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-125378 Implementation batched duplication #2687

Conversation

JGamache-autodesk
Copy link
Collaborator

This allows Maya to duplicate multiple items and to properly fixup connections and relationships between all these individual duplicates.

Also implements the "no connections" mode that is the default Maya behavior. Use "Duplicate Special" with the "Duplicate input connections" active when duplicating shaders.

This allows Maya to duplicate multiple items and to properly fixup
connections and relationships between all these individual duplicates.

Also implements the "no connections" mode that is the default Maya
behavior. Use "Duplicate Special" with the "Duplicate input connections"
active when duplicating shaders.
bool _inBatchedDuplicate = false;

// Clear all guard data.
void _clearGuardData();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this needs _
There is nothing in coding standard about that.

// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't use pragma once. See the coding standard.

bool duplicateUndo();
bool duplicateRedo();

bool _updateSdfPathVector(
Copy link
Collaborator

Choose a reason for hiding this comment

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

_ again - it is supposed to mean something ?

Comment on lines 63 to 64
typedef std::map<SdfPath, SdfPath> TDuplicatePathsMap;
typedef std::unordered_map<Ufe::Path, TDuplicatePathsMap> TDuplicatesMap;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The coding standard says to prefer using over typedef. But in either case no "T".

@JGamache-autodesk JGamache-autodesk changed the title MAYA-125378 Implementation of a duplication guard MAYA-125378 Implementation batched duplication Nov 4, 2022
Copy link
Collaborator

@ppt-adsk ppt-adsk left a comment

Choose a reason for hiding this comment

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

Great work, just needs a few additional undo / redo tests IMO.

dGeomBindAPI = UsdShade.MaterialBindingAPI(dGeomPrim)
# Now seeing and using ss3SG1
self.assertEqual(dGeomBindAPI.GetDirectBinding().GetMaterialPath(), Sdf.Path("/mtl/ss3SG1"))

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be nice to test undo / redo of the UFE command.

dGeomBindAPI = UsdShade.MaterialBindingAPI(dGeomPrim)
# Now seeing and using ss3SG1
self.assertEqual(dGeomBindAPI.GetDirectBinding().GetMaterialPath(), Sdf.Path("/mtl/ss3SG1"))

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be nice to test undo / redo.

connections = connectionHandler.sourceConnections(f3pDupItem)
self.assertIsNotNone(connections)
self.assertEqual(len(connections.allConnections()), 0)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Undo / redo.

#include <mayaUsd/undo/UsdUndoableItem.h>

#include <pxr/usd/sdf/path.h>
#include <pxr/usd/usd/prim.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we use this include?

, _copyExternalInputs(shouldConnectExternalInputs(duplicateOptions))
{
// TODO: MAYA-125854. If duplicating /a/b and /a/b/c, it would make sense to order the
// operations by SdfPath, and always check if the previoulsy processed path is a prefix of the
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo: "previoulsy"

External relationships are now always copied irrespective of the
"imputConnections" option.
ppt-adsk
ppt-adsk previously approved these changes Nov 4, 2022
Geometries that had their own material scope, when duplicated, would lose
their shading because connections deep in the hierarchy were considered
external. Fixed the external check.
ppt-adsk
ppt-adsk previously approved these changes Nov 4, 2022
@@ -11,6 +11,7 @@
# UFE_VERSION UFE version (major.minor.patch) from ufe.h
# UFE_LIGHTS_SUPPORT Presence of UFE lights support
# UFE_SCENE_SEGMENT_SUPPORT Presence of UFE scene segment support
# UFE_PREVIEW_BATCHOPS_SUPPORT Presence of UFE batched operations support
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be UFE_PREVIEW_FEATURES ...


if (UFE_INCLUDE_DIR AND EXISTS "${UFE_INCLUDE_DIR}/ufe/batchOpsHandler.h")
list(APPEND UFE_PREVIEW_FEATURES BatchOps)
endif()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Using a list to store keys looks like a viable solution to handle progressively added features.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like it, but I'm not a CMake expert.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think each feature added to UFE_PREVIEW_FEATURES should be tagged with the version first. So "v4_BatchOps". This would make them easier to find and remove/modify to normal ufe ifdef once Ufe v4 is released.

Copy link
Collaborator Author

@JGamache-autodesk JGamache-autodesk Nov 7, 2022

Choose a reason for hiding this comment

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

What happens when we backport v5_WorkflowX into v4 for an hypothetical Maya dot release?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Once Ufe v4 is released we remove all these "preview" checks and replace them with just "ufe v4" check.

ppt-adsk
ppt-adsk previously approved these changes Nov 7, 2022

if (UFE_INCLUDE_DIR AND EXISTS "${UFE_INCLUDE_DIR}/ufe/batchOpsHandler.h")
list(APPEND UFE_PREVIEW_FEATURES BatchOps)
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like it, but I'm not a CMake expert.

Comment on lines 86 to 87
# Gather all preview features that might be there or not into a single list:
list(APPEND UFE_PREVIEW_FEATURES v4)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can't just say that it includes v4, because when compiling with older versions of Maya we aren't using Ufe v4.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this rather saying that UFE_PREVIEW_FEATURES is a list that pertains to UFE v4? Not sure what we're getting by placing this "v4" string into the list, because it will always be the case that preview features will pertain to the up-coming UFE version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In fact, I would push one step further and say that maybe even "preview" is too specific. If we imagine this being only a list of Ufe features, then it enable them as soon as Ufe supports them in Maya, which becomes very interesteing from a feature backporting scenario. I do remember the MAYA_LIGHT_API_VERSION kicking in when I backported the light API fixes for 2020.3 without having to update MayaUSD.

Might be potential discussion subject for the UFE interest meeting.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Better initializer, since list can not be empty, would be "ufe".

ppt-adsk
ppt-adsk previously approved these changes Nov 7, 2022

#include <mayaUsd/ufe/UsdUndoDuplicateSelectionCommand.h>

PXR_NAMESPACE_USING_DIRECTIVE
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need this? All new code should use the fully qualified namespace name. But I don't see any USD code here.


#include <ufe/path.h>

PXR_NAMESPACE_USING_DIRECTIVE
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again do you need this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If its for the TF_VERIFY below, then put the macro inside that method.

Copy link
Collaborator

@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.

Just a couple of minor comments.

Copy link
Collaborator

@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.

Excellent thanks.

@JGamache-autodesk JGamache-autodesk added the ready-for-merge Development process is finished, PR is ready for merge label Nov 9, 2022
@seando-adsk seando-adsk added the ufe-usd Related to UFE-USD plugin in Maya-Usd label Nov 10, 2022
@seando-adsk seando-adsk merged commit 2bcac83 into dev Nov 10, 2022
@seando-adsk seando-adsk deleted the gamaj/MAYA-125378/fix_relationships_and_connections_on_batched_duplication branch November 10, 2022 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge ufe-usd Related to UFE-USD plugin in Maya-Usd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants