Add rating to object. #4

Merged
Jeroen Bakker merged 2 commits from my-change into main 2023-03-31 13:14:06 +02:00
3 changed files with 15 additions and 0 deletions

View File

@ -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)

View File

@ -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;

View File

@ -3145,6 +3145,16 @@ 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},
};

Add an empty line here

Add an empty line here
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);