[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 CLOSED
 
Thread Tools Search this Thread Display Modes
Old 02 February 2011   #1
[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.
 
Old 02 February 2011   #2
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
 
Old 02 February 2011   #3
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.
 
Old 02 February 2011   #4
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);		   
   
     dgMod.connect(deplocatorNodeFn.findPlug("outData"),depcalculatingNodeFn.findPlug("inData"));
   	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.
 
Old 02 February 2011   #5
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
 
Old 02 February 2011   #6
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.
 
Old 02 February 2011   #7
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 09:34 PM.


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