Closes #3: Remove orphans block in loops

This commit is contained in:
ABelliqueux 2021-06-25 18:51:02 +02:00
parent de3d517a57
commit f31a71ca04
1 changed files with 16 additions and 0 deletions

View File

@ -737,6 +737,10 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
for o in bpy.data.objects:
# If orphan, ignore
if o.users == 0:
continue
if o.type == 'CAMERA' and o.data.get('isDefault'):
defaultCam = o.name
@ -1264,6 +1268,10 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
for l in bpy.data.lamps:
# If orphan, get on with it
if l.users == 0:
continue
LCM.append( str( int( l.color.r * 4096 ) if l.color.r else 0 ) )
LCM.append( str( int( l.color.g * 4096 ) if l.color.g else 0 ) )
@ -1304,6 +1312,10 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
for m in bpy.data.meshes:
# If orphan, ignore
if m.users == 0:
continue
if not m.get('isPortal') :
# Store vertices coordinates by axis to find max/min coordinates
@ -2332,6 +2344,10 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
for o in bpy.data.objects:
# If orphan, ignore
if o.users == 0:
continue
# Only loop through meshes
if o.type == 'MESH' and not o.data.get('isPortal'):