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

Ufe manipulation #962

Merged
merged 63 commits into from
Dec 6, 2020
Merged

Ufe manipulation #962

merged 63 commits into from
Dec 6, 2020

Conversation

ppt-adsk
Copy link
Collaborator

@ppt-adsk ppt-adsk commented Dec 3, 2020

The goal of this pull request is to allow users to edit the transform of any transformable USD prim. See
UsdGeomXformable documentation for background material.

In particular, we wanted to meet the following requirements:

  1. It must be possible to manipulate any asset produced by the maya-usd core exporter without changes to the component transformation operations stack, i.e. manipulation should work "in-place".
  2. Manipulation code will use an interface that takes care of transformation operations management. Pipelines may choose to change this interface at runtime to improve interop between DCCs.
  3. An arbitrary stack of operators (i.e. operators types, sequence, and suffixes) can be provided to UFE manipulation. Manipulation is allowed to append ops (with a custom prefix) to incoming stack, but the original stack has to be preserved.
  4. Undo has to completely restore the transformation operations stack before an edit.
  5. UFE API shouldn’t make any assumptions whether edited data is constant or time-varying, i.e. transform handler can choose to opt-in to authoring time sampled data.
  6. UFE API should provide UFE-USD plugin with an interface to handle the "in-place" editing of any arbitrary transformation stacks, i.e. target any transformation op.

This pull request uses a recently-added method to the Ufe::Transform3d interface, the editTransform3d() method, to target transform ops within a larger stack of transform ops. See this discussion for more details.

It implements support for the Maya transform stack, the USD common transform API stack, and matrix op stacks, through a chain of responsibility scheme. If the prim matches a Maya transform stack, a Transform3d interface for Maya transform stacks will be created, otherwise if the prim matches the USD common transform API stack, a Transform3d interface for such a stack will be created, otherwise if the prim matches a transform stack with matrix transform ops, a Transform3d interface for such a stack will be created. If none of these transform stacks match, a fallback Maya transform stack will be appended to the original transform stack. This chain of responsibility can be manipulated at run time, and reverted back to the previous fixed scheme with conversion to the USD common transform API, though we plan on retiring this legacy code in the future. The capability to change the Transform3d creation scheme at run-time will remain, however.

A full undo / redo system is implemented using a USD state delegate. This ensures that the data model is restored to its previous state, even given prim spec or attribute spec creation. This is the great work of @HamedSabri-adsk.

ppt-adsk and others added 30 commits August 20, 2020 16:31
Proof of concept for USD matrix transform op editing.
…stack_01

Tremblp/maya 106087/maya xform stack 01
…stack_02

Tremblp/maya 106087/maya xform stack 02
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once
Copy link
Contributor

@HamedSabri-adsk HamedSabri-adsk Dec 3, 2020

Choose a reason for hiding this comment

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

@ppt-adsk Nit-pick: use include guard instead based on our coding guideline. Same thing in other files.

@@ -0,0 +1,209 @@
# Editing USD Transformable Objects with maya-usd

Draft version 0.3, 19-Aug-2020, 4:52 P.M.
Copy link

Choose a reason for hiding this comment

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

I wonder if we want to clean this up since it's now no longer a proposal.

Ufe::SceneItem::Ptr UsdTransform3dBase::sceneItem() const { return fItem; }

Ufe::TranslateUndoableCommand::Ptr
UsdTransform3dBase::translateCmd(double /* x */, double /* y */, double /* z */)
Copy link

Choose a reason for hiding this comment

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

Is this base class ever instantiated? In other words, do we need a definition for these methods?


namespace {

class UsdTranslateUndoableCmd : public Ufe::TranslateUndoableCommand
Copy link

Choose a reason for hiding this comment

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

Pretty minimalistic when it comes to documentation :)

: _nextHandler->editTransform3d(
item
#if UFE_PREVIEW_VERSION_NUM >= 2030
,
Copy link

Choose a reason for hiding this comment

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

another example of a clang-format issue. This particular one, unfortunately, doesn't have any good configuration, coma will have to go onto line 359 to get good formatting :(

// - Perform operations on a 4x4 matrix transform op.
// - Perform operations using the USD common transform API.
// - Perform operations using a Maya transform stack.
auto& runTimeMgr = Ufe::RunTimeMgr::instance();
Copy link

Choose a reason for hiding this comment

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

We should communicate this better that for now, the new chain of responsibilities is available only with adsk proxy. It can be adopted by others easily by copying this configuration of the chain of responsibilities.


mayaUtils.openTestScene("xformOpFallback", "fallbackTest.ma")

# We have three objects in the scene, one Maya, one USD with a Maya
Copy link

Choose a reason for hiding this comment

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

Excellent tests. One addition that would be useful to make is for testing fallback when editing pivots on matrix stacks.

Hamed Sabri and others added 8 commits December 4, 2020 11:10
…es. According to USD docs, editing scene description via instance proxies and their properties is not allowed.
…_instance_proxies_not_allowed

MAYA-108545: Prevent the crash when authoring edits to instance proxies.
…aya2020_fixes

Compilation fixes for Maya 2020.
…dy registered with our UsdUndoStateDelegate. If the cast fails, that means it needs to be set with a new one.
ppt-adsk and others added 2 commits December 4, 2020 16:51
…ixes

Fixes for pre-flight tests and clang-format.
…sh_switching_layers

MAYA-108549: Fix undo crash when switching between target layers in a stage
@ppt-adsk ppt-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Dec 6, 2020
@kxl-adsk kxl-adsk merged commit 2120ce6 into dev Dec 6, 2020
@kxl-adsk kxl-adsk deleted the ufe-manipulation branch December 6, 2020 03:36
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 Related to UFE component in Maya ufe-usd Related to UFE-USD plugin in Maya-Usd workflows Related to in-context workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants