- move more active properties into their collections:

scene.active_keying_set --> scene.keying_sets.active
  ...same for active_uv_texture. active_vertex_color, active_keyconfig, 

- move mesh.add_uv_layer() and mesh.add_vertex_color() into their collections
  also have them return the newly created layer and dont set the layer active.

  uvtex = mesh.uv_layers.new(name)
  vcol = mesh.vertex_colors.new(name)
This commit is contained in:
2010-08-23 22:16:45 +00:00
parent 1be4eda552
commit f6c323aa42
35 changed files with 317 additions and 164 deletions

View File

@@ -427,13 +427,13 @@ class JoinUVs(bpy.types.Operator):
if is_editmode:
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
if not mesh.active_uv_texture:
if not mesh.uv_textures:
self.report({'WARNING'}, "Object: %s, Mesh: '%s' has no UVs\n" % (obj.name, mesh.name))
else:
len_faces = len(mesh.faces)
uv_array = array.array('f', [0.0] * 8) * len_faces # seems to be the fastest way to create an array
mesh.active_uv_texture.data.foreach_get("uv_raw", uv_array)
mesh.uv_textures.active.data.foreach_get("uv_raw", uv_array)
objects = context.selected_editable_objects[:]
@@ -451,10 +451,9 @@ class JoinUVs(bpy.types.Operator):
if len(mesh_other.faces) != len_faces:
self.report({'WARNING'}, "Object: %s, Mesh: '%s' has %d faces, expected %d\n" % (obj_other.name, mesh_other.name, len(mesh_other.faces), len_faces))
else:
uv_other = mesh_other.active_uv_texture
uv_other = mesh_other.uv_textures.active
if not uv_other:
mesh_other.add_uv_texture() # should return the texture it adds
uv_other = mesh_other.active_uv_texture
uv_other = mesh_other.uv_textures.new() # should return the texture it adds
# finally do the copy
uv_other.data.foreach_set("uv_raw", uv_array)