Crash while creating a sphere in custom node

   965   1   1
User Avatar
Member
1 posts
Joined: Oct. 2017
Offline
I have a custom Sop node. There is a button and on it's callback I want to create a sphere.

Like this:

int MyNode::myCallback(.....) {

GU_PrimSphereParms parms(me->gdp);
parms.freq = 1;

GEO_Primitive *sphere = GU_PrimSphere::build(parms, GEO_PRIMSPHERE);

sphere->setPos3(0, UT_Vector3F(0, 0, 0));

}

However, I get this crash:

Caught signal 11

Traceback from 15252 ThreadId=0x00000458
CURRENT THREAD 1112
+0x85900b7d [GA_Detail::appendPrimitive]
+0x85f3293c [GEO_Quadric::build]
+0x85c86dd9 [GEO_PrimSphere::build]
+0x867c8a22 [GU_PrimSphere::build]

Is it some wrong thread issue? ANy other way to do it? If I add the sphere in cookMySop it works fine.
Any help would be appreciated!
Edited by neil_math_comp - April 30, 2018 11:03:44
User Avatar
Member
1743 posts
Joined: March 2012
Offline
It's hard to tell without the code or the rest of the stack trace, but are you 100% sure the detail isn't null or deleted? SOP_Node::gdpusually isn't valid unless a cook is currently occurring. (I think it's usually null, but I could be wrong.) There are other ways to get the geometry if the cook isn't currently taking place.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
  • Quick Links