UI: Props Dialog Default Properties #119007

Merged
Harley Acheson merged 5 commits from Harley/blender:ProDialogDefProps into main 2024-03-05 18:55:01 +01:00
Member

Allow activating numerical buttons upon opening of props dialogs. Set
defaults for some dialogs where appropriate.


When props dialogs open we can currently set that a particular input should be active right away by setting the property as default. Unfortunately this currently only works for text inputs. This PR adds code to allow setting a numerical input as activated on open and then also sets four defaults where appropriate:

image

image

image

For ARMATURE_OT_move_to_collection when adding to a new bone collection, this PR changes the title slightly to include "Bone Collection". Otherwise this dialog you get when hitting "M" in pose mode looks exactly the same as hitting "M" in object mode, which are very different. This also adds "Bones" as the default bone collection name as it is in the list itself.

image

Allow activating numerical buttons upon opening of props dialogs. Set defaults for some dialogs where appropriate. --- When props dialogs open we can currently set that a particular input should be active right away by setting the property as default. Unfortunately this currently only works for text inputs. This PR adds code to allow setting a numerical input as activated on open and then also sets four defaults where appropriate: ![image](/attachments/e17ac827-0125-4626-84df-e1cbfa3bc859) ![image](/attachments/4c4709f3-95bc-4abb-95ac-077ade8a271a) ![image](/attachments/03d0b356-a74b-4bc0-985a-44f2c4e6fc62) For `ARMATURE_OT_move_to_collection` when adding to a new bone collection, this PR changes the title slightly to include "Bone Collection". Otherwise this dialog you get when hitting "M" in pose mode looks exactly the same as hitting "M" in object mode, which are very different. This also adds "Bones" as the default bone collection name as it is in the list itself. ![image](/attachments/136aa90e-8aab-47c8-a2de-a59cd2d31ec0)
Harley Acheson added 1 commit 2024-03-02 18:47:29 +01:00
2925524857 UI: Props Dialog Default Properties
Allow activating numerical buttons upon opening of props dialogs. Set
defaults for some dialogs where appropriate.
Harley Acheson added this to the User Interface project 2024-03-02 18:47:57 +01:00
Hans Goudey reviewed 2024-03-02 20:12:13 +01:00
@ -1166,8 +1166,9 @@ static int move_to_collection_regular_invoke(bContext *C, wmOperator *op)
static int move_to_new_collection_invoke(bContext *C, wmOperator *op)
{
RNA_string_set(op->ptr, "new_collection_name", IFACE_("Bones"));
Member

Could this be done by giving the string property a default value? That seems better than potentially overridint a value remembered from last time or a value set explicitly

Could this be done by giving the string property a default value? That seems better than potentially overridint a value remembered from last time or a value set explicitly
Harley marked this conversation as resolved
@ -2622,6 +2622,7 @@ static int image_new_invoke(bContext *C, wmOperator *op, const wmEvent * /*event
/* Better for user feedback. */
RNA_string_set(op->ptr, "name", DATA_(IMA_DEF_NAME));
op->type->prop = RNA_struct_find_property(op->ptr, "name");
Member

Feels like this should be done when defining the property. I think the operator type should basically be considered const after it is registered

Feels like this should be done when defining the property. I think the operator type should basically be considered const after it is registered
Harley marked this conversation as resolved
Author
Member

@HooglyBoogly Feels like this should be done when defining the property. I think the operator type should basically be considered const after it is registered

Yes, makes sense. I actually only just noticed that op->type->prop is meant for this use. Looks messy though, probably needs a helper like RNA_property_set_default?

> @HooglyBoogly Feels like this should be done when defining the property. I think the operator type should basically be considered const after it is registered Yes, makes sense. I actually only just noticed that `op->type->prop` is meant for this use. Looks messy though, probably needs a helper like `RNA_property_set_default`?
Member

Yes, makes sense. I actually only just noticed that op->type->prop is meant for this use. Looks messy though, probably needs a helper like RNA_property_set_default?

It's usually written like ot->prop = RNA_def_* which isn't so bad. It's really more related to the operator system than RNA. So if we had something, WM_operator_set_default_prop might be better. But I'd probably wait for something like a different API for registering operators.

> Yes, makes sense. I actually only just noticed that `op->type->prop` is meant for this use. Looks messy though, probably needs a helper like `RNA_property_set_default`? It's usually written like `ot->prop = RNA_def_*` which isn't so bad. It's really more related to the operator system than RNA. So if we had something, `WM_operator_set_default_prop` might be better. But I'd probably wait for something like a different API for registering operators.
Author
Member

@HooglyBoogly - It's usually written like ot->prop = RNA_def_* which isn't so bad...

OMG, I didn't recognize that this is what that was doing. Just because we have so many instances where we assign to it multiple times - like in ANIM_OT_channels_view_selected for example.

But I see that now. Finally makes sense. LOL.

> @HooglyBoogly - It's usually written like `ot->prop = RNA_def_*` which isn't so bad... OMG, I didn't recognize that this is what that was doing. Just because we have so many instances where we assign to it multiple times - like in ANIM_OT_channels_view_selected for example. But I see that now. Finally makes sense. LOL.
Harley Acheson added 2 commits 2024-03-02 22:07:10 +01:00
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
0863bcf8cc
changes requested by review.
Author
Member

Could this be done by giving the string property a default value? That seems better than potentially overriding a value remembered from last time or a value set explicitly

I don't think so? The property would then just have that value in times when it could otherwise be blank. Setting the default name or value there fits with similar uses in image_new_invoke, move_to_collection_invoke.

> Could this be done by giving the string property a default value? That seems better than potentially overriding a value remembered from last time or a value set explicitly I don't think so? The property would then just have that value in times when it could otherwise be blank. Setting the default name or value there fits with similar uses in image_new_invoke, move_to_collection_invoke.
Author
Member

@HooglyBoogly

Testing the idea of just adding these as property defaults, I am seeing odd things to do with translation. As in if I make the default string "Bones", IFACE_("Bones"), N_("Bones"), etc it works in English, but in Spanish I only ever see the word "Bones". Even though I know that this word is translated because I see "Huesos" if add one in the Bone Collections list.

But does work where I have it in the invoke.

@HooglyBoogly Testing the idea of just adding these as property defaults, I am seeing odd things to do with translation. As in if I make the default string `"Bones"`, ` IFACE_("Bones")`, `N_("Bones")`, etc it works in English, but in Spanish I only ever see the word "Bones". Even though I know that this word is translated because I see "Huesos" if add one in the Bone Collections list. But does work where I have it in the invoke.
Member

Great point, didn't think of that!

Great point, didn't think of that!
Author
Member

@blender-bot build

@blender-bot build
Harley Acheson added 2 commits 2024-03-05 18:21:31 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
8dcb590762
Formatting changes.
Author
Member

@blender-bot build

@blender-bot build
Harley Acheson merged commit 615edb3f3c into main 2024-03-05 18:55:01 +01:00
Harley Acheson deleted branch ProDialogDefProps 2024-03-05 18:55:04 +01:00
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 project
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#119007
No description provided.