- move more active properties into their collections:
authorCampbell Barton <ideasman42@gmail.com>
Mon, 23 Aug 2010 22:16:45 +0000 (22:16 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 23 Aug 2010 22:16:45 +0000 (22:16 +0000)
  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)

35 files changed:
release/scripts/io/export_3ds.py
release/scripts/io/export_fbx.py
release/scripts/io/export_obj.py
release/scripts/io/export_ply.py
release/scripts/io/export_x3d.py
release/scripts/io/import_scene_3ds.py
release/scripts/io/import_scene_obj.py
release/scripts/op/object.py
release/scripts/op/presets.py
release/scripts/op/uv.py
release/scripts/op/uvcalc_follow_active.py
release/scripts/op/uvcalc_smart_project.py
release/scripts/presets/interaction/maya.py
release/scripts/templates/operator_uv.py
release/scripts/ui/properties_data_armature.py
release/scripts/ui/properties_data_mesh.py
release/scripts/ui/properties_scene.py
release/scripts/ui/space_image.py
release/scripts/ui/space_outliner.py
release/scripts/ui/space_time.py
release/scripts/ui/space_userpref_keymap.py
source/blender/blenkernel/BKE_customdata.h
source/blender/blenkernel/intern/customdata.c
source/blender/editors/include/ED_mesh.h
source/blender/editors/mesh/editmesh_lib.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/makesrna/intern/rna_animation.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_mesh_api.c
source/blender/makesrna/intern/rna_pose.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_wm.c

index 4a5521bd9e933ee8d719081afbe5e3715aaf3a88..706e7eb15165a586b4120580a710011236b2518e 100644 (file)
@@ -567,7 +567,7 @@ def extract_triangles(mesh):
         f_v = face.vertices
 #              f_v = face.v
 
-        uf = mesh.active_uv_texture.data[i] if do_uv else None
+        uf = mesh.uv_textures.active.data[i] if do_uv else None
 
         if do_uv:
             f_uv = uf.uv
@@ -998,7 +998,7 @@ def write(filename, context):
                     if not mat_ls:
                         mat = mat_name = None
 
-                    for f, uf in zip(data.faces, data.active_uv_texture.data):
+                    for f, uf in zip(data.faces, data.uv_textures.active.data):
                         if mat_ls:
                             mat_index = f.material_index
 #                                                      mat_index = f.mat
index 60e9e90e11b0d7147cba91d8bbff28b3dc3002ec..486f7d8199b54f220eb6558543d4dd156ff74f40 100644 (file)
@@ -1630,7 +1630,7 @@ def write(filename, batch_objects = None, \
 #              if me.vertexColors:
             collayers = me.vertex_colors
 #                      collayers = me.getColorLayerNames()
-            collayer_orig = me.active_vertex_color
+            collayer_orig = me.vertex_colors.active
 #                      collayer_orig = me.activeColorLayer
             for colindex, collayer in enumerate(collayers):
 #                              me.activeColorLayer = collayer
@@ -1700,7 +1700,7 @@ def write(filename, batch_objects = None, \
         if do_uvs:
             uvlayers = me.uv_textures
 #                      uvlayers = me.getUVLayerNames()
-            uvlayer_orig = me.active_uv_texture
+            uvlayer_orig = me.uv_textures.active
 #                      uvlayer_orig = me.activeUVLayer
             for uvindex, uvlayer in enumerate(me.uv_textures):
 #                      for uvindex, uvlayer in enumerate(uvlayers):
@@ -1834,8 +1834,8 @@ def write(filename, batch_objects = None, \
 
                 mats = my_mesh.blenMaterialList
 
-                if me.active_uv_texture:
-                    uv_faces = me.active_uv_texture.data
+                if me.uv_textures.active:
+                    uv_faces = me.uv_textures.active.data
                 else:
                     uv_faces = [None] * len(me.faces)
 
@@ -2103,7 +2103,7 @@ def write(filename, batch_objects = None, \
                     material_mapping_local = {}
                     if len(me.uv_textures) > 0:
 #                                      if me.faceUV:
-                        uvlayer_orig = me.active_uv_texture
+                        uvlayer_orig = me.uv_textures.active
 #                                              uvlayer_orig = me.activeUVLayer
                         for uvlayer in me.uv_textures:
 #                                              for uvlayer in me.getUVLayerNames():
index 53c4a324ed17266e802d58aa8e1d8e1f405691e5..68edc561498296bc8216243b3970ec5276a73c3d 100644 (file)
@@ -418,7 +418,7 @@ def write_file(filepath, objects, scene,
 
             if EXPORT_UV:
                 faceuv = len(me.uv_textures) > 0
-                uv_layer = me.active_uv_texture.data[:]
+                uv_layer = me.uv_textures.active.data[:]
             else:
                 faceuv = False
 
@@ -542,7 +542,7 @@ def write_file(filepath, objects, scene,
                 uv_face_mapping = [[0,0,0,0] for i in range(len(face_index_pairs))] # a bit of a waste for tri's :/
 
                 uv_dict = {} # could use a set() here
-                uv_layer = me.active_uv_texture.data
+                uv_layer = me.uv_textures.active.data
                 for f, f_index in face_index_pairs:
                     for uv_index, uv in enumerate(uv_layer[f_index].uv):
                         uvkey = veckey2d(uv)
index 1a4fd7a6ff99f366635a678b1838eddf6a1ff02d..946be68ec4194f4d8107d42380d96c9a879cb6c7 100644 (file)
@@ -129,7 +129,7 @@ def write(filename, scene, ob, \
         vertexColors = False
 
     if faceUV:
-        active_uv_layer = mesh.active_uv_texture
+        active_uv_layer = mesh.uv_textures.active
         if not active_uv_layer:
             EXPORT_UV = False
             faceUV = None
@@ -137,7 +137,7 @@ def write(filename, scene, ob, \
             active_uv_layer = active_uv_layer.data
 
     if vertexColors:
-        active_col_layer = mesh.active_vertex_color
+        active_col_layer = mesh.vertex_colors.active
         if not active_col_layer:
             EXPORT_COLORS = False
             vertexColors = None
index aafb7c922a18f81f259d89bce3eb46da65d4647f..c98debd5c60c8326e5eb4ae206664fe00451acfe 100644 (file)
@@ -402,9 +402,9 @@ class x3d_class:
         if len(mesh.faces) == 0: return
         mode = []
         # mode = 0
-        if mesh.active_uv_texture:
+        if mesh.uv_textures.active:
         # if mesh.faceUV:
-            for face in mesh.active_uv_texture.data:
+            for face in mesh.uv_textures.active.data:
             # for face in mesh.faces:
                 if face.use_halo and 'HALO' not in mode:
                     mode += ['HALO']
@@ -463,7 +463,7 @@ class x3d_class:
         hasImageTexture=0
         is_smooth = False
 
-        if len(maters) > 0 or mesh.active_uv_texture:
+        if len(maters) > 0 or mesh.uv_textures.active:
         # if len(maters) > 0 or mesh.faceUV:
             self.writeIndented("<Appearance>\n", 1)
             # right now this script can only handle a single material per mesh.
@@ -480,9 +480,9 @@ class x3d_class:
 
                 #-- textures
                 face = None
-                if mesh.active_uv_texture:
+                if mesh.uv_textures.active:
                 # if mesh.faceUV:
-                    for face in mesh.active_uv_texture.data:
+                    for face in mesh.uv_textures.active.data:
                     # for face in mesh.faces:
                         if face.image:
                         # if (hasImageTexture == 0) and (face.image):
@@ -525,7 +525,7 @@ class x3d_class:
                 self.file.write("creaseAngle=\"%s\" " % (round(creaseAngle,self.cp)))
 
             #--- output textureCoordinates if UV texture used
-            if mesh.active_uv_texture:
+            if mesh.uv_textures.active:
             # if mesh.faceUV:
                 if self.matonly == 1 and self.share == 1:
                     self.writeFaceColors(mesh)
@@ -540,7 +540,7 @@ class x3d_class:
             self.writeCoordinates(ob, mesh, meshName, EXPORT_TRI)
 
             #--- output textureCoordinates if UV texture used
-            if mesh.active_uv_texture:
+            if mesh.uv_textures.active:
             # if mesh.faceUV:
                 if hasImageTexture == 1:
                     self.writeTextureCoordinates(mesh)
@@ -614,7 +614,7 @@ class x3d_class:
         texIndexList=[]
         j=0
 
-        for face in mesh.active_uv_texture.data:
+        for face in mesh.uv_textures.active.data:
         # for face in mesh.faces:
             # workaround, since tface.uv iteration is wrong atm
             uvs = face.uv
@@ -646,10 +646,10 @@ class x3d_class:
     def writeFaceColors(self, mesh):
         if self.writingcolor == 0:
             self.file.write("colorPerVertex=\"false\" ")
-        elif mesh.active_vertex_color:
+        elif mesh.vertex_colors.active:
         # else:
             self.writeIndented("<Color color=\"", 1)
-            for face in mesh.active_vertex_color.data:
+            for face in mesh.vertex_colors.active.data:
                 c = face.color1
                 if self.verbose > 2:
                     print("Debug: face.col r=%d g=%d b=%d" % (c[0], c[1], c[2]))
@@ -961,9 +961,9 @@ class x3d_class:
         faceMap={}
         nFaceIndx=0
 
-        if mesh.active_uv_texture:
+        if mesh.uv_textures.active:
         # if mesh.faceUV:
-            for face in mesh.active_uv_texture.data:
+            for face in mesh.uv_textures.active.data:
             # for face in mesh.faces
                 sidename = "two" if face.use_twoside else "one"
 
index 6378d93df62c361616e75e102f56e11bad83d519..f956f29b0e7322f2267a09a0af669b06e051b8d3 100644 (file)
@@ -346,8 +346,8 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
             bmesh.faces.foreach_set("vertices_raw", eekadoodle_faces)
             
             if bmesh.faces and contextMeshUV:
-                bmesh.add_uv_texture()
-                uv_faces = bmesh.active_uv_texture.data[:]
+                bmesh.uv_textures.new()
+                uv_faces = bmesh.uv_textures.active.data[:]
             else:
                 uv_faces = None
 
index 655f797750e88d6891a98c94b1e671ebc37d4aaf..f20652a6b0a42e00b471d0e6bf4aca5a0c8768a0 100644 (file)
@@ -692,9 +692,7 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
 #      face_mapping= me.faces.extend([f[0] for f in faces], indexList=True)
 
     if verts_tex and me.faces:
-        me.add_uv_texture()
-#              me.faceUV= 1
-        # TEXMODE= Mesh.FaceModes['TEX']
+        me.uv_textures.new()
 
     context_material_old= -1 # avoid a dict lookup
     mat= 0 # rare case it may be un-initialized.
index 56c43c0728c6c896cd261a5905087b42f499ed6b..28f3b226c215aa4a6710aeb8024f954950c1a35f 100644 (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)
index 43e2cda5d53dadf824effe2b92ca530585707ece..4d15d94f408ec1d6991edfc77be72cf40552dd36 100644 (file)
@@ -50,7 +50,7 @@ class AddPresetBase():
         if getattr(self, "save_keyconfig", False):
             bpy.ops.wm.keyconfig_export(filepath=filepath, kc_name=self.properties.name)
             file_preset = open(filepath, 'a')
-            file_preset.write("wm.active_keyconfig = kc\n\n")
+            file_preset.write("wm.keyconfigs.active = kc\n\n")
         else:
             file_preset = open(filepath, 'w')
             file_preset.write("import bpy\n")
index cf3d68787c0d888d156c5e589c51951d9f1df0e0..238c11d6e066e7afd8bcda5edf853e30c0192b19 100644 (file)
@@ -69,7 +69,7 @@ class ExportUVLayout(bpy.types.Operator):
     def _face_uv_iter(self, context):
         obj = context.active_object
         mesh = obj.data
-        uv_layer = mesh.active_uv_texture.data
+        uv_layer = mesh.uv_textures.active.data
         uv_layer_len = len(uv_layer)
 
         if not self.properties.export_all:
index 1f80e704f933bb54e324e42f6cc42a418b15883a..9f809dd39f8554900616916911a228fcc860e27f 100644 (file)
@@ -28,8 +28,8 @@ def extend(obj, operator, EXTEND_MODE):
     me = obj.data
     me_verts = me.vertices
     # script will fail without UVs
-    if not me.active_uv_texture:
-        me.add_uv_texture()
+    if not me.uv_textures:
+        me.uv_textures.new()
 
 
     # Toggle Edit mode
@@ -57,10 +57,10 @@ def extend(obj, operator, EXTEND_MODE):
         vidx_source = face_source.vertices
         vidx_target = face_target.vertices
 
-        faceUVsource = me.active_uv_texture.data[face_source.index]
+        faceUVsource = me.uv_textures.active.data[face_source.index]
         uvs_source = [faceUVsource.uv1, faceUVsource.uv2, faceUVsource.uv3, faceUVsource.uv4]
 
-        faceUVtarget = me.active_uv_texture.data[face_target.index]
+        faceUVtarget = me.uv_textures.active.data[face_target.index]
         uvs_target = [faceUVtarget.uv1, faceUVtarget.uv2, faceUVtarget.uv3, faceUVtarget.uv4]
 
         # vertex index is the key, uv is the value
@@ -138,8 +138,8 @@ def extend(obj, operator, EXTEND_MODE):
             uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
 
 
-    if me.active_uv_texture == None:
-        me.add_uv_texture
+    if not me.uv_textures:
+        me.uv_textures.new()
 
     face_act = me.faces.active
     if face_act == -1:
index 0589b7e861ac40de47f6491ceacba0cc2647ea5f..c4e19afc810130487ef593c4fe982952bd9a7411 100644 (file)
@@ -892,10 +892,10 @@ def main(context, island_margin, projection_limit):
         # Tag as used
         me.tag = True
 
-        if len(me.uv_textures)==0: # Mesh has no UV Coords, dont bother.
-            me.add_uv_texture()
+        if not me.uv_textures: # Mesh has no UV Coords, dont bother.
+            me.uv_textures.new()
 
-        uv_layer = me.active_uv_texture.data
+        uv_layer = me.uv_textures.active.data
         me_verts = list(me.vertices)
 
         if USER_ONLY_SELECTED_FACES:
index ccd95abf75ebbabc5ec2b60698b2513ee24aa163..4fcf987c9b20d466b0f1db9fc7038e67071cd93f 100644 (file)
@@ -375,7 +375,7 @@ kmi.properties.value_2 = 'CONNECTED'
 kmi = km.items.add('mesh.select_all', 'SELECTMOUSE', 'CLICK')
 kmi.properties.action = 'DESELECT'
 
-wm.active_keyconfig = kc
+wm.keyconfigs.active = kc
 
 bpy.context.user_preferences.edit.use_drag_immediately = True
 bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False
index a18aaf358c882827d11fa4a551ae87b37d7f5849..305496e31ce49262feb63f145e40bd2fa9a9e997 100644 (file)
@@ -9,11 +9,11 @@ def main(context):
         bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
 
 
-    if not mesh.active_uv_texture:
-        bpy.ops.mesh.uv_texture_add()
+    if not mesh.uv_textures:
+        uvtex = bpy.ops.mesh.uv_texture_add()
 
     # adjust UVs
-    for i, uv in enumerate(mesh.active_uv_texture.data):
+    for i, uv in enumerate(uvtex.data):
         uvs = uv.uv1, uv.uv2, uv.uv3, uv.uv4
         for j, v_idx in enumerate(mesh.faces[i].vertices):
             if uv.select_uv[j]:
index 7de0655475140f5924cf4851e5ab96e6ae476c3b..3931626f0ffebbf0cf7ed220654d1b16a650d108 100644 (file)
@@ -126,7 +126,7 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
         col.operator("pose.group_add", icon='ZOOMIN', text="")
         col.operator("pose.group_remove", icon='ZOOMOUT', text="")
 
-        group = pose.active_bone_group
+        group = pose.bone_groups.active
         if group:
             col = layout.column()
             col.active = (ob.proxy is None)
index fd184819143f8f1fce7173fb803e5c4dca6938c8..986d1d2e834d0d01c545c9511a3bb743d22dd791 100644 (file)
@@ -272,7 +272,7 @@ class DATA_PT_uv_texture(MeshButtonsPanel, bpy.types.Panel):
         col.operator("mesh.uv_texture_add", icon='ZOOMIN', text="")
         col.operator("mesh.uv_texture_remove", icon='ZOOMOUT', text="")
 
-        lay = me.active_uv_texture
+        lay = me.uv_textures.active
         if lay:
             layout.prop(lay, "name")
 
@@ -341,7 +341,7 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel):
         col.operator("mesh.vertex_color_add", icon='ZOOMIN', text="")
         col.operator("mesh.vertex_color_remove", icon='ZOOMOUT', text="")
 
-        lay = me.active_vertex_color
+        lay = me.vertex_colors.active
         if lay:
             layout.prop(lay, "name")
 
index c6b9d7522e0ef9c3ec95dfda3dbea0143e597139..6e25d79368361608fde268c56079ec7a56d4c54d 100644 (file)
@@ -82,7 +82,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
         col.operator("anim.keying_set_add", icon='ZOOMIN', text="")
         col.operator("anim.keying_set_remove", icon='ZOOMOUT', text="")
 
-        ks = scene.active_keying_set
+        ks = scene.keying_sets.active
         if ks and ks.is_path_absolute:
             row = layout.row()
 
@@ -106,13 +106,14 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
 
     @classmethod
     def poll(cls, context):
-        return (context.scene.active_keying_set and context.scene.active_keying_set.is_path_absolute)
+        ks = context.scene.keying_sets.active
+        return (ks and ks.is_path_absolute)
 
     def draw(self, context):
         layout = self.layout
 
         scene = context.scene
-        ks = scene.active_keying_set
+        ks = scene.keying_sets.active
 
         row = layout.row()
         row.label(text="Paths:")
@@ -126,7 +127,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
         col.operator("anim.keying_set_path_add", icon='ZOOMIN', text="")
         col.operator("anim.keying_set_path_remove", icon='ZOOMOUT', text="")
 
-        ksp = ks.active_path
+        ksp = ks.paths.active
         if ksp:
             col = layout.column()
             col.label(text="Target:")
@@ -227,7 +228,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
             raise Exception("Could not open file.")
 
         scene = context.scene
-        ks = scene.active_keying_set
+        ks = scene.keying_sets.active
 
 
         f.write("# Keying Set: %s\n" % ks.name)
index fc21292bc5e5ae28408361dd109db1d990bb8b1f..06c048140853db8be5ae40f0d0387ada6fdf5734 100644 (file)
@@ -316,7 +316,7 @@ class IMAGE_HT_header(bpy.types.Header):
             row.prop(toolsettings, "snap_element", text="", icon_only=True)
 
             # mesh = context.edit_object.data
-            # row.prop_search(mesh, "active_uv_layer", mesh, "uv_textures")
+            # row.prop_search_self(mesh, "active", "uv_textures")
 
         if ima:
             # layers
index e2d8db385f683cf0441efb933e85cb5a7533c504..11760d7bafe08f205d1199a28fff7eabe61909c1 100644 (file)
@@ -28,7 +28,7 @@ class OUTLINER_HT_header(bpy.types.Header):
 
         space = context.space_data
         scene = context.scene
-        ks = context.scene.active_keying_set
+        ks = context.scene.keying_sets.active
 
         row = layout.row(align=True)
         row.template_header()
@@ -53,7 +53,7 @@ class OUTLINER_HT_header(bpy.types.Header):
 
             if ks:
                 row = layout.row(align=False)
-                row.prop_search(scene, "active_keying_set", scene, "keying_sets", text="")
+                row.prop_search_self(scene, "active", "keying_sets", text="")
 
                 row = layout.row(align=True)
                 row.operator("anim.keyframe_insert", text="", icon='KEY_HLT')
index 7745207341ad1ce5c704d019e21df0b5e529aea0..40d165a8f4918670a50e68b18827f03578e0b81a 100644 (file)
@@ -77,7 +77,7 @@ class TIME_HT_header(bpy.types.Header):
         layout.separator()
 
         row = layout.row(align=True)
-        row.prop_search(scene, "active_keying_set", scene, "keying_sets_all", text="")
+        row.prop_search_self(scene, "active", "keying_sets", text="")
         row.operator("anim.keyframe_insert", text="", icon='KEY_HLT')
         row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT')
 
index b725ba5139c10bebbdaeaa553fb2ccd76db6089c..f8b23df97a6fcb33cce75f477a20b08433e9617d 100644 (file)
@@ -20,7 +20,6 @@
 import bpy
 import os
 
-KM_MOD_PREFIX = "keyconfig_"
 
 KM_HIERARCHY = [
     ('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit
@@ -354,8 +353,8 @@ class InputKeyMapPanel(bpy.types.Panel):
 
     def draw_keymaps(self, context, layout):
         wm = context.manager
-        kc = wm.active_keyconfig
-        defkc = wm.default_keyconfig
+        kc = wm.keyconfigs.active
+        defkc = wm.keyconfigs.default
 
         col = layout.column()
         sub = col.column()
@@ -364,8 +363,8 @@ class InputKeyMapPanel(bpy.types.Panel):
         subcol = subsplit.column()
 
         row = subcol.row()
-        row.prop_search(wm, "active_keyconfig", wm, "keyconfigs", text="Key Config:")
-        layout.set_context_pointer("keyconfig", wm.active_keyconfig)
+        row.prop_search_self(wm, "active", "keyconfigs", text="Key Config:")
+        layout.set_context_pointer("keyconfig", wm.keyconfigs.active)
         row.operator("wm.keyconfig_remove", text="", icon='X')
 
         row.prop(context.space_data, "filter_text", icon="VIEWZOOM")
@@ -487,7 +486,7 @@ class WM_OT_keyconfig_test(bpy.types.Operator):
 
     def execute(self, context):
         wm = context.manager
-        kc = wm.default_keyconfig
+        kc = wm.keyconfigs.default
 
         if self.testConfig(kc):
             print("CONFLICT")
@@ -563,7 +562,7 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
             reload(mod)
 
         wm = bpy.context.manager
-        wm.active_keyconfig = wm.keyconfigs[config_name]
+        wm.keyconfigs.active = wm.keyconfigs[config_name]
 
         return {'FINISHED'}
 
@@ -595,7 +594,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
             raise Exception("Could not open file")
 
         wm = context.manager
-        kc = wm.active_keyconfig
+        kc = wm.keyconfigs.active
 
         if self.properties.kc_name != '':
             name = self.properties.kc_name
@@ -624,7 +623,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
         edited_kc = FakeKeyConfig()
         edited_kc.keymaps.extend(context.user_preferences.inputs.edited_keymaps)
         # merge edited keymaps with non-default keyconfig, if it exists
-        if kc != wm.default_keyconfig:
+        if kc != wm.keyconfigs.default:
             export_keymaps = _merge_keymaps(edited_kc, kc)
         else:
             export_keymaps = _merge_keymaps(edited_kc, edited_kc)
@@ -695,7 +694,7 @@ class WM_OT_keymap_restore(bpy.types.Operator):
         wm = context.manager
 
         if self.properties.all:
-            for km in wm.default_keyconfig.keymaps:
+            for km in wm.keyconfigs.default.keymaps:
                 km.restore_to_default()
         else:
             km = context.keymap
@@ -729,7 +728,7 @@ class WM_OT_keyitem_add(bpy.types.Operator):
     def execute(self, context):
         wm = context.manager
         km = context.keymap
-        kc = wm.default_keyconfig
+        kc = wm.keyconfigs.default
 
         if km.is_modal:
             km.items.add_modal("", 'A', 'PRESS') # kmi
@@ -768,13 +767,13 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
     @classmethod
     def poll(cls, context):
         wm = context.manager
-        return wm.active_keyconfig.is_user_defined
+        return wm.keyconfigs.active.is_user_defined
 
     def execute(self, context):
         import sys
         wm = context.manager
 
-        keyconfig = wm.active_keyconfig
+        keyconfig = wm.keyconfigs.active
 
         module = sys.modules.get(keyconfig.name)
 
index ce4286f01c840f754adc143a368d7d4da58228fb..84eb8ef53001ddbfa4b161b06632bb1f5bbd591c 100644 (file)
@@ -88,7 +88,7 @@ void *CustomData_add_layer(struct CustomData *data, int type, int alloctype,
                                                   void *layer, int totelem);
 /*same as above but accepts a name */
 void *CustomData_add_layer_named(struct CustomData *data, int type, int alloctype,
-                                                  void *layer, int totelem, char *name);
+                                                  void *layer, int totelem, const char *name);
 
 /* frees the active or first data layer with the give type.
  * returns 1 on succes, 0 if no layer with the given type is found
index dcc0a0b876f7b8637f2353de735761f7107e32c2..1f4b0f303f72c18e7ea733cf37dda522ffc79ebb 100644 (file)
@@ -1213,7 +1213,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
        data->layers[index].flag = flag;
        data->layers[index].data = newlayerdata;
 
-       if(name) {
+       if(name || (name=typeInfo->defaultname)) {
                strcpy(data->layers[index].name, name);
                CustomData_set_layer_unique_name(data, index);
        }
@@ -1254,7 +1254,7 @@ void *CustomData_add_layer(CustomData *data, int type, int alloctype,
 
 /*same as above but accepts a name*/
 void *CustomData_add_layer_named(CustomData *data, int type, int alloctype,
-                                                  void *layerdata, int totelem, char *name)
+                                                  void *layerdata, int totelem, const char *name)
 {
        CustomDataLayer *layer;
        
index 43c11206bbe44bae63436a0c2192e48b22b6b50a..bf809d39fe4ba08f87fe7206a4540222192635ce 100644 (file)
@@ -147,7 +147,7 @@ struct UvVertMap *EM_make_uv_vert_map(struct EditMesh *em, int selected, int do_
 struct UvMapVert *EM_get_uv_map_vert(struct UvVertMap *vmap, unsigned int v);
 void              EM_free_uv_vert_map(struct UvVertMap *vmap);
 
-void           EM_add_data_layer(struct EditMesh *em, struct CustomData *data, int type);
+void           EM_add_data_layer(struct EditMesh *em, struct CustomData *data, int type, const char *name);
 void           EM_free_data_layer(struct EditMesh *em, struct CustomData *data, int type);
 
 void           EM_make_hq_normals(struct EditMesh *em);
@@ -216,9 +216,9 @@ void ED_mesh_calc_normals(struct Mesh *me);
 void ED_mesh_material_add(struct Mesh *me, struct Material *ma);
 void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges);
 
-int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me);
+int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
 int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
-int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me);
+int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
 int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
 
 #endif /* ED_MESH_H */
index a5c6a3e5a02c9feb9fa9d17fba24a3d378cc743b..d34cca0d358442d1d5a1922820f018baa188c4cf 100644 (file)
@@ -967,13 +967,13 @@ static void update_data_blocks(EditMesh *em, CustomData *olddata, CustomData *da
        }
 }
 
-void EM_add_data_layer(EditMesh *em, CustomData *data, int type)
+void EM_add_data_layer(EditMesh *em, CustomData *data, int type, const char *name)
 {
        CustomData olddata;
 
        olddata= *data;
        olddata.layers= (olddata.layers)? MEM_dupallocN(olddata.layers): NULL;
-       CustomData_add_layer(data, type, CD_CALLOC, NULL, 0);
+       CustomData_add_layer_named(data, type, CD_CALLOC, NULL, 0, name);
 
        update_data_blocks(em, &olddata, data);
        if (olddata.layers) MEM_freeN(olddata.layers);
index 2d337558f56bcd6c61cb31c3ee1c037b4dc5a8f1..edcdedf2a39d7fa8ab30bb724e4980c499cb3725 100644 (file)
@@ -157,7 +157,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
        }
 }
 
-int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
+int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set)
 {
        EditMesh *em;
        int layernum;
@@ -167,22 +167,25 @@ int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
 
                layernum= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
                if(layernum >= MAX_MTFACE)
-                       return OPERATOR_CANCELLED;
+                       return 0;
 
-               EM_add_data_layer(em, &em->fdata, CD_MTFACE);
-               CustomData_set_layer_active(&em->fdata, CD_MTFACE, layernum);
+               EM_add_data_layer(em, &em->fdata, CD_MTFACE, name);
+               if(active_set || layernum==0)
+                       CustomData_set_layer_active(&em->fdata, CD_MTFACE, layernum);
        }
        else {
                layernum= CustomData_number_of_layers(&me->fdata, CD_MTFACE);
                if(layernum >= MAX_MTFACE)
-                       return OPERATOR_CANCELLED;
+                       return 0;
 
                if(me->mtface)
-                       CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DUPLICATE, me->mtface, me->totface);
+                       CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DUPLICATE, me->mtface, me->totface, name);
                else
-                       CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface);
+                       CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface, name);
+
+               if(active_set || layernum==0)
+                       CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum);
 
-               CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum);
                mesh_update_customdata_pointers(me);
        }
 
@@ -198,7 +201,7 @@ int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
        CustomDataLayer *cdl;
        int index;
 
-        index= CustomData_get_active_layer_index(data, CD_MTFACE);
+       index= CustomData_get_active_layer_index(data, CD_MTFACE);
        cdl= (index == -1) ? NULL: &data->layers[index];
 
        if(!cdl)
@@ -211,7 +214,7 @@ int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
        return 1;
 }
 
-int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
+int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set)
 {
        EditMesh *em;
        MCol *mcol;
@@ -224,8 +227,9 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
                if(layernum >= MAX_MCOL)
                        return 0;
 
-               EM_add_data_layer(em, &em->fdata, CD_MCOL);
-               CustomData_set_layer_active(&em->fdata, CD_MCOL, layernum);
+               EM_add_data_layer(em, &em->fdata, CD_MCOL, name);
+               if(active_set || layernum==0)
+                       CustomData_set_layer_active(&em->fdata, CD_MCOL, layernum);
        }
        else {
                layernum= CustomData_number_of_layers(&me->fdata, CD_MCOL);
@@ -235,11 +239,13 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
                mcol= me->mcol;
 
                if(me->mcol)
-                       CustomData_add_layer(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mcol, me->totface);
+                       CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mcol, me->totface, name);
                else
-                       CustomData_add_layer(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface);
+                       CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface, name);
+
+               if(active_set || layernum==0)
+                       CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
 
-               CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
                mesh_update_customdata_pointers(me);
 
                if(!mcol)
@@ -286,7 +292,7 @@ static int uv_texture_add_exec(bContext *C, wmOperator *op)
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
        Mesh *me= ob->data;
 
-       if(!ED_mesh_uv_texture_add(C, scene, ob, me))
+       if(!ED_mesh_uv_texture_add(C, scene, ob, me, NULL, TRUE))
                return OPERATOR_CANCELLED;
 
        return OPERATOR_FINISHED;
@@ -420,7 +426,7 @@ static int vertex_color_add_exec(bContext *C, wmOperator *op)
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
        Mesh *me= ob->data;
 
-       if(!ED_mesh_color_add(C, scene, ob, me))
+       if(!ED_mesh_color_add(C, scene, ob, me, NULL, TRUE))
                return OPERATOR_CANCELLED;
 
        return OPERATOR_FINISHED;
index 377a4d15675ca2ebb22f2bc7f3aae745bf746861..670e89b668f0dee0259330ece15547ecece188b5 100644 (file)
@@ -1341,7 +1341,7 @@ static void vgroup_assign_verts(Object *ob, float weight)
                EditMesh *em = BKE_mesh_get_editmesh(me);
 
                if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT))
-                       EM_add_data_layer(em, &em->vdata, CD_MDEFORMVERT);
+                       EM_add_data_layer(em, &em->vdata, CD_MDEFORMVERT, NULL);
 
                /* Go through the list of editverts and assign them */
                for(eve=em->verts.first; eve; eve=eve->next){
index c2918f0faaea24f3389de3513df7d65592303717..cd58ac4a482dd4e66223545625c20494491290f6 100644 (file)
@@ -107,7 +107,7 @@ void ED_uvedit_assign_image(Scene *scene, Object *obedit, Image *ima, Image *pre
        
        /* ensure we have a uv layer */
        if(!CustomData_has_layer(&em->fdata, CD_MTFACE)) {
-               EM_add_data_layer(em, &em->fdata, CD_MTFACE);
+               EM_add_data_layer(em, &em->fdata, CD_MTFACE, NULL);
                update= 1;
        }
 
index 54ee7db9556097d2b81ab337cb9302ab4456e96b..20c9fa5877bfc880f91222ef21f80a26928a09d6 100644 (file)
@@ -84,7 +84,7 @@ static int ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit)
        }
 
        if(em && em->faces.first)
-               EM_add_data_layer(em, &em->fdata, CD_MTFACE);
+               EM_add_data_layer(em, &em->fdata, CD_MTFACE, NULL);
        
        if(!ED_uvedit_test(obedit)) {
                BKE_mesh_end_editmesh(obedit->data, em);
index 87a002db828a274dffbb3f95dfb3f7974c367b53..cec7b1cd33c940ec1660b05725013ca97c19d4bb 100644 (file)
@@ -536,6 +536,8 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
 
        FunctionRNA *func;
        PropertyRNA *parm;
+       
+       PropertyRNA *prop;
 
        RNA_def_property_srna(cprop, "KeyingSetPaths");
        srna= RNA_def_struct(brna, "KeyingSetPaths", NULL);
@@ -576,6 +578,13 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
        func= RNA_def_function(srna, "clear", "rna_KeyingSet_paths_clear");
        RNA_def_function_ui_description(func, "Remove all the paths from the Keying Set.");
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
+       
+       prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+       RNA_def_property_struct_type(prop, "KeyingSetPath");
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
+       RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL);
+       RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
 }
 
 static void rna_def_keyingset(BlenderRNA *brna)
@@ -605,13 +614,7 @@ static void rna_def_keyingset(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Paths", "Keying Set Paths to define settings that get keyframed together");
        rna_def_keyingset_paths(brna, prop);
        
-       prop= RNA_def_property(srna, "active_path", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "KeyingSetPath");
-       RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
-       RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL);
-       RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
-       
+       /* TODO, move to collection */
        prop= RNA_def_property(srna, "active_path_index", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "active_path");
        RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set", "rna_KeyingSet_active_ksPath_index_range");
index 3dc7b8922e793440c512e0bc35326ea790ce3d1b..a6d79a18670113a962bcaf873e4cf0d767883085 100644 (file)
@@ -1064,6 +1064,32 @@ static int rna_Mesh_tot_face_get(PointerRNA *ptr)
        return me->edit_mesh ? me->edit_mesh->totfacesel : 0;
 }
 
+static CustomDataLayer *rna_Mesh_vertex_color_new(struct Mesh *me, struct bContext *C, char *name)
+{
+       CustomData *fdata;
+       CustomDataLayer *cdl;
+       int index;
+       ED_mesh_color_add(C, NULL, NULL, me, name, FALSE);
+
+       fdata= rna_mesh_fdata(me);
+       index= CustomData_number_of_layers(fdata, CD_MCOL) - 1;
+       cdl= (index == -1)? NULL: &fdata->layers[index];
+       return cdl;
+}
+
+static CustomDataLayer *rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, char *name)
+{
+       CustomData *fdata;
+       CustomDataLayer *cdl;
+       int index;
+       ED_mesh_uv_texture_add(C, NULL, NULL, me, name, FALSE);
+
+       fdata= rna_mesh_fdata(me);
+       index= CustomData_number_of_layers(fdata, CD_MTFACE) - 1;
+       cdl= (index == -1)? NULL: &fdata->layers[index];
+       return cdl;
+}
+
 #else
 
 static void rna_def_mvert_group(BlenderRNA *brna)
@@ -1630,6 +1656,78 @@ static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
 }
 
 
+/* mesh.vertex_colors */
+static void rna_def_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       FunctionRNA *func;
+       PropertyRNA *parm;
+
+       RNA_def_property_srna(cprop, "VertexColors");
+       srna= RNA_def_struct(brna, "VertexColors", NULL);
+       RNA_def_struct_sdna(srna, "Mesh");
+       RNA_def_struct_ui_text(srna, "Vertex Colors", "Collection of vertex colors");
+       
+       func= RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
+       RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+       RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh.");
+       parm= RNA_def_string(func, "name", "UVTex", 0, "", "UV Texture name.");
+       parm= RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer.");
+       RNA_def_function_return(func, parm);
+       
+/*
+       func= RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
+       RNA_def_function_ui_description(func, "Remove a vertex color layer.");
+       RNA_def_function_flag(func, FUNC_USE_REPORTS);
+       parm= RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+*/
+       prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+       RNA_def_property_struct_type(prop, "MeshColorLayer");
+       RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_vertex_color_get", "rna_Mesh_active_vertex_color_set", NULL, NULL);
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
+       RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
+
+/* mesh.uv_layers */
+static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       FunctionRNA *func;
+       PropertyRNA *parm;
+
+       RNA_def_property_srna(cprop, "UVTextures");
+       srna= RNA_def_struct(brna, "UVTextures", NULL);
+       RNA_def_struct_sdna(srna, "Mesh");
+       RNA_def_struct_ui_text(srna, "UV Textures", "Collection of uv textures");
+       
+       func= RNA_def_function(srna, "new", "rna_Mesh_uv_texture_new");
+       RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+       RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh.");
+       parm= RNA_def_string(func, "name", "UVTex", 0, "", "UV Texture name.");
+       parm= RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer.");
+       RNA_def_function_return(func, parm);
+
+/*
+       func= RNA_def_function(srna, "remove", "rna_Mesh_uv_layers_remove");
+       RNA_def_function_ui_description(func, "Remove a vertex color layer.");
+       RNA_def_function_flag(func, FUNC_USE_REPORTS);
+       parm= RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+*/
+       prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+       RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
+       RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_uv_texture_get", "rna_Mesh_active_uv_texture_set", NULL, NULL);
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Active UV Texture", "Active UV texture");
+       RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
+
 static void rna_def_mesh(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -1672,13 +1770,7 @@ static void rna_def_mesh(BlenderRNA *brna)
        RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", 0, 0, 0, "rna_Mesh_uv_textures_length", 0, 0);
        RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
        RNA_def_property_ui_text(prop, "UV Textures", "");
-
-       prop= RNA_def_property(srna, "active_uv_texture", PROP_POINTER, PROP_UNSIGNED);
-       RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
-       RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_uv_texture_get", "rna_Mesh_active_uv_texture_set", NULL, NULL);
-       RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_ui_text(prop, "Active UV Texture", "Active UV texture");
-       RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+       rna_def_uv_textures(brna, prop);
 
        prop= RNA_def_property(srna, "active_uv_texture_index", PROP_INT, PROP_UNSIGNED);
        RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get", "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range");
@@ -1712,14 +1804,9 @@ static void rna_def_mesh(BlenderRNA *brna)
        RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", 0, 0, 0, "rna_Mesh_vertex_colors_length", 0, 0);
        RNA_def_property_struct_type(prop, "MeshColorLayer");
        RNA_def_property_ui_text(prop, "Vertex Colors", "");
+       rna_def_vertex_colors(brna, prop);
 
-       prop= RNA_def_property(srna, "active_vertex_color", PROP_POINTER, PROP_UNSIGNED);
-       RNA_def_property_struct_type(prop, "MeshColorLayer");
-       RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_vertex_color_get", "rna_Mesh_active_vertex_color_set", NULL, NULL);
-       RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
-       RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
+       /* TODO, remove and make a collection property */
        prop= RNA_def_property(srna, "active_vertex_color_index", PROP_INT, PROP_UNSIGNED);
        RNA_def_property_int_funcs(prop, "rna_Mesh_active_vertex_color_index_get", "rna_Mesh_active_vertex_color_index_set", "rna_Mesh_active_vertex_color_index_range");
        RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
index 97252ce754e2cd6b06ef3a6e059d230a20929453..b0d655e611c5c67b877ade7f2daa40a4dc0c8180 100644 (file)
 
 #ifdef RNA_RUNTIME
 
-static void rna_Mesh_uv_texture_add(struct Mesh *me, struct bContext *C)
-{
-       ED_mesh_uv_texture_add(C, NULL, NULL, me);
-}
-
-static void rna_Mesh_vertex_color_add(struct Mesh *me, struct bContext *C)
-{
-       ED_mesh_color_add(C, NULL, NULL, me);
-}
 
 #else
 
@@ -68,14 +59,6 @@ void RNA_api_mesh(StructRNA *srna)
        parm= RNA_def_int(func, "faces", 0, 0, INT_MAX, "Number", "Number of faces to add.", 0, INT_MAX);
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
-       func= RNA_def_function(srna, "add_uv_texture", "rna_Mesh_uv_texture_add");
-       RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-       RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh.");
-
-       func= RNA_def_function(srna, "add_vertex_color", "rna_Mesh_vertex_color_add");
-       RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-       RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh.");
-
        func= RNA_def_function(srna, "calc_normals", "ED_mesh_calc_normals");
        RNA_def_function_ui_description(func, "Calculate vertex normals.");
 
index ce797f2149488b0aa4baad4177fae7f49a1734ac..73ed2a3ba504d69377e3a3267c1c1df41e43588a 100644 (file)
@@ -1135,6 +1135,28 @@ static void rna_def_pose_ikparam(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined, 0 for Legacy, 1 for iTaSC");
 }
 
+/* pose.bone_groups */
+static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+//     FunctionRNA *func;
+//     PropertyRNA *parm;
+
+       RNA_def_property_srna(cprop, "BoneGroups");
+       srna= RNA_def_struct(brna, "BoneGroups", NULL);
+       RNA_def_struct_sdna(srna, "bPose");
+       RNA_def_struct_ui_text(srna, "Bone Groups", "Collection of bone groups");
+
+       prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+       RNA_def_property_struct_type(prop, "BoneGroup");
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
+       RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
+       RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
+}
+
 static void rna_def_pose(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -1156,13 +1178,7 @@ static void rna_def_pose(BlenderRNA *brna)
        RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL);
        RNA_def_property_struct_type(prop, "BoneGroup");
        RNA_def_property_ui_text(prop, "Bone Groups", "Groups of the bones");
-
-       prop= RNA_def_property(srna, "active_bone_group", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "BoneGroup");
-       RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
-       RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
-       RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
+       rna_def_bone_groups(brna, prop);
 
        prop= RNA_def_property(srna, "active_bone_group_index", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "active_group");
index f09dd596f4f28ff247bcd746065ac5821c24dbe6..442c4b64f911e61523421c211e463b470af8e864 100644 (file)
@@ -2905,6 +2905,43 @@ static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
+/* scene.keying_sets */
+static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+//     FunctionRNA *func;
+//     PropertyRNA *parm;
+
+       RNA_def_property_srna(cprop, "KeyingSets");
+       srna= RNA_def_struct(brna, "KeyingSets", NULL);
+       RNA_def_struct_sdna(srna, "Scene");
+       RNA_def_struct_ui_text(srna, "Keying Sets", "Scene keying sets");
+
+       /*
+       func= RNA_def_function(srna, "new", "rna_Curve_spline_new");
+       RNA_def_function_ui_description(func, "Add a new spline to the curve.");
+       parm= RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       parm= RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline.");
+       RNA_def_function_return(func, parm);
+
+       func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
+       RNA_def_function_ui_description(func, "Remove a spline from a curve.");
+       RNA_def_function_flag(func, FUNC_USE_REPORTS);
+       parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       */
+
+       prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+       RNA_def_property_struct_type(prop, "KeyingSet");
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
+       RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
+       RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+}
+
 void RNA_def_scene(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -3089,6 +3126,7 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_def_property_struct_type(prop, "KeyingSet");
        RNA_def_property_ui_text(prop, "Absolute Keying Sets", "Absolute Keying Sets for this Scene");
        RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+       rna_def_scene_keying_sets(brna, prop);
        
        prop= RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
@@ -3096,13 +3134,7 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "All Keying Sets", "All Keying Sets available for use (builtins and Absolute Keying Sets for this Scene)");
        RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
        
-       prop= RNA_def_property(srna, "active_keying_set", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "KeyingSet");
-       RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
-       RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
-       RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
-       
+       /* TODO, move into the collection */
        prop= RNA_def_property(srna, "active_keying_set_index", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
        RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
index 67b8ca057c83b0684319a3846377f1661db927aa..edd932f4ca7414d9e85befae0888511b2248d316 100644 (file)
@@ -1237,6 +1237,45 @@ static void rna_def_window(BlenderRNA *brna)
        RNA_def_property_update(prop, 0, "rna_Window_screen_update");
 }
 
+/* curve.splines */
+static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       //FunctionRNA *func;
+       //PropertyRNA *parm;
+
+       RNA_def_property_srna(cprop, "KeyConfigurations");
+       srna= RNA_def_struct(brna, "KeyConfigurations", NULL);
+       RNA_def_struct_sdna(srna, "wmWindowManager");
+       RNA_def_struct_ui_text(srna, "KeyConfigs", "Collection of KeyConfigs");
+/*
+       func= RNA_def_function(srna, "new", "rna_Curve_spline_new");
+       RNA_def_function_ui_description(func, "Add a new spline to the curve.");
+       parm= RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       parm= RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline.");
+       RNA_def_function_return(func, parm);
+
+       func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
+       RNA_def_function_ui_description(func, "Remove a spline from a curve.");
+       RNA_def_function_flag(func, FUNC_USE_REPORTS);
+       parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+*/
+       prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+       RNA_def_property_struct_type(prop, "KeyConfig");
+       RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", NULL, NULL);
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Active KeyConfig", "Active wm KeyConfig");
+       
+       prop= RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL);
+       RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
+       RNA_def_property_struct_type(prop, "KeyConfig");
+       RNA_def_property_ui_text(prop, "Default Key Configuration", "");
+}
+
 static void rna_def_windowmanager(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -1258,17 +1297,7 @@ static void rna_def_windowmanager(BlenderRNA *brna)
        prop= RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_struct_type(prop, "KeyConfig");
        RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations");
-
-       prop= RNA_def_property(srna, "active_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
-       RNA_def_property_struct_type(prop, "KeyConfig");
-       RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", 0, NULL);
-       RNA_def_property_ui_text(prop, "Active Key Configuration", "");
-
-       prop= RNA_def_property(srna, "default_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
-       RNA_def_property_struct_type(prop, "KeyConfig");
-       RNA_def_property_ui_text(prop, "Default Key Configuration", "");
+       rna_def_wm_keyconfigs(brna, prop);
 
        RNA_api_wm(srna);
 }