View Full Version : MDGModifier !

10 October 2005, 03:08 AM
When create a sphere in maya, looking in hypergraph, i see that there are two node with connection between them, one is nurbsSphere, and the other is makeNurbSphere. The ouputsurface attribute of makeNurbSphere is connected to the create Attr of nurbsSphere.
So, i tried to make the same thing with maya API.

When using MFnDependencyNode to create node, it work ok. But when i use MDGModifier, it doesn't work (the compilation is ok). Load my plugin in maya, execute the my command, and nothing happen, no node was created !

Here is my code.


class myCmd : public MPxCommand{
virtual MStatus doIt(const MArgList&);
virtual MStatus undoIt();
virtual MStatus redoIt();
virtual bool isUndoable() const{return true;};
static void *creator(){return new myCmd;}
MDGModifier mdg;

MStatus initializePlugin(MObject obj){
MFnPlugin pluginFn(obj,"","1.0");
MStatus stat;
stat = pluginFn.registerCommand("myPlug",myCmd::creator);
stat.perror("registerCommand failed");
return stat;

MStatus uninitializePlugin(MObject obj){
MFnPlugin pluginFn(obj);
MStatus stat;
stat = pluginFn.deregisterCommand("myPlug");
stat.perror("deregisterCommand failed");
return stat;

//doIt function

MStatus myCmd::doIt(const MArgList&){

MObject sphere=mdg.createNode("nurbsSurface");
MObject makeSphere=mdg.createNode("makeNurbSphere");
MFnDependencyNode Fnsphere(sphere);
MFnDependencyNode FnmakeSphere(makeSphere);

return redoIt();

MStatus myCmd::redoIt(){
return mdg.doIt();

MStatus myCmd::undoIt(){
return mdg.undoIt();

The implementation like the one of David Gould (complete maya program).

Did i miss something ? :cry:

10 October 2005, 06:10 AM
It take me a long time to test other nodes like blinn, lambert... and these nodes work ok, only nodes like nurbsSphere, circle .... doesn't.
I don't know why !!! :banghead:

CGTalk Moderation
10 October 2005, 06:10 AM
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.