Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_modifier.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 963 Lines • ▼ Show 20 Lines | switch (fmd->type) { | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| /* update dependency since a domain - other type switch could have happened */ | /* update dependency since a domain - other type switch could have happened */ | ||||
| rna_Modifier_dependency_update(bmain, scene, ptr); | rna_Modifier_dependency_update(bmain, scene, ptr); | ||||
| } | } | ||||
| static void rna_MultiresModifier_type_set(PointerRNA *ptr, int value) | |||||
| { | |||||
| Object *ob = (Object *)ptr->owner_id; | |||||
| MultiresModifierData *mmd = (MultiresModifierData *)ptr->data; | |||||
| multires_force_sculpt_rebuild(ob); | |||||
| mmd->simple = value; | |||||
| } | |||||
| static void rna_MultiresModifier_level_range( | static void rna_MultiresModifier_level_range( | ||||
| PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) | PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) | ||||
| { | { | ||||
| MultiresModifierData *mmd = (MultiresModifierData *)ptr->data; | MultiresModifierData *mmd = (MultiresModifierData *)ptr->data; | ||||
| *min = 0; | *min = 0; | ||||
| *max = max_ii(0, mmd->totlvl); /* intentionally _not_ -1 */ | *max = max_ii(0, mmd->totlvl); /* intentionally _not_ -1 */ | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 610 Lines • ▼ Show 20 Lines | |||||
| # else | # else | ||||
| return false; | return false; | ||||
| UNUSED_VARS(ptr); | UNUSED_VARS(ptr); | ||||
| # endif | # endif | ||||
| } | } | ||||
| #else | #else | ||||
| /* NOTE: *MUST* return subdivision_type property. */ | static void rna_def_property_subdivision_common(StructRNA *srna) | ||||
| static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const char type[]) | |||||
| { | { | ||||
| static const EnumPropertyItem prop_subdivision_type_items[] = { | |||||
| {SUBSURF_TYPE_CATMULL_CLARK, "CATMULL_CLARK", 0, "Catmull-Clark", ""}, | |||||
| {SUBSURF_TYPE_SIMPLE, "SIMPLE", 0, "Simple", ""}, | |||||
| {0, NULL, 0, NULL, NULL}, | |||||
| }; | |||||
| static const EnumPropertyItem prop_uv_smooth_items[] = { | static const EnumPropertyItem prop_uv_smooth_items[] = { | ||||
| {SUBSURF_UV_SMOOTH_NONE, "NONE", 0, "None", "UVs are not smoothed, boundaries are kept sharp"}, | {SUBSURF_UV_SMOOTH_NONE, "NONE", 0, "None", "UVs are not smoothed, boundaries are kept sharp"}, | ||||
| {SUBSURF_UV_SMOOTH_PRESERVE_CORNERS, | {SUBSURF_UV_SMOOTH_PRESERVE_CORNERS, | ||||
| "PRESERVE_CORNERS", | "PRESERVE_CORNERS", | ||||
| 0, | 0, | ||||
| "Keep Corners", | "Keep Corners", | ||||
| "UVs are smoothed, corners on discontinuous boundary are kept sharp"}, | "UVs are smoothed, corners on discontinuous boundary are kept sharp"}, | ||||
| # if 0 | # if 0 | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | # endif | ||||
| RNA_def_property_update(prop, 0, "rna_Modifier_update"); | RNA_def_property_update(prop, 0, "rna_Modifier_update"); | ||||
| prop = RNA_def_property(srna, "boundary_smooth", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "boundary_smooth", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "boundary_smooth"); | RNA_def_property_enum_sdna(prop, NULL, "boundary_smooth"); | ||||
| RNA_def_property_enum_items(prop, prop_boundary_smooth_items); | RNA_def_property_enum_items(prop, prop_boundary_smooth_items); | ||||
| RNA_def_property_ui_text(prop, "Boundary Smooth", "Controls how open boundaries are smoothed"); | RNA_def_property_ui_text(prop, "Boundary Smooth", "Controls how open boundaries are smoothed"); | ||||
| RNA_def_property_update(prop, 0, "rna_Modifier_update"); | RNA_def_property_update(prop, 0, "rna_Modifier_update"); | ||||
| prop = RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE); | |||||
| 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", "Select type of subdivision algorithm"); | |||||
| RNA_def_property_update(prop, 0, "rna_Modifier_update"); | |||||
| RNA_define_lib_overridable(false); | RNA_define_lib_overridable(false); | ||||
| return prop; | |||||
| } | } | ||||
| static void rna_def_modifier_subsurf(BlenderRNA *brna) | static void rna_def_modifier_subsurf(BlenderRNA *brna) | ||||
| { | { | ||||
| static const EnumPropertyItem prop_subdivision_type_items[] = { | |||||
| {SUBSURF_TYPE_CATMULL_CLARK, "CATMULL_CLARK", 0, "Catmull-Clark", ""}, | |||||
| {SUBSURF_TYPE_SIMPLE, "SIMPLE", 0, "Simple", ""}, | |||||
| {0, NULL, 0, NULL, NULL}, | |||||
| }; | |||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| srna = RNA_def_struct(brna, "SubsurfModifier", "Modifier"); | srna = RNA_def_struct(brna, "SubsurfModifier", "Modifier"); | ||||
| RNA_def_struct_ui_text(srna, "Subdivision Surface Modifier", "Subdivision surface modifier"); | RNA_def_struct_ui_text(srna, "Subdivision Surface Modifier", "Subdivision surface modifier"); | ||||
| RNA_def_struct_sdna(srna, "SubsurfModifierData"); | RNA_def_struct_sdna(srna, "SubsurfModifierData"); | ||||
| RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF); | RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF); | ||||
| rna_def_property_subdivision_common(srna, "subdivType"); | rna_def_property_subdivision_common(srna); | ||||
| RNA_define_lib_overridable(true); | RNA_define_lib_overridable(true); | ||||
| prop = RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_sdna(prop, NULL, "subdivType"); | |||||
| RNA_def_property_enum_items(prop, prop_subdivision_type_items); | |||||
| RNA_def_property_ui_text(prop, "Subdivision Type", "Select type of subdivision algorithm"); | |||||
| RNA_def_property_update(prop, 0, "rna_Modifier_update"); | |||||
| /* see CCGSUBSURF_LEVEL_MAX for max limit */ | /* see CCGSUBSURF_LEVEL_MAX for max limit */ | ||||
| prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED); | prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED); | ||||
| RNA_def_property_int_sdna(prop, NULL, "levels"); | RNA_def_property_int_sdna(prop, NULL, "levels"); | ||||
| RNA_def_property_range(prop, 0, 11); | RNA_def_property_range(prop, 0, 11); | ||||
| RNA_def_property_ui_range(prop, 0, 6, 1, -1); | RNA_def_property_ui_range(prop, 0, 6, 1, -1); | ||||
| RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform"); | RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform"); | ||||
| RNA_def_property_update(prop, 0, "rna_Modifier_update"); | RNA_def_property_update(prop, 0, "rna_Modifier_update"); | ||||
| ▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | static void rna_def_modifier_multires(BlenderRNA *brna) | ||||
| srna = RNA_def_struct(brna, "MultiresModifier", "Modifier"); | srna = RNA_def_struct(brna, "MultiresModifier", "Modifier"); | ||||
| RNA_def_struct_ui_text(srna, "Multires Modifier", "Multiresolution mesh modifier"); | RNA_def_struct_ui_text(srna, "Multires Modifier", "Multiresolution mesh modifier"); | ||||
| RNA_def_struct_sdna(srna, "MultiresModifierData"); | RNA_def_struct_sdna(srna, "MultiresModifierData"); | ||||
| RNA_def_struct_ui_icon(srna, ICON_MOD_MULTIRES); | RNA_def_struct_ui_icon(srna, ICON_MOD_MULTIRES); | ||||
| RNA_define_lib_overridable(true); | RNA_define_lib_overridable(true); | ||||
| prop = rna_def_property_subdivision_common(srna, "simple"); | rna_def_property_subdivision_common(srna); | ||||
| RNA_def_property_enum_funcs(prop, NULL, "rna_MultiresModifier_type_set", NULL); | |||||
| prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED); | prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED); | ||||
| RNA_def_property_int_sdna(prop, NULL, "lvl"); | RNA_def_property_int_sdna(prop, NULL, "lvl"); | ||||
| RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to use in the viewport"); | RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to use in the viewport"); | ||||
| RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range"); | RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range"); | ||||
| RNA_def_property_update(prop, 0, "rna_Modifier_update"); | RNA_def_property_update(prop, 0, "rna_Modifier_update"); | ||||
| prop = RNA_def_property(srna, "sculpt_levels", PROP_INT, PROP_UNSIGNED); | prop = RNA_def_property(srna, "sculpt_levels", PROP_INT, PROP_UNSIGNED); | ||||
| ▲ Show 20 Lines • Show All 5,395 Lines • Show Last 20 Lines | |||||