[Bf-extensions-cvs] [189552a] master: fix for broken Paths, Thanks pildanovak

Brendon Murphy noreply at git.blender.org
Wed May 20 20:27:05 CEST 2015


Commit: 189552a857956f30bf3bed28e98b1a087f47f86f
Author: Brendon Murphy
Date:   Thu May 21 04:26:32 2015 +1000
Branches: master
https://developer.blender.org/rBA189552a857956f30bf3bed28e98b1a087f47f86f

fix for broken Paths, Thanks pildanovak

===================================================================

M	object_fracture/fracture_ops.py

===================================================================

diff --git a/object_fracture/fracture_ops.py b/object_fracture/fracture_ops.py
index 74558da..69ec320 100644
--- a/object_fracture/fracture_ops.py
+++ b/object_fracture/fracture_ops.py
@@ -437,27 +437,36 @@ class FractureGroup(bpy.types.Operator):
 # Import Functions
 
 def import_object(obname):
-    opath = "//data.blend\\Object\\" + obname
-    s = os.sep
-    dpath = bpy.utils.script_paths()[0] + \
-        '%saddons%sobject_fracture%sdata.blend\\Object\\' % (s, s, s)
-
-    # DEBUG
-    #print('import_object: ' + opath)
-
-    bpy.ops.wm.link_append(
-            filepath=opath,
-            filename=obname,
-            directory=dpath,
-            filemode=1,
-            link=False,
-            autoselect=True,
-            active_layer=True,
-            instance_groups=True,
-            relative_path=True)
-
-    for ob in bpy.context.selected_objects:
-        ob.location = bpy.context.scene.cursor_location
+	opath = "//data.blend\\Object\\" + obname
+	s = os.sep
+	#dpath = bpy.utils.script_paths()[0] + \
+	#	 '%saddons%sobject_fracture%sdata.blend\\Object\\' % (s, s, s)
+	dpath=''
+	fpath=''
+	for p in bpy.utils.script_paths():
+		
+		testfname= p + '%saddons%sobject_fracture%sdata.blend' % (s,s,s)
+		print(testfname)
+		if os.path.isfile(testfname):
+			fname=testfname
+			dpath = p + \
+			'%saddons%sobject_fracture%sdata.blend\\Object\\' % (s, s, s)
+			break
+	# DEBUG
+	#print('import_object: ' + opath)
+
+	bpy.ops.wm.append(
+			filepath=opath,
+			filename=obname,
+			directory=dpath,
+			filemode=1,
+			link=False,
+			autoselect=True,
+			active_layer=True,
+			instance_groups=True)
+
+	for ob in bpy.context.selected_objects:
+		ob.location = bpy.context.scene.cursor_location
 
 
 class ImportFractureRecorder(bpy.types.Operator):



More information about the Bf-extensions-cvs mailing list