Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_freestyle.py
| Show All 27 Lines | class RenderFreestyleButtonsPanel: | ||||
| bl_region_type = 'WINDOW' | bl_region_type = 'WINDOW' | ||||
| bl_context = "render" | bl_context = "render" | ||||
| # 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): | ||||
| scene = context.scene | scene = context.scene | ||||
| with_freestyle = bpy.app.build_options.freestyle | with_freestyle = bpy.app.build_options.freestyle | ||||
| return scene and with_freestyle and(scene.render.engine in cls.COMPAT_ENGINES) | return scene and with_freestyle and(scene.view_render.engine in cls.COMPAT_ENGINES) | ||||
| class RENDER_PT_freestyle(RenderFreestyleButtonsPanel, Panel): | class RENDER_PT_freestyle(RenderFreestyleButtonsPanel, Panel): | ||||
| bl_label = "Freestyle" | bl_label = "Freestyle" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER'} | COMPAT_ENGINES = {'BLENDER_RENDER'} | ||||
| def draw_header(self, context): | def draw_header(self, context): | ||||
| Show All 25 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.render.engine in cls.COMPAT_ENGINES)) | rd.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): | ||||
| ▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | def draw_edge_type_buttons(self, box, lineset, edge_type): | ||||
| row.prop(lineset, select_edge_type) | row.prop(lineset, select_edge_type) | ||||
| sub = row.column(align=True) | sub = row.column(align=True) | ||||
| sub.prop(lineset, exclude_edge_type, text="") | sub.prop(lineset, exclude_edge_type, text="") | ||||
| sub.active = getattr(lineset, select_edge_type) | sub.active = getattr(lineset, select_edge_type) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| rd = context.scene.render | scene = context.scene | ||||
| rd = scene.render | |||||
| view_render = scene.view_render | |||||
| rl = rd.layers.active | rl = rd.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 | ||||
| ▲ Show 20 Lines • Show All 579 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| col.operator_menu_enum("scene.freestyle_geometry_modifier_add", "type", text="Add Modifier") | col.operator_menu_enum("scene.freestyle_geometry_modifier_add", "type", text="Add Modifier") | ||||
| for modifier in linestyle.geometry_modifiers: | for modifier in linestyle.geometry_modifiers: | ||||
| self.draw_geometry_modifier(context, modifier) | self.draw_geometry_modifier(context, modifier) | ||||
| elif linestyle.panel == 'TEXTURE': | elif linestyle.panel == 'TEXTURE': | ||||
| layout.separator() | layout.separator() | ||||
| row = layout.row() | row = layout.row() | ||||
| if rd.use_shading_nodes: | if view_render.use_shading_nodes: | ||||
| row.prop(linestyle, "use_nodes") | row.prop(linestyle, "use_nodes") | ||||
| else: | else: | ||||
| row.prop(linestyle, "use_texture") | row.prop(linestyle, "use_texture") | ||||
| row.prop(linestyle, "texture_spacing", text="Spacing Along Stroke") | row.prop(linestyle, "texture_spacing", text="Spacing Along Stroke") | ||||
| row = layout.row() | row = layout.row() | ||||
| props = row.operator( | props = row.operator( | ||||
| "wm.properties_context_change", | "wm.properties_context_change", | ||||
| Show All 14 Lines | class MaterialFreestyleButtonsPanel: | ||||
| # 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): | ||||
| scene = context.scene | scene = context.scene | ||||
| material = context.material | material = context.material | ||||
| with_freestyle = bpy.app.build_options.freestyle | with_freestyle = bpy.app.build_options.freestyle | ||||
| return with_freestyle and material and scene and scene.render.use_freestyle and \ | return with_freestyle and material and scene and scene.render.use_freestyle and \ | ||||
| (scene.render.engine in cls.COMPAT_ENGINES) | (scene.view_render.engine in cls.COMPAT_ENGINES) | ||||
| class MATERIAL_PT_freestyle_line(MaterialFreestyleButtonsPanel, Panel): | class MATERIAL_PT_freestyle_line(MaterialFreestyleButtonsPanel, Panel): | ||||
| bl_label = "Freestyle Line" | bl_label = "Freestyle Line" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER'} | COMPAT_ENGINES = {'BLENDER_RENDER'} | ||||
| def draw(self, context): | def draw(self, context): | ||||
| Show All 23 Lines | |||||