2013-03-18 16:34:57 +00:00
|
|
|
/*
|
|
|
|
|
* ***** 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) 2006 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** \file blender/nodes/composite/node_composite_util.c
|
|
|
|
|
* \ingroup nodes
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "node_composite_util.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cmp_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
|
|
|
|
|
{
|
2013-05-27 08:04:07 +00:00
|
|
|
return STREQ(ntree->idname, "CompositorNodeTree");
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cmp_node_update_default(bNodeTree *UNUSED(ntree), bNode *node)
|
|
|
|
|
{
|
|
|
|
|
bNodeSocket *sock;
|
2013-05-27 08:04:07 +00:00
|
|
|
for (sock = node->outputs.first; sock; sock = sock->next) {
|
2013-03-24 01:19:55 +00:00
|
|
|
if (sock->cache) {
|
2013-03-18 16:34:57 +00:00
|
|
|
//free_compbuf(sock->cache);
|
2015-04-21 15:53:32 +10:00
|
|
|
//sock->cache = NULL;
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
2013-05-27 08:04:07 +00:00
|
|
|
node->need_exec = 1;
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag)
|
|
|
|
|
{
|
|
|
|
|
node_type_base(ntype, type, name, nclass, flag);
|
|
|
|
|
|
|
|
|
|
ntype->poll = cmp_node_poll_default;
|
|
|
|
|
ntype->updatefunc = cmp_node_update_default;
|
Node callback for handling link insertion and swapping of occupied inputs.
Nodes have a feature for moving existing links to unoccupied sockets when connecting
to an already used input. This is based on the standard legacy socket types (value/float,
vector, color/rgba) and works reasonably well for shader, compositor and texture nodes.
For new pynode systems, however, the hardcoded nature of that feature has major drawbacks:
* It does not take different type systems into account, leading to meaningless connections
when sockets are swapped and making the feature useless or outright debilitating.
* Advanced socket behaviors would be possible with a registerable callback, e.g. creating
extensible input lists that move existing connections down to make room for a new link.
Now any handling of new links is done via the 'insert_links' callback, which can also be
registered through the RNA API. For the legacy shader/compo/tex nodes the behavior is the
same, using a C callback.
Note on the 'use_swap' flag: this has been removed because it was meaningless anyway:
It was disabled only for the insert-node-on-link feature, which works only for
completely unconnected nodes anyway, so there would be nothing to swap in the first place.
2015-12-03 12:51:29 +01:00
|
|
|
ntype->insert_link = node_insert_link_default;
|
2013-03-18 16:34:57 +00:00
|
|
|
ntype->update_internal_links = node_update_internal_links_default;
|
|
|
|
|
}
|