ynput / OpenPype

OpenPype has been surpassed by AYON and is now read only.
https://ayon.ynput.io
MIT License
286 stars 129 forks source link

Enhancement: Transform Zero validator should allow Deltas #5582

Open alainxi opened 1 year ago

alainxi commented 1 year ago

Is there an existing issue for this?

Please describe the feature you have in mind and explain what the current shortcomings are?

In Blender, the "Transform zero" validator wants us to apply a freeze transform, this is useful. But there are 2 ways to achieve that goal, and this validator wants us to use the method that cannot be used in our productions (we get modeling in Blender, but the rigging and realtime animation is done on other softwares).

The method we need to use (but is refused by the validator) : (from inside Blender) Object-->Apply-->All Transforms to Deltas It transfers the transforms to the Deltas of objects (it places the pivot at the center of the object, so you can use it for realtime animation).

The method that Ayon's Blender validator wants us to use : (from inside Blender) Object-->Apply-->All Transforms It transfers the transforms to the datas of objects (it places the pivot at the center of the world, so you cannot use it for realtime animation).

How would you imagine the implementation of the feature?

Here is the line :

https://github.com/ynput/OpenPype/blob/529ab6ca9bf0de6656fa11ba5f4e38af4b048049/openpype/hosts/blender/plugins/publish/validate_transform_zero.py#L35

It is currently using "matrix_basis", I hope there is a way to do the same thing while allowing deltas. https://docs.blender.org/api/current/bpy.types.Object.html#bpy.types.Object.matrix_basis

If not possible using matrix, a brute force solution would be to test translation and rotation to be 0,0,0 and scale to be 1,1,1

Are there any labels you wish to add?

Describe alternatives you've considered:

No response

Additional context:

No response

[cuID:OP-6758]

alainxi commented 1 year ago

Sorry, I don't find a way to add the "host: Blender" label on this issue.

alainxi commented 1 year ago

In case some studios prefer the current behaviour, it would be even better to have a button that allows to select the behavior we prefer (allow Deltas or not).

BigRoy commented 1 year ago

In case some studios prefer the current behaviour, it would be even better to have a button that allows to select the behavior we prefer (allow Deltas or not).

This would be a studio settings > project settings, yes?

alainxi commented 1 year ago

This would be a studio settings > project settings, yes?

Yes, I mean to have a new button here, to choose between "Allow Deltas" or not :

Currently it only has those 2 options : "Active", "Optional".

LiborBatek commented 9 months ago

@simonebarbieri could be an easy fix, no?

BigRoy commented 9 months ago

I recall actually implementing this some time ago or testing it - but I can't find the code :D

I had this comment. Apparently my code is already quite different from develop so it might be a decent starting point.

Looking back now, my focus seemed mostly on adding a repair method at the time.

I never continued allowing the delta transforms because delta transforms came through as regular transformations in Alembic files to Maya- not as a custom pivot point position. Since I wanted no transformations for my case it meant that unfortunately due to this limitation it only allowed exports from Blender with pivot points at 0, 0, 0. (Since you couldn't set just the pivot point in the alembic export to maya; it would always be transformation)

alainxi commented 9 months ago

I would like to add that this enhancement is not as important for us as it was. Because we changed our realtime tools to allow working with Ayon's current behaviour.