diff options
35 files changed, 317 insertions, 164 deletions
diff --git a/release/scripts/io/export_3ds.py b/release/scripts/io/export_3ds.py index 4a5521bd9e9..706e7eb1516 100644 --- a/release/scripts/io/export_3ds.py +++ b/release/scripts/io/export_3ds.py @@ -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 diff --git a/release/scripts/io/export_fbx.py b/release/scripts/io/export_fbx.py index 60e9e90e11b..486f7d8199b 100644 --- a/release/scripts/io/export_fbx.py +++ b/release/scripts/io/export_fbx.py @@ -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(): diff --git a/release/scripts/io/export_obj.py b/release/scripts/io/export_obj.py index 53c4a324ed1..68edc561498 100644 --- a/release/scripts/io/export_obj.py +++ b/release/scripts/io/export_obj.py @@ -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) diff --git a/release/scripts/io/export_ply.py b/release/scripts/io/export_ply.py index 1a4fd7a6ff9..946be68ec41 100644 --- a/release/scripts/io/export_ply.py +++ b/release/scripts/io/export_ply.py @@ -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 diff --git a/release/scripts/io/export_x3d.py b/release/scripts/io/export_x3d.py index aafb7c922a1..c98debd5c60 100644 --- a/release/scripts/io/export_x3d.py +++ b/release/scripts/io/export_x3d.py @@ -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" diff --git a/release/scripts/io/import_scene_3ds.py b/release/scripts/io/import_scene_3ds.py index 6378d93df62..f956f29b0e7 100644 --- a/release/scripts/io/import_scene_3ds.py +++ b/release/scripts/io/import_scene_3ds.py @@ -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 diff --git a/release/scripts/io/import_scene_obj.py b/release/scripts/io/import_scene_obj.py index 655f797750e..f20652a6b0a 100644 --- a/release/scripts/io/import_scene_obj.py +++ b/release/scripts/io/import_scene_obj.py @@ -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. diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py index 56c43c0728c..28f3b226c21 100644 --- a/release/scripts/op/object.py +++ b/release/scripts/op/object.py @@ -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) diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py index 43e2cda5d53..4d15d94f408 100644 --- a/release/scripts/op/presets.py +++ b/release/scripts/op/presets.py @@ -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") diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py index cf3d68787c0..238c11d6e06 100644 --- a/release/scripts/op/uv.py +++ b/release/scripts/op/uv.py @@ -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: diff --git a/release/scripts/op/uvcalc_follow_active.py b/release/scripts/op/uvcalc_follow_active.py index 1f80e704f93..9f809dd39f8 100644 --- a/release/scripts/op/uvcalc_follow_active.py +++ b/release/scripts/op/uvcalc_follow_active.py @@ -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: diff --git a/release/scripts/op/uvcalc_smart_project.py b/release/scripts/op/uvcalc_smart_project.py index 0589b7e861a..c4e19afc810 100644 --- a/release/scripts/op/uvcalc_smart_project.py +++ b/release/scripts/op/uvcalc_smart_project.py @@ -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: diff --git a/release/scripts/presets/interaction/maya.py b/release/scripts/presets/interaction/maya.py index ccd95abf75e..4fcf987c9b2 100644 --- a/release/scripts/presets/interaction/maya.py +++ b/release/scripts/presets/interaction/maya.py @@ -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 diff --git a/release/scripts/templates/operator_uv.py b/release/scripts/templates/operator_uv.py index a18aaf358c8..305496e31ce 100644 --- a/release/scripts/templates/operator_uv.py +++ b/release/scripts/templates/operator_uv.py @@ -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]: diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py index 7de06554751..3931626f0ff 100644 --- a/release/scripts/ui/properties_data_armature.py +++ b/release/scripts/ui/properties_data_armature.py @@ -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) diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py index fd184819143..986d1d2e834 100644 --- a/release/scripts/ui/properties_data_mesh.py +++ b/release/scripts/ui/properties_data_mesh.py @@ -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") diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py index c6b9d7522e0..6e25d793683 100644 --- a/release/scripts/ui/properties_scene.py +++ b/release/scripts/ui/properties_scene.py @@ -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) diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py index fc21292bc5e..06c04814085 100644 --- a/release/scripts/ui/space_image.py +++ b/release/scripts/ui/space_image.py @@ -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 diff --git a/release/scripts/ui/space_outliner.py b/release/scripts/ui/space_outliner.py index e2d8db385f6..11760d7bafe 100644 --- a/release/scripts/ui/space_outliner.py +++ b/release/scripts/ui/space_outliner.py @@ -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') diff --git a/release/scripts/ui/space_time.py b/release/scripts/ui/space_time.py index 7745207341a..40d165a8f49 100644 --- a/release/scripts/ui/space_time.py +++ b/release/scripts/ui/space_time.py @@ -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') diff --git a/release/scripts/ui/space_userpref_keymap.py b/release/scripts/ui/space_userpref_keymap.py index b725ba5139c..f8b23df97a6 100644 --- a/release/scripts/ui/space_userpref_keymap.py +++ b/release/scripts/ui/space_userpref_keymap.py @@ -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) diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index ce4286f01c8..84eb8ef5300 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -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 diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index dcc0a0b876f..1f4b0f303f7 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -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; diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 43c11206bbe..bf809d39fe4 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -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 */ diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index a5c6a3e5a02..d34cca0d358 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -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); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 2d337558f56..edcdedf2a39 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -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; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 377a4d15675..670e89b668f 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -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){ diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index c2918f0faae..cd58ac4a482 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -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; } diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 54ee7db9556..20c9fa5877b 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -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); diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 87a002db828..cec7b1cd33c 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -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"); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 3dc7b8922e7..a6d79a18670 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -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"); diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index 97252ce754e..b0d655e611c 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -37,15 +37,6 @@ #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."); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index ce797f21494..73ed2a3ba50 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -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"); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index f09dd596f4f..442c4b64f91 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -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); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 67b8ca057c8..edd932f4ca7 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -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); } |