UI: move toggle icons out of layout checks into rna
authorCampbell Barton <ideasman42@gmail.com>
Thu, 30 Jan 2014 05:24:51 +0000 (16:24 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 30 Jan 2014 05:24:51 +0000 (16:24 +1100)
release/scripts/startup/bl_ui/properties_data_bone.py
release/scripts/startup/bl_ui/properties_render.py
release/scripts/startup/bl_ui/space_image.py
release/scripts/startup/bl_ui/space_sequencer.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/makesrna/RNA_define.h
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_pose.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_sequencer.c

index 4e36065422dcc2f05cdb3112547fb4e5450c7714..0f5039a40eae1726d04ed812e8e14a3fe7830155 100644 (file)
@@ -253,7 +253,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel):
         active = pchan.is_in_ik_chain
 
         split = layout.split(percentage=0.25)
-        split.prop(pchan, "lock_ik_x", icon='LOCKED' if pchan.lock_ik_x else 'UNLOCKED', text="X")
+        split.prop(pchan, "lock_ik_x", text="X", icon_only=True)
         split.active = active
         row = split.row()
         row.prop(pchan, "ik_stiffness_x", text="Stiffness", slider=True)
@@ -270,7 +270,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel):
         sub.active = pchan.lock_ik_x is False and pchan.use_ik_limit_x and active
 
         split = layout.split(percentage=0.25)
-        split.prop(pchan, "lock_ik_y", icon='LOCKED' if pchan.lock_ik_y else 'UNLOCKED', text="Y")
+        split.prop(pchan, "lock_ik_y", text="Y", icon_only=True)
         split.active = active
         row = split.row()
         row.prop(pchan, "ik_stiffness_y", text="Stiffness", slider=True)
@@ -288,7 +288,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel):
         sub.active = pchan.lock_ik_y is False and pchan.use_ik_limit_y and active
 
         split = layout.split(percentage=0.25)
-        split.prop(pchan, "lock_ik_z", icon='LOCKED' if pchan.lock_ik_z else 'UNLOCKED', text="Z")
+        split.prop(pchan, "lock_ik_z", text="Z", icon_only=True)
         split.active = active
         sub = split.row()
         sub.prop(pchan, "ik_stiffness_z", text="Stiffness", slider=True)
index ebcb8ea3de7ae9a766898c0f9d2cb627e9c767a9..ce375eca894ad92b7982e30731f01d7d8ec12119 100644 (file)
@@ -74,11 +74,7 @@ class RENDER_PT_render(RenderButtonsPanel, Panel):
         split.label(text="Display:")
         row = split.row(align=True)
         row.prop(rd, "display_mode", text="")
-
-        if rd.use_lock_interface:
-            row.prop(rd, "use_lock_interface", text="", icon='LOCKED')
-        else:
-            row.prop(rd, "use_lock_interface", text="", icon='UNLOCKED')
+        row.prop(rd, "use_lock_interface", icon_only=True)
 
 
 class RENDER_PT_dimensions(RenderButtonsPanel, Panel):
index c341d855ccc56ea02d84d5df8061f9c5e1909d4d..5c221412d43e754e7a7b3dc6472fc522b8967c31 100644 (file)
@@ -874,11 +874,10 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
         col.separator()
 
         row = col.row(align=True)
+        row.prop(brush, "use_relative_jitter", icon_only=True)
         if brush.use_relative_jitter:
-            row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
             row.prop(brush, "jitter", slider=True)
         else:
-            row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
             row.prop(brush, "jitter_absolute")
         row.prop(brush, "use_pressure_jitter", toggle=True, text="")
 
index eab4f5ea541738e3e40a0bce84f398592b5d0d1c..d7acffa05c7747a2a9107c9343a03e26320a1937 100644 (file)
@@ -427,12 +427,12 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
             sub = row.row(align=True)
             sub.active = (not strip.mute)
             sub.prop(strip, "blend_alpha", text="Opacity", slider=True)
-            row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
-            row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
+            row.prop(strip, "mute", toggle=True, icon_only=True)
+            row.prop(strip, "lock", toggle=True, icon_only=True)
         else:
             row = layout.row(align=True)
-            row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF')
-            row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED')
+            row.prop(strip, "mute", toggle=True, icon_only=True)
+            row.prop(strip, "lock", toggle=True, icon_only=True)
 
         col = layout.column()
         sub = col.column()
index 4056be04a26ffbb7c0440da22e80c79d029fb971..bb86285e0d9547c5af1626ef8b3331eeeed52f1c 100644 (file)
@@ -738,10 +738,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
                 row = col.row(align=True)
 
                 if capabilities.has_space_attenuation:
-                    if brush.use_space_attenuation:
-                        row.prop(brush, "use_space_attenuation", toggle=True, text="", icon='LOCKED')
-                    else:
-                        row.prop(brush, "use_space_attenuation", toggle=True, text="", icon='UNLOCKED')
+                    row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True)
 
                 self.prop_unified_strength(row, context, brush, "strength", text="Strength")
                 self.prop_unified_strength(row, context, brush, "use_pressure_strength")
@@ -771,10 +768,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
                 col.separator()
                 row = col.row(align=True)
 
-                if brush.use_original_normal:
-                    row.prop(brush, "use_original_normal", toggle=True, text="", icon='LOCKED')
-                else:
-                    row.prop(brush, "use_original_normal", toggle=True, text="", icon='UNLOCKED')
+                row.prop(brush, "use_original_normal", toggle=True, icon_only=True)
 
                 row.prop(brush, "sculpt_plane", text="")
 
@@ -1061,11 +1055,10 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
                 col.separator()
 
                 row = col.row(align=True)
+                row.prop(brush, "use_relative_jitter", icon_only=True)
                 if brush.use_relative_jitter:
-                    row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
                     row.prop(brush, "jitter", slider=True)
                 else:
-                    row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
                     row.prop(brush, "jitter_absolute")
                 row.prop(brush, "use_pressure_jitter", toggle=True, text="")
 
@@ -1083,11 +1076,10 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
             col.separator()
 
             row = col.row(align=True)
+            row.prop(brush, "use_relative_jitter", icon_only=True)
             if brush.use_relative_jitter:
-                row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
                 row.prop(brush, "jitter", slider=True)
             else:
-                row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
                 row.prop(brush, "jitter_absolute")
             row.prop(brush, "use_pressure_jitter", toggle=True, text="")
 
index 2b1a5bc71ff2d1beb001ad72cdf7343b6da5e7b4..cc876b4375ec8ba4da1d028db177ba35f0dfa0f9 100644 (file)
@@ -158,7 +158,7 @@ void RNA_def_property_string_default(PropertyRNA *prop, const char *value);
 
 void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description);
 void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision);
-void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive);
+void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, bool consecutive);
 
 void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *updatefunc);
 void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable);
index aa9d70fd979dd788b6b34d0c545166617acfd66b..34c44565456aa7f85f065074e33cd8d043e98111 100644 (file)
@@ -883,6 +883,7 @@ static void rna_def_brush(BlenderRNA *brna)
        
        prop = RNA_def_property(srna, "use_original_normal", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ORIGINAL_NORMAL);
+       RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
        RNA_def_property_ui_text(prop, "Original Normal",
                                 "When locked keep using normal of surface where stroke was initiated");
        RNA_def_property_update(prop, 0, "rna_Brush_update");
@@ -935,6 +936,7 @@ static void rna_def_brush(BlenderRNA *brna)
 
        prop = RNA_def_property(srna, "use_relative_jitter", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BRUSH_ABSOLUTE_JITTER);
+       RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
        RNA_def_property_ui_text(prop, "Absolute Jitter", "Jittering happens in screen space, not relative to brush size");
        RNA_def_property_update(prop, 0, "rna_Brush_update");
 
@@ -980,6 +982,7 @@ static void rna_def_brush(BlenderRNA *brna)
        
        prop = RNA_def_property(srna, "use_space_attenuation", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE_ATTEN);
+       RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
        RNA_def_property_ui_text(prop, "Use Automatic Strength Adjustment",
                                 "Automatically adjust strength to give consistent results for different spacings");
        RNA_def_property_update(prop, 0, "rna_Brush_update");
index 319e49c5462a921952e112557b613610020c3938..fedfdd42b55c3c8c376319a7e6ad35712c1afe1d 100644 (file)
@@ -1305,7 +1305,7 @@ void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *d
        prop->description = description;
 }
 
-void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
+void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, bool consecutive)
 {
        prop->icon = icon;
        if (consecutive)
index 9c4e7f034cb2ca71f5a331202e9b578c00f730fe..4ece8a25e73b70eb9326c6b8fe8ed272d5b061cc 100644 (file)
@@ -883,18 +883,21 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 
        prop = RNA_def_property(srna, "lock_ik_x", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_XDOF);
+       RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
        RNA_def_property_ui_text(prop, "IK X Lock", "Disallow movement around the X axis");
        RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
        RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
 
        prop = RNA_def_property(srna, "lock_ik_y", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_YDOF);
+       RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
        RNA_def_property_ui_text(prop, "IK Y Lock", "Disallow movement around the Y axis");
        RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
        RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
 
        prop = RNA_def_property(srna, "lock_ik_z", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_ZDOF);
+       RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
        RNA_def_property_ui_text(prop, "IK Z Lock", "Disallow movement around the Z axis");
        RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
        RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
index 19d90ab752ba3af2aff5ad8ac14f42635b24ac79..e901737c670b7f3b57eafed2cbbbb206f70db475 100644 (file)
@@ -4541,6 +4541,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 
        prop = RNA_def_property(srna, "use_lock_interface", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "use_lock_interface", 1);
+       RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
        RNA_def_property_ui_text(prop, "Lock Interface", "Lock interface during rendering in favor of giving more memory to the renderer");
        RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
 
index d8fc8799237b9b9e54fc63d2f827937fd511cd37..ba5f42f311f1f436f50675430f99c2fe0f4dd5e0 100644 (file)
@@ -1404,11 +1404,13 @@ static void rna_def_sequence(BlenderRNA *brna)
 
        prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MUTE);
+       RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, true);
        RNA_def_property_ui_text(prop, "Mute", "");
        RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_mute_update");
 
        prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LOCK);
+       RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
        RNA_def_property_ui_text(prop, "Lock", "Lock strip so that it can't be transformed");
        RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);