|
Blender
V2.59
|
00001 /* 00002 * $Id: depsgraph_private.h 37503 2011-06-15 09:45:26Z blendix $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2004 Blender Foundation. 00021 * All rights reserved. 00022 * 00023 * Contributor(s): none yet. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00032 #ifndef DEPSGRAPH_PRIVATE 00033 #define DEPSGRAPH_PRIVATE 00034 00035 #include "BKE_depsgraph.h" 00036 #include "DNA_constraint_types.h" 00037 #include "BKE_constraint.h" 00038 00039 00040 #define DEPSX 5.0f 00041 #define DEPSY 1.8f 00042 00043 #define DAGQUEUEALLOC 50 00044 00045 enum { 00046 DAG_WHITE = 0, 00047 DAG_GRAY = 1, 00048 DAG_BLACK = 2 00049 }; 00050 00051 00052 00053 typedef struct DagAdjList 00054 { 00055 struct DagNode *node; 00056 short type; 00057 int count; // number of identical arcs 00058 unsigned int lay; // for flushing redraw/rebuild events 00059 const char *name; 00060 struct DagAdjList *next; 00061 } DagAdjList; 00062 00063 00064 typedef struct DagNode 00065 { 00066 int color; 00067 short type; 00068 float x, y, k; 00069 void * ob; 00070 void * first_ancestor; 00071 int ancestor_count; 00072 unsigned int lay; // accumulated layers of its relations + itself 00073 unsigned int scelay; // layers due to being in scene 00074 unsigned int customdata_mask; // customdata mask 00075 int lasttime; // if lasttime != DagForest->time, this node was not evaluated yet for flushing 00076 int BFS_dist; // BFS distance 00077 int DFS_dist; // DFS distance 00078 int DFS_dvtm; // DFS discovery time 00079 int DFS_fntm; // DFS Finishing time 00080 struct DagAdjList *child; 00081 struct DagAdjList *parent; 00082 struct DagNode *next; 00083 } DagNode; 00084 00085 typedef struct DagNodeQueueElem { 00086 struct DagNode *node; 00087 struct DagNodeQueueElem *next; 00088 } DagNodeQueueElem; 00089 00090 typedef struct DagNodeQueue 00091 { 00092 DagNodeQueueElem *first; 00093 DagNodeQueueElem *last; 00094 int count; 00095 int maxlevel; 00096 struct DagNodeQueue *freenodes; 00097 } DagNodeQueue; 00098 00099 // forest as we may have more than one DAG unnconected 00100 typedef struct DagForest 00101 { 00102 ListBase DagNode; 00103 struct GHash *nodeHash; 00104 int numNodes; 00105 int is_acyclic; 00106 int time; // for flushing/tagging, compare with node->lasttime 00107 } DagForest; 00108 00109 00110 // queue operations 00111 DagNodeQueue * queue_create (int slots); 00112 void queue_raz(DagNodeQueue *queue); 00113 void push_queue(DagNodeQueue *queue, DagNode *node); 00114 void push_stack(DagNodeQueue *queue, DagNode *node); 00115 DagNode * pop_queue(DagNodeQueue *queue); 00116 DagNode * get_top_node_queue(DagNodeQueue *queue); 00117 00118 // Dag management 00119 DagForest *getMainDag(void); 00120 void setMainDag(DagForest *dag); 00121 DagForest * dag_init(void); 00122 DagNode * dag_find_node (DagForest *forest,void * fob); 00123 DagNode * dag_add_node (DagForest *forest,void * fob); 00124 DagNode * dag_get_node (DagForest *forest,void * fob); 00125 DagNode * dag_get_sub_node (DagForest *forest,void * fob); 00126 void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, const char *name); 00127 00128 void graph_bfs(void); 00129 00130 DagNodeQueue * graph_dfs(void); 00131 00132 void set_node_xy(DagNode *node, float x, float y); 00133 void graph_print_queue(DagNodeQueue *nqueue); 00134 void graph_print_queue_dist(DagNodeQueue *nqueue); 00135 void graph_print_adj_list(void); 00136 00137 int build_deps(short mask); 00138 00139 #endif