render layer saving script assumed scriptsdir existed.
authorCampbell Barton <ideasman42@gmail.com>
Fri, 9 May 2008 17:13:03 +0000 (17:13 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 9 May 2008 17:13:03 +0000 (17:13 +0000)
apply def script assumed the mesh had all the objects vertex groups.

release/scripts/object_apply_def.py
release/scripts/render_save_layers.py

index c863fdb69629a335605ed81cc1f34baa5e0c5c01..006e97463d83519e7d62d1e7cb2060836e0792f5 100644 (file)
@@ -77,7 +77,11 @@ def copy_vgroups(source_ob, target_ob):
                for vgroupname in vgroups:
                        target_me.addVertGroup(vgroupname)
                        if len(target_me.verts) == len(source_me.verts):
-                               vlist = source_me.getVertsFromGroup(vgroupname, True)
+                               try: # in rare cases this can raise an 'no deform groups assigned to mesh' error
+                                       vlist = source_me.getVertsFromGroup(vgroupname, True)
+                               except:
+                                       vlist = []
+                               
                                try:
                                        for vpair in vlist:
                                                target_me.assignVertsToGroup(vgroupname, [vpair[0]], vpair[1], ADD)
@@ -171,4 +175,4 @@ def apply_deform():
        Blender.Window.RedrawAll()
 
 if __name__=='__main__':
-       apply_deform()
\ No newline at end of file
+       apply_deform()
index 06f410b97838d02fd67c0b47bd221196be828c2a..ad1265be50c017756bfc29da3e8099670d0346c5 100644 (file)
@@ -47,8 +47,12 @@ rend = sce.render
 
 # default filename: theme's name + '_theme.py' in user's scripts dir:
 default_fname = Blender.Get("scriptsdir")
-default_fname = Blender.sys.join(default_fname, sce.name + '_renderlayer.py')
-default_fname = default_fname.replace(' ','_')
+if not default_fname:
+       default_fname = Blender.Get("uscriptsdir")
+
+if default_fname:
+       default_fname = Blender.sys.join(default_fname, sce.name + '_renderlayer.py')
+       default_fname = default_fname.replace(' ','_')
 
 def write_renderlayers(filename):
        "Write the current renderlayer as a bpython script"
@@ -113,4 +117,4 @@ rend = sce.render
        except:
                Blender.Draw.PupMenu("Warning - check console!%t|Menus could not be automatically updated")
 
-FileSelector(write_renderlayers, "Save RenderLayers", default_fname)
\ No newline at end of file
+FileSelector(write_renderlayers, "Save RenderLayers", default_fname)