Gizmo: add undo and name #104888

Open
Weizhen Huang wants to merge 5 commits from weizhen/blender:enable_gizmo_undo into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

No response

_No response_
Weizhen Huang added the
Module
EEVEE & Viewport
label 2023-02-17 16:21:32 +01:00
Weizhen Huang requested review from Campbell Barton 2023-02-17 18:09:03 +01:00
Brecht Van Lommel added this to the EEVEE & Viewport project 2023-02-20 10:38:20 +01:00
Weizhen Huang force-pushed enable_gizmo_undo from c1ae1ac248 to 2de990a55c 2023-02-20 17:24:52 +01:00 Compare
Weizhen Huang reviewed 2023-02-21 15:15:38 +01:00
@ -1057,0 +1056,4 @@
if (gz->name && gz->name[0]) {
uiTooltipField *field = text_field_add(
data, uiTooltipFormat::Style::Header, uiTooltipFormat::ColorID::Value, true);
field->text = BLI_strdup(TIP_(gz->name));
Author
Member

Usually description is used here, but looks rather lengthy if there is already description for RNA properties, so I use name instead.
image

Usually `description` is used here, but looks rather lengthy if there is already description for RNA properties, so I use `name` instead. ![image](/attachments/f50d0277-867d-4835-b0cf-f619bdf330cc)
@ -456,0 +457,4 @@
if (gz->type->exit) {
/* Push undo if needed. */
if ((gz->flag & WM_GIZMO_UNDO) && !cancel) {
const wmGizmoProperty *gz_prop = WM_gizmo_target_property_get_unique(gz);
Author
Member

I find this get_unique concept quite strange, it is here because gizmos are allowed to have multiple properties, and if there are multiple I don't know which one just got edited, and could it be that only one of them has undo.

I find this `get_unique` concept quite strange, it is here because gizmos are allowed to have multiple properties, and if there are multiple I don't know which one just got edited, and could it be that only one of them has undo.
@ -73,2 +82,4 @@
wmGizmoPropertyFnGet value_get_fn;
wmGizmoPropertyFnSet value_set_fn;
wmGizmoPropertyFnTransformGet transform_get_fn;
wmGizmoPropertyFnTransformSet transform_set_fn;
Author
Member

I find it a bit confusing that there are two groups of getter/setters. The new transform_set_fn could modify the value, and I don't want to drop the const specifier for value_set_fn. Or could there be better function names?

I find it a bit confusing that there are two groups of getter/setters. The new `transform_set_fn` could modify the value, and I don't want to drop the `const` specifier for `value_set_fn`. Or could there be better function names?
Weizhen Huang force-pushed enable_gizmo_undo from 2de990a55c to db95b7226c 2023-02-24 14:46:12 +01:00 Compare
Weizhen Huang force-pushed enable_gizmo_undo from db95b7226c to e467a8c1db 2023-02-28 13:08:58 +01:00 Compare
Campbell Barton requested changes 2023-03-09 06:48:02 +01:00
Campbell Barton left a comment
Owner

Is it necessary to mix the changes to area-lights with undo? I'd prefer to support undo in a way that's closer to how buttons work (where the information for undo is automatically extracted).

From investigating this I think it can be supported.

Can the undo changes be removed from this patch and resolved separately?

Is it necessary to mix the changes to area-lights with undo? I'd prefer to support undo in a way that's closer to how buttons work (where the information for undo is automatically extracted). From investigating this I think it can be supported. Can the undo changes be removed from this patch and resolved separately?
Author
Member

The purpose of this patch was to get undo with RNA information in a quick and dirty way, I looked into the proper way with RNA only after that, so these commits have a dependency, and I won't squash commit them. If you think the two Refactor and one Cleanup commits look good, I can also push them first to the main (or create another pull request for those changes), then make the undo changes depend on that.

However, I do not like the way the buttons are performing undo, they just show numbers, these are not informative at all, there are plans to change this behavior.
image
This patch uses the RNA property name, for example "Spot Blend", instead of the value. The undo name is then the name of the operation upon that, "Resize" for example, so it looks like this:
image

The purpose of this patch was to get undo with RNA information in a quick and dirty way, I looked into the proper way with RNA only after that, so these commits have a dependency, and I won't squash commit them. If you think the two Refactor and one Cleanup commits look good, I can also push them first to the main (or create another pull request for those changes), then make the undo changes depend on that. However, I do not like the way the buttons are performing undo, they just show numbers, these are not informative at all, there are plans to change this behavior. ![image](/attachments/9395c9fb-979f-4ec3-92f0-346a4ec5ac5d) This patch uses the RNA property name, for example "Spot Blend", instead of the value. The undo name is then the name of the operation upon that, "Resize" for example, so it looks like this: ![image](/attachments/1ad06c9c-21a6-459b-be93-15c820bce714)
This pull request has changes conflicting with the target branch.
  • source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
  • source/blender/editors/include/ED_gizmo_library.h
  • source/blender/editors/interface/interface_region_tooltip.cc
  • source/blender/editors/space_view3d/view3d_gizmo_light.c
  • source/blender/makesrna/intern/rna_light.c
  • source/blender/windowmanager/gizmo/WM_gizmo_api.h
  • source/blender/windowmanager/gizmo/WM_gizmo_types.h
  • source/blender/windowmanager/gizmo/intern/wm_gizmo.c
  • source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
  • source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u enable_gizmo_undo:weizhen-enable_gizmo_undo
git checkout weizhen-enable_gizmo_undo
Sign in to join this conversation.
No reviewers
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
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
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
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
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
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 Info 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 Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#104888
No description provided.