diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_mesh.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 188 |
1 files changed, 181 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index d6c41fa4368..539fe20c299 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -55,26 +55,26 @@ #include "WM_api.h" #include "WM_types.h" -static void rna_Mesh_update_data(bContext *C, PointerRNA *ptr) +static void rna_Mesh_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; DAG_id_flush_update(id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, id); + WM_main_add_notifier(NC_GEOM|ND_DATA, id); } -static void rna_Mesh_update_select(bContext *C, PointerRNA *ptr) +static void rna_Mesh_update_select(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, id); + WM_main_add_notifier(NC_GEOM|ND_SELECT, id); } -void rna_Mesh_update_draw(bContext *C, PointerRNA *ptr) +void rna_Mesh_update_draw(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; - WM_event_add_notifier(C, NC_GEOM|ND_DATA, id); + WM_main_add_notifier(NC_GEOM|ND_DATA, id); } static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value) @@ -278,6 +278,15 @@ static int rna_CustomDataLayer_active_get(PointerRNA *ptr, int type, int render) else return (n == CustomData_get_active_layer_index(fdata, type)); } +static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, int type, int render) +{ + Mesh *me= (Mesh*)ptr->id.data; + CustomData *fdata= rna_mesh_pdata(me); + int n= ((CustomDataLayer*)ptr->data) - fdata->layers; + + return (n == CustomData_get_clone_layer_index(fdata, type)); +} + static void rna_CustomDataLayer_active_set(PointerRNA *ptr, int value, int type, int render) { Mesh *me= (Mesh*)ptr->id.data; @@ -291,6 +300,18 @@ static void rna_CustomDataLayer_active_set(PointerRNA *ptr, int value, int type, else CustomData_set_layer_active_index(fdata, type, n); } +static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, int value, int type, int render) +{ + Mesh *me= (Mesh*)ptr->id.data; + CustomData *fdata= rna_mesh_pdata(me); + int n= ((CustomDataLayer*)ptr->data) - fdata->layers; + + if(value == 0) + return; + + CustomData_set_layer_clone_index(fdata, type, n); +} + static int rna_uv_texture_check(CollectionPropertyIterator *iter, void *data) { CustomDataLayer *layer= (CustomDataLayer*)data; @@ -319,6 +340,34 @@ static PointerRNA rna_Mesh_active_uv_texture_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl); } +static PointerRNA rna_Mesh_uv_texture_clone_get(PointerRNA *ptr) +{ + PointerRNA pnull = {0,}; +#if 0 + Mesh *me= (Mesh*)ptr->data; + CustomData *fdata= rna_mesh_fdata(me); + int index= CustomData_get_clone_layer_index(fdata, CD_MTFACE); + CustomDataLayer *cdl= (index == -1)? NULL: &fdata->layers[index]; + + return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl); +#endif + return pnull; +} + +static PointerRNA rna_Mesh_uv_texture_stencil_get(PointerRNA *ptr) +{ + PointerRNA pnull = {0,}; +#if 0 + Mesh *me= (Mesh*)ptr->data; + CustomData *fdata= rna_mesh_fdata(me); + int index= CustomData_get_stencil_layer_index(fdata, CD_MTFACE); + CustomDataLayer *cdl= (index == -1)? NULL: &fdata->layers[index]; + + return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl); +#endif + return pnull; +} + static void rna_Mesh_active_uv_texture_set(PointerRNA *ptr, PointerRNA value) { Mesh *me= (Mesh*)ptr->data; @@ -335,6 +384,42 @@ static void rna_Mesh_active_uv_texture_set(PointerRNA *ptr, PointerRNA value) } } +static void rna_Mesh_uv_texture_clone_set(PointerRNA *ptr, PointerRNA value) +{ +#if 0 + Mesh *me= (Mesh*)ptr->data; + CustomData *fdata= rna_mesh_fdata(me); + CustomDataLayer *cdl; + int a; + + for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) { + if(value.data == cdl) { + CustomData_set_layer_clone_index(fdata, CD_MTFACE, a); + return; + } + } +#endif + return NULL; +} + +static void rna_Mesh_uv_texture_stencil_set(PointerRNA *ptr, PointerRNA value) +{ +#if 0 + Mesh *me= (Mesh*)ptr->data; + CustomData *fdata= rna_mesh_fdata(me); + CustomDataLayer *cdl; + int a; + + for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) { + if(value.data == cdl) { + CustomData_set_layer_stencil_index(fdata, CD_MTFACE, a); + return; + } + } +#endif + return NULL; +} + static int rna_Mesh_active_uv_texture_index_get(PointerRNA *ptr) { Mesh *me= (Mesh*)ptr->data; @@ -342,6 +427,20 @@ static int rna_Mesh_active_uv_texture_index_get(PointerRNA *ptr) return CustomData_get_active_layer(fdata, CD_MTEXPOLY); } +static int rna_Mesh_uv_texture_clone_index_get(PointerRNA *ptr) +{ + Mesh *me= (Mesh*)ptr->data; + CustomData *fdata= rna_mesh_pdata(me); + return CustomData_get_clone_layer(fdata, CD_MTEXPOLY); +} + +static int rna_Mesh_uv_texture_stencil_index_get(PointerRNA *ptr) +{ + Mesh *me= (Mesh*)ptr->data; + CustomData *fdata= rna_mesh_pdata(me); + return CustomData_get_stencil_layer(fdata, CD_MTEXPOLY); +} + static void rna_Mesh_active_uv_texture_index_set(PointerRNA *ptr, int value) { Mesh *me= (Mesh*)ptr->data; @@ -351,6 +450,22 @@ static void rna_Mesh_active_uv_texture_index_set(PointerRNA *ptr, int value) mesh_update_customdata_pointers(me); } +static void rna_Mesh_uv_texture_clone_index_set(PointerRNA *ptr, int value) +{ + Mesh *me= (Mesh*)ptr->data; + CustomData *fdata= rna_mesh_pdata(me); + + CustomData_set_layer_clone(fdata, CD_MTEXPOLY, value); +} + +static void rna_Mesh_uv_texture_stencil_index_set(PointerRNA *ptr, int value) +{ + Mesh *me= (Mesh*)ptr->data; + CustomData *fdata= rna_mesh_pdata(me); + + CustomData_set_layer_stencil(fdata, CD_MTEXPOLY, value); +} + static void rna_Mesh_active_uv_texture_index_range(PointerRNA *ptr, int *min, int *max) { Mesh *me= (Mesh*)ptr->data; @@ -443,6 +558,11 @@ static int rna_MeshTextureFaceLayer_active_get(PointerRNA *ptr) return rna_CustomDataLayer_active_get(ptr, CD_MTEXPOLY, 0); } +static int rna_MeshTextureFaceLayer_clone_get(PointerRNA *ptr) +{ + return rna_CustomDataLayer_clone_get(ptr, CD_MTFACE, 0); +} + static void rna_MeshTextureFaceLayer_active_render_set(PointerRNA *ptr, int value) { rna_CustomDataLayer_active_set(ptr, value, CD_MTEXPOLY, 1); @@ -453,6 +573,11 @@ static void rna_MeshTextureFaceLayer_active_set(PointerRNA *ptr, int value) rna_CustomDataLayer_active_set(ptr, value, CD_MTEXPOLY, 0); } +static void rna_MeshTextureFaceLayer_clone_set(PointerRNA *ptr, int value) +{ + rna_CustomDataLayer_clone_set(ptr, value, CD_MTFACE, 0); +} + static void rna_MeshTextureFaceLayer_name_set(PointerRNA *ptr, const char *value) { Mesh *me= (Mesh*)ptr->id.data; @@ -1076,6 +1201,12 @@ static void rna_def_mtexpoly(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); + prop= RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0); + RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_clone_get", "rna_MeshTextureFaceLayer_clone_set"); + RNA_def_property_ui_text(prop, "Active Clone", "Sets the layer as active for cloning"); + RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); + prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshTextureFace"); RNA_def_property_ui_text(prop, "Data", ""); @@ -1357,6 +1488,27 @@ void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable) RNA_def_property_ui_text(prop, "Materials", ""); } + +/* scene.objects */ +static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + +// FunctionRNA *func; +// PropertyRNA *parm; + + RNA_def_property_srna(cprop, "MeshFaces"); + srna= RNA_def_struct(brna, "MeshFaces", NULL); + RNA_def_struct_sdna(srna, "Mesh"); + RNA_def_struct_ui_text(srna, "Mesh Faces", "Collection of mesh faces."); + + prop= RNA_def_property(srna, "active", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "act_face"); + RNA_def_property_ui_text(prop, "Active Face", "The active face for this mesh"); +} + + static void rna_def_mesh(BlenderRNA *brna) { StructRNA *srna; @@ -1380,6 +1532,7 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "mface", "totface"); RNA_def_property_struct_type(prop, "MeshFace"); RNA_def_property_ui_text(prop, "Faces", "Faces of the mesh."); + rna_def_mesh_faces(brna, prop); prop= RNA_def_property(srna, "sticky", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "msticky", "totvert"); @@ -1411,6 +1564,26 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Active UV Texture Index", "Active UV texture index."); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); + prop= RNA_def_property(srna, "uv_texture_clone", PROP_POINTER, PROP_UNSIGNED); + RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); + RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_clone_get", "rna_Mesh_uv_texture_clone_set", NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Clone UV Texture", "UV texture to be used as cloning source."); + + prop= RNA_def_property(srna, "uv_texture_clone_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get", "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_active_uv_texture_index_range"); + RNA_def_property_ui_text(prop, "Clone UV Texture Index", "Clone UV texture index."); + + prop= RNA_def_property(srna, "uv_texture_stencil", PROP_POINTER, PROP_UNSIGNED); + RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); + RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_stencil_get", "rna_Mesh_uv_texture_stencil_set", NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Mask UV Texture", "UV texture to mask the painted area."); + + prop= RNA_def_property(srna, "uv_texture_stencil_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_stencil_index_get", "rna_Mesh_uv_texture_stencil_index_set", "rna_Mesh_active_uv_texture_index_range"); + RNA_def_property_ui_text(prop, "Mask UV Texture Index", "Mask UV texture index."); + /* Vertex colors */ prop= RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE); @@ -1559,7 +1732,8 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_MASK); RNA_def_property_ui_text(prop, "Paint Mask", "Face selection masking for painting"); - + RNA_def_property_ui_icon(prop, ICON_FACESEL_HLT, 0); + RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); rna_def_texmat_common(srna, "rna_Mesh_texspace_editable"); |