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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_rna.c')
-rw-r--r--source/blender/makesrna/intern/rna_rna.c208
1 files changed, 155 insertions, 53 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index ae67de9228c..16a4dfe71cf 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -50,56 +50,85 @@ const EnumPropertyItem rna_enum_property_type_items[] = {
{0, NULL, 0, NULL, NULL},
};
-/* Keep in sync with RNA_types.h PropertySubType and bpy_props.c's property_subtype_xxx_items */
+/* Wraps multiple enums onto a single line in a way that is difficult to read.
+ * NOTE: these enums are split up based on their use in `bpy.props` Python module. */
+
+/* clang-format off */
+#define RNA_ENUM_PROPERTY_SUBTYPE_STRING_ITEMS \
+ {PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""}, \
+ {PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""}, \
+ {PROP_FILENAME, "FILE_NAME", 0, "File Name", ""}, \
+ {PROP_BYTESTRING, "BYTE_STRING", 0, "Byte String", ""}, \
+ {PROP_PASSWORD, "PASSWORD", 0, "Password", "A string that is displayed hidden ('********')"}
+
+#define RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ITEMS \
+ {PROP_PIXEL, "PIXEL", 0, "Pixel", ""}, \
+ {PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""}, \
+ {PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""}, \
+ {PROP_FACTOR, "FACTOR", 0, "Factor", ""}, \
+ {PROP_ANGLE, "ANGLE", 0, "Angle", ""}, \
+ {PROP_TIME, "TIME", 0, "Time (Scene Relative)", \
+ "Time specified in frames, converted to seconds based on scene frame rate"}, \
+ {PROP_TIME_ABSOLUTE, "TIME_ABSOLUTE", 0, "Time (Absolute)", \
+ "Time specified in seconds, independent of the scene"}, \
+ {PROP_DISTANCE, "DISTANCE", 0, "Distance", ""}, \
+ {PROP_DISTANCE_CAMERA, "DISTANCE_CAMERA", 0, "Camera Distance", ""}, \
+ {PROP_POWER, "POWER", 0, "Power", ""}, \
+ {PROP_TEMPERATURE, "TEMPERATURE", 0, "Temperature", ""}
+
+#define RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ARRAY_ITEMS \
+ {PROP_COLOR, "COLOR", 0, "Color", ""}, \
+ {PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""}, \
+ {PROP_DIRECTION, "DIRECTION", 0, "Direction", ""}, \
+ {PROP_VELOCITY, "VELOCITY", 0, "Velocity", ""}, \
+ {PROP_ACCELERATION, "ACCELERATION", 0, "Acceleration", ""}, \
+ {PROP_MATRIX, "MATRIX", 0, "Matrix", ""}, \
+ {PROP_EULER, "EULER", 0, "Euler Angles", ""}, \
+ {PROP_QUATERNION, "QUATERNION", 0, "Quaternion", ""}, \
+ {PROP_AXISANGLE, "AXISANGLE", 0, "Axis-Angle", ""}, \
+ {PROP_XYZ, "XYZ", 0, "XYZ", ""}, \
+ {PROP_XYZ_LENGTH, "XYZ_LENGTH", 0, "XYZ Length", ""}, \
+ {PROP_COLOR_GAMMA, "COLOR_GAMMA", 0, "Color", ""}, \
+ {PROP_COORDS, "COORDINATES", 0, "Coordinates", ""}, \
+ /* Boolean. */ \
+ {PROP_LAYER, "LAYER", 0, "Layer", ""}, \
+ {PROP_LAYER_MEMBER, "LAYER_MEMBER", 0, "Layer Member", ""}
+
+/* clang-format on */
+
+const EnumPropertyItem rna_enum_property_subtype_string_items[] = {
+ RNA_ENUM_PROPERTY_SUBTYPE_STRING_ITEMS,
+
+ {PROP_NONE, "NONE", 0, "None", ""},
+ {0, NULL, 0, NULL, NULL},
+};
+
+const EnumPropertyItem rna_enum_property_subtype_number_items[] = {
+ RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ITEMS,
+
+ {PROP_NONE, "NONE", 0, "None", ""},
+ {0, NULL, 0, NULL, NULL},
+};
+
+const EnumPropertyItem rna_enum_property_subtype_number_array_items[] = {
+ RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ARRAY_ITEMS,
+
+ {PROP_NONE, "NONE", 0, "None", ""},
+ {0, NULL, 0, NULL, NULL},
+};
+
const EnumPropertyItem rna_enum_property_subtype_items[] = {
{PROP_NONE, "NONE", 0, "None", ""},
- /* strings */
- {PROP_FILEPATH, "FILEPATH", 0, "File Path", ""},
- {PROP_DIRPATH, "DIRPATH", 0, "Directory Path", ""},
- {PROP_FILENAME, "FILENAME", 0, "File Name", ""},
- {PROP_BYTESTRING, "BYTESTRING", 0, "Byte String", ""},
- {PROP_PASSWORD, "PASSWORD", 0, "Password", "A string that is displayed hidden ('********')"},
-
- /* numbers */
- {PROP_PIXEL, "PIXEL", 0, "Pixel", ""},
- {PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""},
- {PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""},
- {PROP_FACTOR, "FACTOR", 0, "Factor", ""},
- {PROP_ANGLE, "ANGLE", 0, "Angle", ""},
- {PROP_TIME,
- "TIME",
- 0,
- "Time (Scene Relative)",
- "Time specified in frames, converted to seconds based on scene frame rate"},
- {PROP_TIME_ABSOLUTE,
- "TIME_ABSOLUTE",
- 0,
- "Time (Absolute)",
- "Time specified in seconds, independent of the scene"},
- {PROP_DISTANCE, "DISTANCE", 0, "Distance", ""},
- {PROP_DISTANCE_CAMERA, "DISTANCE_CAMERA", 0, "Camera Distance", ""},
- {PROP_POWER, "POWER", 0, "Power", ""},
- {PROP_TEMPERATURE, "TEMPERATURE", 0, "Temperature", ""},
-
- /* number arrays */
- {PROP_COLOR, "COLOR", 0, "Color", ""},
- {PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
- {PROP_DIRECTION, "DIRECTION", 0, "Direction", ""},
- {PROP_VELOCITY, "VELOCITY", 0, "Velocity", ""},
- {PROP_ACCELERATION, "ACCELERATION", 0, "Acceleration", ""},
- {PROP_MATRIX, "MATRIX", 0, "Matrix", ""},
- {PROP_EULER, "EULER", 0, "Euler Angles", ""},
- {PROP_QUATERNION, "QUATERNION", 0, "Quaternion", ""},
- {PROP_AXISANGLE, "AXISANGLE", 0, "Axis-Angle", ""},
- {PROP_XYZ, "XYZ", 0, "XYZ", ""},
- {PROP_XYZ_LENGTH, "XYZ_LENGTH", 0, "XYZ Length", ""},
- {PROP_COLOR_GAMMA, "COLOR_GAMMA", 0, "Color", ""},
- {PROP_COORDS, "COORDS", 0, "Coordinates", ""},
-
- /* booleans */
- {PROP_LAYER, "LAYER", 0, "Layer", ""},
- {PROP_LAYER_MEMBER, "LAYER_MEMBER", 0, "Layer Member", ""},
+ /* String. */
+ RNA_ENUM_PROPERTY_SUBTYPE_STRING_ITEMS,
+
+ /* Number. */
+ RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ITEMS,
+
+ /* Number array. */
+ RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ARRAY_ITEMS,
+
{0, NULL, 0, NULL, NULL},
};
@@ -120,6 +149,69 @@ const EnumPropertyItem rna_enum_property_unit_items[] = {
{0, NULL, 0, NULL, NULL},
};
+const EnumPropertyItem rna_enum_property_flag_items[] = {
+ {PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
+ {PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
+ {PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""},
+ {PROP_LIB_EXCEPTION, "LIBRARY_EDITABLE", 0, "Library Editable", ""},
+ {PROP_PROPORTIONAL, "PROPORTIONAL", 0, "Adjust values proportionally to each other", ""},
+ {PROP_TEXTEDIT_UPDATE,
+ "TEXTEDIT_UPDATE",
+ 0,
+ "Update on every keystroke in textedit 'mode'",
+ ""},
+ {0, NULL, 0, NULL, NULL},
+};
+
+/** Only for enum type properties. */
+const EnumPropertyItem rna_enum_property_flag_enum_items[] = {
+ {PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
+ {PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
+ {PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""},
+ {PROP_LIB_EXCEPTION, "LIBRARY_EDITABLE", 0, "Library Editable", ""},
+ {PROP_ENUM_FLAG, "ENUM_FLAG", 0, "Enum Flag", ""},
+ {0, NULL, 0, NULL, NULL},
+};
+
+const EnumPropertyItem rna_enum_property_override_flag_items[] = {
+ {PROPOVERRIDE_OVERRIDABLE_LIBRARY,
+ "LIBRARY_OVERRIDABLE",
+ 0,
+ "Library Overridable",
+ "Make that property editable in library overrides of linked data-blocks"},
+ {0, NULL, 0, NULL, NULL},
+};
+
+const EnumPropertyItem rna_enum_property_override_flag_collection_items[] = {
+ {PROPOVERRIDE_OVERRIDABLE_LIBRARY,
+ "LIBRARY_OVERRIDABLE",
+ 0,
+ "Library Overridable",
+ "Make that property editable in library overrides of linked data-blocks"},
+ {PROPOVERRIDE_NO_PROP_NAME,
+ "NO_PROPERTY_NAME",
+ 0,
+ "No Name",
+ "Do not use the names of the items, only their indices in the collection"},
+ {PROPOVERRIDE_LIBRARY_INSERTION,
+ "USE_INSERTION",
+ 0,
+ "Use Insertion",
+ "Allow users to add new items in that collection in library overrides"},
+ {0, NULL, 0, NULL, NULL},
+};
+
+const EnumPropertyItem rna_enum_property_string_search_flag_items[] = {
+ {PROP_STRING_SEARCH_SORT, "SORT", 0, "Sort Search Results", ""},
+ {PROP_STRING_SEARCH_SUGGESTION,
+ "SUGGESTION",
+ 0,
+ "Suggestion",
+ "Search results are suggestions (other values may be entered)"},
+
+ {0, NULL, 0, NULL, NULL},
+};
+
/** \} */
#ifdef RNA_RUNTIME
@@ -941,17 +1033,29 @@ static int rna_EnumPropertyItem_identifier_length(PointerRNA *ptr)
static void rna_EnumPropertyItem_name_get(PointerRNA *ptr, char *value)
{
- strcpy(value, ((EnumPropertyItem *)ptr->data)->name);
+ const EnumPropertyItem *eprop = ptr->data;
+ /* Name can be NULL in the case of separators
+ * which are exposed via `_bpy.rna_enum_items_static`. */
+ if (eprop->name) {
+ strcpy(value, eprop->name);
+ }
+ else {
+ value[0] = '\0';
+ }
}
static int rna_EnumPropertyItem_name_length(PointerRNA *ptr)
{
- return strlen(((EnumPropertyItem *)ptr->data)->name);
+ const EnumPropertyItem *eprop = ptr->data;
+ if (eprop->name) {
+ return strlen(eprop->name);
+ }
+ return 0;
}
static void rna_EnumPropertyItem_description_get(PointerRNA *ptr, char *value)
{
- EnumPropertyItem *eprop = (EnumPropertyItem *)ptr->data;
+ const EnumPropertyItem *eprop = ptr->data;
if (eprop->description) {
strcpy(value, eprop->description);
@@ -968,9 +1072,7 @@ static int rna_EnumPropertyItem_description_length(PointerRNA *ptr)
if (eprop->description) {
return strlen(eprop->description);
}
- else {
- return 0;
- }
+ return 0;
}
static int rna_EnumPropertyItem_value_get(PointerRNA *ptr)