From 5a68cdd08b19b486b6db344e1294c3b0a0ca9596 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 31 Mar 2023 13:01:33 +0200 Subject: [PATCH 1/2] Add rating to object. --- scripts/startup/bl_ui/properties_object.py | 1 + source/blender/makesdna/DNA_object_types.h | 4 ++++ source/blender/makesrna/intern/rna_object.c | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/scripts/startup/bl_ui/properties_object.py b/scripts/startup/bl_ui/properties_object.py index 3977782050f..c299d88f7eb 100644 --- a/scripts/startup/bl_ui/properties_object.py +++ b/scripts/startup/bl_ui/properties_object.py @@ -37,6 +37,7 @@ class OBJECT_PT_transform(ObjectButtonsPanel, Panel): layout.use_property_split = True ob = context.object + layout.prop(ob, "rating") col = layout.column() row = col.row(align=True) diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index ad84ab716c0..e33a85d54d5 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -441,6 +441,10 @@ typedef struct Object { uint8_t modifier_flag; char _pad8[4]; + /* Rating. */ + int rating; + char _pad9[4]; + struct PreviewImage *preview; ObjectLineArt lineart; diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index f7a83915ed2..cb666e1523d 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -3145,6 +3145,15 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Data", "Object data"); RNA_def_property_update(prop, 0, "rna_Object_data_update"); + static const EnumPropertyItem rating_items[] = { + {0, "BAD", 0, "Bad", "I don't like this"}, + {1, "GOOD", 0, "Good", "I like this one"}, + {0, NULL, 0, NULL, NULL}, + }; + prop = RNA_def_property(srna, "rating", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rating_items); + RNA_def_property_ui_text(prop, "Rating", "Rating of the Object"); + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, rna_enum_object_type_items); -- 2.30.2 From 7fc8e003a19cc19b93ffeb4c98a7470feececd5b Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 31 Mar 2023 13:05:59 +0200 Subject: [PATCH 2/2] Added an empty line. --- source/blender/makesrna/intern/rna_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index cb666e1523d..cc49b898686 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -3150,6 +3150,7 @@ static void rna_def_object(BlenderRNA *brna) {1, "GOOD", 0, "Good", "I like this one"}, {0, NULL, 0, NULL, NULL}, }; + prop = RNA_def_property(srna, "rating", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rating_items); RNA_def_property_ui_text(prop, "Rating", "Rating of the Object"); -- 2.30.2