UV Transform Tool - broken handles #83310

Closed
opened 2 years ago by APEC · 13 comments
APEC commented 2 years ago

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce GTX 1650 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.71

Blender Version
Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: 0f45cab862
Broken: also 2.83 and 2.90

Short description of error
When move Transform Tool handles "Rotate" and "Resize" they works with bugs

Exact steps for others to reproduce the error

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: GeForce GTX 1650 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.71 **Blender Version** Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: `0f45cab862` Broken: also 2.83 and 2.90 **Short description of error** When move Transform Tool handles "Rotate" and "Resize" they works with bugs **Exact steps for others to reproduce the error** - "Rotate" handle also rotate island when move mouse up and down. [UVTransform_Tool_Rotate.mp4](https://archive.blender.org/developer/F9423826/UVTransform_Tool_Rotate.mp4) - "Resize" handles do not respect aspect ratio visually when resize, but do when you finish operation. [UVTransform_Tool_Resize.mp4](https://archive.blender.org/developer/F9423838/UVTransform_Tool_Resize.mp4) - Works correctly only resize by sides [UVTransform_Tool_Resize_Sides.mp4](https://archive.blender.org/developer/F9423848/UVTransform_Tool_Resize_Sides.mp4)
APEC commented 2 years ago
Poster

Added subscriber: @APEC

Added subscriber: @APEC
Collaborator

Added subscriber: @mano-wii

Added subscriber: @mano-wii
Collaborator

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Collaborator

Thanks for the report, I can confirm.

Thanks for the report, I can confirm.
Collaborator

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Collaborator

Scale Cage in 3D does the same thing btw. [in regards to corner resizing]

`Scale Cage` in 3D does the same thing btw. [in regards to corner resizing]
lichtwerk self-assigned this 2 years ago
lichtwerk removed their assignment 2 years ago
Collaborator

Added subscriber: @ideasman42

Added subscriber: @ideasman42
Collaborator

Looked into this a bit, but afaics, this is a design limitation?

In case an operator is tied to the gizmo, there is some stuff that gets set up for the operator prior to going modal.
In the case of cage corner resizing for example the center_override property of the resize operator gets set according to which corner gets grabbed etc.

But once this is done, I dont see an easy way to inject scale values into the operator properties?
There is also this comment:

/* if gizmo evokes an operator we cannot use it for property manipulation */

Of course, there is still stuff from the gizmo that runs in modal, in this case gizmo_cage2d_modal.
This makes sure the gizmo is drawn with the correct scaling and this all works fine.
But this is called after the operator modal has already done its thing, specifically in wm_gizmomaps_handled_modal_update

I have tried injecting the scale into the resize operators value property like so (but again, the resize operator has already done its transform_modal):
P1922: T83310_snippet



diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
index be5f488d759..8b32f8261ec 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
@@ -1094,6 +1094,10 @@ static int gizmo_cage2d_modal(bContext *C,
     transform_pivot_set_m4(matrix_scale,
                            (const float- [x]){pivot- [x] * dims- [x], pivot- [x] * dims- [x], 0.0f});
     mul_m4_m4m4(gz->matrix_offset, data->orig_matrix_offset, matrix_scale);
+
+    PropertyRNA *prop_value = RNA_struct_find_property(&gz->op_data->ptr, "value");
+    RNA_property_float_set_array(
+        &gz->op_data->ptr, prop_value, (float- [x]){scale- [x], scale- [x], scale[1]});
   }
 
   if (gz_prop->type != NULL) {

The place where manipulating operator properties actually works is gizmo2d_xform_refresh
That already does WM_gizmo_operator_get / RNA_property_float_set_array on the center_override (see above)
Manipulating values here actually also works for said value, but only updates when the operator finishes.

Not sure if there is anything that could be done with gizmos target_properties, but again, the comment about gizmos tied to operators makes me think this is a dead end as well.

Soo: think I have to step down here, for me this looks like a Design Issue and not a bug [it sure works against user expectations], probably @ideasman42 would know best...

Looked into this a bit, but afaics, this is a design limitation? In case an operator is tied to the gizmo, there is some stuff that gets set up for the operator prior to going modal. In the case of cage corner resizing for example the `center_override` property of the resize operator gets set according to which corner gets grabbed etc. But once this is done, I dont see an easy way to inject scale values into the operator properties? There is also this comment: > /* if gizmo evokes an operator we cannot use it for property manipulation */ Of course, there is still stuff from the gizmo that runs in modal, in this case `gizmo_cage2d_modal`. This makes sure the gizmo is drawn with the correct scaling and this all works fine. But this is called after the operator modal has already done its thing, specifically in `wm_gizmomaps_handled_modal_update` I have tried injecting the scale into the resize operators `value` property like so (but again, the resize operator has already done its `transform_modal`): [P1922: T83310_snippet](https://archive.blender.org/developer/P1922.txt) ``` diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c index be5f488d759..8b32f8261ec 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c @@ -1094,6 +1094,10 @@ static int gizmo_cage2d_modal(bContext *C, transform_pivot_set_m4(matrix_scale, (const float- [x]){pivot- [x] * dims- [x], pivot- [x] * dims- [x], 0.0f}); mul_m4_m4m4(gz->matrix_offset, data->orig_matrix_offset, matrix_scale); + + PropertyRNA *prop_value = RNA_struct_find_property(&gz->op_data->ptr, "value"); + RNA_property_float_set_array( + &gz->op_data->ptr, prop_value, (float- [x]){scale- [x], scale- [x], scale[1]}); } if (gz_prop->type != NULL) { ``` The place where manipulating operator properties actually works is `gizmo2d_xform_refresh` That already does `WM_gizmo_operator_get` / `RNA_property_float_set_array` on the `center_override` (see above) Manipulating values here actually also works for said `value`, but only updates when the operator finishes. Not sure if there is anything that could be done with gizmos target_properties, but again, the comment about gizmos tied to operators makes me think this is a dead end as well. Soo: think I have to step down here, for me this looks like a Design Issue and not a bug [it sure works against user expectations], probably @ideasman42 would know best...
Collaborator

I've looked at problems like this before.

From my point of view, the problem is that the basic idea of gizmos is that they inform the values to the operator to perform and not the other way around.
A possible solution would be to update the "target_property" "matrix" of the gizmo, since it is used for reading and writing (see WM_gizmo_target_property_def_func).
Another possible solution would be to prevent the gizmo from performing the modal operation and just update the matrices in the operator itself.
Another solution (which is used in the rotate operator of the view3d), is to hide the gizmo and reuse its drawing functions.

(There are also other options like overriding the modal callback of gizmo with WM_gizmo_set_fn_custom_modal and redoing a modal just for the transform operator).

But none of these options seem to be ideal as the intention is only to update the drawing, and the ideal design should make this possible in both C and Python.

I've looked at problems like this before. From my point of view, the problem is that the basic idea of gizmos is that they inform the values to the operator to perform and **not** the other way around. A possible solution would be to update the `"target_property" "matrix"` of the gizmo, since it is used for reading and writing (see `WM_gizmo_target_property_def_func`). Another possible solution would be to prevent the gizmo from performing the modal operation and just update the matrices in the operator itself. Another solution (which is used in the rotate operator of the view3d), is to hide the gizmo and reuse its drawing functions. (There are also other options like overriding the modal callback of gizmo with `WM_gizmo_set_fn_custom_modal` and redoing a modal just for the transform operator). But none of these options seem to be ideal as the intention is only to update the drawing, and the ideal design should make this possible in both C and Python.
Collaborator

Added subscriber: @Chris_Blackbourn

Added subscriber: @Chris_Blackbourn
Collaborator

Testing in commit ccb4e29873 from 2022-05-10

The behavior in all three videos appear to be working correctly now, with the only difference being the cage disappears during the interaction.

Is this task complete, or is there more here that needs to be done?

Testing in commit ccb4e298735f066f9e9074d88320001ded6b1918 from 2022-05-10 The behavior in all three videos appear to be working correctly now, with the only difference being the cage disappears during the interaction. Is this task complete, or is there more here that needs to be done?
Owner

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
ideasman42 closed this issue 9 months ago
ideasman42 self-assigned this 9 months ago
Owner

Agree this task can be closed. Any further improvements the could be created as more specific TODO's.

Agree this task can be closed. Any further improvements the could be created as more specific TODO's.
Sign in to join this conversation.
No Label
Interest/Alembic
Interest/Animation & Rigging
Interest/Asset Browser
Interest/Asset Browser Project Overview
Interest/Audio
Interest/Automated Testing
Interest/Blender Asset Bundle
Interest/Collada
Interest/Compositing
Interest/Core
Interest/Cycles
Interest/Dependency Graph
Interest/Development Management
Interest/Eevee & Viewport
Interest/Freestyle
Interest/Geometry Nodes
Interest/Grease Pencil
Interest/ID Management
Interest/Images & Movies
Interest/Import/Export
Interest/Line Art
Interest/Masking
Interest/Modeling
Interest/Modifiers
Interest/Motion Tracking
Interest/Nodes & Physics
Interest/Overrides
Interest/Performance
Interest/Performance
Interest/Physics
Interest/Pipeline, Assets & I/O
Interest/Platforms, Builds, Tests & Devices
Interest/Python API
Interest/Render & Cycles
Interest/Render Pipeline
Interest/Sculpt, Paint & Texture
Interest/Text Editor
Interest/Translations
Interest/Triaging
Interest/Undo
Interest/USD
Interest/User Interface
Interest/UV Editing
Interest/VFX & Video
Interest/Video Sequencer
Interest/Virtual Reality
legacy module/Animation & Rigging
legacy module/Core
legacy module/Eevee & Viewport
legacy module/Grease Pencil
legacy module/Modeling
legacy module/Nodes & Physics
legacy module/Pipeline, Assets & IO
legacy module/Platforms, Builds, Tests & Devices
legacy module/Python API
legacy module/Sculpt, Paint & Texture
legacy module/User Interface
legacy module/VFX & Video
legacy project/BF Blender: 2.8
legacy project/Milestone 1: Basic, Local Asset Browser
legacy project/OpenGL Error
legacy project/Retrospective
Meta/Good First Issue
Meta/Papercut
migration/requires-manual-verification
Module › Animation & Rigging
Module › Core
Module › Development Management
Module › Eevee & Viewport
Module › Grease Pencil
Module › Modeling
Module › Nodes & Physics
Module › Pipeline, Assets & IO
Module › Platforms, Builds, Tests & Devices
Module › Python API
Module › Render & Cycles
Module › Sculpt, Paint & Texture
Module › Triaging
Module › User Interface
Module › VFX & Video
Platform/FreeBSD
Platform/Linux
Platform/macOS
Platform/Windows
Priority › High
Priority › Low
Priority › Normal
Priority › Unbreak Now!
Status › Archived
Status › Confirmed
Status › Duplicate
Status › Needs Information from Developers
Status › Needs Information from User
Status › Needs Triage
Status › Resolved
Type › Bug
Type › Design
Type › Known Issue
Type › Patch
Type › Report
Type › To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#83310
Loading…
There is no content yet.