diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-18 04:48:59 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-18 04:48:59 +0400 |
commit | c1ceab1281ccf061f03f8000bf190a082a5385d8 (patch) | |
tree | 01b9a9cfca80432d316bdad6c18c74eb025e9eb0 /source/blender/makesrna | |
parent | 0d9c98c4bbfbc8c70c4772086dd09a51d01921ef (diff) | |
parent | 66a35e089a64d27bfc09c2225a530069eca05875 (diff) |
Merged changes in the trunk up to revision 55357.
Resolved conflicts:
release/datafiles/startup.blend
source/blender/editors/space_nla/nla_buttons.c
Also updated source/blender/blenkernel/intern/linestyle.c as a follow-up of
recent changes for the use of bool.
Diffstat (limited to 'source/blender/makesrna')
66 files changed, 886 insertions, 583 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 821b429e75c..770508cd625 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -392,7 +392,6 @@ extern StructRNA RNA_MouseSensor; extern StructRNA RNA_MovieSequence; extern StructRNA RNA_MovieClipSequence; extern StructRNA RNA_MovieTracking; -extern StructRNA RNA_MovieTrackingTrack; extern StructRNA RNA_MovieTrackingObject; extern StructRNA RNA_MovieTrackingTrack; extern StructRNA RNA_MulticamSequence; @@ -703,10 +702,10 @@ PropertyRNA *RNA_struct_name_property(StructRNA *type); PropertyRNA *RNA_struct_iterator_property(StructRNA *type); StructRNA *RNA_struct_base(StructRNA *type); -int RNA_struct_is_ID(StructRNA *type); -int RNA_struct_is_a(StructRNA *type, StructRNA *srna); +bool RNA_struct_is_ID(StructRNA *type); +bool RNA_struct_is_a(StructRNA *type, StructRNA *srna); -int RNA_struct_undo_check(StructRNA *type); +bool RNA_struct_undo_check(StructRNA *type); StructRegisterFunc RNA_struct_register(StructRNA *type); StructUnregisterFunc RNA_struct_unregister(StructRNA *type); @@ -718,13 +717,13 @@ void RNA_struct_py_type_set(StructRNA *srna, void *py_type); void *RNA_struct_blender_type_get(StructRNA *srna); void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type); -struct IDProperty *RNA_struct_idprops(PointerRNA *ptr, int create); -int RNA_struct_idprops_check(StructRNA *srna); -int RNA_struct_idprops_register_check(StructRNA *type); -int RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier); +struct IDProperty *RNA_struct_idprops(PointerRNA *ptr, bool create); +bool RNA_struct_idprops_check(StructRNA *srna); +bool RNA_struct_idprops_register_check(StructRNA *type); +bool RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier); PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier); -int RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test); +bool RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test); /* lower level functions for access to type properties */ const struct ListBase *RNA_struct_type_properties(StructRNA *srna); @@ -751,12 +750,12 @@ PropertyUnit RNA_property_unit(PropertyRNA *prop); int RNA_property_flag(PropertyRNA *prop); void *RNA_property_py_data_get(PropertyRNA *prop); -int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop); -int RNA_property_array_check(PropertyRNA *prop); -int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dimension); -int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[]); +int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop); +bool RNA_property_array_check(PropertyRNA *prop); +int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dimension); +int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[]); char RNA_property_array_item_char(PropertyRNA *prop, int index); -int RNA_property_array_item_index(PropertyRNA *prop, char name); +int RNA_property_array_item_index(PropertyRNA *prop, char name); int RNA_property_string_maxlength(PropertyRNA *prop); @@ -776,31 +775,31 @@ void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *soft int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value); int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value); -int RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **identifier); -int RNA_enum_bitflag_identifiers(EnumPropertyItem *item, const int value, const char **identifier); -int RNA_enum_name(EnumPropertyItem *item, const int value, const char **name); -int RNA_enum_description(EnumPropertyItem *item, const int value, const char **description); +bool RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **identifier); +int RNA_enum_bitflag_identifiers(EnumPropertyItem *item, const int value, const char **identifier); +bool RNA_enum_name(EnumPropertyItem *item, const int value, const char **r_name); +bool RNA_enum_description(EnumPropertyItem *item, const int value, const char **description); void RNA_property_enum_items(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free); void RNA_property_enum_items_gettexted(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free); -int RNA_property_enum_value(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value); -int RNA_property_enum_identifier(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier); -int RNA_property_enum_name(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name); +bool RNA_property_enum_value(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *r_value); +bool RNA_property_enum_identifier(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier); +bool RNA_property_enum_name(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name); int RNA_property_enum_bitflag_identifiers(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier); StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop); int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value); -int RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop); -int RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index); -int RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop); /* without lib check, only checks the flag */ -int RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop); -int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop); -int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop); /* slow, use with care */ +bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop); +bool RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index); +bool RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop); /* without lib check, only checks the flag */ +bool RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop); +bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop); +bool RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop); /* slow, use with care */ void RNA_property_update(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop); void RNA_property_update_main(struct Main *bmain, struct Scene *scene, PointerRNA *ptr, PropertyRNA *prop); -int RNA_property_update_check(struct PropertyRNA *prop); +bool RNA_property_update_check(struct PropertyRNA *prop); void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_update_cache_flush(struct Main *bmain, struct Scene *scene); @@ -865,7 +864,7 @@ int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, Poi int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr); int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr); int RNA_property_collection_assign_int(PointerRNA *ptr, PropertyRNA *prop, const int key, const PointerRNA *assign_ptr); -int RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr); +bool RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr); /* efficient functions to set properties for arrays */ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, PropertyRNA *itemprop, RawArray *array); @@ -879,13 +878,13 @@ RawPropertyType RNA_property_raw_type(PropertyRNA *prop); void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr); -int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key); +bool RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key); void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop); -int RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, int pos); +bool RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, int pos); /* copy/reset */ -int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index); -int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index); +bool RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index); +bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index); /* Path * @@ -924,36 +923,36 @@ char *RNA_path_property_py(struct PointerRNA *ptr, struct PropertyRNA *prop, int * There is no support for pointers and collections here yet, these can be * added when ID properties support them. */ -int RNA_boolean_get(PointerRNA *ptr, const char *name); +int RNA_boolean_get(PointerRNA *ptr, const char *name); void RNA_boolean_set(PointerRNA *ptr, const char *name, int value); void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values); void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values); -int RNA_int_get(PointerRNA *ptr, const char *name); +int RNA_int_get(PointerRNA *ptr, const char *name); void RNA_int_set(PointerRNA *ptr, const char *name, int value); void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values); void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values); float RNA_float_get(PointerRNA *ptr, const char *name); -void RNA_float_set(PointerRNA *ptr, const char *name, float value); -void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values); -void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values); +void RNA_float_set(PointerRNA *ptr, const char *name, float value); +void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values); +void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values); -int RNA_enum_get(PointerRNA *ptr, const char *name); +int RNA_enum_get(PointerRNA *ptr, const char *name); void RNA_enum_set(PointerRNA *ptr, const char *name, int value); void RNA_enum_set_identifier(PointerRNA *ptr, const char *name, const char *id); -int RNA_enum_is_equal(struct bContext *C, PointerRNA *ptr, const char *name, const char *enumname); +bool RNA_enum_is_equal(struct bContext *C, PointerRNA *ptr, const char *name, const char *enumname); /* lower level functions that don't use a PointerRNA */ -int RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value); -int RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **identifier); -int RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *icon); -int RNA_enum_name_from_value(EnumPropertyItem *item, int value, const char **name); +bool RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *r_value); +bool RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **r_identifier); +bool RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *r_icon); +bool RNA_enum_name_from_value(EnumPropertyItem *item, int value, const char **r_name); -void RNA_string_get(PointerRNA *ptr, const char *name, char *value); +void RNA_string_get(PointerRNA *ptr, const char *name, char *value); char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen); -int RNA_string_length(PointerRNA *ptr, const char *name); -void RNA_string_set(PointerRNA *ptr, const char *name, const char *value); +int RNA_string_length(PointerRNA *ptr, const char *name); +void RNA_string_set(PointerRNA *ptr, const char *name, const char *value); /** * Retrieve the named property from PointerRNA. @@ -964,7 +963,7 @@ void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value); void RNA_pointer_add(PointerRNA *ptr, const char *name); void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyIterator *iter); -int RNA_collection_length(PointerRNA *ptr, const char *name); +int RNA_collection_length(PointerRNA *ptr, const char *name); void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value); void RNA_collection_clear(PointerRNA *ptr, const char *name); @@ -1014,11 +1013,11 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name); } /* check if the idproperty exists, for operators */ -int RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, int use_ghost); -int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop); -int RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, int use_ghost); -int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier); -int RNA_property_is_idprop(PropertyRNA *prop); +bool RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, bool use_ghost); +bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop); +bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost); +bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier); +bool RNA_property_is_idprop(PropertyRNA *prop); /* python compatible string representation of this property, (must be freed!) */ char *RNA_property_as_string(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index); @@ -1063,21 +1062,27 @@ int RNA_parameter_length_get_data(ParameterList *parms, PropertyRNA *parm, void void RNA_parameter_length_set(ParameterList *parms, PropertyRNA *parm, int length); void RNA_parameter_length_set_data(ParameterList *parms, PropertyRNA *parm, void *data, int length); -int RNA_function_call(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms); -int RNA_function_call_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, const char *identifier, ParameterList *parms); +int RNA_function_call(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, + FunctionRNA *func, ParameterList *parms); +int RNA_function_call_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, + const char *identifier, ParameterList *parms); -int RNA_function_call_direct(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, ...) +int RNA_function_call_direct(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, + FunctionRNA *func, const char *format, ...) #ifdef __GNUC__ __attribute__ ((format(printf, 5, 6))) #endif ; -int RNA_function_call_direct_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, ...) +int RNA_function_call_direct_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, + const char *identifier, const char *format, ...) #ifdef __GNUC__ __attribute__ ((format(printf, 5, 6))) #endif ; -int RNA_function_call_direct_va(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, va_list args); -int RNA_function_call_direct_va_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, va_list args); +int RNA_function_call_direct_va(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, + FunctionRNA *func, const char *format, va_list args); +int RNA_function_call_direct_va_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, + const char *identifier, const char *format, va_list args); /* ID */ diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 54d2efcf4cf..b69c95d0363 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -88,7 +88,8 @@ typedef enum PropertyUnit { PROP_UNIT_ROTATION = (5 << 16), /* radians */ PROP_UNIT_TIME = (6 << 16), /* frame */ PROP_UNIT_VELOCITY = (7 << 16), /* m/s */ - PROP_UNIT_ACCELERATION = (8 << 16) /* m/(s^2) */ + PROP_UNIT_ACCELERATION = (8 << 16), /* m/(s^2) */ + PROP_UNIT_CAMERA = (9 << 16) /* mm */ } PropertyUnit; #define RNA_SUBTYPE_UNIT(subtype) ((subtype) & 0x00FF0000) @@ -122,6 +123,7 @@ typedef enum PropertySubType { PROP_TIME = 17 | PROP_UNIT_TIME, /* distance in 3d space, don't use for pixel distance for eg. */ PROP_DISTANCE = 18 | PROP_UNIT_LENGTH, + PROP_DISTANCE_CAMERA = 19 | PROP_UNIT_CAMERA, /* number arrays */ PROP_COLOR = 20, diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 3cd75ab10f0..0d5c1eb2352 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -24,7 +24,6 @@ * \ingroup RNA */ - #include <float.h> #include <limits.h> #include <stdio.h> @@ -34,6 +33,8 @@ #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" + #include "RNA_access.h" #include "RNA_define.h" #include "RNA_types.h" @@ -2450,6 +2451,7 @@ static const char *rna_property_subtypename(PropertySubType type) case PROP_ANGLE: return "PROP_ANGLE"; case PROP_TIME: return "PROP_TIME"; case PROP_DISTANCE: return "PROP_DISTANCE"; + case PROP_DISTANCE_CAMERA: return "PROP_DISTANCE_CAMERA"; case PROP_COLOR: return "PROP_COLOR"; case PROP_TRANSLATION: return "PROP_TRANSLATION"; case PROP_DIRECTION: return "PROP_DIRECTION"; @@ -2490,6 +2492,7 @@ static const char *rna_property_subtype_unit(PropertySubType type) case PROP_UNIT_TIME: return "PROP_UNIT_TIME"; case PROP_UNIT_VELOCITY: return "PROP_UNIT_VELOCITY"; case PROP_UNIT_ACCELERATION: return "PROP_UNIT_ACCELERATION"; + case PROP_UNIT_CAMERA: return "PROP_UNIT_CAMERA"; default: return "PROP_UNIT_UNKNOWN"; } } @@ -3172,7 +3175,9 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE fprintf(f, "\t(PropertyRNA *)&rna_%s_%s, ", base->identifier, prop->identifier); } - else fprintf(f, "\tNULL, "); + else { + fprintf(f, "\tNULL, "); + } prop = srna->iteratorproperty; base = srna; diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 18281d4d251..1716864f23f 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -24,18 +24,19 @@ * \ingroup RNA */ - #include <stdlib.h> #include <stdio.h> -#include "RNA_access.h" -#include "RNA_define.h" - #include "DNA_ID.h" #include "DNA_vfont_types.h" #include "DNA_material_types.h" #include "DNA_object_types.h" +#include "BLI_utildefines.h" + +#include "RNA_access.h" +#include "RNA_define.h" + #include "WM_types.h" #include "rna_internal.h" @@ -105,7 +106,7 @@ void rna_ID_name_set(PointerRNA *ptr, const char *value) { ID *id = (ID *)ptr->data; BLI_strncpy_utf8(id->name + 2, value, sizeof(id->name) - 2); - test_idbutton(id->name + 2); + test_idbutton(id->name); } static int rna_ID_name_editable(PointerRNA *ptr) @@ -205,7 +206,7 @@ StructRNA *rna_ID_refine(PointerRNA *ptr) return ID_code_to_RNA_type(GS(id->name)); } -IDProperty *rna_ID_idprops(PointerRNA *ptr, int create) +IDProperty *rna_ID_idprops(PointerRNA *ptr, bool create) { return IDP_GetProperties(ptr->data, create); } @@ -224,7 +225,7 @@ void rna_ID_fake_user_set(PointerRNA *ptr, int value) } } -IDProperty *rna_PropertyGroup_idprops(PointerRNA *ptr, int UNUSED(create)) +IDProperty *rna_PropertyGroup_idprops(PointerRNA *ptr, bool UNUSED(create)) { return ptr->data; } @@ -269,7 +270,7 @@ static ID *rna_ID_copy(ID *id) { ID *newid; - if (id_copy(id, &newid, 0)) { + if (id_copy(id, &newid, false)) { if (newid) id_us_min(newid); return newid; } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 6035326e0ae..f3efbd0d53e 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -52,12 +52,11 @@ #include "BKE_main.h" #include "BKE_report.h" - -#include "WM_api.h" - #include "RNA_access.h" #include "RNA_define.h" +#include "WM_api.h" + /* flush updates */ #include "DNA_object_types.h" #include "BKE_depsgraph.h" @@ -258,7 +257,7 @@ static IDProperty *rna_idproperty_ui(PropertyRNA *prop) return NULL; } -IDProperty *RNA_struct_idprops(PointerRNA *ptr, int create) +IDProperty *RNA_struct_idprops(PointerRNA *ptr, bool create) { StructRNA *type = ptr->type; @@ -268,9 +267,9 @@ IDProperty *RNA_struct_idprops(PointerRNA *ptr, int create) return NULL; } -int RNA_struct_idprops_check(StructRNA *srna) +bool RNA_struct_idprops_check(StructRNA *srna) { - return (srna && srna->idproperties) ? 1 : 0; + return (srna && srna->idproperties); } static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name) @@ -299,15 +298,15 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop) } } -static int rna_ensure_property_array_check(PropertyRNA *prop) +static bool rna_ensure_property_array_check(PropertyRNA *prop) { if (prop->magic == RNA_MAGIC) { - return (prop->getlength || prop->totarraylength) ? 1 : 0; + return (prop->getlength || prop->totarraylength); } else { IDProperty *idprop = (IDProperty *)prop; - return idprop->type == IDP_ARRAY ? 1 : 0; + return (idprop->type == IDP_ARRAY); } } @@ -329,7 +328,7 @@ static void rna_ensure_property_multi_array_length(PointerRNA *ptr, PropertyRNA } } -static int rna_idproperty_verify_valid(PointerRNA *ptr, PropertyRNA *prop, IDProperty *idprop) +static bool rna_idproperty_verify_valid(PointerRNA *ptr, PropertyRNA *prop, IDProperty *idprop) { /* this verifies if the idproperty actually matches the property * description and otherwise removes it. this is to ensure that @@ -339,40 +338,40 @@ static int rna_idproperty_verify_valid(PointerRNA *ptr, PropertyRNA *prop, IDPro switch (idprop->type) { case IDP_IDPARRAY: if (prop->type != PROP_COLLECTION) - return 0; + return false; break; case IDP_ARRAY: if (rna_ensure_property_array_length(ptr, prop) != idprop->len) - return 0; + return false; if (idprop->subtype == IDP_FLOAT && prop->type != PROP_FLOAT) - return 0; + return false; if (idprop->subtype == IDP_INT && !ELEM3(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM)) - return 0; + return false; break; case IDP_INT: if (!ELEM3(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM)) - return 0; + return false; break; case IDP_FLOAT: case IDP_DOUBLE: if (prop->type != PROP_FLOAT) - return 0; + return false; break; case IDP_STRING: if (prop->type != PROP_STRING) - return 0; + return false; break; case IDP_GROUP: if (prop->type != PROP_POINTER) - return 0; + return false; break; default: - return 0; + return false; } - return 1; + return true; } static PropertyRNA *typemap[IDP_NUMTYPES] = { @@ -549,23 +548,23 @@ StructRNA *RNA_struct_base(StructRNA *type) return type->base; } -int RNA_struct_is_ID(StructRNA *type) +bool RNA_struct_is_ID(StructRNA *type) { return (type->flag & STRUCT_ID) != 0; } -int RNA_struct_undo_check(StructRNA *type) +bool RNA_struct_undo_check(StructRNA *type) { return (type->flag & STRUCT_UNDO) != 0; } -int RNA_struct_idprops_register_check(StructRNA *type) +bool RNA_struct_idprops_register_check(StructRNA *type) { return (type->flag & STRUCT_NO_IDPROPERTIES) == 0; } /* remove an id-property */ -int RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier) +bool RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier) { IDProperty *group = RNA_struct_idprops(ptr, 0); @@ -576,25 +575,25 @@ int RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier) IDP_FreeProperty(idp); MEM_freeN(idp); - return 1; + return true; } } - return 0; + return false; } -int RNA_struct_is_a(StructRNA *type, StructRNA *srna) +bool RNA_struct_is_a(StructRNA *type, StructRNA *srna) { StructRNA *base; if (!type) - return 0; + return false; /* ptr->type is always maximally refined */ for (base = type; base; base = base->base) if (base == srna) - return 1; + return true; - return 0; + return false; } PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier) @@ -637,13 +636,13 @@ static PropertyRNA *RNA_struct_find_nested(PointerRNA *ptr, StructRNA *srna) return prop; } -int RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test) +bool 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; + bool found = false; iterprop = RNA_struct_iterator_property(ptr->type); @@ -651,7 +650,7 @@ int RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test) { /* PropertyRNA *prop = itemptr.data; */ if (prop_test == (PropertyRNA *)itemptr.data) { - found = TRUE; + found = true; break; } } @@ -812,7 +811,7 @@ int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop) return rna_ensure_property_array_length(ptr, prop); } -int RNA_property_array_check(PropertyRNA *prop) +bool RNA_property_array_check(PropertyRNA *prop) { return rna_ensure_property_array_check(prop); } @@ -845,6 +844,8 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index) const char *coloritem = "RGBA"; PropertySubType subtype = rna_ensure_property(prop)->subtype; + BLI_assert(index >= 0); + /* get string to use for array index */ if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) { return quatitem[index]; @@ -1272,17 +1273,18 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA } -int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value) +bool RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *r_value) { EnumPropertyItem *item, *item_array; - int free, found; + int free; + bool found; RNA_property_enum_items(C, ptr, prop, &item_array, NULL, &free); if (item_array) { for (item = item_array; item->identifier; item++) { if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) { - *value = item->value; + *r_value = item->value; break; } } @@ -1294,97 +1296,100 @@ int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, con } } else { - found = 0; + found = false; } return found; } -int RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **identifier) +bool RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **identifier) { for (; item->identifier; item++) { if (item->identifier[0] && item->value == value) { *identifier = item->identifier; - return 1; + return true; } } - return 0; + return false; } -int RNA_enum_bitflag_identifiers(EnumPropertyItem *item, const int value, const char **identifier) +int RNA_enum_bitflag_identifiers(EnumPropertyItem *item, const int value, const char **r_identifier) { int index = 0; for (; item->identifier; item++) { if (item->identifier[0] && item->value & value) { - identifier[index++] = item->identifier; + r_identifier[index++] = item->identifier; } } - identifier[index] = NULL; + r_identifier[index] = NULL; return index; } -int RNA_enum_name(EnumPropertyItem *item, const int value, const char **name) +bool RNA_enum_name(EnumPropertyItem *item, const int value, const char **r_name) { for (; item->identifier; item++) { if (item->identifier[0] && item->value == value) { - *name = item->name; - return 1; + *r_name = item->name; + return true; } } - return 0; + return false; } -int RNA_enum_description(EnumPropertyItem *item, const int value, const char **description) +bool RNA_enum_description(EnumPropertyItem *item, const int value, const char **r_description) { for (; item->identifier; item++) { if (item->identifier[0] && item->value == value) { - *description = item->description; - return 1; + *r_description = item->description; + return true; } } - return 0; + return false; } -int RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, - const char **identifier) +bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, + const char **identifier) { EnumPropertyItem *item = NULL; - int result, free; + int free; RNA_property_enum_items(C, ptr, prop, &item, NULL, &free); if (item) { + bool result; result = RNA_enum_identifier(item, value, identifier); if (free) MEM_freeN(item); return result; } - return 0; + return false; } -int RNA_property_enum_name(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name) +bool RNA_property_enum_name(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name) { EnumPropertyItem *item = NULL; - int result, free; + int free; RNA_property_enum_items(C, ptr, prop, &item, NULL, &free); if (item) { + bool result; result = RNA_enum_name(item, value, name); if (free) MEM_freeN(item); return result; } - return 0; + return false; } int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier) { EnumPropertyItem *item = NULL; - int result, free; + int free; RNA_property_enum_items(C, ptr, prop, &item, NULL, &free); if (item) { + int result; result = RNA_enum_bitflag_identifiers(item, value, identifier); if (free) MEM_freeN(item); @@ -1415,7 +1420,7 @@ int RNA_property_ui_icon(PropertyRNA *prop) return rna_ensure_property(prop)->icon; } -int RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop) +bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop) { ID *id = ptr->id.data; int flag; @@ -1425,21 +1430,23 @@ int RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop) return (flag & PROP_EDITABLE) && (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION)); } -int RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop) +bool RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop) { int flag; prop = rna_ensure_property(prop); flag = prop->editable ? prop->editable(ptr) : prop->flag; - return (flag & PROP_EDITABLE); + return (flag & PROP_EDITABLE) != 0; } /* same as RNA_property_editable(), except this checks individual items in an array */ -int RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index) +bool RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index) { ID *id; int flag; + BLI_assert(index >= 0); + prop = rna_ensure_property(prop); flag = prop->flag; @@ -1455,34 +1462,34 @@ int RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index) return (flag & PROP_EDITABLE) && (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION)); } -int RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop) +bool RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop) { /* check that base ID-block can support animation data */ if (!id_type_can_have_animdata(ptr->id.data)) - return 0; + return false; prop = rna_ensure_property(prop); if (!(prop->flag & PROP_ANIMATABLE)) - return 0; + return false; - return (prop->flag & PROP_EDITABLE); + return (prop->flag & PROP_EDITABLE) != 0; } -int RNA_property_animated(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop)) +bool RNA_property_animated(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop)) { /* would need to ask animation system */ - return 0; + return false; } /* this function is to check if its possible to create a valid path from the ID * its slow so don't call in a loop */ -int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop) +bool RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop) { char *path = RNA_path_from_ID_to_property(ptr, prop); - int ret = 0; + bool ret = false; if (path) { PointerRNA id_ptr; @@ -1493,9 +1500,6 @@ int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop) if (RNA_path_resolve(&id_ptr, path, &r_ptr, &r_prop) == TRUE) { ret = (prop == r_prop); } - else { - ret = FALSE; - } MEM_freeN(path); } @@ -1540,7 +1544,7 @@ static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerR /* must keep in sync with 'rna_property_update' * note, its possible this returns a false positive in the case of PROP_CONTEXT_UPDATE * but this isn't likely to be a performance problem. */ -int RNA_property_update_check(PropertyRNA *prop) +bool RNA_property_update_check(PropertyRNA *prop) { return (prop->magic != RNA_MAGIC || prop->update || prop->noteflag); } @@ -1670,7 +1674,7 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); - BLI_assert(RNA_property_array_check(prop) == 0); + BLI_assert(RNA_property_array_check(prop) == false); if ((idprop = rna_idproperty_check(&prop, ptr))) return IDP_Int(idprop); @@ -1688,7 +1692,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); - BLI_assert(RNA_property_array_check(prop) == 0); + BLI_assert(RNA_property_array_check(prop) == false); /* just in case other values are passed */ if (value) value = 1; @@ -1721,7 +1725,7 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); if ((idprop = rna_idproperty_check(&prop, ptr))) { if (prop->arraydimension == 0) @@ -1747,7 +1751,8 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); + BLI_assert(index >= 0); if (len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_array(ptr, prop, tmp); @@ -1771,7 +1776,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); if ((idprop = rna_idproperty_check(&prop, ptr))) { if (prop->arraydimension == 0) @@ -1809,7 +1814,8 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); + BLI_assert(index >= 0); if (len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_array(ptr, prop, tmp); @@ -1832,7 +1838,7 @@ int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); - BLI_assert(RNA_property_array_check(prop) == 0); + BLI_assert(RNA_property_array_check(prop) == false); return bprop->defaultvalue; } @@ -1842,7 +1848,7 @@ void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); if (prop->arraydimension == 0) values[0] = bprop->defaultvalue; @@ -1858,7 +1864,8 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); + BLI_assert(index >= 0); if (len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_boolean_get_default_array(ptr, prop, tmp); @@ -1882,7 +1889,7 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); - BLI_assert(RNA_property_array_check(prop) == 0); + BLI_assert(RNA_property_array_check(prop) == false); if ((idprop = rna_idproperty_check(&prop, ptr))) return IDP_Int(idprop); @@ -1900,7 +1907,7 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); - BLI_assert(RNA_property_array_check(prop) == 0); + BLI_assert(RNA_property_array_check(prop) == false); /* useful to check on bad values but set function should clamp */ /* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */ @@ -1932,7 +1939,7 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); if ((idprop = rna_idproperty_check(&prop, ptr))) { if (prop->arraydimension == 0) @@ -1995,7 +2002,8 @@ int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_INT); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); + BLI_assert(index >= 0); if (len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_int_get_array(ptr, prop, tmp); @@ -2019,7 +2027,7 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_INT); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); if ((idprop = rna_idproperty_check(&prop, ptr))) { if (prop->arraydimension == 0) @@ -2059,7 +2067,8 @@ void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, i int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_INT); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); + BLI_assert(index >= 0); if (len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_int_get_array(ptr, prop, tmp); @@ -2088,7 +2097,7 @@ void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *pr IntPropertyRNA *iprop = (IntPropertyRNA *)prop; BLI_assert(RNA_property_type(prop) == PROP_INT); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); if (prop->arraydimension == 0) values[0] = iprop->defaultvalue; @@ -2103,6 +2112,10 @@ int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int i int tmp[RNA_MAX_ARRAY_LENGTH]; int len = rna_ensure_property_array_length(ptr, prop); + BLI_assert(RNA_property_type(prop) == PROP_INT); + BLI_assert(RNA_property_array_check(prop) != false); + BLI_assert(index >= 0); + if (len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_int_get_default_array(ptr, prop, tmp); return tmp[index]; @@ -2125,7 +2138,7 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); - BLI_assert(RNA_property_array_check(prop) == 0); + BLI_assert(RNA_property_array_check(prop) == false); if ((idprop = rna_idproperty_check(&prop, ptr))) { if (idprop->type == IDP_FLOAT) @@ -2147,7 +2160,7 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); - BLI_assert(RNA_property_array_check(prop) == 0); + BLI_assert(RNA_property_array_check(prop) == false); /* useful to check on bad values but set function should clamp */ /* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */ @@ -2186,7 +2199,7 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val int i; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); if ((idprop = rna_idproperty_check(&prop, ptr))) { if (prop->arraydimension == 0) @@ -2254,7 +2267,8 @@ float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); + BLI_assert(index >= 0); if (len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_array(ptr, prop, tmp); @@ -2270,7 +2284,6 @@ float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index return value; } - } void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values) @@ -2280,7 +2293,7 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa int i; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); if ((idprop = rna_idproperty_check(&prop, ptr))) { if (prop->arraydimension == 0) { @@ -2331,7 +2344,8 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); + BLI_assert(index >= 0); if (len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_array(ptr, prop, tmp); @@ -2354,7 +2368,7 @@ float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); - BLI_assert(RNA_property_array_check(prop) == 0); + BLI_assert(RNA_property_array_check(prop) == false); return fprop->defaultvalue; } @@ -2364,7 +2378,7 @@ void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA * FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; BLI_assert(RNA_property_type(prop) == PROP_FLOAT); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); if (prop->arraydimension == 0) values[0] = fprop->defaultvalue; @@ -2380,7 +2394,8 @@ float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_FLOAT); - BLI_assert(RNA_property_array_check(prop) != 0); + BLI_assert(RNA_property_array_check(prop) != false); + BLI_assert(index >= 0); if (len <= RNA_MAX_ARRAY_LENGTH) { RNA_property_float_get_default_array(ptr, prop, tmp); @@ -2864,7 +2879,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA } } -int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) +bool RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) { IDProperty *idprop; /* CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop; */ @@ -2889,10 +2904,11 @@ int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) IDP_ResizeIDPArray(idprop, len - 1); } - return 1; + return true; + } + else if (prop->flag & PROP_IDPROPERTY) { + return true; } - else if (prop->flag & PROP_IDPROPERTY) - return 1; /* py api calls directly */ #if 0 @@ -2904,15 +2920,15 @@ int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) RNA_parameter_list_free(¶ms); } - return 0; + return false; } /*else printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier);*/ #endif - return 0; + return false; } -int RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, int pos) +bool RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, int pos) { IDProperty *idprop; @@ -2934,12 +2950,13 @@ int RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, in memcpy(&array[pos], &tmp, sizeof(IDProperty)); } - return 1; + return true; + } + else if (prop->flag & PROP_IDPROPERTY) { + return true; } - else if (prop->flag & PROP_IDPROPERTY) - return 1; - return 0; + return false; } void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop) @@ -3066,7 +3083,7 @@ int RNA_property_collection_assign_int(PointerRNA *ptr, PropertyRNA *prop, const return 0; } -int RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr) +bool RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr) { BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); @@ -4557,7 +4574,7 @@ void RNA_enum_set_identifier(PointerRNA *ptr, const char *name, const char *id) } } -int RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char *enumname) +bool RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char *enumname) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); EnumPropertyItem *item; @@ -4574,60 +4591,60 @@ int RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char MEM_freeN(item); printf("%s: %s.%s item %s not found.\n", __func__, ptr->type->identifier, name, enumname); - return 0; + return false; } else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); - return 0; + return false; } } -int RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value) +bool RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *r_value) { for (; item->identifier; item++) { if (strcmp(item->identifier, identifier) == 0) { - *value = item->value; - return 1; + *r_value = item->value; + return true; } } - return 0; + return false; } -int RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **identifier) +bool RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **r_identifier) { for (; item->identifier; item++) { if (item->value == value) { - *identifier = item->identifier; - return 1; + *r_identifier = item->identifier; + return true; } } - return 0; + return false; } -int RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *icon) +bool RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *r_icon) { for (; item->identifier; item++) { if (item->value == value) { - *icon = item->icon; - return 1; + *r_icon = item->icon; + return true; } } - return 0; + return false; } -int RNA_enum_name_from_value(EnumPropertyItem *item, int value, const char **name) +bool RNA_enum_name_from_value(EnumPropertyItem *item, int value, const char **r_name) { for (; item->identifier; item++) { if (item->value == value) { - *name = item->name; - return 1; + *r_name = item->name; + return true; } } - return 0; + return false; } void RNA_string_get(PointerRNA *ptr, const char *name, char *value) @@ -4758,29 +4775,29 @@ int RNA_collection_length(PointerRNA *ptr, const char *name) } } -int RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, int use_ghost) +bool RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, bool use_ghost) { if (prop->flag & PROP_IDPROPERTY) { IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier); - return ((idprop != NULL) && (use_ghost == FALSE || !(idprop->flag & IDP_FLAG_GHOST))); + return ((idprop != NULL) && (use_ghost == false || !(idprop->flag & IDP_FLAG_GHOST))); } else { - return 1; + return true; } } -int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop) +bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop) { if (prop->flag & PROP_IDPROPERTY) { IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier); return ((idprop != NULL) && !(idprop->flag & IDP_FLAG_GHOST)); } else { - return 1; + return true; } } -int RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, int use_ghost) +bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost) { PropertyRNA *prop = RNA_struct_find_property(ptr, identifier); @@ -4794,7 +4811,7 @@ int RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, int u } } -int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier) +bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier) { PropertyRNA *prop = RNA_struct_find_property(ptr, identifier); @@ -4808,7 +4825,7 @@ int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier) } } -int RNA_property_is_idprop(PropertyRNA *prop) +bool RNA_property_is_idprop(PropertyRNA *prop) { return (prop->magic != RNA_MAGIC); } @@ -5887,7 +5904,7 @@ int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, Pointer return 0; } -int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index) +bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index) { int len; @@ -5915,7 +5932,7 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index) int value = RNA_property_boolean_get_default(ptr, prop); RNA_property_boolean_set(ptr, prop, value); } - return 1; + return true; case PROP_INT: if (len) { if (index == -1) { @@ -5935,7 +5952,7 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index) int value = RNA_property_int_get_default(ptr, prop); RNA_property_int_set(ptr, prop, value); } - return 1; + return true; case PROP_FLOAT: if (len) { if (index == -1) { @@ -5955,12 +5972,12 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index) float value = RNA_property_float_get_default(ptr, prop); RNA_property_float_set(ptr, prop, value); } - return 1; + return true; case PROP_ENUM: { int value = RNA_property_enum_get_default(ptr, prop); RNA_property_enum_set(ptr, prop, value); - return 1; + return true; } case PROP_STRING: @@ -5968,23 +5985,23 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index) char *value = RNA_property_string_get_default_alloc(ptr, prop, NULL, 0); RNA_property_string_set(ptr, prop, value); MEM_freeN(value); - return 1; + return true; } case PROP_POINTER: { PointerRNA value = RNA_property_pointer_get_default(ptr, prop); RNA_property_pointer_set(ptr, prop, value); - return 1; + return true; } default: /* FIXME: are there still any cases that haven't been handled? comment out "default" block to check :) */ - return 0; + return false; } } -int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index) +bool RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index) { int len, fromlen; @@ -5993,7 +6010,7 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i fromlen = RNA_property_array_length(fromptr, prop); if (len != fromlen) - return 0; + return false; /* get and set the default values as appropriate for the various types */ switch (RNA_property_type(prop)) { @@ -6016,7 +6033,7 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i int value = RNA_property_boolean_get(fromptr, prop); RNA_property_boolean_set(ptr, prop, value); } - return 1; + return true; case PROP_INT: if (len) { if (index == -1) { @@ -6036,7 +6053,7 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i int value = RNA_property_int_get(fromptr, prop); RNA_property_int_set(ptr, prop, value); } - return 1; + return true; case PROP_FLOAT: if (len) { if (index == -1) { @@ -6056,31 +6073,31 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i float value = RNA_property_float_get(fromptr, prop); RNA_property_float_set(ptr, prop, value); } - return 1; + return true; case PROP_ENUM: { int value = RNA_property_enum_get(fromptr, prop); RNA_property_enum_set(ptr, prop, value); - return 1; + return true; } case PROP_POINTER: { PointerRNA value = RNA_property_pointer_get(fromptr, prop); RNA_property_pointer_set(ptr, prop, value); - return 1; + return true; } case PROP_STRING: { char *value = RNA_property_string_get_alloc(fromptr, prop, NULL, 0, NULL); RNA_property_string_set(ptr, prop, value); MEM_freeN(value); - return 1; + return true; } default: - return 0; + return false; } - return 0; + return false; } /* use RNA_warning macro which includes __func__ suffix */ diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 457066aed7c..e9bf40a58b1 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -24,15 +24,8 @@ * \ingroup RNA */ - #include <stdlib.h> -#include "RNA_access.h" -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_scene_types.h" @@ -43,6 +36,12 @@ #include "BKE_action.h" +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + #include "WM_types.h" diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index fe4a23cb393..2c022e80ddd 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -27,22 +27,23 @@ #include <stdlib.h> -#include "RNA_define.h" -#include "RNA_access.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" #include "DNA_constraint_types.h" #include "DNA_object_types.h" #include "DNA_actuator_types.h" #include "DNA_scene_types.h" /* for MAXFRAME */ -#include "WM_types.h" - #include "BLI_utildefines.h" #include "BLF_translation.h" +#include "RNA_define.h" +#include "RNA_access.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + +#include "WM_types.h" + /* Always keep in alphabetical order */ EnumPropertyItem actuator_type_items[] = { {ACT_ACTION, "ACTION", 0, "Action", ""}, diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index d6ea53f6ab3..50f156dd985 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -26,12 +26,6 @@ #include <stdlib.h> -#include "RNA_access.h" -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_scene_types.h" @@ -40,10 +34,16 @@ #include "MEM_guardedalloc.h" -#include "ED_keyframing.h" +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" #include "WM_types.h" +#include "ED_keyframing.h" + /* exported for use in API */ EnumPropertyItem keyingset_path_grouping_items[] = { {KSP_GROUP_NAMED, "NAMED", 0, "Named Group", ""}, @@ -895,6 +895,7 @@ static void rna_def_animdata(BlenderRNA *brna) srna = RNA_def_struct(brna, "AnimData", NULL); RNA_def_struct_ui_text(srna, "Animation Data", "Animation data for datablock"); + RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA); /* NLA */ prop = RNA_def_property(srna, "nla_tracks", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c index 68075823a86..9f8f30b00a7 100644 --- a/source/blender/makesrna/intern/rna_animviz.c +++ b/source/blender/makesrna/intern/rna_animviz.c @@ -24,19 +24,20 @@ * \ingroup RNA */ - #include <stdlib.h> #include "RNA_define.h" -#include "rna_internal.h" - #include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_scene_types.h" +#include "BLI_utildefines.h" + #include "MEM_guardedalloc.h" +#include "rna_internal.h" + #include "WM_types.h" /* Which part of bone(s) get baked */ diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 6c48ed25b60..1bc6c7e4f6f 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -207,7 +207,7 @@ static char *rna_Bone_path(PointerRNA *ptr) return BLI_sprintfN("bones[\"%s\"]", bone->name); } -static IDProperty *rna_Bone_idprops(PointerRNA *ptr, int create) +static IDProperty *rna_Bone_idprops(PointerRNA *ptr, bool create) { Bone *bone = ptr->data; @@ -219,7 +219,7 @@ static IDProperty *rna_Bone_idprops(PointerRNA *ptr, int create) return bone->prop; } -static IDProperty *rna_EditBone_idprops(PointerRNA *ptr, int create) +static IDProperty *rna_EditBone_idprops(PointerRNA *ptr, bool create) { EditBone *ebone = ptr->data; diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 63f4e480468..9d44ae87b57 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -29,20 +29,21 @@ * \ingroup RNA */ - #include <float.h> #include <limits.h> #include <stdlib.h> -#include "RNA_define.h" - -#include "rna_internal.h" - #include "DNA_scene_types.h" #include "DNA_boid_types.h" #include "DNA_object_types.h" #include "DNA_particle_types.h" +#include "BLI_utildefines.h" + +#include "RNA_define.h" + +#include "rna_internal.h" + #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index c995d3b52c7..8480427c433 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -24,14 +24,11 @@ * \ingroup RNA */ - #include <stdlib.h> #include <assert.h> #include "RNA_define.h" -#include "rna_internal.h" - #include "DNA_brush_types.h" #include "DNA_texture_types.h" #include "DNA_scene_types.h" @@ -39,6 +36,8 @@ #include "BLI_math.h" +#include "rna_internal.h" + #include "IMB_imbuf.h" #include "WM_types.h" @@ -107,7 +106,7 @@ EnumPropertyItem brush_image_tool_items[] = { #include "WM_api.h" -static int rna_SculptCapabilities_has_accumulate_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_accumulate_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return ELEM6(br->sculpt_tool, @@ -115,19 +114,19 @@ static int rna_SculptCapabilities_has_accumulate_get(PointerRNA *ptr) SCULPT_TOOL_DRAW, SCULPT_TOOL_INFLATE, SCULPT_TOOL_LAYER); } -static int rna_SculptCapabilities_has_auto_smooth_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_auto_smooth_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return !ELEM(br->sculpt_tool, SCULPT_TOOL_MASK, SCULPT_TOOL_SMOOTH); } -static int rna_SculptCapabilities_has_height_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_height_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return br->sculpt_tool == SCULPT_TOOL_LAYER; } -static int rna_SculptCapabilities_has_jitter_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_jitter_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return (!(br->flag & BRUSH_ANCHORED) && @@ -137,13 +136,13 @@ static int rna_SculptCapabilities_has_jitter_get(PointerRNA *ptr) SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB)); } -static int rna_SculptCapabilities_has_normal_weight_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_normal_weight_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK); } -static int rna_SculptCapabilities_has_overlay_get(PointerRNA *ptr) +static int rna_BrushCapabilities_has_overlay_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return ELEM(br->mtex.brush_map_mode, @@ -151,38 +150,43 @@ static int rna_SculptCapabilities_has_overlay_get(PointerRNA *ptr) MTEX_MAP_MODE_TILED); } -static int rna_SculptCapabilities_has_persistence_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_persistence_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return br->sculpt_tool == SCULPT_TOOL_LAYER; } -static int rna_SculptCapabilities_has_pinch_factor_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_pinch_factor_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return ELEM(br->sculpt_tool, SCULPT_TOOL_BLOB, SCULPT_TOOL_CREASE); } -static int rna_SculptCapabilities_has_plane_offset_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_plane_offset_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return ELEM5(br->sculpt_tool, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_FILL, SCULPT_TOOL_FLATTEN, SCULPT_TOOL_SCRAPE); } -static int rna_SculptCapabilities_has_random_texture_angle_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_random_texture_angle_get(PointerRNA *ptr) +{ + Brush *br = (Brush *)ptr->data; + return (!ELEM4(br->sculpt_tool, + SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE, + SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB)); +} + +static int rna_BrushCapabilities_has_random_texture_angle_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return (ELEM(br->mtex.brush_map_mode, MTEX_MAP_MODE_VIEW, MTEX_MAP_MODE_AREA) && - !(br->flag & BRUSH_ANCHORED) && - !ELEM4(br->sculpt_tool, - SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE, - SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB)); + !(br->flag & BRUSH_ANCHORED)); } -static int rna_SculptCapabilities_has_sculpt_plane_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_sculpt_plane_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return !ELEM4(br->sculpt_tool, SCULPT_TOOL_INFLATE, @@ -190,7 +194,7 @@ static int rna_SculptCapabilities_has_sculpt_plane_get(PointerRNA *ptr) SCULPT_TOOL_SMOOTH); } -static int rna_SculptCapabilities_has_secondary_color_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_secondary_color_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return ELEM10(br->sculpt_tool, @@ -200,7 +204,7 @@ static int rna_SculptCapabilities_has_secondary_color_get(PointerRNA *ptr) SCULPT_TOOL_SCRAPE); } -static int rna_SculptCapabilities_has_smooth_stroke_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_smooth_stroke_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return (!(br->flag & BRUSH_ANCHORED) && @@ -210,7 +214,7 @@ static int rna_SculptCapabilities_has_smooth_stroke_get(PointerRNA *ptr) SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB)); } -static int rna_SculptCapabilities_has_space_attenuation_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_space_attenuation_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return ((br->flag & BRUSH_SPACE) && @@ -218,22 +222,19 @@ static int rna_SculptCapabilities_has_space_attenuation_get(PointerRNA *ptr) SCULPT_TOOL_SMOOTH, SCULPT_TOOL_SNAKE_HOOK)); } -static int rna_SculptCapabilities_has_spacing_get(PointerRNA *ptr) +static int rna_BrushCapabilities_has_spacing_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; - return (!(br->flag & BRUSH_ANCHORED) && - !ELEM4(br->sculpt_tool, - SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE, - SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB)); + return (!(br->flag & BRUSH_ANCHORED)); } -static int rna_SculptCapabilities_has_strength_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_strength_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK); } -static int rna_SculptCapabilities_has_texture_angle_get(PointerRNA *ptr) +static int rna_BrushCapabilities_has_texture_angle_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return ELEM3(br->mtex.brush_map_mode, @@ -242,7 +243,7 @@ static int rna_SculptCapabilities_has_texture_angle_get(PointerRNA *ptr) MTEX_MAP_MODE_TILED); } -static int rna_SculptCapabilities_has_texture_angle_source_get(PointerRNA *ptr) +static int rna_BrushCapabilities_has_texture_angle_source_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return ELEM(br->mtex.brush_map_mode, @@ -250,9 +251,14 @@ static int rna_SculptCapabilities_has_texture_angle_source_get(PointerRNA *ptr) MTEX_MAP_MODE_AREA); } -static PointerRNA rna_Brush_sculpt_capabilities_get(PointerRNA *ptr) +static PointerRNA rna_Sculpt_sculpt_tool_capabilities_get(PointerRNA *ptr) +{ + return rna_pointer_inherit_refine(ptr, &RNA_SculptToolCapabilities, ptr->id.data); +} + +static PointerRNA rna_Brush_capabilities_get(PointerRNA *ptr) { - return rna_pointer_inherit_refine(ptr, &RNA_SculptCapabilities, ptr->id.data); + return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilities, ptr->id.data); } static void rna_Brush_reset_icon(Brush *br, const char *UNUSED(type)) @@ -464,41 +470,66 @@ static void rna_def_sculpt_capabilities(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna = RNA_def_struct(brna, "SculptCapabilities", NULL); + srna = RNA_def_struct(brna, "SculptToolCapabilities", NULL); RNA_def_struct_sdna(srna, "Brush"); RNA_def_struct_nested(brna, srna, "Brush"); RNA_def_struct_ui_text(srna, "Sculpt Capabilities", "Read-only indications of which brush operations " "are supported by the current sculpt tool"); +#define SCULPT_TOOL_CAPABILITY(prop_name_, ui_name_) \ + prop = RNA_def_property(srna, #prop_name_, \ + PROP_BOOLEAN, PROP_NONE); \ + RNA_def_property_clear_flag(prop, PROP_EDITABLE); \ + RNA_def_property_boolean_funcs(prop, "rna_SculptToolCapabilities_" \ + #prop_name_ "_get", NULL); \ + RNA_def_property_ui_text(prop, ui_name_, NULL) + + SCULPT_TOOL_CAPABILITY(has_accumulate, "Has Accumulate"); + SCULPT_TOOL_CAPABILITY(has_auto_smooth, "Has Auto Smooth"); + SCULPT_TOOL_CAPABILITY(has_height, "Has Height"); + SCULPT_TOOL_CAPABILITY(has_jitter, "Has Jitter"); + SCULPT_TOOL_CAPABILITY(has_normal_weight, "Has Crease/Pinch Factor"); + SCULPT_TOOL_CAPABILITY(has_persistence, "Has Persistence"); + SCULPT_TOOL_CAPABILITY(has_pinch_factor, "Has Pinch Factor"); + SCULPT_TOOL_CAPABILITY(has_plane_offset, "Has Plane Offset"); + SCULPT_TOOL_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle"); + SCULPT_TOOL_CAPABILITY(has_sculpt_plane, "Has Sculpt Plane"); + SCULPT_TOOL_CAPABILITY(has_secondary_color, "Has Secondary Color"); + SCULPT_TOOL_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke"); + SCULPT_TOOL_CAPABILITY(has_space_attenuation, "Has Space Attenuation"); + SCULPT_TOOL_CAPABILITY(has_strength, "Has Strength"); + +#undef SCULPT_CAPABILITY +} + +static void rna_def_brush_capabilities(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "BrushCapabilities", NULL); + RNA_def_struct_sdna(srna, "Brush"); + RNA_def_struct_nested(brna, srna, "Brush"); + RNA_def_struct_ui_text(srna, "Brush Capabilities", + "Read-only indications of which brush operations " + "are supported by the current brush"); + #define BRUSH_CAPABILITY(prop_name_, ui_name_) \ prop = RNA_def_property(srna, #prop_name_, \ PROP_BOOLEAN, PROP_NONE); \ RNA_def_property_clear_flag(prop, PROP_EDITABLE); \ - RNA_def_property_boolean_funcs(prop, "rna_SculptCapabilities_" \ + RNA_def_property_boolean_funcs(prop, "rna_BrushCapabilities_" \ #prop_name_ "_get", NULL); \ RNA_def_property_ui_text(prop, ui_name_, NULL) - BRUSH_CAPABILITY(has_accumulate, "Has Accumulate"); - BRUSH_CAPABILITY(has_auto_smooth, "Has Auto Smooth"); - BRUSH_CAPABILITY(has_height, "Has Height"); - BRUSH_CAPABILITY(has_jitter, "Has Jitter"); - BRUSH_CAPABILITY(has_normal_weight, "Has Crease/Pinch Factor"); BRUSH_CAPABILITY(has_overlay, "Has Overlay"); - BRUSH_CAPABILITY(has_persistence, "Has Persistence"); - BRUSH_CAPABILITY(has_pinch_factor, "Has Pinch Factor"); - BRUSH_CAPABILITY(has_plane_offset, "Has Plane Offset"); BRUSH_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle"); - BRUSH_CAPABILITY(has_sculpt_plane, "Has Sculpt Plane"); - BRUSH_CAPABILITY(has_secondary_color, "Has Secondary Color"); - BRUSH_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke"); - BRUSH_CAPABILITY(has_space_attenuation, "Has Space Attenuation"); - BRUSH_CAPABILITY(has_spacing, "Has Spacing"); - BRUSH_CAPABILITY(has_strength, "Has Strength"); BRUSH_CAPABILITY(has_texture_angle, "Has Texture Angle"); BRUSH_CAPABILITY(has_texture_angle_source, "Has Texture Angle Source"); + BRUSH_CAPABILITY(has_spacing, "Has Spacing"); -#undef SCULPT_CAPABILITY +#undef BRUSH_CAPABILITY } static void rna_def_brush(BlenderRNA *brna) @@ -634,10 +665,17 @@ static void rna_def_brush(BlenderRNA *brna) prop = RNA_def_property(srna, "jitter", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "jitter"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, 0.0f, 1000.0f); + RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.1, 4); RNA_def_property_ui_text(prop, "Jitter", "Jitter the position of the brush while painting"); RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "jitter_absolute", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "jitter_absolute"); + RNA_def_property_range(prop, 0, 1000000); + RNA_def_property_ui_text(prop, "Jitter", "Jitter the position of the brush in pixels while painting"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "spacing", PROP_INT, PROP_PERCENTAGE); RNA_def_property_int_sdna(prop, NULL, "spacing"); RNA_def_property_range(prop, 1, 1000); @@ -794,6 +832,11 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Rake", "Rotate the brush texture to match the stroke direction"); RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "use_relative_jitter", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BRUSH_ABSOLUTE_JITTER); + RNA_def_property_ui_text(prop, "Absolute Jitter", "Jittering happens in screen space, not relative to brush size"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "use_random_rotation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RANDOM_ROTATION); RNA_def_property_ui_text(prop, "Random Rotation", "Rotate the brush texture at random"); @@ -957,11 +1000,17 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_range(prop, -1.0f, 1.0f, 10.0f, 3); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_update"); + prop = RNA_def_property(srna, "brush_capabilities", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "BrushCapabilities"); + RNA_def_property_pointer_funcs(prop, "rna_Brush_capabilities_get", NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Brush Capabilities", "Brush's capabilities"); + /* brush capabilities (mode-dependent) */ prop = RNA_def_property(srna, "sculpt_capabilities", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_struct_type(prop, "SculptCapabilities"); - RNA_def_property_pointer_funcs(prop, "rna_Brush_sculpt_capabilities_get", NULL, NULL, NULL); + RNA_def_property_struct_type(prop, "SculptToolCapabilities"); + RNA_def_property_pointer_funcs(prop, "rna_Sculpt_sculpt_tool_capabilities_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Sculpt Capabilities", "Brush's capabilities in sculpt mode"); } @@ -1023,6 +1072,7 @@ static void rna_def_operator_stroke_element(BlenderRNA *brna) void RNA_def_brush(BlenderRNA *brna) { rna_def_brush(brna); + rna_def_brush_capabilities(brna); rna_def_sculpt_capabilities(brna); rna_def_brush_texture_slot(brna); rna_def_operator_stroke_element(brna); diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 5f11663c057..5743fcf2b9f 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -24,17 +24,16 @@ * \ingroup RNA */ - #include <stdlib.h> -#include "RNA_define.h" - -#include "rna_internal.h" - #include "DNA_camera_types.h" #include "BLI_math.h" +#include "RNA_define.h" + +#include "rna_internal.h" + #include "WM_types.h" #ifdef RNA_RUNTIME @@ -186,20 +185,20 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Clip End", "Camera far clipping distance"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - prop = RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "lens", PROP_FLOAT, PROP_DISTANCE_CAMERA); RNA_def_property_float_sdna(prop, NULL, "lens"); RNA_def_property_range(prop, 1.0f, 5000.0f); RNA_def_property_ui_text(prop, "Focal Length", "Perspective Camera lens value in millimeters"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update"); - prop = RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_DISTANCE_CAMERA); RNA_def_property_float_sdna(prop, NULL, "sensor_x"); RNA_def_property_range(prop, 1.0f, FLT_MAX); RNA_def_property_ui_range(prop, 1.0f, 100.f, 1, 2); RNA_def_property_ui_text(prop, "Sensor Width", "Horizontal size of the image sensor area in millimeters"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update"); - prop = RNA_def_property(srna, "sensor_height", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "sensor_height", PROP_FLOAT, PROP_DISTANCE_CAMERA); RNA_def_property_float_sdna(prop, NULL, "sensor_y"); RNA_def_property_range(prop, 1.0f, FLT_MAX); RNA_def_property_ui_range(prop, 1.0f, 100.f, 1, 2); diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 69de86da007..1bf15fd0838 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -24,14 +24,9 @@ * \ingroup RNA */ - #include <stdlib.h> #include <limits.h> -#include "RNA_define.h" - -#include "rna_internal.h" - #include "BKE_cloth.h" #include "BKE_modifier.h" @@ -39,6 +34,10 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "RNA_define.h" + +#include "rna_internal.h" + #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index f32f28e8143..c5f6744bcbe 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -24,16 +24,17 @@ * \ingroup RNA */ - #include <stdlib.h> #include <stdio.h> -#include "RNA_define.h" -#include "rna_internal.h" - #include "DNA_color_types.h" #include "DNA_texture_types.h" +#include "BLI_utildefines.h" + +#include "RNA_define.h" +#include "rna_internal.h" + #include "WM_api.h" #include "WM_types.h" @@ -415,7 +416,8 @@ static void rna_ColorManagedDisplaySettings_display_device_set(struct PointerRNA } } -static EnumPropertyItem *rna_ColorManagedDisplaySettings_display_device_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_ColorManagedDisplaySettings_display_device_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *items = NULL; int totitem = 0; @@ -462,7 +464,8 @@ static void rna_ColorManagedViewSettings_view_transform_set(PointerRNA *ptr, int } } -static EnumPropertyItem *rna_ColorManagedViewSettings_view_transform_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_ColorManagedViewSettings_view_transform_itemf(bContext *C, PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { Scene *scene = CTX_data_scene(C); EnumPropertyItem *items = NULL; @@ -509,7 +512,8 @@ static void rna_ColorManagedColorspaceSettings_colorspace_set(struct PointerRNA } } -static EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *items = NULL; int totitem = 0; @@ -1015,6 +1019,7 @@ static void rna_def_colormanage(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "ColorManagedInputColorspaceSettings", "Input color space settings"); prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE); + RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT); RNA_def_property_enum_items(prop, color_space_items); RNA_def_property_enum_funcs(prop, "rna_ColorManagedColorspaceSettings_colorspace_get", "rna_ColorManagedColorspaceSettings_colorspace_set", @@ -1026,6 +1031,7 @@ static void rna_def_colormanage(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "ColorManagedSequencerColorspaceSettings", "Input color space settings"); prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE); + RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT); RNA_def_property_enum_items(prop, color_space_items); RNA_def_property_enum_funcs(prop, "rna_ColorManagedColorspaceSettings_colorspace_get", "rna_ColorManagedColorspaceSettings_colorspace_set", diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 956483890f5..4ced8326560 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -24,13 +24,8 @@ * \ingroup RNA */ - #include <stdlib.h> -#include "RNA_define.h" - -#include "rna_internal.h" - #include "BLI_math.h" #include "BLF_translation.h" @@ -41,46 +36,73 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "ED_object.h" +#include "RNA_define.h" + +#include "rna_internal.h" + #include "WM_types.h" +#include "ED_object.h" + /* please keep the names in sync with constraint.c */ EnumPropertyItem constraint_type_items[] = { {0, "", 0, N_("Motion Tracking"), ""}, {CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT_DATA, "Camera Solver", ""}, {CONSTRAINT_TYPE_OBJECTSOLVER, "OBJECT_SOLVER", ICON_CONSTRAINT_DATA, "Object Solver", ""}, - {CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT_DATA, "Follow Track", ""}, + {CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT_DATA, "Follow Track", ""}, {0, "", 0, N_("Transform"), ""}, - {CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", ICON_CONSTRAINT_DATA, "Copy Location", ""}, - {CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", ICON_CONSTRAINT_DATA, "Copy Rotation", ""}, - {CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", ICON_CONSTRAINT_DATA, "Copy Scale", ""}, - {CONSTRAINT_TYPE_TRANSLIKE, "COPY_TRANSFORMS", ICON_CONSTRAINT_DATA, "Copy Transforms", ""}, - {CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", ICON_CONSTRAINT_DATA, "Limit Distance", ""}, - {CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", ICON_CONSTRAINT_DATA, "Limit Location", ""}, - {CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", ICON_CONSTRAINT_DATA, "Limit Rotation", ""}, - {CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", ICON_CONSTRAINT_DATA, "Limit Scale", ""}, - {CONSTRAINT_TYPE_SAMEVOL, "MAINTAIN_VOLUME", ICON_CONSTRAINT_DATA, "Maintain Volume", ""}, - {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", ICON_CONSTRAINT_DATA, "Transformation", ""}, + {CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", ICON_CONSTRAINT_DATA, "Copy Location", + "Copy the location of a target (with an optional offset), so that they move together"}, + {CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", ICON_CONSTRAINT_DATA, "Copy Rotation", + "Copy the rotation of a target (with an optional offset), so that they rotate together"}, + {CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", ICON_CONSTRAINT_DATA, "Copy Scale", + "Copy the scale factors of a target (with an optional offset), so that they are scaled by the same amount"}, + {CONSTRAINT_TYPE_TRANSLIKE, "COPY_TRANSFORMS", ICON_CONSTRAINT_DATA, "Copy Transforms", + "Copy all the transformations of a target, so that they move together"}, + {CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", ICON_CONSTRAINT_DATA, "Limit Distance", + "Restrict movements to within a certain distance of a target (at the time of constraint evaluation only)"}, + {CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", ICON_CONSTRAINT_DATA, "Limit Location", + "Restrict movement along each axis within given ranges"}, + {CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", ICON_CONSTRAINT_DATA, "Limit Rotation", + "Restrict rotation along each axis within given ranges"}, + {CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", ICON_CONSTRAINT_DATA, "Limit Scale", + "Restrict scaling along each axis with given ranges"}, + {CONSTRAINT_TYPE_SAMEVOL, "MAINTAIN_VOLUME", ICON_CONSTRAINT_DATA, "Maintain Volume", + "Compensate for scaling one axis by applying suitable scaling to the other two axes"}, + {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", ICON_CONSTRAINT_DATA, "Transformation", + "Use one transform property from target to control another (or same) property on owner"}, {0, "", 0, N_("Tracking"), ""}, - {CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", ICON_CONSTRAINT_DATA, "Clamp To", ""}, + {CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", ICON_CONSTRAINT_DATA, "Clamp To", + "Restrict movements to lie along a curve by remapping location along curve's longest axis"}, {CONSTRAINT_TYPE_DAMPTRACK, "DAMPED_TRACK", ICON_CONSTRAINT_DATA, "Damped Track", - "Tracking by taking the shortest path"}, - {CONSTRAINT_TYPE_KINEMATIC, "IK", ICON_CONSTRAINT_DATA, "Inverse Kinematics", ""}, + "Point towards a target by performing the smallest rotation necessary"}, + {CONSTRAINT_TYPE_KINEMATIC, "IK", ICON_CONSTRAINT_DATA, "Inverse Kinematics", + "Control a chain of bones by specifying the endpoint target (Bones only)"}, {CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", ICON_CONSTRAINT_DATA, "Locked Track", - "Tracking along a single axis"}, - {CONSTRAINT_TYPE_SPLINEIK, "SPLINE_IK", ICON_CONSTRAINT_DATA, "Spline IK", ""}, - {CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO", ICON_CONSTRAINT_DATA, "Stretch To", ""}, - {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To", - "Legacy tracking constraint prone to twisting artifacts"}, + "Rotate around the specified ('locked') axis to point towards a target"}, + {CONSTRAINT_TYPE_SPLINEIK, "SPLINE_IK", ICON_CONSTRAINT_DATA, "Spline IK", + "Align chain of bones along a curve (Bones only)"}, + {CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO", ICON_CONSTRAINT_DATA, "Stretch To", + "Stretch along Y-Axis to point towards a target"}, + {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To", + "Legacy tracking constraint prone to twisting artifacts"}, {0, "", 0, N_("Relationship"), ""}, - {CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT_DATA, "Action", ""}, - {CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", ICON_CONSTRAINT_DATA, "Child Of", ""}, - {CONSTRAINT_TYPE_MINMAX, "FLOOR", ICON_CONSTRAINT_DATA, "Floor", ""}, - {CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", ICON_CONSTRAINT_DATA, "Follow Path", ""}, - {CONSTRAINT_TYPE_PIVOT, "PIVOT", ICON_CONSTRAINT_DATA, "Pivot", ""}, - {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", ICON_CONSTRAINT_DATA, "Rigid Body Joint", ""}, - {CONSTRAINT_TYPE_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script", ""}, - {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT_DATA, "Shrinkwrap", ""}, + {CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT_DATA, "Action", + "Use transform property of target to look up pose for owner from an Action"}, + {CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", ICON_CONSTRAINT_DATA, "Child Of", + "Make target the 'detachable' parent of owner"}, + {CONSTRAINT_TYPE_MINMAX, "FLOOR", ICON_CONSTRAINT_DATA, "Floor", + "Use position (and optionally rotation) of target to define a 'wall' or 'floor' that the owner can not cross"}, + {CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", ICON_CONSTRAINT_DATA, "Follow Path", + "Use to animate an object/bone following a path"}, + {CONSTRAINT_TYPE_PIVOT, "PIVOT", ICON_CONSTRAINT_DATA, "Pivot", + "Change pivot point for transforms (buggy)"}, + {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", ICON_CONSTRAINT_DATA, "Rigid Body Joint", + "Use to define a Rigid Body Constraint (for Game Engine use only)"}, + {CONSTRAINT_TYPE_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script", + "Custom constraint(s) written in Python (Not yet implemented)"}, + {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT_DATA, "Shrinkwrap", + "Restrict movements to surface of target mesh"}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c index 4204506e67b..d7a679e9702 100644 --- a/source/blender/makesrna/intern/rna_context.c +++ b/source/blender/makesrna/intern/rna_context.c @@ -24,17 +24,17 @@ * \ingroup RNA */ - #include <stdlib.h> #include "DNA_ID.h" #include "DNA_userdef_types.h" +#include "BLI_utildefines.h" +#include "BKE_context.h" + #include "RNA_access.h" #include "RNA_define.h" -#include "BKE_context.h" - #include "rna_internal.h" /* own include */ #ifdef RNA_RUNTIME diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index c59e376da82..472cc6e89e6 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -24,15 +24,18 @@ * \ingroup RNA */ - #include <stdlib.h> -#include "WM_types.h" +#include "DNA_object_types.h" +#include "DNA_controller_types.h" + +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "rna_internal.h" -#include "DNA_object_types.h" -#include "DNA_controller_types.h" + +#include "WM_types.h" EnumPropertyItem controller_type_items[] = { {CONT_LOGIC_AND, "LOGIC_AND", 0, "And", "Logic And"}, diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index b7ef76eeaf3..dba33bb9ab5 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -26,11 +26,6 @@ #include <stdlib.h> -#include "RNA_access.h" -#include "RNA_define.h" - -#include "rna_internal.h" - #include "DNA_curve_types.h" #include "DNA_key_types.h" #include "DNA_material_types.h" @@ -40,6 +35,11 @@ #include "BKE_font.h" +#include "RNA_access.h" +#include "RNA_define.h" + +#include "rna_internal.h" + #include "WM_types.h" #include "BKE_curve.h" diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index a505ae0dec2..8d30a0be0f1 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -24,14 +24,9 @@ * \ingroup RNA */ - #include <stdlib.h> #include <limits.h> -#include "RNA_define.h" - -#include "rna_internal.h" - #include "BLI_math_base.h" #include "BKE_modifier.h" @@ -43,6 +38,10 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "RNA_define.h" + +#include "rna_internal.h" + #include "WM_types.h" EnumPropertyItem prop_dynamicpaint_type_items[] = { diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index a91832268e2..f6f8b14d0e2 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -24,15 +24,8 @@ * \ingroup RNA */ - #include <stdlib.h> -#include "RNA_access.h" -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_anim_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -43,6 +36,12 @@ #include "BKE_action.h" +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + #include "WM_types.h" #include "ED_keyframing.h" diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 84ff53ee68f..9ff83daa2f8 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -28,6 +28,7 @@ #include "DNA_object_fluidsim.h" +#include "BLI_utildefines.h" #include "BLI_path_util.h" #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 9461a816652..7156b76bab2 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -24,19 +24,20 @@ * \ingroup RNA */ - #include <stdlib.h> -#include "RNA_access.h" -#include "RNA_define.h" - -#include "rna_internal.h" - #include "DNA_gpencil_types.h" #include "DNA_scene_types.h" #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" + +#include "RNA_access.h" +#include "RNA_define.h" + +#include "rna_internal.h" + #include "WM_types.h" #ifdef RNA_RUNTIME @@ -547,7 +548,9 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_NO_XRAY); RNA_def_property_ui_text(prop, "X Ray", "Make the layer draw in front of objects"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); - + + + /* Layers API */ func = RNA_def_function(srna, "clear", "rna_GPencil_layer_clear"); RNA_def_function_ui_description(func, "Remove all the grease pencil layer data"); } diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c index 4baf46fd0b5..1ac59f9caed 100644 --- a/source/blender/makesrna/intern/rna_group.c +++ b/source/blender/makesrna/intern/rna_group.c @@ -24,15 +24,16 @@ * \ingroup RNA */ - #include <stdlib.h> +#include "DNA_group_types.h" + +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "rna_internal.h" -#include "DNA_group_types.h" - #ifdef RNA_RUNTIME #include "DNA_scene_types.h" diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index be462e20ee7..81136193883 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -24,21 +24,22 @@ * \ingroup RNA */ - #include <stdlib.h> -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_image_types.h" #include "DNA_scene_types.h" +#include "BLI_utildefines.h" + #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_image.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + #include "WM_types.h" #include "WM_api.h" @@ -454,7 +455,6 @@ static void rna_def_imageuser(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "offset"); RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "sfra"); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 5d45e0d23b6..c1769f02974 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -34,13 +34,15 @@ #include <string.h> #include <time.h> -#include "RNA_define.h" -#include "RNA_enum_types.h" - #include "DNA_packedFile_types.h" +#include "BLI_utildefines.h" + #include "BIF_gl.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + #include "rna_internal.h" /* own include */ #ifdef RNA_RUNTIME diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 1c0909c946f..550a3d8f353 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -24,12 +24,13 @@ * \ingroup RNA */ - #ifndef __RNA_INTERNAL_H__ #define __RNA_INTERNAL_H__ #include "UI_resources.h" +#include "BLI_utildefines.h" + #include "rna_internal_types.h" #define RNA_MAGIC ((int)~0) @@ -211,9 +212,9 @@ void rna_ID_name_get(struct PointerRNA *ptr, char *value); int rna_ID_name_length(struct PointerRNA *ptr); void rna_ID_name_set(struct PointerRNA *ptr, const char *value); struct StructRNA *rna_ID_refine(struct PointerRNA *ptr); -struct IDProperty *rna_ID_idprops(struct PointerRNA *ptr, int create); +struct IDProperty *rna_ID_idprops(struct PointerRNA *ptr, bool create); void rna_ID_fake_user_set(struct PointerRNA *ptr, int value); -struct IDProperty *rna_PropertyGroup_idprops(struct PointerRNA *ptr, int create); +struct IDProperty *rna_PropertyGroup_idprops(struct PointerRNA *ptr, bool create); void rna_PropertyGroup_unregister(struct Main *bmain, struct StructRNA *type); struct StructRNA *rna_PropertyGroup_register(struct Main *bmain, struct ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, @@ -422,6 +423,4 @@ int rna_IDMaterials_assign_int(struct PointerRNA *ptr, int key, const struct Poi void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values); void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values); -#endif /* __RNA_INTERNAL_H__ */ - - +#endif /* __RNA_INTERNAL_H__ */ diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 43ec09de010..1dce89c343d 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -66,7 +66,7 @@ typedef void (*ContextPropUpdateFunc)(struct bContext *C, struct PointerRNA *ptr typedef void (*ContextUpdateFunc)(struct bContext *C, struct PointerRNA *ptr); typedef int (*EditableFunc)(struct PointerRNA *ptr); typedef int (*ItemEditableFunc)(struct PointerRNA *ptr, int index); -typedef struct IDProperty *(*IDPropertiesFunc)(struct PointerRNA *ptr, int create); +typedef struct IDProperty *(*IDPropertiesFunc)(struct PointerRNA *ptr, bool create); typedef struct StructRNA *(*StructRefineFunc)(struct PointerRNA *ptr); typedef char *(*StructPathFunc)(struct PointerRNA *ptr); diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 33bbaeec282..1577019f22a 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -24,14 +24,8 @@ * \ingroup RNA */ - #include <stdlib.h> -#include "RNA_access.h" -#include "RNA_define.h" - -#include "rna_internal.h" - #include "DNA_ID.h" #include "DNA_scene_types.h" #include "DNA_curve_types.h" @@ -39,6 +33,13 @@ #include "DNA_lattice_types.h" #include "DNA_mesh_types.h" +#include "BLI_utildefines.h" + +#include "RNA_access.h" +#include "RNA_define.h" + +#include "rna_internal.h" + #ifdef RNA_RUNTIME #include <stddef.h> diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 660f6fc6ab7..912f4d914cb 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -24,20 +24,20 @@ * \ingroup RNA */ - #include <stdlib.h> +#include "BLI_math_base.h" + +#include "BLF_translation.h" + #include "RNA_define.h" #include "RNA_enum_types.h" - #include "rna_internal.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" #include "DNA_texture_types.h" -#include "BLI_math_base.h" - #ifdef RNA_RUNTIME #include "MEM_guardedalloc.h" @@ -364,6 +364,7 @@ static void rna_def_lamp(BlenderRNA *brna) prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, lamp_type_items); RNA_def_property_ui_text(prop, "Type", "Type of Lamp"); + RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_LAMP); RNA_def_property_update(prop, 0, "rna_Lamp_draw_update"); prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index e4a29d9c674..b2790a25e47 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -24,19 +24,19 @@ * \ingroup RNA */ - #include <stdlib.h> -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_curve_types.h" #include "DNA_key_types.h" #include "DNA_lattice_types.h" #include "DNA_meshdata_types.h" +#include "BLI_utildefines.h" + +#include "RNA_define.h" +#include "RNA_enum_types.h" +#include "rna_internal.h" + #ifdef RNA_RUNTIME #include "DNA_object_types.h" diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 32db099c0c0..06a7b4aa11b 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -27,6 +27,7 @@ #include <stdlib.h> #include <string.h> +#include "BLI_utildefines.h" #include "BLI_path_util.h" #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 75ad64b1f29..de7911aeccb 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -36,8 +36,8 @@ #include "DNA_ID.h" #include "DNA_modifier_types.h" -#include "BLI_path_util.h" #include "BLI_utildefines.h" +#include "BLI_path_util.h" #include "RNA_define.h" #include "RNA_access.h" diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index 3f23a376ea3..72b0030ee23 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -31,6 +31,10 @@ #include "MEM_guardedalloc.h" +#include "DNA_mask_types.h" +#include "DNA_object_types.h" /* SELECT */ +#include "DNA_scene_types.h" + #include "BKE_movieclip.h" #include "BKE_tracking.h" @@ -39,10 +43,6 @@ #include "rna_internal.h" -#include "DNA_mask_types.h" -#include "DNA_object_types.h" /* SELECT */ -#include "DNA_scene_types.h" - #include "WM_types.h" #include "IMB_imbuf_types.h" diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 35173c290de..d1c81200e6a 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -24,17 +24,16 @@ * \ingroup RNA */ - #include <float.h> #include <stdlib.h> +#include "DNA_material_types.h" +#include "DNA_texture_types.h" + #include "RNA_define.h" #include "rna_internal.h" -#include "DNA_material_types.h" -#include "DNA_texture_types.h" - #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 2fcec014a9c..73d77c2d0c4 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -28,28 +28,27 @@ * \ingroup RNA */ - #include <stdlib.h> #include "MEM_guardedalloc.h" -#include "RNA_access.h" -#include "RNA_define.h" -#include "RNA_types.h" - -#include "rna_internal.h" - #include "DNA_material_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" -#include "WM_types.h" - #include "BLI_array.h" #include "BLI_math_base.h" #include "BLI_math_rotation.h" +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_types.h" + +#include "rna_internal.h" + +#include "WM_types.h" + #ifdef RNA_RUNTIME #include "DNA_scene_types.h" @@ -552,7 +551,7 @@ DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, rende /* MeshUVLoopLayer */ -static char *rna_MeshUVLoopLayer_path(PointerRNA * ptr) +static char *rna_MeshUVLoopLayer_path(PointerRNA *ptr) { return BLI_sprintfN("uv_layers[\"%s\"]", ((CustomDataLayer *)ptr->data)->name); } diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index 4813f25dea7..f38151fd721 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -24,18 +24,19 @@ * \ingroup RNA */ - #include <stdlib.h> +#include "DNA_mesh_types.h" +#include "DNA_meta_types.h" + +#include "BLI_utildefines.h" + #include "RNA_access.h" #include "RNA_define.h" #include "RNA_enum_types.h" #include "rna_internal.h" -#include "DNA_mesh_types.h" -#include "DNA_meta_types.h" - #ifdef RNA_RUNTIME #include "BLI_math.h" diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 810999033a4..fa436e30200 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -29,11 +29,6 @@ #include <limits.h> #include <stdlib.h> -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_armature_types.h" #include "DNA_mesh_types.h" #include "DNA_modifier_types.h" @@ -53,6 +48,11 @@ #include "BKE_multires.h" #include "BKE_smoke.h" /* For smokeModifier_free & smokeModifier_createType */ +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + #include "WM_api.h" #include "WM_types.h" @@ -2593,6 +2593,13 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Factor", "Amount to deform object"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "factor"); + RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); + RNA_def_property_ui_range(prop, -10, 10, 1, 3); + RNA_def_property_ui_text(prop, "Angle", "Angle of deformation"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "limits", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "limit"); RNA_def_property_array(prop, 2); @@ -2641,6 +2648,13 @@ static void rna_def_modifier_solidify(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Thickness", "Thickness of the shell"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "thickness_clamp", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "offset_clamp"); + RNA_def_property_range(prop, 0, 100.0); + RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 4); + RNA_def_property_ui_text(prop, "Clamp", "Offset clamp based on geometry scale"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg"); RNA_def_property_range(prop, 0.0, 1.0); diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index 3b018591455..cc3d5e5ca5e 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -25,7 +25,6 @@ * \ingroup RNA */ - #include <stdlib.h> #include <limits.h> @@ -34,13 +33,13 @@ #include "BKE_movieclip.h" #include "BKE_tracking.h" +#include "DNA_movieclip_types.h" +#include "DNA_scene_types.h" + #include "RNA_define.h" #include "rna_internal.h" -#include "DNA_movieclip_types.h" -#include "DNA_scene_types.h" - #include "WM_types.h" #include "IMB_imbuf_types.h" diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 2b7f6a182a0..9afaad96019 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -24,20 +24,21 @@ * \ingroup RNA */ - #include <stdlib.h> -#include "RNA_access.h" -#include "RNA_define.h" - -#include "rna_internal.h" - #include "DNA_anim_types.h" #include "DNA_action_types.h" #include "DNA_scene_types.h" +#include "BLI_utildefines.h" + #include "MEM_guardedalloc.h" +#include "RNA_access.h" +#include "RNA_define.h" + +#include "rna_internal.h" + #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 73fe5f3a48d..933b7a78b59 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -27,13 +27,6 @@ #include <stdlib.h> #include <string.h> -#include "RNA_access.h" -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" -#include "rna_internal_types.h" - #include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_string.h" @@ -54,7 +47,15 @@ #include "BKE_texture.h" #include "BKE_idprop.h" +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" +#include "rna_internal_types.h" + #include "IMB_imbuf.h" +#include "IMB_imbuf_types.h" #include "WM_types.h" @@ -521,6 +522,38 @@ static void rna_Node_material_update(Main *bmain, Scene *scene, PointerRNA *ptr) node_update(bmain, scene, ntree, node); } +static void rna_NodeTree_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + bNodeTree *ntree = (bNodeTree *)ptr->id.data; + + /* when using border, make it so no old data from outside of + * border is hanging around + * ideally shouldn't be in RNA callback, but how to teach + * compo to only clear frame when border usage is actually + * toggling + */ + if (ntree->flag & NTREE_VIEWER_BORDER) { + Image *ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node"); + void *lock; + ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + + if (ibuf) { + if (ibuf->rect) + memset(ibuf->rect, 0, 4 * ibuf->x * ibuf->y); + + if (ibuf->rect_float) + memset(ibuf->rect_float, 0, 4 * ibuf->x * ibuf->y * sizeof(float)); + + ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID; + } + + BKE_image_release_ibuf(ima, ibuf, lock); + } + + WM_main_add_notifier(NC_NODE | NA_EDITED, NULL); + WM_main_add_notifier(NC_SCENE | ND_NODES, &ntree->id); +} + static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bNodeTree *ntree = (bNodeTree *)ptr->id.data; @@ -1009,6 +1042,16 @@ static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *rep return NULL; } +static void rna_Image_Node_update_id(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + bNodeTree *ntree = (bNodeTree *)ptr->id.data; + bNode *node = (bNode *)ptr->data; + + node->update |= NODE_UPDATE_ID; + node_update(bmain, scene, ntree, node); + node->update &= ~NODE_UPDATE_ID; +} + static void rna_Mapping_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bNode *node = ptr->data; @@ -1193,7 +1236,7 @@ static void rna_ShaderNodeScript_bytecode_set(PointerRNA *ptr, const char *value nss->bytecode = NULL; } -static IDProperty *rna_ShaderNodeScript_idprops(PointerRNA *ptr, int create) +static IDProperty *rna_ShaderNodeScript_idprops(PointerRNA *ptr, bool create) { bNode *node = (bNode *)ptr->data; NodeShaderScript *nss = node->storage; @@ -2411,7 +2454,7 @@ static void def_cmp_image(StructRNA *srna) RNA_def_property_struct_type(prop, "Image"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Image", ""); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Image_Node_update_id"); prop = RNA_def_property(srna, "use_straight_alpha_output", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT); @@ -4091,7 +4134,7 @@ static void def_cmp_viewer(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 1); + RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", CMP_NODE_OUTPUT_IGNORE_ALPHA); RNA_def_property_ui_text(prop, "Use Alpha", "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } @@ -4101,7 +4144,7 @@ static void def_cmp_composite(StructRNA *srna) PropertyRNA *prop; prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 1); + RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", CMP_NODE_OUTPUT_IGNORE_ALPHA); RNA_def_property_ui_text(prop, "Use Alpha", "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } @@ -4985,6 +5028,11 @@ static void rna_def_composite_nodetree(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_TWO_PASS); RNA_def_property_ui_text(prop, "Two Pass", "Use two pass execution during editing: first calculate fast nodes, " "second pass calculate all nodes"); + + prop = RNA_def_property(srna, "use_viewer_border", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_VIEWER_BORDER); + RNA_def_property_ui_text(prop, "Viewer Border", "Use boundaries for viewer nodes and composite backdrop"); + RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update"); } static void rna_def_shader_nodetree(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 2c736df1ed2..531794f7ab4 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -24,16 +24,9 @@ * \ingroup RNA */ - #include <stdio.h> #include <stdlib.h> -#include "RNA_access.h" -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_action_types.h" #include "DNA_customdata_types.h" #include "DNA_controller_types.h" @@ -52,6 +45,12 @@ #include "BKE_tessmesh.h" #include "BKE_group.h" /* needed for object_in_group() */ +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + #include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */ #include "ED_mesh.h" diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index ec974df54d5..ab8b54334fe 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -24,13 +24,8 @@ * \ingroup RNA */ - #include <stdlib.h> -#include "RNA_define.h" - -#include "rna_internal.h" - #include "DNA_cloth_types.h" #include "DNA_object_types.h" #include "DNA_object_force.h" @@ -38,6 +33,10 @@ #include "DNA_scene_types.h" #include "DNA_smoke_types.h" +#include "RNA_define.h" + +#include "rna_internal.h" + #include "WM_api.h" #include "WM_types.h" @@ -484,7 +483,7 @@ static void rna_FieldSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), part->pd->tex = NULL; } - if (part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) { + if (part->pd2 && part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) { part->pd2->tex->id.us--; part->pd2->tex = NULL; } diff --git a/source/blender/makesrna/intern/rna_packedfile.c b/source/blender/makesrna/intern/rna_packedfile.c index e691ca46c69..a72188591a1 100644 --- a/source/blender/makesrna/intern/rna_packedfile.c +++ b/source/blender/makesrna/intern/rna_packedfile.c @@ -24,15 +24,16 @@ * \ingroup RNA */ - #include <stdlib.h> +#include "BLI_utildefines.h" + +#include "DNA_packedFile_types.h" + #include "RNA_define.h" #include "rna_internal.h" -#include "DNA_packedFile_types.h" - EnumPropertyItem unpack_method_items[] = { {PF_USE_LOCAL, "USE_LOCAL", 0, "Use Local File", ""}, {PF_WRITE_LOCAL, "WRITE_LOCAL", 0, "Write Local File (overwrite existing)", ""}, diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 4bf5de03b05..c675aa6ebc3 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -27,16 +27,10 @@ * \ingroup RNA */ - #include <stdio.h> #include <stdlib.h> #include <limits.h> -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_material_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" @@ -48,6 +42,11 @@ #include "DNA_boid_types.h" #include "DNA_texture_types.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + #include "WM_types.h" #include "WM_api.h" diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 1ed675962f3..6a1b3d4cfc5 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -159,7 +159,7 @@ static void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value) BLI_uniquename(&ob->pose->agroups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); } -static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, int create) +static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, bool create) { bPoseChannel *pchan = ptr->data; @@ -444,7 +444,7 @@ static void rna_pose_bgroup_name_index_set(PointerRNA *ptr, const char *value, s int a; for (a = 1, grp = pose->agroups.first; grp; grp = grp->next, a++) { - if (strcmp(grp->name, value) == 0) { + if (STREQ(grp->name, value)) { *index = a; return; } @@ -459,7 +459,7 @@ static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *r bActionGroup *grp; for (grp = pose->agroups.first; grp; grp = grp->next) { - if (strcmp(grp->name, value) == 0) { + if (STREQ(grp->name, value)) { BLI_strncpy(result, value, maxlen); return; } diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index e2e373d8beb..8cf352311f7 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -28,6 +28,7 @@ #include "DNA_scene_types.h" +#include "BLI_utildefines.h" #include "BLI_path_util.h" #include "RNA_define.h" @@ -225,6 +226,20 @@ static StructRNA *rna_RenderEngine_refine(PointerRNA *ptr) return (engine->type && engine->type->ext.srna) ? engine->type->ext.srna : &RNA_RenderEngine; } +static PointerRNA rna_RenderEngine_render_get(PointerRNA *ptr) +{ + RenderEngine *engine = (RenderEngine *)ptr->data; + + if (engine->re) { + RenderData *r = RE_engine_get_render_data(engine->re); + + return rna_pointer_inherit_refine(ptr, &RNA_RenderSettings, r); + } + else { + return rna_pointer_inherit_refine(ptr, &RNA_RenderSettings, NULL); + } +} + static void rna_RenderResult_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { RenderResult *rr = (RenderResult *)ptr->data; @@ -406,6 +421,12 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "resolution_y"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + /* Render Data */ + prop = RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "RenderSettings"); + RNA_def_property_pointer_funcs(prop, "rna_RenderEngine_render_get", NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Render Data", ""); + prop = RNA_def_property(srna, "use_highlight_tiles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_HIGHLIGHT_TILES); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 9bd20d854e7..17b01de1eeb 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -24,11 +24,12 @@ * \ingroup RNA */ - #include <stdlib.h> #include "DNA_ID.h" +#include "BLI_utildefines.h" + #include "RNA_access.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -65,6 +66,7 @@ EnumPropertyItem property_subtype_items[] = { {PROP_ANGLE, "ANGLE", 0, "Angle", ""}, {PROP_TIME, "TIME", 0, "Time", ""}, {PROP_DISTANCE, "DISTANCE", 0, "Distance", ""}, + {PROP_DISTANCE_CAMERA, "DISTANCE_CAMERA", 0, "Camera Distance", ""}, /* number arrays */ {PROP_COLOR, "COLOR", 0, "Color", ""}, @@ -96,6 +98,7 @@ EnumPropertyItem property_unit_items[] = { {PROP_UNIT_TIME, "TIME", 0, "Time", ""}, {PROP_UNIT_VELOCITY, "VELOCITY", 0, "Velocity", ""}, {PROP_UNIT_ACCELERATION, "ACCELERATION", 0, "Acceleration", ""}, + {PROP_UNIT_CAMERA, "CAMERA", 0, "Camera", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 906c8853179..23a3c2188da 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -26,11 +26,6 @@ #include <stdlib.h> -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_brush_types.h" #include "DNA_group_types.h" #include "DNA_modifier_types.h" @@ -49,6 +44,11 @@ #include "BKE_tessmesh.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + /* Include for Bake Options */ #include "RE_engine.h" #include "RE_pipeline.h" @@ -3578,8 +3578,9 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {CODEC_ID_THEORA, "THEORA", 0, "Theora", ""}, {CODEC_ID_FLV1, "FLASH", 0, "Flash Video", ""}, {CODEC_ID_FFV1, "FFV1", 0, "FFmpeg video codec #1", ""}, - {CODEC_ID_QTRLE, "QTRLE", 0, "QTRLE", ""}, + {CODEC_ID_QTRLE, "QTRLE", 0, "QT rle / QT Animation", ""}, {CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""}, + {CODEC_ID_PNG, "PNG", 0, "PNG", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index b3619330e7a..82f054e62e0 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -32,6 +32,7 @@ #include <stdlib.h> #include <stdio.h> +#include "BLI_utildefines.h" #include "BLI_path_util.h" #include "RNA_define.h" @@ -114,12 +115,13 @@ static void rna_Scene_collada_export( int use_ngons, int use_object_instantiation, int sort_by_name, + int export_transformation_type, int second_life) { collada_export(scene, filepath, apply_modifiers, export_mesh_type, selected, include_children, include_armatures, include_shapekeys, deform_bones_only, active_uv_only, include_uv_textures, include_material_textures, - use_texture_copies, use_ngons, use_object_instantiation, sort_by_name, second_life); + use_texture_copies, use_ngons, use_object_instantiation, sort_by_name, export_transformation_type, second_life); } #endif @@ -165,6 +167,10 @@ void RNA_api_scene(StructRNA *srna) parm = RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances", "Instantiate multiple Objects from same Data"); parm = RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name"); parm = RNA_def_boolean(func, "second_life", 0, "Export for Second Life", "Compatibility mode for Second Life"); + + parm = RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX, + "Transformation", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX); + RNA_def_function_ui_description(func, "Export to collada file"); #endif } diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index e0687295c70..b8b4ad5bb76 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -451,12 +451,7 @@ static void rna_def_image_paint(BlenderRNA *brna) RNA_def_struct_path_func(srna, "rna_ImagePaintSettings_path"); RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode"); - /* booleans */ - prop = RNA_def_property(srna, "use_projection", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_DISABLE); - RNA_def_property_ui_text(prop, "Project Paint", - "Use projection painting for improved consistency in the brush strokes"); - + /* booleans */ prop = RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY); RNA_def_property_ui_text(prop, "Occlude", "Only paint onto the faces directly under the brush (slower)"); diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 6097fa2ae96..547d0ff78c9 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -24,19 +24,20 @@ * \ingroup RNA */ - #include <stdlib.h> +#include "DNA_constraint_types.h" +#include "DNA_object_types.h" +#include "DNA_sensor_types.h" + +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "RNA_enum_types.h" #include "RNA_access.h" #include "rna_internal.h" -#include "DNA_constraint_types.h" -#include "DNA_object_types.h" -#include "DNA_sensor_types.h" - #include "WM_types.h" /* Always keep in alphabetical order */ diff --git a/source/blender/makesrna/intern/rna_sensor_api.c b/source/blender/makesrna/intern/rna_sensor_api.c index d920cbef4a2..476f0589bc9 100644 --- a/source/blender/makesrna/intern/rna_sensor_api.c +++ b/source/blender/makesrna/intern/rna_sensor_api.c @@ -28,15 +28,17 @@ * \ingroup RNA */ - #include <stdlib.h> #include <stdio.h> -#include "WM_types.h" +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "rna_internal.h" /* own include */ +#include "WM_types.h" + #ifdef RNA_RUNTIME #include "BKE_sca.h" diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index a2704619ee6..9b81f042358 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -24,16 +24,9 @@ * \ingroup RNA */ - #include <stdlib.h> #include <limits.h> -#include "RNA_access.h" -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_anim_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -49,6 +42,12 @@ #include "MEM_guardedalloc.h" +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + #include "WM_types.h" #include "BLF_translation.h" diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 386263c784e..0c58d5cab6b 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -28,17 +28,17 @@ #include <stdio.h> #include <string.h> +#include "DNA_scene_types.h" +#include "DNA_sequence_types.h" + +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "RNA_access.h" #include "RNA_define.h" #include "rna_internal.h" -#include "DNA_scene_types.h" -#include "DNA_sequence_types.h" - -#include "BLI_utildefines.h" - #ifdef RNA_RUNTIME //#include "DNA_anim_types.h" diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index f1f4c13731f..4bfc54c25ed 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -24,16 +24,10 @@ * \ingroup RNA */ - #include <stdlib.h> #include "MEM_guardedalloc.h" -#include "RNA_access.h" -#include "RNA_define.h" - -#include "rna_internal.h" - #include "BLF_translation.h" #include "BKE_key.h" @@ -49,6 +43,11 @@ #include "DNA_mask_types.h" #include "DNA_view3d_types.h" +#include "RNA_access.h" +#include "RNA_define.h" + +#include "rna_internal.h" + #include "WM_api.h" #include "WM_types.h" @@ -3340,6 +3339,7 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "view"); RNA_def_property_enum_items(prop, view_items); RNA_def_property_ui_text(prop, "View", "Type of the clip editor view"); + RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_MOVIECLIP); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_view_type_update"); /* show pattern */ @@ -3513,6 +3513,7 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "gpencil_src"); RNA_def_property_enum_items(prop, gpencil_source_items); RNA_def_property_ui_text(prop, "Grease Pencil Source", "Where the grease pencil comes from"); + RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_MOVIECLIP); RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL); /* pivot point */ diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c index 5f67f367195..de398bc10a6 100644 --- a/source/blender/makesrna/intern/rna_text_api.c +++ b/source/blender/makesrna/intern/rna_text_api.c @@ -24,10 +24,11 @@ * \ingroup RNA */ - #include <stdlib.h> #include <stdio.h> +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "rna_internal.h" /* own include */ diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index e007fe67c0b..d86e5fd0d9c 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -24,16 +24,10 @@ * \ingroup RNA */ - #include <float.h> #include <stdio.h> #include <stdlib.h> -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_brush_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" @@ -48,6 +42,11 @@ #include "BKE_node.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + #include "WM_api.h" #include "WM_types.h" @@ -1196,6 +1195,11 @@ static void rna_def_texture_image(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis"); RNA_def_property_update(prop, 0, "rna_Texture_update"); + prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_USEALPHA); + RNA_def_property_ui_text(prop, "Use Alpha", "Use the alpha channel information in the image"); + RNA_def_property_update(prop, 0, "rna_Texture_update"); + prop = RNA_def_property(srna, "use_calculate_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_CALCALPHA); RNA_def_property_ui_text(prop, "Calculate Alpha", "Calculate an alpha channel based on RGB values in the image"); diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c index 218fda361fa..10ac5a9548a 100644 --- a/source/blender/makesrna/intern/rna_texture_api.c +++ b/source/blender/makesrna/intern/rna_texture_api.c @@ -28,6 +28,7 @@ #include <stdio.h> #include <string.h> +#include "BLI_utildefines.h" #include "BLI_path_util.h" #include "RNA_define.h" diff --git a/source/blender/makesrna/intern/rna_timeline.c b/source/blender/makesrna/intern/rna_timeline.c index 3842fe95894..a732b550261 100644 --- a/source/blender/makesrna/intern/rna_timeline.c +++ b/source/blender/makesrna/intern/rna_timeline.c @@ -24,15 +24,14 @@ * \ingroup RNA */ - #include <stdlib.h> +#include "DNA_scene_types.h" + #include "RNA_define.h" #include "rna_internal.h" -#include "DNA_scene_types.h" - #include "WM_types.h" #ifdef RNA_RUNTIME diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 798395b9fef..6f0478b5eec 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -113,6 +113,7 @@ static void rna_tracking_active_object_index_set(PointerRNA *ptr, int value) MovieClip *clip = (MovieClip *)ptr->id.data; clip->tracking.objectnr = value; + BKE_tracking_dopesheet_tag_update(&clip->tracking); } static void rna_tracking_active_object_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index e5585b4f72d..05056574a71 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -29,6 +29,8 @@ #include "DNA_screen_types.h" +#include "BLF_translation.h" + #include "RNA_define.h" #include "rna_internal.h" @@ -226,6 +228,7 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat memcpy(pt, &dummypt, sizeof(dummypt)); pt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, pt->idname, &RNA_Panel); + RNA_def_struct_translation_context(pt->ext.srna, pt->translation_context); pt->ext.data = data; pt->ext.call = call; pt->ext.free = free; @@ -573,6 +576,7 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data } mt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, mt->idname, &RNA_Menu); + RNA_def_struct_translation_context(mt->ext.srna, mt->translation_context); mt->ext.data = data; mt->ext.call = call; mt->ext.free = free; @@ -773,6 +777,7 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_struct_sdna(srna, "Panel"); RNA_def_struct_refine_func(srna, "rna_Panel_refine"); RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister", NULL); + RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_DEFAULT); /* poll */ func = RNA_def_function(srna, "poll", NULL); @@ -819,7 +824,13 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Label", "The panel label, shows up in the panel header at the right of the " "triangle used to collapse the panel"); - + + prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "type->translation_context"); + RNA_def_property_string_default(prop, BLF_I18NCONTEXT_DEFAULT); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + RNA_define_verify_sdna(TRUE); + prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type->space_type"); RNA_def_property_enum_items(prop, space_type_items); @@ -956,6 +967,7 @@ static void rna_def_menu(BlenderRNA *brna) RNA_def_struct_sdna(srna, "Menu"); RNA_def_struct_refine_func(srna, "rna_Menu_refine"); RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister", NULL); + RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_DEFAULT); /* poll */ func = RNA_def_function(srna, "poll", NULL); @@ -972,7 +984,7 @@ static void rna_def_menu(BlenderRNA *brna) parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_define_verify_sdna(0); /* not in sdna */ + RNA_define_verify_sdna(FALSE); /* not in sdna */ prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "layout"); @@ -994,6 +1006,11 @@ static void rna_def_menu(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", "The menu label"); + prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "type->translation_context"); + RNA_def_property_string_default(prop, BLF_I18NCONTEXT_DEFAULT); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 0ce98e0b364..0204fa5367b 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -595,7 +595,7 @@ void RNA_api_ui_layout(StructRNA *srna) func = RNA_def_function(srna, "label", "rna_uiItemL"); RNA_def_function_ui_description(func, "Item. Display text and/or icon in the layout"); - api_ui_item_common(func); + api_ui_item_common(func); parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item " diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 6c6bb560192..c7b5d30e4d1 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -26,12 +26,6 @@ #include <stdlib.h> -#include "RNA_access.h" -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_curve_types.h" #include "DNA_space_types.h" #include "DNA_userdef_types.h" @@ -39,16 +33,22 @@ #include "DNA_view3d_types.h" #include "DNA_scene_types.h" -#include "WM_api.h" -#include "WM_types.h" - #include "BLI_utildefines.h" -#include "BLF_translation.h" - #include "BKE_sound.h" #include "BKE_addon.h" +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "BLF_translation.h" + #ifdef WITH_CYCLES static EnumPropertyItem compute_device_type_items[] = { {USER_COMPUTE_DEVICE_NONE, "NONE", 0, "None", "Don't use compute device"}, @@ -278,7 +278,8 @@ static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRN { Object *ob; - vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL); + bTheme *btheme = UI_GetTheme(); + vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL, btheme->tv3d.vertex_unreferenced); for (ob = bmain->object.first; ob; ob = ob->id.next) { if (ob->mode & OB_MODE_WEIGHT_PAINT) @@ -442,7 +443,7 @@ static EnumPropertyItem *rna_lang_enum_properties_itemf(bContext *UNUSED(C), Poi } #endif -static IDProperty *rna_AddonPref_idprops(PointerRNA *ptr, int create) +static IDProperty *rna_AddonPref_idprops(PointerRNA *ptr, bool create) { if (create && !ptr->data) { IDPropertyTemplate val = {0}; @@ -1164,6 +1165,11 @@ static void rna_def_userdef_theme_spaces_vertex(StructRNA *srna) RNA_def_property_range(prop, 1, 10); RNA_def_property_ui_text(prop, "Vertex Size", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "vertex_unreferenced", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Vertex Group Unreferenced", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); } static void rna_def_userdef_theme_spaces_edge(StructRNA *srna) @@ -3464,6 +3470,12 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_ui_text(prop, "GPU Mipmap Generation", "Generate Image Mipmaps on the GPU"); RNA_def_property_update(prop, 0, "rna_userdef_gl_gpu_mipmaps"); + prop = RNA_def_property(srna, "image_gpubuffer_limit", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "image_gpubuffer_limit"); + RNA_def_property_range(prop, 0, 128); + RNA_def_property_ui_text(prop, "Image GPU draw limit", "If set, amount of Mega Pixels to use for drawing Images as GPU textures"); + + prop = RNA_def_property(srna, "use_vertex_buffer_objects", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_VBO); RNA_def_property_ui_text(prop, "VBOs", diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 0c1c5d8f64a..f42197ec0a9 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -24,20 +24,23 @@ * \ingroup RNA */ - #include <stdlib.h> +#include "DNA_screen_types.h" +#include "DNA_space_types.h" +#include "DNA_userdef_types.h" +#include "DNA_windowmanager_types.h" + +#include "BLI_utildefines.h" + +#include "BLF_translation.h" + #include "RNA_access.h" #include "RNA_define.h" #include "RNA_enum_types.h" #include "rna_internal.h" -#include "DNA_screen_types.h" -#include "DNA_space_types.h" -#include "DNA_userdef_types.h" -#include "DNA_windowmanager_types.h" - #include "WM_types.h" EnumPropertyItem event_keymouse_value_items[] = { @@ -466,7 +469,7 @@ static StructRNA *rna_OperatorProperties_refine(PointerRNA *ptr) return ptr->type; } -static IDProperty *rna_OperatorProperties_idprops(PointerRNA *ptr, int create) +static IDProperty *rna_OperatorProperties_idprops(PointerRNA *ptr, bool create) { if (create && !ptr->data) { IDPropertyTemplate val = {0}; @@ -946,7 +949,7 @@ static int operator_check(bContext *C, wmOperator *op) return result; } -static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int operator_invoke(bContext *C, wmOperator *op, const wmEvent *event) { extern FunctionRNA rna_Operator_invoke_func; @@ -973,7 +976,7 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) } /* same as invoke */ -static int operator_modal(bContext *C, wmOperator *op, wmEvent *event) +static int operator_modal(bContext *C, wmOperator *op, const wmEvent *event) { extern FunctionRNA rna_Operator_modal_func; @@ -1049,6 +1052,7 @@ void macro_wrapper(wmOperatorType *ot, void *userdata); static char _operator_idname[OP_MAX_TYPENAME]; static char _operator_name[OP_MAX_TYPENAME]; static char _operator_descr[RNA_DYN_DESCR_MAX]; +static char _operator_ctxt[RNA_DYN_DESCR_MAX]; static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { @@ -1062,10 +1066,13 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void * dummyot.idname = _operator_idname; /* only assigne the pointer, string is NULL'd */ dummyot.name = _operator_name; /* only assigne the pointer, string is NULL'd */ dummyot.description = _operator_descr; /* only assigne the pointer, string is NULL'd */ + dummyot.translation_context = _operator_ctxt; /* only assigne the pointer, string is NULL'd */ RNA_pointer_create(NULL, &RNA_Operator, &dummyop, &dummyotr); /* clear in case they are left unset */ _operator_idname[0] = _operator_name[0] = _operator_descr[0] = '\0'; + /* We have to set default op context! */ + strcpy(_operator_ctxt, BLF_I18NCONTEXT_OPERATOR_DEFAULT); /* validate the python class */ if (validate(&dummyotr, data, have_function) != 0) @@ -1116,9 +1123,10 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void * int idlen = strlen(_operator_idname) + 4; int namelen = strlen(_operator_name) + 1; int desclen = strlen(_operator_descr) + 1; + int ctxtlen = strlen(_operator_ctxt) + 1; char *ch; /* 2 terminators and 3 to convert a.b -> A_OT_b */ - ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); + ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen + ctxtlen), "_operator_idname"); WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */ dummyot.idname = ch; ch += idlen; @@ -1127,6 +1135,9 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void * ch += namelen; strcpy(ch, _operator_descr); dummyot.description = ch; + ch += desclen; + strcpy(ch, _operator_ctxt); + dummyot.translation_context = ch; } } @@ -1143,6 +1154,7 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void * /* create a new operator type */ dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator); RNA_def_struct_flag(dummyot.ext.srna, STRUCT_NO_IDPROPERTIES); /* operator properties are registered separately */ + RNA_def_struct_translation_context(dummyot.ext.srna, dummyot.translation_context); dummyot.ext.data = data; dummyot.ext.call = call; dummyot.ext.free = free; @@ -1181,8 +1193,14 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v dummyot.idname = _operator_idname; /* only assigne the pointer, string is NULL'd */ dummyot.name = _operator_name; /* only assigne the pointer, string is NULL'd */ dummyot.description = _operator_descr; /* only assigne the pointer, string is NULL'd */ + dummyot.translation_context = _operator_ctxt; /* only assigne the pointer, string is NULL'd */ RNA_pointer_create(NULL, &RNA_Macro, &dummyop, &dummyotr); + /* clear in case they are left unset */ + _operator_idname[0] = _operator_name[0] = _operator_descr[0] = '\0'; + /* We have to set default op context! */ + strcpy(_operator_ctxt, BLF_I18NCONTEXT_OPERATOR_DEFAULT); + /* validate the python class */ if (validate(&dummyotr, data, have_function) != 0) return NULL; @@ -1192,9 +1210,10 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v int idlen = strlen(_operator_idname) + 4; int namelen = strlen(_operator_name) + 1; int desclen = strlen(_operator_descr) + 1; + int ctxtlen = strlen(_operator_ctxt) + 1; char *ch; /* 2 terminators and 3 to convert a.b -> A_OT_b */ - ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); + ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen + ctxtlen), "_operator_idname"); WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */ dummyot.idname = ch; ch += idlen; @@ -1203,6 +1222,9 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v ch += namelen; strcpy(ch, _operator_descr); dummyot.description = ch; + ch += desclen; + strcpy(ch, _operator_ctxt); + dummyot.translation_context = ch; } if (strlen(identifier) >= sizeof(dummyop.idname)) { @@ -1223,6 +1245,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v /* create a new operator type */ dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator); + RNA_def_struct_translation_context(dummyot.ext.srna, dummyot.translation_context); dummyot.ext.data = data; dummyot.ext.call = call; dummyot.ext.free = free; @@ -1272,6 +1295,16 @@ static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value) assert(!"setting the bl_label on a non-builtin operator"); } +static void rna_Operator_bl_translation_context_set(PointerRNA *ptr, const char *value) +{ + wmOperator *data = (wmOperator *)(ptr->data); + char *str = (char *)data->type->translation_context; + if (!str[0]) + BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ + else + assert(!"setting the bl_translation_context on a non-builtin operator"); +} + static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value) { wmOperator *data = (wmOperator *)(ptr->data); @@ -1302,6 +1335,7 @@ static void rna_def_operator(BlenderRNA *brna) #ifdef WITH_PYTHON RNA_def_struct_register_funcs(srna, "rna_Operator_register", "rna_Operator_unregister", "rna_Operator_instance"); #endif + RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -1340,6 +1374,14 @@ static void rna_def_operator(BlenderRNA *brna) /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ RNA_def_property_flag(prop, PROP_REGISTER); + prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "type->translation_context"); + RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set"); + RNA_def_property_string_default(prop, BLF_I18NCONTEXT_OPERATOR_DEFAULT); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ + prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ @@ -1376,6 +1418,7 @@ static void rna_def_macro_operator(BlenderRNA *brna) RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister", "rna_Operator_instance"); #endif + RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -1404,6 +1447,14 @@ static void rna_def_macro_operator(BlenderRNA *brna) /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ RNA_def_property_flag(prop, PROP_REGISTER); + prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "type->translation_context"); + RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set"); + RNA_def_property_string_default(prop, BLF_I18NCONTEXT_OPERATOR_DEFAULT); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ + prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index b7895cc0e2d..64c5f7ae220 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -86,6 +86,16 @@ static void rna_event_timer_remove(struct wmWindowManager *wm, wmTimer *timer) WM_event_remove_timer(wm, timer->win, timer); } +/* wrap these because of 'const wmEvent *' */ +static int rna_Operator_confirm(bContext *C, wmOperator *op, wmEvent *event) +{ + return WM_operator_confirm(C, op, event); +} +static int rna_Operator_props_popup(bContext *C, wmOperator *op, wmEvent *event) +{ + return WM_operator_props_popup(C, op, event); +} + static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, const char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier, int head) { @@ -266,7 +276,7 @@ void RNA_api_wm(StructRNA *srna) /* invoke functions, for use with python */ - func = RNA_def_function(srna, "invoke_props_popup", "WM_operator_props_popup"); + func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup"); RNA_def_function_ui_description(func, "Operator popup invoke"); rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN); @@ -284,7 +294,7 @@ void RNA_api_wm(StructRNA *srna) RNA_def_function_ui_description(func, "Operator popup invoke"); rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN); - func = RNA_def_function(srna, "invoke_confirm", "WM_operator_confirm"); + func = RNA_def_function(srna, "invoke_confirm", "rna_Operator_confirm"); RNA_def_function_ui_description(func, "Operator confirmation"); rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN); |