diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-16 16:51:11 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-16 16:51:11 +0300 |
commit | 943b919fe807b53558631bcbc688c2d712d6b0cc (patch) | |
tree | c1c141866f50eb1f28e1875195395c8582898cc2 /source/blender/editors/space_node/node_add.cc | |
parent | cb267cec5552c17092a99999e4e352bf266b578f (diff) |
Geometry Nodes: Remove legacy node code
This commit removes the implementations of legacy nodes,
their type definitions, and related code that becomes unused.
Now that we have two releases that included the legacy nodes,
there is not much reason to include them still. Removing the
code means refactoring will be easier, and old code doesn't
have to be tested and maintained.
After this commit, the legacy nodes will be undefined in the UI,
so 3.0 or 3.1 should be used to convert files to the fields system.
The net change is 12184 lines removed!
The tooltip for legacy nodes mentioned that we would remove
them before 4.0, which was purposefully a bit vague to allow
us this flexibility. In a poll in a devtalk post showed that the
majority of people were okay with removing the nodes.
https://devtalk.blender.org/t/geometry-nodes-backward-compatibility-poll/20199
Differential Revision: https://developer.blender.org/D14353
Diffstat (limited to 'source/blender/editors/space_node/node_add.cc')
-rw-r--r-- | source/blender/editors/space_node/node_add.cc | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 30bd0fb528b..7fb15d69ab5 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -517,113 +517,6 @@ void NODE_OT_add_object(wmOperatorType *ot) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Add Node Texture Operator - * \{ */ - -static Tex *node_add_texture_get_and_poll_texture_node_tree(Main *bmain, wmOperator *op) -{ - if (RNA_struct_property_is_set(op->ptr, "session_uuid")) { - const uint32_t session_uuid = (uint32_t)RNA_int_get(op->ptr, "session_uuid"); - return (Tex *)BKE_libblock_find_session_uuid(bmain, ID_TE, session_uuid); - } - - char name[MAX_ID_NAME - 2]; - RNA_string_get(op->ptr, "name", name); - return (Tex *)BKE_libblock_find_name(bmain, ID_TE, name); -} - -static int node_add_texture_exec(bContext *C, wmOperator *op) -{ - Main *bmain = CTX_data_main(C); - SpaceNode *snode = CTX_wm_space_node(C); - bNodeTree *ntree = snode->edittree; - Tex *texture; - - if (!(texture = node_add_texture_get_and_poll_texture_node_tree(bmain, op))) { - return OPERATOR_CANCELLED; - } - - ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); - - bNode *texture_node = node_add_node(*C, - nullptr, - GEO_NODE_LEGACY_ATTRIBUTE_SAMPLE_TEXTURE, - snode->runtime->cursor[0], - snode->runtime->cursor[1]); - if (!texture_node) { - BKE_report(op->reports, RPT_WARNING, "Could not add texture node"); - return OPERATOR_CANCELLED; - } - - texture_node->id = &texture->id; - id_us_plus(&texture->id); - - nodeSetActive(ntree, texture_node); - ED_node_tree_propagate_change(C, bmain, ntree); - DEG_relations_tag_update(bmain); - - return OPERATOR_FINISHED; -} - -static int node_add_texture_invoke(bContext *C, wmOperator *op, const wmEvent *event) -{ - ARegion *region = CTX_wm_region(C); - SpaceNode *snode = CTX_wm_space_node(C); - - /* Convert mouse coordinates to v2d space. */ - UI_view2d_region_to_view(®ion->v2d, - event->mval[0], - event->mval[1], - &snode->runtime->cursor[0], - &snode->runtime->cursor[1]); - - snode->runtime->cursor[0] /= UI_DPI_FAC; - snode->runtime->cursor[1] /= UI_DPI_FAC; - - return node_add_texture_exec(C, op); -} - -static bool node_add_texture_poll(bContext *C) -{ - const SpaceNode *snode = CTX_wm_space_node(C); - return ED_operator_node_editable(C) && ELEM(snode->nodetree->type, NTREE_GEOMETRY) && - !UI_but_active_drop_name(C); -} - -void NODE_OT_add_texture(wmOperatorType *ot) -{ - PropertyRNA *prop; - - /* identifiers */ - ot->name = "Add Node Texture"; - ot->description = "Add a texture to the current node editor"; - ot->idname = "NODE_OT_add_texture"; - - /* callbacks */ - ot->exec = node_add_texture_exec; - ot->invoke = node_add_texture_invoke; - ot->poll = node_add_texture_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - - RNA_def_string( - ot->srna, "name", "Texture", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); - prop = RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the data-block to assign", - INT32_MIN, - INT32_MAX); - RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ /** \name Add Node Collection Operator * \{ */ |