Exemple #1
0
void EntityInstanceNode::Flatten()
{
    EntityNode& instanceClassNode = EntityNode::Get( m_Entity->GetEntity()->GetPath() );

    if( instanceClassNode == EntityNode::Null )
        return;

    MFnDagNode instanceFn( thisMObject() );

    MFnDagNode nodeFn( instanceClassNode.thisMObject() );
    u32 len = nodeFn.childCount();

    MDagPath path;
    MFnTransform newTransformFn;
    MObject newTransform = newTransformFn.create();

    MTransformationMatrix matrix = instanceFn.transformationMatrix();
    newTransformFn.set( matrix );
    newTransformFn.getPath( path );

    for( u32 i = 0; i < len; ++i )
    {
        MFnDagNode nodeFn( nodeFn.child( i ) );

        MDagPath child;
        nodeFn.getPath( child );
        MDagPath result;

        Maya::duplicate( child, path, result, false, false );
    }

    Maya::LockHierarchy( thisMObject(), false );
}
Exemple #2
0
MObject HesperisTransformCreator::create(BaseTransform * data, MObject & parentObj,
                       const std::string & nodeName)
{
    MObject otm = MObject::kNullObj;
    if(!HesperisIO::FindNamedChild(otm, nodeName, parentObj)) {
        MFnTransform ftransform;
        otm = ftransform.create(parentObj);

        std::string validName(nodeName);
        SHelper::noColon(validName);
        ftransform.setName(validName.c_str()); 
    }
    // MGlobal::displayInfo(MString("todo transform in ")+nodeName.c_str()); 
    return otm;
}
Exemple #3
0
bool HesperisIO::ReadTransforms(HBase * parent, MObject &target)
{
    std::vector<std::string > tmNames;
    parent->lsTypedChild<HTransform>(tmNames);
	std::vector<std::string>::const_iterator it = tmNames.begin();
	
    for(;it!=tmNames.end();++it) {
        std::string nodeName = *it;
        SHelper::behead(nodeName, parent->pathToObject());
        SHelper::behead(nodeName, "/");
        HBase child(*it);
        MObject otm = MObject::kNullObj;
        if(!FindNamedChild(otm, nodeName, target)) {
            MFnTransform ftransform;
            otm = ftransform.create(target);
            SHelper::noColon(nodeName);
            ftransform.setName(nodeName.c_str()); 
        }
        ReadTransforms(&child, otm);
        ReadCurves(&child, otm);
        child.close();
	}
    return true;
}