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, 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. Pull Request: https://projects.blender.org/blender/blender/pulls/110929
This commit is contained in:
parent
485c98cc2c
commit
4cefe0ec80
@ -547,8 +547,7 @@ static int node_add_object_invoke(bContext *C, wmOperator *op, const wmEvent *ev
|
||||
static bool node_add_object_poll(bContext *C)
|
||||
{
|
||||
const SpaceNode *snode = CTX_wm_space_node(C);
|
||||
return ED_operator_node_editable(C) && ELEM(snode->nodetree->type, NTREE_GEOMETRY) &&
|
||||
!UI_but_active_drop_name(C);
|
||||
return ED_operator_node_editable(C) && ELEM(snode->nodetree->type, NTREE_GEOMETRY);
|
||||
}
|
||||
|
||||
void NODE_OT_add_object(wmOperatorType *ot)
|
||||
@ -634,8 +633,7 @@ static int node_add_collection_invoke(bContext *C, wmOperator *op, const wmEvent
|
||||
static bool node_add_collection_poll(bContext *C)
|
||||
{
|
||||
const SpaceNode *snode = CTX_wm_space_node(C);
|
||||
return ED_operator_node_editable(C) && ELEM(snode->nodetree->type, NTREE_GEOMETRY) &&
|
||||
!UI_but_active_drop_name(C);
|
||||
return ED_operator_node_editable(C) && ELEM(snode->nodetree->type, NTREE_GEOMETRY);
|
||||
}
|
||||
|
||||
void NODE_OT_add_collection(wmOperatorType *ot)
|
||||
|
@ -676,14 +676,14 @@ static bool node_group_drop_poll(bContext * /*C*/, wmDrag *drag, const wmEvent *
|
||||
return WM_drag_is_ID_type(drag, ID_NT);
|
||||
}
|
||||
|
||||
static bool node_object_drop_poll(bContext * /*C*/, wmDrag *drag, const wmEvent * /*event*/)
|
||||
static bool node_object_drop_poll(bContext *C, wmDrag *drag, const wmEvent * /*event*/)
|
||||
{
|
||||
return WM_drag_is_ID_type(drag, ID_OB);
|
||||
return WM_drag_is_ID_type(drag, ID_OB) && !UI_but_active_drop_name(C);
|
||||
}
|
||||
|
||||
static bool node_collection_drop_poll(bContext * /*C*/, wmDrag *drag, const wmEvent * /*event*/)
|
||||
static bool node_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent * /*event*/)
|
||||
{
|
||||
return WM_drag_is_ID_type(drag, ID_GR);
|
||||
return WM_drag_is_ID_type(drag, ID_GR) && !UI_but_active_drop_name(C);
|
||||
}
|
||||
|
||||
static bool node_ima_drop_poll(bContext * /*C*/, wmDrag *drag, const wmEvent * /*event*/)
|
||||
|
Loading…
Reference in New Issue
Block a user