Blender V2.61 - r43446
|
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLF_translation.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_scene.h"
#include "RNA_access.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "../interface/interface_intern.h"
#include "ED_node.h"
Go to the source code of this file.
Classes | |
struct | NodeLinkArg |
Defines | |
#define | UI_NODE_LINK_ADD 0 |
#define | UI_NODE_LINK_DISCONNECT -1 |
#define | UI_NODE_LINK_REMOVE -2 |
Typedefs | |
typedef struct NodeLinkArg | NodeLinkArg |
Functions | |
static void | node_tag_recursive (bNode *node) |
static void | node_clear_recursive (bNode *node) |
static void | node_remove_linked (bNodeTree *ntree, bNode *rem_node) |
static void | node_socket_disconnect (Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to) |
static void | node_socket_remove (Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to) |
static void | node_socket_add_replace (Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to, bNodeTemplate *ntemp, int sock_num) |
static void | ui_node_link (bContext *UNUSED(C), void *arg_p, void *event_p) |
static void | ui_node_sock_name (bNodeSocket *sock, char name[UI_MAX_NAME_STR]) |
static int | ui_compatible_sockets (int typeA, int typeB) |
static void | ui_node_menu_column (NodeLinkArg *arg, int nclass, const char *cname) |
static void | node_menu_column_foreach_cb (void *calldata, int nclass, const char *name) |
static void | ui_template_node_link_menu (bContext *C, uiLayout *layout, void *but_p) |
void | uiTemplateNodeLink (uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSocket *sock) |
static void | ui_node_draw_input (uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, bNodeSocket *input, int depth) |
static void | ui_node_draw_node (uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, int depth) |
void | uiTemplateNodeView (uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, bNodeSocket *input) |
#define UI_NODE_LINK_ADD 0 |
Definition at line 236 of file node_templates.c.
#define UI_NODE_LINK_DISCONNECT -1 |
Definition at line 237 of file node_templates.c.
Referenced by ui_node_link(), and ui_template_node_link_menu().
#define UI_NODE_LINK_REMOVE -2 |
Definition at line 238 of file node_templates.c.
Referenced by ui_node_link(), and ui_template_node_link_menu().
typedef struct NodeLinkArg NodeLinkArg |
static void node_clear_recursive | ( | bNode * | node | ) | [static] |
Definition at line 77 of file node_templates.c.
References ListBase::first, bNode::flag, bNodeLink::fromnode, bNode::inputs, bNodeSocket::link, bNodeSocket::next, and NODE_TEST.
Referenced by node_remove_linked().
static void node_menu_column_foreach_cb | ( | void * | calldata, |
int | nclass, | ||
const char * | name | ||
) | [static] |
Definition at line 436 of file node_templates.c.
References ELEM, NODE_CLASS_GROUP, NODE_CLASS_LAYOUT, and ui_node_menu_column().
Referenced by ui_template_node_link_menu().
Definition at line 91 of file node_templates.c.
References ListBase::first, bNode::flag, bNodeLink::fromnode, bNode::id, bNode::inputs, bNodeSocket::link, bNodeSocket::next, bNode::next, next, node_clear_recursive(), node_tag_recursive(), NODE_TEST, nodeFreeNode(), bNodeTree::nodes, and ID::us.
Referenced by node_socket_add_replace(), and node_socket_remove().
static void node_socket_add_replace | ( | Main * | bmain, |
bNodeTree * | ntree, | ||
bNode * | node_to, | ||
bNodeSocket * | sock_to, | ||
bNodeTemplate * | ntemp, | ||
int | sock_num | ||
) | [static] |
Definition at line 153 of file node_templates.c.
References BLI_findlink(), bNodeSocket::default_value, ED_node_generic_update(), ListBase::first, bNodeType::flag, bNodeLink::fromnode, bNodeLink::fromsock, bNodeTree::id, bNode::id, id_us_plus(), bNode::inputs, link(), bNodeSocket::link, bNode::locx, bNode::locy, MEM_dupallocN(), MEM_freeN(), bNodeSocket::name, bNodeType::nclass, bNodeSocket::next, bNode::next, bNodeTemplate::ngroup, NODE_CLASS_TEXTURE, NODE_GROUP, NODE_OPTIONS, node_remove_linked(), nodeAddLink(), nodeAddNode(), nodeRemLink(), bNodeTree::nodes, nodeSetActive(), nodeUpdate(), ntreeUpdateTree(), NULL, bNode::outputs, bNode::storage, bNodeSocket::type, bNodeTemplate::type, bNode::type, bNode::typeinfo, and bNodeType::width.
Referenced by ui_node_link().
static void node_socket_disconnect | ( | Main * | bmain, |
bNodeTree * | ntree, | ||
bNode * | node_to, | ||
bNodeSocket * | sock_to | ||
) | [static] |
Definition at line 125 of file node_templates.c.
References ED_node_generic_update(), bNodeSocket::link, nodeRemLink(), nodeUpdate(), and ntreeUpdateTree().
Referenced by ui_node_link().
static void node_socket_remove | ( | Main * | bmain, |
bNodeTree * | ntree, | ||
bNode * | node_to, | ||
bNodeSocket * | sock_to | ||
) | [static] |
Definition at line 139 of file node_templates.c.
References ED_node_generic_update(), bNodeLink::fromnode, bNodeSocket::link, node_remove_linked(), nodeUpdate(), and ntreeUpdateTree().
Referenced by ui_node_link().
static void node_tag_recursive | ( | bNode * | node | ) | [static] |
Definition at line 63 of file node_templates.c.
References ListBase::first, bNode::flag, bNodeLink::fromnode, bNode::inputs, bNodeSocket::link, bNodeSocket::next, and NODE_TEST.
Referenced by node_remove_linked().
static int ui_compatible_sockets | ( | int | typeA, |
int | typeB | ||
) | [static] |
Definition at line 299 of file node_templates.c.
Referenced by ui_node_menu_column().
static void ui_node_draw_input | ( | uiLayout * | layout, |
bContext * | C, | ||
bNodeTree * | ntree, | ||
bNode * | node, | ||
bNodeSocket * | input, | ||
int | depth | ||
) | [static] |
Definition at line 545 of file node_templates.c.
References BLI_snprintf(), uiBlock::buttons, ListBase::first, uiBut::flag, bNode::flag, bNodeSocket::flag, bNodeLink::fromnode, bNodeTree::id, bNode::inputs, label(), ListBase::last, bNodeSocket::link, bNodeSocket::name, NODE_GROUP, NODE_TEST, NULL, RNA_NodeSocket, RNA_pointer_create(), SOCK_COLLAPSED, SOCK_HIDE_VALUE, SOCK_SHADER, SOCK_UNAVAIL, SOCK_VECTOR, split(), bNodeSocket::type, bNode::type, bNode::typeinfo, UI_EMBOSS, UI_EMBOSSN, UI_ITEM_R_ICON_ONLY, UI_MAX_NAME_STR, ui_node_draw_node(), UI_TEXT_LEFT, UI_UNIT_X, uiBlockSetEmboss(), bNodeType::uifunc, uiItemL(), uiItemR(), uiItemS(), uiLayoutColumn(), uiLayoutGetBlock(), uiLayoutRow(), uiLayoutSplit(), uiTemplateNodeLink(), and uiBut::x2.
Referenced by ui_node_draw_node(), and uiTemplateNodeView().
static void ui_node_draw_node | ( | uiLayout * | layout, |
bContext * | C, | ||
bNodeTree * | ntree, | ||
bNode * | node, | ||
int | depth | ||
) | [static] |
Definition at line 523 of file node_templates.c.
References ListBase::first, bNodeTree::id, bNode::inputs, bNodeSocket::next, NODE_GROUP, RNA_Node, RNA_pointer_create(), split(), bNode::type, bNode::typeinfo, ui_node_draw_input(), bNodeType::uifunc, uiLayoutColumn(), and uiLayoutSplit().
Referenced by ui_node_draw_input(), and uiTemplateNodeView().
static void ui_node_link | ( | bContext * | UNUSEDC, |
void * | arg_p, | ||
void * | event_p | ||
) | [static] |
Definition at line 254 of file node_templates.c.
References NodeLinkArg::bmain, GET_INT_FROM_POINTER, bNodeTemplate::ngroup, NodeLinkArg::ngroup, NodeLinkArg::node, node_socket_add_replace(), node_socket_disconnect(), node_socket_remove(), NodeLinkArg::ntree, NodeLinkArg::output, NodeLinkArg::sock, NodeLinkArg::type, bNodeTemplate::type, UI_NODE_LINK_DISCONNECT, and UI_NODE_LINK_REMOVE.
Referenced by ui_node_menu_column(), and ui_template_node_link_menu().
static void ui_node_menu_column | ( | NodeLinkArg * | arg, |
int | nclass, | ||
const char * | cname | ||
) | [static] |
Definition at line 304 of file node_templates.c.
References BLI_snprintf(), BLI_strncpy(), NodeLinkArg::bmain, BUT, uiBlock::buttons, bNodeType::compatibility, ListBase::first, uiBut::flag, i, bNodeTree::id, bNodeTree::inputs, ListBase::last, NodeLinkArg::layout, MEM_dupallocN(), bNodeSocketTemplate::name, bNodeType::name, bNodeSocket::name, ID::name, bNodeType::nclass, bNodeType::next, bNodeSocket::next, ID::next, NodeLinkArg::ngroup, NODE_CLASS_GROUP, NODE_GROUP, NODE_NEW_SHADING, NODE_OLD_SHADING, bNodeTreeType::node_types, Main::nodetree, NodeLinkArg::ntree, NTREE_SHADER, ntreeGetType(), NULL, NodeLinkArg::output, bNodeType::outputs, bNodeTree::outputs, NodeLinkArg::scene, scene_use_new_shading_nodes(), NodeLinkArg::sock, bNodeType::type, bNodeSocketTemplate::type, NodeLinkArg::type, bNodeSocket::type, bNodeTree::type, ui_compatible_sockets(), UI_MAX_NAME_STR, ui_node_link(), UI_TEXT_LEFT, UI_UNIT_X, UI_UNIT_Y, uiBlockSetCurLayout(), uiButSetNFunc(), uiDefBut(), uiItemL(), uiLayoutColumn(), and uiLayoutGetBlock().
Referenced by node_menu_column_foreach_cb(), and ui_template_node_link_menu().
static void ui_node_sock_name | ( | bNodeSocket * | sock, |
char | name[UI_MAX_NAME_STR] | ||
) | [static] |
Definition at line 275 of file node_templates.c.
References BLI_snprintf(), BLI_strncpy(), ListBase::first, bNodeType::flag, bNodeLink::fromnode, bNodeLink::fromsock, bNode::id, bNode::inputs, ListBase::last, bNodeSocket::link, bNodeSocket::name, bNodeType::name, ID::name, NODE_GROUP, NODE_OPTIONS, NULL, bNode::outputs, SOCK_SHADER, bNodeSocket::type, bNode::type, bNode::typeinfo, and UI_MAX_NAME_STR.
Referenced by uiTemplateNodeLink().
Definition at line 444 of file node_templates.c.
References NodeLinkArg::bmain, BUT, uiBlock::buttons, CTX_data_main(), CTX_data_scene(), uiBut::flag, uiBut::func_argN, IFACE_, ListBase::last, NodeLinkArg::layout, MEM_dupallocN(), NODE_CLASS_GROUP, node_menu_column_foreach_cb(), NodeLinkArg::ntree, ntreeGetType(), NULL, NodeLinkArg::scene, SET_INT_IN_POINTER, NodeLinkArg::sock, split(), bNodeTree::type, ui_node_link(), UI_NODE_LINK_DISCONNECT, UI_NODE_LINK_REMOVE, ui_node_menu_column(), UI_TEXT_LEFT, UI_UNIT_X, UI_UNIT_Y, uiBlockSetCurLayout(), uiButSetNFunc(), uiDefBut(), uiItemL(), uiLayoutColumn(), uiLayoutGetBlock(), and uiLayoutSplit().
Referenced by uiTemplateNodeLink().
void uiTemplateNodeLink | ( | uiLayout * | layout, |
bNodeTree * | ntree, | ||
bNode * | node, | ||
bNodeSocket * | sock | ||
) |
Definition at line 485 of file node_templates.c.
References bNode::flag, uiBut::flag, bNodeSocket::flag, bNodeLink::fromnode, uiBut::func_argN, bNodeSocket::link, MEM_callocN(), MENU, NodeLinkArg::node, NODE_ACTIVE_TEXTURE, NodeLinkArg::ntree, NULL, NodeLinkArg::output, uiBut::poin, NodeLinkArg::sock, SOCK_HIDE_VALUE, SOCK_SHADER, uiBut::type, bNodeSocket::type, NodeLinkArg::type, UI_BUT_NODE_ACTIVE, UI_BUT_NODE_LINK, UI_MAX_NAME_STR, ui_node_sock_name(), ui_template_node_link_menu(), UI_TEXT_LEFT, UI_UNIT_X, UI_UNIT_Y, uiBlockSetCurLayout(), uiDefIconMenuBut(), uiDefMenuBut(), and uiLayoutGetBlock().
Referenced by node_sockets_panel(), and ui_node_draw_input().
void uiTemplateNodeView | ( | uiLayout * | layout, |
bContext * | C, | ||
bNodeTree * | ntree, | ||
bNode * | node, | ||
bNodeSocket * | input | ||
) |
Definition at line 639 of file node_templates.c.
References ListBase::first, bNode::flag, bNode::next, NODE_TEST, bNodeTree::nodes, ui_node_draw_input(), and ui_node_draw_node().