c++ - Pass custom data to attributes of MPxLocator (Maya API) -
in cpp class using maya api, initiate custom mpxlocator instance called mylocatornode , pass attributes variables:
mdagmodifier dagmod; mdgmodifier mdgmod; myobj=dagmod.createnode("mylocatornode", <existing transform mobject>); dagmod.doit(); mfndagnode mydagnode(myobj); mydagnode.findplug("attributeone").setvalue(1.5); mydagnode.findplug("attributetwo").setvalue(2.0); mydagnode.findplug("attributethree").setvalue(3.1); mydagnode.findplug("classattrib").setvalue(classpointer); // <- type should use ?
custom locator class:
mstatus mylocatornode::initialize() { mfnnumericattribute nattr; mfn???attribute customattr; <-- can use here ? attr1= nattr.create( "attributeone", "ao", mfnnumericdata::kfloat,1.0 ); attr2= nattr.create( "attributetwo", "ao", mfnnumericdata::kfloat,1.0 ); attr3= nattr.create( "attributethree", "ao", mfnnumericdata::kfloat,1.0 ); attr4= customattr.create("classattrib","ca", mycustomclass *); <-- , here ? ... }
i pass attribute/plug pointer custom class. attribute type in locator class me doing ? thanks
mfn???attribute customattr; <-- can use here ?
well, class pointer mean memory address? on x64 bit machine pointer int64, need store int64 integer. can use mfnnumericattribute::createaddress() way or store own int64 described here: http://around-the-corner.typepad.com/adn/2012/11/no-64bit-integer-attribute-in-maya-no-way.html
Comments
Post a Comment