Ejemplo n.º 1
0
void disconnectMesh(MObject & iMeshObject,
    std::vector<Prop> & iSampledPropList,
    std::size_t iFirstProp)
{
    MFnMesh fnMesh;
    fnMesh.setObject(iMeshObject);

    // disconnect old connection from AlembicNode or some other nodes
    // to inMesh if one such connection exist
    MPlug dstPlug = fnMesh.findPlug("inMesh");
    disconnectAllPlugsTo(dstPlug);

    disconnectProps(fnMesh, iSampledPropList, iFirstProp);

    clearPt(fnMesh);

    return;

}
void disconnectMesh(MObject & iMeshObject,
    std::vector<std::string> & oSampledPropNameList)
{
    MFnMesh fnMesh;
    fnMesh.setObject(iMeshObject);

    // disconnect old connection from AlembicNode or some other nodes
    // to inMesh if one such connection exist
    MPlug dstPlug = fnMesh.findPlug("inMesh");
    disconnectAllPlugsTo(dstPlug);

    // get prop names and make sure they are disconnected before
    // trying to connect to them
    // disconnect connections to animated props
    //dstPlug = fnMesh.findPlug(propName.c_str());
    // disconnectAllPlugsTo(dstPlug);

    clearPt(fnMesh);

    return;

}
Ejemplo n.º 3
0
void disconnectProps(MFnDependencyNode & iNode,
    std::vector<Prop> & iSampledPropList,
    std::size_t iFirstProp)
{
    // get prop names and make sure they are disconnected before
    // trying to connect to them
    std::size_t numProps = iSampledPropList.size();
    for (std::size_t i = iFirstProp; i < numProps; ++i)
    {
        std::string propName;
        if (iSampledPropList[i].mArray.valid())
        {
            propName = iSampledPropList[i].mArray.getName();
        }
        else
        {
            propName = iSampledPropList[i].mScalar.getName();
        }

        // disconnect connections to animated props
        MPlug dstPlug;
        if (propName == Alembic::AbcGeom::kVisibilityPropertyName)
        {
            dstPlug = iNode.findPlug("visibility");
        }
        else
        {
            dstPlug = iNode.findPlug(propName.c_str());
        }

        // make sure the long name matches
        if (propName == Alembic::AbcGeom::kVisibilityPropertyName ||
            dstPlug.partialName(false, false, false, false, false, true) == propName.c_str())
        {
            disconnectAllPlugsTo(dstPlug);
        }
    }
}