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

Tremblp/maya 102361/rename fixes #237

Merged
merged 8 commits into from
Feb 11, 2020
Merged

Conversation

ppt-adsk
Copy link
Collaborator

No description provided.

@ppt-adsk ppt-adsk added the do-not-merge-yet Development is not finished, PR not ready for merge label Jan 31, 2020
lib/ufe/ProxyShapeHierarchy.cpp Show resolved Hide resolved
lib/ufe/ProxyShapeHierarchyHandler.cpp Show resolved Hide resolved
lib/ufe/ProxyShapeHierarchyHandler.cpp Show resolved Hide resolved
prevents it).
Two-way map of proxy shape UFE path to corresponding stage.

We will assume that a USD proxy shape will not be instanced (even though
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Previous USD stage map was path-based, which was impossible to maintain in the presence of path changes through renaming. Simply use the proxy shape MObject instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Again, slightly concerned about the no instancing assumption, but maybe I'm misunderstanding.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, you're not misunderstanding... As per other comment entered as
#256

lib/ufe/UsdUndoRenameCommand.cpp Show resolved Hide resolved
test/lib/ufe/testRename.py Outdated Show resolved Hide resolved
@ppt-adsk ppt-adsk removed the do-not-merge-yet Development is not finished, PR not ready for merge label Feb 4, 2020
Copy link
Contributor

@mattyjams mattyjams left a comment

Choose a reason for hiding this comment

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

The assumption that proxy shapes are not going to be instanced got me a little bit concerned, but otherwise this seems reasonable to me. Just a bunch of other minor cosmetic comments.

@@ -22,7 +22,6 @@
#include "UsdTransform3dHandler.h"
#include "UsdSceneItemOpsHandler.h"

#include <ufe/rtid.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we're actually adding a usage of Ufe::Rtid at line 130, so I'm not sure why we're taking this include out? I know it was added to the header, but since there's usage in both files, I'd prefer to see the include in both files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not a huge deal, to be sure, but isn't that violating Don't Repeat Yourself? If maintenance removes the use of Ufe::Rtid, I'd now have two places to remove the include of ufe/rtid.h.

lib/ufe/ProxyShapeHierarchy.cpp Outdated Show resolved Hide resolved
lib/ufe/ProxyShapeHierarchy.h Outdated Show resolved Hide resolved
return handle;
}

// Assuming proxy shape nodes cannot be instanced, simply return the first path.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll admit I'm not sure I fully understand the context here, but is this a safe assumption? In our pipeline, we definitely do instance pxrUsdReferenceAssembly/pxrUsdProxyShape nodes using either nParticles or MASH.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created an issue describing the problem, and some areas that would need to be worked on:
#256

lib/ufe/UsdStageMap.cpp Outdated Show resolved Hide resolved
Comment on lines +29 to +36
// Allow for use of MObjectHandle with std::unordered_map.
namespace std {
template <> struct hash<MObjectHandle> {
std::size_t operator()(const MObjectHandle& handle) const {
return static_cast<std::size_t>(handle.hashCode());
}
};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be a great candidate for the kind of Maya-as-the-only-dependency utilities library that Animal Logic has been advocating for. We actually had something for this in usdMaya (now migrated to mayaUsd) as well:

using MObjectHandleUnorderedMap =

There's nothing USD or UFE related about either implementation.

prevents it).
Two-way map of proxy shape UFE path to corresponding stage.

We will assume that a USD proxy shape will not be instanced (even though
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, slightly concerned about the no instancing assumption, but maybe I'm misunderstanding.

lib/ufe/UsdUndoRenameCommand.cpp Outdated Show resolved Hide resolved
lib/ufe/wrapUtils.cpp Outdated Show resolved Hide resolved
@kxl-adsk
Copy link

kxl-adsk commented Feb 7, 2020

@mattyjams you already approved the change, but there are new commits implementing your code review suggestions. Can you re-approve once reviewed (or simply let me know that you are done with the review).

Copy link
Contributor

@mattyjams mattyjams left a comment

Choose a reason for hiding this comment

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

Yup, looks good to me! And thanks for opening #256 to track instancing support!

Copy link
Contributor

@HamedSabri-adsk HamedSabri-adsk left a comment

Choose a reason for hiding this comment

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

LGTM! Merci

@HamedSabri-adsk
Copy link
Contributor

PS: UFE 2.5.6 or later is required for this branch.

fPathToStage[path] = stage;
fStageToPath[stage] = path;
// We expect a path to the proxy shape node, therefore a single segment.
auto nbSegments = path.nbSegments();
Copy link
Contributor

Choose a reason for hiding this comment

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

One minor thing that I just noticed, It doesn't look like we are guarding UsdStageMap.cpp against UFE1.0.

See

ufe/UsdStageMap.cpp

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, I think that's fine: UsdStageMap is required for proper UFE v1 use, and it doesn't depend on any UFE v2 features, so it should only be protected for UFE compilation, which it currently is, not against UFE v2.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense. Thanks

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As discussed, completely missed your point, great catch! Fixed in
e508bdb

@HamedSabri-adsk HamedSabri-adsk added the do-not-merge-yet Development is not finished, PR not ready for merge label Feb 8, 2020
@HamedSabri-adsk HamedSabri-adsk removed the do-not-merge-yet Development is not finished, PR not ready for merge label Feb 10, 2020
@@ -69,7 +69,12 @@ UsdStageMap g_StageMap;
void UsdStageMap::addItem(const Ufe::Path& path, UsdStageWeakPtr stage)
{
// We expect a path to the proxy shape node, therefore a single segment.
auto nbSegments = path.nbSegments();
auto nbSegments =
#ifdef UFE_V2_FEATURES_AVAILABLE
Copy link
Contributor

Choose a reason for hiding this comment

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

lgtm. Thanks Pierre.

Copy link

@kxl-adsk kxl-adsk left a comment

Choose a reason for hiding this comment

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

We have some interface changes here which are not available in the latest Maya beta. Please change it.

@kxl-adsk kxl-adsk merged commit b83b17f into dev Feb 11, 2020
@kxl-adsk kxl-adsk deleted the tremblp/MAYA-102361/rename_fixes branch February 11, 2020 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants