Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_define.c
| Show First 20 Lines • Show All 4,105 Lines • ▼ Show 20 Lines | PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont_, | ||||
| float softmin, | float softmin, | ||||
| float softmax) | float softmax) | ||||
| { | { | ||||
| ContainerRNA *cont = cont_; | ContainerRNA *cont = cont_; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| ASSERT_SOFT_HARD_LIMITS; | ASSERT_SOFT_HARD_LIMITS; | ||||
| #ifdef DEBUG | |||||
| /* Properties with PROP_PERCENTAGE should use a range like 0 to 100, unlike PROP_FACTOR. */ | |||||
| if (hardmax < 2.0f) { | |||||
| CLOG_WARN(&LOG, | |||||
| "Percentage property with incorrect range: %s.%s", | |||||
| CONTAINER_RNA_ID(cont), | |||||
| identifier); | |||||
| } | |||||
| #endif | |||||
| prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_PERCENTAGE); | prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_PERCENTAGE); | ||||
| RNA_def_property_float_default(prop, default_value); | RNA_def_property_float_default(prop, default_value); | ||||
| if (hardmin != hardmax) { | if (hardmin != hardmax) { | ||||
| RNA_def_property_range(prop, hardmin, hardmax); | RNA_def_property_range(prop, hardmin, hardmax); | ||||
| } | } | ||||
| RNA_def_property_ui_text(prop, ui_name, ui_description); | RNA_def_property_ui_text(prop, ui_name, ui_description); | ||||
| RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); | RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); | ||||
| ▲ Show 20 Lines • Show All 635 Lines • Show Last 20 Lines | |||||