diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-13 04:08:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-13 04:08:24 +0400 |
commit | 118e0426f109fb41fa5d9c982ffdce2661b1157a (patch) | |
tree | d9cb5e896072d4549ebb40ea3cd70c3171cb8093 /release/scripts/ui/properties_data_armature_rigify.py | |
parent | 4a385adbf339f585cc1802a1e5d277ff99438146 (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.
Diffstat (limited to 'release/scripts/ui/properties_data_armature_rigify.py')
-rw-r--r-- | release/scripts/ui/properties_data_armature_rigify.py | 13 |
1 files changed, 11 insertions, 2 deletions
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'} |