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:
authorWillian Padovani Germano <wpgermano@gmail.com>2004-09-21 09:28:17 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2004-09-21 09:28:17 +0400
commite7d3039d127d8bb4a57c6baeb883d0cf32fd21f3 (patch)
treece33cb6959dc1c17e979ed68ff6ed4a098874b53 /release
parente5e621ad242824d2fb3be4a05425a3970bd9c1ae (diff)
- Blender: added option 'scriptsdir' to Blender.Get();
- small updates to the docs; - Object: small fix to getMatrix: check during_script() to avoid undesired loops; added old behavior (pre 2.34) as option: .getMatrix('oldlocal'); - tentative fix for bug #1275: scene REDRAW scriptlinks were not being executed (the call to do so was missing): http://projects.blender.org/tracker/index.php?func=detail&aid=1275&group_id=9&atid=125 added the call in drawview.c, in drawview3dspace(). This causes the scriptlink to be called for each visible view3d, but that's what happens with object redraw scriptlinks, too. Anyway, this is still a test. The place was chosen based on the idea that a scene redraw scriptlink is like an object redraw one, but for all objs in the scene at once. - Window.Theme: new submodule, to get/set theme options in Blender; - Added the script save_theme.py (Help menu for now), to save the current theme in Blender as an executable script (currently shown in the Scripts->Misc menu). There's more work to do for themes, like defining a proper place for them in the interface, adding documentation (for now the added script and the ones it generates can give a pretty good idea of how to use the new module), probably extending themes to support SpaceScript and so on.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/save_theme.py75
1 files changed, 75 insertions, 0 deletions
diff --git a/release/scripts/save_theme.py b/release/scripts/save_theme.py
new file mode 100644
index 00000000000..73c23087cec
--- /dev/null
+++ b/release/scripts/save_theme.py
@@ -0,0 +1,75 @@
+#!BPY
+
+"""
+Name: 'Save Current Theme'
+Blender: 234
+Group: 'Help'
+Tooltip: 'Save current theme as a bpython script'
+"""
+
+# $Id$
+#
+# --------------------------------------------------------------------------
+# save_theme version 2.34 Sep 20, 2004
+# Copyright (C) 2004: Willian P. Germano, wgermano _at_ ig.com.br
+# --------------------------------------------------------------------------
+# Released under the Blender Artistic License (BAL):
+# http://download.blender.org/documentation/html/x21254.html
+#
+# The scripts generated by this script are put under Public Domain by
+# default, but you are free to edit the ones you generate with this script
+# and change their license to another one of your choice.
+# --------------------------------------------------------------------------
+
+import Blender
+from Blender.Window import Theme, FileSelector
+
+theme = Theme.Get()[0] # get current theme
+
+# default filename: theme's name + '_theme.py' in user's scripts dir:
+default_fname = Blender.Get("scriptsdir")
+default_fname = Blender.sys.join(default_fname, theme.name + '_theme.py')
+
+def write_theme(filename):
+ "Write the current theme as a bpython script"
+
+ if filename.find('.py', -3) <= 0: filename += '.py'
+
+ fout = file(filename, "w")
+
+ fout.write("""#!BPY
+
+\"\"\"
+Name: '%s'
+Blender: 234
+Group: 'Theme'
+Tooltip: 'Change current theme'
+\"\"\"
+
+# This script was automatically generated by the save_theme.py bpython script.
+# By default, these generated scripts are released as Public Domain, but you
+# are free to change the license of the scripts you generate with
+# save_theme.py before releasing them.
+
+import Blender
+from Blender.Window import Theme
+
+theme = Theme.New('%s')
+""" % (theme.name, theme.name))
+
+ for tsp in theme.get(): #
+ command = "\n%s = theme.get('%s')" % (tsp, tsp)
+ fout.write(command + "\n")
+ exec(command)
+ exec("vars = dir(%s)" % tsp)
+ vars.remove('theme')
+
+ for var in vars:
+ v = "%s.%s" % (tsp, var)
+ exec("value = %s" % v)
+ fout.write("%s = %s\n" % (v, value))
+
+ fout.write('\nBlender.Redraw(-1)')
+ fout.close()
+
+FileSelector(write_theme, "Save Current Theme", default_fname)