-
Couldn't load subscription status.
- Fork 78
Closed
Labels
Description
(I use a version from this weekend (24c6b5d))
I’m having trouble with databindings.
- I have an enum property
- I can identify it as an enum property with my function below (GetDataType)
- I get the property: rive::ViewModelInstanceEnumRuntime* prop = vmir->propertyEnum(path);
- It has the values: 0 = ORDER_FOOD, 1 = IDLE , current index/value is 0 / ORDER_FOOD
- I call prop->value("ORDER_FOOD");
- after that, the property will identify as a trigger !?
- that is, this returns non-zero: prop = rive::ViewModelInstanceTriggerRuntime* prop_trigger = vmir->propertyTrigger(path);
As mentioned earlier, I’d like to have the property base class function rive::DataType = prop->dataType() so that I don’t have to try to get the property through all possible versions.
Please advice.
static rive::DataType GetDataType(rive::ViewModelInstanceRuntime* vmir, const char* path)
{
// We check the rare occurrences first, as we can do correct type checking for the Lua types
// in the scripting api
rive::ViewModelInstanceTriggerRuntime* prop_trigger = vmir->propertyTrigger(path);
if (prop_trigger)
return rive::DataType::trigger;
rive::ViewModelInstanceEnumRuntime* prop_enum = vmir->propertyEnum(path);
if (prop_enum)
return rive::DataType::enumType;
rive::ViewModelInstanceRuntime* prop_vmir = vmir->propertyViewModel(path);
if (prop_vmir)
return rive::DataType::viewModel;
rive::ViewModelInstanceListRuntime* prop_list = vmir->propertyList(path);
if (prop_list)
return rive::DataType::list;
rive::ViewModelInstanceColorRuntime* prop_color = vmir->propertyColor(path);
if (prop_color)
return rive::DataType::color;
rive::ViewModelInstanceNumberRuntime* prop_number = vmir->propertyNumber(path);
if (prop_number)
return rive::DataType::number;
rive::ViewModelInstanceStringRuntime* prop_string = vmir->propertyString(path);
if (prop_string)
return rive::DataType::string;
rive::ViewModelInstanceBooleanRuntime* prop_boolean = vmir->propertyBoolean(path);
if (prop_boolean)
return rive::DataType::boolean;
return rive::DataType::none;
};