View Full Version : [C++] dg.createNode odd behavior
02-02-2011, 08:54 AM
I'm facing a strange problem and I have never encountered it before. I have 2 nodes initialized..one of type MPxLocator and another MPxNode. During plugin tests I had been creating and connecting the nodes manually through command line. However I just created a command that does this and it only creates the MPxNode...it of course crashes since it is trying to connect to a node that does not exist, but I commented everything but the create operations and same thing....only one node is created.
Am I forgetting something here? I mean what I am doing is pretty trivial...not sure If something slipped my mind. Like I said...funny thing is that out of two nodes....it only creates one.
02-02-2011, 02:52 PM
Like I said...funny thing is that out of two nodes....it only creates one.
Got to be honest, with no code posted in your question, I'm inclined to say, I don't believe you. If you are creating 2 nodes correctly, then connecting their attributes is trivial. The only reason it can ever fail is because you have made a mistake. Of course, since you've been testing every single MStatus return code, you will already know what function call is failing, and will already know how to fix it ;)
02-02-2011, 05:32 PM
When you try to make a connection in Maya to a node that does not exist, Maya will only give out an error. It does not just crash. So I guess at least something is not robust enough with your command code in the first place.
02-02-2011, 06:49 PM
Got to be honest, with no code posted in your question, I'm inclined to say, I don't believe you.
Wow, that was direct....you could just have asked for the code :)
Sorry Robert, I didn't post the code because it IS trivial....I have also received comments in the past about not posting lots of code...and sometimes people say to post more code..I'm confused....Now like I said...since I can create both nodes manually through the command line and connect them and see them working....I assumed that nothing is wrong with the code belonging to each node. Of course...assumptions are the mother of all screw ups...The code for the command is here:
MStatus customCmd::doIt ( const MArgList &args )
MObject locatorNodeObj = dgMod.createNode("locatorNode");
MObject calculatingNodeObj = dgMod.createNode("calculatingNode");
I had posted the code for the other nodes here if you would not mind taking a peek:
Passing MPointArray between nodes (http://forums.cgsociety.org/showthread.php?f=89&t=944246)
I did have some problems with such code, but after I got it working and ran tests on it...I assumed I had fixed everything.
02-02-2011, 06:56 PM
If it's really like you said, everything works as expected in mel, why don't you try to use MGlobal::executeCommand to call the exact same commands in your custom command and see what happens
02-02-2011, 07:09 PM
Yup I will give it a try....although I still wonder why the above only works for one of the nodes...I went back to the code for the node that is not being created and I still cant find any errors with it...and It still gets created correctly through the command line with createNode...just not within my command.
02-02-2011, 07:09 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.