Fix #110723: cant drop object name on object field/socket in node editor #110929

Merged
Philipp Oeser merged 3 commits from lichtwerk/blender:110723 into main 2023-08-14 13:12:40 +02:00
Member

Reason was a difference in poll functions (dropbox poll function vs.
operator poll function).

So the dropbox was actually recognized as being active (see
dropbox_active) but then when actually dropping, the corresponding
operator wasnt called (but instead another operator was).

In detail, the way wm_handlers_do_intern works, it checks all
dropboxes poll function if one succeeds it calls the dropbox operator.
But if that operators poll function fails, wm_handlers_do_intern
happily continues and "ends" the drop operations in a way we dont
actually get to the "real" dropbox & operator that was also recognized
as being active.

In the case of the report:

  • dropbox for UI_OT_drop_name is active
  • dropbox poll for NODE_OT_add_object (node_object_drop_poll)
    succeeds though
  • operator poll for NODE_OT_add_object (node_add_object_poll) fails
    (it checks UI_but_active_drop_name already)

So in order to make this work, add the check for UI_but_active_drop_name to two dropbox poll
functions (and remove from the operator polls).

Probably good for LTS as well.

Reason was a difference in poll functions (dropbox poll function vs. operator poll function). So the dropbox was actually recognized as being active (see `dropbox_active`) but then when actually dropping, the corresponding operator wasnt called (but instead another operator was). In detail, the way `wm_handlers_do_intern` works, it checks all dropboxes poll function if one succeeds it calls the dropbox operator. But if that operators poll function fails, `wm_handlers_do_intern` happily continues and "ends" the drop operations in a way we dont actually get to the "real" dropbox & operator that was also recognized as being active. In the case of the report: - dropbox for `UI_OT_drop_name` is active - dropbox poll for `NODE_OT_add_object` (`node_object_drop_poll`) succeeds though - operator poll for `NODE_OT_add_object` (`node_add_object_poll`) fails (it checks `UI_but_active_drop_name` already) So in order to make this work, add the check for `UI_but_active_drop_name` to two dropbox poll functions (and remove from the operator polls). Probably good for LTS as well.
Philipp Oeser added 1 commit 2023-08-08 15:33:13 +02:00
117d04f2d1 Fix #110723: cant drop object name on object field/socket in node editor
Reason was a difference in poll functions (dropbox poll function vs.
operator poll function).

So the dropbox was actually recognized as being active (see
`dropbox_active`) but then when actually dropping, the corresponding
operator wasnt called (but instead another operator was).

In detail, the way `wm_handlers_do_intern` works, it checks all
dropboxes poll function if one succeeds it calls the dropbox operator.
But if that operators poll function fails, `wm_handlers_do_intern`
happily continues and "ends" the drop operations in a way we dont
actually get to the "real" dropbox & operator that was also recognized
as being active.

In the case of the report:
- dropbox for `UI_OT_drop_name` is active
- dropbox poll for `NODE_OT_add_object` (`node_object_drop_poll`)
succeeds though
- operator poll for `NODE_OT_add_object` (`node_add_object_poll`) fails
(it checks `UI_but_active_drop_name` already)

So in order to make this work, bring the poll functions in sync by
adding the check for `UI_but_active_drop_name` to two dropbox poll
functions as well.

Probably good for LTS as well.
Philipp Oeser added this to the User Interface project 2023-08-08 15:33:22 +02:00
Philipp Oeser requested review from Hans Goudey 2023-08-08 15:33:30 +02:00
Philipp Oeser added the
Interest
Nodes & Physics
label 2023-08-08 15:33:46 +02:00
Philipp Oeser requested review from Julian Eisel 2023-08-08 15:34:07 +02:00
Member

The fix itself makes sense I think. But I wonder if it really makes sense to duplicate the poll functions for dropboxes and operators. When an dropbox just references an operator, theoretically we could just call the operator poll function right? Maybe I'm missing something?

The fix itself makes sense I think. But I wonder if it really makes sense to duplicate the poll functions for dropboxes and operators. When an dropbox just references an operator, theoretically we could just call the operator poll function right? Maybe I'm missing something?
Author
Member

The fix itself makes sense I think. But I wonder if it really makes sense to duplicate the poll functions for dropboxes and operators. When an dropbox just references an operator, theoretically we could just call the operator poll function right? Maybe I'm missing something?

Afaict, the dropbox poll functions get direct access to the wmDrag [which the operator poll doesnt]

> The fix itself makes sense I think. But I wonder if it really makes sense to duplicate the poll functions for dropboxes and operators. When an dropbox just references an operator, theoretically we could just call the operator poll function right? Maybe I'm missing something? Afaict, the dropbox poll functions get direct access to the `wmDrag` [which the operator poll doesnt]
Julian Eisel reviewed 2023-08-10 17:48:11 +02:00
Julian Eisel left a comment
Member

It's not great to have a dropbox poll include checks for other dropboxes. But I guess it makes sense in this corner case. Maybe we could invert the order of the dropboxes instead, so the button dropboxes have priority.

For now this seems fine, although I think we can remove the poll check from the operator?

It's not great to have a dropbox poll include checks for other dropboxes. But I guess it makes sense in this corner case. Maybe we could invert the order of the dropboxes instead, so the button dropboxes have priority. For now this seems fine, although I think we can remove the poll check from the operator?
Philipp Oeser added 2 commits 2023-08-11 13:38:06 +02:00
Author
Member

Maybe we could invert the order of the dropboxes instead, so the button dropboxes have priority.

I tried registering (ED_dropboxes_ui) the UI dropboxes after the space dropboxes (currently this is the other way around) but that didnt change the order they were called. The proper way to do that would be to delay ed_default_handlers to happen after the area and region init in ED_area_init (tried that, would actually work, yes).
However, I dont think giving a whole whole group of dropboxes priority over another group is much cleaner, I think it is more flexible and transparent to be able define/check polls that could let you give prio to whatever dropbox you like.
No strong opinion here though, your call :)

although I think we can remove the poll check from the operator?

Think so, too, updated the PR.

> Maybe we could invert the order of the dropboxes instead, so the button dropboxes have priority. I tried registering (`ED_dropboxes_ui`) the UI dropboxes **after** the space dropboxes (currently this is the other way around) but that didnt change the order they were called. The proper way to do that would be to delay `ed_default_handlers` to happen after the area and region init in `ED_area_init` (tried that, would actually work, yes). However, I dont think giving a whole whole group of dropboxes priority over another group is much cleaner, I think it is more flexible and transparent to be able define/check polls that could let you give prio to whatever dropbox you like. No strong opinion here though, your call :) > although I think we can remove the poll check from the operator? Think so, too, updated the PR.
Julian Eisel approved these changes 2023-08-14 12:44:41 +02:00
Julian Eisel left a comment
Member

However, I dont think giving a whole whole group of dropboxes priority over another group is much cleaner, I think it is more flexible and transparent to be able define/check polls that could let you give prio to whatever dropbox you like.

We have to figure out what order makes the most sense: UI dropboxes before space dropboxes or the other way around. Issues like this suggest the current order may be sub-optimal, and we should consider changing it. Dependencies between different dropboxes and such tend to get out of sync, so they are code/design smells.
Anyway, this is more of a correction to a previous fix, the order of dropbox handling priority can still be changed.

> However, I dont think giving a whole whole group of dropboxes priority over another group is much cleaner, I think it is more flexible and transparent to be able define/check polls that could let you give prio to whatever dropbox you like. We have to figure out what order makes the most sense: UI dropboxes before space dropboxes or the other way around. Issues like this suggest the current order may be sub-optimal, and we should consider changing it. Dependencies between different dropboxes and such tend to get out of sync, so they are code/design smells. Anyway, this is more of a correction to a previous fix, the order of dropbox handling priority can still be changed.
Author
Member

However, I dont think giving a whole whole group of dropboxes priority over another group is much cleaner, I think it is more flexible and transparent to be able define/check polls that could let you give prio to whatever dropbox you like.

We have to figure out what order makes the most sense: UI dropboxes before space dropboxes or the other way around. Issues like this suggest the current order may be sub-optimal, and we should consider changing it. Dependencies between different dropboxes and such tend to get out of sync, so they are code/design smells.
Anyway, this is more of a correction to a previous fix, the order of dropbox handling priority can still be changed.

If in doubt, the UI dropboxes should probably have preference (so delay ed_default_handlers to happen after the area and region init in ED_area_init), I would assumethere is a reason why these are called "general" which implies these should work everywhere.
Can put up another PR for this if you like (it is not the easiest task to reason this though -- as I said, there might be other cases where a region dropbox should have preference, wil aslo think about this more...)

> > However, I dont think giving a whole whole group of dropboxes priority over another group is much cleaner, I think it is more flexible and transparent to be able define/check polls that could let you give prio to whatever dropbox you like. > > We have to figure out what order makes the most sense: UI dropboxes before space dropboxes or the other way around. Issues like this suggest the current order may be sub-optimal, and we should consider changing it. Dependencies between different dropboxes and such tend to get out of sync, so they are code/design smells. > Anyway, this is more of a correction to a previous fix, the order of dropbox handling priority can still be changed. If in doubt, the UI dropboxes should probably have preference (so delay `ed_default_handlers` to happen after the area and region init in `ED_area_init`), I would assumethere is a reason why these are called "general" which implies these should work everywhere. Can put up another PR for this if you like (it is not the easiest task to reason this though -- as I said, there might be other cases where a region dropbox _should_ have preference, wil aslo think about this more...)
Philipp Oeser merged commit 4cefe0ec80 into main 2023-08-14 13:12:40 +02:00
Philipp Oeser deleted branch 110723 2023-08-14 13:12:45 +02: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
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
3 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#110929
No description provided.