forked from bartvdbraak/blender
fix for using subtype units that are not defined as a part of types. eg.
prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ|PROP_UNIT_LENGTH);
This commit is contained in:
parent
e49ad2e148
commit
911078aaad
@ -66,6 +66,7 @@ typedef enum PropertyType {
|
|||||||
PROP_COLLECTION = 6
|
PROP_COLLECTION = 6
|
||||||
} PropertyType;
|
} PropertyType;
|
||||||
|
|
||||||
|
/* also update rna_property_subtype_unit when you change this */
|
||||||
typedef enum PropertyUnit {
|
typedef enum PropertyUnit {
|
||||||
PROP_UNIT_NONE = (0<<16),
|
PROP_UNIT_NONE = (0<<16),
|
||||||
PROP_UNIT_LENGTH = (1<<16), /* m */
|
PROP_UNIT_LENGTH = (1<<16), /* m */
|
||||||
|
@ -1388,6 +1388,30 @@ static const char *rna_property_subtypename(PropertyType type)
|
|||||||
case PROP_XYZ: return "PROP_XYZ";
|
case PROP_XYZ: return "PROP_XYZ";
|
||||||
case PROP_RGB: return "PROP_RGB";
|
case PROP_RGB: return "PROP_RGB";
|
||||||
case PROP_NEVER_NULL: return "PROP_NEVER_NULL";
|
case PROP_NEVER_NULL: return "PROP_NEVER_NULL";
|
||||||
|
default: {
|
||||||
|
/* incase we dont have a type preset that includes the subtype */
|
||||||
|
if(RNA_SUBTYPE_UNIT(type)) {
|
||||||
|
return rna_property_subtypename(type & ~RNA_SUBTYPE_UNIT(type));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "PROP_SUBTYPE_UNKNOWN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *rna_property_subtype_unit(PropertyType type)
|
||||||
|
{
|
||||||
|
switch(RNA_SUBTYPE_UNIT(type)) {
|
||||||
|
case PROP_UNIT_NONE: return "PROP_UNIT_NONE";
|
||||||
|
case PROP_UNIT_LENGTH: return "PROP_UNIT_LENGTH";
|
||||||
|
case PROP_UNIT_AREA: return "PROP_UNIT_AREA";
|
||||||
|
case PROP_UNIT_VOLUME: return "PROP_UNIT_VOLUME";
|
||||||
|
case PROP_UNIT_MASS: return "PROP_UNIT_MASS";
|
||||||
|
case PROP_UNIT_ROTATION: return "PROP_UNIT_ROTATION";
|
||||||
|
case PROP_UNIT_TIME: return "PROP_UNIT_TIME";
|
||||||
|
case PROP_UNIT_VELOCITY: return "PROP_UNIT_VELOCITY";
|
||||||
|
case PROP_UNIT_ACCELERATION:return "PROP_UNIT_ACCELERATION";
|
||||||
default: return "PROP_UNKNOWN";
|
default: return "PROP_UNKNOWN";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1693,7 +1717,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
|
|||||||
rna_print_c_string(f, prop->name); fprintf(f, ",\n\t");
|
rna_print_c_string(f, prop->name); fprintf(f, ",\n\t");
|
||||||
rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
|
rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
|
||||||
fprintf(f, "%d,\n", prop->icon);
|
fprintf(f, "%d,\n", prop->icon);
|
||||||
fprintf(f, "\t%s, %s, %d,\n", rna_property_typename(prop->type), rna_property_subtypename(prop->subtype), prop->arraylength);
|
fprintf(f, "\t%s, %s|%s, %d,\n", rna_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), prop->arraylength);
|
||||||
fprintf(f, "\t%s, %d, %s,\n", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable));
|
fprintf(f, "\t%s, %d, %s,\n", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable));
|
||||||
|
|
||||||
if(prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop);
|
if(prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop);
|
||||||
|
Loading…
Reference in New Issue
Block a user