Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_edit.cc
| Show All 37 Lines | |||||
| #include "RE_engine.h" | #include "RE_engine.h" | ||||
| #include "RE_pipeline.h" | #include "RE_pipeline.h" | ||||
| #include "ED_image.h" | #include "ED_image.h" | ||||
| #include "ED_node.h" /* own include */ | #include "ED_node.h" /* own include */ | ||||
| #include "ED_render.h" | #include "ED_render.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_select_utils.h" | #include "ED_select_utils.h" | ||||
| #include "ED_spreadsheet.h" | #include "ED_viewer_path.hh" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| #include "RNA_prototypes.h" | #include "RNA_prototypes.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| ▲ Show 20 Lines • Show All 761 Lines • ▼ Show 20 Lines | else if (ntree->type == NTREE_GEOMETRY) { | ||||
| if (node->type == GEO_NODE_VIEWER) { | if (node->type == GEO_NODE_VIEWER) { | ||||
| if ((node->flag & NODE_DO_OUTPUT) == 0) { | if ((node->flag & NODE_DO_OUTPUT) == 0) { | ||||
| LISTBASE_FOREACH (bNode *, node_iter, &ntree->nodes) { | LISTBASE_FOREACH (bNode *, node_iter, &ntree->nodes) { | ||||
| if (node_iter->type == GEO_NODE_VIEWER) { | if (node_iter->type == GEO_NODE_VIEWER) { | ||||
| node_iter->flag &= ~NODE_DO_OUTPUT; | node_iter->flag &= ~NODE_DO_OUTPUT; | ||||
| } | } | ||||
| } | } | ||||
| node->flag |= NODE_DO_OUTPUT; | node->flag |= NODE_DO_OUTPUT; | ||||
| ED_spreadsheet_context_paths_set_geometry_node(bmain, snode, node); | |||||
| } | } | ||||
| blender::ed::viewer_path::activate_geometry_node(*bmain, *snode, *node); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void ED_node_post_apply_transform(bContext *UNUSED(C), bNodeTree *UNUSED(ntree)) | void ED_node_post_apply_transform(bContext *UNUSED(C), bNodeTree *UNUSED(ntree)) | ||||
| { | { | ||||
| /* XXX This does not work due to layout functions relying on node->block, | /* XXX This does not work due to layout functions relying on node->block, | ||||
| ▲ Show 20 Lines • Show All 861 Lines • ▼ Show 20 Lines | void NODE_OT_preview_toggle(wmOperatorType *ot) | ||||
| /* callbacks */ | /* callbacks */ | ||||
| ot->exec = node_preview_toggle_exec; | ot->exec = node_preview_toggle_exec; | ||||
| ot->poll = ED_operator_node_active; | ot->poll = ED_operator_node_active; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| static int node_deactivate_viewer_exec(bContext *C, wmOperator *UNUSED(op)) | |||||
| { | |||||
| SpaceNode &snode = *CTX_wm_space_node(C); | |||||
| WorkSpace &workspace = *CTX_wm_workspace(C); | |||||
| bNode *active_viewer = viewer_path::find_geometry_nodes_viewer(workspace.viewer_path, snode); | |||||
| LISTBASE_FOREACH (bNode *, node, &snode.edittree->nodes) { | |||||
| if (node->type != GEO_NODE_VIEWER) { | |||||
| continue; | |||||
| } | |||||
| if (!(node->flag & SELECT)) { | |||||
| continue; | |||||
| } | |||||
| if (node == active_viewer) { | |||||
| node->flag &= ~NODE_DO_OUTPUT; | |||||
| BKE_ntree_update_tag_node_property(snode.edittree, node); | |||||
| } | |||||
| } | |||||
| ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree); | |||||
| return OPERATOR_FINISHED; | |||||
| } | |||||
| void NODE_OT_deactivate_viewer(wmOperatorType *ot) | |||||
| { | |||||
| /* identifiers */ | |||||
| ot->name = "Deactivate Viewer Node"; | |||||
| ot->description = "Deactivate selected viewer node in geometry nodes"; | |||||
| ot->idname = __func__; | |||||
| /* callbacks */ | |||||
| ot->exec = node_deactivate_viewer_exec; | |||||
| ot->poll = ED_operator_node_active; | |||||
| /* flags */ | |||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | |||||
| } | |||||
| static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op)) | static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| SpaceNode *snode = CTX_wm_space_node(C); | SpaceNode *snode = CTX_wm_space_node(C); | ||||
| /* sanity checking (poll callback checks this already) */ | /* sanity checking (poll callback checks this already) */ | ||||
| if ((snode == nullptr) || (snode->edittree == nullptr)) { | if ((snode == nullptr) || (snode->edittree == nullptr)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,360 Lines • Show Last 20 Lines | |||||