[C++] dg.createNode odd behavior

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  02 February 2011
[C++] dg.createNode odd behavior

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 February 2011
Originally Posted by ganzo: 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 February 2011
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 February 2011
Originally Posted by Robert Bateman: 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");
   	MFnDependencyNode depcalculatingNodeFn(calculatingNodeObj);
   	MFnDependencyNode deplocatorNodeFn(locatorNodeObj);		   
   	return redoIt();

I had posted the code for the other nodes here if you would not mind taking a peek:
Passing MPointArray between nodes

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.

Last edited by ganzo : 02 February 2011 at 07:09 PM.
  02 February 2011
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 February 2011
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 February 2011
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:08 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.