Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_data_modifier.py
| Show All 26 Lines | class ModifierButtonsPanel: | ||||
| bl_region_type = 'WINDOW' | bl_region_type = 'WINDOW' | ||||
| bl_context = "modifier" | bl_context = "modifier" | ||||
| bl_options = {'HIDE_HEADER'} | bl_options = {'HIDE_HEADER'} | ||||
| class DATA_PT_modifiers(ModifierButtonsPanel, Panel): | class DATA_PT_modifiers(ModifierButtonsPanel, Panel): | ||||
| bl_label = "Modifiers" | bl_label = "Modifiers" | ||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| ob = context.object | |||||
| return ob and ob.type != 'GPENCIL' | |||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| ob = context.object | ob = context.object | ||||
| layout.operator_menu_enum("object.modifier_add", "type") | layout.operator_menu_enum("object.modifier_add", "type") | ||||
| for md in ob.modifiers: | for md in ob.modifiers: | ||||
| ▲ Show 20 Lines • Show All 1,514 Lines • ▼ Show 20 Lines | def CORRECTIVE_SMOOTH(self, layout, ob, md): | ||||
| col = split.column() | col = split.column() | ||||
| col.prop(md, "use_only_smooth") | col.prop(md, "use_only_smooth") | ||||
| col.prop(md, "use_pin_boundary") | col.prop(md, "use_pin_boundary") | ||||
| layout.prop(md, "rest_source") | layout.prop(md, "rest_source") | ||||
| if md.rest_source == 'BIND': | if md.rest_source == 'BIND': | ||||
| layout.operator("object.correctivesmooth_bind", text="Unbind" if is_bind else "Bind") | layout.operator("object.correctivesmooth_bind", text="Unbind" if is_bind else "Bind") | ||||
| class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel): | |||||
| bl_label = "Modifiers" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| ob = context.object | |||||
| return ob and ob.type == 'GPENCIL' | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| ob = context.object | |||||
| layout.operator_menu_enum("object.gpencil_modifier_add", "type") | |||||
| for md in ob.grease_pencil_modifiers: | |||||
| box = layout.template_greasepencil_modifier(md) | |||||
| if box: | |||||
| # match enum type to our functions, avoids a lookup table. | |||||
| getattr(self, md.type)(box, ob, md) | |||||
| # the mt.type enum is (ab)used for a lookup on function names | |||||
| # ...to avoid lengthy if statements | |||||
| # so each type must have a function here. | |||||
| def GP_NOISE(self, layout, ob, md): | def GP_NOISE(self, layout, ob, md): | ||||
| gpd = ob.data | gpd = ob.data | ||||
| split = layout.split() | split = layout.split() | ||||
| col = split.column() | col = split.column() | ||||
| row = col.row(align=True) | row = col.row(align=True) | ||||
| row.prop(md, "factor") | row.prop(md, "factor") | ||||
| row.prop(md, "random", text="", icon="TIME", toggle=True) | row.prop(md, "random", text="", icon="TIME", toggle=True) | ||||
| ▲ Show 20 Lines • Show All 271 Lines • ▼ Show 20 Lines | def GP_BUILD(self, layout, ob, md): | ||||
| sub.prop(md, "frame_end", text="End") | sub.prop(md, "frame_end", text="End") | ||||
| col.separator() | col.separator() | ||||
| col.label("Layer:") | col.label("Layer:") | ||||
| row = col.row(align=True) | row = col.row(align=True) | ||||
| row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL') | row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL') | ||||
| row.prop(md, "invert_layers", text="", icon="ARROW_LEFTRIGHT") | row.prop(md, "invert_layers", text="", icon="ARROW_LEFTRIGHT") | ||||
| # row = col.row(align=True) | |||||
| # row.prop(md, "pass_index", text="Pass") | |||||
| # row.prop(md, "invert_pass", text="", icon="ARROW_LEFTRIGHT") | |||||
| def GP_LATTICE(self, layout, ob, md): | def GP_LATTICE(self, layout, ob, md): | ||||
| gpd = ob.data | gpd = ob.data | ||||
| split = layout.split() | split = layout.split() | ||||
| col = split.column() | col = split.column() | ||||
| col.label(text="Object:") | col.label(text="Object:") | ||||
| col.prop(md, "object", text="") | col.prop(md, "object", text="") | ||||
| ▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | def GP_OFFSET(self, layout, ob, md): | ||||
| row = col.row(align=True) | row = col.row(align=True) | ||||
| row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") | row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") | ||||
| row.prop(md, "invert_vertex", text="", icon="ARROW_LEFTRIGHT") | row.prop(md, "invert_vertex", text="", icon="ARROW_LEFTRIGHT") | ||||
| row = col.row(align=True) | row = col.row(align=True) | ||||
| row.prop(md, "pass_index", text="Pass") | row.prop(md, "pass_index", text="Pass") | ||||
| row.prop(md, "invert_pass", text="", icon="ARROW_LEFTRIGHT") | row.prop(md, "invert_pass", text="", icon="ARROW_LEFTRIGHT") | ||||
| classes = ( | classes = ( | ||||
| DATA_PT_modifiers, | DATA_PT_modifiers, | ||||
| DATA_PT_gpencil_modifiers, | |||||
| ) | ) | ||||
| if __name__ == "__main__": # only for live edit. | if __name__ == "__main__": # only for live edit. | ||||
| from bpy.utils import register_class | from bpy.utils import register_class | ||||
| for cls in classes: | for cls in classes: | ||||
| register_class(cls) | register_class(cls) | ||||