[Bf-extensions-cvs] [9ac1aff] master: Code Cleanup
oscurart
noreply at git.blender.org
Sat Dec 28 19:40:53 CET 2013
Commit: 9ac1affb66dd46ddac71e4229adb7f7b68a707f7
Author: oscurart
Date: Sat Dec 28 15:19:47 2013 -0300
https://developer.blender.org/rBAC9ac1affb66dd46ddac71e4229adb7f7b68a707f7
Code Cleanup
===================================================================
M oscurart_tools/oscurart_overrides.py
===================================================================
diff --git a/oscurart_tools/oscurart_overrides.py b/oscurart_tools/oscurart_overrides.py
index 25f45a9..9c702ed 100644
--- a/oscurart_tools/oscurart_overrides.py
+++ b/oscurart_tools/oscurart_overrides.py
@@ -31,10 +31,10 @@ def DefOscApplyOverrides(self):
ENTFILEPATH= "%s_OVERRIDE.xml" % (os.path.join(ACTIVEFOLDER, bpy.context.scene.name))
## GUARDO MATERIALES DE OBJETOS EN GRUPOS
- LISTMAT = { OBJ : [SLOT.material for SLOT in OBJ.material_slots[:]] for OBJ in bpy.data.objects[:] if OBJ.type == "MESH" or OBJ.type == "META" or OBJ.type == "CURVE" }
+ LISTMAT = { OBJ : [SLOT.material for SLOT in OBJ.material_slots] for OBJ in bpy.data.objects if OBJ.type in {'MESH', 'META', 'CURVE'} }
for OVERRIDE in PROPTOLIST:
- for OBJECT in bpy.data.groups[OVERRIDE[0]].objects[:]:
- if OBJECT.type == "MESH" or OBJECT.type == "META" or OBJECT.type == "CURVE":
+ for OBJECT in bpy.data.groups[OVERRIDE[0]].objects:
+ if OBJECT.type in {'MESH', 'META', 'CURVE'}:
LENSLOTS = len(OBJECT.material_slots[:])
OBJECT.data.materials.clear()
for MATSLOT in range(LENSLOTS):
@@ -46,7 +46,7 @@ def DefOscApplyOverrides(self):
#else:
# print ("* %s have not Material Slots" % (OBJECT.name))
with open(ENTFILEPATH, mode="w") as file:
- file.writelines(str(LISTMAT))
+ file.write(str(LISTMAT))
def DefOscRestoreOverrides(self):
@@ -60,7 +60,7 @@ def DefOscRestoreOverrides(self):
# RESTAURO MATERIALES DE OVERRIDES
for OBJ in LISTMAT:
OBJ.data.materials.clear()
- if OBJ.type == "MESH" or OBJ.type == "META" or OBJ.type == "CURVE":
+ if OBJ.type in {'MESH', 'META', 'CURVE'}:
for SLOTIND, SLOT in enumerate(LISTMAT[OBJ]):
#OBJ.material_slots[SLOTIND].material = SLOT
OBJ.data.materials.append(SLOT)
@@ -292,4 +292,3 @@ class OscRemoveOverridesSlot (bpy.types.Operator):
bpy.utils.register_class(OscTransferOverrides)
bpy.utils.register_class(OscAddOverridesSlot)
bpy.utils.register_class(OscRemoveOverridesSlot)
-
More information about the Bf-extensions-cvs
mailing list