[Bf-blender-cvs] [6539cf31992] master: Visibility panel: Use "toggle" keyword

Dalai Felinto noreply at git.blender.org
Wed May 22 18:23:20 CEST 2019


Commit: 6539cf319924a6a5bb473898dc343fd2485b2800
Author: Dalai Felinto
Date:   Wed May 22 16:18:44 2019 +0000
Branches: master
https://developer.blender.org/rB6539cf319924a6a5bb473898dc343fd2485b2800

Visibility panel: Use "toggle" keyword

No functional nor visual change.
This is a partial revert of 0910932e71d2.

The toggle option was introduced on 6640bcca7422.
This allow us to simplify the outliner draw code so it uses the icon as
defined in the RNA (as oppose to get the value there once again).

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

M	release/scripts/startup/bl_ui/properties_object.py
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/makesrna/intern/rna_object.c

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

diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index aeda8d8648a..526ec17f2cb 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -396,11 +396,11 @@ class OBJECT_PT_visibility(ObjectButtonsPanel, Panel):
         ob = context.object
 
         col = flow.column()
-        col.prop(ob, "hide_viewport", text="Show in Viewports", invert_checkbox=True)
+        col.prop(ob, "hide_viewport", text="Show in Viewports", toggle=False, invert_checkbox=True)
         col = flow.column()
-        col.prop(ob, "hide_render", text="Show in Renders", invert_checkbox=True)
+        col.prop(ob, "hide_render", text="Show in Renders", toggle=False, invert_checkbox=True)
         col = flow.column()
-        col.prop(ob, "hide_select", text="Selectable", invert_checkbox=True)
+        col.prop(ob, "hide_select", text="Selectable", toggle=False, invert_checkbox=True)
 
 
 class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, Panel):
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 3a3cdafc1f5..aed7af3911f 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1088,13 +1088,10 @@ static void outliner_draw_restrictbuts(uiBlock *block,
         }
 
         if (soops->show_restrict_flags & SO_RESTRICT_SELECT) {
-          const int icon = RNA_property_boolean_get(&ptr, props.object_hide_select) ?
-                               ICON_RESTRICT_SELECT_ON :
-                               ICON_RESTRICT_SELECT_OFF;
           bt = uiDefIconButR_prop(block,
                                   UI_BTYPE_ICON_TOGGLE,
                                   0,
-                                  icon,
+                                  0,
                                   (int)(ar->v2d.cur.xmax - restrict_offsets.select),
                                   te->ys,
                                   UI_UNIT_X,
@@ -1116,13 +1113,10 @@ static void outliner_draw_restrictbuts(uiBlock *block,
         }
 
         if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
-          const int icon = RNA_property_boolean_get(&ptr, props.object_hide_viewport) ?
-                               ICON_RESTRICT_VIEW_ON :
-                               ICON_RESTRICT_VIEW_OFF;
           bt = uiDefIconButR_prop(block,
                                   UI_BTYPE_ICON_TOGGLE,
                                   0,
-                                  icon,
+                                  0,
                                   (int)(ar->v2d.cur.xmax - restrict_offsets.viewport),
                                   te->ys,
                                   UI_UNIT_X,
@@ -1144,13 +1138,10 @@ static void outliner_draw_restrictbuts(uiBlock *block,
         }
 
         if (soops->show_restrict_flags & SO_RESTRICT_RENDER) {
-          const int icon = RNA_property_boolean_get(&ptr, props.object_hide_render) ?
-                               ICON_RESTRICT_RENDER_ON :
-                               ICON_RESTRICT_RENDER_OFF;
           bt = uiDefIconButR_prop(block,
                                   UI_BTYPE_ICON_TOGGLE,
                                   0,
-                                  icon,
+                                  0,
                                   (int)(ar->v2d.cur.xmax - restrict_offsets.render),
                                   te->ys,
                                   UI_UNIT_X,
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 716a3236561..e2f566cfdab 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2819,6 +2819,7 @@ static void rna_def_object(BlenderRNA *brna)
   RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEWPORT);
   RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
   RNA_def_property_ui_text(prop, "Disable in Viewports", "Globally disable in viewports");
+  RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
   RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
 
   prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
@@ -2826,12 +2827,14 @@ static void rna_def_object(BlenderRNA *brna)
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
   RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
   RNA_def_property_ui_text(prop, "Disable Selection", "Disable selection in viewport");
+  RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
   RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
 
   prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
   RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
   RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders");
+  RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
   RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
 
   prop = RNA_def_property(srna, "show_instancer_for_render", PROP_BOOLEAN, PROP_NONE);



More information about the Bf-blender-cvs mailing list