diff options
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/CMakeLists.txt | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 40 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 78 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 29 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 18 |
11 files changed, 177 insertions, 24 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index c2d361d0ee9..7744e1311b9 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -172,13 +172,17 @@ if(WITH_IMAGE_HDR) add_definitions(-DWITH_HDR) endif() +if(WITH_AUDASPACE) + add_definitions(-DWITH_AUDASPACE) +endif() + if(WITH_CODEC_QUICKTIME) list(APPEND INC ../../quicktime) add_definitions(-DWITH_QUICKTIME) endif() if(WITH_CODEC_FFMPEG) - list(APPEND INC_SYS ${FFMPEG_INC}) + list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS}) add_definitions(-DWITH_FFMPEG) endif() diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 052a87b93fb..d5fff1e88ad 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -644,6 +644,25 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr return func; } +/* defined min/max variables to be used by rna_clamp_value() */ +static void rna_clamp_value_range(FILE *f, PropertyRNA *prop) +{ + if(prop->type == PROP_FLOAT) { + FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; + if(fprop->range) { + fprintf(f, " float prop_clamp_min, prop_clamp_max;\n"); + fprintf(f, " %s(ptr, &prop_clamp_min, &prop_clamp_max);\n", rna_function_string(fprop->range)); + } + } + else if(prop->type == PROP_INT) { + IntPropertyRNA *iprop= (IntPropertyRNA*)prop; + if(iprop->range) { + fprintf(f, " int prop_clamp_min, prop_clamp_max;\n"); + fprintf(f, " %s(ptr, &prop_clamp_min, &prop_clamp_max);\n", rna_function_string(iprop->range)); + } + } +} + static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array) { if(prop->type == PROP_INT) { @@ -652,8 +671,13 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array) if(iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX) { if(array) fprintf(f, "CLAMPIS(values[i], "); else fprintf(f, "CLAMPIS(value, "); - rna_int_print(f, iprop->hardmin); fprintf(f, ", "); - rna_int_print(f, iprop->hardmax); fprintf(f, ");\n"); + if(iprop->range) { + fprintf(f, "prop_clamp_min, prop_clamp_max);"); + } + else { + rna_int_print(f, iprop->hardmin); fprintf(f, ", "); + rna_int_print(f, iprop->hardmax); fprintf(f, ");\n"); + } return; } } @@ -663,8 +687,13 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array) if(fprop->hardmin != -FLT_MAX || fprop->hardmax != FLT_MAX) { if(array) fprintf(f, "CLAMPIS(values[i], "); else fprintf(f, "CLAMPIS(value, "); - rna_float_print(f, fprop->hardmin); fprintf(f, ", "); - rna_float_print(f, fprop->hardmax); fprintf(f, ");\n"); + if(fprop->range) { + fprintf(f, "prop_clamp_min, prop_clamp_max);"); + } + else { + rna_float_print(f, fprop->hardmin); fprintf(f, ", "); + rna_float_print(f, fprop->hardmax); fprintf(f, ");\n"); + } return; } } @@ -767,11 +796,13 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr char *lenfunc= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set_length"); fprintf(f, " int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n"); fprintf(f, " int len= %s(ptr, arraylen);\n\n", lenfunc); + rna_clamp_value_range(f, prop); fprintf(f, " for(i=0; i<len; i++) {\n"); MEM_freeN(lenfunc); } else { fprintf(f, " int i;\n\n"); + rna_clamp_value_range(f, prop); fprintf(f, " for(i=0; i<%d; i++) {\n", prop->totarraylength); } @@ -833,6 +864,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr fprintf(f, " data->%s |= value;\n", dp->dnaname); } else { + rna_clamp_value_range(f, prop); fprintf(f, " data->%s= %s", dp->dnaname, (dp->booleannegative)? "!": ""); rna_clamp_value(f, prop, 0); } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index ab11f88e0f6..e83161b8c62 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1603,6 +1603,8 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); + /* useful to check on bad values but set function should clamp */ + /* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */ if((idprop=rna_idproperty_check(&prop, ptr))) IDP_Int(idprop)= value; @@ -1643,6 +1645,43 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) memset(values, 0, sizeof(int)*prop->totarraylength); } +void RNA_property_int_get_array_range(PointerRNA *ptr, PropertyRNA *prop, int values[2]) +{ + const int array_len= RNA_property_array_length(ptr, prop); + + if(array_len <= 0) { + values[0]= 0; + values[1]= 0; + } + else if (array_len == 1) { + RNA_property_int_get_array(ptr, prop, values); + values[1]= values[0]; + } + else { + int arr_stack[32]; + int *arr; + int i; + + if(array_len > 32) { + arr= MEM_mallocN(sizeof(int) * array_len, "RNA_property_int_get_array_range"); + } + else { + arr= arr_stack; + } + + RNA_property_int_get_array(ptr, prop, arr); + values[0]= values[1]= arr[0]; + for(i= 1; i < array_len; i++) { + values[0]= MIN2(values[0], arr[i]); + values[1]= MAX2(values[1], arr[i]); + } + + if(arr != arr_stack) { + MEM_freeN(arr); + } + } +} + int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) { int tmp[RNA_MAX_ARRAY_LENGTH]; @@ -1788,6 +1827,8 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + /* useful to check on bad values but set function should clamp */ + /* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */ if((idprop=rna_idproperty_check(&prop, ptr))) { if(idprop->type == IDP_FLOAT) @@ -1839,6 +1880,43 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val memset(values, 0, sizeof(float)*prop->totarraylength); } +void RNA_property_float_get_array_range(PointerRNA *ptr, PropertyRNA *prop, float values[2]) +{ + const int array_len= RNA_property_array_length(ptr, prop); + + if(array_len <= 0) { + values[0]= 0.0f; + values[1]= 0.0f; + } + else if (array_len == 1) { + RNA_property_float_get_array(ptr, prop, values); + values[1]= values[0]; + } + else { + float arr_stack[32]; + float *arr; + int i; + + if(array_len > 32) { + arr= MEM_mallocN(sizeof(float) * array_len, "RNA_property_float_get_array_range"); + } + else { + arr= arr_stack; + } + + RNA_property_float_get_array(ptr, prop, arr); + values[0]= values[1]= arr[0]; + for(i= 1; i < array_len; i++) { + values[0]= MIN2(values[0], arr[i]); + values[1]= MAX2(values[1], arr[i]); + } + + if(arr != arr_stack) { + MEM_freeN(arr); + } + } +} + float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) { float tmp[RNA_MAX_ARRAY_LENGTH]; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index df9071d7825..594295ba817 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -233,6 +233,7 @@ static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max) Curve *cu= (Curve*)ptr->id.data; *min= 0; *max= cu->totcol-1; + *max= MAX2(0, *max); } static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int *max) @@ -240,6 +241,7 @@ static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int Curve *cu= (Curve*)ptr->id.data; *min= 0; *max= cu->totbox-1; + *max= MAX2(0, *max); } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 479e449958b..80c98e8c428 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -305,6 +305,7 @@ static void rna_MeshFace_material_index_range(PointerRNA *ptr, int *min, int *ma Mesh *me= (Mesh*)ptr->id.data; *min= 0; *max= me->totcol-1; + *max= MAX2(0, *max); } static CustomData *rna_mesh_fdata(Mesh *me) diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index ff277b6d9b0..d2c1b862fee 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -404,7 +404,8 @@ static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max MultiresModifierData *mmd = (MultiresModifierData*)ptr->data; *min = 0; - *max = mmd->totlvl; + *max = mmd->totlvl; /* intentionally _not_ -1 */ + *max= MAX2(0, *max); } static int rna_MultiresModifier_external_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 8ee8652e2e5..6b925b42e06 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1024,8 +1024,13 @@ static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, i Key *key= ob_get_key(ob); *min= 0; - *max= (key)? BLI_countlist(&key->block)-1: 0; - *max= MAX2(0, *max); + if(key) { + *max= BLI_countlist(&key->block)-1; + if(*max < 0) *max= 0; + } + else { + *max= 0; + } } static int rna_Object_active_shape_key_index_get(PointerRNA *ptr) @@ -1826,7 +1831,6 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "par1"); RNA_def_property_array(prop, 3); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in cases of a vertex parenting relation"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 4913e98a0af..30fce5716a9 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1757,11 +1757,6 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames"); RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update"); - prop= RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK); - RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis"); - RNA_def_property_update(prop, 0, "rna_Particle_redo"); - prop= RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT); RNA_def_property_ui_text(prop, "Parents", "Render parent particles"); @@ -1910,6 +1905,11 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); /* billboards */ + prop= RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK); + RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + prop= RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "bb_align"); RNA_def_property_enum_items(prop, bb_align_items); @@ -1958,6 +1958,25 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Billboard Offset", ""); RNA_def_property_update(prop, 0, "rna_Particle_redo"); + prop= RNA_def_property(srna, "billboard_size", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "bb_size"); + RNA_def_property_array(prop, 2); + RNA_def_property_range(prop, 0.001f, 10.0f); + RNA_def_property_ui_text(prop, "Billboard Scale", "Scale billboards relative to particle size"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + + prop= RNA_def_property(srna, "billboard_velocity_head", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "bb_vel_head"); + RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_ui_text(prop, "Billboard Velocity Head", "Scale billboards by velocity"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + + prop= RNA_def_property(srna, "billboard_velocity_tail", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "bb_vel_tail"); + RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_ui_text(prop, "Billboard Velocity Tail", "Scale billboards by velocity"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + /* simplification */ prop= RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_ENABLE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index f15f3093a86..3416f478315 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -46,7 +46,9 @@ #ifdef WITH_QUICKTIME #include "quicktime_export.h" -#include "AUD_C-API.h" +# ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +# endif #endif #ifdef WITH_FFMPEG @@ -1219,7 +1221,13 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Project Individual Elements", "Project individual elements on the surface of other objects"); RNA_def_property_ui_icon(prop, ICON_RETOPO, 0); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ - + + prop= RNA_def_property(srna, "use_snap_project_self", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT_NO_SELF); + RNA_def_property_ui_text(prop, "Project to Self", "Project into its self (editmode)"); + RNA_def_property_ui_icon(prop, ICON_ORTHO, 0); + RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ + /* Grease Pencil */ prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 8ab480df425..f4753e2efbe 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -700,7 +700,7 @@ static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *m ConsoleLine *ci= (ConsoleLine*)ptr->data; *min= 0; - *max= ci->len; + *max= ci->len; /* intentionally _not_ -1 */ } /* Space Dopesheet */ diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index cf371fbf9bc..4d1e1f175f2 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -361,36 +361,37 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna) RNA_def_struct_sdna(srna, "uiStyle"); RNA_def_struct_ui_text(srna, "Style", "Theme settings for style sets"); + /* (not used yet) prop= RNA_def_property(srna, "panelzoom", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.5, 2.0); RNA_def_property_ui_text(prop, "Panel Zoom", "Default zoom level for panel areas"); - + */ prop= RNA_def_property(srna, "panel_title", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "paneltitle"); RNA_def_property_struct_type(prop, "ThemeFontStyle"); - RNA_def_property_ui_text(prop, "Panel Font", ""); + RNA_def_property_ui_text(prop, "Panel Style", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - +/* (not used yet) prop= RNA_def_property(srna, "group_label", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "grouplabel"); RNA_def_property_struct_type(prop, "ThemeFontStyle"); RNA_def_property_ui_text(prop, "Group Label Font", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - +*/ prop= RNA_def_property(srna, "widget_label", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "widgetlabel"); RNA_def_property_struct_type(prop, "ThemeFontStyle"); - RNA_def_property_ui_text(prop, "Widget Label Font", ""); + RNA_def_property_ui_text(prop, "Widget Label Style", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "widget", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "widget"); RNA_def_property_struct_type(prop, "ThemeFontStyle"); - RNA_def_property_ui_text(prop, "Widget Font", ""); + RNA_def_property_ui_text(prop, "Widget Style", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); } @@ -2115,19 +2116,22 @@ static void rna_def_userdef_view(BlenderRNA *brna) prop= RNA_def_property(srna, "manipulator_size", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "tw_size"); RNA_def_property_range(prop, 2, 40); + RNA_def_property_int_default(prop, 15); RNA_def_property_ui_text(prop, "Manipulator Size", "Diameter of widget, in 10 pixel units"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "manipulator_handle_size", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "tw_handlesize"); RNA_def_property_range(prop, 2, 40); + RNA_def_property_int_default(prop, 25); RNA_def_property_ui_text(prop, "Manipulator Handle Size", "Size of widget handles as percentage of widget radius"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "manipulator_hotspot", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "tw_hotspot"); RNA_def_property_range(prop, 4, 40); - RNA_def_property_ui_text(prop, "Manipulator Hotspot", "Hotspot in pixels for clicking widget handles"); + RNA_def_property_int_default(prop, 14); + RNA_def_property_ui_text(prop, "Manipulator Hotspot", "Pixel distance around the handles to accept mouse clicks"); prop= RNA_def_property(srna, "object_origin_size", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "obcenter_dia"); |