[Bf-blender-cvs] [b9734f7716f] master: Cleanup: Remove unused node.c.

Jeroen Bakker noreply at git.blender.org
Mon Mar 29 09:25:06 CEST 2021


Commit: b9734f7716f67b9b040d78b809f2871e8141b7a6
Author: Jeroen Bakker
Date:   Mon Mar 29 09:24:28 2021 +0200
Branches: master
https://developer.blender.org/rBb9734f7716f67b9b040d78b809f2871e8141b7a6

Cleanup: Remove unused node.c.

Was wrongly added back with the anti aliasing node patch.

===================================================================

D	source/blender/blenkernel/intern/node.c

===================================================================

diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
deleted file mode 100644
index 95013264026..00000000000
--- a/source/blender/blenkernel/intern/node.c
+++ /dev/null
@@ -1,3969 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/blenkernel/intern/node.c
- *  \ingroup bke
- */
-
-#include "MEM_guardedalloc.h"
-
-#include <limits.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "DNA_action_types.h"
-#include "DNA_anim_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_linestyle_types.h"
-#include "DNA_material_types.h"
-#include "DNA_node_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_world_types.h"
-
-#include "BLI_listbase.h"
-#include "BLI_math.h"
-#include "BLI_path_util.h"
-#include "BLI_string.h"
-#include "BLI_string_utils.h"
-#include "BLI_utildefines.h"
-
-#include "BLT_translation.h"
-
-#include "BKE_animsys.h"
-#include "BKE_global.h"
-#include "BKE_idprop.h"
-#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
-#include "BKE_main.h"
-#include "BKE_node.h"
-
-#include "BLI_ghash.h"
-#include "BLI_threads.h"
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "NOD_common.h"
-#include "NOD_composite.h"
-#include "NOD_shader.h"
-#include "NOD_socket.h"
-#include "NOD_texture.h"
-
-#define NODE_DEFAULT_MAX_WIDTH 700
-
-/* Fallback types for undefined tree, nodes, sockets */
-bNodeTreeType NodeTreeTypeUndefined;
-bNodeType NodeTypeUndefined;
-bNodeSocketType NodeSocketTypeUndefined;
-
-static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType *ntype)
-{
-  bNodeSocketTemplate *sockdef;
-  /* bNodeSocket *sock; */ /* UNUSED */
-
-  if (ntype->inputs) {
-    sockdef = ntype->inputs;
-    while (sockdef->type != -1) {
-      /* sock = */ node_add_socket_from_template(ntree, node, sockdef, SOCK_IN);
-
-      sockdef++;
-    }
-  }
-  if (ntype->outputs) {
-    sockdef = ntype->outputs;
-    while (sockdef->type != -1) {
-      /* sock = */ node_add_socket_from_template(ntree, node, sockdef, SOCK_OUT);
-
-      sockdef++;
-    }
-  }
-}
-
-/* Note: This function is called to initialize node data based on the type.
- * The bNodeType may not be registered at creation time of the node,
- * so this can be delayed until the node type gets registered.
- */
-static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node)
-{
-  bNodeType *ntype = node->typeinfo;
-  if (ntype == &NodeTypeUndefined)
-    return;
-
-  /* only do this once */
-  if (node->flag & NODE_INIT)
-    return;
-
-  node->flag = NODE_SELECT | NODE_OPTIONS | ntype->flag;
-  node->width = ntype->width;
-  node->miniwidth = 42.0f;
-  node->height = ntype->height;
-  node->color[0] = node->color[1] = node->color[2] = 0.608; /* default theme color */
-  /* initialize the node name with the node label.
-   * note: do this after the initfunc so nodes get their data set which may be used in naming
-   * (node groups for example) */
-  /* XXX Do not use nodeLabel() here, it returns translated content for UI, which should *only* be
-   * used in UI, *never* in data... Data have their own translation option! This solution may be a
-   * bit rougher than nodeLabel()'s returned string, but it's simpler than adding "do_translate"
-   * flags to this func (and labelfunc() as well). */
-  BLI_strncpy(node->name, DATA_(ntype->ui_name), NODE_MAXSTR);
-  nodeUniqueName(ntree, node);
-
-  node_add_sockets_from_type(ntree, node, ntype);
-
-  if (ntype->initfunc != NULL)
-    ntype->initfunc(ntree, node);
-
-  if (ntree->typeinfo->node_add_init != NULL)
-    ntree->typeinfo->node_add_init(ntree, node);
-
-  /* extra init callback */
-  if (ntype->initfunc_api) {
-    PointerRNA ptr;
-    RNA_pointer_create((ID *)ntree, &RNA_Node, node, &ptr);
-
-    /* XXX Warning: context can be NULL in case nodes are added in do_versions.
-     * Delayed init is not supported for nodes with context-based initfunc_api atm.
-     */
-    BLI_assert(C != NULL);
-    ntype->initfunc_api(C, &ptr);
-  }
-
-  if (node->id)
-    id_us_plus(node->id);
-
-  node->flag |= NODE_INIT;
-}
-
-static void ntree_set_typeinfo(bNodeTree *ntree, bNodeTreeType *typeinfo)
-{
-  if (typeinfo) {
-    ntree->typeinfo = typeinfo;
-
-    /* deprecated integer type */
-    ntree->type = typeinfo->type;
-  }
-  else {
-    ntree->typeinfo = &NodeTreeTypeUndefined;
-
-    ntree->init &= ~NTREE_TYPE_INIT;
-  }
-}
-
-static void node_set_typeinfo(const struct bContext *C,
-                              bNodeTree *ntree,
-                              bNode *node,
-                              bNodeType *typeinfo)
-{
-  /* for nodes saved in older versions storage can get lost, make undefined then */
-  if (node->flag & NODE_INIT) {
-    if (typeinfo && typeinfo->storagename[0] && !node->storage)
-      typeinfo = NULL;
-  }
-
-  if (typeinfo) {
-    node->typeinfo = typeinfo;
-
-    /* deprecated integer type */
-    node->type = typeinfo->type;
-
-    /* initialize the node if necessary */
-    node_init(C, ntree, node);
-  }
-  else {
-    node->typeinfo = &NodeTypeUndefined;
-
-    ntree->init &= ~NTREE_TYPE_INIT;
-  }
-}
-
-static void node_socket_set_typeinfo(bNodeTree *ntree,
-                                     bNodeSocket *sock,
-                                     bNodeSocketType *typeinfo)
-{
-  if (typeinfo) {
-    sock->typeinfo = typeinfo;
-
-    /* deprecated integer type */
-    sock->type = typeinfo->type;
-
-    if (sock->default_value == NULL) {
-      /* initialize the default_value pointer used by standard socket types */
-      node_socket_init_default_value(sock);
-    }
-  }
-  else {
-    sock->typeinfo = &NodeSocketTypeUndefined;
-
-    ntree->init &= ~NTREE_TYPE_INIT;
-  }
-}
-
-/* Set specific typeinfo pointers in all node trees on register/unregister */
-static void update_typeinfo(Main *bmain,
-                            const struct bContext *C,
-                            bNodeTreeType *treetype,
-                            bNodeType *nodetype,
-                            bNodeSocketType *socktype,
-                            bool unregister)
-{
-  if (!bmain)
-    return;
-
-  FOREACH_NODETREE(bmain, ntree, id)
-  {
-    bNode *node;
-    bNodeSocket *sock;
-
-    ntree->init |= NTREE_TYPE_INIT;
-
-    if (treetype && STREQ(ntree->idname, treetype->idname))
-      ntree_set_typeinfo(ntree, unregister ? NULL : treetype);
-
-    /* initialize nodes */
-    for (node = ntree->nodes.first; node; node = node->next) {
-      if (nodetype && STREQ(node->idname, nodetype->idname))
-        node_set_typeinfo(C, ntree, node, unregister ? NULL : nodetype);
-
-      /* initialize node sockets */
-      for (sock = node->inputs.first; sock; sock = sock->next)
-        if (socktype && STREQ(sock->idname, socktype->idname))
-          node_socket_set_typeinfo(ntree, sock, unregister ? NULL : socktype);
-      for (sock = node->outputs.first; sock; sock = sock->next)
-        if (socktype && STREQ(sock->idname, socktype->idname))
-          node_socket_set_typeinfo(ntree, sock, unregister ? NULL : socktype);
-    }
-
-    /* initialize tree sockets */
-    for (sock = ntree->inputs.first; sock; sock = sock->next)
-      if (socktype && STREQ(sock->idname, socktype->idname))
-        node_socket_set_typeinfo(ntree, sock, unregister ? NULL : socktype);
-    for (sock = ntree->outputs.first; sock; sock = sock->next)
-      if (socktype && STREQ(sock->idname, socktype->idname))
-        node_socket_set_typeinfo(ntree, sock, unregister ? NULL : socktype);
-  }
-  FOREACH_NODETREE_END
-}
-
-/* Try to initialize all typeinfo in a node tree.
- * NB: In general undefined typeinfo is a perfectly valid case, the type may just be registered
- * later. In that case the update_typeinfo function will set typeinfo on registration and do
- * necessary updates.
- */
-void ntreeSetTypes(const struct bContext *C, bNodeTree *ntree)
-{
-  bNode *node;
-  bNodeSocket *sock;
-
-  ntree->init |= NTREE_TYPE_INIT;
-
-  ntree_set_typeinfo(ntree, ntreeTypeFind(ntree->idname));
-
-  for (node = ntree->nodes.first; node; node = node->next) {
-    node_set_typeinfo(C, ntree, node, nodeTypeFind(node->idname));
-
-    for (sock = node->inputs.first; sock; sock = sock->next)
-      node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(sock->idname));
-    for (sock = node->outputs.first; sock; sock = sock->next)
-      node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(sock->idname));
-  }
-
-  for (sock = ntree->inputs.first; sock; sock = sock->next)
-    node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(sock->idname));
-  for (sock = ntree->outputs.first; sock; sock = sock->next)
-    node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(sock->idname));
-}
-
-static GHash *nodetreetypes_hash = NULL;
-static GHash *nodetypes_hash = NULL;
-static GHash *nodesockettypes_hash = NULL;
-static SpinLock spin;
-
-bNodeTreeType *ntreeTypeFind(const char *idname)
-{
-  bNodeTreeType *nt;
-
-  if (idname[0]) {
-    nt = BLI_ghash_lookup(nodetreetypes_hash, idname);
-    if (nt)
-      return nt;
-  }
-
-  return NULL;
-}
-
-void ntreeTypeAdd(bNodeTreeType *nt)
-{
-  BLI_ghash_insert(nodetreetyp

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list