[Bf-blender-cvs] [a2de3d86de2] master: Fix utterly wrong decorator button logic

Julian Eisel noreply at git.blender.org
Sun Apr 26 17:40:12 CEST 2020


Commit: a2de3d86de29575698f42a167b8d2c4acf05c38e
Author: Julian Eisel
Date:   Sun Apr 26 16:02:18 2020 +0200
Branches: master
https://developer.blender.org/rBa2de3d86de29575698f42a167b8d2c4acf05c38e

Fix utterly wrong decorator button logic

This was in fact completely messed up, but it worked by accident for all
current cases. That is, we always inserted the decorator buttons
immediately after the button they applied to. So the first button
comparision in ui_but_anim_decorate_find_attached_button() would
succeed, because it just compared a few values that all happened to be
NULL and thus the comparison returned true.

Further, avoid NULL-pointer dereferences and incorrect printing.

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

M	source/blender/editors/interface/interface_anim.c

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

diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 877216daacc..ed591335660 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -123,10 +123,11 @@ static uiBut *ui_but_anim_decorate_find_attached_button(uiBut *but_decorate)
   BLI_assert(but_decorate->rnasearchpoin.data && but_decorate->rnasearchprop);
 
   LISTBASE_CIRCULAR_BACKWARD_BEGIN (&but_decorate->block->buttons, but_iter, but_decorate->prev) {
-    if (but_iter != but_decorate && ui_but_rna_equals_ex(but_decorate,
-                                                         &but_iter->rnasearchpoin,
-                                                         but_iter->rnasearchprop,
-                                                         POINTER_AS_INT(but_iter->custom_data))) {
+    if (but_iter != but_decorate &&
+        ui_but_rna_equals_ex(but_iter,
+                             &but_decorate->rnasearchpoin,
+                             but_decorate->rnasearchprop,
+                             POINTER_AS_INT(but_decorate->custom_data))) {
       return but_iter;
     }
   }
@@ -140,9 +141,10 @@ void ui_but_anim_decorate_update_from_flag(uiBut *but)
   const uiBut *but_anim = ui_but_anim_decorate_find_attached_button(but);
 
   if (!but_anim) {
-    printf("Could not find button with matching property to decorate (%s.%s)",
-           RNA_struct_identifier(but->rnapoin.type),
-           RNA_property_identifier(but->rnaprop));
+    printf("Could not find button with matching property to decorate (%s.%s)\n",
+           RNA_struct_identifier(but->rnasearchpoin.type),
+           RNA_property_identifier(but->rnasearchprop));
+    return;
   }
 
   int flag = but_anim->flag;



More information about the Bf-blender-cvs mailing list