From f6c323aa42e94c4750f52940b47a0d57b503c1b9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Aug 2010 22:16:45 +0000 Subject: - move more active properties into their collections: scene.active_keying_set --> scene.keying_sets.active ...same for active_uv_texture. active_vertex_color, active_keyconfig, - move mesh.add_uv_layer() and mesh.add_vertex_color() into their collections also have them return the newly created layer and dont set the layer active. uvtex = mesh.uv_layers.new(name) vcol = mesh.vertex_colors.new(name) --- source/blender/blenkernel/BKE_customdata.h | 2 +- source/blender/blenkernel/intern/customdata.c | 4 +- source/blender/editors/include/ED_mesh.h | 6 +- source/blender/editors/mesh/editmesh_lib.c | 4 +- source/blender/editors/mesh/mesh_data.c | 40 ++++---- source/blender/editors/object/object_vgroup.c | 2 +- source/blender/editors/uvedit/uvedit_ops.c | 2 +- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 2 +- source/blender/makesrna/intern/rna_animation.c | 17 ++-- source/blender/makesrna/intern/rna_mesh.c | 115 +++++++++++++++++++--- source/blender/makesrna/intern/rna_mesh_api.c | 17 ---- source/blender/makesrna/intern/rna_pose.c | 30 ++++-- source/blender/makesrna/intern/rna_scene.c | 46 +++++++-- source/blender/makesrna/intern/rna_wm.c | 51 +++++++--- 14 files changed, 247 insertions(+), 91 deletions(-) (limited to 'source') 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); } -- cgit v1.2.3