[Bf-blender-cvs] [248060c8849] soc-2019-outliner: Outliner: Show enable/disable button for constraints
Nathan Craddock
noreply at git.blender.org
Sat Jun 15 07:05:04 CEST 2019
Commit: 248060c8849232b40339c74d7e222ecc10c7ecb4
Author: Nathan Craddock
Date: Fri Jun 14 23:03:27 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB248060c8849232b40339c74d7e222ecc10c7ecb4
Outliner: Show enable/disable button for constraints
This adds the restriction icon for constraints in the outliner so
they can be enabled/disabled similar to modifiers.
It also moves the icon definition to RNA from the UI template for
the constraints in the properties editor.
===================================================================
M source/blender/editors/interface/interface_templates.c
M source/blender/editors/space_outliner/outliner_draw.c
M source/blender/makesrna/intern/rna_constraint.c
===================================================================
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 4efa024ac77..ae0af0b9b78 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2524,7 +2524,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
/* enabled */
UI_block_emboss_set(block, UI_EMBOSS_NONE);
- uiItemR(row, &ptr, "mute", 0, "", (con->flag & CONSTRAINT_OFF) ? ICON_HIDE_ON : ICON_HIDE_OFF);
+ uiItemR(row, &ptr, "mute", 0, "", 0);
UI_block_emboss_set(block, UI_EMBOSS);
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 0c87cfa3e1e..78aeeb9bda5 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -844,6 +844,7 @@ typedef struct RestrictProperties {
PropertyRNA *layer_collection_holdout, *layer_collection_indirect_only,
*layer_collection_hide_viewport;
PropertyRNA *modifier_show_viewport, *modifier_show_render;
+ PropertyRNA *constraint_enable;
} RestrictProperties;
/* We don't care about the value of the property
@@ -861,6 +862,7 @@ typedef struct RestrictPropertiesActive {
bool layer_collection_hide_viewport;
bool modifier_show_viewport;
bool modifier_show_render;
+ bool constraint_enable;
} RestrictPropertiesActive;
static void outliner_restrict_properties_enable_collection_set(
@@ -874,6 +876,7 @@ static void outliner_restrict_properties_enable_collection_set(
props_active->layer_collection_indirect_only = false;
props_active->object_hide_render = false;
props_active->modifier_show_render = false;
+ props_active->constraint_enable = false;
}
}
@@ -887,6 +890,7 @@ static void outliner_restrict_properties_enable_collection_set(
props_active->object_hide_viewport = false;
props_active->base_hide_viewport = false;
props_active->modifier_show_viewport = false;
+ props_active->constraint_enable = false;
}
}
@@ -957,6 +961,8 @@ static void outliner_draw_restrictbuts(uiBlock *block,
props.modifier_show_viewport = RNA_struct_type_find_property(&RNA_Modifier, "show_viewport");
props.modifier_show_render = RNA_struct_type_find_property(&RNA_Modifier, "show_render");
+ props.constraint_enable = RNA_struct_type_find_property(&RNA_Constraint, "mute");
+
props.initialized = true;
}
@@ -1143,6 +1149,35 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
}
}
+ else if (tselem->type == TSE_CONSTRAINT) {
+ bConstraint *con = (bConstraint *)te->directdata;
+
+ PointerRNA ptr;
+ RNA_pointer_create(tselem->id, &RNA_Constraint, con, &ptr);
+
+ if (soops->show_restrict_flags & SO_RESTRICT_HIDE) {
+ bt = uiDefIconButR_prop(block,
+ UI_BTYPE_ICON_TOGGLE,
+ 0,
+ 0,
+ (int)(ar->v2d.cur.xmax - restrict_offsets.hide),
+ te->ys,
+ UI_UNIT_X,
+ UI_UNIT_Y,
+ &ptr,
+ props.constraint_enable,
+ -1,
+ 0,
+ 0,
+ -1,
+ -1,
+ NULL);
+ UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+ if (!props_active.constraint_enable) {
+ UI_but_flag_enable(bt, UI_BUT_INACTIVE);
+ }
+ }
+ }
else if (tselem->type == TSE_MODIFIER) {
ModifierData *md = (ModifierData *)te->directdata;
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 0c89639c72a..e5caf5885ba 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -3031,6 +3031,7 @@ void RNA_def_constraint(BlenderRNA *brna)
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint");
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
More information about the Bf-blender-cvs
mailing list