Machen Sie benutzerdefinierte MPXManipulatornodes mit Maya C ++ API ausgewähltC++

Programme in C++. Entwicklerforum
Anonymous
 Machen Sie benutzerdefinierte MPXManipulatornodes mit Maya C ++ API ausgewählt

Post by Anonymous »

Ich habe einen benutzerdefinierten MPXManIpContainer erstellt, der zwei Instanzen eines benutzerdefinierten MPXManipulatornode enthält. Einer der MpxManipulatornode wurde in der Funktion createChildren () des Containers erstellt, und der andere wird auf einer Dorelease () einer Maustaste erstellt. MpxManipulatornode , der während der CreateChildren () Funktion erstellt wurde.

Code: Select all

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;
screenshot aus Plugin:

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post