Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_freestyle.py
| Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | class RenderLayerFreestyleButtonsPanel: | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| rd = context.scene.render | rd = context.scene.render | ||||
| with_freestyle = bpy.app.build_options.freestyle | with_freestyle = bpy.app.build_options.freestyle | ||||
| return (scene and with_freestyle and rd.use_freestyle and | return (scene and with_freestyle and rd.use_freestyle and | ||||
| rd.layers.active and(scene.view_render.engine in cls.COMPAT_ENGINES)) | scene.render_layers.active and(scene.view_render.engine in cls.COMPAT_ENGINES)) | ||||
| class RenderLayerFreestyleEditorButtonsPanel(RenderLayerFreestyleButtonsPanel): | class RenderLayerFreestyleEditorButtonsPanel(RenderLayerFreestyleButtonsPanel): | ||||
| # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here | # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if not super().poll(context): | if not super().poll(context): | ||||
| return False | return False | ||||
| rl = context.scene.render.layers.active | rl = context.scene.render_layers.active | ||||
| return rl and rl.freestyle_settings.mode == 'EDITOR' | return rl and rl.freestyle_settings.mode == 'EDITOR' | ||||
| class RENDERLAYER_UL_linesets(UIList): | class RENDERLAYER_UL_linesets(UIList): | ||||
| def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): | def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): | ||||
| lineset = item | lineset = item | ||||
| if self.layout_type in {'DEFAULT', 'COMPACT'}: | if self.layout_type in {'DEFAULT', 'COMPACT'}: | ||||
| layout.prop(lineset, "name", text="", emboss=False, icon_value=icon) | layout.prop(lineset, "name", text="", emboss=False, icon_value=icon) | ||||
| Show All 14 Lines | |||||
| class RENDERLAYER_PT_freestyle(RenderLayerFreestyleButtonsPanel, Panel): | class RENDERLAYER_PT_freestyle(RenderLayerFreestyleButtonsPanel, Panel): | ||||
| bl_label = "Freestyle" | bl_label = "Freestyle" | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER'} | COMPAT_ENGINES = {'BLENDER_RENDER'} | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| rd = context.scene.render | scene = context.scene | ||||
| rl = rd.layers.active | rl = scene.render_layers.active | ||||
| freestyle = rl.freestyle_settings | freestyle = rl.freestyle_settings | ||||
| layout.active = rl.use_freestyle | layout.active = rl.use_freestyle | ||||
| row = layout.row() | row = layout.row() | ||||
| layout.prop(freestyle, "mode", text="Control Mode") | layout.prop(freestyle, "mode", text="Control Mode") | ||||
| layout.prop(freestyle, "use_view_map_cache", text="View Map Cache") | layout.prop(freestyle, "use_view_map_cache", text="View Map Cache") | ||||
| layout.label(text="Edge Detection Options:") | layout.label(text="Edge Detection Options:") | ||||
| ▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | class RENDERLAYER_PT_freestyle_lineset(RenderLayerFreestyleEditorButtonsPanel, Panel): | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| scene = context.scene | scene = context.scene | ||||
| rd = scene.render | rd = scene.render | ||||
| view_render = scene.view_render | view_render = scene.view_render | ||||
| rl = rd.layers.active | rl = scene.render_layers.active | ||||
| freestyle = rl.freestyle_settings | freestyle = rl.freestyle_settings | ||||
| lineset = freestyle.linesets.active | lineset = freestyle.linesets.active | ||||
| layout.active = rl.use_freestyle | layout.active = rl.use_freestyle | ||||
| row = layout.row() | row = layout.row() | ||||
| rows = 4 if lineset else 2 | rows = 4 if lineset else 2 | ||||
| row.template_list("RENDERLAYER_UL_linesets", "", freestyle, "linesets", freestyle.linesets, "active_index", rows=rows) | row.template_list("RENDERLAYER_UL_linesets", "", freestyle, "linesets", freestyle.linesets, "active_index", rows=rows) | ||||
| ▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | def draw_color_modifier(self, context, modifier): | ||||
| row.prop(modifier, "angle_min") | row.prop(modifier, "angle_min") | ||||
| row.prop(modifier, "angle_max") | row.prop(modifier, "angle_max") | ||||
| elif modifier.type == 'CURVATURE_3D': | elif modifier.type == 'CURVATURE_3D': | ||||
| self.draw_modifier_color_ramp_common(box, modifier, False) | self.draw_modifier_color_ramp_common(box, modifier, False) | ||||
| row = box.row(align=True) | row = box.row(align=True) | ||||
| row.prop(modifier, "curvature_min") | row.prop(modifier, "curvature_min") | ||||
| row.prop(modifier, "curvature_max") | row.prop(modifier, "curvature_max") | ||||
| freestyle = context.scene.render.layers.active.freestyle_settings | freestyle = context.scene.render_layers.active.freestyle_settings | ||||
| if not freestyle.use_smoothness: | if not freestyle.use_smoothness: | ||||
| message = "Enable Face Smoothness to use this modifier" | message = "Enable Face Smoothness to use this modifier" | ||||
| self.draw_modifier_box_error(col.box(), modifier, message) | self.draw_modifier_box_error(col.box(), modifier, message) | ||||
| def draw_alpha_modifier(self, context, modifier): | def draw_alpha_modifier(self, context, modifier): | ||||
| layout = self.layout | layout = self.layout | ||||
| col = layout.column(align=True) | col = layout.column(align=True) | ||||
| Show All 38 Lines | def draw_alpha_modifier(self, context, modifier): | ||||
| row.prop(modifier, "angle_min") | row.prop(modifier, "angle_min") | ||||
| row.prop(modifier, "angle_max") | row.prop(modifier, "angle_max") | ||||
| elif modifier.type == 'CURVATURE_3D': | elif modifier.type == 'CURVATURE_3D': | ||||
| self.draw_modifier_curve_common(box, modifier, False, False) | self.draw_modifier_curve_common(box, modifier, False, False) | ||||
| row = box.row(align=True) | row = box.row(align=True) | ||||
| row.prop(modifier, "curvature_min") | row.prop(modifier, "curvature_min") | ||||
| row.prop(modifier, "curvature_max") | row.prop(modifier, "curvature_max") | ||||
| freestyle = context.scene.render.layers.active.freestyle_settings | freestyle = context.scene.render_layers.active.freestyle_settings | ||||
| if not freestyle.use_smoothness: | if not freestyle.use_smoothness: | ||||
| message = "Enable Face Smoothness to use this modifier" | message = "Enable Face Smoothness to use this modifier" | ||||
| self.draw_modifier_box_error(col.box(), modifier, message) | self.draw_modifier_box_error(col.box(), modifier, message) | ||||
| def draw_thickness_modifier(self, context, modifier): | def draw_thickness_modifier(self, context, modifier): | ||||
| layout = self.layout | layout = self.layout | ||||
| col = layout.column(align=True) | col = layout.column(align=True) | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | def draw_thickness_modifier(self, context, modifier): | ||||
| elif modifier.type == 'CURVATURE_3D': | elif modifier.type == 'CURVATURE_3D': | ||||
| self.draw_modifier_curve_common(box, modifier, False, False) | self.draw_modifier_curve_common(box, modifier, False, False) | ||||
| row = box.row(align=True) | row = box.row(align=True) | ||||
| row.prop(modifier, "thickness_min") | row.prop(modifier, "thickness_min") | ||||
| row.prop(modifier, "thickness_max") | row.prop(modifier, "thickness_max") | ||||
| row = box.row(align=True) | row = box.row(align=True) | ||||
| row.prop(modifier, "curvature_min") | row.prop(modifier, "curvature_min") | ||||
| row.prop(modifier, "curvature_max") | row.prop(modifier, "curvature_max") | ||||
| freestyle = context.scene.render.layers.active.freestyle_settings | freestyle = context.scene.render_layers.active.freestyle_settings | ||||
| if not freestyle.use_smoothness: | if not freestyle.use_smoothness: | ||||
| message = "Enable Face Smoothness to use this modifier" | message = "Enable Face Smoothness to use this modifier" | ||||
| self.draw_modifier_box_error(col.box(), modifier, message) | self.draw_modifier_box_error(col.box(), modifier, message) | ||||
| def draw_geometry_modifier(self, context, modifier): | def draw_geometry_modifier(self, context, modifier): | ||||
| layout = self.layout | layout = self.layout | ||||
| col = layout.column(align=True) | col = layout.column(align=True) | ||||
| ▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | def draw_geometry_modifier(self, context, modifier): | ||||
| box.prop(modifier, "angle") | box.prop(modifier, "angle") | ||||
| elif modifier.type == 'SIMPLIFICATION': | elif modifier.type == 'SIMPLIFICATION': | ||||
| box.prop(modifier, "tolerance") | box.prop(modifier, "tolerance") | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| rd = context.scene.render | scene = context.scene | ||||
| rl = rd.layers.active | rl = scene.render_layers.active | ||||
| lineset = rl.freestyle_settings.linesets.active | lineset = rl.freestyle_settings.linesets.active | ||||
| layout.active = rl.use_freestyle | layout.active = rl.use_freestyle | ||||
| if lineset is None: | if lineset is None: | ||||
| return | return | ||||
| linestyle = lineset.linestyle | linestyle = lineset.linestyle | ||||
| ▲ Show 20 Lines • Show All 221 Lines • Show Last 20 Lines | |||||