Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-06-02 02:37:15 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-06-02 02:37:15 +0400
commit67fb85b5f2da6fa448a175a386e80af19e89a3c0 (patch)
treeaca6d25bdd2b0cb510bd20f03bb7f3df002a598c /release
parentc6d1b6c3fc27558887bc5d4c06b147398f913284 (diff)
Added a short-cut button in the Freestyle Python Scripting mode for loading
a style module file as a text datablock and appending it to the style module stack.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_operators/freestyle.py36
-rw-r--r--release/scripts/startup/bl_ui/properties_freestyle.py1
2 files changed, 36 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_operators/freestyle.py b/release/scripts/startup/bl_operators/freestyle.py
index 90e79439f35..e9e636235ff 100644
--- a/release/scripts/startup/bl_operators/freestyle.py
+++ b/release/scripts/startup/bl_operators/freestyle.py
@@ -19,7 +19,7 @@
import sys
import bpy
-from bpy.props import (EnumProperty, StringProperty)
+from bpy.props import (BoolProperty, EnumProperty, StringProperty)
class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator):
@@ -139,3 +139,37 @@ class SCENE_OT_freestyle_add_face_marks_to_keying_set(bpy.types.Operator):
ks.paths.add(mesh, path, index=0)
bpy.ops.object.mode_set(mode=ob_mode, toggle=False)
return {'FINISHED'}
+
+
+class SCENE_OT_freestyle_module_open(bpy.types.Operator):
+ """Open a style module file"""
+ bl_idname = "scene.freestyle_module_open"
+ bl_label = "Open Style Module File"
+ bl_options = {'INTERNAL'}
+
+ filepath = StringProperty(subtype='FILE_PATH')
+
+ make_internal = BoolProperty(
+ name="Make internal",
+ description="Make module file internal after loading",
+ default=True)
+
+ @classmethod
+ def poll(cls, context):
+ rl = context.scene.render.layers.active
+ return rl and rl.freestyle_settings.mode == 'SCRIPT'
+
+ def invoke(self, context, event):
+ self.freestyle_module = context.freestyle_module
+ wm = context.window_manager
+ wm.fileselect_add(self)
+ return {'RUNNING_MODAL'}
+
+ def execute(self, context):
+ text = bpy.data.texts.load(self.filepath)
+ if self.make_internal:
+ text.is_in_memory = True
+ text.is_dirty = True
+ text.filepath = ""
+ self.freestyle_module.script = text
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py b/release/scripts/startup/bl_ui/properties_freestyle.py
index 4ed9c1f10da..04fcddf9603 100644
--- a/release/scripts/startup/bl_ui/properties_freestyle.py
+++ b/release/scripts/startup/bl_ui/properties_freestyle.py
@@ -161,6 +161,7 @@ class RENDERLAYER_PT_freestyle(RenderLayerFreestyleButtonsPanel, Panel):
row = box.row(align=True)
row.prop(module, "use", text="")
row.prop(module, "script", text="")
+ row.operator("scene.freestyle_module_open", icon='FILESEL', text="")
row.operator("scene.freestyle_module_remove", icon='X', text="")
row.operator("scene.freestyle_module_move", icon='TRIA_UP', text="").direction = 'UP'
row.operator("scene.freestyle_module_move", icon='TRIA_DOWN', text="").direction = 'DOWN'