Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / SDK / Instantiating a custom node from C++?
  RSS 2.0 ATOM  

Instantiating a custom node from C++?
Rate this thread
 
33942
 
Permlink of this thread  
avatar
  • koalak
  • Posted: 02 September 2009 02:43 AM
  • Total Posts: 4
  • Joined: 01 September 2009 09:53 AM

Hello;
Is there any c++ way to create a node from a custom type?

I’m searching for something more elegant than:

MGlobal::executeCommand("createNode myCustomNode")


Replies: 0
avatar
  • koalak
  • Posted: 02 September 2009 02:55 AM

Funny enough, by googling my question I found an answer elsewhere :)
anyway, here’s what I get :

MDagModifier dagMod;
MObject obj dagMod.createNode(myCustomNode::id)
dagMod
.doIt()

That works pretty well, but how to retrieve the myCustomNode* actual pointer then?
By the way, how do I make sure myCustomNode::id is unique and not used within another plugin?



Replies: 0
avatar
  • rebb
  • Posted: 01 June 2010 06:57 AM

By dishing out at least 1300$ for an ADN Subscription.

Autodesk doesn’t want you to improve the software without paying them first.

Which punches people like Students or people who want to release Plug-Ins for free right in the face.

I guess taking a random ID and hoping for the best is thus the officially accepted method if you can’t afford it.



Replies: 0
avatar

hi there

you can use second method in the class which allows you to create nodes via their names.

MObject oMyNode = dgMod.createNode("Name of the node as MString")

http://download.autodesk.com/us/...9500f5c1f8516c76ea03f92d6

btw I agree with you in terms of ADN! as far as I know APi support was free back in AW.



Replies: 0
avatar

koalak 02 September 2009 09:55 AM

Funny enough, by googling my question I found an answer elsewhere :)
anyway, here’s what I get :

MDagModifier dagMod;
MObject obj dagMod.createNode(myCustomNode::id)
dagMod
.doIt()

That works pretty well, but how to retrieve the myCustomNode* actual pointer then?
By the way, how do I make sure myCustomNode::id is unique and not used within another plugin?

Is this method as well correct for iterating customNode???

// loop for iterating on locator type.
for ( MItDependencyNodes itermyCustomNode::id ); !iter.isDone(); iter.next()){
   MObject 
iter.item();
   
//do something
}


Replies: 0