Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SofaDeformable] Fix RestShapeSpringsForceField #367

Merged

Conversation

EulalieCoevoet
Copy link
Contributor

@EulalieCoevoet EulalieCoevoet commented Aug 18, 2017

1- In SceneCheckerVisitor:
Fixed segfault. Please review, I'm not sure about the fix.

2- In RestShapeSpringForceField:
Fixed segfault when using the component without external_rest_shape, by removing a "return" that was unintentionally introduced in #315. (line 95)
And the error message should be print only if external_rest_shape is set by user. (line 93)

And minor cleaning.


This PR:

  • builds with SUCCESS for all platforms on the CI.
  • does not generate new warnings.
  • does not generate new unit test failures.
  • does not generate new scene test failures.
  • does not break API compatibility.
  • is more than 1 week old (or has fast-merge label).

Reviewers will merge only if all these checks are true.

@EulalieCoevoet EulalieCoevoet added pr: clean Cleaning the code pr: fix Fix a bug labels Aug 18, 2017
@@ -62,7 +62,7 @@ void SceneCheckerVisitor::addHookInChangeSet(const std::string& version, ChangeS
void SceneCheckerVisitor::installChangeSets()
{
addHookInChangeSet("17.06", [](Base* o){
if(o->getClassName() == "RestShapeSpringsForceField" && o->findData("external_rest_shape")->isSet())
if(o->getClassName() == "RestShapeSpringsForceField" && o->findLink("external_rest_shape")->getSize() != 0)
msg_warning(o) << "RestShapeSpringsForceField have changed since 17.06. The parameter 'external_rest_shape' is now a Link. To fix your scene you need to add and '@' in front of the provided path. See PR#315" ;
Copy link
Contributor

@guparan guparan Aug 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just reading the code, it seems to me that we really want to search for a Data (and raise a warning if we find one).
@damienmarchal ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we want to check is if the object still have "something" with the name "external_rest_shape" and if this thing has be set by the user. Before the merge of PR 315 this thing was a Data, but since the PR it is a Link.

So I think searching for the link is the right thing to do.

@damienmarchal damienmarchal added pr: fast merge Minor change that can be merged without waiting for the 7 review days pr: status to review To notify reviewers to review this pull-request labels Aug 23, 2017

msg_error(this)<< "external_rest_shape in node " << this-> getContext()->getName() << " not found";
//getContext()->removeObject(this);
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raffaellatrivisonne, you added this return in #315. Could you explain why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked and I agree with @EulalieCoevoet.
The return wouldn't allow a default scenario with no external_rest_shape.
Sorry, my bad !!!

@damienmarchal
Copy link
Contributor

damienmarchal commented Aug 23, 2017

So i pass this PR to read ?

Edit: if if the component should work then the correct way to emit the message is msg_warning instead of a msg_error.

@hugtalbot hugtalbot changed the title [modules] Fix RestShapeSpringsForceField [SofaDeformable] Fix RestShapeSpringsForceField Aug 30, 2017
@damienmarchal
Copy link
Contributor

I fixed the conflict...Isn't this PR ready ? @hugtalbot @guparan

@hugtalbot
Copy link
Contributor

I think the PR is ready then, right @damienmarchal ?

@damienmarchal
Copy link
Contributor

damienmarchal commented Sep 1, 2017

[ci-build]

All build & tests are passing... so let's merge it .

@damienmarchal damienmarchal added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Sep 1, 2017
@damienmarchal damienmarchal merged commit adb5974 into sofa-framework:master Sep 1, 2017
matthieu-nesme pushed a commit to Anatoscope/sofa that referenced this pull request Sep 6, 2017
…ringFF

[SofaDeformable] Fix RestShapeSpringsForceField
(cherry picked from commit adb5974)

# Conflicts:
#	SofaKernel/modules/SofaDeformable/RestShapeSpringsForceField.inl
@guparan guparan modified the milestones: v17.06, v17.12 Sep 13, 2017
@damienmarchal damienmarchal deleted the fixRestShapeSpringFF branch September 20, 2017 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: clean Cleaning the code pr: fast merge Minor change that can be merged without waiting for the 7 review days pr: fix Fix a bug pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants