Может ли кто -нибудь объяснить, почему это так, и как сделать пользовательскую функцию mpxmanipulatornode , из DoreLease () , выборочной?
Код: Выделить всё
struct LineManip : MPxManipulatorNode
{
static MTypeId id;
...
};
MTypeId LineManip::id = 0x81047;
struct ToyManipContainer : MPxManipContainer
{
static MTypeId id;
...
MStatus addLineManip( const MString& name_, double y_ = 0.0 )
{
MStatus status = MStatus::kSuccess;
MPxManipulatorNode* proxyManip = 0;
MString manipTypeName("LineManip");
status = addMPxManipulatorNode( manipTypeName, name_, proxyManip );
CHECK_STATUS_AND_RETURN_IF_FAIL( status, "Failed in addMPxManipulatorNode." );
// Position the new line manip at a certain height.
LineManip* tmpManipPtr = (LineManip*) proxyManip;
tmpManipPtr->start.y = y_;
tmpManipPtr->end.y = y_;
return status;
}
MStatus createChildren() override
{
MStatus status = MS::kSuccess;
// Creates a new line manip upon initialization.
// The manip is created and is selectable.
status = addLineManip( MString("foo"), 0.0 );
CHECK_STATUS_AND_RETURN_IF_FAIL( status, "Failed to create the temp LineManip." );
return status;
}
MStatus doRelease() override
{
MStatus status = MStatus::kSuccess;
// Creates a new line manip upon the release of a mouse button.
// Problem: The new manip is created, but it's not selectable.
status = addLineManip( MString("bar"), 0.5 );
CHECK_STATUS_AND_RETURN_IF_FAIL( status, "Failed to add LineManip in ToyManipContainer." );
return status;
}
};
MTypeId ToyManipContainer::id = 0x81559;
Подробнее здесь: https://stackoverflow.com/questions/795 ... maya-c-api