diff options
-rw-r--r-- | object_fracture/fracture_ops.py | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/object_fracture/fracture_ops.py b/object_fracture/fracture_ops.py index 74558dad..69ec3202 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): |