Skip to content

Commit

Permalink
EMSUSD-261 fix root layer attribute in AE
Browse files Browse the repository at this point in the history
- Add dependencies between file path attribute and the root layer, session layer and prim path attributes.
- Add a sript job to update the root layer and prim field in teh AE when the file path changes.
  • Loading branch information
pierrebai-adsk committed Jul 14, 2023
1 parent f72fa9a commit 3c8307e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/mayaUsd/nodes/proxyShapeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,13 @@ MStatus MayaUsdProxyShapeBase::initialize()
retValue = attributeAffects(filePathAttr, outStageDataAttr);
CHECK_MSTATUS_AND_RETURN_IT(retValue);
retValue = attributeAffects(filePathAttr, outStageCacheIdAttr);
CHECK_MSTATUS_AND_RETURN_IT(retValue);
retValue = attributeAffects(filePathAttr, rootLayerNameAttr);
CHECK_MSTATUS_AND_RETURN_IT(retValue);
retValue = attributeAffects(filePathAttr, sessionLayerNameAttr);
CHECK_MSTATUS_AND_RETURN_IT(retValue);
retValue = attributeAffects(filePathAttr, primPathAttr);
CHECK_MSTATUS_AND_RETURN_IT(retValue);

retValue = attributeAffects(primPathAttr, outStageDataAttr);
CHECK_MSTATUS_AND_RETURN_IT(retValue);
Expand Down
18 changes: 17 additions & 1 deletion plugin/adsk/scripts/AEmayaUsdProxyShapeBaseTemplate.mel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ global proc AEmayaUsdProxyShapeInfoNew(string $input)
AEmayaUsdProxyShapeInfoReplace($input);
}

global proc AEmayaUsdProxyShapeInfoReplace(string $input)
global proc string AEmayaUsdProxyShapeInfoChanged(string $input)
{
// From the input attribute we simply want the node name.
string $nodeName = plugNode($input);
Expand All @@ -24,6 +24,22 @@ global proc AEmayaUsdProxyShapeInfoReplace(string $input)

textFieldGrp -edit -text $rootLayer mayaUsdProxyShapeRootLayer;
textFieldGrp -edit -text $defaultPrim mayaUsdProxyShapeDefaultPrim;

return $fullNodeName;
}

global proc AEmayaUsdProxyShapeInfoReplace(string $input)
{
string $fullNodeName = AEmayaUsdProxyShapeInfoChanged($input);

// Add a script job on the file path attribute so we can update the AE control
// if the attribute changes from the outside.
global int $mayaUsdProxyShapeInfoScriptJobId = -1;
if (`scriptJob -exists $mayaUsdProxyShapeInfoScriptJobId`)
scriptJob -kill $mayaUsdProxyShapeInfoScriptJobId;
string $cmd = "AEmayaUsdProxyShapeInfoChanged(\"" + $input + "\")";
string $attrName = $fullNodeName + ".filePath";
$mayaUsdProxyShapeInfoScriptJobId = `scriptJob -parent mayaUsdProxyShapeRootLayer -attributeChange $attrName $cmd`;
}

global proc AEmayaUsdProxyShapeShareStageNew(string $shareStageAttr)
Expand Down

0 comments on commit 3c8307e

Please sign in to comment.