All pastes #241650 Raw Edit

jesterKing

public c v1 · immutable
·published 2006-11-06 13:09 UTC
rendered paste body
/* ntree itself has been read! */static void direct_link_nodetree(FileData *fd, bNodeTree *ntree){	/* note: writing and reading goes in sync, for speed */	bNode *node;	bNodeSocket *sock;	bNodeLink *link;		ntree->init= 0;		/* to set callbacks and force setting types */	ntree->owntype= NULL;	ntree->timecursor= NULL;		link_list(fd, &ntree->nodes);	for(node= ntree->nodes.first; node; node= node->next) {		node->storage= newdataadr(fd, node->storage);		if(node->storage) {						/* could be handlerized at some point */			if(ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))				direct_link_curvemapping(fd, node->storage);			else if(ntree->type==NTREE_COMPOSIT && (node->type==CMP_NODE_TIME || node->type==CMP_NODE_CURVE_VEC || node->type==CMP_NODE_CURVE_RGB))				direct_link_curvemapping(fd, node->storage);					}		link_list(fd, &node->inputs);		link_list(fd, &node->outputs);	}	link_list(fd, &ntree->links);		/* and we connect the rest */	for(node= ntree->nodes.first; node; node= node->next) {		node->preview= NULL;		node->lasty= 0;		for(sock= node->inputs.first; sock; sock= sock->next)			sock->link= newdataadr(fd, sock->link);		for(sock= node->outputs.first; sock; sock= sock->next)			sock->ns.data= NULL;	}	for(link= ntree->links.first; link; link= link->next) {		link->fromnode= newdataadr(fd, link->fromnode);		link->tonode= newdataadr(fd, link->tonode);		link->fromsock= newdataadr(fd, link->fromsock);		link->tosock= newdataadr(fd, link->tosock);	}		/* type verification is in lib-link */}