diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-12-20 11:57:26 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-12-20 11:57:26 +0400 |
commit | a462d69bbf771e49d2fa49589608c375376b42ed (patch) | |
tree | 60d85d4131399a0a39dbc582e30a7144b14edc18 /release | |
parent | d433cd65f7127d60e17d05a824290423ad226eae (diff) |
Another big patch set by Bastien Montagne, thanks a lot!
* Made Freestyle optional (turned on by default).
* Fix for missing bpath.c updates in the previous merge of trunk changes.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/__init__.py | 15 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_render.py | 15 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_render_layer.py | 77 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 15 |
4 files changed, 67 insertions, 55 deletions
diff --git a/release/scripts/startup/bl_operators/__init__.py b/release/scripts/startup/bl_operators/__init__.py index 0ecb0d46c5f..897dd24e174 100644 --- a/release/scripts/startup/bl_operators/__init__.py +++ b/release/scripts/startup/bl_operators/__init__.py @@ -22,12 +22,11 @@ if "bpy" in locals(): from imp import reload as _reload for val in _modules_loaded.values(): _reload(val) -_modules = ( +_modules = [ "add_mesh_torus", "anim", "clip", "console", - "freestyle", "image", "mesh", "node", @@ -44,16 +43,18 @@ _modules = ( "vertexpaint_dirt", "view3d", "wm", -) +] + +import bpy + +if 'FREESTYLE' in bpy.app.build_options: + _modules.append("freestyle") __import__(name=__name__, fromlist=_modules) _namespace = globals() -_modules_loaded = {name: _namespace[name] for name in _modules} +_modules_loaded = {name: _namespace[name] for name in _modules if name != 'bpy'} del _namespace -import bpy - - def register(): bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index 8031bd26bee..519aae96e91 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -50,8 +50,19 @@ class RenderButtonsPanel(): @classmethod def poll(cls, context): + scene = context.scene + return scene and (scene.render.engine in cls.COMPAT_ENGINES) + + +class RenderFreestyleButtonsPanel(RenderButtonsPanel): + # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here + + @classmethod + def poll(cls, context): + if not super().poll(context): + return False rd = context.scene.render - return context.scene and (rd.engine in cls.COMPAT_ENGINES) + return 'FREESTYLE' in bpy.app.build_options class RENDER_PT_render(RenderButtonsPanel, Panel): @@ -297,7 +308,7 @@ class RENDER_PT_post_processing(RenderButtonsPanel, Panel): sub.prop(rd, "edge_color", text="") -class RENDER_PT_freestyle(RenderButtonsPanel, Panel): +class RENDER_PT_freestyle(RenderFreestyleButtonsPanel, Panel): bl_label = "Freestyle" bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} diff --git a/release/scripts/startup/bl_ui/properties_render_layer.py b/release/scripts/startup/bl_ui/properties_render_layer.py index 93c6d289bff..20fc0808759 100644 --- a/release/scripts/startup/bl_ui/properties_render_layer.py +++ b/release/scripts/startup/bl_ui/properties_render_layer.py @@ -33,6 +33,28 @@ class RenderLayerButtonsPanel(): return scene and (scene.render.engine in cls.COMPAT_ENGINES) +class RenderLayerFreestyleButtonsPanel(RenderLayerButtonsPanel): + # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here + + @classmethod + def poll(cls, context): + if not super().poll(context): + return False + rd = context.scene.render + return 'FREESTYLE' in bpy.app.build_options and rd.use_freestyle and rd.layers.active + + +class RenderLayerFreestyleEditorButtonsPanel(RenderLayerFreestyleButtonsPanel): + # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here + + @classmethod + def poll(cls, context): + if not super().poll(context): + return False + rl = context.scene.render.layers.active + return rl and rl.freestyle_settings.mode == 'EDITOR' + + class RENDERLAYER_PT_layers(RenderLayerButtonsPanel, Panel): bl_label = "Layers" bl_options = {'HIDE_HEADER'} @@ -89,24 +111,26 @@ class RENDERLAYER_PT_layer_options(RenderLayerButtonsPanel, Panel): split = layout.split() col = split.column() - col.prop(rl, "use_zmask") - row = col.row() - row.prop(rl, "invert_zmask", text="Negate") - row.active = rl.use_zmask + row = col.row(align=True) + row.prop(rl, "use_zmask") + sub = row.row(align=True) + sub.prop(rl, "invert_zmask", text="", icon='ZOOMOUT') + sub.active = rl.use_zmask col.prop(rl, "use_all_z") + col.prop(rl, "use_ztransp") col = split.column() col.prop(rl, "use_solid") col.prop(rl, "use_halo") - col.prop(rl, "use_ztransp") - col.prop(rl, "use_sky") + col.prop(rl, "use_strand") col = split.column() + col.prop(rl, "use_sky") col.prop(rl, "use_edge_enhance") - col.prop(rl, "use_strand") - row = col.row() - row.prop(rl, "use_freestyle") - row.active = rd.use_freestyle + if 'FREESTYLE' in bpy.app.build_options: + row = col.row() + row.prop(rl, "use_freestyle") + row.active = rd.use_freestyle class RENDERLAYER_PT_layer_passes(RenderLayerButtonsPanel, Panel): @@ -164,19 +188,10 @@ class RENDER_MT_lineset_specials(Menu): layout.operator("scene.freestyle_lineset_paste", icon='PASTEDOWN') -class RENDERLAYER_PT_freestyle(RenderLayerButtonsPanel, Panel): +class RENDERLAYER_PT_freestyle(RenderLayerFreestyleButtonsPanel, Panel): bl_label = "Freestyle" COMPAT_ENGINES = {'BLENDER_RENDER'} - @classmethod - def poll(cls, context): - scene = context.scene - if not (scene and (scene.render.engine in cls.COMPAT_ENGINES)): - return False - rd = scene.render - rl = rd.layers.active - return rd.use_freestyle and rl - def draw(self, context): rd = context.scene.render rl = rd.layers.active @@ -225,19 +240,10 @@ class RENDERLAYER_PT_freestyle(RenderLayerButtonsPanel, Panel): row.operator("scene.freestyle_module_move", icon='TRIA_DOWN', text="").direction = 'DOWN' -class RENDERLAYER_PT_freestyle_lineset(RenderLayerButtonsPanel, Panel): +class RENDERLAYER_PT_freestyle_lineset(RenderLayerFreestyleEditorButtonsPanel, Panel): bl_label = "Freestyle Line Set" COMPAT_ENGINES = {'BLENDER_RENDER'} - @classmethod - def poll(cls, context): - scene = context.scene - if not (scene and (scene.render.engine in cls.COMPAT_ENGINES)): - return False - rd = scene.render - rl = rd.layers.active - return rd.use_freestyle and rl and rl.freestyle_settings.mode == 'EDITOR' - def draw_edge_type_buttons(self, box, lineset, edge_type): # property names select_edge_type = "select_" + edge_type @@ -326,20 +332,11 @@ class RENDERLAYER_PT_freestyle_lineset(RenderLayerButtonsPanel, Panel): row.prop(lineset, "group_negation", expand=True) -class RENDERLAYER_PT_freestyle_linestyle(RenderLayerButtonsPanel, Panel): +class RENDERLAYER_PT_freestyle_linestyle(RenderLayerFreestyleEditorButtonsPanel, Panel): bl_label = "Freestyle Line Style" bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} - @classmethod - def poll(cls, context): - scene = context.scene - if not (scene and (scene.render.engine in cls.COMPAT_ENGINES)): - return False - rd = scene.render - rl = rd.layers.active - return rd.use_freestyle and rl and rl.freestyle_settings.mode == 'EDITOR' - def draw_modifier_box_header(self, box, modifier): row = box.row() row.context_pointer_set("modifier", modifier) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 689cd635606..7807bb11c8a 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1838,8 +1838,9 @@ class VIEW3D_MT_edit_mesh_edges(Menu): layout.separator() - layout.operator("mesh.mark_freestyle_edge").clear = False - layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True + if context.scene and 'FREESTYLE' in bpy.app.build_options: + layout.operator("mesh.mark_freestyle_edge").clear = False + layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True layout.separator() @@ -1883,8 +1884,9 @@ class VIEW3D_MT_edit_mesh_faces(Menu): layout.separator() - layout.operator("mesh.mark_freestyle_face").clear = False - layout.operator("mesh.mark_freestyle_face", text="Clear Freestyle Face").clear = True + if context.scene and 'FREESTYLE' in bpy.app.build_options: + layout.operator("mesh.mark_freestyle_face").clear = False + layout.operator("mesh.mark_freestyle_face", text="Clear Freestyle Face").clear = True layout.separator() @@ -2491,8 +2493,9 @@ class VIEW3D_PT_view3d_meshdisplay(Panel): col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights") col.prop(mesh, "show_edge_seams", text="Seams") col.prop(mesh, "show_edge_sharp", text="Sharp") - col.prop(mesh, "show_freestyle_edge_marks", text="Freestyle Edge Marks") - col.prop(mesh, "show_freestyle_face_marks", text="Freestyle Face Marks") + if context.scene and 'FREESTYLE' in bpy.app.build_options: + col.prop(mesh, "show_freestyle_edge_marks", text="Freestyle Edge Marks") + col.prop(mesh, "show_freestyle_face_marks", text="Freestyle Face Marks") col.separator() col.label(text="Normals:") |