[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2417] trunk/py/scripts/addons: use library argument for bpy_extras.io_utils.path_reference(...)

Campbell Barton ideasman42 at gmail.com
Tue Oct 11 06:44:53 CEST 2011


Revision: 2417
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2417
Author:   campbellbarton
Date:     2011-10-11 04:44:52 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
use library argument for bpy_extras.io_utils.path_reference(...)

Modified Paths:
--------------
    trunk/py/scripts/addons/io_mesh_ply/export_ply.py
    trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
    trunk/py/scripts/addons/io_scene_obj/export_obj.py
    trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
    trunk/py/scripts/addons/object_animrenderbake.py
    trunk/py/scripts/addons/render_povray/render.py

Modified: trunk/py/scripts/addons/io_mesh_ply/export_ply.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/export_ply.py	2011-10-11 04:12:13 UTC (rev 2416)
+++ trunk/py/scripts/addons/io_mesh_ply/export_ply.py	2011-10-11 04:44:52 UTC (rev 2417)
@@ -47,7 +47,7 @@
         return round(v[0], 6), round(v[1], 6)
 
     scene = context.scene
-    obj = context.object
+    obj = context.active_object
 
     if not obj:
         raise Exception("Error, Select 1 active object")

Modified: trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
===================================================================
--- trunk/py/scripts/addons/io_scene_fbx/export_fbx.py	2011-10-11 04:12:13 UTC (rev 2416)
+++ trunk/py/scripts/addons/io_scene_fbx/export_fbx.py	2011-10-11 04:44:52 UTC (rev 2417)
@@ -1140,7 +1140,7 @@
 			Property: "Width", "int", "",0
 			Property: "Height", "int", "",0''')
         if tex:
-            fname_rel = bpy_extras.io_utils.path_reference(tex.filepath, base_src, base_dst, path_mode, "", copy_set)
+            fname_rel = bpy_extras.io_utils.path_reference(tex.filepath, base_src, base_dst, path_mode, "", copy_set, tex.library)
             fname_strip = bpy.path.basename(fname_rel)
         else:
             fname_strip = fname_rel = ""
@@ -1199,8 +1199,8 @@
         fw('\n\t\tMedia: "Video::%s"' % texname)
 
         if tex:
-            fname_rel = bpy_extras.io_utils.path_reference(tex.filepath, base_src, base_dst, path_mode, "", copy_set)
-            fname_strip = bpy.path.basename(bpy.path.abspath(fname_rel))
+            fname_rel = bpy_extras.io_utils.path_reference(tex.filepath, base_src, base_dst, path_mode, "", copy_set, tex.library)
+            fname_strip = bpy.path.basename(fname_rel)
         else:
             fname_strip = fname_rel = ""
 

Modified: trunk/py/scripts/addons/io_scene_obj/export_obj.py
===================================================================
--- trunk/py/scripts/addons/io_scene_obj/export_obj.py	2011-10-11 04:12:13 UTC (rev 2416)
+++ trunk/py/scripts/addons/io_scene_obj/export_obj.py	2011-10-11 04:44:52 UTC (rev 2417)
@@ -101,7 +101,7 @@
         # Write images!
         if face_img:  # We have an image on the face!
             # write relative image path
-            rel = bpy_extras.io_utils.path_reference(face_img.filepath, source_dir, dest_dir, path_mode, "", copy_set)
+            rel = bpy_extras.io_utils.path_reference(face_img.filepath, source_dir, dest_dir, path_mode, "", copy_set, face_img.library)
             fw('map_Kd %s\n' % rel)  # Diffuse mapping image
 
         if mat:  # No face image. if we havea material search for MTex image.
@@ -128,7 +128,7 @@
                             image_map["map_Ns"] = image
 
             for key, image in image_map.items():
-                filepath = bpy_extras.io_utils.path_reference(image.filepath, source_dir, dest_dir, path_mode, "", copy_set)
+                filepath = bpy_extras.io_utils.path_reference(image.filepath, source_dir, dest_dir, path_mode, "", copy_set, image.library)
                 fw('%s %s\n' % (key, repr(filepath)[1:-1]))
 
         fw('\n\n')

Modified: trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/export_x3d.py	2011-10-11 04:12:13 UTC (rev 2416)
+++ trunk/py/scripts/addons/io_scene_x3d/export_x3d.py	2011-10-11 04:44:52 UTC (rev 2417)
@@ -1238,8 +1238,8 @@
             # collect image paths, can load multiple
             # [relative, name-only, absolute]
             filepath = image.filepath
-            filepath_full = bpy.path.abspath(filepath)
-            filepath_ref = bpy_extras.io_utils.path_reference(filepath_full, base_src, base_dst, path_mode, "textures", copy_set)
+            filepath_full = bpy.path.abspath(filepath, library=image.library)
+            filepath_ref = bpy_extras.io_utils.path_reference(filepath_full, base_src, base_dst, path_mode, "textures", copy_set, image.library)
             filepath_base = os.path.basename(filepath_full)
 
             images = [

Modified: trunk/py/scripts/addons/object_animrenderbake.py
===================================================================
--- trunk/py/scripts/addons/object_animrenderbake.py	2011-10-11 04:12:13 UTC (rev 2416)
+++ trunk/py/scripts/addons/object_animrenderbake.py	2011-10-11 04:44:52 UTC (rev 2417)
@@ -94,7 +94,7 @@
             return {'CANCELLED'}
 
         # make sure we have an absolute path so that copying works for sure
-        absp = bpy.path.abspath(img.filepath)
+        absp = bpy.path.abspath(img.filepath, library=img.library)
 
         print("Animated baking for frames " + str(start) + " - " + str(end))
 

Modified: trunk/py/scripts/addons/render_povray/render.py
===================================================================
--- trunk/py/scripts/addons/render_povray/render.py	2011-10-11 04:12:13 UTC (rev 2416)
+++ trunk/py/scripts/addons/render_povray/render.py	2011-10-11 04:44:52 UTC (rev 2417)
@@ -2067,7 +2067,7 @@
             # check paths
             povPath = bpy.path.abspath(scene.pov.scene_path).replace('\\', '/')
             if povPath == "":
-                if bpy.path.abspath("//") != "":
+                if bpy.data.is_saved:
                     povPath = bpy.path.abspath("//")
                 else:
                     povPath = tempfile.gettempdir()
@@ -2094,7 +2094,7 @@
             # Bug in POV-Ray RC3
             renderImagePath = bpy.path.abspath(scene.pov.renderimage_path).replace('\\','/')
             if renderImagePath == "":
-                if bpy.path.abspath("//") != "":
+                if bpy.data.is_saved:
                     renderImagePath = bpy.path.abspath("//")
                 else:
                     renderImagePath = tempfile.gettempdir()



More information about the Bf-extensions-cvs mailing list