本文整理汇总了C++中MDagPath::extendToShapeDirectlyBelow方法的典型用法代码示例。如果您正苦于以下问题:C++ MDagPath::extendToShapeDirectlyBelow方法的具体用法?C++ MDagPath::extendToShapeDirectlyBelow怎么用?C++ MDagPath::extendToShapeDirectlyBelow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDagPath
的用法示例。
在下文中一共展示了MDagPath::extendToShapeDirectlyBelow方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readObject
ConstObjectPtr LiveScene::readObject( double time ) const
{
tbb::mutex::scoped_lock l( s_mutex );
if( m_dagPath.length() == 0 && !m_isRoot )
{
throw Exception( "IECoreMaya::LiveScene::readObject: Dag path no longer exists!" );
}
if( fabs( MAnimControl::currentTime().as( MTime::kSeconds ) - time ) > 1.e-4 )
{
throw Exception( "IECoreMaya::LiveScene::readObject: time must be the same as on the maya timeline!" );
}
for ( std::vector< CustomReader >::const_reverse_iterator it = customObjectReaders().rbegin(); it != customObjectReaders().rend(); it++ )
{
if ( it->m_has( m_dagPath ) )
{
return it->m_read( m_dagPath );
}
}
// if no custom object was detected, we try the general cortex converter
unsigned int childCount = 0;
m_dagPath.numberOfShapesDirectlyBelow(childCount);
for ( unsigned int c = 0; c < childCount; c++ )
{
MDagPath childDag = m_dagPath;
if( childDag.extendToShapeDirectlyBelow( c ) )
{
MFnDagNode fnChildDag(childDag);
if ( fnChildDag.isIntermediateObject() )
{
continue;
}
FromMayaShapeConverterPtr shapeConverter = FromMayaShapeConverter::create( childDag );
if( shapeConverter )
{
return shapeConverter->convert();
}
FromMayaDagNodeConverterPtr dagConverter = FromMayaDagNodeConverter::create( childDag );
if( dagConverter )
{
ObjectPtr result = dagConverter->convert();
Camera *cam = runTimeCast< Camera >( result.get() );
if( cam )
{
// Cameras still carry the transform when converted from maya,
// so we have to remove them after conversion.
cam->setTransform( new MatrixTransform( Imath::M44f() ) );
}
return result;
}
}
}
return IECore::NullObject::defaultNullObject();
}
示例2: getShapeNode
MStatus sgCurveEditBrush_context::getShapeNode( MDagPath& path )
{
MStatus status;
if ( path.apiType() == MFn::kNurbsCurve )
{
return MS::kSuccess;
}
unsigned int numShapes;
status = path.numberOfShapesDirectlyBelow( numShapes );
CHECK_MSTATUS_AND_RETURN_IT( status );
for ( unsigned int i = 0; i < numShapes; ++i )
{
status = path.extendToShapeDirectlyBelow( i );
CHECK_MSTATUS_AND_RETURN_IT( status );
if ( !path.hasFn( MFn::kNurbsCurve ) )
{
path.pop();
continue;
}
MFnDagNode fnNode( path, &status );
CHECK_MSTATUS_AND_RETURN_IT( status );
if ( !fnNode.isIntermediateObject() )
{
return MS::kSuccess;
}
path.pop();
}
return MS::kFailure;
}
示例3: hasObject
bool LiveScene::hasObject() const
{
tbb::mutex::scoped_lock l( s_mutex );
if( m_isRoot )
{
return false;
}
else if( m_dagPath.length() == 0 && !m_isRoot )
{
throw Exception( "IECoreMaya::LiveScene::hasObject: Dag path no longer exists!" );
}
for ( std::vector< CustomReader >::const_reverse_iterator it = customObjectReaders().rbegin(); it != customObjectReaders().rend(); it++ )
{
if ( it->m_has( m_dagPath ) )
{
return true;
}
}
// if no custom object was detected, we try the general cortex converter
unsigned int childCount = 0;
m_dagPath.numberOfShapesDirectlyBelow(childCount);
for ( unsigned int c = 0; c < childCount; c++ )
{
MDagPath childDag = m_dagPath;
if( childDag.extendToShapeDirectlyBelow( c ) )
{
MFnDagNode fnChildDag(childDag);
if ( fnChildDag.isIntermediateObject() )
{
continue;
}
FromMayaShapeConverterPtr shapeConverter = FromMayaShapeConverter::create( childDag );
if( shapeConverter )
{
return true;
}
FromMayaDagNodeConverterPtr dagConverter = FromMayaDagNodeConverter::create( childDag );
if( dagConverter )
{
return true;
}
}
}
return false;
}
示例4: FindSkinnerNodesInHierarchy
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
MStatus CVsSkinnerCmd::FindSkinnerNodesInHierarchy(
const MDagPath &iDagPath,
MSelectionList &oList )
{
MStatus retVal( MS::kFailure );
MDagPath rDagPath( iDagPath ); // Root dag path
while ( rDagPath.length() > 1U )
{
rDagPath.pop();
}
MDagPath mDagPath;
MDagPath sDagPath;
uint nShapes;
MItDag dIt;
if ( rDagPath.length() )
{
dIt.reset( rDagPath );
}
for ( ; !dIt.isDone(); dIt.next() )
{
if ( !dIt.getPath( mDagPath ) )
continue;
mDagPath.numberOfShapesDirectlyBelow( nShapes );
for ( uint i( 0U ); i != nShapes; ++i )
{
sDagPath = mDagPath;
sDagPath.extendToShapeDirectlyBelow( i );
if ( !IsSkinnerNode( sDagPath ) )
continue;
oList.add( sDagPath, MObject::kNullObj, true );
retVal = MS::kSuccess;
}
if ( !ConnectedToSkinnerNode( mDagPath, sDagPath ) )
continue;
oList.add( sDagPath, MObject::kNullObj, true );
retVal = MS::kSuccess;
}
return retVal;
}
示例5: getDagPath
MStatus Object::setShapesVisibility(bool visible, MTypeId & typeId) {
MStatus status;
MDagPath dagPath = getDagPath(status);
if (!status) {
status.perror("Object::getDagPath");
return status;
}
unsigned int numShapes;
if (!(status = dagPath.numberOfShapesDirectlyBelow(numShapes))) {
status.perror("MDagPath::numberOfShapesDirectlyBelow");
return status;
}
for(unsigned int i = 0; i < numShapes; ++i) {
MDagPath shape = dagPath;
if (!(status = shape.extendToShapeDirectlyBelow(i))) {
status.perror("MDagPath::extendToShapeDirectlyBelow");
return status;
}
MFnDagNode shape_dagNode(shape);
if (shape_dagNode.typeId(&status) == typeId) {
MPlug visibilityPlug(shape.node(), shape_dagNode.findPlug("visibility", &status));
if (!status) {
status.perror("MFnDagNode::findPlug");
return status;
}
if (!(status = visibilityPlug.setBool(visible))) {
status.perror("MPlug::setBool");
return status;
}
}
else if (!status) {
status.perror("MFnDagNode::typeId");
return status;
}
}
return MStatus::kSuccess;
}
示例6: GetSpecifiedMeshes
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CVstSelectCoincidentFacesCmd::GetSpecifiedMeshes(
MSelectionList &meshList )
{
meshList.clear();
MSelectionList optSelectionList;
m_undo.ArgDatabase().getObjects( optSelectionList );
MDagPath mDagPath;
MObject cObj;
for ( MItSelectionList sIt( optSelectionList ); !sIt.isDone(); sIt.next() )
{
if ( sIt.itemType() == MItSelectionList::kDagSelectionItem && sIt.getDagPath( mDagPath, cObj ) )
{
if ( mDagPath.hasFn( MFn::kMesh ) )
{
if ( sIt.hasComponents() || !cObj.isNull() )
{
meshList.add( mDagPath, cObj );
}
else
{
mDagPath.extendToShapeDirectlyBelow( 0U );
meshList.add( mDagPath, MObject::kNullObj, true );
}
}
}
}
if ( meshList.isEmpty() )
{
for ( MItDag dIt( MItDag::kDepthFirst, MFn::kMesh ); !dIt.isDone(); dIt.next() )
{
if ( dIt.getPath( mDagPath ) )
{
meshList.add( mDagPath, MObject::kNullObj, true );
}
}
}
}
示例7: CVCurveFromObject
MStatus CVCurveFromObject(const Model::Object & object, MPointArray & array) {
MStatus status;
MDagPath dagPath = object.getDagPath(status);
if (!status) {
status.perror("Object::getDagPath");
return status;
}
MDagPath shape = dagPath;
unsigned int numShapes;
if (!(status = dagPath.numberOfShapesDirectlyBelow(numShapes))) {
status.perror("MDagPath::numberOfShapesDirectlyBelow");
return status;
}
for(unsigned int i = 0; i < numShapes; ++i) {
if (!(status = shape.extendToShapeDirectlyBelow(i))) {
status.perror("MDagPath::extendToShapeDirectlyBelow");
return status;
}
if (shape.hasFn(MFn::kNurbsCurve)) {
MFnNurbsCurve nurbsCurve(shape);
if (!(status = nurbsCurve.getCVs(array, MSpace::kWorld))) {
status.perror("MFnNurbsCurve::getCVs");
return status;
}
return MStatus::kSuccess;
}
else
std::cerr << "No MFnNurbsCurve!" << std::endl;
}
return MStatus::kNotFound;
}
示例8: GetSpecifiedMeshes
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
MStatus CVsSkinnerCmd::GetSpecifiedMeshes(
const MSelectionList &iList,
MSelectionList &oList )
{
MStatus retVal( MS::kFailure );
oList.clear();
MDagPath mDagPath;
for ( MItSelectionList sIt( iList ); !sIt.isDone(); sIt.next() )
{
if ( sIt.itemType() == MItSelectionList::kDagSelectionItem && sIt.getDagPath( mDagPath ) )
{
if ( mDagPath.hasFn( MFn::kMesh ) )
{
mDagPath.extendToShapeDirectlyBelow( 0 );
oList.add( mDagPath, MObject::kNullObj, true );
retVal = MS::kSuccess;
}
}
}
MSelectionList tmpList;
for ( MItSelectionList sIt( iList ); !sIt.isDone(); sIt.next() )
{
if ( sIt.itemType() == MItSelectionList::kDagSelectionItem && sIt.getDagPath( mDagPath ) )
{
if ( FindMeshesInHierarchy( mDagPath, tmpList ) )
{
oList.merge( tmpList );
retVal = MS::kSuccess;
}
}
}
return retVal;
}
示例9: readAttribute
ConstObjectPtr LiveScene::readAttribute( const Name &name, double time ) const
{
if ( !m_isRoot && m_dagPath.length() == 0 )
{
throw Exception( "IECoreMaya::LiveScene::readAttribute: Dag path no longer exists!" );
}
tbb::mutex::scoped_lock l( s_mutex );
if ( !m_isRoot )
{
if( name == SceneInterface::visibilityName )
{
bool visible = true;
MStatus st;
MFnDagNode dagFn( m_dagPath );
MPlug visibilityPlug = dagFn.findPlug( MPxTransform::visibility, &st );
if( st )
{
visible = visibilityPlug.asBool();
}
if( visible )
{
MDagPath childDag;
// find an object that's either a SceneShape, or has a cortex converter and check its visibility:
unsigned int childCount = 0;
m_dagPath.numberOfShapesDirectlyBelow(childCount);
for ( unsigned int c = 0; c < childCount; c++ )
{
MDagPath d = m_dagPath;
if( d.extendToShapeDirectlyBelow( c ) )
{
MFnDagNode fnChildDag(d);
if( fnChildDag.typeId() == SceneShape::id )
{
childDag = d;
break;
}
if ( fnChildDag.isIntermediateObject() )
{
continue;
}
FromMayaShapeConverterPtr shapeConverter = FromMayaShapeConverter::create( d );
if( shapeConverter )
{
childDag = d;
break;
}
FromMayaDagNodeConverterPtr dagConverter = FromMayaDagNodeConverter::create( d );
if( dagConverter )
{
childDag = d;
break;
}
}
}
if( childDag.isValid() )
{
MFnDagNode dagFn( childDag );
MPlug visibilityPlug = dagFn.findPlug( MPxSurfaceShape::visibility, &st );
if( st )
{
visible = visibilityPlug.asBool();
}
}
}
return new BoolData( visible );
}
}
else if( name == SceneInterface::visibilityName )
{
return new BoolData( true );
}
std::vector< CustomAttributeReader > &attributeReaders = customAttributeReaders();
for ( std::vector< CustomAttributeReader >::const_reverse_iterator it = attributeReaders.rbegin(); it != attributeReaders.rend(); ++it )
{
ConstObjectPtr attr = it->m_read( m_dagPath, name );
if( !attr )
{
continue;
}
return attr;
}
if( strstr( name.c_str(), "user:" ) == name.c_str() )
{
MStatus st;
//.........这里部分代码省略.........