THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/05/2011 at 16:03, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
I'm trying to convert this python code to C++:
import c4d
from c4d import gui
def main() :
nm = doc.GetActiveTag().GetNodeMaster() #Get the node master of selected xpresso tag
node = nm.CreateNode(nm.GetRoot(), c4d.ID_OPERATOR_OBJECT,insert=None, x=200, y=200) #Create the object's node
node.AddPort(c4d.GV_PORT_OUTPUT, c4d.ID_BASEOBJECT_POSITION) #add a position output port to the object node
print node.GetOperatorContainer()[c4d.GV_OBJECT_OBJECT_ID].GetName() #print name
c4d.EventAdd()
if __name__=='__main__':
main()
But I'm having lots of trouble figuring out how to properly use the GvNode and GvNodeMaster types:
Bool SimplePlugin::Execute(BaseDocument *doc)
{
BaseObject *obj = doc->GetFirstObject();
if(!obj) return true;
BaseTag *xtag = obj->MakeTag(Texpresso, NULL);
xtag->SetBit(BIT_ACTIVE);
///////////// Everything is working fine up to here /////////////////
GvNodeMaster *nm = doc->GetActiveTag()->GetNodeMaster(); //Error: BaseTag has no member GetnodeMaster
GvNode *node = nm->CreateNode(nm->GetRoot(), ID_OPERATOR_OBJECT, insert=None, x=200, y=200); //<--wrong
node->AddPort(GV_PORT_OUTPUT, ID_BASEOBJECT_POSITION); //<--wrong
EventAdd();
return true;
}
Can anyone help?
-ScottA