Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2011-06-23 11:14:37 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-06-23 11:14:37 +0400
commit2afa7e4944cd9efcf728f58360adc68343320755 (patch)
tree9c3b88a98a54e82ea4a4d902e3c645351ca09a4e /source
parent5021dd3476012b1c64a5ffaa7986537d1e263245 (diff)
parent53bf66a579789ad32e2e7c4bd15dca9863ba7e2d (diff)
Merge with trunk r 37746.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_file/file_ops.c2
-rw-r--r--source/blender/makesrna/intern/makesrna.c39
-rw-r--r--source/blender/makesrna/intern/rna_access.c4
-rw-r--r--source/blender/makesrna/intern/rna_curve.c2
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c1
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c3
-rw-r--r--source/blender/makesrna/intern/rna_object.c9
-rw-r--r--source/blender/makesrna/intern/rna_space.c2
-rw-r--r--source/creator/CMakeLists.txt10
9 files changed, 58 insertions, 14 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 11e7040d4c9..77524c7e117 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1279,7 +1279,7 @@ void FILE_OT_filenum(struct wmOperatorType *ot)
ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
/* props */
- RNA_def_int(ot->srna, "increment", 1, 0, 100, "Increment", "", 0,100);
+ RNA_def_int(ot->srna, "increment", 1, -100, 100, "Increment", "", -100,100);
}
static int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index f3f539feb99..2c62316780d 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;
}
}
@@ -762,6 +791,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
}
else {
rna_print_data_get(f, dp);
+ rna_clamp_value_range(f, prop);
if(prop->flag & PROP_DYNAMIC) {
char *lenfunc= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set_length");
@@ -833,6 +863,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 a632c5c646e..d2742f421f3 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;
@@ -1825,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)
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 8000427cb21..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)
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/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index afea07b5076..04f1f359ce6 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -340,13 +340,13 @@ if(UNIX AND NOT APPLE)
install(
FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
- DESTINATION ${TARGETDIR_VER}/config
+ DESTINATION ${TARGETDIR_VER}
)
if(WITH_INTERNATIONAL)
install(
FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
- DESTINATION ${TARGETDIR_VER}/config
+ DESTINATION ${TARGETDIR_VER}
)
install(
@@ -416,13 +416,13 @@ elseif(WIN32)
install( # same as linux!, deduplicate
FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
- DESTINATION ${TARGETDIR_VER}/config
+ DESTINATION ${TARGETDIR_VER}
)
if(WITH_INTERNATIONAL) # same as linux!, deduplicate
install(
FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
- DESTINATION ${TARGETDIR_VER}/config
+ DESTINATION ${TARGETDIR_VER}
)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
@@ -647,7 +647,7 @@ elseif(APPLE)
install(
FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
- DESTINATION ${TARGETDIR_VER}/datafiles
+ DESTINATION ${TARGETDIR_VER}
)
# localization