Fix T86876: cannot modify float properties of geometry nodes modifier from Python
Previously, the code expected the id property to have the `IDP_FLOAT` type. However, when assigning a Python float (which is a double internally) to an id property, it would change the type to `IDP_DOUBLE`. The fix is to allow both types in the geometry nodes modifier.
This commit is contained in:
parent
fa1569a072
commit
8034b276ba
Notes:
blender-bot
2023-02-14 10:43:47 +01:00
Referenced by issue #86876, Geometry node group "float" inputs are not modifiable through python
|
@ -722,10 +722,17 @@ static const SocketPropertyType *get_socket_property_type(const bNodeSocket &bso
|
|||
[](const bNodeSocket &socket) {
|
||||
return (PropertyType)((bNodeSocketValueFloat *)socket.default_value)->subtype;
|
||||
},
|
||||
[](const IDProperty &property) { return property.type == IDP_FLOAT; },
|
||||
[](const IDProperty &property) { return ELEM(property.type, IDP_FLOAT, IDP_DOUBLE); },
|
||||
[](const IDProperty &property,
|
||||
const PersistentDataHandleMap &UNUSED(handles),
|
||||
void *r_value) { *(float *)r_value = IDP_Float(&property); },
|
||||
void *r_value) {
|
||||
if (property.type == IDP_FLOAT) {
|
||||
*(float *)r_value = IDP_Float(&property);
|
||||
}
|
||||
else if (property.type == IDP_DOUBLE) {
|
||||
*(float *)r_value = (float)IDP_Double(&property);
|
||||
}
|
||||
},
|
||||
};
|
||||
return &float_type;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue