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:
authorCampbell Barton <ideasman42@gmail.com>2010-10-13 04:08:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-13 04:08:24 +0400
commit118e0426f109fb41fa5d9c982ffdce2661b1157a (patch)
treed9cb5e896072d4549ebb40ea3cd70c3171cb8093
parent4a385adbf339f585cc1802a1e5d277ff99438146 (diff)
patch [#24221] Creating graph from armature doesn't work with unsaved .blend files (with fix).
from Sergej Reich (sergof) Made some corrections to the patch as well as using bpy.app.tempdir with tempfile python module.
-rw-r--r--release/scripts/modules/rigify/__init__.py6
-rw-r--r--release/scripts/ui/properties_data_armature_rigify.py13
-rw-r--r--source/blender/python/intern/bpy_app.c10
3 files changed, 21 insertions, 8 deletions
diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py
index 98d9bb235a2..c4f18d51519 100644
--- a/release/scripts/modules/rigify/__init__.py
+++ b/release/scripts/modules/rigify/__init__.py
@@ -534,7 +534,11 @@ def generate_test_all(context, GRAPH=False):
new_objects = rigify.generate_test(context)
if GRAPH:
- base_name = os.path.splitext(bpy.data.filepath)[0]
+ if(bpy.data.filepath):
+ base_name = os.path.splitext(bpy.data.filepath)[0]
+ else:
+ import tempfile
+ base_name = tempfile.mktemp(prefix=bpy.app.tempdir)
for obj, obj_new in new_objects:
for obj in (obj, obj_new):
fn = base_name + "-" + bpy.path.clean_name(obj.name)
diff --git a/release/scripts/ui/properties_data_armature_rigify.py b/release/scripts/ui/properties_data_armature_rigify.py
index f7961821277..6453ea9e038 100644
--- a/release/scripts/ui/properties_data_armature_rigify.py
+++ b/release/scripts/ui/properties_data_armature_rigify.py
@@ -211,14 +211,23 @@ class Graph(bpy.types.Operator):
import bpy
reload(graphviz_export)
obj = bpy.context.object
- path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name)
+ if(bpy.data.filepath):
+ path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name)
+ else:
+ import tempfile
+ path = tempfile.mktemp(prefix=bpy.app.tempdir) + "-" + bpy.path.clean_name(obj.name)
path_dot = path + ".dot"
path_png = path + ".png"
saved = graphviz_export.graph_armature(bpy.context.object, path_dot, CONSTRAINTS=False, DRIVERS=False)
if saved:
# if we seriously want this working everywhere we'll need some new approach
- os.system("dot -Tpng %s > %s; gnome-open %s &" % (path_dot, path_png, path_png))
+ os.system("dot -Tpng %r > %r" % (path_dot, path_png))
+ if not os.path.exists(path_png) or os.stat(path_png)[6] == 0:
+ self.report('ERROR', "Graphvis could not create %r check graphviz is installed" % path_png)
+ return {'CANCELLED'}
+
+ bpy.ops.image.external_edit(filepath=path_png)
#os.system("python /b/xdot.py '%s' &" % path_dot)
return {'FINISHED'}
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index f506f91292f..6a6b5277d9f 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -94,11 +94,11 @@ static PyObject *make_app_info(void)
SetStrItem(build_platform);
SetStrItem(build_type);
#else
- SetStrItem("Unknown");
- SetStrItem("Unknown");
- SetStrItem("Unknown");
- SetStrItem("Unknown");
- SetStrItem("Unknown");
+ SetStrItem("Unknown");
+ SetStrItem("Unknown");
+ SetStrItem("Unknown");
+ SetStrItem("Unknown");
+ SetStrItem("Unknown");
#endif
#undef SetIntItem