Page MenuHome

Fix for T86613: Renaming in outliner doesn't trigger rename event
ClosedPublic

Authored by Erik Abrahamsson (erik85) on Mar 16 2021, 5:24 AM.

Details

Summary

When subscribing to name-changes through the API, the event doesn't trigger if the object is renamed in the outliner.
Fixed by publishing the RNA changes.

See T86613

Diff Detail

Repository
rB Blender

Event Timeline

Erik Abrahamsson (erik85) requested review of this revision.Mar 16 2021, 5:24 AM
Erik Abrahamsson (erik85) created this revision.
Campbell Barton (campbellbarton) requested changes to this revision.EditedMar 17 2021, 8:00 AM

This assumes the name is for an object, where as the name could be from a modifier or a bone.

Instead namebutton_fn could call:

  • WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, name);
  • WM_msg_publish_rna_prop(mbus, &arm->id, ebone, EditBone, name);

and similar functions for other ID types, eventually this should replace the notifiers.


A larger refactor could use RNA, setting the "name" of each item, instead of having to add calls to BKE_object_defgroup_unique_name, BLI_libblock_ensure_unique_name.. etc, seems unnecessarily low level, for an operation RNA already supports.

This revision now requires changes to proceed.Mar 17 2021, 8:00 AM

Thanks @Campbell Barton (campbellbarton) , I went for the easier idea you had. Not sure if I covered all possible cases but it's a start I guess.

Campbell Barton (campbellbarton) requested changes to this revision.Mar 17 2021, 11:42 PM
Campbell Barton (campbellbarton) added inline comments.
source/blender/editors/space_outliner/outliner_draw.c
740

The 3rd argument should be the vertex group, not the ID, suggest to assign te->directdata to the proper type, to make code read better (also for use above).

This revision now requires changes to proceed.Mar 17 2021, 11:42 PM
Erik Abrahamsson (erik85) marked an inline comment as done.

Fixed the vertex group argument error.

Campbell Barton (campbellbarton) requested changes to this revision.Mar 22 2021, 11:27 AM

The patch needs updating to apply on master.

  • All the &tselem->id are passing the wrong pointer type, in most/all cases these have been assigned a variable, scene, object, armature etc. Those can be used instead.
source/blender/editors/space_outliner/outliner_draw.c:677:37: error: passing argument 1 of 'RNA_pointer_create' from incompatible pointer type [-Werror=incompatible-pointer-types]
  677 |       WM_msg_publish_rna_prop(mbus, &tselem->id, id, ID, name);
      |                                     ^~~~~~~~~~~
      |                                     |
      |                                     struct ID **

This also warns:

source/blender/editors/space_outliner/outliner_draw.c:733:11: error: a label can only be part of a statement and a declaration is not a statement
  733 |           bDeformGroup *vg = te->directdata;
      |           ^~~~~~~~~~~~
This revision now requires changes to proceed.Mar 22 2021, 11:27 AM
Erik Abrahamsson (erik85) edited the summary of this revision. (Show Details)

@Campbell Barton (campbellbarton) sorry about that, must have missed to compile or something. Patch is updated to master and changed according to what I think you meant..

Applied with some edits, LayerCollection will use an ID of Collection, there was a missing message for pose bones.

This revision is now accepted and ready to land.Mar 25 2021, 2:42 PM