[Bf-blender-cvs] [27f3f3d8a72] property-search-ui-v2: Use RNA to set the pin ID

Hans Goudey noreply at git.blender.org
Wed Sep 9 18:11:50 CEST 2020


Commit: 27f3f3d8a723627a8f8091aab3484fccd7ca2b3a
Author: Hans Goudey
Date:   Wed Sep 9 10:54:34 2020 -0500
Branches: property-search-ui-v2
https://developer.blender.org/rB27f3f3d8a723627a8f8091aab3484fccd7ca2b3a

Use RNA to set the pin ID

===================================================================

M	source/blender/editors/space_buttons/buttons_ops.c

===================================================================

diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 10e1e1613cf..2e6ad82ef08 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -60,10 +60,20 @@ static int toggle_pin_exec(bContext *C, wmOperator *UNUSED(op))
 {
   SpaceProperties *sbuts = CTX_wm_space_properties(C);
 
-  sbuts->pinid = (sbuts->flag & SB_PIN_CONTEXT) ? NULL : buttons_context_id_path(C);
-
   sbuts->flag ^= SB_PIN_CONTEXT;
 
+  /* Create the properties space pointer. */
+  PointerRNA sbuts_ptr;
+  bScreen *screen = CTX_wm_screen(C);
+  RNA_pointer_create(&screen->id, &RNA_SpaceProperties, sbuts, &sbuts_ptr);
+
+  /* Create the new ID pointer and set the the pin ID with RNA
+   * so we can use the property's RNA update functionality. */
+  ID *new_id = (sbuts->flag & SB_PIN_CONTEXT) ? buttons_context_id_path(C) : NULL;
+  PointerRNA new_id_ptr;
+  RNA_id_pointer_create(new_id, &new_id_ptr);
+  RNA_pointer_set(&sbuts_ptr, "pin_id", new_id_ptr);
+
   ED_area_tag_redraw(CTX_wm_area(C));
 
   return OPERATOR_FINISHED;



More information about the Bf-blender-cvs mailing list