Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_nodes.cc
| Show First 20 Lines • Show All 1,047 Lines • ▼ Show 20 Lines | static void modifyGeometrySet(ModifierData *md, | ||||
| modifyGeometry(md, ctx, *geometry_set); | modifyGeometry(md, ctx, *geometry_set); | ||||
| } | } | ||||
| /* Drawing the properties manually with #uiItemR instead of #uiDefAutoButsRNA allows using | /* Drawing the properties manually with #uiItemR instead of #uiDefAutoButsRNA allows using | ||||
| * the node socket identifier for the property names, since they are unique, but also having | * the node socket identifier for the property names, since they are unique, but also having | ||||
| * the correct label displayed in the UI. */ | * the correct label displayed in the UI. */ | ||||
| static void draw_property_for_socket(uiLayout *layout, | static void draw_property_for_socket(uiLayout *layout, | ||||
| PointerRNA *bmain_ptr, | PointerRNA *bmain_ptr, | ||||
| PointerRNA *settings_ptr, | PointerRNA *md_ptr, | ||||
| const IDProperty *modifier_props, | const IDProperty *modifier_props, | ||||
| const bNodeSocket &socket) | const bNodeSocket &socket) | ||||
| { | { | ||||
| const SocketPropertyType *property_type = get_socket_property_type(socket); | const SocketPropertyType *property_type = get_socket_property_type(socket); | ||||
| if (property_type == nullptr) { | if (property_type == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| Show All 11 Lines | if (property != nullptr && property_type->is_correct_type(*property)) { | ||||
| BLI_snprintf(rna_path, ARRAY_SIZE(rna_path), "[\"%s\"]", socket_id_esc); | BLI_snprintf(rna_path, ARRAY_SIZE(rna_path), "[\"%s\"]", socket_id_esc); | ||||
| /* Use #uiItemPointerR to draw pointer properties because #uiItemR would not have enough | /* Use #uiItemPointerR to draw pointer properties because #uiItemR would not have enough | ||||
| * information about what type of ID to select for editing the values. This is because | * information about what type of ID to select for editing the values. This is because | ||||
| * pointer IDProperties contain no information about their type. */ | * pointer IDProperties contain no information about their type. */ | ||||
| switch (socket.type) { | switch (socket.type) { | ||||
| case SOCK_OBJECT: { | case SOCK_OBJECT: { | ||||
| uiItemPointerR( | uiItemPointerR( | ||||
| layout, settings_ptr, rna_path, bmain_ptr, "objects", socket.name, ICON_OBJECT_DATA); | layout, md_ptr, rna_path, bmain_ptr, "objects", socket.name, ICON_OBJECT_DATA); | ||||
| break; | break; | ||||
| } | } | ||||
| case SOCK_COLLECTION: { | case SOCK_COLLECTION: { | ||||
| uiItemPointerR(layout, | uiItemPointerR(layout, | ||||
| settings_ptr, | md_ptr, | ||||
| rna_path, | rna_path, | ||||
| bmain_ptr, | bmain_ptr, | ||||
| "collections", | "collections", | ||||
| socket.name, | socket.name, | ||||
| ICON_OUTLINER_COLLECTION); | ICON_OUTLINER_COLLECTION); | ||||
| break; | break; | ||||
| } | } | ||||
| default: | default: | ||||
| uiItemR(layout, settings_ptr, rna_path, 0, socket.name, ICON_NONE); | uiItemR(layout, md_ptr, rna_path, 0, socket.name, ICON_NONE); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void panel_draw(const bContext *C, Panel *panel) | static void panel_draw(const bContext *C, Panel *panel) | ||||
| { | { | ||||
| uiLayout *layout = panel->layout; | uiLayout *layout = panel->layout; | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr); | PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr); | ||||
| NodesModifierData *nmd = static_cast<NodesModifierData *>(ptr->data); | NodesModifierData *nmd = static_cast<NodesModifierData *>(ptr->data); | ||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| /* This should be removed, but animation currently doesn't work with the IDProperties. */ | uiLayoutSetPropDecorate(layout, true); | ||||
| uiLayoutSetPropDecorate(layout, false); | |||||
| uiTemplateID(layout, | uiTemplateID(layout, | ||||
| C, | C, | ||||
| ptr, | ptr, | ||||
| "node_group", | "node_group", | ||||
| "node.new_geometry_node_group_assign", | "node.new_geometry_node_group_assign", | ||||
| nullptr, | nullptr, | ||||
| nullptr, | nullptr, | ||||
| 0, | 0, | ||||
| false, | false, | ||||
| nullptr); | nullptr); | ||||
| if (nmd->node_group != nullptr && nmd->settings.properties != nullptr) { | if (nmd->node_group != nullptr && nmd->settings.properties != nullptr) { | ||||
| PointerRNA settings_ptr; | |||||
| RNA_pointer_create(ptr->owner_id, &RNA_NodesModifierSettings, &nmd->settings, &settings_ptr); | |||||
| PointerRNA bmain_ptr; | PointerRNA bmain_ptr; | ||||
| RNA_main_pointer_create(bmain, &bmain_ptr); | RNA_main_pointer_create(bmain, &bmain_ptr); | ||||
| LISTBASE_FOREACH (bNodeSocket *, socket, &nmd->node_group->inputs) { | LISTBASE_FOREACH (bNodeSocket *, socket, &nmd->node_group->inputs) { | ||||
| draw_property_for_socket( | draw_property_for_socket(layout, &bmain_ptr, ptr, nmd->settings.properties, *socket); | ||||
| layout, &bmain_ptr, &settings_ptr, nmd->settings.properties, *socket); | |||||
| } | } | ||||
| } | } | ||||
| modifier_panel_end(layout, ptr); | modifier_panel_end(layout, ptr); | ||||
| } | } | ||||
| static void panelRegister(ARegionType *region_type) | static void panelRegister(ARegionType *region_type) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines | |||||