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
diff options
context:
space:
mode:
authorXiao Xiangquan <xiaoxiangquan@gmail.com>2011-06-24 07:30:50 +0400
committerXiao Xiangquan <xiaoxiangquan@gmail.com>2011-06-24 07:30:50 +0400
commitb429af10d04d727574eb50a7186e8075ae8fb0b8 (patch)
treedae073488e49cb2a4107d3fe2d553711496bf4f9 /source/blender/makesrna/intern/rna_access.c
parent9a2f36b50f818c0c1b659363a1df298f7043e207 (diff)
merge from trunk #37722
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c82
1 files changed, 75 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 10a837f0d05..391f681a832 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -100,9 +100,7 @@ void RNA_exit(void)
void RNA_struct_gettexted( StructRNA* ptr )
{
- StructRNA* temp_struct;
- PropertyRNA* temp_property;
- PropertyRNA* end_property;
+ PropertyRNA *temp_property, *end_property;
ptr->name = _(ptr->name);
ptr->description = _(ptr->description);
@@ -124,10 +122,6 @@ void RNA_struct_gettexted( StructRNA* ptr )
if( end_property->type == PROP_ENUM )
RNA_enum_items_gettexted( ((EnumPropertyRNA*)end_property)->item );
}
-
- temp_struct = (StructRNA*)ptr->cont.next;
- if( temp_struct!=NULL && temp_struct != &RNA_UnknownType )
- RNA_struct_gettexted( temp_struct );
}
void RNA_types_init_gettext()
@@ -1687,6 +1681,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];
@@ -1883,6 +1914,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];