-
Notifications
You must be signed in to change notification settings - Fork 202
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
MAYA-125378 Implementation batched duplication #2687
Conversation
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.
lib/mayaUsd/ufe/UsdBatchOpsHandler.h
Outdated
bool _inBatchedDuplicate = false; | ||
|
||
// Clear all guard data. | ||
void _clearGuardData(); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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 ?
typedef std::map<SdfPath, SdfPath> TDuplicatePathsMap; | ||
typedef std::unordered_map<Ufe::Path, TDuplicatePathsMap> TDuplicatesMap; |
There was a problem hiding this comment.
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".
There was a problem hiding this 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")) | ||
|
There was a problem hiding this comment.
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")) | ||
|
There was a problem hiding this comment.
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) | ||
|
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
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.
cmake/modules/FindUFE.cmake
Outdated
@@ -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 |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
||
if (UFE_INCLUDE_DIR AND EXISTS "${UFE_INCLUDE_DIR}/ufe/batchOpsHandler.h") | ||
list(APPEND UFE_PREVIEW_FEATURES BatchOps) | ||
endif() |
There was a problem hiding this comment.
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.
cmake/modules/FindUFE.cmake
Outdated
# Gather all preview features that might be there or not into a single list: | ||
list(APPEND UFE_PREVIEW_FEATURES v4) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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".
Also did some updates following review.
…ctions_on_batched_duplication
|
||
#include <mayaUsd/ufe/UsdUndoDuplicateSelectionCommand.h> | ||
|
||
PXR_NAMESPACE_USING_DIRECTIVE |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
…ctions_on_batched_duplication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent thanks.
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.