Commit: 19fe5caf872476db265596eaac1dc35ad1c6422d Author: Jacques Lucke Date: Wed Feb 1 12:53:57 2023 +0100 Branches: master https://developer.blender.org/rB19fe5caf872476db265596eaac1dc35ad1c6422d
Geometry Nodes: add support for eye dropper for object input in modifier Differential Revision: https://developer.blender.org/D17108 =================================================================== M source/blender/makesdna/DNA_ID.h M source/blender/makesrna/intern/rna_access.c M source/blender/modifiers/intern/MOD_nodes.cc =================================================================== diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 1e43321836f..a0f5448a003 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -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 { diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index e7187b2822b..d6d7ae359d6 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -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) { diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index da623881548..6ecd2c74462 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -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 *>( _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
