40 #include "RNA_prototypes.h"
69 "GeometryNodeTree")) {
103 return "ShaderNodeGroup";
106 return "CompositorNodeGroup";
109 return "TextureNodeGroup";
112 return "GeometryNodeGroup";
145 if (gnode && !exit) {
190 const char *dst_basepath)
193 sizeof(*basepath_change),
AT);
196 return basepath_change;
213 ListBase anim_basepaths = {
nullptr,
nullptr};
236 const char *old_animation_basepath =
nullptr;
308 if (glinks_first !=
nullptr) {
311 const char *identifier = link->fromsock->identifier;
312 int num_external_links = 0;
316 tlink = tlink->
next) {
317 if (tlink->tonode == gnode &&
STREQ(tlink->tosock->identifier, identifier)) {
318 nodeAddLink(
ntree, tlink->fromnode, tlink->fromsock, link->tonode, link->tosock);
319 num_external_links++;
325 if (num_external_links == 0) {
332 ntree, link->tosock->new_sock, link->tonode->new_node,
ntree, sock, gnode);
344 if (link->fromnode == gnode) {
345 const char *identifier = link->fromsock->identifier;
346 int num_internal_links = 0;
350 tlink = tlink->
next) {
353 if (
STREQ(tlink->tosock->identifier, identifier)) {
354 nodeAddLink(
ntree, tlink->fromnode, tlink->fromsock, link->tonode, link->tosock);
355 num_internal_links++;
362 if (num_internal_links == 0) {
368 nodeSocketCopy(
ntree, link->tosock, link->tonode,
ntree, sock, gnode);
414 ot->
idname =
"NODE_OT_group_ungroup";
441 ListBase anim_basepaths = {
nullptr,
nullptr};
504 const bool fromselect = (link->fromnode && (link->fromnode->flag &
NODE_SELECT));
505 const bool toselect = (link->tonode && (link->tonode->flag &
NODE_SELECT));
509 if (fromselect && toselect) {
511 node_map.
lookup(link->fromnode),
512 socket_map.
lookup(link->fromsock),
513 node_map.
lookup(link->tonode),
514 socket_map.
lookup(link->tosock));
519 if (fromselect && toselect) {
523 else if (fromselect || toselect) {
556 {
NODE_GS_COPY,
"COPY", 0,
"Copy",
"Copy to parent node tree, keep group intact"},
557 {
NODE_GS_MOVE,
"MOVE", 0,
"Move",
"Move to parent node tree, remove from group"},
558 {0,
nullptr, 0,
nullptr,
nullptr},
623 ot->
description =
"Separate selected nodes from the node group";
624 ot->
idname =
"NODE_OT_group_separate";
651 const char *ntree_idname,
662 const char *disabled_hint =
nullptr;
663 if (
node->typeinfo->poll_instance &&
664 !
node->typeinfo->poll_instance(
node, ngroup, &disabled_hint)) {
668 "Can not add node '%s' in a group:\n %s",
694 link->tonode->done |= 1;
697 link->fromnode->done |= 2;
720 loc[0] +=
node->width;
721 loc[1] -=
node->height;
729 if (totselect == 0) {
740 bool expose_visible =
false;
743 static const float offsetx = 200;
744 static const float offsety = 0.0f;
756 float2 real_min, real_max;
760 if (totselect == 1) {
761 expose_visible =
true;
764 ListBase anim_basepaths = {
nullptr,
nullptr};
769 if (
node->parent ==
nullptr) {
826 input_node->
locx = real_min[0] -
center[0] - offsetx;
827 input_node->
locy = -offsety;
831 output_node->
locx = real_max[0] -
center[0] + offsetx * 0.25f;
832 output_node->
locy = -offsety;
839 if ((fromselect && link->tonode == gnode) || (toselect && link->fromnode == gnode)) {
845 else if (toselect && !fromselect) {
865 nodeAddLink(ngroup, input_node, input_sock, link->tonode, link->tosock);
868 link->tonode = gnode;
871 else if (fromselect && !toselect) {
880 bool connected =
false;
882 if (olink->fromsock == link->fromsock && olink->tonode == output_node) {
884 olink->tosock->identifier);
885 link->fromnode = gnode;
886 link->fromsock = output_sock;
895 &
ntree.
links, link->fromnode, link->fromsock, &link_node, &link_sock);
906 nodeAddLink(ngroup, link->fromnode, link->fromsock, output_node, output_sock);
909 link->fromnode = gnode;
920 if (fromselect && toselect) {
935 if (expose_visible) {
941 if (link->tosock == sock) {
965 if (link->fromsock == sock) {
993 const char *ntreetype)
1000 if (totselect == 0) {
1009 gnode->
id = (
ID *)ngroup;
1089 if (!gnode || !gnode->
id) {
1110 ot->
name =
"Group Insert";
1111 ot->
description =
"Insert selected nodes into a node group";
1112 ot->
idname =
"NODE_OT_group_insert";
Blender kernel action and pose functionality.
void BKE_animdata_transfer_by_basepath(struct Main *bmain, struct ID *srcID, struct ID *dstID, struct ListBase *basepaths)
struct SpaceNode * CTX_wm_space_node(const bContext *C)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
struct ID * BKE_id_copy(struct Main *bmain, const struct ID *id)
void BKE_id_free(struct Main *bmain, void *idv)
void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node)
bool nodeLinkIsHidden(const struct bNodeLink *link)
void ntreeFreeCache(struct bNodeTree *ntree)
void ntreeFreeTree(struct bNodeTree *ntree)
struct bNode * nodeGetActive(struct bNodeTree *ntree)
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link)
struct bNodeSocket * ntreeAddSocketInterfaceFromSocket(struct bNodeTree *ntree, struct bNode *from_node, struct bNodeSocket *from_sock)
void nodeRemoveNode(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node, bool do_id_user)
struct bNodeLink * nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock)
struct bNodeTree * ntreeCopyTree(struct Main *bmain, const struct bNodeTree *ntree)
struct bNode * nodeAddNode(const struct bContext *C, struct bNodeTree *ntree, const char *idname)
void nodeSetSelected(struct bNode *node, bool select)
struct bNodeTree * ntreeAddTree(struct Main *bmain, const char *name, const char *idname)
struct bNode * nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type)
void nodeToView(const struct bNode *node, float x, float y, float *rx, float *ry)
void nodeDetachNode(struct bNode *node)
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node)
void BKE_ntree_update_tag_all(struct bNodeTree *ntree)
void BKE_ntree_update_tag_node_new(struct bNodeTree *ntree, struct bNode *node)
void BKE_ntree_update_tag_node_removed(struct bNodeTree *ntree)
void BKE_ntree_update_tag_link_added(struct bNodeTree *ntree, struct bNodeLink *link)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE void mul_v2_fl(float r[2], float f)
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
#define INIT_MINMAX2(min, max)
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
void DEG_relations_tag_update(struct Main *bmain)
bool ED_node_is_compositor(struct SpaceNode *snode)
bool ED_node_is_texture(struct SpaceNode *snode)
void ED_node_tree_push(struct SpaceNode *snode, struct bNodeTree *ntree, struct bNode *gnode)
bool ED_node_is_geometry(struct SpaceNode *snode)
bool ED_node_is_shader(struct SpaceNode *snode)
struct bNodeTree * ED_node_tree_get(struct SpaceNode *snode, int level)
void ED_node_tree_propagate_change(const struct bContext *C, struct Main *bmain, struct bNodeTree *ntree)
void ED_node_tree_pop(struct SpaceNode *snode)
void ED_preview_kill_jobs(struct wmWindowManager *wm, struct Main *bmain)
bool ED_operator_node_active(struct bContext *C)
bool ED_operator_node_editable(struct bContext *C)
NSNotificationCenter * center
_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.
struct uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
void uiItemEnumO(uiLayout *layout, const char *opname, const char *name, int icon, const char *propname, int value)
void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *pup)
void uiLayoutSetOperatorContext(uiLayout *layout, wmOperatorCallContext opcontext)
uiPopupMenu * UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL()
const Value & lookup(const Key &key) const
void add_new(const Key &key, const Value &value)
void append(const T &value)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
bNode * node_copy_with_mapping(bNodeTree *dst_tree, const bNode &node_src, const int flag, const bool unique_name, Map< const bNodeSocket *, bNodeSocket * > &socket_map)
static int node_group_make_exec(bContext *C, wmOperator *op)
static bool node_group_operator_active_poll(bContext *C)
static void node_group_make_insert_selected(const bContext &C, bNodeTree &ntree, bNode *gnode)
static int node_group_insert_exec(bContext *C, wmOperator *op)
static int node_group_ungroup_exec(bContext *C, wmOperator *op)
static int node_group_separate_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
void NODE_OT_group_make(wmOperatorType *ot)
static const EnumPropertyItem node_group_separate_types[]
void NODE_OT_group_insert(wmOperatorType *ot)
static bool node_group_separate_selected(Main &bmain, bNodeTree &ntree, bNodeTree &ngroup, const float2 &offset, const bool make_copy)
static int node_group_edit_exec(bContext *C, wmOperator *op)
static bool node_group_make_test_selected(bNodeTree &ntree, bNode *gnode, const char *ntree_idname, struct ReportList &reports)
static bNode * node_group_make_from_selected(const bContext &C, bNodeTree &ntree, const char *ntype, const char *ntreetype)
static bool node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
static int node_get_selected_minmax(bNodeTree &ntree, bNode *gnode, float2 &min, float2 &max, bool use_size)
static bNode * node_group_get_active(bContext *C, const char *node_idname)
const char * node_group_idname(bContext *C)
static bool node_group_operator_editable(bContext *C)
float2 space_node_group_offset(const SpaceNode &snode)
void NODE_OT_group_edit(wmOperatorType *ot)
static const char * group_ntree_idname(bContext *C)
void NODE_OT_group_separate(wmOperatorType *ot)
void sort_multi_input_socket_links(SpaceNode &snode, bNode &node, bNodeLink *drag_link, const float2 *cursor)
static int node_group_separate_exec(bContext *C, wmOperator *op)
void NODE_OT_group_ungroup(wmOperatorType *ot)
static bool node_group_make_use_node(bNode &node, bNode *gnode)
static AnimationBasePathChange * animation_basepath_change_new(const char *src_basepath, const char *dst_basepath)
static void animation_basepath_change_free(AnimationBasePathChange *basepath_change)
bNodeSocket * node_group_output_find_socket(bNode *node, const char *identifier)
void node_group_update(struct bNodeTree *ntree, struct bNode *node)
void node_group_input_update(bNodeTree *ntree, bNode *node)
bNodeSocket * node_group_find_output_socket(bNode *groupnode, const char *identifier)
bNodeSocket * node_group_input_find_socket(bNode *node, const char *identifier)
bNodeSocket * node_group_find_input_socket(bNode *groupnode, const char *identifier)
void node_group_output_update(bNodeTree *ntree, bNode *node)
void node_socket_skip_reroutes(ListBase *links, bNode *node, bNodeSocket *socket, bNode **r_node, bNodeSocket **r_socket)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
char * RNA_path_from_ID_to_struct(const PointerRNA *ptr)
const char * dst_basepath
const char * src_basepath
struct bNodeTree * edittree
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)