Geometry Nodes: add support for eye dropper for object input in modifier

Differential Revision: https://developer.blender.org/D17108
This commit is contained in:
2023-02-01 12:53:57 +01:00
parent 5a97b282e9
commit 19fe5caf87
3 changed files with 20 additions and 1 deletions

View File

@@ -104,6 +104,12 @@ typedef struct IDPropertyUIDataString {
/** For #IDP_UI_DATA_TYPE_ID. */
typedef struct IDPropertyUIDataID {
IDPropertyUIData base;
/**
* #ID_Type. This type type is not enforced. It is just a hint to the ui for what kind of ID is
* expected. If this is zero, any id type is expected.
*/
short id_type;
char _pad[6];
} IDPropertyUIDataID;
typedef struct IDPropertyData {

View File

@@ -1415,6 +1415,16 @@ int RNA_property_string_maxlength(PropertyRNA *prop)
StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
{
if (prop->magic != RNA_MAGIC) {
const IDProperty *idprop = (IDProperty *)prop;
if (idprop->type == IDP_ID) {
const IDPropertyUIDataID *ui_data = (const IDPropertyUIDataID *)idprop->ui_data;
if (ui_data) {
return ID_code_to_RNA_type(ui_data->id_type);
}
}
}
prop = rna_ensure_property(prop);
if (prop->type == PROP_POINTER) {

View File

@@ -513,7 +513,10 @@ id_property_create_from_socket(const bNodeSocket &socket)
case SOCK_OBJECT: {
const bNodeSocketValueObject *value = static_cast<const bNodeSocketValueObject *>(
socket.default_value);
return bke::idprop::create(socket.identifier, reinterpret_cast<ID *>(value->value));
auto property = bke::idprop::create(socket.identifier, reinterpret_cast<ID *>(value->value));
IDPropertyUIDataID *ui_data = (IDPropertyUIDataID *)IDP_ui_data_ensure(property.get());
ui_data->id_type = ID_OB;
return property;
}
case SOCK_COLLECTION: {
const bNodeSocketValueCollection *value = static_cast<const bNodeSocketValueCollection *>(