Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_node/space_node.c')
-rw-r--r--source/blender/editors/space_node/space_node.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index ccac730c88f..36886d0ab32 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -73,30 +73,30 @@ void ED_node_tree_start(SpaceNode *snode, bNodeTree *ntree, ID *id, ID *from)
MEM_freeN(path);
}
BLI_listbase_clear(&snode->treepath);
-
+
if (ntree) {
path = MEM_callocN(sizeof(bNodeTreePath), "node tree path");
path->nodetree = ntree;
path->parent_key = NODE_INSTANCE_KEY_BASE;
-
+
/* copy initial offset from bNodeTree */
copy_v2_v2(path->view_center, ntree->view_center);
-
+
if (id)
BLI_strncpy(path->node_name, id->name + 2, sizeof(path->node_name));
-
+
BLI_addtail(&snode->treepath, path);
-
+
id_us_ensure_real(&ntree->id);
}
-
+
/* update current tree */
snode->nodetree = snode->edittree = ntree;
snode->id = id;
snode->from = from;
-
+
ED_node_set_active_viewer_key(snode);
-
+
WM_main_add_notifier(NC_SCENE | ND_NODES, NULL);
}
@@ -110,44 +110,44 @@ void ED_node_tree_push(SpaceNode *snode, bNodeTree *ntree, bNode *gnode)
path->parent_key = BKE_node_instance_key(prev_path->parent_key, prev_path->nodetree, gnode);
else
path->parent_key = NODE_INSTANCE_KEY_BASE;
-
+
BLI_strncpy(path->node_name, gnode->name, sizeof(path->node_name));
}
else
path->parent_key = NODE_INSTANCE_KEY_BASE;
-
+
/* copy initial offset from bNodeTree */
copy_v2_v2(path->view_center, ntree->view_center);
-
+
BLI_addtail(&snode->treepath, path);
-
+
id_us_ensure_real(&ntree->id);
-
+
/* update current tree */
snode->edittree = ntree;
-
+
ED_node_set_active_viewer_key(snode);
-
+
WM_main_add_notifier(NC_SCENE | ND_NODES, NULL);
}
void ED_node_tree_pop(SpaceNode *snode)
{
bNodeTreePath *path = snode->treepath.last;
-
+
/* don't remove root */
if (path == snode->treepath.first)
return;
-
+
BLI_remlink(&snode->treepath, path);
MEM_freeN(path);
-
+
/* update current tree */
path = snode->treepath.last;
snode->edittree = path->nodetree;
-
+
ED_node_set_active_viewer_key(snode);
-
+
/* listener updates the View2D center from edittree */
WM_main_add_notifier(NC_SCENE | ND_NODES, NULL);
}
@@ -185,7 +185,7 @@ void ED_node_tree_path_get(SpaceNode *snode, char *value)
{
bNodeTreePath *path;
int i;
-
+
value[0] = '\0';
for (path = snode->treepath.first, i = 0; path; path = path->next, ++i) {
if (i == 0) {
@@ -203,7 +203,7 @@ void ED_node_tree_path_get_fixedbuf(SpaceNode *snode, char *value, int max_lengt
{
bNodeTreePath *path;
int size, i;
-
+
value[0] = '\0';
for (path = snode->treepath.first, i = 0; path; path = path->next, ++i) {
if (i == 0) {
@@ -230,7 +230,7 @@ void ED_node_set_active_viewer_key(SpaceNode *snode)
void snode_group_offset(SpaceNode *snode, float *x, float *y)
{
bNodeTreePath *path = snode->treepath.last;
-
+
if (path && path->prev) {
float dcenter[2];
sub_v2_v2v2(dcenter, path->view_center, path->prev->view_center);
@@ -270,24 +270,24 @@ ARegion *node_has_buttons_region(ScrArea *sa)
ARegion *node_has_tools_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
+
ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
if (ar) return ar;
-
+
/* add subdiv level; after header */
ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
-
+
/* is error! */
if (ar == NULL) return NULL;
-
+
arnew = MEM_callocN(sizeof(ARegion), "node tools");
-
+
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
arnew->regiontype = RGN_TYPE_TOOLS;
arnew->alignment = RGN_ALIGN_LEFT;
-
+
arnew->flag = RGN_FLAG_HIDDEN;
-
+
return arnew;
}
@@ -403,7 +403,7 @@ static void node_area_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn
/* shift view to node tree center */
if (ar && path)
UI_view2d_center_set(&ar->v2d, path->view_center[0], path->view_center[1]);
-
+
ED_area_tag_refresh(sa);
break;
}
@@ -528,7 +528,7 @@ static void node_area_refresh(const struct bContext *C, ScrArea *sa)
{
/* default now: refresh node is starting preview */
SpaceNode *snode = sa->spacedata.first;
-
+
snode_set_context(C);
if (snode->nodetree) {
@@ -629,14 +629,14 @@ static void node_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
/* convert mouse coordinates to v2d space */
UI_view2d_region_to_view(&ar->v2d, win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin,
&snode->cursor[0], &snode->cursor[1]);
-
+
/* here snode->cursor is used to detect the node edge for sizing */
node_set_cursor(win, snode, snode->cursor);
/* XXX snode->cursor is in placing new nodes space */
snode->cursor[0] /= UI_DPI_FAC;
snode->cursor[1] /= UI_DPI_FAC;
-
+
}
/* Initialize main region, setting handlers. */
@@ -1040,7 +1040,7 @@ void ED_spacetype_node(void)
art->init = node_toolbar_region_init;
art->draw = node_toolbar_region_draw;
BLI_addhead(&st->regiontypes, art);
-
+
node_toolbar_register(art);
BKE_spacetype_register(st);