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:
-rw-r--r--GNUmakefile2
-rw-r--r--release/scripts/templates/driver_functions.py34
-rw-r--r--source/blender/nodes/intern/node_exec.c4
3 files changed, 37 insertions, 3 deletions
diff --git a/GNUmakefile b/GNUmakefile
index f92b0093eae..52f36b218d8 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -233,7 +233,7 @@ check_sparse:
doc_py:
$(BUILD_DIR)/bin/blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py
cd doc/python_api ; sphinx-build -n -b html sphinx-in sphinx-out
- @echo "docs written into: 'doc/python_api/sphinx-out/index.html'"
+ @echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'"
clean:
diff --git a/release/scripts/templates/driver_functions.py b/release/scripts/templates/driver_functions.py
new file mode 100644
index 00000000000..db9d4fb4678
--- /dev/null
+++ b/release/scripts/templates/driver_functions.py
@@ -0,0 +1,34 @@
+# This script defines functions to be used directly in drivers expressions to
+# extend the builtin set of python functions.
+#
+# This can be executed on manually or set to 'Register' to
+# initialize thefunctions on file load.
+
+
+# two sample functions
+def invert(f):
+ """ Simple function call:
+
+ invert(val)
+ """
+ return 1.0 - f
+
+
+uuid_store = {}
+
+def slow_value(value, fac, uuid):
+ """ Delay the value by a factor, use a unique string to allow
+ use in multiple drivers without conflict:
+
+ slow_value(val, 0.5, "my_value")
+ """
+ value_prev = uuid_store.get(uuid, value)
+ uuid_store[uuid] = value_new = (value_prev * fac) + (value * (1.0 - fac))
+ return value_new
+
+
+import bpy
+
+# Add variable defined in this script into the drivers namespace.
+bpy.app.driver_namespace["invert"] = invert
+bpy.app.driver_namespace["slow_value"] = slow_value
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index 53bbb27f9b0..154f7613223 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -180,7 +180,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
/* prepare group tree inputs */
for (sock=ntree->inputs.first; sock; sock=sock->next) {
- ns = setup_stack(exec->stack, sock);
+ /* ns = */ setup_stack(exec->stack, sock);
}
/* prepare all internal nodes for execution */
for(n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) {
@@ -198,7 +198,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
/* tag all outputs */
for (sock=node->outputs.first; sock; sock=sock->next) {
- ns = setup_stack(exec->stack, sock);
+ /* ns = */ setup_stack(exec->stack, sock);
}
if(node->typeinfo->initexecfunc)