- This topic has 3 replies, 2 voices, and was last updated 6 years, 10 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Programming with SOFA › [SOLVED] How can I get a OglModel object from c++ code for a Scena?
I need to get OglModel node from c++ code and set data on it in a Scena, I tried to get that with the following code:
sofa::helper::vector< sofa::component::visualmodel::OglModel* > list_collisionModels;
static_cast(this->getContext())->get< sofa::component::visualmodel::OglModel >( &list_collisionModels );
But I get the following error:
error: expected ‘<’ before ‘(’ token
static_cast(this->getContext())->get<sofa::component::visualmodel::OglModel >(&list_collisionModels );
How can I fix it or if there are other forms that I can set values over OglModel node.
I appreciate very much the help that you can give me.
(I’m using Fedora 24 x64)
Regards Andrés Sánchez.
Dear Andres,
Welcome on the SOFA forum for your first question!
I would have written it this way:
sofa::helper::vector< sofa::component::visualmodel::OglModel* > list_collisionModels;
this->getContext()->get< sofa::component::visualmodel::OglModel >( &list_collisionModels );
Let us know if it works.
Best,
Hugo
I tried to use the code that you give me, but this didn’t work.
I solved this problem using std::vector and not sofa::helper::vector, additionally I didn’t use “this->” I only code with getContext()…….
Thank you for your help.
Regards,
Andrés Sánchez.
Great to hear, good luck for the next steps Andrés.
Anytime do not hesitate to post your issues.
Best,
Hugo
PS: I mark your topic as resolved.
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.