forked from bartvdbraak/blender
Simplified the implementation of toggle buttons for folding/expanding
modifier boxes in the Parameter Editor mode UI.
This commit is contained in:
parent
e6f92e2b91
commit
bc1e26e496
@ -305,7 +305,7 @@ class RENDER_PT_freestyle_linestyle(RenderButtonsPanel, bpy.types.Panel):
|
|||||||
icon = "TRIA_DOWN"
|
icon = "TRIA_DOWN"
|
||||||
else:
|
else:
|
||||||
icon = "TRIA_RIGHT"
|
icon = "TRIA_RIGHT"
|
||||||
row.operator("scene.freestyle_modifier_toggle_fold", icon=icon, text="", emboss=False)
|
row.prop(modifier, "expanded", text="", icon=icon, emboss=False)
|
||||||
row.label(text=modifier.rna_type.name)
|
row.label(text=modifier.rna_type.name)
|
||||||
row.prop(modifier, "name", text="")
|
row.prop(modifier, "name", text="")
|
||||||
row.prop(modifier, "use", text="")
|
row.prop(modifier, "use", text="")
|
||||||
|
@ -60,7 +60,6 @@ void SCENE_OT_freestyle_linestyle_new(struct wmOperatorType *ot);
|
|||||||
void SCENE_OT_freestyle_color_modifier_add(struct wmOperatorType *ot);
|
void SCENE_OT_freestyle_color_modifier_add(struct wmOperatorType *ot);
|
||||||
void SCENE_OT_freestyle_alpha_modifier_add(struct wmOperatorType *ot);
|
void SCENE_OT_freestyle_alpha_modifier_add(struct wmOperatorType *ot);
|
||||||
void SCENE_OT_freestyle_thickness_modifier_add(struct wmOperatorType *ot);
|
void SCENE_OT_freestyle_thickness_modifier_add(struct wmOperatorType *ot);
|
||||||
void SCENE_OT_freestyle_modifier_toggle_fold(struct wmOperatorType *ot);
|
|
||||||
void SCENE_OT_freestyle_modifier_remove(struct wmOperatorType *ot);
|
void SCENE_OT_freestyle_modifier_remove(struct wmOperatorType *ot);
|
||||||
void SCENE_OT_freestyle_modifier_move(struct wmOperatorType *ot);
|
void SCENE_OT_freestyle_modifier_move(struct wmOperatorType *ot);
|
||||||
|
|
||||||
|
@ -67,7 +67,6 @@ void ED_operatortypes_render(void)
|
|||||||
WM_operatortype_append(SCENE_OT_freestyle_color_modifier_add);
|
WM_operatortype_append(SCENE_OT_freestyle_color_modifier_add);
|
||||||
WM_operatortype_append(SCENE_OT_freestyle_alpha_modifier_add);
|
WM_operatortype_append(SCENE_OT_freestyle_alpha_modifier_add);
|
||||||
WM_operatortype_append(SCENE_OT_freestyle_thickness_modifier_add);
|
WM_operatortype_append(SCENE_OT_freestyle_thickness_modifier_add);
|
||||||
WM_operatortype_append(SCENE_OT_freestyle_modifier_toggle_fold);
|
|
||||||
WM_operatortype_append(SCENE_OT_freestyle_modifier_remove);
|
WM_operatortype_append(SCENE_OT_freestyle_modifier_remove);
|
||||||
WM_operatortype_append(SCENE_OT_freestyle_modifier_move);
|
WM_operatortype_append(SCENE_OT_freestyle_modifier_move);
|
||||||
|
|
||||||
|
@ -1084,36 +1084,6 @@ void SCENE_OT_freestyle_thickness_modifier_add(wmOperatorType *ot)
|
|||||||
ot->prop= RNA_def_enum(ot->srna, "type", linestyle_thickness_modifier_type_items, 0, "Type", "");
|
ot->prop= RNA_def_enum(ot->srna, "type", linestyle_thickness_modifier_type_items, 0, "Type", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int freestyle_modifier_toggle_fold_exec(bContext *C, wmOperator *UNUSED(op))
|
|
||||||
{
|
|
||||||
Scene *scene= CTX_data_scene(C);
|
|
||||||
PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
|
|
||||||
LineStyleModifier *modifier= ptr.data;
|
|
||||||
|
|
||||||
if (modifier->flags & LS_MODIFIER_EXPANDED)
|
|
||||||
modifier->flags &= ~LS_MODIFIER_EXPANDED;
|
|
||||||
else
|
|
||||||
modifier->flags |= LS_MODIFIER_EXPANDED;
|
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
|
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SCENE_OT_freestyle_modifier_toggle_fold(wmOperatorType *ot)
|
|
||||||
{
|
|
||||||
/* identifiers */
|
|
||||||
ot->name= "Toggle Modifier Fold";
|
|
||||||
ot->idname= "SCENE_OT_freestyle_modifier_toggle_fold";
|
|
||||||
ot->description="Fold/expand the modifier tab.";
|
|
||||||
|
|
||||||
/* api callbacks */
|
|
||||||
ot->exec= freestyle_modifier_toggle_fold_exec;
|
|
||||||
|
|
||||||
/* flags */
|
|
||||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int freestyle_get_modifier_type(PointerRNA *ptr)
|
static int freestyle_get_modifier_type(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
if (RNA_struct_is_a(ptr->type, &RNA_LineStyleColorModifier))
|
if (RNA_struct_is_a(ptr->type, &RNA_LineStyleColorModifier))
|
||||||
|
Loading…
Reference in New Issue
Block a user