Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAYA-131348 - Adapt to Maya Ufe world node change #3842

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

seando-adsk
Copy link
Collaborator

MAYA-131348 - Nothing prevents users from naming nodes "world", which breaks USD workflow

  • Incorrect to create Ufe::Path for Maya (hidden) world node using Ufe::PathString::path().
  • Let DuplicateCommand accept empty destination path which means Maya (hidden) world node.
  • Let CreateStageWithNewLayer command accept null input parent which means Maya world node.
  • Use ufe.PathString.string() instead of str()

@seando-adsk seando-adsk added bug Something isn't working ufe Related to UFE component in Maya labels Jul 4, 2024
@seando-adsk seando-adsk self-assigned this Jul 4, 2024
@seando-adsk seando-adsk force-pushed the donnels/MAYA-131348/maya_ufe_world_node branch from 3a75125 to 524ab90 Compare July 4, 2024 19:04
… breaks USD workflow

* Incorrect to create Ufe::Path for Maya (hidden) world node
  using Ufe::PathString::path().
* Let DuplicateCommand accept empty destination path which
  means Maya (hidden) world node.
* Let CreateStageWithNewLayer command accept null input parent
  which means Maya world node.
* Use ufe.PathString.string() instead of str()
@seando-adsk seando-adsk force-pushed the donnels/MAYA-131348/maya_ufe_world_node branch from 524ab90 to 0bfe9f9 Compare July 5, 2024 13:59
Copy link
Collaborator Author

@seando-adsk seando-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code wasn't "incorrect" before its just that we were relying on knowledge of the Maya hidden world node (which is the root). Removed all that world knowledge except in very special cases. These changes are required now before I make a fix in Maya which will allow users to create their own top-level "world" node and use that with Ufe. Currently they cannot because of a bug in Maya.


status = parseUfePathArg(argParser, 0, _srcPath);
if (status != MS::kSuccess)
return reportError(status);

status = parseUfePathArg(argParser, 1, _dstPath);
status = parseUfePathArg(argParser, 1, _dstPath, true /*allowEmpty*/);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set new allowEmpty bool here to be able to accept as command input "" which means Maya "world" node.

Comment on lines +466 to +478
Ufe::Path childPath;
if (_srcPath.runTimeId() == getMayaRunTimeId()) {
// Maya duplicate to USD
_dstPath + Ufe::PathSegment(_srcPath.back(), getUsdRunTimeId(), '/')
auto ps = Ufe::PathSegment(_srcPath.back(), getUsdRunTimeId(), '/');
childPath = _dstPath.empty() ? ps : _dstPath + ps;
} else {
// USD duplicate to Maya
: _dstPath + _srcPath.back();
if (_dstPath.empty()) {
childPath = Ufe::PathString::path("|" + _srcPath.back().string());
} else {
childPath = _dstPath + _srcPath.back();
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to rework logic to handle when _dstPath is empty.

const Ufe::Path& ufePulledPath,
const MObject& mayaObject,
const UsdMayaPrimUpdaterContext& context)
PushCustomizeSrc pushExport(const MObject& mayaObject, const UsdMayaPrimUpdaterContext& context)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unused input var ufePullPath

Comment on lines +1560 to +1563
MayaUsdProxyShapeBase* srcProxyShape
= srcPath.empty() ? nullptr : MayaUsd::ufe::getProxyShape(srcPath);
MayaUsdProxyShapeBase* dstProxyShape
= dstPath.empty() ? nullptr : MayaUsd::ufe::getProxyShape(dstPath);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either of these is now allowed to be null.

MString script;
script.format(
"^1s \"^2s\" \"|world\"",
"^1s \"^2s\" \"\"",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace "world" with empty string which is now handled in command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ufe Related to UFE component in Maya
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant