MDGModifier !

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 10 October 2005   #1
MDGModifier !

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.


#include<maya/MPXCommand.h>
#include<maya/MGlobal.h>
#include<maya/MFnPlugin.h>
#include<maya/MFnDependencyNode.h>
#include<maya/MDGModifier.h>

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



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

MStatus uninitializePlugin(MObject obj){
MFnPlugin pluginFn(obj);
MStatus stat;
stat = pluginFn.deregisterCommand("myPlug");
if(!stat)
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);

mdg.connect(FnmakeSphere.findPlug("outputSurface"),Fnsphere.findPlug("create"));
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 ?
 
Old 10 October 2005   #2
hmm,
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 !!!
 
Old 10 October 2005   #3
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 02:47 AM.


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