diff options
author | Joseph Eagar <joeedh@gmail.com> | 2011-04-15 05:19:13 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2011-04-15 05:19:13 +0400 |
commit | c98148a963d37fc2f25e125afeb4cf21df6fbf14 (patch) | |
tree | 691a051e27f08e35bf09d35b6fb9c88e4c37b8d2 /source/blender/makesrna/intern | |
parent | 0bba684d08952d0be822f3906ffb2a03b2674cc2 (diff) | |
parent | fa63c297753636c149fbb1a3877d9b3d93601357 (diff) |
=bmesh= merge from trunk at r36153
Diffstat (limited to 'source/blender/makesrna/intern')
81 files changed, 1487 insertions, 496 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 0b54d181a78..62e1e018fc9 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -125,6 +125,10 @@ if(WITH_JACK) add_definitions(-DWITH_JACK) endif() +if(WITH_OPENCOLLADA) + add_definitions(-DWITH_COLLADA) +endif() + # Build makesrna executable blender_include_dirs( . @@ -141,10 +145,10 @@ blender_include_dirs( ../../windowmanager ../../editors/include ../../render/extern/include - ../../../../extern/glew/include ../../../../intern/audaspace/intern ../../../../intern/guardedalloc ../../../../intern/memutil + ${GLEW_INCLUDE_PATH} ) add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC}) diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 998acc3c228..3c76fbf1edb 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -34,6 +34,7 @@ incs += ' ../../imbuf ../../makesdna ../../makesrna ../../ikplugin' incs += ' ../../windowmanager ../../editors/include ../../blenfont' incs += ' ../../render/extern/include ../../bmesh' incs += ' #/intern/audaspace/intern ' +incs += ' #/extern/glew/include ' if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') @@ -88,6 +89,9 @@ if env['BF_UNIT_TEST']: if env['WITH_BF_PYTHON']: defs.append('WITH_PYTHON') +if env['WITH_BF_COLLADA']: + defs.append('WITH_COLLADA') + if env['OURPLATFORM'] == 'linux2': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 247b87d7bc4..d4bb3957d70 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/makesrna.c + * \ingroup RNA + */ + + #include <float.h> #include <limits.h> #include <stdio.h> @@ -1772,6 +1777,7 @@ static const char *rna_property_subtypename(PropertySubType type) case PROP_ACCELERATION: return "PROP_ACCELERATION"; case PROP_XYZ: return "PROP_XYZ"; case PROP_COLOR_GAMMA: return "PROP_COLOR_GAMMA"; + case PROP_COORDS: return "PROP_COORDS"; case PROP_LAYER: return "PROP_LAYER"; case PROP_LAYER_MEMBER: return "PROP_LAYER_MEMBER"; default: { @@ -1786,7 +1792,7 @@ static const char *rna_property_subtypename(PropertySubType type) } } -static const char *rna_property_subtype_unit(PropertyType type) +static const char *rna_property_subtype_unit(PropertySubType type) { switch(RNA_SUBTYPE_UNIT(type)) { case PROP_UNIT_NONE: return "PROP_UNIT_NONE"; diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index dfc2040b0aa..ae62ef55c01 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_ID.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> @@ -358,7 +363,7 @@ static void rna_def_ID_properties(BlenderRNA *brna) prop= RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "PropertyGroup"); - RNA_def_property_collection_funcs(prop, "rna_IDPArray_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_IDPArray_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_IDPArray_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_IDPArray_length", NULL, NULL); RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY); // never tested, maybe its useful to have this? diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index cbde3fe1398..cd9b23da5d3 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_access.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stddef.h> #include <string.h> @@ -57,7 +62,7 @@ #include "rna_internal.h" -const PointerRNA PointerRNA_NULL= {{0}}; +const PointerRNA PointerRNA_NULL= {{NULL}}; /* Init/Exit */ @@ -105,7 +110,7 @@ void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr) StructRNA *type, *idtype= NULL; if(id) { - PointerRNA tmp= {{0}}; + PointerRNA tmp= {{NULL}}; tmp.data= id; idtype= rna_ID_refine(&tmp); @@ -569,6 +574,28 @@ PropertyRNA *RNA_struct_find_nested(PointerRNA *ptr, StructRNA *srna) return prop; } +int RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test) +{ + /* note, prop_test could be freed memory, only use for comparison */ + + /* validate the RNA is ok */ + PropertyRNA *iterprop; + int found= FALSE; + + iterprop= RNA_struct_iterator_property(ptr->type); + + RNA_PROP_BEGIN(ptr, itemptr, iterprop) { + /* PropertyRNA *prop= itemptr.data; */ + if(prop_test == (PropertyRNA *)itemptr.data) { + found= TRUE; + break; + } + } + RNA_PROP_END; + + return found; +} + /* low level direct access to type->properties, note this ignores parent classes so should be used with care */ const struct ListBase *RNA_struct_type_properties(StructRNA *srna) { @@ -739,7 +766,7 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index) /* get string to use for array index */ if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) return quatitem[index]; - else if((index < 4) && ELEM7(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION)) + else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS)) return vectoritem[index]; else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) return coloritem[index]; @@ -751,43 +778,41 @@ int RNA_property_array_item_index(PropertyRNA *prop, char name) { PropertySubType subtype= rna_ensure_property(prop)->subtype; - name= toupper(name); - /* get index based on string name/alias */ /* maybe a function to find char index in string would be better than all the switches */ if (ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) { switch (name) { - case 'W': + case 'w': return 0; - case 'X': + case 'x': return 1; - case 'Y': + case 'y': return 2; - case 'Z': + case 'z': return 3; } } else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION)) { switch (name) { - case 'X': + case 'x': return 0; - case 'Y': + case 'y': return 1; - case 'Z': + case 'z': return 2; - case 'W': + case 'w': return 3; } } else if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) { switch (name) { - case 'R': + case 'r': return 0; - case 'G': + case 'g': return 1; - case 'B': + case 'b': return 2; - case 'A': + case 'a': return 3; } } @@ -876,10 +901,10 @@ void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin IDProperty *item; item= IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_DOUBLE); - *hardmin= item ? IDP_Double(item) : FLT_MIN; + *hardmin= item ? (float)IDP_Double(item) : FLT_MIN; item= IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_DOUBLE); - *hardmax= item ? IDP_Double(item) : FLT_MAX; + *hardmax= item ? (float)IDP_Double(item) : FLT_MAX; return; } @@ -907,16 +932,16 @@ void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *soft IDProperty *item; item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_DOUBLE); - *softmin= item ? IDP_Double(item) : FLT_MIN; + *softmin= item ? (float)IDP_Double(item) : FLT_MIN; item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_DOUBLE); - *softmax= item ? IDP_Double(item) : FLT_MAX; + *softmax= item ? (float)IDP_Double(item) : FLT_MAX; item= IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_DOUBLE); - *step= item ? IDP_Double(item) : 1.0f; + *step= item ? (float)IDP_Double(item) : 1.0f; item= IDP_GetPropertyTypeFromGroup(idp_ui, "precision", IDP_DOUBLE); - *precision= item ? IDP_Double(item) : 3.0f; + *precision= item ? (float)IDP_Double(item) : 3.0f; return; } @@ -1326,6 +1351,8 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + if((idprop=rna_idproperty_check(&prop, ptr))) return IDP_Int(idprop); else if(bprop->get) @@ -1339,6 +1366,8 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + /* just incase other values are passed */ if(value) value= 1; @@ -1363,6 +1392,8 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) values[0]= RNA_property_boolean_get(ptr, prop); @@ -1384,6 +1415,8 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index int tmp[RNA_MAX_ARRAY_LENGTH]; int len= rna_ensure_property_array_length(ptr, prop); + BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_array(ptr, prop, tmp); return tmp[index]; @@ -1405,6 +1438,8 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) IDP_Int(idprop)= values[0]; @@ -1436,6 +1471,8 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde int tmp[RNA_MAX_ARRAY_LENGTH]; int len= rna_ensure_property_array_length(ptr, prop); + BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_array(ptr, prop, tmp); tmp[index]= value; @@ -1455,6 +1492,9 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde int RNA_property_boolean_get_default(PointerRNA *ptr, PropertyRNA *prop) { BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; + + BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + return bprop->defaultvalue; } @@ -1462,6 +1502,8 @@ void RNA_property_boolean_get_default_array(PointerRNA *ptr, PropertyRNA *prop, { BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; + BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + if(prop->arraydimension == 0) values[0]= bprop->defaultvalue; else if(bprop->defaultarray) @@ -1475,6 +1517,8 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i int tmp[RNA_MAX_ARRAY_LENGTH]; int len= rna_ensure_property_array_length(ptr, prop); + BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); + if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_default_array(ptr, prop, tmp); return tmp[index]; @@ -1496,6 +1540,8 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop) IntPropertyRNA *iprop= (IntPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_INT); + if((idprop=rna_idproperty_check(&prop, ptr))) return IDP_Int(idprop); else if(iprop->get) @@ -1509,6 +1555,8 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) IntPropertyRNA *iprop= (IntPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_INT); + if((idprop=rna_idproperty_check(&prop, ptr))) IDP_Int(idprop)= value; else if(iprop->set) @@ -1530,6 +1578,8 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) IntPropertyRNA *iprop= (IntPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_INT); + if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) values[0]= RNA_property_int_get(ptr, prop); @@ -1551,6 +1601,8 @@ int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) int tmp[RNA_MAX_ARRAY_LENGTH]; int len= rna_ensure_property_array_length(ptr, prop); + BLI_assert(RNA_property_type(prop) == PROP_INT); + if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_int_get_array(ptr, prop, tmp); return tmp[index]; @@ -1572,6 +1624,8 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v IntPropertyRNA *iprop= (IntPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_INT); + if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) IDP_Int(idprop)= values[0]; @@ -1603,6 +1657,8 @@ void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, i int tmp[RNA_MAX_ARRAY_LENGTH]; int len= rna_ensure_property_array_length(ptr, prop); + BLI_assert(RNA_property_type(prop) == PROP_INT); + if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_int_get_array(ptr, prop, tmp); tmp[index]= value; @@ -1629,6 +1685,8 @@ void RNA_property_int_get_default_array(PointerRNA *ptr, PropertyRNA *prop, int { IntPropertyRNA *iprop= (IntPropertyRNA*)prop; + BLI_assert(RNA_property_type(prop) == PROP_INT); + if(prop->arraydimension == 0) values[0]= iprop->defaultvalue; else if(iprop->defaultarray) @@ -1663,6 +1721,8 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop) FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + if((idprop=rna_idproperty_check(&prop, ptr))) { if(idprop->type == IDP_FLOAT) return IDP_Float(idprop); @@ -1680,6 +1740,8 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + if((idprop=rna_idproperty_check(&prop, ptr))) { if(idprop->type == IDP_FLOAT) IDP_Float(idprop)= value; @@ -1707,6 +1769,8 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val IDProperty *idprop; int i; + BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) values[0]= RNA_property_float_get(ptr, prop); @@ -1733,6 +1797,8 @@ float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index float tmp[RNA_MAX_ARRAY_LENGTH]; int len= rna_ensure_property_array_length(ptr, prop); + BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_array(ptr, prop, tmp); return tmp[index]; @@ -1756,6 +1822,8 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa IDProperty *idprop; int i; + BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + if((idprop=rna_idproperty_check(&prop, ptr))) { if(prop->arraydimension == 0) { if(idprop->type == IDP_FLOAT) @@ -1797,6 +1865,8 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float tmp[RNA_MAX_ARRAY_LENGTH]; int len= rna_ensure_property_array_length(ptr, prop); + BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_array(ptr, prop, tmp); tmp[index]= value; @@ -1816,6 +1886,9 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float RNA_property_float_get_default(PointerRNA *ptr, PropertyRNA *prop) { FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; + + BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + return fprop->defaultvalue; } @@ -1823,6 +1896,8 @@ void RNA_property_float_get_default_array(PointerRNA *ptr, PropertyRNA *prop, fl { FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; + BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + if(prop->arraydimension == 0) values[0]= fprop->defaultvalue; else if(fprop->defaultarray) @@ -1836,6 +1911,8 @@ float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i float tmp[RNA_MAX_ARRAY_LENGTH]; int len= rna_ensure_property_array_length(ptr, prop); + BLI_assert(RNA_property_type(prop) == PROP_FLOAT); + if(len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_default_array(ptr, prop, tmp); return tmp[index]; @@ -1857,6 +1934,8 @@ void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value) StringPropertyRNA *sprop= (StringPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_STRING); + if((idprop=rna_idproperty_check(&prop, ptr))) strcpy(value, IDP_String(idprop)); else if(sprop->get) @@ -1870,6 +1949,8 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fi char *buf; int length; + BLI_assert(RNA_property_type(prop) == PROP_STRING); + length= RNA_property_string_length(ptr, prop); if(length+1 < fixedlen) @@ -1888,6 +1969,8 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop) StringPropertyRNA *sprop= (StringPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_STRING); + if((idprop=rna_idproperty_check(&prop, ptr))) return strlen(IDP_String(idprop)); else if(sprop->length) @@ -1901,6 +1984,8 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val StringPropertyRNA *sprop= (StringPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_STRING); + if((idprop=rna_idproperty_check(&prop, ptr))) IDP_AssignString(idprop, (char*)value, RNA_property_string_maxlength(prop) - 1); else if(sprop->set) @@ -1917,6 +2002,9 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val void RNA_property_string_get_default(PointerRNA *ptr, PropertyRNA *prop, char *value) { StringPropertyRNA *sprop= (StringPropertyRNA*)prop; + + BLI_assert(RNA_property_type(prop) == PROP_STRING); + strcpy(value, sprop->defaultvalue); } @@ -1925,6 +2013,8 @@ char *RNA_property_string_get_default_alloc(PointerRNA *ptr, PropertyRNA *prop, char *buf; int length; + BLI_assert(RNA_property_type(prop) == PROP_STRING); + length= RNA_property_string_default_length(ptr, prop); if(length+1 < fixedlen) @@ -1941,6 +2031,9 @@ char *RNA_property_string_get_default_alloc(PointerRNA *ptr, PropertyRNA *prop, int RNA_property_string_default_length(PointerRNA *ptr, PropertyRNA *prop) { StringPropertyRNA *sprop= (StringPropertyRNA*)prop; + + BLI_assert(RNA_property_type(prop) == PROP_STRING); + return strlen(sprop->defaultvalue); } @@ -1949,6 +2042,8 @@ int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop) EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_ENUM); + if((idprop=rna_idproperty_check(&prop, ptr))) return IDP_Int(idprop); else if(eprop->get) @@ -1962,6 +2057,8 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value) EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_ENUM); + if((idprop=rna_idproperty_check(&prop, ptr))) IDP_Int(idprop)= value; else if(eprop->set) { @@ -1982,6 +2079,9 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value) int RNA_property_enum_get_default(PointerRNA *ptr, PropertyRNA *prop) { EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop; + + BLI_assert(RNA_property_type(prop) == PROP_ENUM); + return eprop->defaultvalue; } @@ -1991,6 +2091,8 @@ PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop) PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_POINTER); + if((idprop=rna_idproperty_check(&prop, ptr))) { pprop= (PointerPropertyRNA*)prop; @@ -2015,6 +2117,8 @@ void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr { /*IDProperty *idprop;*/ + BLI_assert(RNA_property_type(prop) == PROP_POINTER); + if((/*idprop=*/ rna_idproperty_check(&prop, ptr))) { /* not supported */ } @@ -2033,6 +2137,9 @@ void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr PointerRNA RNA_property_pointer_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop)) { //PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; + + // BLI_assert(RNA_property_type(prop) == PROP_POINTER); + return PointerRNA_NULL; // FIXME: there has to be a way... } @@ -2040,6 +2147,8 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop) { /*IDProperty *idprop;*/ + BLI_assert(RNA_property_type(prop) == PROP_POINTER); + if((/*idprop=*/rna_idproperty_check(&prop, ptr))) { /* already exists */ } @@ -2061,6 +2170,8 @@ void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop) { IDProperty *idprop, *group; + BLI_assert(RNA_property_type(prop) == PROP_POINTER); + if((idprop=rna_idproperty_check(&prop, ptr))) { group= RNA_struct_idprops(ptr, 0); @@ -2087,6 +2198,8 @@ void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, Collectio { IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + memset(iter, 0, sizeof(*iter)); if((idprop=rna_idproperty_check(&prop, ptr)) || (prop->flag & PROP_IDPROPERTY)) { @@ -2138,6 +2251,8 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop) CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + if((idprop=rna_idproperty_check(&prop, ptr))) { return idprop->len; } @@ -2162,6 +2277,8 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA IDProperty *idprop; // CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + if((idprop=rna_idproperty_check(&prop, ptr))) { IDPropertyTemplate val = {0}; IDProperty *item; @@ -2219,6 +2336,8 @@ int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) IDProperty *idprop; // CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + if((idprop=rna_idproperty_check(&prop, ptr))) { IDProperty tmp, *array; int len; @@ -2264,6 +2383,8 @@ int RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, in { IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + if((idprop=rna_idproperty_check(&prop, ptr))) { IDProperty tmp, *array; int len; @@ -2292,6 +2413,8 @@ void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop) { IDProperty *idprop; + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + if((idprop=rna_idproperty_check(&prop, ptr))) IDP_ResizeIDPArray(idprop, 0); } @@ -2301,6 +2424,8 @@ int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, Poi CollectionPropertyIterator iter; int index= 0; + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + RNA_property_collection_begin(ptr, prop, &iter); for(index=0; iter.valid; RNA_property_collection_next(&iter), index++) { if (iter.ptr.data == t_ptr->data) @@ -2319,6 +2444,8 @@ int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int k { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop); + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + if(cprop->lookupint) { /* we have a callback defined, use it */ return cprop->lookupint(ptr, key, r_ptr); @@ -2348,6 +2475,8 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop); + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + if(cprop->lookupstring) { /* we have a callback defined, use it */ return cprop->lookupstring(ptr, key, r_ptr); @@ -2389,6 +2518,8 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co int RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr) { + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + *r_ptr= *ptr; return ((r_ptr->type = prop->srna) ? 1:0); } @@ -2399,6 +2530,8 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper ArrayIterator *internal; char *arrayp; + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + if(!(prop->flag & PROP_RAW_ARRAY) || !(itemprop->flag & PROP_RAW_ACCESS)) return 0; @@ -3756,7 +3889,7 @@ char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, in } else { printf("RNA_string_get_alloc: %s.%s not found.\n", ptr->type->identifier, name); - return 0; + return NULL; } } @@ -4942,3 +5075,19 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i return 0; } + +void RNA_warning(const char *format, ...) +{ + va_list args; + + va_start(args, format); + vprintf(format, args); + va_end(args); + +#ifdef WITH_PYTHON + { + extern void PyC_LineSpit(void); + PyC_LineSpit(); + } +#endif +} diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 0cc52c93b95..418451801ca 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_action.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -231,6 +236,18 @@ static void rna_def_dopesheet(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Filtering Group", "Group that included Object should be a member of"); RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); + /* FCurve Display Name Search Settings */ + prop= RNA_def_property(srna, "show_only_matching_fcurves", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_BY_FCU_NAME); + RNA_def_property_ui_text(prop, "Only Matching F-Curves", "Only include F-Curves with names containing search text"); + RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0); + RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); + + prop= RNA_def_property(srna, "filter_fcurve_name", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "searchstr"); + RNA_def_property_ui_text(prop, "F-Curve Name Filter", "F-Curve live filtering string"); + RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); + /* NLA Specific Settings */ prop= RNA_def_property(srna, "show_missing_nla", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT); @@ -440,7 +457,7 @@ static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_string(func, "data_path", "", 0, "Data Path", "FCurve data path to use."); RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_int(func, "array_index", 0, 0, INT_MAX, "Index", "Array index.", 0, INT_MAX); + RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index.", 0, INT_MAX); RNA_def_string(func, "action_group", "", 0, "Action Group", "Acton group to add this fcurve into."); parm= RNA_def_pointer(func, "fcurve", "FCurve", "", "Newly created fcurve"); diff --git a/source/blender/makesrna/intern/rna_action_api.c b/source/blender/makesrna/intern/rna_action_api.c index 7c26b4d40fa..07c42cf0d20 100644 --- a/source/blender/makesrna/intern/rna_action_api.c +++ b/source/blender/makesrna/intern/rna_action_api.c @@ -24,6 +24,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_action_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> #include <string.h> diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 248d878e9e0..863c30f8ef2 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_actuator.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -48,7 +53,7 @@ EnumPropertyItem actuator_type_items[] ={ {ACT_2DFILTER, "FILTER_2D", 0, "Filter 2D", ""}, {ACT_GAME, "GAME", 0, "Game", ""}, {ACT_MESSAGE, "MESSAGE", 0, "Message", ""}, - {ACT_OBJECT, "OBJECT", 0, "Motion", ""}, + {ACT_OBJECT, "MOTION", 0, "Motion", ""}, {ACT_PARENT, "PARENT", 0, "Parent", ""}, {ACT_PROPERTY, "PROPERTY", 0, "Property", ""}, {ACT_RANDOM, "RANDOM", 0, "Random", ""}, @@ -1168,7 +1173,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_distance_get", "rna_ConstraintActuator_distance_set", NULL); RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2); - RNA_def_property_ui_text(prop, "Distance", "Set the maximum length of ray"); + RNA_def_property_ui_text(prop, "Distance", "Keep this distance to target"); RNA_def_property_update(prop, NC_LOGIC, NULL); //XXX to use a pointer or add a material lookup @@ -1209,35 +1214,37 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Reference Direction", "Reference Direction"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE); + //XXX TODO - use radians internally then change to PROP_ANGLE + prop= RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "minloc[0]"); RNA_def_property_range(prop, 0.0, 180.0); - RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle to maintain with target direction. No correction is done if angle with target direction is between min and max"); + RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle (in degree) to maintain with target direction. No correction is done if angle with target direction is between min and max"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE); + //XXX TODO - use radians internally then change to PROP_ANGLE + prop= RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "maxloc[0]"); RNA_def_property_range(prop, 0.0, 180.0); - RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle allowed with target direction. No correction is done if angle with target direction is between min and max"); + RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle (in degree) allowed with target direction. No correction is done if angle with target direction is between min and max"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* ACT_CONST_TYPE_FH */ prop= RNA_def_property(srna, "fh_height", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_fhheight_get", "rna_ConstraintActuator_fhheight_set", NULL); RNA_def_property_ui_range(prop, 0.01, 2000.0, 10, 2); - RNA_def_property_ui_text(prop, "Distance", "Height of the Fh area"); + RNA_def_property_ui_text(prop, "Distance", "Height of the force field area"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "spring", PROP_FLOAT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "fh_force", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_spring_get", "rna_ConstraintActuator_spring_set", NULL); RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2); - RNA_def_property_ui_text(prop, "Fh", "Spring force within the Fh area"); + RNA_def_property_ui_text(prop, "Force", "Spring force within the force field area"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "maxrot[0]"); RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2); - RNA_def_property_ui_text(prop, "Damping", "Damping factor of the Fh spring force"); + RNA_def_property_ui_text(prop, "Damping", "Damping factor of the force field spring"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* booleans */ @@ -1455,7 +1462,7 @@ static void rna_def_random_actuator(BlenderRNA *brna) static EnumPropertyItem prop_distribution_items[] ={ {ACT_RANDOM_BOOL_CONST, "BOOL_CONSTANT", 0, "Bool Constant", ""}, {ACT_RANDOM_BOOL_UNIFORM, "BOOL_UNIFORM", 0, "Bool Uniform", ""}, - {ACT_RANDOM_BOOL_BERNOUILLI, "BOOL_BERNOUILLI", 0, "Bool Bernouilli", ""}, + {ACT_RANDOM_BOOL_BERNOUILLI, "BOOL_BERNOUILLI", 0, "Bool Bernoulli", ""}, {ACT_RANDOM_INT_CONST, "INT_CONSTANT", 0, "Int Constant", ""}, {ACT_RANDOM_INT_UNIFORM, "INT_UNIFORM", 0, "Int Uniform", ""}, {ACT_RANDOM_INT_POISSON, "INT_POISSON", 0, "Int Poisson", ""}, diff --git a/source/blender/makesrna/intern/rna_actuator_api.c b/source/blender/makesrna/intern/rna_actuator_api.c index e587b6f86e4..3c1f78c21c3 100644 --- a/source/blender/makesrna/intern/rna_actuator_api.c +++ b/source/blender/makesrna/intern/rna_actuator_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_actuator_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 0214def4d07..17d2e27c462 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_animation.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_access.h" @@ -164,9 +169,9 @@ static void rna_KeyingSetInfo_unregister(const bContext *C, StructRNA *type) static StructRNA *rna_KeyingSetInfo_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { - KeyingSetInfo dummyksi = {0}; + KeyingSetInfo dummyksi = {NULL}; KeyingSetInfo *ksi; - PointerRNA dummyptr = {{0}}; + PointerRNA dummyptr = {{NULL}}; int have_function[3]; /* setup dummy type info to store static properties in */ @@ -545,7 +550,8 @@ static void rna_def_keyingset_path(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Data Path", "Path to property setting"); RNA_def_struct_name_property(srna, prop); // XXX this is the best indicator for now... RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); - + + /* called 'index' when given as function arg */ prop= RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE); RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific setting if applicable"); RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); // XXX: maybe a bit too noisy diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c index 6feb86ff45d..4f1a94d62c5 100644 --- a/source/blender/makesrna/intern/rna_animation_api.c +++ b/source/blender/makesrna/intern/rna_animation_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_animation_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c index 91a5659f9aa..5bbd71bf8bc 100644 --- a/source/blender/makesrna/intern/rna_animviz.c +++ b/source/blender/makesrna/intern/rna_animviz.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_animviz.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index a86a7bb2c18..1b07b224f87 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_armature.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "BLI_math.h" @@ -795,7 +800,7 @@ static void rna_def_armature(BlenderRNA *brna) {ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)"}, {ARM_LINE, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"}, {ARM_B_BONE, "BBONE", 0, "B-Bone", "Display bones as boxes, showing subdivision and B-Splines"}, - {ARM_ENVELOPE, "ENVELOPE", 0, "Envelope", "Display bones as extruded spheres, showing defomation influence volume"}, + {ARM_ENVELOPE, "ENVELOPE", 0, "Envelope", "Display bones as extruded spheres, showing deformation influence volume"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_ghost_type_items[] = { {ARM_GHOST_CUR, "CURRENT_FRAME", 0, "Around Frame", "Display Ghosts of poses within a fixed number of frames around the current frame"}, diff --git a/source/blender/makesrna/intern/rna_armature_api.c b/source/blender/makesrna/intern/rna_armature_api.c index 00c0342ac3e..fd9ae7f11c2 100644 --- a/source/blender/makesrna/intern/rna_armature_api.c +++ b/source/blender/makesrna/intern/rna_armature_api.c @@ -24,6 +24,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_armature_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> #include <string.h> diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 1a7f7f99c8f..c9d261e8143 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -27,6 +27,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_boid.c + * \ingroup RNA + */ + + #include <float.h> #include <limits.h> #include <stdlib.h> @@ -46,7 +51,7 @@ EnumPropertyItem boidrule_type_items[] ={ {eBoidRuleType_Goal, "GOAL", 0, "Goal", "Go to assigned object or loudest assigned signal source"}, {eBoidRuleType_Avoid, "AVOID", 0, "Avoid", "Get away from assigned object or loudest assigned signal source"}, - {eBoidRuleType_AvoidCollision, "AVOID_COLLISION", 0, "Avoid Collision", "Maneuver to avoid collisions with other boids and deflector objects in near future"}, + {eBoidRuleType_AvoidCollision, "AVOID_COLLISION", 0, "Avoid Collision", "Manoeuvre to avoid collisions with other boids and deflector objects in near future"}, {eBoidRuleType_Separate, "SEPARATE", 0, "Separate", "Keep from going through other boids"}, {eBoidRuleType_Flock, "FLOCK", 0, "Flock", "Move to center of neighbors and match their velocity"}, {eBoidRuleType_FollowLeader, "FOLLOW_LEADER", 0, "Follow Leader", "Follow a boid or assigned object"}, diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 3f8e38a99c6..74857115bc5 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_brush.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -64,7 +69,7 @@ EnumPropertyItem brush_sculpt_tool_items[] = { {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem brush_vertexpaint_tool_items[] = { +EnumPropertyItem brush_vertex_tool_items[] = { {0, "MIX", ICON_BRUSH_MIX, "Mix", "Use mix blending mode while painting"}, {1, "ADD", ICON_BRUSH_ADD, "Add", "Use add blending mode while painting"}, {2, "SUB", ICON_BRUSH_SUBTRACT, "Subtract", "Use subtract blending mode while painting"}, @@ -74,7 +79,7 @@ EnumPropertyItem brush_vertexpaint_tool_items[] = { {6, "DARKEN", ICON_BRUSH_DARKEN, "Darken", "Use darken blending mode while painting"}, {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem brush_imagepaint_tool_items[] = { +EnumPropertyItem brush_image_tool_items[] = { {PAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_TEXDRAW, "Draw", ""}, {PAINT_TOOL_SOFTEN, "SOFTEN", ICON_BRUSH_SOFTEN, "Soften", ""}, {PAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_SMEAR, "Smear", ""}, @@ -125,7 +130,7 @@ static void rna_Brush_sculpt_tool_update(Main *bmain, Scene *scene, PointerRNA * rna_Brush_update(bmain, scene, ptr); } -static void rna_Brush_vertexpaint_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Brush_vertex_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Brush *br= (Brush*)ptr->data; rna_Brush_reset_icon(br, "vertex_paint"); @@ -135,7 +140,7 @@ static void rna_Brush_vertexpaint_tool_update(Main *bmain, Scene *scene, Pointer static void rna_Brush_imagepaint_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Brush *br= (Brush*)ptr->data; - rna_Brush_reset_icon(br, "texture_paint"); + rna_Brush_reset_icon(br, "image_paint"); rna_Brush_update(bmain, scene, ptr); } @@ -378,13 +383,15 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sculpt Tool", ""); RNA_def_property_update(prop, 0, "rna_Brush_sculpt_tool_update"); - prop= RNA_def_property(srna, "vertexpaint_tool", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, brush_vertexpaint_tool_items); + prop= RNA_def_property(srna, "vertex_tool", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "vertexpaint_tool"); + RNA_def_property_enum_items(prop, brush_vertex_tool_items); RNA_def_property_ui_text(prop, "Vertex/Weight Paint Tool", ""); - RNA_def_property_update(prop, 0, "rna_Brush_vertexpaint_tool_update"); + RNA_def_property_update(prop, 0, "rna_Brush_vertex_tool_update"); - prop= RNA_def_property(srna, "imagepaint_tool", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, brush_imagepaint_tool_items); + prop= RNA_def_property(srna, "image_tool", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "imagepaint_tool"); + RNA_def_property_enum_items(prop, brush_image_tool_items); RNA_def_property_ui_text(prop, "Image Paint Tool", ""); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_imagepaint_tool_update"); @@ -423,7 +430,7 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_int_funcs(prop, "rna_Brush_get_size", "rna_Brush_set_size", NULL); RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS*10); RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0); - RNA_def_property_ui_text(prop, "Size", "Radius of the brush in pixels"); + RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels"); RNA_def_property_update(prop, 0, "rna_Brush_update"); prop= RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE); @@ -660,11 +667,10 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Restore Mesh", "Allows a single dot to be carefully positioned"); RNA_def_property_update(prop, 0, "rna_Brush_update"); - /* not exposed in the interface yet - prop= RNA_def_property(srna, "fixed_tex", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_fixed_texture", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX); RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position"); - RNA_def_property_update(prop, 0, "rna_Brush_update"); */ + RNA_def_property_update(prop, 0, "rna_Brush_update"); /* only for projection paint, TODO, other paint modes */ prop= RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); @@ -690,7 +696,7 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_WEIGHT_PAINT); RNA_def_property_ui_text(prop, "Use Weight", "Use this brush in weight paint mode"); - prop= RNA_def_property(srna, "use_paint_texture", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_paint_image", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_TEXTURE_PAINT); RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode"); @@ -722,7 +728,7 @@ static void rna_def_brush(BlenderRNA *brna) prop= RNA_def_property(srna, "cursor_color_subtract", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "sub_col"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Subract Color", "Color of cursor when subtracting"); + RNA_def_property_ui_text(prop, "Subtract Color", "Color of cursor when subtracting"); RNA_def_property_update(prop, 0, "rna_Brush_update"); prop= RNA_def_property(srna, "use_custom_icon", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index ad5fdbe9aba..34b1dc85881 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_camera.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index ed40eb95620..a7f308742ac 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_cloth.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <limits.h> diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 64f7c02da44..a8e3500f08f 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_color.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> @@ -328,7 +333,7 @@ static void rna_def_curvemappoint(BlenderRNA *brna) RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, prop_handle_type_items); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Handle Type", "Curve interpolation at this point: bezier or vector"); + RNA_def_property_ui_text(prop, "Handle Type", "Curve interpolation at this point: Bezier or vector"); prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_SELECT); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 9570d817726..fcfbb4eb990 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_constraint.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -70,32 +75,20 @@ EnumPropertyItem constraint_type_items[] ={ {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT_DATA, "Shrinkwrap", ""}, {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem space_pchan_items[] = { +static EnumPropertyItem space_pchan_items[] = { {0, "WORLD", 0, "World Space", ""}, {2, "POSE", 0, "Pose Space", ""}, {3, "LOCAL_WITH_PARENT", 0, "Local With Parent", ""}, {1, "LOCAL", 0, "Local Space", ""}, {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem space_object_items[] = { +#ifdef RNA_RUNTIME + +static EnumPropertyItem space_object_items[] = { {0, "WORLD", 0, "World Space", ""}, {1, "LOCAL", 0, "Local Space", ""}, {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem constraint_ik_type_items[] ={ - {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""}, - {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""}, - {0, NULL, 0, NULL, NULL}, -}; - -EnumPropertyItem constraint_ik_axisref_items[] ={ - {0, "BONE", 0, "Bone", ""}, - {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""}, - {0, NULL, 0, NULL, NULL}, -}; - -#ifdef RNA_RUNTIME - #include "BKE_animsys.h" #include "BKE_action.h" #include "BKE_constraint.h" @@ -322,47 +315,6 @@ static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const flo memcpy(ikData->points, values, ikData->numpoints * sizeof(float)); } -/* Array Get/Set Functions for RigidBodyJointConstraint Min/Max Cone Limits */ -void rna_RigidBodyJointConstraint_limit_cone_min_get(PointerRNA *ptr, float values[3]) -{ - bRigidBodyJointConstraint *data= (bRigidBodyJointConstraint*)(((bConstraint*)ptr->data)->data); - float *limit = data->minLimit; - - values[0]= limit[3]; - values[1]= limit[4]; - values[2]= limit[5]; -} - -static void rna_RigidBodyJointConstraint_limit_cone_min_set(PointerRNA *ptr, const float values[3]) -{ - bRigidBodyJointConstraint *data= (bRigidBodyJointConstraint*)(((bConstraint*)ptr->data)->data); - float *limit = data->minLimit; - - limit[3]= values[0]; - limit[4]= values[1]; - limit[5]= values[2]; -} - -void rna_RigidBodyJointConstraint_limit_cone_max_get(PointerRNA *ptr, float values[3]) -{ - bRigidBodyJointConstraint *data= (bRigidBodyJointConstraint*)(((bConstraint*)ptr->data)->data); - float *limit = data->maxLimit; - - values[0]= limit[3]; - values[1]= limit[4]; - values[2]= limit[5]; -} - -static void rna_RigidBodyJointConstraint_limit_cone_max_set(PointerRNA *ptr, const float values[3]) -{ - bRigidBodyJointConstraint *data= (bRigidBodyJointConstraint*)(((bConstraint*)ptr->data)->data); - float *limit = data->maxLimit; - - limit[3]= values[0]; - limit[4]= values[1]; - limit[5]= values[2]; -} - #else EnumPropertyItem constraint_distance_items[] = { @@ -502,6 +454,18 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + static EnumPropertyItem constraint_ik_axisref_items[] ={ + {0, "BONE", 0, "Bone", ""}, + {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""}, + {0, NULL, 0, NULL, NULL}, + }; + + static EnumPropertyItem constraint_ik_type_items[] ={ + {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""}, + {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""}, + {0, NULL, 0, NULL, NULL}, + }; + srna= RNA_def_struct(brna, "KinematicConstraint", "Constraint"); RNA_def_struct_ui_text(srna, "Kinematic Constraint", "Inverse Kinematics"); RNA_def_struct_sdna_from(srna, "bKinematicConstraint", "data"); @@ -1158,7 +1122,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna) static EnumPropertyItem volume_items[] = { {VOLUME_XZ, "VOLUME_XZX", 0, "XZ", ""}, - {VOLUME_X, "VOLUME_X", 0, "Y", ""}, + {VOLUME_X, "VOLUME_X", 0, "X", ""}, {VOLUME_Z, "VOLUME_Z", 0, "Z", ""}, {NO_VOLUME, "NO_VOLUME", 0, "None", ""}, {0, NULL, 0, NULL, NULL}}; @@ -1293,62 +1257,92 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - /* Limit */ - - /* Limit Min/Max for genereic 6 DoF */ - prop= RNA_def_property(srna, "limit_generic_min", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "minLimit"); - RNA_def_property_array(prop, 6); - RNA_def_property_ui_text(prop, "Minimum Limit", ""); - - prop= RNA_def_property(srna, "limit_generic_max", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "maxLimit"); - RNA_def_property_array(prop, 6); - RNA_def_property_ui_text(prop, "Maximum Limit", ""); - - /* Limit Min/Max for Cone Twist */ - prop= RNA_def_property(srna, "limit_cone_min", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "minLimit"); - RNA_def_property_float_funcs(prop, "rna_RigidBodyJointConstraint_limit_cone_min_get", "rna_RigidBodyJointConstraint_limit_cone_min_set", NULL); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Minimum Limit", ""); - - prop= RNA_def_property(srna, "limit_cone_max", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "maxLimit"); - RNA_def_property_float_funcs(prop, "rna_RigidBodyJointConstraint_limit_cone_max_get", "rna_RigidBodyJointConstraint_limit_cone_max_set", NULL); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Maximum Limit", ""); + /* Limits */ + /* Limit Min/Max */ + prop= RNA_def_property(srna, "limit_min_x", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[0]"); + RNA_def_property_ui_text(prop, "Minimum Limit X", ""); + + prop= RNA_def_property(srna, "limit_min_y", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[1]"); + RNA_def_property_ui_text(prop, "Minimum Limit Y", ""); + + prop= RNA_def_property(srna, "limit_min_z", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[2]"); + RNA_def_property_ui_text(prop, "Minimum Limit Z", ""); + + prop= RNA_def_property(srna, "limit_max_x", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[0]"); + RNA_def_property_ui_text(prop, "Maximum Limit X", ""); + + prop= RNA_def_property(srna, "limit_max_y", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[1]"); + RNA_def_property_ui_text(prop, "Maximum Limit Y", ""); + + prop= RNA_def_property(srna, "limit_max_z", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[2]"); + RNA_def_property_ui_text(prop, "Maximum Limit Z", ""); + + /* Limit Min/Max for angle */ + prop= RNA_def_property(srna, "limit_angle_min_x", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[3]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Minimum Angular Limit X", ""); - - /* Limit Booleans */ + prop= RNA_def_property(srna, "limit_angle_min_y", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[4]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Minimum Angular Limit Y", ""); + + prop= RNA_def_property(srna, "limit_angle_min_z", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "minLimit[5]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Minimum Angular Limit Z", ""); + + prop= RNA_def_property(srna, "limit_angle_max_x", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[3]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Maximum Angular Limit X", ""); + + prop= RNA_def_property(srna, "limit_angle_max_y", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[4]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Maximum Angular Limit Y", ""); + + prop= RNA_def_property(srna, "limit_angle_max_z", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit[5]"); + RNA_def_property_range(prop, -M_PI*2, M_PI*2); + RNA_def_property_ui_text(prop, "Maximum Angular Limit Z", ""); + + /* Limit Booleans */ prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", 1); - RNA_def_property_ui_text(prop, "Use X Limit", "Use minimum/maximum x limit"); + RNA_def_property_ui_text(prop, "Limit X", "Use minimum/maximum x limit"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", 2); - RNA_def_property_ui_text(prop, "Use Y Limit", "Use minimum/maximum y limit"); + RNA_def_property_ui_text(prop, "Limit Y", "Use minimum/maximum y limit"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", 4); - RNA_def_property_ui_text(prop, "Use Z Limit", "Use minimum/maximum z limit"); + RNA_def_property_ui_text(prop, "Limit Z", "Use minimum/maximum z limit"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_angular_limit_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", 8); - RNA_def_property_ui_text(prop, "Use Angular X Limit", "Use minimum/maximum x angular limit"); + RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum x angular limit"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_angular_limit_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", 16); - RNA_def_property_ui_text(prop, "Use Angular Y Limit", "Use minimum/maximum y angular limit"); + RNA_def_property_ui_text(prop, "Angular Y Limit", "Use minimum/maximum y angular limit"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop= RNA_def_property(srna, "use_angular_limit_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", 32); - RNA_def_property_ui_text(prop, "Use Angular Z Limit", "Use minimum/maximum z angular limit"); + RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum z angular limit"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); } diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c index 58081d13867..42ef12e7d1e 100644 --- a/source/blender/makesrna/intern/rna_context.c +++ b/source/blender/makesrna/intern/rna_context.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_context.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "DNA_ID.h" diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index 535476685cd..12d27bc80c2 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_controller.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "WM_types.h" @@ -39,7 +44,7 @@ EnumPropertyItem controller_type_items[] ={ {CONT_LOGIC_XOR, "LOGIC_XOR", 0, "Xor", "Logic Xor"}, {CONT_LOGIC_XNOR, "LOGIC_XNOR", 0, "Xnor", "Logic Xnor"}, {CONT_EXPRESSION, "EXPRESSION", 0, "Expression", ""}, - {CONT_PYTHON, "PYTHON", 0, "Python Script", ""}, + {CONT_PYTHON, "PYTHON", 0, "Python", ""}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME diff --git a/source/blender/makesrna/intern/rna_controller_api.c b/source/blender/makesrna/intern/rna_controller_api.c index c46a61fb1d8..d9defe3f8aa 100644 --- a/source/blender/makesrna/intern/rna_controller_api.c +++ b/source/blender/makesrna/intern/rna_controller_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_controller_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index e103da253dc..03314bca6a3 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_curve.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -515,7 +520,7 @@ static void rna_Curve_spline_points_add(ID *id, Nurb *nu, ReportList *reports, i static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, ReportList *reports, int number) { if(nu->type != CU_BEZIER) { - BKE_report(reports, RPT_ERROR, "Only bezier splines can be added"); + BKE_report(reports, RPT_ERROR, "Only Bezier splines can be added"); } else if(number==0) { // do nothing @@ -1207,7 +1212,7 @@ static void rna_def_curve(BlenderRNA *brna) static const EnumPropertyItem curve_axis_items[]= { {0, "2D", 0, "2D", "Clamp the Z axis of of the curve"}, - {CU_3D, "3D", 0, "3D", "Allow editing on the Z axis of this curve, also alows tilt and curve radius to be used"}, + {CU_3D, "3D", 0, "3D", "Allow editing on the Z axis of this curve, also allows tilt and curve radius to be used"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Curve", "ID"); @@ -1235,7 +1240,7 @@ static void rna_def_curve(BlenderRNA *brna) prop= RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_HANDLES); - RNA_def_property_ui_text(prop, "Draw Handles", "Display bezier handles in editmode"); + RNA_def_property_ui_text(prop, "Draw Handles", "Display Bezier handles in editmode"); RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL); prop= RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE); @@ -1425,7 +1430,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "BezierSplinePoint"); RNA_def_property_collection_sdna(prop, NULL, "bezt", "pntsu"); - RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points for bezier curves only"); + RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points for Bezier curves only"); rna_def_curve_spline_bezpoints(brna, prop); @@ -1512,12 +1517,12 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "use_bezier_u", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_BEZIER); - RNA_def_property_ui_text(prop, "Bezier U", "Make this nurbs curve or surface act like a bezier spline in the U direction (Order U must be 3 or 4, Cyclic U must be disabled)"); + RNA_def_property_ui_text(prop, "Bezier U", "Make this nurbs curve or surface act like a Bezier spline in the U direction (Order U must be 3 or 4, Cyclic U must be disabled)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); prop= RNA_def_property(srna, "use_bezier_v", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_BEZIER); - RNA_def_property_ui_text(prop, "Bezier V", "Make this nurbs surface act like a bezier spline in the V direction (Order V must be 3 or 4, Cyclic V must be disabled)"); + RNA_def_property_ui_text(prop, "Bezier V", "Make this nurbs surface act like a Bezier spline in the V direction (Order V must be 3 or 4, Cyclic V must be disabled)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 97c7df253a1..3afec03a13f 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_define.c + * \ingroup RNA + */ + + #include <float.h> #include <limits.h> #include <stdio.h> @@ -44,7 +49,7 @@ /* Global used during defining */ -BlenderDefRNA DefRNA = {0, {0, 0}, {0, 0}, 0, 0, 0, 0, 1}; +BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1}; /* Duplicated code since we can't link in blenkernel or blenlib */ @@ -61,7 +66,7 @@ void rna_addtail(ListBase *listbase, void *vlink) link->prev = listbase->last; if (listbase->last) ((Link *)listbase->last)->next = link; - if (listbase->first == 0) listbase->first = link; + if (listbase->first == NULL) listbase->first = link; listbase->last = link; } @@ -390,7 +395,7 @@ static int rna_validate_identifier(const char *identifier, char *error, int prop } if (identifier[a]==' ') { - strcpy(error, "spaces are not ok in identifier names"); + strcpy(error, "spaces are not okay in identifier names"); return 0; } @@ -406,6 +411,21 @@ static int rna_validate_identifier(const char *identifier, char *error, int prop return 0; } } + + if(property) { + static const char *kwlist_prop[] = { + /* not keywords but reserved all the same because py uses */ + "keys", "values", "items", "get", + NULL + }; + + for(a=0; kwlist_prop[a]; a++) { + if (strcmp(identifier, kwlist_prop[a]) == 0) { + strcpy(error, "this keyword is reserved by python"); + return 0; + } + } + } return 1; } @@ -654,7 +674,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * if(DefRNA.preprocess) { RNA_def_property_struct_type(prop, "Property"); - RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", "rna_iterator_listbase_end", "rna_builtin_properties_get", 0, 0, "rna_builtin_properties_lookup_string"); + RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", "rna_iterator_listbase_end", "rna_builtin_properties_get", NULL, NULL, "rna_builtin_properties_lookup_string"); } else { #ifdef RNA_RUNTIME @@ -1810,7 +1830,7 @@ void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editabl void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_refine_func: only during preprocessing.\n"); + fprintf(stderr, "RNA_def_property_update: only during preprocessing.\n"); return; } @@ -2835,7 +2855,7 @@ void RNA_def_property_free_pointers(PropertyRNA *prop) } } -void RNA_def_property_free(StructOrFunctionRNA *cont_, PropertyRNA *prop) +static void rna_def_property_free(StructOrFunctionRNA *cont_, PropertyRNA *prop) { ContainerRNA *cont= cont_; @@ -2860,7 +2880,7 @@ int RNA_def_property_free_identifier(StructOrFunctionRNA *cont_, const char *ide for(prop= cont->properties.first; prop; prop= prop->next) { if(strcmp(prop->identifier, identifier)==0) { if(prop->flag & PROP_RUNTIME) { - RNA_def_property_free(cont_, prop); + rna_def_property_free(cont_, prop); return 1; } else { diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 72f74f5a3e9..c5200181133 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_fcurve.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_access.h" @@ -556,6 +561,7 @@ static BezTriple *rna_FKeyframe_points_insert(FCurve *fcu, float frame, float va static void rna_FKeyframe_points_add(FCurve *fcu, int tot) { if(tot > 0) { + BezTriple *bezt; if(fcu->totvert) { BezTriple *nbezt= MEM_callocN(sizeof(BezTriple) * (fcu->totvert + tot), "rna_FKeyframe_points_add"); memcpy(nbezt, fcu->bezt, sizeof(BezTriple) * fcu->totvert); @@ -566,7 +572,16 @@ static void rna_FKeyframe_points_add(FCurve *fcu, int tot) fcu->bezt= MEM_callocN(sizeof(BezTriple) * tot, "rna_FKeyframe_points_add"); } + bezt= fcu->bezt + fcu->totvert; fcu->totvert += tot; + + while(tot--) { + /* defaults, no userprefs gives pradictable results for API */ + bezt->f1= bezt->f2= bezt->f3= SELECT; + bezt->ipo= BEZT_IPO_BEZ; + bezt->h1= bezt->h2= HD_AUTO; + bezt++; + } } } @@ -583,7 +598,7 @@ static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, BezTri static void rna_fcurve_range(FCurve *fcu, float range[2]) { - calc_fcurve_range(fcu, range, range+1); + calc_fcurve_range(fcu, range, range+1, FALSE); } #else @@ -1204,7 +1219,7 @@ static void rna_def_fpoint(BlenderRNA *brna) RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL); /* Vector value */ - prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ); + prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */ RNA_def_property_float_sdna(prop, NULL, "vec"); RNA_def_property_array(prop, 2); RNA_def_property_ui_text(prop, "Point", "Point coordinates"); @@ -1266,19 +1281,19 @@ static void rna_def_fkeyframe(BlenderRNA *brna) RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); /* Vector values */ - prop= RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION); + prop= RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */ RNA_def_property_array(prop, 2); RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle1_get", "rna_FKeyframe_handle1_set", NULL); RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); - prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION); + prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */ RNA_def_property_array(prop, 2); RNA_def_property_float_funcs(prop, "rna_FKeyframe_ctrlpoint_get", "rna_FKeyframe_ctrlpoint_set", NULL); RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); - prop= RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION); + prop= RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */ RNA_def_property_array(prop, 2); RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle2_get", "rna_FKeyframe_handle2_set", NULL); RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle"); @@ -1414,7 +1429,8 @@ static void rna_def_fcurve(BlenderRNA *brna) RNA_def_property_string_funcs(prop, "rna_FCurve_RnaPath_get", "rna_FCurve_RnaPath_length", "rna_FCurve_RnaPath_set"); RNA_def_property_ui_text(prop, "Data Path", "RNA Path to property affected by F-Curve"); RNA_def_property_update(prop, NC_ANIMATION, NULL); // XXX need an update callback for this to that animation gets evaluated - + + /* called 'index' when given as function arg */ prop= RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE); RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific property affected by F-Curve if applicable"); RNA_def_property_update(prop, NC_ANIMATION, NULL); // XXX need an update callback for this so that animation gets evaluated diff --git a/source/blender/makesrna/intern/rna_fcurve_api.c b/source/blender/makesrna/intern/rna_fcurve_api.c index 12211f33966..a1b84f5bcfe 100644 --- a/source/blender/makesrna/intern/rna_fcurve_api.c +++ b/source/blender/makesrna/intern/rna_fcurve_api.c @@ -24,6 +24,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_fcurve_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> #include <string.h> diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 525f402e5fd..acec2ca7a24 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_fluidsim.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 3b5c8f9e8a9..228b00e7937 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_gpencil.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -40,7 +45,7 @@ static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr) { bGPDlayer *gpl= (bGPDlayer *)ptr->data; - + /* surely there must be other criteria too... */ if (gpl->flag & GP_LAYER_LOCKED) return 0; @@ -48,22 +53,43 @@ static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr) return 1; } -static void rna_GPencilLayer_active_set(PointerRNA *ptr, int value) +static PointerRNA rna_GPencil_active_layer_get(PointerRNA *ptr) { bGPdata *gpd= ptr->id.data; - bGPDlayer *gpl= ptr->data; - - /* disabled all other layers anyway */ - if (GS(gpd->id.name) == ID_GD) { + + if (GS(gpd->id.name) == ID_GD) { /* why would this ever be not GD */ bGPDlayer *gl; - - for (gl= gpd->layers.first; gl; gl= gl->next) - gl->flag &= ~GP_LAYER_ACTIVE; - } - - /* if enabling value, make it active */ - if (value) - gpl->flag |= GP_LAYER_ACTIVE; + + for (gl= gpd->layers.first; gl; gl= gl->next) { + if(gl->flag & GP_LAYER_ACTIVE) { + break; + } + } + + if(gl) { + return rna_pointer_inherit_refine(ptr, &RNA_GPencilLayer, gl); + } + } + + return rna_pointer_inherit_refine(ptr, NULL, NULL); +} + +static void rna_GPencil_active_layer_set(PointerRNA *ptr, PointerRNA value) +{ + bGPdata *gpd= ptr->id.data; + + if (GS(gpd->id.name) == ID_GD) { /* why would this ever be not GD */ + bGPDlayer *gl; + + for (gl= gpd->layers.first; gl; gl= gl->next) { + if(gl == value.data) { + gl->flag |= GP_LAYER_ACTIVE; + } + else { + gl->flag &= ~GP_LAYER_ACTIVE; + } + } + } } #else @@ -213,13 +239,16 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_FRAMELOCK); RNA_def_property_ui_text(prop, "Frame Locked", "Lock current frame displayed by layer"); RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); - + + /* expose as layers.active */ + /* prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ACTIVE); RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencilLayer_active_set"); RNA_def_property_ui_text(prop, "Active", "Set active layer for editing"); RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); - + */ + prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SELECT); RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the DopeSheet"); @@ -230,6 +259,47 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_DRAWDEBUG); RNA_def_property_ui_text(prop, "Show Points", "Draw the points which make up the strokes (for debugging purposes)"); RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); + + /* X-Ray */ + prop= RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_NO_XRAY); + RNA_def_property_ui_text(prop, "X Ray", ""); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); +} + +static void rna_def_gpencil_layers(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + +// FunctionRNA *func; +// PropertyRNA *parm; + + RNA_def_property_srna(cprop, "GreasePencilLayers"); + srna= RNA_def_struct(brna, "GreasePencilLayers", NULL); + RNA_def_struct_sdna(srna, "bGPdata"); + RNA_def_struct_ui_text(srna, "Grease Pencil Layers", "Collection of grease pencil layers"); + +#if 0 + func= RNA_def_function(srna, "new", "rna_GPencil_layer_new"); + RNA_def_function_ui_description(func, "Add a new spline to the curve."); + parm= RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline."); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "rna_GPencil_layer_remove"); + RNA_def_function_ui_description(func, "Remove a spline from a curve."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); +#endif + + prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "GreasePencil"); + RNA_def_property_pointer_funcs(prop, "rna_GPencil_active_layer_get", "rna_GPencil_active_layer_set", NULL, NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Active Layer", "Active grease pencil layer"); } static void rna_def_gpencil_data(BlenderRNA *brna) @@ -254,6 +324,7 @@ static void rna_def_gpencil_data(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "layers", NULL); RNA_def_property_struct_type(prop, "GPencilLayer"); RNA_def_property_ui_text(prop, "Layers", ""); + rna_def_gpencil_layers(brna, prop); /* Flags */ prop= RNA_def_property(srna, "draw_mode", PROP_ENUM, PROP_NONE); @@ -273,7 +344,7 @@ static void rna_def_gpencil_data(BlenderRNA *brna) void RNA_def_gpencil(BlenderRNA *brna) { rna_def_gpencil_data(brna); - + rna_def_gpencil_layer(brna); rna_def_gpencil_frame(brna); rna_def_gpencil_stroke(brna); diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c index ebe6bdd5872..a5097cc8b41 100644 --- a/source/blender/makesrna/intern/rna_group.c +++ b/source/blender/makesrna/intern/rna_group.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_group.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 96d85cda5e7..df5bd9f27f3 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_image.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -229,7 +234,7 @@ static int rna_Image_depth_get(PointerRNA *ptr) if(!ibuf) depth= 0; else if(ibuf->rect_float) - depth= 128; + depth= ibuf->depth * 4; else depth= ibuf->depth; @@ -238,6 +243,74 @@ static int rna_Image_depth_get(PointerRNA *ptr) return depth; } +static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) +{ + Image *ima= ptr->id.data; + ImBuf *ibuf; + void *lock; + + ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock); + + if(ibuf) + length[0]= ibuf->x*ibuf->y*ibuf->channels; + else + length[0]= 0; + + BKE_image_release_ibuf(ima, lock); + + return length[0]; +} + +static void rna_Image_pixels_get(PointerRNA *ptr, float *values) +{ + Image *ima= ptr->id.data; + ImBuf *ibuf; + void *lock; + int i, size; + + ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock); + + if(ibuf) { + size= ibuf->x*ibuf->y*ibuf->channels; + + if(ibuf->rect_float) { + memcpy(values, ibuf->rect_float, sizeof(float)*size); + } + else { + for(i = 0; i < size; i++) + values[i] = ((unsigned char*)ibuf->rect)[i]*(1.0f/255.0f); + } + } + + BKE_image_release_ibuf(ima, lock); +} + +static void rna_Image_pixels_set(PointerRNA *ptr, const float *values) +{ + Image *ima= ptr->id.data; + ImBuf *ibuf; + void *lock; + int i, size; + + ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock); + + if(ibuf) { + size= ibuf->x*ibuf->y*ibuf->channels; + + if(ibuf->rect_float) { + memcpy(ibuf->rect_float, values, sizeof(float)*size); + } + else { + for(i = 0; i < size; i++) + ((unsigned char*)ibuf->rect)[i] = FTOCHAR(values[i]); + } + + ibuf->userflags |= IB_BITMAPDIRTY; + } + + BKE_image_release_ibuf(ima, lock); +} + #else static void rna_def_imageuser(BlenderRNA *brna) @@ -484,6 +557,13 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_int_funcs(prop, "rna_Image_size_get" , NULL, NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop= RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE); + RNA_def_property_flag(prop, PROP_DYNAMIC); + RNA_def_property_multi_array(prop, 1, NULL); + RNA_def_property_ui_text(prop, "Pixels", "Image pixels in floating point values"); + RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length"); + RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL); + RNA_api_image(srna); } diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index c858c25afe1..cc6214fbcd7 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_image_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> #include <string.h> diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 08f1fb7d2a1..4dc98ceb0a4 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_internal.h + * \ingroup RNA + */ + + #ifndef RNA_INTERNAL_H #define RNA_INTERNAL_H diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 35a80fdec79..eb1beb90567 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_internal_types.h + * \ingroup RNA + */ + + #ifndef RNA_INTERNAL_TYPES_H #define RNA_INTERNAL_TYPES_H @@ -341,6 +346,6 @@ struct BlenderRNA { ListBase structs; }; -#define CONTAINER_RNA_ID(cont) (const char *)(((ContainerRNA *)(cont))+1) +#define CONTAINER_RNA_ID(cont) (*(const char **)(((ContainerRNA *)(cont))+1)) #endif /* RNA_INTERNAL_TYPES_H */ diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 464d1d850a1..3f0ccf99266 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_key.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_access.h" @@ -80,7 +85,7 @@ void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value) } /* fix all the animation data which may link to this */ - BKE_all_animdata_fix_paths_rename("keys", oldname, kb->name); + BKE_all_animdata_fix_paths_rename("key_blocks", oldname, kb->name); } static void rna_ShapeKey_value_set(PointerRNA *ptr, float value) @@ -99,7 +104,7 @@ static void rna_ShapeKey_value_range(PointerRNA *ptr, float *min, float *max) } /* epsilon for how close one end of shapekey range can get to the other */ -#define SHAPEKEY_SLIDER_TOL 0.001 +#define SHAPEKEY_SLIDER_TOL 0.001f static void rna_ShapeKey_slider_min_range(PointerRNA *ptr, float *min, float *max) { @@ -343,9 +348,9 @@ static char *rna_ShapeKey_path(PointerRNA *ptr) ID *id= ptr->id.data; if ((id) && (GS(id->name) != ID_KE)) - return BLI_sprintfN("shape_keys.keys[\"%s\"]", kb->name); + return BLI_sprintfN("shape_keys.key_blocks[\"%s\"]", kb->name); else - return BLI_sprintfN("keys[\"%s\"]", kb->name); + return BLI_sprintfN("key_blocks[\"%s\"]", kb->name); } static void rna_Key_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -429,9 +434,9 @@ static char *rna_ShapeKeyPoint_path(PointerRNA *ptr) int index = rna_ShapeKeyPoint_get_index(key, kb, point); if (GS(id->name) == ID_KE) - return BLI_sprintfN("keys[\"%s\"].data[%d]", kb->name, index); + return BLI_sprintfN("key_blocks[\"%s\"].data[%d]", kb->name, index); else - return BLI_sprintfN("shape_keys.keys[\"%s\"].data[%d]", kb->name, index); + return BLI_sprintfN("shape_keys.key_blocks[\"%s\"].data[%d]", kb->name, index); } else return NULL; // XXX: there's really no way to resolve this... @@ -470,7 +475,7 @@ static void rna_def_keydata(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Key_update_data"); srna= RNA_def_struct(brna, "ShapeKeyBezierPoint", NULL); - RNA_def_struct_ui_text(srna, "Shape Key Bezier Point", "Point in a shape key for bezier curves"); + RNA_def_struct_ui_text(srna, "Shape Key Bezier Point", "Point in a shape key for Bezier curves"); RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path"); /* there's nothing type specific here, so this is fine for now */ prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION); @@ -594,10 +599,10 @@ static void rna_def_key(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "refkey"); RNA_def_property_ui_text(prop, "Reference Key", ""); - prop= RNA_def_property(srna, "keys", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "key_blocks", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "block", NULL); RNA_def_property_struct_type(prop, "ShapeKey"); - RNA_def_property_ui_text(prop, "Keys", "Shape keys"); + RNA_def_property_ui_text(prop, "Key Blocks", "Shape keys"); rna_def_animdata_common(srna); diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 63857fad62d..dbb068c9cf0 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -22,9 +22,15 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_lamp.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" +#include "RNA_enum_types.h" #include "rna_internal.h" @@ -132,13 +138,13 @@ static void rna_Lamp_sky_update(Main *bmain, Scene *scene, PointerRNA *ptr) static float rna_Lamp_spot_size_get(PointerRNA *ptr) { Lamp *la= ptr->id.data; - return la->spotsize * (M_PI / 180.0); + return DEG2RADF(la->spotsize); } static void rna_Lamp_spot_size_set(PointerRNA *ptr, float value) { Lamp *la= ptr->id.data; - la->spotsize= value * (180.0 / M_PI); + la->spotsize= RAD2DEGF(value); } @@ -212,25 +218,6 @@ static void rna_def_lamp_sky_settings(BlenderRNA *brna) {2, "CIE", 0, "CIE", ""}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem prop_blendmode_items[] = { - {0, "MIX", 0, "Mix", ""}, - {1, "ADD", 0, "Add", ""}, - {2, "MULTIPLY", 0, "Multiply", ""}, - {3, "SUBTRACT", 0, "Subtract", ""}, - {4, "SCREEN", 0, "Screen", ""}, - {5, "DIVIDE", 0, "Divide", ""}, - {6, "DIFFERENCE", 0, "Difference", ""}, - {7, "DARKEN", 0, "Darken", ""}, - {8, "LIGHTEN", 0, "Lighten", ""}, - {9, "OVERLAY", 0, "Overlay", ""}, - {10, "DODGE", 0, "Dodge", ""}, - {11, "BURN", 0, "Burn", ""}, - {12, "HUE", 0, "Hue", ""}, - {13, "SATURATION", 0, "Saturation", ""}, - {14, "VALUE", 0, "Value", ""}, - {15, "COLOR", 0, "Color", ""}, - {0, NULL, 0, NULL, NULL}}; - srna= RNA_def_struct(brna, "LampSkySettings", NULL); RNA_def_struct_sdna(srna, "Lamp"); RNA_def_struct_nested(brna, srna, "SunLamp"); @@ -244,7 +231,7 @@ static void rna_def_lamp_sky_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "sky_blend_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "skyblendtype"); - RNA_def_property_enum_items(prop, prop_blendmode_items); + RNA_def_property_enum_items(prop, ramp_blend_items); RNA_def_property_ui_text(prop, "Sky Blend Mode", "Blend mode for combining sun sky with world sky"); RNA_def_property_update(prop, 0, "rna_Lamp_sky_update"); @@ -588,7 +575,7 @@ static void rna_def_spot_lamp(BlenderRNA *brna) static EnumPropertyItem prop_shadbuftype_items[] = { {LA_SHADBUF_REGULAR , "REGULAR", 0, "Classical", "Classic shadow buffer"}, - {LA_SHADBUF_HALFWAY, "HALFWAY", 0, "Classic-Halfway", "Regular buffer, averaging the closest and 2nd closest Z value to reducing bias artifaces"}, + {LA_SHADBUF_HALFWAY, "HALFWAY", 0, "Classic-Halfway", "Regular buffer, averaging the closest and 2nd closest Z value to reducing bias artifacts"}, {LA_SHADBUF_IRREGULAR, "IRREGULAR", 0, "Irregular", "Irregular buffer produces sharp shadow always, but it doesn't show up for raytracing"}, {LA_SHADBUF_DEEP, "DEEP", 0, "Deep", "Deep shadow buffer supports transparency and better filtering, at the cost of more memory usage and processing time"}, {0, NULL, 0, NULL, NULL}}; @@ -662,7 +649,7 @@ static void rna_def_spot_lamp(BlenderRNA *brna) prop= RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_ANGLE); // RNA_def_property_float_sdna(prop, NULL, "spotsize"); - RNA_def_property_range(prop, M_PI/180.0f, M_PI); + RNA_def_property_range(prop, M_PI/180.0, M_PI); RNA_def_property_ui_text(prop, "Spot Size", "Angle of the spotlight beam in degrees"); RNA_def_property_float_funcs(prop, "rna_Lamp_spot_size_get", "rna_Lamp_spot_size_set", NULL); /* only for deg/rad conversion */ RNA_def_property_update(prop, 0, "rna_Lamp_draw_update"); diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 5d5480e3761..a3503999a4c 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_lattice.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index b01d217376a..eedf199bf1c 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_main.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <string.h> @@ -37,9 +42,20 @@ /* all the list begin functions are added manually here, Main is not in SDNA */ +static int rna_Main_is_saved_get(PointerRNA *ptr) +{ + return G.relbase_valid; +} + static int rna_Main_is_dirty_get(PointerRNA *ptr) { - return !G.relbase_valid; + /* XXX, not totally nice to do it this way, should store in main ? */ + wmWindowManager *wm; + for(wm= G.main->wm.first; wm; wm= wm->id.next) { + return !wm->file_saved; + } + + return TRUE; } static void rna_Main_filepath_get(PointerRNA *ptr, char *value) @@ -277,7 +293,7 @@ void RNA_def_main(BlenderRNA *brna) {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks.", RNA_def_main_brushes}, {"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks.", RNA_def_main_worlds}, {"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks.", RNA_def_main_groups}, - {"shape_keys", "Key", "rna_Main_key_begin", "Keys", "Key datablocks.", NULL}, + {"shape_keys", "Key", "rna_Main_key_begin", "Shape Keys", "Shape Key datablocks.", NULL}, {"scripts", "ID", "rna_Main_script_begin", "Scripts", "Script datablocks (DEPRECATED).", NULL}, {"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks.", RNA_def_main_texts}, {"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks.", RNA_def_main_sounds}, @@ -302,6 +318,11 @@ void RNA_def_main(BlenderRNA *brna) prop= RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Main_is_dirty_get", NULL); + RNA_def_property_ui_text(prop, "File is Saved", "Have recent edits been saved to disk"); + + prop= RNA_def_property(srna, "is_saved", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_is_saved_get", NULL); RNA_def_property_ui_text(prop, "File is Saved", "Has the current session been saved to disk as a .blend file"); for(i=0; lists[i].name; i++) diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 9b3f4209edd..07c2313e50f 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_main_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> #include <errno.h> @@ -532,6 +537,7 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataCameras"); srna= RNA_def_struct(brna, "BlendDataCameras", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras"); func= RNA_def_function(srna, "new", "rna_Main_cameras_new"); @@ -561,6 +567,7 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataScenes"); srna= RNA_def_struct(brna, "BlendDataScenes", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Scenes", "Collection of scenes"); func= RNA_def_function(srna, "new", "rna_Main_scenes_new"); @@ -586,6 +593,7 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataObjects"); srna= RNA_def_struct(brna, "BlendDataObjects", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Objects", "Collection of objects"); func= RNA_def_function(srna, "new", "rna_Main_objects_new"); @@ -619,6 +627,7 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataMaterials"); srna= RNA_def_struct(brna, "BlendDataMaterials", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Material", "Collection of materials"); func= RNA_def_function(srna, "new", "rna_Main_materials_new"); @@ -653,6 +662,7 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataNodeTrees"); srna= RNA_def_struct(brna, "BlendDataNodeTrees", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees"); func= RNA_def_function(srna, "new", "rna_Main_nodetree_new"); @@ -683,6 +693,7 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataMeshes"); srna= RNA_def_struct(brna, "BlendDataMeshes", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Meshes", "Collection of meshes"); func= RNA_def_function(srna, "new", "rna_Main_meshes_new"); @@ -711,6 +722,7 @@ void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataLamps"); srna= RNA_def_struct(brna, "BlendDataLamps", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Lamps", "Collection of lamps"); func= RNA_def_function(srna, "new", "rna_Main_lamps_new"); @@ -742,6 +754,7 @@ void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataLibraries"); srna= RNA_def_struct(brna, "BlendDataLibraries", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Libraries", "Collection of libraries"); func= RNA_def_function(srna, "tag", "rna_Main_libraries_tag"); @@ -757,6 +770,7 @@ void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataScreens"); srna= RNA_def_struct(brna, "BlendDataScreens", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Screens", "Collection of screens"); func= RNA_def_function(srna, "tag", "rna_Main_screens_tag"); @@ -772,6 +786,7 @@ void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataWindowManagers"); srna= RNA_def_struct(brna, "BlendDataWindowManagers", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Window Managers", "Collection of window managers"); func= RNA_def_function(srna, "tag", "rna_Main_window_managers_tag"); @@ -786,6 +801,7 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataImages"); srna= RNA_def_struct(brna, "BlendDataImages", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Images", "Collection of images"); func= RNA_def_function(srna, "new", "rna_Main_images_new"); @@ -830,6 +846,7 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataLattices"); srna= RNA_def_struct(brna, "BlendDataLattices", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices"); func= RNA_def_function(srna, "new", "rna_Main_lattices_new"); @@ -858,6 +875,7 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataCurves"); srna= RNA_def_struct(brna, "BlendDataCurves", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Curves", "Collection of curves"); func= RNA_def_function(srna, "new", "rna_Main_curves_new"); @@ -888,6 +906,7 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataMetaBalls"); srna= RNA_def_struct(brna, "BlendDataMetaBalls", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main MetaBall", "Collection of metaballs"); func= RNA_def_function(srna, "new", "rna_Main_metaballs_new"); @@ -916,6 +935,7 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataFonts"); srna= RNA_def_struct(brna, "BlendDataFonts", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts"); func= RNA_def_function(srna, "load", "rna_Main_fonts_load"); @@ -945,6 +965,7 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataTextures"); srna= RNA_def_struct(brna, "BlendDataTextures", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Textures", "Collection of groups"); func= RNA_def_function(srna, "new", "rna_Main_textures_new"); @@ -975,6 +996,7 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataBrushes"); srna= RNA_def_struct(brna, "BlendDataBrushes", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes"); func= RNA_def_function(srna, "new", "rna_Main_brushes_new"); @@ -1004,6 +1026,7 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataWorlds"); srna= RNA_def_struct(brna, "BlendDataWorlds", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds"); func= RNA_def_function(srna, "new", "rna_Main_worlds_new"); @@ -1033,6 +1056,7 @@ void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataGroups"); srna= RNA_def_struct(brna, "BlendDataGroups", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Groups", "Collection of groups"); func= RNA_def_function(srna, "new", "rna_Main_groups_new"); @@ -1060,6 +1084,7 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataTexts"); srna= RNA_def_struct(brna, "BlendDataTexts", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Texts", "Collection of texts"); func= RNA_def_function(srna, "new", "rna_Main_texts_new"); @@ -1098,6 +1123,7 @@ void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataSounds"); srna= RNA_def_struct(brna, "BlendDataSounds", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds"); /* TODO, 'load' */ @@ -1115,6 +1141,7 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataArmatures"); srna= RNA_def_struct(brna, "BlendDataArmatures", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Armatures", "Collection of armatures"); func= RNA_def_function(srna, "new", "rna_Main_armatures_new"); @@ -1143,6 +1170,7 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataActions"); srna= RNA_def_struct(brna, "BlendDataActions", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Actions", "Collection of actions"); func= RNA_def_function(srna, "new", "rna_Main_actions_new"); @@ -1171,6 +1199,7 @@ void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataParticles"); srna= RNA_def_struct(brna, "BlendDataParticles", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings"); func= RNA_def_function(srna, "new", "rna_Main_particles_new"); @@ -1200,6 +1229,7 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataGreasePencils"); srna= RNA_def_struct(brna, "BlendDataGreasePencils", NULL); + RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils"); func= RNA_def_function(srna, "tag", "rna_Main_gpencil_tag"); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 7732e9157bd..909c824074e 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_material.c + * \ingroup RNA + */ + + #include <float.h> #include <stdlib.h> @@ -49,6 +54,27 @@ static EnumPropertyItem prop_texture_coordinates_items[] = { {TEXCO_TANGENT, "TANGENT", 0, "Tangent", "Uses the optional tangent vector as texture coordinates"}, {0, NULL, 0, NULL, NULL}}; +EnumPropertyItem ramp_blend_items[] = { +{MA_RAMP_BLEND, "MIX", 0, "Mix", ""}, +{MA_RAMP_ADD, "ADD", 0, "Add", ""}, +{MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""}, +{MA_RAMP_SUB, "SUBTRACT", 0, "Subtract", ""}, +{MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""}, +{MA_RAMP_DIV, "DIVIDE", 0, "Divide", ""}, +{MA_RAMP_DIFF, "DIFFERENCE", 0, "Difference", ""}, +{MA_RAMP_DARK, "DARKEN", 0, "Darken", ""}, +{MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""}, +{MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""}, +{MA_RAMP_DODGE, "DODGE", 0, "Dodge", ""}, +{MA_RAMP_BURN, "BURN", 0, "Burn", ""}, +{MA_RAMP_HUE, "HUE", 0, "Hue", ""}, +{MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""}, +{MA_RAMP_VAL, "VALUE", 0, "Value", ""}, +{MA_RAMP_COLOR, "COLOR", 0, "Color", ""}, +{MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""}, +{MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""}, +{0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME #include "MEM_guardedalloc.h" @@ -706,27 +732,6 @@ static void rna_def_material_mtex(BlenderRNA *brna) static void rna_def_material_colors(StructRNA *srna) { PropertyRNA *prop; - - static EnumPropertyItem prop_ramp_blend_diffuse_items[] = { - {MA_RAMP_BLEND, "MIX", 0, "Mix", ""}, - {MA_RAMP_ADD, "ADD", 0, "Add", ""}, - {MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""}, - {MA_RAMP_SUB, "SUBTRACT", 0, "Subtract", ""}, - {MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""}, - {MA_RAMP_DIV, "DIVIDE", 0, "Divide", ""}, - {MA_RAMP_DIFF, "DIFFERENCE", 0, "Difference", ""}, - {MA_RAMP_DARK, "DARKEN", 0, "Darken", ""}, - {MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""}, - {MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""}, - {MA_RAMP_DODGE, "DODGE", 0, "Dodge", ""}, - {MA_RAMP_BURN, "BURN", 0, "Burn", ""}, - {MA_RAMP_HUE, "HUE", 0, "Hue", ""}, - {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""}, - {MA_RAMP_VAL, "VALUE", 0, "Value", ""}, - {MA_RAMP_COLOR, "COLOR", 0, "Color", ""}, - {MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""}, - {MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""}, - {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_ramp_input_items[] = { {MA_RAMP_IN_SHADER, "SHADER", 0, "Shader", ""}, @@ -791,13 +796,13 @@ static void rna_def_material_colors(StructRNA *srna) prop= RNA_def_property(srna, "diffuse_ramp_blend", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "rampblend_col"); - RNA_def_property_enum_items(prop, prop_ramp_blend_diffuse_items); + RNA_def_property_enum_items(prop, ramp_blend_items); RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", ""); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "specular_ramp_blend", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "rampblend_spec"); - RNA_def_property_enum_items(prop, prop_ramp_blend_diffuse_items); + RNA_def_property_enum_items(prop, ramp_blend_items); RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", ""); RNA_def_property_update(prop, 0, "rna_Material_update"); @@ -1235,7 +1240,7 @@ static void rna_def_material_halo(BlenderRNA *brna) prop= RNA_def_property(srna, "use_flare_mode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_FLARE); /* use bitflags */ - RNA_def_property_ui_text(prop, "Flare", "Renders halo as a lensflare"); + RNA_def_property_ui_text(prop, "Flare", "Renders halo as a lens flare"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_size", PROP_FLOAT, PROP_NONE); @@ -1247,7 +1252,7 @@ static void rna_def_material_halo(BlenderRNA *brna) prop= RNA_def_property(srna, "flare_subflare_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "subsize"); RNA_def_property_range(prop, 0.1f, 25.0f); - RNA_def_property_ui_text(prop, "Flare Subsize", "Sets the dimension of the subflares, dots and circles"); + RNA_def_property_ui_text(prop, "Flare Subsize", "Sets the dimension of the sub-flares, dots and circles"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_boost", PROP_FLOAT, PROP_NONE); @@ -1265,7 +1270,7 @@ static void rna_def_material_halo(BlenderRNA *brna) prop= RNA_def_property(srna, "flare_subflare_count", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "flarec"); RNA_def_property_range(prop, 1, 32); - RNA_def_property_ui_text(prop, "Flares Sub", "Sets the number of subflares"); + RNA_def_property_ui_text(prop, "Flares Sub", "Sets the number of sub-flares"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_ring", PROP_BOOLEAN, PROP_NONE); @@ -1520,31 +1525,33 @@ static void rna_def_material_physics(BlenderRNA *brna) RNA_def_struct_nested(brna, srna, "Material"); RNA_def_struct_ui_text(srna, "Material Physics", "Physics settings for a Material datablock"); - prop= RNA_def_property(srna, "use_normal_align", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "dynamode", MA_FH_NOR); - RNA_def_property_ui_text(prop, "Align to Normal", "Align dynamic game objects along the surface normal, when inside the physics distance area"); - prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "friction"); RNA_def_property_range(prop, 0, 100); RNA_def_property_ui_text(prop, "Friction", "Coulomb friction coefficient, when inside the physics distance area"); - prop= RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "fh"); - RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_text(prop, "Force", "Upward spring force, when inside the physics distance area"); - prop= RNA_def_property(srna, "elasticity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "reflect"); RNA_def_property_range(prop, 0, 1); RNA_def_property_ui_text(prop, "Elasticity", "Elasticity of collisions"); + + /* FH/Force Field Settings */ + prop= RNA_def_property(srna, "use_fh_normal", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "dynamode", MA_FH_NOR); + RNA_def_property_ui_text(prop, "Align to Normal", "Align dynamic game objects along the surface normal, when inside the physics distance area"); + + prop= RNA_def_property(srna, "fh_force", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "fh"); + RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2); + RNA_def_property_ui_text(prop, "Force", "Upward spring force, when inside the physics distance area"); - prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "fh_distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fhdist"); RNA_def_property_range(prop, 0, 20); RNA_def_property_ui_text(prop, "Distance", "Distance of the physics area"); - prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xyfrict"); RNA_def_property_range(prop, 0, 1); RNA_def_property_ui_text(prop, "Damping", "Damping of the spring force, when inside the physics distance area"); @@ -1562,6 +1569,7 @@ void RNA_def_material(BlenderRNA *brna) {MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem transparency_items[] = { + {0, "MASK", 0, "Mask", "Mask the background"}, {MA_ZTRANSP, "Z_TRANSPARENCY", 0, "Z Transparency", "Use alpha buffer for transparent faces"}, {MA_RAYTRANSP, "RAYTRACE", 0, "Raytrace", "Use raytracing for transparent refraction rendering"}, {0, NULL, 0, NULL, NULL}}; @@ -1576,6 +1584,12 @@ void RNA_def_material(BlenderRNA *brna) {MA_SPHERE_A, "SPHERE_A", ICON_MAT_SPHERE_SKY, "Flat", "Preview type: Large sphere with sky"}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem prop_shadows_only_items[] = { + {MA_SO_OLD, "SHADOW_ONLY_OLD", 0, "Shadow and Distance", ""}, + {MA_SO_SHADOW, "SHADOW_ONLY", 0, "Shadow Only", ""}, + {MA_SO_SHADED, "SHADOW_ONLY_SHADED", 0, "Shadow and Shading", ""}, + {0, NULL, 0, NULL, NULL}}; + srna= RNA_def_struct(brna, "Material", "ID"); RNA_def_struct_ui_text(srna, "Material", "Material datablock to defined the appearance of geometric objects for rendering"); RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA); @@ -1706,6 +1720,12 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ONLYSHADOW); RNA_def_property_ui_text(prop, "Only Shadow", "Renders shadows as the material's alpha value, making materials transparent except for shadowed areas"); RNA_def_property_update(prop, 0, "rna_Material_update"); + + prop= RNA_def_property(srna, "shadow_only_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "shadowonly_flag"); + RNA_def_property_enum_items(prop, prop_shadows_only_items); + RNA_def_property_ui_text(prop, "Shadow Type", "How to draw shadows"); + RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_face_texture", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE); @@ -1729,7 +1749,7 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_transparent_shadows", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADOW_TRA); - RNA_def_property_ui_text(prop, "Receive Transparent Shadows", "Allow this object to receive transparent shadows casted through other objects"); + RNA_def_property_ui_text(prop, "Receive Transparent Shadows", "Allow this object to receive transparent shadows cast through other objects"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_ray_shadow_bias", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c index 063f87caa3a..f563f53744b 100644 --- a/source/blender/makesrna/intern/rna_material_api.c +++ b/source/blender/makesrna/intern/rna_material_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_material_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index dd072ba99c0..babe6d9c6b0 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -26,6 +26,10 @@ getting info on the layers themselves, accessing the data is done through the (not yet written) mpoly interfaces.*/ +/** \file blender/makesrna/intern/rna_mesh.c + * \ingroup RNA + */ + #include <stdlib.h> #include "RNA_define.h" @@ -1915,7 +1919,7 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_TOPO); - RNA_def_property_ui_text(prop, "Topology Mirror", "Use topology based mirroring"); + RNA_def_property_ui_text(prop, "Topology Mirror", "Use topology based mirroring. For when both sides of mesh have matching, unique topology"); prop= RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_MASK); diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index f6c9405dc78..8912a576710 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_mesh_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index e575ecabac9..d94fa130163 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_meta.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -232,8 +237,8 @@ static void rna_def_metaball_elements(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "new", "rna_MetaBall_elements_new"); RNA_def_function_ui_description(func, "Add a new spline to the curve."); - RNA_def_enum(func, "type", metaelem_type_items, MB_BALL, "", "type for the new meta element."); - parm= RNA_def_pointer(func, "element", "MetaElement", "", "The newly created metaelement."); + RNA_def_enum(func, "type", metaelem_type_items, MB_BALL, "", "type for the new meta-element."); + parm= RNA_def_pointer(func, "element", "MetaElement", "", "The newly created meta-element."); RNA_def_function_return(func, parm); func= RNA_def_function(srna, "remove", "rna_MetaBall_elements_remove"); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index f37598743c1..d04d24f35f2 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_modifier.c + * \ingroup RNA + */ + + #include <float.h> #include <limits.h> #include <stdlib.h> @@ -435,9 +440,12 @@ static void modifier_object_set(Object *self, Object **ob_p, int type, PointerRN { Object *ob= value.data; - if(!self || ob != self) - if(!ob || type == OB_EMPTY || ob->type == type) + if(!self || ob != self) { + if(!ob || type == OB_EMPTY || ob->type == type) { + id_lib_extern((ID *)ob); *ob_p= ob; + } + } } static void rna_LatticeModifier_object_set(PointerRNA *ptr, PointerRNA value) @@ -795,7 +803,7 @@ static void rna_def_modifier_mirror(BlenderRNA *brna) prop= RNA_def_property(srna, "use_mirror_merge", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MOD_MIR_NO_MERGE); - RNA_def_property_ui_text(prop, "Merge Verticies", "Merge vertices within the merge threshold"); + RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices within the merge threshold"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "use_mirror_u", PROP_BOOLEAN, PROP_NONE); @@ -1124,7 +1132,7 @@ static void rna_def_modifier_boolean(BlenderRNA *brna) prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Object", "Mesh object to use for Boolean operation"); - RNA_def_property_pointer_funcs(prop, NULL, "rna_BooleanModifier_object_set", NULL, NULL); + RNA_def_property_pointer_funcs(prop, NULL, "rna_BooleanModifier_object_set", NULL, "rna_Mesh_object_poll"); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); @@ -2160,6 +2168,18 @@ static void rna_def_modifier_solidify(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Rim Crease", "Assign a crease to the edges making up the rim"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop= RNA_def_property(srna, "material_offset", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "mat_ofs"); + RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX); + RNA_def_property_ui_text(prop, "Material Offset", "Offset material index of generated faces"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop= RNA_def_property(srna, "material_offset_rim", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "mat_ofs_rim"); + RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX); + RNA_def_property_ui_text(prop, "Rim Material Offset", "Offset material index of generated rim faces"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "defgrp_name"); RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name"); @@ -2170,11 +2190,6 @@ static void rna_def_modifier_solidify(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_RIM); RNA_def_property_ui_text(prop, "Fill Rim", "Create edge loops between the inner and outer surfaces on face edges (slow, disable when not needed)"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - - prop= RNA_def_property(srna, "use_rim_material", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_RIM_MATERIAL); - RNA_def_property_ui_text(prop, "Rim Material", "Use in the next material for rim faces"); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_EVEN); diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index d63fd39a728..5fba18bb6cd 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_nla.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -158,7 +163,7 @@ static void rna_NlaStrip_end_frame_set(PointerRNA *ptr, float value) len= data->end - data->start; actlen= data->actend - data->actstart; - if (IS_EQ(actlen, 0.0f)) actlen= 1.0f; + if (IS_EQF(actlen, 0.0f)) actlen= 1.0f; /* now, adjust the 'scale' setting to reflect this (so that this change can be valid) */ data->scale= len / ((actlen) * data->repeat); @@ -291,7 +296,7 @@ static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *repo * - only the nla_tracks list is needed there, which we aim to reverse engineer here... */ { - AnimData adt = {0}; + AnimData adt = {NULL}; NlaTrack *nlt, *nlt_p; /* 'first' NLA track is found by going back up chain of given track's parents until we fall off */ @@ -332,9 +337,9 @@ static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *report /* enum defines exported for rna_animation.c */ EnumPropertyItem nla_mode_blend_items[] = { {NLASTRIP_MODE_REPLACE, "REPLACE", 0, "Replace", "Result strip replaces the accumulated results by amount specified by influence"}, - {NLASTRIP_MODE_ADD, "ADD", 0, "Add", "Weighted result of strip is added to the accumlated results"}, - {NLASTRIP_MODE_SUBTRACT, "SUBTRACT", 0, "Subtract", "Weighted result of strip is removed from the accumlated results"}, - {NLASTRIP_MODE_MULTIPLY, "MULITPLY", 0, "Multiply", "Weighted result of strip is multiplied with the accumlated results"}, + {NLASTRIP_MODE_ADD, "ADD", 0, "Add", "Weighted result of strip is added to the accumulated results"}, + {NLASTRIP_MODE_SUBTRACT, "SUBTRACT", 0, "Subtract", "Weighted result of strip is removed from the accumulated results"}, + {NLASTRIP_MODE_MULTIPLY, "MULITPLY", 0, "Multiply", "Weighted result of strip is multiplied with the accumulated results"}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem nla_mode_extend_items[] = { {NLASTRIP_EXTEND_NOTHING, "NOTHING", 0, "Nothing", "Strip has no influence past its extents"}, diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index a526f360355..0dd536b64c2 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -22,10 +22,16 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_nodetree.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <string.h> #include "RNA_define.h" +#include "RNA_enum_types.h" #include "rna_internal.h" @@ -54,27 +60,6 @@ EnumPropertyItem node_socket_type_items[] = { {SOCK_RGBA, "RGBA", 0, "RGBA", ""}, {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem node_blend_type_items[] = { -{ 0, "MIX", 0, "Mix", ""}, -{ 1, "ADD", 0, "Add", ""}, -{ 3, "SUBTRACT", 0, "Subtract", ""}, -{ 2, "MULTIPLY", 0, "Multiply", ""}, -{ 4, "SCREEN", 0, "Screen", ""}, -{ 9, "OVERLAY", 0, "Overlay", ""}, -{ 5, "DIVIDE", 0, "Divide", ""}, -{ 6, "DIFFERENCE", 0, "Difference", ""}, -{ 7, "DARKEN", 0, "Darken", ""}, -{ 8, "LIGHTEN", 0, "Lighten", ""}, -{10, "DODGE", 0, "Dodge", ""}, -{11, "BURN", 0, "Burn", ""}, -{15, "COLOR", 0, "Color", ""}, -{14, "VALUE", 0, "Value", ""}, -{13, "SATURATION", 0, "Saturation", ""}, -{12, "HUE", 0, "Hue", ""}, -{16, "SOFT_LIGHT", 0, "Soft Light", ""}, -{17, "LINEAR_LIGHT", 0, "Linear Light",""}, -{0, NULL, 0, NULL, NULL}}; - EnumPropertyItem node_math_items[] = { { 0, "ADD", 0, "Add", ""}, { 1, "SUBTRACT", 0, "Subtract", ""}, @@ -312,55 +297,6 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value) BKE_all_animdata_fix_paths_rename("nodes", oldname, node->name); } -/* this should be done at display time! if no custom names are set */ -#if 0 -static void rna_Node_update_username(Main *bmain, Scene *scene, PointerRNA *ptr) -{ - bNode *node= (bNode*)ptr->data; - const char *name; - - - /* - if (!node->username[0]) { - if(node->id) { - BLI_strncpy(node->username, node->id->name+2, NODE_MAXSTR); - } - else { - - switch(node->typeinfo->type) { - case SH_NODE_MIX_RGB: - case CMP_NODE_MIX_RGB: - case TEX_NODE_MIX_RGB: - if(RNA_enum_name(node_blend_type_items, node->custom1, &name)) - BLI_strncpy(node->username, name, NODE_MAXSTR); - break; - case CMP_NODE_FILTER: - if(RNA_enum_name(node_filter_items, node->custom1, &name)) - BLI_strncpy(node->username, name, NODE_MAXSTR); - break; - case CMP_NODE_FLIP: - if(RNA_enum_name(node_flip_items, node->custom1, &name)) - BLI_strncpy(node->username, name, NODE_MAXSTR); - break; - case SH_NODE_MATH: - case CMP_NODE_MATH: - case TEX_NODE_MATH: - if(RNA_enum_name(node_math_items, node->custom1, &name)) - BLI_strncpy(node->username, name, NODE_MAXSTR); - break; - case SH_NODE_VECT_MATH: - if(RNA_enum_name(node_vec_math_items, node->custom1, &name)) - BLI_strncpy(node->username, name, NODE_MAXSTR); - break; - } - */ - } - } - - rna_Node_update(bmain, scene, ptr); -} -#endif - static void rna_NodeSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bNodeTree *ntree= (bNodeTree*)ptr->id.data; @@ -596,15 +532,14 @@ static void rna_NodeTree_node_remove(bNodeTree *ntree, ReportList *reports, bNod static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, bNodeSocket *in, bNodeSocket *out) { bNodeLink *ret; - bNode *fromnode, *tonode; - - if (!nodeFindNode(ntree, in, &fromnode, NULL, NULL)) { - BKE_reportf(reports, RPT_ERROR, "Unable to locate input socket's node in nodetree"); - return NULL; - } + bNode *fromnode= NULL, *tonode= NULL; + int from_in_out, to_in_out; - if (!nodeFindNode(ntree, out, &tonode, NULL, NULL)) { - BKE_reportf(reports, RPT_ERROR, "Unable to locate output socket's node in nodetree"); + nodeFindNode(ntree, in, &fromnode, NULL, &from_in_out); + nodeFindNode(ntree, out, &tonode, NULL, &to_in_out); + + if (&from_in_out == &to_in_out) { + BKE_reportf(reports, RPT_ERROR, "Same input/output direction of sockets"); return NULL; } @@ -941,7 +876,7 @@ static void def_mix_rgb(StructRNA *srna) prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "custom1"); - RNA_def_property_enum_items(prop, node_blend_type_items); + RNA_def_property_enum_items(prop, ramp_blend_items); RNA_def_property_ui_text(prop, "Blend Type", ""); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); @@ -1279,7 +1214,7 @@ static void def_cmp_vector_blur(StructRNA *srna) prop = RNA_def_property(srna, "use_curved", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "curved", 1); - RNA_def_property_ui_text(prop, "Curved", "Interpolate between frames in a bezier curve, rather than linearly"); + RNA_def_property_ui_text(prop, "Curved", "Interpolate between frames in a Bezier curve, rather than linearly"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } @@ -1612,7 +1547,7 @@ static void def_cmp_color_spill(StructRNA *srna) prop = RNA_def_property(srna, "use_unspill", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "unspill", 0); - RNA_def_property_ui_text(prop, "Unspill", "Compensate all channels (diffenrently) by hand"); + RNA_def_property_ui_text(prop, "Unspill", "Compensate all channels (differently) by hand"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "unspill_red", PROP_FLOAT, PROP_NONE); @@ -1874,13 +1809,13 @@ static void def_cmp_defocus(StructRNA *srna) prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "no_zbuf", 1); - RNA_def_property_ui_text(prop, "Use Z-Buffer", "Disable when using an image as input instead of actual zbuffer (auto enabled if node not image based, eg. time node)"); + RNA_def_property_ui_text(prop, "Use Z-Buffer", "Disable when using an image as input instead of actual z-buffer (auto enabled if node not image based, eg. time node)"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "scale"); RNA_def_property_range(prop, 0.0f, 1000.0f); - RNA_def_property_ui_text(prop, "Z-Scale", "Scales the Z input when not using a zbuffer, controls maximum blur designated by the color white or input value 1"); + RNA_def_property_ui_text(prop, "Z-Scale", "Scales the Z input when not using a z-buffer, controls maximum blur designated by the color white or input value 1"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } @@ -2680,7 +2615,7 @@ static void rna_def_node(BlenderRNA *brna) RNA_def_property_update(prop, NC_NODE, "rna_Node_update"); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Name", "Node name"); + RNA_def_property_ui_text(prop, "Name", "Unique node identifier"); RNA_def_struct_name_property(srna, prop); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Node_name_set"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); @@ -2694,6 +2629,11 @@ static void rna_def_node(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL); RNA_def_property_struct_type(prop, "NodeSocket"); RNA_def_property_ui_text(prop, "Outputs", ""); + + prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "label"); + RNA_def_property_ui_text(prop, "Label", "Optional custom node label"); + RNA_def_property_update(prop, NC_NODE, "rna_Node_update"); } static void rna_def_node_link(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h index 0dd622924fc..d48df85697a 100644 --- a/source/blender/makesrna/intern/rna_nodetree_types.h +++ b/source/blender/makesrna/intern/rna_nodetree_types.h @@ -21,6 +21,11 @@ * * ***** END GPL LICENSE BLOCK ***** */ + +/** \file blender/makesrna/intern/rna_nodetree_types.h + * \ingroup RNA + */ + /* Tree type Node ID RNA def function Enum name Struct name UI Name UI Description */ DefNode( ShaderNode, SH_NODE_OUTPUT, 0, "OUTPUT", Output, "Output", "" ) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 48054604a25..b73c447e860 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_object.c + * \ingroup RNA + */ + + #include <stdio.h> #include <stdlib.h> @@ -1301,7 +1306,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem body_type_items[] = { - {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", "Disable colision for this object"}, + {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", "Disable collision for this object"}, {OB_BODY_TYPE_STATIC, "STATIC", 0, "Static", "Stationary object"}, {OB_BODY_TYPE_DYNAMIC, "DYNAMIC", 0, "Dynamic", "Linear physics"}, {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", "Linear and angular physics"}, @@ -1431,9 +1436,9 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); - prop= RNA_def_property(srna, "use_material_physics", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_DO_FH); - RNA_def_property_ui_text(prop, "Use Material Physics", "Use physics settings in materials"); + RNA_def_property_ui_text(prop, "Use Material Force Field", "React to force field physics settings in materials"); prop= RNA_def_property(srna, "use_rotate_from_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH); diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index f2e12c91c49..2a369ba9044 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_object_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -34,6 +39,7 @@ #include "RNA_define.h" #include "DNA_object_types.h" +#include "DNA_modifier_types.h" // #include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */ @@ -72,12 +78,12 @@ /* copied from Mesh_getFromObject and adapted to RNA interface */ /* settings: 0 - preview, 1 - render */ -static Mesh *rna_Object_create_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings) +static Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings) { Mesh *tmpmesh; Curve *tmpcu = NULL; Object *tmpobj = NULL; - int render = settings, i; + int render = settings == eModifierMode_Render, i; int cage = !apply_modifiers; /* perform the mesh extraction based on type */ @@ -372,7 +378,7 @@ static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start[3], float ray_end[3], float r_location[3], float r_normal[3], int *index) { - BVHTreeFromMesh treeData= {0}; + BVHTreeFromMesh treeData= {NULL}; if(ob->derivedFinal==NULL) { BKE_reportf(reports, RPT_ERROR, "object \"%s\" has no mesh data to be used for ray casting.", ob->id.name+2); @@ -416,6 +422,11 @@ void rna_ObjectBase_layers_from_view(Base *base, View3D *v3d) base->lay= base->object->lay= v3d->lay; } +int rna_Object_is_modified(Object *ob, Scene *scene, int settings) +{ + return object_is_modified(scene, ob) & settings; +} + #else void RNA_api_object(StructRNA *srna) @@ -424,13 +435,13 @@ void RNA_api_object(StructRNA *srna) PropertyRNA *parm; static EnumPropertyItem mesh_type_items[] = { - {0, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, - {1, "RENDER", 0, "Render", "Apply modifier render settings"}, + {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, + {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"}, {0, NULL, 0, NULL, NULL} }; /* mesh */ - func= RNA_def_function(srna, "create_mesh", "rna_Object_create_mesh"); + func= RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh"); RNA_def_function_ui_description(func, "Create a Mesh datablock with modifiers applied."); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers."); @@ -443,13 +454,13 @@ void RNA_api_object(StructRNA *srna) RNA_def_function_return(func, parm); /* duplis */ - func= RNA_def_function(srna, "create_dupli_list", "rna_Object_create_duplilist"); + func= RNA_def_function(srna, "dupli_list_create", "rna_Object_create_duplilist"); RNA_def_function_ui_description(func, "Create a list of dupli objects for this object, needs to be freed manually with free_dupli_list to restore the objects real matrix and layers."); parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); RNA_def_function_flag(func, FUNC_USE_REPORTS); - func= RNA_def_function(srna, "free_dupli_list", "rna_Object_free_duplilist"); + func= RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist"); RNA_def_function_ui_description(func, "Free the list of dupli objects."); /* Armature */ @@ -495,7 +506,17 @@ void RNA_api_object(StructRNA *srna) RNA_def_function_ui_description(func, "Determine if object is visible in a given scene."); parm= RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); - parm= RNA_def_boolean(func, "is_visible", 0, "", "Object visibility."); + parm= RNA_def_boolean(func, "result", 0, "", "Object visibility."); + RNA_def_function_return(func, parm); + + /* utility function for checking if the object is modified */ + func= RNA_def_function(srna, "is_modified", "rna_Object_is_modified"); + RNA_def_function_ui_description(func, "Determine if this object is modified from the base mesh data."); + parm= RNA_def_pointer(func, "scene", "Scene", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + parm= RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply."); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_boolean(func, "result", 0, "", "Object visibility."); RNA_def_function_return(func, parm); } diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index fe69fefa879..9aedcab1301 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_object_force.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -472,12 +477,12 @@ static void rna_FieldSettings_update(Main *bmain, Scene *scene, PointerRNA *ptr) if(part->pd->forcefield != PFIELD_TEXTURE && part->pd->tex) { part->pd->tex->id.us--; - part->pd->tex= 0; + part->pd->tex= NULL; } if(part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) { part->pd2->tex->id.us--; - part->pd2->tex= 0; + part->pd2->tex= NULL; } DAG_id_tag_update(&part->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME|PSYS_RECALC_RESET); @@ -489,7 +494,7 @@ static void rna_FieldSettings_update(Main *bmain, Scene *scene, PointerRNA *ptr) if(ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) { ob->pd->tex->id.us--; - ob->pd->tex= 0; + ob->pd->tex= NULL; } DAG_id_tag_update(&ob->id, OB_RECALC_OB); @@ -1653,7 +1658,7 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "fuzzyness"); RNA_def_property_range(prop, 1, 100); - RNA_def_property_ui_text(prop, "Fuzzy", "Fuzziness while on collision, high values make collsion handling faster but less stable"); + RNA_def_property_ui_text(prop, "Fuzzy", "Fuzziness while on collision, high values make collision handling faster but less stable"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_packedfile.c b/source/blender/makesrna/intern/rna_packedfile.c index 2effc616e53..b414ce8ac09 100644 --- a/source/blender/makesrna/intern/rna_packedfile.c +++ b/source/blender/makesrna/intern/rna_packedfile.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_packedfile.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 2a4e018b741..fe164cbd3c1 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_particle.c + * \ingroup RNA + */ + + #include <stdio.h> #include <stdlib.h> @@ -32,6 +37,7 @@ #include "rna_internal.h" #include "DNA_material_types.h" +#include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_cloth_types.h" #include "DNA_particle_types.h" @@ -55,7 +61,19 @@ EnumPropertyItem part_reactor_from_items[] = { {PART_FROM_VERT, "VERT", 0, "Verts", ""}, {PART_FROM_FACE, "FACE", 0, "Faces", ""}, {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""}, - {PART_FROM_PARTICLE, "PARTICLE", 0, "Particle", ""}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem part_dist_items[] = { + {PART_DISTR_JIT, "JIT", 0, "Jittered", ""}, + {PART_DISTR_RAND, "RAND", 0, "Random", ""}, + {PART_DISTR_GRID, "GRID", 0, "Grid", ""}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem part_hair_dist_items[] = { + {PART_DISTR_JIT, "JIT", 0, "Jittered", ""}, + {PART_DISTR_RAND, "RAND", 0, "Random", ""}, {0, NULL, 0, NULL, NULL} }; @@ -104,6 +122,8 @@ EnumPropertyItem part_hair_ren_as_items[] = { #include "BKE_cloth.h" #include "BKE_deform.h" #include "BKE_depsgraph.h" +#include "BKE_DerivedMesh.h" +#include "BKE_cdderivedmesh.h" #include "BKE_effect.h" #include "BKE_modifier.h" #include "BKE_particle.h" @@ -163,10 +183,18 @@ static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *valu rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa); if(pa) { - float hairmat[4][4]; - psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat); - copy_v3_v3(values, hkey->co); - mul_m4_v3(hairmat, values); + DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL; + + if(hairdm) { + MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair)); + copy_v3_v3(values, mvert->co); + } + else { + float hairmat[4][4]; + psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat); + copy_v3_v3(values, hkey->co); + mul_m4_v3(hairmat, values); + } } else { zero_v3(values); @@ -183,13 +211,21 @@ static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa); if(pa) { - float hairmat[4][4]; - float imat[4][4]; + DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL; - psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat); - invert_m4_m4(imat, hairmat); - copy_v3_v3(hkey->co, values); - mul_m4_v3(imat, hkey->co); + if(hairdm) { + MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair)); + copy_v3_v3(mvert->co, values); + } + else { + float hairmat[4][4]; + float imat[4][4]; + + psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat); + invert_m4_m4(imat, hairmat); + copy_v3_v3(hkey->co, values); + mul_m4_v3(imat, hkey->co); + } } else { zero_v3(hkey->co); @@ -390,6 +426,20 @@ static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value) settings->end = value; } +static void rna_PartSetings_timestep_set(struct PointerRNA *ptr, float value) +{ + ParticleSettings *settings = (ParticleSettings*)ptr->data; + + settings->timetweak = value/0.04f; +} + +static float rna_PartSettings_timestep_get(struct PointerRNA *ptr) +{ + ParticleSettings *settings = (ParticleSettings*)ptr->data; + + return settings->timetweak * 0.04f; +} + static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value) { ParticleSettings *settings = (ParticleSettings*)ptr->data; @@ -419,7 +469,7 @@ static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, floa if(settings->type==PART_HAIR) { *min = 0.0f; - *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0; + *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f; } else { *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f; @@ -660,6 +710,16 @@ static EnumPropertyItem *rna_Particle_from_itemf(bContext *C, PointerRNA *ptr, i return part_from_items; } +static EnumPropertyItem *rna_Particle_dist_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + ParticleSettings *part = ptr->id.data; + + if(part->type==PART_HAIR) + return part_hair_dist_items; + else + return part_dist_items; +} + static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *C, PointerRNA *ptr, int *free) { ParticleSettings *part = ptr->id.data; @@ -865,7 +925,7 @@ static void rna_def_particle_key(BlenderRNA *brna) prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION); RNA_def_property_float_sdna(prop, NULL, "rot"); - RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaterion"); + RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion"); prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY); RNA_def_property_float_sdna(prop, NULL, "ave"); @@ -944,12 +1004,12 @@ static void rna_def_particle(BlenderRNA *brna) /* Hair & Keyed Keys */ - prop= RNA_def_property(srna, "hair", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey"); RNA_def_property_struct_type(prop, "ParticleHairKey"); RNA_def_property_ui_text(prop, "Hair", ""); - prop= RNA_def_property(srna, "keys", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey"); RNA_def_property_struct_type(prop, "ParticleKey"); RNA_def_property_ui_text(prop, "Keyed States", ""); @@ -1046,10 +1106,9 @@ static void rna_def_fluid_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); - /* Hidden in ui to give a little easier user experience. */ prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of interaction radius)"); + RNA_def_property_range(prop, 0.0f, 2.0f); + RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE); @@ -1059,12 +1118,12 @@ static void rna_def_fluid_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH); - RNA_def_property_ui_text(prop, "Initial Rest Length", "Use the initial length as spring rest length instead of interaction radius/2"); + RNA_def_property_ui_text(prop, "Initial Rest Length", "Use the initial length as spring rest length instead of 2 * particle size"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "plasticity_constant"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Plasticity", "How much the spring rest length can change after the elastic limit is crossed"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); @@ -1073,6 +1132,11 @@ static void rna_def_fluid_settings(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Elastic Limit", "How much the spring has to be stretched/compressed in order to change it's rest length"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_ui_text(prop, "Spring Frames", "Create springs for this number of frames since particles birth (0 is always)"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); /* Viscosity */ prop= RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE); @@ -1082,42 +1146,69 @@ static void rna_def_fluid_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); - prop= RNA_def_property(srna, "square_viscosity", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "viscosity_beta"); RNA_def_property_range(prop, 0.0f, 100.0f); - RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_ui_text(prop, "Square viscosity", "Square viscosity"); + RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3); + RNA_def_property_ui_text(prop, "Stiff viscosity", "Creates viscosity for expanding fluid)"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); /* Double density relaxation */ - prop= RNA_def_property(srna, "density_force", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "stiffness_k"); RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_ui_text(prop, "Density Force", "How strongly the fluid tends to rest density"); + RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); - prop= RNA_def_property(srna, "repulsion_force", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "stiffness_knear"); RNA_def_property_range(prop, 0.0f, 100.0f); - RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); - RNA_def_property_ui_text(prop, "Repulsion", "How strongly the fluid tries to keep from clustering"); + RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3); + RNA_def_property_ui_text(prop, "Repulsion Factor", "How strongly the fluid tries to keep from clustering (factor of stiffness)"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rest_density"); - RNA_def_property_range(prop, 0.0f, 1000.0f); - RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3); - RNA_def_property_ui_text(prop, "Rest Density", "Rest density of the fluid"); + RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3); + RNA_def_property_ui_text(prop, "Rest Density", "Fluid rest density"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); /* Buoyancy */ prop= RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "buoyancy"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3); RNA_def_property_ui_text(prop, "Buoyancy", "Artificial buoyancy force in negative gravity direction based on pressure differences inside the fluid"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + /* Factor flags */ + prop= RNA_def_property(srna, "factor_repulsion", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REPULSION); + RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "factor_density", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_DENSITY); + RNA_def_property_ui_text(prop, "Factor Density", "Density is calculated as a factor of default density (depends on particle size)"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "factor_radius", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_RADIUS); + RNA_def_property_ui_text(prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_VISCOSITY); + RNA_def_property_ui_text(prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "factor_rest_length", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REST_LENGTH); + RNA_def_property_ui_text(prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); } static void rna_def_particle_settings_mtex(BlenderRNA *brna) @@ -1356,13 +1447,6 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem dist_items[] = { - {PART_DISTR_JIT, "JIT", 0, "Jittered", ""}, - {PART_DISTR_RAND, "RAND", 0, "Random", ""}, - {PART_DISTR_GRID, "GRID", 0, "Grid", ""}, - {0, NULL, 0, NULL, NULL} - }; - static EnumPropertyItem phys_type_items[] = { {PART_PHYS_NO, "NO", 0, "No", ""}, {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""}, @@ -1463,6 +1547,14 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem draw_col_items[] = { + {PART_DRAW_COL_NONE, "NONE", 0, "None", ""}, + {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""}, + {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""}, + {PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""}, + {0, NULL, 0, NULL, NULL} + }; + srna= RNA_def_struct(brna, "ParticleSettings", "ID"); RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems"); RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA); @@ -1604,7 +1696,9 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "distr"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_enum_items(prop, dist_items); + RNA_def_property_enum_items(prop, part_dist_items); + RNA_def_property_enum_items(prop, part_draw_as_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_dist_itemf"); RNA_def_property_ui_text(prop, "Distribution", "How to distribute particles on selected element"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); @@ -1703,11 +1797,6 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); - prop= RNA_def_property(srna, "show_material_color", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_MAT_COL); - RNA_def_property_ui_text(prop, "Material Color", "Draw particles using material's diffuse color"); - RNA_def_property_update(prop, 0, "rna_Particle_redo"); - prop= RNA_def_property(srna, "use_whole_group", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR); RNA_def_property_ui_text(prop, "Whole Group", "Use whole group at once"); @@ -1732,6 +1821,12 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); + prop= RNA_def_property(srna, "draw_color", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "draw_col"); + RNA_def_property_enum_items(prop, draw_col_items); + RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + prop= RNA_def_property(srna, "draw_size", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 1000); RNA_def_property_ui_range(prop, 0, 100, 1, 0); @@ -1786,7 +1881,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "material", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "omat"); - RNA_def_property_range(prop, 1, 16); + RNA_def_property_range(prop, 1, 32767); RNA_def_property_ui_text(prop, "Material", "Specify material used for the particles"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); @@ -1843,6 +1938,12 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Tilt", "Tilt of the billboards"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); + prop= RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "color_vec_max"); + RNA_def_property_range(prop, 0.01f, 100.0f); + RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + prop= RNA_def_property(srna, "billboard_tilt_random", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt"); RNA_def_property_range(prop, 0.0f, 1.0f); @@ -1918,6 +2019,13 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0, 10, 1, 3); RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL); + RNA_def_property_range(prop, 0.0001, 100.0); + RNA_def_property_ui_range(prop, 0.01, 10, 1, 3); + RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (in seconds)"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 1000); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index e6aa753147a..9b8b23e3c47 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_pose.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <string.h> @@ -818,7 +823,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "pose_mat"); RNA_def_property_multi_array(prop, 2, matrix_dimsize); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix for this channel"); + RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix after constraints and drivers are applied (object space)"); /* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */ prop= RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION); @@ -1206,7 +1211,7 @@ static void rna_def_pose(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL); RNA_def_property_struct_type(prop, "PoseBone"); RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature"); - RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, "rna_PoseBones_lookup_string"); /* can be removed, only for fast lookup */ + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string"); /* can be removed, only for fast lookup */ /* bone groups */ prop= RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL); diff --git a/source/blender/makesrna/intern/rna_pose_api.c b/source/blender/makesrna/intern/rna_pose_api.c index b1daf8adcde..258d67abb19 100644 --- a/source/blender/makesrna/intern/rna_pose_api.c +++ b/source/blender/makesrna/intern/rna_pose_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_pose_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> #include <string.h> diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c index 4ea54994561..08a3f174c15 100644 --- a/source/blender/makesrna/intern/rna_property.c +++ b/source/blender/makesrna/intern/rna_property.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_property.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 1d8c335e88f..93754d324df 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_render.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "DNA_scene_types.h" @@ -110,8 +115,8 @@ static void rna_RenderEngine_unregister(const bContext *C, StructRNA *type) static StructRNA *rna_RenderEngine_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { - RenderEngineType *et, dummyet = {0}; - RenderEngine dummyengine= {0}; + RenderEngineType *et, dummyet = {NULL}; + RenderEngine dummyengine= {NULL}; PointerRNA dummyptr; int have_function[1]; @@ -300,7 +305,7 @@ static void rna_def_render_result(BlenderRNA *brna) func= RNA_def_function(srna, "load_from_file", "RE_result_load_from_file"); RNA_def_function_ui_description(func, "Copies the pixels of this render result from an image file."); RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm= RNA_def_string_file_name(func, "filename", "", FILE_MAX, "File Name", "Filename to load into this render tile, must be no smaller then the render result"); + parm= RNA_def_string_file_name(func, "filename", "", FILE_MAX, "File Name", "Filename to load into this render tile, must be no smaller than the render result"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_define_verify_sdna(0); @@ -332,10 +337,10 @@ static void rna_def_render_layer(BlenderRNA *brna) func= RNA_def_function(srna, "load_from_file", "RE_layer_load_from_file"); RNA_def_function_ui_description(func, "Copies the pixels of this renderlayer from an image file."); RNA_def_function_flag(func, FUNC_USE_REPORTS); - prop= RNA_def_string(func, "filename", "", 0, "Filename", "Filename to load into this render tile, must be no smaller then the renderlayer"); + prop= RNA_def_string(func, "filename", "", 0, "Filename", "Filename to load into this render tile, must be no smaller than the renderlayer"); RNA_def_property_flag(prop, PROP_REQUIRED); - prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "Offset X", "Offset the position to copy from if the image is larger then the render layer", 0, INT_MAX); - prop= RNA_def_int(func, "y", 0, 0, INT_MAX, "Offset Y", "Offset the position to copy from if the image is larger then the render layer", 0, INT_MAX); + prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "Offset X", "Offset the position to copy from if the image is larger than the render layer", 0, INT_MAX); + prop= RNA_def_int(func, "y", 0, 0, INT_MAX, "Offset Y", "Offset the position to copy from if the image is larger than the render layer", 0, INT_MAX); RNA_define_verify_sdna(0); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 4402f0a3665..de2b551909c 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_rna.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "DNA_ID.h" @@ -305,7 +310,7 @@ int rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, Point { StructRNA *srna; PropertyRNA *prop; - PointerRNA propptr= {{0}}; + PointerRNA propptr= {{NULL}}; srna= ptr->type; @@ -729,12 +734,12 @@ static int rna_enum_check_separator(CollectionPropertyIterator *iter, void *data static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; - EnumPropertyRNA *eprop; + // EnumPropertyRNA *eprop; // UNUSED EnumPropertyItem *item= NULL; int totitem, free= 0; rna_idproperty_check(&prop, ptr); - eprop= (EnumPropertyRNA*)prop; + // eprop= (EnumPropertyRNA*)prop; RNA_property_enum_items(NULL, ptr, prop, &item, &totitem, &free); rna_iterator_array_begin(iter, (void*)item, sizeof(EnumPropertyItem), totitem, free, rna_enum_check_separator); @@ -962,6 +967,7 @@ static void rna_def_property(BlenderRNA *brna) {PROP_QUATERNION, "QUATERNION", 0, "Quaternion", ""}, {PROP_XYZ, "XYZ", 0, "XYZ", ""}, {PROP_COLOR_GAMMA, "COLOR_GAMMA", 0, "Gamma Corrected Color", ""}, + {PROP_COORDS, "COORDINATES", 0, "Vector Coordinates", ""}, {PROP_LAYER, "LAYER", 0, "Layer", ""}, {PROP_LAYER_MEMBER, "LAYER_MEMBERSHIP", 0, "Layer Membership", ""}, {0, NULL, 0, NULL, NULL}}; @@ -1228,7 +1234,7 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna) RNA_def_property_enum_funcs(prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf"); RNA_def_property_ui_text(prop, "Default", "Default value for this enum"); - prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "enum_items", PROP_COLLECTION, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "EnumPropertyItem"); RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index a8e8cbcc153..a3cd2d55c0a 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_scene.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -51,6 +56,7 @@ #include <libavformat/avformat.h> #endif +#include "WM_api.h" #include "WM_types.h" #include "BLI_threads.h" @@ -74,9 +80,9 @@ EnumPropertyItem proportional_falloff_items[] ={ EnumPropertyItem proportional_editing_items[] = { - {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", ""}, - {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", ""}, - {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected", ""}, + {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"}, + {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"}, + {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected", "Proportional Editing using connected geometry only"}, {0, NULL, 0, NULL, NULL}}; /* keep for operators, not used here */ @@ -218,7 +224,7 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report } base= scene_add_base(scene, ob); - ob->id.us++; + id_us_plus(&ob->id); /* this is similar to what object_add_type and add_object do */ base->lay= scene->lay; @@ -316,6 +322,12 @@ static void rna_Scene_view3d_update(Main *bmain, Scene *unused, PointerRNA *ptr) BKE_screen_view3d_main_sync(&bmain->screen, scene); } +static void rna_Scene_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + rna_Scene_view3d_update(bmain, scene, ptr); + DAG_on_visible_update(bmain, FALSE); +} + static void rna_Scene_framelen_update(Main *bmain, Scene *scene, PointerRNA *ptr) { scene->r.framelen= (float)scene->r.framapto/(float)scene->r.images; @@ -745,6 +757,9 @@ static void rna_RenderSettings_color_management_update(Main *bmain, Scene *unuse bNode *node; if(ntree && scene->use_nodes) { + /* XXX images are freed here, stop render and preview threads, until Image is threadsafe */ + WM_jobs_stop_all(bmain->wm.first); + for (node=ntree->nodes.first; node; node=node->next) { if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_IMAGE)) { ED_node_changed_update(&scene->id, node); @@ -899,6 +914,24 @@ static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr rna_Scene_use_simplify_update(bmain, scene, ptr); } +static int rna_Scene_use_audio_get(PointerRNA *ptr) +{ + Scene *scene= (Scene*)ptr->data; + return scene->audio.flag & AUDIO_MUTE; +} + +static void rna_Scene_use_audio_set(PointerRNA *ptr, int value) +{ + Scene *scene= (Scene*)ptr->data; + + if(value) + scene->audio.flag |= AUDIO_MUTE; + else + scene->audio.flag &= ~AUDIO_MUTE; + + sound_mute_scene(scene, value); +} + static int rna_Scene_sync_mode_get(PointerRNA *ptr) { Scene *scene= (Scene*)ptr->data; @@ -1074,7 +1107,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "proportional"); RNA_def_property_enum_items(prop, proportional_editing_items); - RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional editing mode"); + RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional Editing mode, allows transforms with distance fall-off"); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ prop= RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE); @@ -1203,6 +1236,10 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, edge_tag_items); RNA_def_property_ui_text(prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path"); + prop= RNA_def_property(srna, "edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1); + RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap"); + /* etch-a-ton */ prop= RNA_def_property(srna, "use_bone_sketching", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING); @@ -1942,7 +1979,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem color_mode_items[] ={ - {R_PLANESBW, "BW", 0, "BW", "Images are saved with BW (grayscale) data"}, + {R_PLANESBW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"}, {R_PLANES24, "RGB", 0, "RGB", "Images are saved with RGB (color) data"}, {R_PLANES32, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"}, {0, NULL, 0, NULL, NULL}}; @@ -1951,7 +1988,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {R_OUTPUT_SCREEN, "SCREEN", 0, "Full Screen", "Images are rendered in full Screen"}, {R_OUTPUT_AREA, "AREA", 0, "Image Editor", "Images are rendered in Image Editor"}, {R_OUTPUT_WINDOW, "WINDOW", 0, "New Window", "Images are rendered in new Window"}, - {R_OUTPUT_NONE, "NONE", 0, "No Output", "Images are rendered without drawing"}, + {R_OUTPUT_NONE, "NONE", 0, "Keep UI", "Images are rendered without forcing UI changes, optionally showing result"}, {0, NULL, 0, NULL, NULL}}; /* Bake */ @@ -2027,7 +2064,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {1, "CINE_24FPS", 0, "Cinema 24fps 2048x1080", ""}, {2, "CINE_48FPS", 0, "Cinema 48fps 2048x1080", ""}, {3, "CINE_24FPS_4K", 0, "Cinema 24fps 4096x2160", ""}, - {4, "CINE_SCOPE_48FPS", 0, "Cine-Scope 24fps 2048x858", ""}, + {4, "CINE_SCOPE_24FPS", 0, "Cine-Scope 24fps 2048x858", ""}, {5, "CINE_SCOPE_48FPS", 0, "Cine-Scope 48fps 2048x858", ""}, {6, "CINE_FLAT_24FPS", 0, "Cine-Flat 24fps 1998x1080", ""}, {7, "CINE_FLAT_48FPS", 0, "Cine-Flat 48fps 1998x1080", ""}, @@ -2148,7 +2185,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_PERCENTAGE); RNA_def_property_int_sdna(prop, NULL, "size"); - RNA_def_property_range(prop, 1, INT_MAX); + RNA_def_property_range(prop, 1, SHRT_MAX); RNA_def_property_ui_range(prop, 1, 100, 10, 1); RNA_def_property_ui_text(prop, "Resolution %", "Percentage scale for render resolution"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); @@ -2233,7 +2270,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "exr_zbuf", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_OPENEXR_ZBUF); - RNA_def_property_ui_text(prop, "Zbuf", "Save the z-depth per pixel (32 bit unsigned int zbuffer)"); + RNA_def_property_ui_text(prop, "Zbuf", "Save the z-depth per pixel (32 bit unsigned int z-buffer)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "exr_preview", PROP_BOOLEAN, PROP_NONE); @@ -2971,7 +3008,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_pointer_funcs(prop, "rna_Scene_active_object_get", "rna_Scene_active_object_set", NULL, NULL); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK); RNA_def_property_ui_text(prop, "Active Object", "Active object for this scene"); /* Could call: ED_base_object_activate(C, scene->basact); * but would be a bad level call and it seems the notifier is enough */ @@ -3170,7 +3207,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_array(prop, 20); RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_layer_set"); RNA_def_property_ui_text(prop, "Layers", "Layers visible when rendering the scene"); - RNA_def_property_update(prop, NC_SCENE|ND_LAYER, "rna_Scene_view3d_update"); + RNA_def_property_update(prop, NC_SCENE|ND_LAYER, "rna_Scene_layer_update"); /* Frame Range Stuff */ prop= RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME); @@ -3333,7 +3370,7 @@ void RNA_def_scene(BlenderRNA *brna) /* Audio Settings */ prop= RNA_def_property(srna, "use_audio", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "audio.flag", AUDIO_MUTE); + RNA_def_property_boolean_funcs(prop, "rna_Scene_use_audio_get", "rna_Scene_use_audio_set"); RNA_def_property_ui_text(prop, "Audio Muted", "Play back of audio from Sequence Editor will be muted"); RNA_def_property_update(prop, NC_SCENE, NULL); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 042d3214edf..c2194636cd3 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_scene_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> @@ -76,6 +81,17 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name BKE_makepicstring(name, rd->pic, (frame==INT_MIN) ? rd->cfra : frame, rd->imtype, rd->scemode & R_EXTENSION, TRUE); } +#ifdef WITH_COLLADA +/* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ +#include "../../collada/collada.h" + +static void rna_Scene_collada_export(Scene *scene, const char *filepath) +{ + collada_export(scene, filepath); +} + +#endif + #else void RNA_api_scene(StructRNA *srna) @@ -91,8 +107,18 @@ void RNA_api_scene(StructRNA *srna) func= RNA_def_function(srna, "update", "rna_Scene_update_tagged"); RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators."); + +#ifdef WITH_COLLADA + /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ + func= RNA_def_function(srna, "collada_export", "rna_Scene_collada_export"); + parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file."); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */ + RNA_def_function_ui_description(func, "Export to collada file."); +#endif } + void RNA_api_scene_render(StructRNA *srna) { FunctionRNA *func; diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 892090b7f38..d129fccc717 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_screen.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stddef.h> @@ -148,6 +153,16 @@ static void rna_def_area(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_Area_type_update"); + prop= RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "winx"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Width", "Area width"); + + prop= RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "winy"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Height", "Area height"); + RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw"); func= RNA_def_function(srna, "header_text_set", "ED_area_headerprint"); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index a4face4de74..58f19fe8799 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_sculpt_paint.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -464,7 +469,7 @@ static void rna_def_particle_edit(BlenderRNA *brna) prop= RNA_def_property(srna, "size", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 1, SHRT_MAX); RNA_def_property_ui_range(prop, 1, 100, 10, 3); - RNA_def_property_ui_text(prop, "Size", "Brush size"); + RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels"); prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.001, 1.0); diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index f4d732ee041..e19816a42f6 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_sensor.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -629,9 +634,10 @@ static void rna_def_radar_sensor(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Axis", "Specify along which axis the radar cone is cast"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); + //XXX TODO - use radians internally then change to PROP_ANGLE + prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 179.9); - RNA_def_property_ui_text(prop, "Angle", "Opening angle of the radar cone"); + RNA_def_property_ui_text(prop, "Angle", "Opening angle of the radar cone (in degrees)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sensor_api.c b/source/blender/makesrna/intern/rna_sensor_api.c index 5bf0e00f05d..cfa957bdd9e 100644 --- a/source/blender/makesrna/intern/rna_sensor_api.c +++ b/source/blender/makesrna/intern/rna_sensor_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_sensor_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index dae4b484aef..34963e9507f 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_sequencer.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <limits.h> @@ -1055,7 +1060,7 @@ static void rna_def_editor(BlenderRNA *brna) prop= RNA_def_property(srna, "show_overlay", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_SHOW); - RNA_def_property_ui_text(prop, "Draw Axes", "Partial overlay ontop of the sequencer"); + RNA_def_property_ui_text(prop, "Draw Axes", "Partial overlay on top of the sequencer"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); prop= RNA_def_property(srna, "overlay_lock", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 614e3d7b031..d2c2787784b 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_sequencer_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index f0d5600ac06..922c68f45bd 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_smoke.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <limits.h> diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index dc30f0f09b4..97339058794 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_sound.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index c6ed60c90f7..3d9d8a8e9f4 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_space.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "MEM_guardedalloc.h" @@ -79,7 +84,7 @@ static EnumPropertyItem draw_channels_items[] = { static EnumPropertyItem transform_orientation_items[] = { {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"}, {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"}, - {V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the euler rotation axis as used for input"}, + {V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the Euler rotation axis as used for input"}, {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", "Align the transformation axes to average normal of selected elements (bone Y axis for pose mode)"}, {V3D_MANIP_VIEW, "VIEW", 0, "View", "Align the transformation axes to the window"}, {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"}, @@ -309,6 +314,11 @@ static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values) v3d->lay= ED_view3d_scene_layer_set(v3d->lay, values, &v3d->layact); } +static void rna_SpaceView3D_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + DAG_on_visible_update(bmain, FALSE); +} + static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr) { View3D *v3d= (View3D*)(ptr->data); @@ -609,12 +619,11 @@ static void rna_ConsoleLine_body_set(PointerRNA *ptr, const char *value) ConsoleLine *ci= (ConsoleLine*)ptr->data; int len= strlen(value); - if((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new strnig */ + if((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new string */ MEM_freeN(ci->line); ci->line= MEM_mallocN((len + 1) * sizeof(char), "rna_consoleline"); ci->len_alloc= len + 1; } - memcpy(ci->line, value, len + 1); ci->len= len; @@ -725,7 +734,7 @@ static int rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr) static void rna_Sequencer_display_mode_update(bContext *C, PointerRNA *ptr) { - int view = RNA_int_get(ptr, "view_type"); + int view = RNA_enum_get(ptr, "view_type"); ED_sequencer_update_view(C, view); } @@ -893,7 +902,7 @@ static void rna_def_space_image_uv(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); - prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ); RNA_def_property_array(prop, 2); RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get", "rna_SpaceImageEditor_cursor_location_set", NULL); RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view"); @@ -1271,7 +1280,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_array(prop, 20); RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_layer_set"); RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible in this 3D View"); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_layer_update"); prop= RNA_def_property(srna, "layers_used", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "lay_used", 1); @@ -1441,9 +1450,9 @@ static void rna_def_space_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); - prop= RNA_def_property(srna, "curves", PROP_POINTER, PROP_NONE); + prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "cumap"); - RNA_def_property_ui_text(prop, "Curves", "Color curve mapping to use for displaying the image"); + RNA_def_property_ui_text(prop, "Curve", "Color curve mapping to use for displaying the image"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_curves_update"); prop= RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_test.c b/source/blender/makesrna/intern/rna_test.c index ba5fdfcc5cf..17a7590ba47 100644 --- a/source/blender/makesrna/intern/rna_test.c +++ b/source/blender/makesrna/intern/rna_test.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_test.c + * \ingroup RNA + */ + + /* Defines a structure with properties used for array manipulation tests in BPY. */ #include <stdlib.h> diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index ec71dd0f2d6..959f9db851b 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_text.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <limits.h> diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c index 9d884eaa257..54cb6714b1b 100644 --- a/source/blender/makesrna/intern/rna_text_api.c +++ b/source/blender/makesrna/intern/rna_text_api.c @@ -21,6 +21,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_text_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 23a98804771..82eb5d1d0c9 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_texture.c + * \ingroup RNA + */ + + #include <float.h> #include <stdio.h> #include <stdlib.h> @@ -144,7 +149,9 @@ static void rna_Texture_voxeldata_image_update(Main *bmain, Scene *scene, Pointe { Tex *tex= ptr->id.data; - tex->ima->source = IMA_SRC_SEQUENCE; + if(tex->ima) { /* may be getting cleared too */ + tex->ima->source = IMA_SRC_SEQUENCE; + } rna_Texture_voxeldata_update(bmain, scene, ptr); } @@ -783,7 +790,7 @@ static void rna_def_texture_wood(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Pattern", ""); RNA_def_property_update(prop, 0, "rna_Texture_nodes_update"); - prop= RNA_def_property(srna, "noisebasis_2", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "noisebasis2"); RNA_def_property_enum_items(prop, prop_wood_noisebasis2); RNA_def_property_ui_text(prop, "Noise Basis 2", ""); @@ -857,7 +864,7 @@ static void rna_def_texture_marble(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence"); RNA_def_property_update(prop, 0, "rna_Texture_nodes_update"); - prop= RNA_def_property(srna, "noisebasis_2", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "noisebasis2"); RNA_def_property_enum_items(prop, prop_marble_noisebasis2); RNA_def_property_ui_text(prop, "Noise Basis 2", ""); @@ -1009,7 +1016,7 @@ static void rna_def_texture_image(BlenderRNA *brna) prop= RNA_def_property(srna, "use_interpolation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_INTERPOL); - RNA_def_property_ui_text(prop, "Interpolation", "Interpolates pixels using Area filter"); + RNA_def_property_ui_text(prop, "Interpolation", "Interpolates pixels using selected filter"); RNA_def_property_update(prop, 0, "rna_Texture_update"); /* XXX: I think flip_axis should be a generic Texture property, enabled for all the texture types */ diff --git a/source/blender/makesrna/intern/rna_timeline.c b/source/blender/makesrna/intern/rna_timeline.c index edff898b8db..c36666846d9 100644 --- a/source/blender/makesrna/intern/rna_timeline.c +++ b/source/blender/makesrna/intern/rna_timeline.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_timeline.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index d6117c393a5..d48c1d35c13 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_ui.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "DNA_screen_types.h" @@ -166,8 +171,8 @@ static void rna_Panel_unregister(const bContext *C, StructRNA *type) static StructRNA *rna_Panel_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { ARegionType *art; - PanelType *pt, dummypt = {0}; - Panel dummypanel= {0}; + PanelType *pt, dummypt = {NULL}; + Panel dummypanel= {NULL}; PointerRNA dummyptr; int have_function[3]; @@ -281,8 +286,8 @@ static void rna_Header_unregister(const bContext *C, StructRNA *type) static StructRNA *rna_Header_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { ARegionType *art; - HeaderType *ht, dummyht = {0}; - Header dummyheader= {0}; + HeaderType *ht, dummyht = {NULL}; + Header dummyheader= {NULL}; PointerRNA dummyhtr; int have_function[1]; @@ -399,8 +404,8 @@ static void rna_Menu_unregister(const bContext *C, StructRNA *type) static StructRNA *rna_Menu_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { - MenuType *mt, dummymt = {0}; - Menu dummymenu= {0}; + MenuType *mt, dummymt = {NULL}; + Menu dummymenu= {NULL}; PointerRNA dummymtr; int have_function[2]; diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index d7ff6af9bb2..2ee19b07d86 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_ui_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> @@ -41,7 +46,7 @@ static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, int flag= 0; if(!prop) { - printf("rna_uiItemR: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("rna_uiItemR: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); return; } diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 1376786469a..687003b3421 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_userdef.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" @@ -976,6 +981,11 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) RNA_def_property_range(prop, 0, 100); RNA_def_property_ui_text(prop, "Pin Face Opacity", ""); RNA_def_property_update(prop, NC_WINDOW, NULL); + + prop= RNA_def_property(srna, "outline_width", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 1, 5); + RNA_def_property_ui_text(prop, "Outline Width", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); } static void rna_def_userdef_theme_space_graph(BlenderRNA *brna) @@ -1718,7 +1728,7 @@ static void rna_def_userdef_themes(BlenderRNA *brna) static EnumPropertyItem active_theme_area[] = { {0, "USER_INTERFACE", ICON_UI, "User Interface", ""}, - {18, "COLOR_SETS", ICON_COLOR, "Bone Color Sets", ""}, + {18, "BONE_COLOR_SETS", ICON_COLOR, "Bone Color Sets", ""}, {1, "VIEW_3D", ICON_VIEW3D, "3D View", ""}, {2, "TIMELINE", ICON_TIME, "Timeline", ""}, {3, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", ""}, @@ -2706,7 +2716,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) prop= RNA_def_property(srna, "use_mouse_emulate_3_button", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TWOBUTTONMOUSE); - RNA_def_property_ui_text(prop, "Emulate 3 Button Mouse", "Emulates Middle Mouse with Alt+LeftMouse (doesn't work with Left Mouse Select option)"); + RNA_def_property_ui_text(prop, "Emulate 3 Button Mouse", "Emulates Middle Mouse with Alt+Left Mouse (doesn't work with Left Mouse Select option)"); prop= RNA_def_property(srna, "use_emulate_numpad", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_NONUMPAD); @@ -2807,7 +2817,8 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop= RNA_def_property(srna, "script_directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "pythondir"); - RNA_def_property_ui_text(prop, "Python Scripts Directory", "The default directory to search for Python scripts (resets python module search path: sys.path)"); + RNA_def_property_ui_text(prop, "Python Scripts Directory", "Alternate script path, matching the default layout with subdirs: startup, addons & modules (requires restart)"); + /* TODO, editing should reset sys.path! */ prop= RNA_def_property(srna, "sound_directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "sounddir"); diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c index f6b39f648c4..c64cf61429a 100644 --- a/source/blender/makesrna/intern/rna_vfont.c +++ b/source/blender/makesrna/intern/rna_vfont.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_vfont.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 54d1b1a55b4..a6b6ae26ca5 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_wm.c + * \ingroup RNA + */ + + #include <stdlib.h> #include "RNA_access.h" @@ -823,6 +828,30 @@ static void operator_draw(bContext *C, wmOperator *op) RNA_parameter_list_free(&list); } +/* same as exec(), but call cancel */ +static int operator_cancel(bContext *C, wmOperator *op) +{ + PointerRNA opr; + ParameterList list; + FunctionRNA *func; + void *ret; + int result; + + RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); + func= RNA_struct_find_function(&opr, "cancel"); + + RNA_parameter_list_create(&list, &opr, func); + RNA_parameter_set_lookup(&list, "context", &C); + op->type->ext.call(C, &opr, func, &list); + + RNA_parameter_get_lookup(&list, "result", &ret); + result= *(int*)ret; + + RNA_parameter_list_free(&list); + + return result; +} + void operator_wrapper(wmOperatorType *ot, void *userdata); void macro_wrapper(wmOperatorType *ot, void *userdata); @@ -831,10 +860,10 @@ static char _operator_name[OP_MAX_TYPENAME]; static char _operator_descr[1024]; static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { - wmOperatorType dummyot = {0}; - wmOperator dummyop= {0}; + wmOperatorType dummyot = {NULL}; + wmOperator dummyop= {NULL}; PointerRNA dummyotr; - int have_function[6]; + int have_function[7]; /* setup dummy operator & operator type to store static properties in */ dummyop.type= &dummyot; @@ -889,8 +918,8 @@ static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void * int idlen = strlen(_operator_idname) + 4; int namelen = strlen(_operator_name) + 1; int desclen = strlen(_operator_descr) + 1; - char *ch, *ch_arr; - ch_arr= ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */ + char *ch; + ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */ WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */ dummyot.idname= ch; ch += idlen; @@ -922,6 +951,7 @@ static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void * dummyot.invoke= (have_function[3])? operator_invoke: NULL; dummyot.modal= (have_function[4])? operator_modal: NULL; dummyot.ui= (have_function[5])? operator_draw: NULL; + dummyot.cancel= (have_function[6])? operator_cancel: NULL; WM_operatortype_append_ptr(operator_wrapper, (void *)&dummyot); /* update while blender is running */ @@ -934,8 +964,8 @@ static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void * static StructRNA *rna_MacroOperator_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { - wmOperatorType dummyot = {0}; - wmOperator dummyop= {0}; + wmOperatorType dummyot = {NULL}; + wmOperator dummyop= {NULL}; PointerRNA dummyotr; int have_function[4]; @@ -955,8 +985,8 @@ static StructRNA *rna_MacroOperator_register(bContext *C, ReportList *reports, v int idlen = strlen(_operator_idname) + 4; int namelen = strlen(_operator_name) + 1; int desclen = strlen(_operator_descr) + 1; - char *ch, *ch_arr; - ch_arr= ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */ + char *ch; + ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */ WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */ dummyot.idname= ch; ch += idlen; @@ -1293,9 +1323,9 @@ static void rna_def_operator_filelist_element(BlenderRNA *brna) srna= RNA_def_struct(brna, "OperatorFileListElement", "PropertyGroup"); RNA_def_struct_ui_text(srna, "Operator File List Element", ""); - - - prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + + + prop= RNA_def_property(srna, "name", PROP_STRING, PROP_FILENAME); RNA_def_property_flag(prop, PROP_IDPROPERTY); RNA_def_property_ui_text(prop, "Name", "the name of a file or directory within a file list"); } @@ -1388,6 +1418,36 @@ static void rna_def_event(BlenderRNA *brna) RNA_define_verify_sdna(1); // not in sdna } +static void rna_def_timer(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "Timer", NULL); + RNA_def_struct_ui_text(srna, "Timer", "Window event timer"); + RNA_def_struct_sdna(srna, "wmTimer"); + + RNA_define_verify_sdna(0); // not in sdna + + /* could wrap more, for now this is enough */ + prop= RNA_def_property(srna, "time_step", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "timestep"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Time Step", ""); + + prop= RNA_def_property(srna, "time_delta", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "delta"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds"); + + prop= RNA_def_property(srna, "time_duration", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "duration"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds"); + + RNA_define_verify_sdna(1); // not in sdna +} + static void rna_def_window(BlenderRNA *brna) { StructRNA *srna; @@ -1634,7 +1694,8 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_enum_items(prop, region_type_items); RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with"); - prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "keymap_items", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "items", NULL); RNA_def_property_struct_type(prop, "KeyMapItem"); RNA_def_property_ui_text(prop, "Items", "Items in the keymap, linking an operator to an input event"); rna_def_keymap_items(brna, prop); @@ -1770,6 +1831,7 @@ void RNA_def_wm(BlenderRNA *brna) rna_def_macro_operator(brna); rna_def_operator_type_macro(brna); rna_def_event(brna); + rna_def_timer(brna); rna_def_window(brna); rna_def_windowmanager(brna); rna_def_keyconfig(brna); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 8c0be26d3a8..48daabefd01 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -26,6 +26,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_wm_api.c + * \ingroup RNA + */ + + #include <stdlib.h> #include <stdio.h> @@ -68,6 +73,17 @@ static int rna_event_modal_handler_add(struct bContext *C, struct wmOperator *op return WM_event_add_modal_handler(C, operator) != NULL; } +/* XXX, need a way for python to know event types, 0x0110 is hard coded */ +struct wmTimer *rna_event_timer_add(struct wmWindowManager *wm, float time_step, wmWindow *win) +{ + return WM_event_add_timer(wm, win, 0x0110, time_step); +} + +void rna_event_timer_remove(struct wmWindowManager *wm, wmTimer *timer) +{ + WM_event_remove_timer(wm, timer->win, timer); +} + #else #define WM_GEN_INVOKE_EVENT (1<<0) @@ -113,6 +129,22 @@ void RNA_api_wm(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_function_return(func, RNA_def_boolean(func, "handle", 1, "", "")); + + func= RNA_def_function(srna, "event_timer_add", "rna_event_timer_add"); + parm= RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_range(parm, 0.0, FLT_MAX); + RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events"); + parm= RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to or None."); + parm= RNA_def_pointer(func, "result", "Timer", "", ""); + RNA_def_function_return(func, parm); + + + func= RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove"); + parm= RNA_def_pointer(func, "timer", "Timer", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + /* invoke functions, for use with python */ func= RNA_def_function(srna, "invoke_props_popup", "WM_operator_props_popup"); RNA_def_function_ui_description(func, "Operator popup invoke."); @@ -210,6 +242,16 @@ void RNA_api_operator(StructRNA *srna) RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); parm= RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + /* cancel */ + func= RNA_def_function(srna, "cancel", NULL); + RNA_def_function_ui_description(func, "Called when the operator is cancelled."); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); + parm= RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); + + parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name? + RNA_def_function_return(func, parm); } void RNA_api_macro(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 2de7e0e206f..7166d51da5a 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -22,6 +22,11 @@ * ***** END GPL LICENSE BLOCK ***** */ +/** \file blender/makesrna/intern/rna_world.c + * \ingroup RNA + */ + + #include <float.h> #include <stdlib.h> @@ -286,7 +291,7 @@ static void rna_def_lighting(BlenderRNA *brna) prop= RNA_def_property(srna, "indirect_bounces", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "ao_indirect_bounces"); RNA_def_property_range(prop, 1, SHRT_MAX); - RNA_def_property_ui_text(prop, "Bounces", "Number of indirect diffuse light bounces to use for approximate ambient occlusion"); + RNA_def_property_ui_text(prop, "Bounces", "Number of indirect diffuse light bounces"); RNA_def_property_update(prop, 0, "rna_World_update"); /* gathering parameters */ @@ -299,7 +304,7 @@ static void rna_def_lighting(BlenderRNA *brna) prop= RNA_def_property(srna, "passes", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ao_approx_passes"); RNA_def_property_range(prop, 0, 10); - RNA_def_property_ui_text(prop, "Passes", "Number of preprocessing passes to reduce overocclusion (for approximate ambient occlusion)"); + RNA_def_property_ui_text(prop, "Passes", "Number of preprocessing passes to reduce overocclusion"); RNA_def_property_update(prop, 0, "rna_World_update"); prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); @@ -333,14 +338,14 @@ static void rna_def_lighting(BlenderRNA *brna) prop= RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ao_approx_error"); RNA_def_property_range(prop, 0.0001, 10); - RNA_def_property_ui_text(prop, "Error Tolerance", "Low values are slower and higher quality (for Approximate)"); + RNA_def_property_ui_text(prop, "Error Tolerance", "Low values are slower and higher quality"); RNA_def_property_update(prop, 0, "rna_World_update"); prop= RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ao_approx_correction"); RNA_def_property_range(prop, 0, 1); RNA_def_property_ui_range(prop, 0, 1, 0.1, 2); - RNA_def_property_ui_text(prop, "Correction", "Ad-hoc correction for over-occlusion due to the approximation (for Approximate)"); + RNA_def_property_ui_text(prop, "Correction", "Ad-hoc correction for over-occlusion due to the approximation"); RNA_def_property_update(prop, 0, "rna_World_update"); prop= RNA_def_property(srna, "use_falloff", PROP_BOOLEAN, PROP_NONE); @@ -350,7 +355,7 @@ static void rna_def_lighting(BlenderRNA *brna) prop= RNA_def_property(srna, "use_cache", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "aomode", WO_AOCACHE); - RNA_def_property_ui_text(prop, "Pixel Cache", "Cache AO results in pixels and interpolate over neighbouring pixels for speedup (for Approximate)"); + RNA_def_property_ui_text(prop, "Pixel Cache", "Cache AO results in pixels and interpolate over neighbouring pixels for speedup"); RNA_def_property_update(prop, 0, "rna_World_update"); prop= RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); @@ -568,4 +573,3 @@ void RNA_def_world(BlenderRNA *brna) } #endif - |