diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-02-05 04:12:47 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-02-05 04:12:47 +0300 |
commit | 66f90c47d4400f6a549f8fbb05a7f71dc1cca6f9 (patch) | |
tree | ed9e80b5f87b1564f2bd133658e581ae046045ea /source/blender/makesrna | |
parent | 5fc657cdc614334c9c4c29910f06ebe1a286947b (diff) |
* Added range function for Multires's level RNA
* Removed RNA for old multires in Mesh, the old mesh->mr struct should never be used (except for loading old files)
* Dealt with sculpt + render (just needed to force multires update)
* sculpt memory leaks fixed
* Entering editmode now always exits paint modes (previously, only happened if editmode was called from the header button)
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 42 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 35 |
2 files changed, 25 insertions, 52 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 569febd4af1..46a2fcf998a 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -172,13 +172,6 @@ static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, Pointe rna_iterator_array_begin(iter, NULL, 0, 0, NULL); } -static void rna_MeshMultires_level_range(PointerRNA *ptr, int *min, int *max) -{ - Multires *mr= (Multires*)ptr->data; - *min= 1; - *max= mr->level_count; -} - static void rna_MeshFace_material_index_range(PointerRNA *ptr, int *min, int *max) { Mesh *me= (Mesh*)ptr->id.data; @@ -871,36 +864,6 @@ static void rna_def_mproperties(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Value", ""); } -static void rna_def_mmultires(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna= RNA_def_struct(brna, "MeshMultires", NULL); - RNA_def_struct_sdna(srna, "Multires"); - RNA_def_struct_ui_text(srna, "Mesh Multires", "Multiresolution mesh levels data in a Mesh datablock."); - - prop= RNA_def_property(srna, "level", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "newlvl"); - RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshMultires_level_range"); - RNA_def_property_ui_text(prop, "Level", ""); - - prop= RNA_def_property(srna, "edge_level", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "edgelvl"); - RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshMultires_level_range"); - RNA_def_property_ui_text(prop, "Edge Level", ""); - - prop= RNA_def_property(srna, "pin_level", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "pinlvl"); - RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshMultires_level_range"); - RNA_def_property_ui_text(prop, "Pin Level", "Set level to apply modifiers to during render."); - - prop= RNA_def_property(srna, "render_level", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "renderlvl"); - RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshMultires_level_range"); - RNA_def_property_ui_text(prop, "Render Level", "Set level to render."); -} - void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable) { PropertyRNA *prop; @@ -1013,10 +976,6 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "texcomesh"); RNA_def_property_ui_text(prop, "Texture Space Mesh", "Derive texture coordinates from another mesh"); - prop= RNA_def_property(srna, "multires", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "mr"); - RNA_def_property_ui_text(prop, "Multires", ""); - prop= RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "key"); RNA_def_property_ui_text(prop, "Shape Keys", ""); @@ -1035,7 +994,6 @@ void RNA_def_mesh(BlenderRNA *brna) rna_def_msticky(brna); rna_def_mcol(brna); rna_def_mproperties(brna); - rna_def_mmultires(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 5259ee41d73..0284d428939 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -232,9 +232,17 @@ static void rna_WaveModifier_uvlayer_set(PointerRNA *ptr, const char *value) rna_object_uvlayer_name_set(ptr, value, wmd->uvlayer_name, sizeof(wmd->uvlayer_name)); } +static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max) +{ + MultiresModifierData *mmd = (MultiresModifierData*)ptr->data; + + *min = 1; + *max = mmd->totlvl; +} + #else -static void rna_def_property_subdivision_common(StructRNA *srna, const char type[], const char level[]) +static void rna_def_property_subdivision_common(StructRNA *srna, const char type[]) { static EnumPropertyItem prop_subdivision_type_items[] = { {0, "CATMULL_CLARK", "Catmull-Clark", ""}, @@ -245,13 +253,6 @@ static void rna_def_property_subdivision_common(StructRNA *srna, const char type RNA_def_property_enum_sdna(prop, NULL, type); RNA_def_property_enum_items(prop, prop_subdivision_type_items); RNA_def_property_ui_text(prop, "Subdivision Type", "Selects type of subdivision algorithm."); - - prop= RNA_def_property(srna, "levels", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, level); - RNA_def_property_range(prop, 1, 20); - RNA_def_property_ui_range(prop, 1, 6, 1, 0); - RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform."); - RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); } static void rna_def_modifier_subsurf(BlenderRNA *brna) @@ -263,7 +264,14 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Subsurf Modifier", "Subdivision surface modifier."); RNA_def_struct_sdna(srna, "SubsurfModifierData"); - rna_def_property_subdivision_common(srna, "subdivType", "levels"); + rna_def_property_subdivision_common(srna, "subdivType"); + + prop= RNA_def_property(srna, "levels", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "levels"); + RNA_def_property_range(prop, 1, 20); + RNA_def_property_ui_range(prop, 1, 6, 1, 0); + RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform."); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); prop= RNA_def_property(srna, "render_levels", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "renderLevels"); @@ -285,12 +293,19 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna) static void rna_def_modifier_multires(BlenderRNA *brna) { StructRNA *srna; + PropertyRNA *prop; srna= RNA_def_struct(brna, "MultiresModifier", "Modifier"); RNA_def_struct_ui_text(srna, "Multires Modifier", "Multiresolution mesh modifier."); RNA_def_struct_sdna(srna, "MultiresModifierData"); - rna_def_property_subdivision_common(srna, "simple", "lvl"); + rna_def_property_subdivision_common(srna, "simple"); + + prop= RNA_def_property(srna, "levels", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "lvl"); + RNA_def_property_ui_text(prop, "Levels", ""); + RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); } static void rna_def_modifier_lattice(BlenderRNA *brna) |