[Bf-blender-cvs] [e7fc0965d6c] temp-lineart-contained: Cleanup: Remove unecessary logic in panel code

Hans Goudey noreply at git.blender.org
Sat Dec 19 06:18:49 CET 2020


Commit: e7fc0965d6c15d38dfb28885ba21e1c89bbab5fa
Author: Hans Goudey
Date:   Thu Nov 12 23:32:50 2020 -0500
Branches: temp-lineart-contained
https://developer.blender.org/rBe7fc0965d6c15d38dfb28885ba21e1c89bbab5fa

Cleanup: Remove unecessary logic in panel code

Also use short for panel flag arguments to functions since it matches
the type in DNA, and remove a comment that isn't helpful.

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

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

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

diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 09c918b31ec..76dc41a7312 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -604,28 +604,20 @@ static void set_panels_list_data_expand_flag(const bContext *C, const ARegion *r
 
 /**
  * Set flag state for a panel and its sub-panels.
- *
- * \return True if this function changed any of the flags, false if it didn't.
  */
-static bool panel_set_flag_recursive(Panel *panel, int flag, bool value)
+static void panel_set_flag_recursive(Panel *panel, short flag, bool value)
 {
-  const short flag_original = panel->flag;
-
   SET_FLAG_FROM_TEST(panel->flag, value, flag);
 
-  bool changed = (flag_original != panel->flag);
-
   LISTBASE_FOREACH (Panel *, child, &panel->children) {
-    changed |= panel_set_flag_recursive(child, flag, value);
+    panel_set_flag_recursive(child, flag, value);
   }
-
-  return changed;
 }
 
 /**
  * Set runtime flag state for a panel and its sub-panels.
  */
-static void panel_set_runtime_flag_recursive(Panel *panel, int flag, bool value)
+static void panel_set_runtime_flag_recursive(Panel *panel, short flag, bool value)
 {
   SET_FLAG_FROM_TEST(panel->runtime_flag, value, flag);
 
@@ -1836,23 +1828,17 @@ static void ui_do_animate(bContext *C, Panel *panel)
   float fac = (PIL_check_seconds_timer() - data->starttime) / ANIMATION_TIME;
   fac = min_ff(sqrtf(fac), 1.0f);
 
-  /* For max 1 second, interpolate positions. */
   if (uiAlignPanelStep(region, fac, false)) {
     ED_region_tag_redraw(region);
   }
   else {
-    fac = 1.0f;
-  }
-
-  if (fac >= 1.0f) {
     if (UI_panel_is_dragging(panel)) {
       /* Note: doing this in #panel_activate_state would require
-       *  removing `const` for context in many other places. */
+       * removing `const` for context in many other places. */
       reorder_instanced_panel_list(C, region, panel);
     }
 
     panel_activate_state(C, panel, PANEL_STATE_EXIT);
-    return;
   }
 }



More information about the Bf-blender-cvs mailing list