29 #include "RNA_prototypes.h"
35 #include "../interface/interface_intern.h"
164 if (!sock_to->
link) {
178 if (!sock_to->
link) {
200 bNode *node_prev =
nullptr;
224 node_from = node_prev;
226 else if (!node_from) {
228 if (node_prev !=
nullptr) {
252 if (node_prev && node_from != node_prev) {
256 sock_prev = sock_prev->
next) {
258 sock_from = sock_from->
next) {
296 #define UI_NODE_LINK_DISCONNECT -1
297 #define UI_NODE_LINK_REMOVE -2
314 std::optional<NodeDeclaration> &r_node_decl)
325 const char *disabled_hint;
335 const char *disabled_hint;
367 r_node_decl->outputs();
373 if (
dynamic_cast<const decl::Float *
>(&socket_decl)) {
376 else if (
dynamic_cast<const decl::Int *
>(&socket_decl)) {
379 else if (
dynamic_cast<const decl::Bool *
>(&socket_decl)) {
382 else if (
dynamic_cast<const decl::Vector *
>(&socket_decl)) {
385 else if (
dynamic_cast<const decl::Color *
>(&socket_decl)) {
388 else if (
dynamic_cast<const decl::String *
>(&socket_decl)) {
391 else if (
dynamic_cast<const decl::Image *
>(&socket_decl)) {
394 else if (
dynamic_cast<const decl::Texture *
>(&socket_decl)) {
400 else if (
dynamic_cast<const decl::Shader *
>(&socket_decl)) {
406 else if (
dynamic_cast<const decl::Object *
>(&socket_decl)) {
424 for (stemp = socket_templates; stemp && stemp->
type != -1; stemp++, i++) {
487 return (typeA == typeB);
499 if (
STREQ(ntype->
idname,
"ShaderNodeUVAlongStroke")) {
525 const char *disabled_hint;
526 if (!(ntype->poll && ntype->poll(ntype,
ntree, &disabled_hint))) {
530 if (ntype->nclass != nclass) {
538 sorted_ntypes.
append(ntype);
546 for (
int j = 0; j < sorted_ntypes.
size(); j++) {
549 const char *cur_node_name =
nullptr;
551 int icon = ICON_NONE;
555 std::optional<blender::nodes::NodeDeclaration> node_decl;
580 if (!cur_node_name || !
STREQ(cur_node_name, item.node_name)) {
581 cur_node_name = item.node_name;
622 TIP_(
"Add node to input"));
659 if (ntreetype && ntreetype->foreach_nodeclass) {
684 TIP_(
"Remove nodes connected to the input"));
700 TIP_(
"Disconnect nodes connected to the input"));
720 arg = MEM_new<NodeLinkArg>(
"NodeLinkArg");
746 but->
poin = (
char *)but;
771 if (
node->typeinfo->draw_buttons) {
774 node->typeinfo->draw_buttons(layout,
C, &nodeptr);
789 bool dependency_loop;
800 if (dependency_loop) {
814 bool add_dummy_decorator =
false;
825 ICON_DISCLOSURE_TRI_DOWN;
837 if (dependency_loop) {
839 add_dummy_decorator =
true;
844 add_dummy_decorator =
true;
860 add_dummy_decorator =
true;
864 switch (
input->type) {
873 uiItemR(sub, &inputptr,
"default_value", 0,
"", ICON_NONE);
886 uiItemR(sub, &inputptr,
"default_value", 0,
"", ICON_NONE);
893 add_dummy_decorator =
true;
898 if (add_dummy_decorator) {
struct Scene * CTX_data_scene(const bContext *C)
struct SpaceNode * CTX_wm_space_node(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
void id_us_plus(struct ID *id)
#define NODE_TYPES_BEGIN(ntype)
bool nodeGroupPoll(struct bNodeTree *nodetree, struct bNodeTree *grouptree, const char **r_disabled_hint)
#define NODE_CUSTOM_GROUP
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link)
void nodeRemoveNode(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node, bool do_id_user)
int nodeSocketLinkLimit(const struct bNodeSocket *sock)
void nodePositionRelative(struct bNode *from_node, struct bNode *to_node, struct bNodeSocket *from_sock, struct bNodeSocket *to_sock)
struct bNodeLink * nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock)
void nodeLabel(const struct bNodeTree *ntree, const struct bNode *node, char *label, int maxlen)
#define NODE_CLASS_LAYOUT
struct bNode * nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type)
int nodeCountSocketLinks(const struct bNodeTree *ntree, const struct bNodeSocket *sock)
#define NODE_CLASS_TEXTURE
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node)
void BKE_ntree_update_tag_node_property(struct bNodeTree *ntree, struct bNode *node)
A (mainly) macro array library.
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_strcasecmp_natural(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
#define NODE_ACTIVE_TEXTURE
void ED_node_tree_propagate_change(const struct bContext *C, struct Main *bmain, struct bNodeTree *ntree)
void ED_undo_push(struct bContext *C, const char *str)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
uiBut * uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
void UI_but_node_link_set(uiBut *but, struct bNodeSocket *socket, const float draw_color[4])
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
uiBut * uiDefBut(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout)
void uiItemL(uiLayout *layout, const char *name, int icon)
void UI_but_drawflag_enable(uiBut *but, int flag)
void uiLayoutSetAlignment(uiLayout *layout, char alignment)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemS(uiLayout *layout)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void UI_but_type_set_menu_from_pulldown(uiBut *but)
void UI_block_emboss_set(uiBlock *block, eUIEmbossType emboss)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
uiBut * uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, int x, int y, short width, short height, const char *tip)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
uiLayout * uiLayoutSplit(uiLayout *layout, float percentage, bool align)
uiBut * uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip)
void uiItemDecoratorR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int index)
void UI_block_layout_set_current(uiBlock *block, uiLayout *layout)
void UI_but_funcN_set(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2)
void UI_block_flag_enable(uiBlock *block, int flag)
constexpr const char * c_str() const
void append(const T &value)
StringRefNull name() const
ccl_global KernelShaderEvalInput * input
void *(* MEM_dupallocN)(const void *vmemh)
static void node_clear_recursive(bNode *node)
void node_socket_add_tooltip(bNodeTree *ntree, bNode *node, bNodeSocket *sock, uiLayout *layout)
static void node_socket_disconnect(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to)
static void node_link_item_apply(bNodeTree *ntree, bNode *node, NodeLinkItem *item)
static int ui_node_item_name_compare(const void *a, const void *b)
static void ui_node_draw_node(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, int depth)
static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_p)
static void node_tag_recursive(bNode *node)
void node_geometry_add_attribute_search_button(const bContext &UNUSED(C), const bNode &node, PointerRNA &socket_ptr, uiLayout &layout)
static Vector< NodeLinkItem > ui_node_link_items(NodeLinkArg *arg, int in_out, std::optional< NodeDeclaration > &r_node_decl)
static void node_menu_column_foreach_cb(void *calldata, int nclass, const char *name)
static void ui_node_sock_name(const bNodeTree *ntree, bNodeSocket *sock, char name[UI_MAX_NAME_STR])
void node_socket_color_get(const bContext &C, const bNodeTree &ntree, PointerRNA &node_ptr, const bNodeSocket &sock, float r_color[4])
static bool ui_node_item_special_poll(const bNodeTree *UNUSED(ntree), const bNodeType *ntype)
static void node_socket_add_replace(const bContext *C, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to, int type, NodeLinkItem *item)
static void node_remove_linked(Main *bmain, bNodeTree *ntree, bNode *rem_node)
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_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to)
static bool node_link_item_compare(bNode *node, NodeLinkItem *item)
static void ui_node_link(bContext *C, void *arg_p, void *event_p)
static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, bNodeSocket *input, int depth)
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
std::unique_ptr< SocketDeclaration > SocketDeclarationPtr
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void node_socket_copy_default_value(bNodeSocket *to, const bNodeSocket *from)
#define UI_NODE_LINK_DISCONNECT
void uiTemplateNodeView(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, bNodeSocket *input)
void uiTemplateNodeLink(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, bNodeSocket *input)
#define UI_NODE_LINK_REMOVE
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Compact definition of a node socket.
struct bNodeSocket * next
struct bNodeSocketType * typeinfo
struct bNodeTreeType * typeinfo
bNodeSocketTemplate * outputs
void(* draw_buttons_ex)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
NodeDeclareFunction declare
bNodeSocketTemplate * inputs
struct bNodeType * typeinfo
uiLayout * decorate_column