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:
authorJoshua Leung <aligorith@gmail.com>2011-06-10 16:43:06 +0400
committerJoshua Leung <aligorith@gmail.com>2011-06-10 16:43:06 +0400
commitf4b2e9b91d78b270f8741cec9b8770579d424f4a (patch)
treec521719ada9d969d9678cb98e7d0ff371a84f2be /release/scripts/startup/bl_ui/properties_scene.py
parentff5fb2f4ef8997cb110476f2823b6edfd28cea08 (diff)
Added operator to make importing Keying Sets from files easier.
This can be found from the dropdown below the Add/Remove buttons in the Properties Editor -> Scene -> Keying Sets panel.
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_scene.py')
-rw-r--r--release/scripts/startup/bl_ui/properties_scene.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index 7725f661693..e2dc9de064f 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -76,6 +76,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
col = row.column(align=True)
col.operator("anim.keying_set_add", icon='ZOOMIN', text="")
col.operator("anim.keying_set_remove", icon='ZOOMOUT', text="")
+ col.menu("SCENE_MT_keying_set_specials", icon='DOWNARROW_HLT', text="")
ks = scene.keying_sets.active
if ks and ks.is_path_absolute:
@@ -94,6 +95,14 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
col.prop(ks, "bl_options")
+class SCENE_MT_keying_set_specials(bpy.types.Menu):
+ bl_label = "Keying Set Specials"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("anim.keying_set_import", text="Import From File")
+
class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Active Keying Set"
@@ -198,6 +207,36 @@ class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
# XXX, move operator to op/ dir
+class ANIM_OT_keying_set_import(bpy.types.Operator):
+ "Import Keying Set from a python script."
+ bl_idname = "anim.keying_set_import"
+ bl_label = "Import Keying Set from File"
+
+ filepath = bpy.props.StringProperty(name="File Path", description="Filepath to read file from.")
+ filter_folder = bpy.props.BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'})
+ filter_text = bpy.props.BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'})
+ filter_python = bpy.props.BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'})
+
+ def execute(self, context):
+ if not self.filepath:
+ raise Exception("Filepath not set.")
+
+ f = open(self.filepath, "r")
+ if not f:
+ raise Exception("Could not open file.")
+
+ # lazy way of loading and running this file...
+ exec(compile(f.read(), self.filepath, 'exec'))
+
+ f.close()
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.fileselect_add(self)
+ return {'RUNNING_MODAL'}
+
class ANIM_OT_keying_set_export(bpy.types.Operator):
"Export Keying Set to a python script."
bl_idname = "anim.keying_set_export"