Пример #1
0
void getDirectConnectedPlugs(const char *attrName, MFnDependencyNode& depFn, bool dest, MPlugArray& thisNodePlugs, MPlugArray& otherSidePlugs)
{
	MPlug thisPlug = depFn.findPlug(attrName);
	if (!thisPlug.isArray())
	{
		if (thisPlug.isConnected())
		{
			thisNodePlugs.append(thisPlug);
			otherSidePlugs.append(getDirectConnectedPlug(thisPlug, dest));
		}
		return;
	}
	for (uint i = 0; i < thisPlug.numElements(); i++)
	{
		if (thisPlug.isCompound())
		{
			// we only support simple compounds like colorListEntry
			if (MString(attrName) == MString("colorEntryList"))
			{
				MPlug element = thisPlug[i];
				if (element.child(0).isConnected())
				{
					MPlug connectedPlug = element.child(0);
					thisNodePlugs.append(connectedPlug);
					otherSidePlugs.append(getDirectConnectedPlug(connectedPlug, dest));
				}
				if (element.child(1).isConnected())
				{
					MPlug connectedPlug = element.child(1);
					thisNodePlugs.append(connectedPlug);
					otherSidePlugs.append(getDirectConnectedPlug(connectedPlug, dest));
				}
			}
		}
		else{
			if (!thisPlug[i].isConnected())
			{
				continue;
			}
			MPlug connectedPlug = thisPlug[i];
			thisNodePlugs.append(connectedPlug);
			otherSidePlugs.append(getDirectConnectedPlug(connectedPlug, dest));
		}
	}

}
Пример #2
0
void getConnectedChildPlugs(const MPlug& plug, bool dest, MPlugArray& thisNodePlugs, MPlugArray& otherSidePlugs)
{
    if (plug.numConnectedChildren() == 0)
        return;
    for (uint chId = 0; chId < plug.numChildren(); chId++)
        if (plug.child(chId).isConnected())
        {
            if ((plug.child(chId).isDestination() && dest) || (plug.child(chId).isSource() && !dest))
            {
                thisNodePlugs.append(plug.child(chId));
                otherSidePlugs.append(getDirectConnectedPlug(plug, dest));
            }
        }
}