[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31069] branches/particles-2010/source/ blender: - Fixed a bug mixing up the socket type preference value with the type itself
Lukas Toenne
lukas.toenne at googlemail.com
Thu Aug 5 17:25:24 CEST 2010
Revision: 31069
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31069
Author: lukastoenne
Date: 2010-08-05 17:25:24 +0200 (Thu, 05 Aug 2010)
Log Message:
-----------
- Fixed a bug mixing up the socket type preference value with the type itself
- Removed unnecessary update calls during the modal linking operator
- Basic socket context initialization
Modified Paths:
--------------
branches/particles-2010/source/blender/blenkernel/BKE_node.h
branches/particles-2010/source/blender/blenkernel/intern/node.c
branches/particles-2010/source/blender/editors/space_node/node_edit.c
branches/particles-2010/source/blender/makesdna/DNA_node_types.h
branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_vertex_data.c
branches/particles-2010/source/blender/nodes/intern/node_tree_simulation.c
Modified: branches/particles-2010/source/blender/blenkernel/BKE_node.h
===================================================================
--- branches/particles-2010/source/blender/blenkernel/BKE_node.h 2010-08-05 14:04:56 UTC (rev 31068)
+++ branches/particles-2010/source/blender/blenkernel/BKE_node.h 2010-08-05 15:25:24 UTC (rev 31069)
@@ -71,7 +71,7 @@
short flag;
- char pad[2];
+ int contexttype;
/* after this line is used internal only */
struct ListBase verified; /* used during verify_types */
Modified: branches/particles-2010/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/particles-2010/source/blender/blenkernel/intern/node.c 2010-08-05 14:04:56 UTC (rev 31068)
+++ branches/particles-2010/source/blender/blenkernel/intern/node.c 2010-08-05 15:25:24 UTC (rev 31069)
@@ -157,6 +157,8 @@
if(stype->limit==0) sock->limit= 0xFFF;
else sock->limit= stype->limit;
sock->type= stype->type;
+ sock->context.type = stype->contexttype;
+ sock->context.source = NULL;
sock->to_index= stype->own_index;
sock->tonode= stype->internnode;
@@ -186,6 +188,8 @@
if(stype->limit==0) sock->limit= 0xFFF;
else sock->limit= stype->limit;
sock->type= stype->type;
+ sock->context.type = stype->contexttype;
+ sock->context.source = NULL;
sock->to_index= stype->own_index;
sock->tonode= stype->internnode;
@@ -1706,42 +1710,8 @@
}
}
-static void printf_socket_islands(bNodeSocketIsland *island, int totsock)
+static void merge_socket_islands(bNodeSocketIsland *islands, int a, int b)
{
- int i, number;
- bNodeSocketIsland *cur;
-
- number = -1;
- for (i = 0; i < totsock; ++i, ++island) {
- if (island->sock->island > number) {
- number = island->sock->island;
- printf ("Island %d = { ", number);
- for (cur = island; cur; cur = cur->next) {
- printf("%s", cur->sock->name);
- if (cur->next)
- printf(", ");
- }
- printf(" }\n");
- }
- }
-}
-
-static void printf_links(bNodeTree *ntree)
-{
- bNodeLink *link;
- for (link=ntree->links.first; link; link = link->next) {
- printf("\t");
- if (link->fromnode)
- printf("'%s:%s'", link->fromnode->name, link->fromsock->name);
- printf(" -> ");
- if (link->tonode)
- printf("'%s:%s'", link->tonode->name, link->tosock->name);
- printf("\n");
- }
-}
-
-static void merge_socket_type_islands(bNodeSocketIsland *islands, int a, int b)
-{
bNodeSocketIsland *i;
if (a == b)
@@ -1766,14 +1736,14 @@
}
}
-static void node_merge_islands(bNode *node, bNodeSocketIsland *islands)
+static void node_merge_type_islands(bNode *node, bNodeSocketIsland *islands)
{
bNodeSocket *sock;
int any_island = -1;
for (sock=node->inputs.first; sock; sock = sock->next) {
if (sock->stype->type == SOCK_ANY) {
if (any_island > 0)
- merge_socket_type_islands(islands, any_island, sock->island);
+ merge_socket_islands(islands, any_island, sock->island);
else
any_island = sock->island;
}
@@ -1781,7 +1751,7 @@
for (sock=node->outputs.first; sock; sock = sock->next) {
if (sock->stype->type == SOCK_ANY) {
if (any_island > 0)
- merge_socket_type_islands(islands, any_island, sock->island);
+ merge_socket_islands(islands, any_island, sock->island);
else
any_island = sock->island;
}
@@ -1822,13 +1792,13 @@
/* merge islands inside nodes */
for (node=ntree->nodes.first; node; node = node->next) {
- node_merge_islands(node, islands);
+ node_merge_type_islands(node, islands);
}
/* merge islands by links */
for (link=ntree->links.first; link; link = link->next) {
if (link->fromsock && link->tosock)
if (link->fromsock->stype->type == SOCK_ANY || link->tosock->stype->type == SOCK_ANY)
- merge_socket_type_islands(islands, link->fromsock->island, link->tosock->island);
+ merge_socket_islands(islands, link->fromsock->island, link->tosock->island);
}
*r_islands = islands;
@@ -1850,9 +1820,6 @@
ntreeFindSocketTypeIslands(ntree, &island_map, &totsock);
- printf("Socket Islands:\n");
- printf_socket_islands(island_map, totsock);
-
number = -1;
island = island_map;
for (i = 0; i < totsock; ++i, ++island) {
Modified: branches/particles-2010/source/blender/editors/space_node/node_edit.c
===================================================================
--- branches/particles-2010/source/blender/editors/space_node/node_edit.c 2010-08-05 14:04:56 UTC (rev 31068)
+++ branches/particles-2010/source/blender/editors/space_node/node_edit.c 2010-08-05 15:25:24 UTC (rev 31069)
@@ -1621,13 +1621,16 @@
if(tnode!=node && link->tonode!=tnode && link->tosock!= tsock) {
link->tonode= tnode;
link->tosock= tsock;
-// ntreeSolveOrder(snode->edittree); /* for interactive red line warning */
+ ntreeUpdate(snode->edittree); /* for interactive red line warning */
}
}
}
else {
- link->tonode= NULL;
- link->tosock= NULL;
+ if (link->tonode || link->tosock) {
+ link->tonode= NULL;
+ link->tosock= NULL;
+ ntreeUpdate(snode->edittree);
+ }
}
}
else {
@@ -1637,17 +1640,19 @@
if(tnode!=node && link->fromnode!=tnode && link->fromsock!= tsock) {
link->fromnode= tnode;
link->fromsock= tsock;
-// ntreeSolveOrder(snode->edittree); /* for interactive red line warning */
+ ntreeUpdate(snode->edittree); /* for interactive red line warning */
}
}
}
}
else {
- link->fromnode= NULL;
- link->fromsock= NULL;
+ if (link->tonode || link->tosock) {
+ link->fromnode= NULL;
+ link->fromsock= NULL;
+ ntreeUpdate(snode->edittree);
+ }
}
}
- ntreeUpdate(snode->edittree);
/* hilight target sockets only */
node_socket_hilights(snode, in_out==SOCK_OUT?SOCK_IN:SOCK_OUT);
ED_region_tag_redraw(ar);
Modified: branches/particles-2010/source/blender/makesdna/DNA_node_types.h
===================================================================
--- branches/particles-2010/source/blender/makesdna/DNA_node_types.h 2010-08-05 14:04:56 UTC (rev 31068)
+++ branches/particles-2010/source/blender/makesdna/DNA_node_types.h 2010-08-05 15:25:24 UTC (rev 31069)
@@ -67,8 +67,8 @@
} bNodeDataContext;
typedef enum eNodeDataContextType {
- NDC_SINGLETON = 0,
- NDC_ANY,
+ NDC_UNDEFINED = 0,
+ NDC_SINGLETON,
NDC_NODE,
NDC_PARTICLE,
NDC_VERTEX,
@@ -101,6 +101,7 @@
short type, flag; /* type is copy from socket type struct */
short limit, stack_index; /* limit for dependency sort, stack_index for exec */
+ bNodeDataContext context; /* data context (simulation nodes) */
short intern; /* intern = tag for group nodes */
short stack_index_ext; /* for groups, to find the caller stack index */
Modified: branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_vertex_data.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_vertex_data.c 2010-08-05 14:04:56 UTC (rev 31068)
+++ branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_vertex_data.c 2010-08-05 15:25:24 UTC (rev 31069)
@@ -41,7 +41,7 @@
};
static bNodeSocketType outputs[]= {
- { SOCK_VECTOR, 0, "Position", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
+ { SOCK_VECTOR, 0, "Position", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NDC_VERTEX },
{ -1, 0, "" }
};
Modified: branches/particles-2010/source/blender/nodes/intern/node_tree_simulation.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/node_tree_simulation.c 2010-08-05 14:04:56 UTC (rev 31068)
+++ branches/particles-2010/source/blender/nodes/intern/node_tree_simulation.c 2010-08-05 15:25:24 UTC (rev 31069)
@@ -150,8 +150,7 @@
for (sock=node->outputs.first; sock; sock = sock->next) {
stack_out[index_out].batches.first = stack_out[index_out].batches.last = NULL;
stack_out[index_out].datatype = sock->type;
-// stack_out[index_out].contexttype = sock->context.type;
- stack_out[index_out].contexttype = NDC_SINGLETON;
+ stack_out[index_out].contexttype = sock->context.type;
sock->stack_index = index_out; /* needed for finding the input socket fromnodes later on (only used inside this function!) */
/* prepare operator sockets */
@@ -669,9 +668,9 @@
4 /* SOCK_FLOAT */
};
if (prefmap[a] < prefmap[b])
- return prefmap[b];
+ return b;
else
- return prefmap[a];
+ return a;
}
bNodeTreeTypeInfo ntreeType_Simulation = {
More information about the Bf-blender-cvs
mailing list