View Full Version : postConstructor issue

08-24-2006, 08:03 PM
Hi. I am trying to read one of the plugs on Custom node in postConstructor.
But seems like I am not getting Object handle properly. And I read the old Alias web
site which says......


I'm writing a custom MPxNode and want to make certain connections between it
and a scene node once its created. Can I make these connections in the
postConstructor? Has a node been fully created (with its plugs) at this point?


It is safe to access and modify the node's plug values within the
postConstructor() method. But it is not safe to connect plugs at this point.
This is because when the postConstructor is called, the node has not been added
to the dependency graph but the node itself and all its plugs have been created
and initialized. That's why its safe to access and modify the plugs but you
can't do any connections on the node.
Here is my code.

void ctNode :: PostConstructor(){
MObject thisNode=thisMObject();
MString lpath;
MPlug fpplug(thisNode,m_aFilePath);

I am not sure what the problem is.I also tryed to use MFnDependencyNode to find a plug.
But it did not work neither.
Any Help would be appreciated.


08-25-2006, 01:17 AM
I have to use MEventMessage ha?
Ummm, I think there is a lot of situation like you want to initialize the node first
everytime you open up the scene,
but there is no way?

08-25-2006, 02:50 AM
I could not call MObject thisNode=thisMObject(); without object in callback function.
Does anyone have idea?
Thanks in advance.

Robert Bateman
08-29-2006, 01:24 PM
use the clientData pointer when you set your callback up to be the this pointer to your node. Then, in your callback, cast the void* back to your node type. You can then call any member functions on it that you want....

08-29-2006, 07:43 PM
I cast the void* back to my node type, then it worked!!:thumbsup:
Thanks Robert Bateman!!. I am appreciate for your help.

08-29-2006, 07:44 PM
I casted the void* back to my node type, then it worked!!:thumbsup:
Thanks Robert Bateman!!. I am appreciate for your help.

CGTalk Moderation
08-29-2006, 07:44 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.