Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillian Padovani Germano <wpgermano@gmail.com>2007-02-10 18:11:11 +0300
committerWillian Padovani Germano <wpgermano@gmail.com>2007-02-10 18:11:11 +0300
commit148b8d8014d07444aef2ce015c7068adc195053a (patch)
tree9fb8a9dfd12063dcb24f923b9410645e980315dc /release/scripts/ac3d_import.py
parentde0e9d8b20de768f1cc33d77c185266f1cbe664d (diff)
Scripts:
- Fixing bug #5950 reported by Stewart Andreason (thanks): http://projects.blender.org/tracker/?func=detail&atid=125&aid=5950&group_id=9 Importing .ac models created Blender objects with user count equal to 2, instead of 1 (so they couldn't be deleted in Blender), because the script kept a second reference to each created Blender object and so Python didn't deallocate things properly at the end of the script. Now these extra references are deleted in the script, preventing the problem. But this is surely something to fix in the API itself.
Diffstat (limited to 'release/scripts/ac3d_import.py')
-rw-r--r--release/scripts/ac3d_import.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/release/scripts/ac3d_import.py b/release/scripts/ac3d_import.py
index 7aa8d8ab8ba..e711f4ccd33 100644
--- a/release/scripts/ac3d_import.py
+++ b/release/scripts/ac3d_import.py
@@ -460,6 +460,8 @@ class AC3DImport:
olist = self.objlist[1:]
olist.reverse()
+ scene = self.scene
+
newlist = []
for o in olist:
@@ -473,9 +475,7 @@ class AC3DImport:
children.remove(parent)
o.bl_obj = parent.bl_obj
else: # not found, use an empty
- empty = Object.New('Empty', o.name)
- self.scene.link(empty)
- empty.select(True)
+ empty = scene.objects.new('Empty', o.name)
o.bl_obj = empty
bl_children = [c.bl_obj for c in children if c.bl_obj != None]
@@ -513,6 +513,13 @@ class AC3DImport:
o.loc = Vector(0.0, 0.0, 0.0)
blob.setLocation(o.loc) # forces DAG update, so we do it even for 0, 0, 0
+ # XXX important: until we fix the BPy API so it doesn't increase user count
+ # when wrapping a Blender object, this piece of code is needed for proper
+ # object (+ obdata) deletion in Blender:
+ for o in self.objlist:
+ if o.bl_obj:
+ o.bl_obj = None
+
def testAC3DImport(self):
FACE_TWOSIDE = Mesh.FaceModes['TWOSIDE']
@@ -555,7 +562,7 @@ class AC3DImport:
elif obj.type == AC_LIGHT:
light = Lamp.New('Lamp')
object = scene.objects.new(light, obj.name)
- object.select(True)
+ #object.select(True)
obj.bl_obj = object
if obj.data:
light.name = obj.data
@@ -570,7 +577,7 @@ class AC3DImport:
mesh = Mesh.New()
object = scene.objects.new(mesh, obj.name)
- object.select(True)
+ #object.select(True)
obj.bl_obj = object
if obj.data: mesh.name = obj.data
mesh.degr = obj.crease # will auto clamp to [1, 80]