18cfdb3593ae26b31f96099acb991c7c1dcf93d2
[blender-staging.git] / source / blender / depsgraph / intern / builder / deg_builder_nodes.cc
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2013 Blender Foundation.
19  * All rights reserved.
20  *
21  * Original Author: Joshua Leung
22  * Contributor(s): Based on original depsgraph.c code - Blender Foundation (2005-2013)
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 /** \file blender/depsgraph/intern/builder/deg_build_nodes.cc
28  *  \ingroup depsgraph
29  *
30  * Methods for constructing depsgraph's nodes
31  */
32
33 #include "intern/builder/deg_builder_nodes.h"
34
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <string.h>
38
39 #include "MEM_guardedalloc.h"
40
41 extern "C" {
42 #include "BLI_blenlib.h"
43 #include "BLI_string.h"
44 #include "BLI_utildefines.h"
45
46 #include "DNA_action_types.h"
47 #include "DNA_anim_types.h"
48 #include "DNA_armature_types.h"
49 #include "DNA_camera_types.h"
50 #include "DNA_constraint_types.h"
51 #include "DNA_curve_types.h"
52 #include "DNA_effect_types.h"
53 #include "DNA_gpencil_types.h"
54 #include "DNA_group_types.h"
55 #include "DNA_key_types.h"
56 #include "DNA_lamp_types.h"
57 #include "DNA_material_types.h"
58 #include "DNA_mesh_types.h"
59 #include "DNA_meta_types.h"
60 #include "DNA_node_types.h"
61 #include "DNA_particle_types.h"
62 #include "DNA_object_types.h"
63 #include "DNA_rigidbody_types.h"
64 #include "DNA_scene_types.h"
65 #include "DNA_texture_types.h"
66 #include "DNA_world_types.h"
67
68 #include "BKE_action.h"
69 #include "BKE_armature.h"
70 #include "BKE_animsys.h"
71 #include "BKE_constraint.h"
72 #include "BKE_curve.h"
73 #include "BKE_depsgraph.h"
74 #include "BKE_effect.h"
75 #include "BKE_fcurve.h"
76 #include "BKE_idcode.h"
77 #include "BKE_group.h"
78 #include "BKE_key.h"
79 #include "BKE_lattice.h"
80 #include "BKE_library.h"
81 #include "BKE_main.h"
82 #include "BKE_material.h"
83 #include "BKE_mesh.h"
84 #include "BKE_mball.h"
85 #include "BKE_modifier.h"
86 #include "BKE_node.h"
87 #include "BKE_object.h"
88 #include "BKE_particle.h"
89 #include "BKE_rigidbody.h"
90 #include "BKE_sound.h"
91 #include "BKE_texture.h"
92 #include "BKE_tracking.h"
93 #include "BKE_world.h"
94
95 #include "DEG_depsgraph.h"
96 #include "DEG_depsgraph_build.h"
97
98 #include "RNA_access.h"
99 #include "RNA_types.h"
100 } /* extern "C" */
101
102 #include "intern/builder/deg_builder.h"
103 #include "intern/nodes/deg_node.h"
104 #include "intern/nodes/deg_node_component.h"
105 #include "intern/nodes/deg_node_operation.h"
106 #include "intern/depsgraph_types.h"
107 #include "intern/depsgraph_intern.h"
108
109 namespace DEG {
110
111 /* ************ */
112 /* Node Builder */
113
114 /* **** General purpose functions **** */
115
116 DepsgraphNodeBuilder::DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph) :
117     m_bmain(bmain),
118     m_graph(graph)
119 {
120 }
121
122 DepsgraphNodeBuilder::~DepsgraphNodeBuilder()
123 {
124 }
125
126 RootDepsNode *DepsgraphNodeBuilder::add_root_node()
127 {
128         return m_graph->add_root_node();
129 }
130
131 IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id)
132 {
133         const char *idtype_name = BKE_idcode_to_name(GS(id->name));
134         return m_graph->add_id_node(id, string(id->name + 2) + "[" + idtype_name + "]");
135 }
136
137 TimeSourceDepsNode *DepsgraphNodeBuilder::add_time_source(ID *id)
138 {
139         /* determine which node to attach timesource to */
140         if (id) {
141 #if 0 /* XXX TODO */
142                 /* get ID node */
143                 IDDepsNode id_node = m_graph->find_id_node(id);
144
145                 /* depends on what this is... */
146                 switch (GS(id->name)) {
147                         case ID_SCE: /* Scene - Usually sequencer strip causing time remapping... */
148                         {
149                                 // TODO...
150                         }
151                         break;
152
153                         case ID_GR: /* Group */
154                         {
155                                 // TODO...
156                         }
157                         break;
158
159                         // XXX: time source...
160
161                         default:     /* Unhandled */
162                                 printf("%s(): Unhandled ID - %s \n", __func__, id->name);
163                                 break;
164                 }
165 #endif
166         }
167         else {
168                 /* root-node */
169                 RootDepsNode *root_node = m_graph->root_node;
170                 if (root_node) {
171                         return root_node->add_time_source("Time Source");
172                 }
173         }
174
175         return NULL;
176 }
177
178 ComponentDepsNode *DepsgraphNodeBuilder::add_component_node(
179         ID *id,
180         eDepsNode_Type comp_type,
181         const string &comp_name)
182 {
183         IDDepsNode *id_node = add_id_node(id);
184         ComponentDepsNode *comp_node = id_node->add_component(comp_type, comp_name);
185         comp_node->owner = id_node;
186         return comp_node;
187 }
188
189 OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(
190         ComponentDepsNode *comp_node,
191         eDepsOperation_Type optype,
192         DepsEvalOperationCb op,
193         eDepsOperation_Code opcode,
194         const string &description)
195 {
196         OperationDepsNode *op_node = comp_node->has_operation(opcode, description);
197         if (op_node == NULL) {
198                 op_node = comp_node->add_operation(optype, op, opcode, description);
199                 m_graph->operations.push_back(op_node);
200         }
201         else {
202                 fprintf(stderr, "add_operation: Operation already exists - %s has %s at %p\n",
203                         comp_node->identifier().c_str(),
204                         op_node->identifier().c_str(),
205                         op_node);
206                 BLI_assert(!"Should not happen!");
207         }
208         return op_node;
209 }
210
211 OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(
212         ID *id,
213         eDepsNode_Type comp_type,
214         const string &comp_name,
215         eDepsOperation_Type optype,
216         DepsEvalOperationCb op,
217         eDepsOperation_Code opcode,
218         const string &description)
219 {
220         ComponentDepsNode *comp_node = add_component_node(id, comp_type, comp_name);
221         return add_operation_node(comp_node, optype, op, opcode, description);
222 }
223
224 OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(
225         ID *id,
226         eDepsNode_Type comp_type,
227         eDepsOperation_Type optype,
228         DepsEvalOperationCb op,
229         eDepsOperation_Code opcode,
230         const string& description)
231 {
232         return add_operation_node(id, comp_type, "", optype, op, opcode, description);
233 }
234
235 bool DepsgraphNodeBuilder::has_operation_node(ID *id,
236                                               eDepsNode_Type comp_type,
237                                               const string &comp_name,
238                                               eDepsOperation_Code opcode,
239                                               const string &description)
240 {
241         return find_operation_node(id, comp_type, comp_name, opcode, description) != NULL;
242 }
243
244 OperationDepsNode *DepsgraphNodeBuilder::find_operation_node(
245         ID *id,
246         eDepsNode_Type comp_type,
247         const string &comp_name,
248         eDepsOperation_Code opcode,
249         const string &description)
250 {
251         ComponentDepsNode *comp_node = add_component_node(id, comp_type, comp_name);
252         return comp_node->has_operation(opcode, description);
253 }
254
255 OperationDepsNode *DepsgraphNodeBuilder::find_operation_node(
256         ID *id,
257         eDepsNode_Type comp_type,
258         eDepsOperation_Code opcode,
259         const string& description)
260 {
261         return find_operation_node(id, comp_type, "", opcode, description);
262 }
263
264 /* **** Build functions for entity nodes **** */
265
266 void DepsgraphNodeBuilder::build_scene(Main *bmain, Scene *scene)
267 {
268         /* LIB_TAG_DOIT is used to indicate whether node for given ID was already
269          * created or not. This flag is being set in add_id_node(), so functions
270          * shouldn't bother with setting it, they only might query this flag when
271          * needed.
272          */
273         BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
274         /* XXX nested node trees are not included in tag-clearing above,
275          * so we need to do this manually.
276          */
277         FOREACH_NODETREE(bmain, nodetree, id) {
278                 if (id != (ID *)nodetree)
279                         nodetree->id.tag &= ~LIB_TAG_DOIT;
280         } FOREACH_NODETREE_END
281
282         /* scene ID block */
283         add_id_node(&scene->id);
284
285         /* timesource */
286         add_time_source(NULL);
287
288         /* build subgraph for set, and link this in... */
289         // XXX: depending on how this goes, that scene itself could probably store its
290         //      own little partial depsgraph?
291         if (scene->set) {
292                 build_scene(bmain, scene->set);
293         }
294
295         /* scene objects */
296         for (Base *base = (Base *)scene->base.first; base; base = base->next) {
297                 Object *ob = base->object;
298
299                 /* object that this is a proxy for */
300                 // XXX: the way that proxies work needs to be completely reviewed!
301                 if (ob->proxy) {
302                         ob->proxy->proxy_from = ob;
303                 }
304
305                 /* object itself */
306                 build_object(scene, base, ob);
307
308                 /* Object dupligroup. */
309                 if (ob->dup_group) {
310                         build_group(scene, base, ob->dup_group);
311                 }
312         }
313
314         /* rigidbody */
315         if (scene->rigidbody_world) {
316                 build_rigidbody(scene);
317         }
318
319         /* scene's animation and drivers */
320         if (scene->adt) {
321                 build_animdata(&scene->id);
322         }
323
324         /* world */
325         if (scene->world) {
326                 build_world(scene->world);
327         }
328
329         /* compo nodes */
330         if (scene->nodetree) {
331                 build_compositor(scene);
332         }
333
334         /* sequencer */
335         // XXX...
336
337         /* grease pencil */
338         if (scene->gpd) {
339                 build_gpencil(scene->gpd);
340         }
341 }
342
343 void DepsgraphNodeBuilder::build_group(Scene *scene,
344                                        Base *base,
345                                        Group *group)
346 {
347         ID *group_id = &group->id;
348         if (group_id->tag & LIB_TAG_DOIT) {
349                 return;
350         }
351         group_id->tag |= LIB_TAG_DOIT;
352
353         for (GroupObject *go = (GroupObject *)group->gobject.first;
354              go != NULL;
355              go = go->next)
356         {
357                 build_object(scene, base, go->ob);
358         }
359 }
360
361 SubgraphDepsNode *DepsgraphNodeBuilder::build_subgraph(Group *group)
362 {
363         /* sanity checks */
364         if (!group)
365                 return NULL;
366
367         /* create new subgraph's data */
368         Depsgraph *subgraph = reinterpret_cast<Depsgraph *>(DEG_graph_new());
369
370         DepsgraphNodeBuilder subgraph_builder(m_bmain, subgraph);
371
372         /* add group objects */
373         for (GroupObject *go = (GroupObject *)group->gobject.first;
374              go != NULL;
375              go = go->next)
376         {
377                 /*Object *ob = go->ob;*/
378
379                 /* Each "group object" is effectively a separate instance of the underlying
380                  * object data. When the group is evaluated, the transform results and/or
381                  * some other attributes end up getting overridden by the group
382                  */
383         }
384
385         /* create a node for representing subgraph */
386         SubgraphDepsNode *subgraph_node = m_graph->add_subgraph_node(&group->id);
387         subgraph_node->graph = subgraph;
388
389         /* make a copy of the data this node will need? */
390         // XXX: do we do this now, or later?
391         // TODO: need API function which queries graph's ID's hash, and duplicates those blocks thoroughly with all outside links removed...
392
393         return subgraph_node;
394 }
395
396 void DepsgraphNodeBuilder::build_object(Scene *scene, Base *base, Object *ob)
397 {
398         if (ob->id.tag & LIB_TAG_DOIT) {
399                 IDDepsNode *id_node = m_graph->find_id_node(&ob->id);
400                 id_node->layers = base->lay;
401                 return;
402         }
403
404         IDDepsNode *id_node = add_id_node(&ob->id);
405         id_node->layers = base->lay;
406         ob->customdata_mask = 0;
407
408         /* standard components */
409         build_object_transform(scene, ob);
410
411         /* object data */
412         if (ob->data) {
413                 /* type-specific data... */
414                 switch (ob->type) {
415                         case OB_MESH:     /* Geometry */
416                         case OB_CURVE:
417                         case OB_FONT:
418                         case OB_SURF:
419                         case OB_MBALL:
420                         case OB_LATTICE:
421                         {
422                                 /* TODO(sergey): This way using this object's
423                                  * properties as driver target works fine.
424                                  *
425                                  * Does this depend on other nodes?
426                                  */
427                                 add_operation_node(&ob->id, DEPSNODE_TYPE_PARAMETERS, DEPSOP_TYPE_POST, NULL,
428                                                    DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
429
430                                 build_obdata_geom(scene, ob);
431                                 /* TODO(sergey): Only for until we support granular
432                                  * update of curves.
433                                  */
434                                 if (ob->type == OB_FONT) {
435                                         Curve *curve = (Curve *)ob->data;
436                                         if (curve->textoncurve) {
437                                                 id_node->eval_flags |= DAG_EVAL_NEED_CURVE_PATH;
438                                         }
439                                 }
440                                 break;
441                         }
442
443                         case OB_ARMATURE: /* Pose */
444                                 if (ob->id.lib != NULL && ob->proxy_from != NULL) {
445                                         build_proxy_rig(ob);
446                                 }
447                                 else {
448                                         build_rig(scene, ob);
449                                 }
450                                 break;
451
452                         case OB_LAMP:   /* Lamp */
453                                 build_lamp(ob);
454                                 break;
455
456                         case OB_CAMERA: /* Camera */
457                                 build_camera(ob);
458                                 break;
459
460                         default:
461                         {
462                                 ID *obdata = (ID *)ob->data;
463                                 if ((obdata->tag & LIB_TAG_DOIT) == 0) {
464                                         build_animdata(obdata);
465                                 }
466                                 break;
467                         }
468                 }
469         }
470
471         /* Build animation data,
472          *
473          * Do it now because it's possible object data will affect
474          * on object's level animation, for example in case of rebuilding
475          * pose for proxy.
476          */
477         build_animdata(&ob->id);
478
479         /* particle systems */
480         if (ob->particlesystem.first) {
481                 build_particles(scene, ob);
482         }
483
484         /* grease pencil */
485         if (ob->gpd) {
486                 build_gpencil(ob->gpd);
487         }
488
489         if (ob->proxy != NULL) {
490                 add_operation_node(&ob->id, DEPSNODE_TYPE_PROXY, DEPSOP_TYPE_POST,
491                                    function_bind(BKE_object_eval_proxy_backlink, _1, ob),
492                                    DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
493         }
494 }
495
496 void DepsgraphNodeBuilder::build_object_transform(Scene *scene, Object *ob)
497 {
498         /* local transforms (from transform channels - loc/rot/scale + deltas) */
499         add_operation_node(&ob->id, DEPSNODE_TYPE_TRANSFORM,
500                            DEPSOP_TYPE_INIT, function_bind(BKE_object_eval_local_transform, _1, scene, ob),
501                            DEG_OPCODE_TRANSFORM_LOCAL);
502
503         /* object parent */
504         if (ob->parent) {
505                 add_operation_node(&ob->id, DEPSNODE_TYPE_TRANSFORM,
506                                    DEPSOP_TYPE_EXEC, function_bind(BKE_object_eval_parent, _1, scene, ob),
507                                    DEG_OPCODE_TRANSFORM_PARENT);
508         }
509
510         /* object constraints */
511         if (ob->constraints.first) {
512                 build_object_constraints(scene, ob);
513         }
514
515         /* Temporary uber-update node, which does everything.
516          * It is for the being we're porting old dependencies into the new system.
517          * We'll get rid of this node as soon as all the granular update functions
518          * are filled in.
519          *
520          * TODO(sergey): Get rid of this node.
521          */
522         add_operation_node(&ob->id, DEPSNODE_TYPE_TRANSFORM,
523                            DEPSOP_TYPE_EXEC, function_bind(BKE_object_eval_uber_transform, _1, scene, ob),
524                            DEG_OPCODE_OBJECT_UBEREVAL);
525
526         /* object transform is done */
527         add_operation_node(&ob->id, DEPSNODE_TYPE_TRANSFORM,
528                            DEPSOP_TYPE_POST, function_bind(BKE_object_eval_done, _1, ob),
529                            DEG_OPCODE_TRANSFORM_FINAL);
530 }
531
532 /**
533  * Constraints Graph Notes
534  *
535  * For constraints, we currently only add a operation node to the Transform
536  * or Bone components (depending on whichever type of owner we have).
537  * This represents the entire constraints stack, which is for now just
538  * executed as a single monolithic block. At least initially, this should
539  * be sufficient for ensuring that the porting/refactoring process remains
540  * manageable.
541  *
542  * However, when the time comes for developing "node-based" constraints,
543  * we'll need to split this up into pre/post nodes for "constraint stack
544  * evaluation" + operation nodes for each constraint (i.e. the contents
545  * of the loop body used in the current "solve_constraints()" operation).
546  *
547  * -- Aligorith, August 2013
548  */
549 void DepsgraphNodeBuilder::build_object_constraints(Scene *scene, Object *ob)
550 {
551         /* create node for constraint stack */
552         add_operation_node(&ob->id, DEPSNODE_TYPE_TRANSFORM,
553                            DEPSOP_TYPE_EXEC, function_bind(BKE_object_eval_constraints, _1, scene, ob),
554                            DEG_OPCODE_TRANSFORM_CONSTRAINTS);
555 }
556
557 void DepsgraphNodeBuilder::build_pose_constraints(Object *ob, bPoseChannel *pchan)
558 {
559         /* create node for constraint stack */
560         add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
561                            DEPSOP_TYPE_EXEC, function_bind(BKE_pose_constraints_evaluate, _1, ob, pchan),
562                            DEG_OPCODE_BONE_CONSTRAINTS);
563 }
564
565 /**
566  * Build graph nodes for AnimData block
567  * \param id: ID-Block which hosts the AnimData
568  */
569 void DepsgraphNodeBuilder::build_animdata(ID *id)
570 {
571         AnimData *adt = BKE_animdata_from_id(id);
572
573         if (adt == NULL)
574                 return;
575
576         /* animation */
577         if (adt->action || adt->nla_tracks.first || adt->drivers.first) {
578                 // XXX: Hook up specific update callbacks for special properties which may need it...
579
580                 /* actions and NLA - as a single unit for now, as it gets complicated to schedule otherwise */
581                 if ((adt->action) || (adt->nla_tracks.first)) {
582                         /* create the node */
583                         add_operation_node(id, DEPSNODE_TYPE_ANIMATION,
584                                            DEPSOP_TYPE_EXEC, function_bind(BKE_animsys_eval_animdata, _1, id),
585                                            DEG_OPCODE_ANIMATION, id->name);
586
587                         // TODO: for each channel affected, we might also want to add some support for running RNA update callbacks on them
588                         // (which will be needed for proper handling of drivers later)
589                 }
590
591                 /* drivers */
592                 for (FCurve *fcu = (FCurve *)adt->drivers.first; fcu; fcu = fcu->next) {
593                         /* create driver */
594                         build_driver(id, fcu);
595                 }
596         }
597 }
598
599 /**
600  * Build graph node(s) for Driver
601  * \param id: ID-Block that driver is attached to
602  * \param fcu: Driver-FCurve
603  */
604 OperationDepsNode *DepsgraphNodeBuilder::build_driver(ID *id, FCurve *fcu)
605 {
606         ChannelDriver *driver = fcu->driver;
607
608         /* Create data node for this driver */
609         /* TODO(sergey): Avoid creating same operation multiple times,
610          * in the future we need to avoid lookup of the operation as well
611          * and use some tagging magic instead.
612          */
613         OperationDepsNode *driver_op = find_operation_node(id,
614                                                            DEPSNODE_TYPE_PARAMETERS,
615                                                            DEG_OPCODE_DRIVER,
616                                                            deg_fcurve_id_name(fcu));
617
618         if (driver_op == NULL) {
619                 driver_op = add_operation_node(id, DEPSNODE_TYPE_PARAMETERS,
620                                                DEPSOP_TYPE_EXEC, function_bind(BKE_animsys_eval_driver, _1, id, fcu),
621                                                DEG_OPCODE_DRIVER, deg_fcurve_id_name(fcu));
622         }
623
624         /* tag "scripted expression" drivers as needing Python (due to GIL issues, etc.) */
625         if (driver->type == DRIVER_TYPE_PYTHON) {
626                 driver_op->flag |= DEPSOP_FLAG_USES_PYTHON;
627         }
628
629         /* return driver node created */
630         return driver_op;
631 }
632
633 /* Recursively build graph for world */
634 void DepsgraphNodeBuilder::build_world(World *world)
635 {
636         ID *world_id = &world->id;
637         if (world_id->tag & LIB_TAG_DOIT) {
638                 return;
639         }
640
641         /* world itself */
642         IDDepsNode *world_node = add_id_node(world_id); /* world shading/params? */
643
644         build_animdata(world_id);
645
646         /* TODO: other settings? */
647
648         /* textures */
649         build_texture_stack(world_node, world->mtex);
650
651         /* world's nodetree */
652         if (world->nodetree) {
653                 build_nodetree(world_node, world->nodetree);
654         }
655 }
656
657 /* Rigidbody Simulation - Scene Level */
658 void DepsgraphNodeBuilder::build_rigidbody(Scene *scene)
659 {
660         RigidBodyWorld *rbw = scene->rigidbody_world;
661
662         /**
663          * Rigidbody Simulation Nodes
664          * ==========================
665          *
666          * There are 3 nodes related to Rigidbody Simulation:
667          * 1) "Initialize/Rebuild World" - this is called sparingly, only when the simulation
668          *    needs to be rebuilt (mainly after file reload, or moving back to start frame)
669          * 2) "Do Simulation" - perform a simulation step - interleaved between the evaluation
670          *    steps for clusters of objects (i.e. between those affected and/or not affected by
671          *    the sim for instance)
672          *
673          * 3) "Pull Results" - grab the specific transforms applied for a specific object -
674          *    performed as part of object's transform-stack building
675          */
676
677         /* create nodes ------------------------------------------------------------------------ */
678         /* XXX: is this the right component, or do we want to use another one instead? */
679
680         /* init/rebuild operation */
681         /*OperationDepsNode *init_node =*/ add_operation_node(&scene->id, DEPSNODE_TYPE_TRANSFORM,
682                                                               DEPSOP_TYPE_REBUILD, function_bind(BKE_rigidbody_rebuild_sim, _1, scene),
683                                                               DEG_OPCODE_RIGIDBODY_REBUILD);
684
685         /* do-sim operation */
686         // XXX: what happens if we need to split into several groups?
687         OperationDepsNode *sim_node     = add_operation_node(&scene->id, DEPSNODE_TYPE_TRANSFORM,
688                                                              DEPSOP_TYPE_SIM, function_bind(BKE_rigidbody_eval_simulation, _1, scene),
689                                                              DEG_OPCODE_RIGIDBODY_SIM);
690
691         /* XXX: For now, the sim node is the only one that really matters here. If any other
692          * sims get added later, we may have to remove these hacks...
693          */
694         sim_node->owner->entry_operation = sim_node;
695         sim_node->owner->exit_operation  = sim_node;
696
697
698         /* objects - simulation participants */
699         if (rbw->group) {
700                 for (GroupObject *go = (GroupObject *)rbw->group->gobject.first; go; go = go->next) {
701                         Object *ob = go->ob;
702
703                         if (!ob || (ob->type != OB_MESH))
704                                 continue;
705
706                         /* 2) create operation for flushing results */
707                         /* object's transform component - where the rigidbody operation lives */
708                         add_operation_node(&ob->id, DEPSNODE_TYPE_TRANSFORM,
709                                            DEPSOP_TYPE_EXEC, function_bind(BKE_rigidbody_object_sync_transforms, _1, scene, ob),
710                                            DEG_OPCODE_TRANSFORM_RIGIDBODY);
711                 }
712         }
713 }
714
715 void DepsgraphNodeBuilder::build_particles(Scene *scene, Object *ob)
716 {
717         /**
718          * Particle Systems Nodes
719          * ======================
720          *
721          * There are two types of nodes associated with representing
722          * particle systems:
723          *  1) Component (EVAL_PARTICLES) - This is the particle-system
724          *     evaluation context for an object. It acts as the container
725          *     for all the nodes associated with a particular set of particle
726          *     systems.
727          *  2) Particle System Eval Operation - This operation node acts as a
728          *     blackbox evaluation step for one particle system referenced by
729          *     the particle systems stack. All dependencies link to this operation.
730          */
731
732         /* component for all particle systems */
733         ComponentDepsNode *psys_comp = add_component_node(&ob->id, DEPSNODE_TYPE_EVAL_PARTICLES);
734
735         /* particle systems */
736         for (ParticleSystem *psys = (ParticleSystem *)ob->particlesystem.first; psys; psys = psys->next) {
737                 ParticleSettings *part = psys->part;
738
739                 /* particle settings */
740                 // XXX: what if this is used more than once!
741                 build_animdata(&part->id);
742
743                 /* this particle system */
744                 // TODO: for now, this will just be a placeholder "ubereval" node
745                 add_operation_node(psys_comp,
746                                    DEPSOP_TYPE_EXEC, function_bind(BKE_particle_system_eval, _1, scene, ob, psys),
747                                    DEG_OPCODE_PSYS_EVAL,
748                                    psys->name);
749         }
750
751         /* pointcache */
752         // TODO...
753 }
754
755 /* IK Solver Eval Steps */
756 void DepsgraphNodeBuilder::build_ik_pose(Scene *scene, Object *ob, bPoseChannel *pchan, bConstraint *con)
757 {
758         bKinematicConstraint *data = (bKinematicConstraint *)con->data;
759
760         /* Find the chain's root. */
761         bPoseChannel *rootchan = BKE_armature_ik_solver_find_root(pchan, data);
762
763         if (has_operation_node(&ob->id, DEPSNODE_TYPE_EVAL_POSE, rootchan->name,
764                                DEG_OPCODE_POSE_IK_SOLVER))
765         {
766                 return;
767         }
768
769         /* Operation node for evaluating/running IK Solver. */
770         add_operation_node(&ob->id, DEPSNODE_TYPE_EVAL_POSE, rootchan->name,
771                            DEPSOP_TYPE_SIM, function_bind(BKE_pose_iktree_evaluate, _1, scene, ob, rootchan),
772                            DEG_OPCODE_POSE_IK_SOLVER);
773 }
774
775 /* Spline IK Eval Steps */
776 void DepsgraphNodeBuilder::build_splineik_pose(Scene *scene, Object *ob, bPoseChannel *pchan, bConstraint *con)
777 {
778         bSplineIKConstraint *data = (bSplineIKConstraint *)con->data;
779
780         /* Find the chain's root. */
781         bPoseChannel *rootchan = BKE_armature_splineik_solver_find_root(pchan, data);
782
783         /* Operation node for evaluating/running Spline IK Solver.
784          * Store the "root bone" of this chain in the solver, so it knows where to start.
785          */
786         add_operation_node(&ob->id, DEPSNODE_TYPE_EVAL_POSE, rootchan->name,
787                            DEPSOP_TYPE_SIM, function_bind(BKE_pose_splineik_evaluate, _1, scene, ob, rootchan),
788                            DEG_OPCODE_POSE_SPLINE_IK_SOLVER);
789 }
790
791 /* Pose/Armature Bones Graph */
792 void DepsgraphNodeBuilder::build_rig(Scene *scene, Object *ob)
793 {
794         bArmature *arm = (bArmature *)ob->data;
795
796         /* animation and/or drivers linking posebones to base-armature used to define them
797          * NOTE: AnimData here is really used to control animated deform properties,
798          *       which ideally should be able to be unique across different instances.
799          *       Eventually, we need some type of proxy/isolation mechanism in-between here
800          *       to ensure that we can use same rig multiple times in same scene...
801          */
802         build_animdata(&arm->id);
803
804         /* Rebuild pose if not up to date. */
805         if (ob->pose == NULL || (ob->pose->flag & POSE_RECALC)) {
806                 BKE_pose_rebuild(ob, arm);
807                 /* XXX: Without this animation gets lost in certain circumstances
808                  * after loading file. Need to investigate further since it does
809                  * not happen with simple scenes..
810                  */
811                 if (ob->adt) {
812                         ob->adt->recalc |= ADT_RECALC_ANIM;
813                 }
814         }
815
816         /* speed optimization for animation lookups */
817         if (ob->pose) {
818                 BKE_pose_channels_hash_make(ob->pose);
819                 if (ob->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) {
820                         BKE_pose_update_constraint_flags(ob->pose);
821                 }
822         }
823
824         /* Make sure pose is up-to-date with armature updates. */
825         add_operation_node(&arm->id,
826                            DEPSNODE_TYPE_PARAMETERS,
827                            DEPSOP_TYPE_EXEC,
828                            NULL,
829                            DEG_OPCODE_PLACEHOLDER,
830                            "Armature Eval");
831
832         /**
833          * Pose Rig Graph
834          * ==============
835          *
836          * Pose Component:
837          * - Mainly used for referencing Bone components.
838          * - This is where the evaluation operations for init/exec/cleanup
839          *   (ik) solvers live, and are later hooked up (so that they can be
840          *   interleaved during runtime) with bone-operations they depend on/affect.
841          * - init_pose_eval() and cleanup_pose_eval() are absolute first and last
842          *   steps of pose eval process. ALL bone operations must be performed
843          *   between these two...
844          *
845          * Bone Component:
846          * - Used for representing each bone within the rig
847          * - Acts to encapsulate the evaluation operations (base matrix + parenting,
848          *   and constraint stack) so that they can be easily found.
849          * - Everything else which depends on bone-results hook up to the component only
850          *   so that we can redirect those to point at either the the post-IK/
851          *   post-constraint/post-matrix steps, as needed.
852          */
853
854         /* pose eval context */
855         add_operation_node(&ob->id, DEPSNODE_TYPE_EVAL_POSE,
856                            DEPSOP_TYPE_INIT, function_bind(BKE_pose_eval_init, _1, scene, ob, ob->pose), DEG_OPCODE_POSE_INIT);
857
858         add_operation_node(&ob->id, DEPSNODE_TYPE_EVAL_POSE,
859                            DEPSOP_TYPE_POST, function_bind(BKE_pose_eval_flush, _1, scene, ob, ob->pose), DEG_OPCODE_POSE_DONE);
860
861         /* bones */
862         for (bPoseChannel *pchan = (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan = pchan->next) {
863                 /* node for bone eval */
864                 add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
865                                    DEPSOP_TYPE_INIT, NULL, // XXX: BKE_pose_eval_bone_local
866                                    DEG_OPCODE_BONE_LOCAL);
867
868                 add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
869                                    DEPSOP_TYPE_EXEC, function_bind(BKE_pose_eval_bone, _1, scene, ob, pchan), // XXX: BKE_pose_eval_bone_pose
870                                    DEG_OPCODE_BONE_POSE_PARENT);
871
872                 add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
873                                    DEPSOP_TYPE_OUT, NULL, /* NOTE: dedicated noop for easier relationship construction */
874                                    DEG_OPCODE_BONE_READY);
875
876                 add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
877                                    DEPSOP_TYPE_POST, function_bind(BKE_pose_bone_done, _1, pchan),
878                                    DEG_OPCODE_BONE_DONE);
879
880                 /* constraints */
881                 if (pchan->constraints.first != NULL) {
882                         build_pose_constraints(ob, pchan);
883                 }
884
885                 /**
886                  * IK Solvers...
887                  *
888                  * - These require separate processing steps are pose-level
889                  *   to be executed between chains of bones (i.e. once the
890                  *   base transforms of a bunch of bones is done)
891                  *
892                  * Unsolved Issues:
893                  * - Care is needed to ensure that multi-headed trees work out the same as in ik-tree building
894                  * - Animated chain-lengths are a problem...
895                  */
896                 for (bConstraint *con = (bConstraint *)pchan->constraints.first; con; con = con->next) {
897                         switch (con->type) {
898                                 case CONSTRAINT_TYPE_KINEMATIC:
899                                         build_ik_pose(scene, ob, pchan, con);
900                                         break;
901
902                                 case CONSTRAINT_TYPE_SPLINEIK:
903                                         build_splineik_pose(scene, ob, pchan, con);
904                                         break;
905
906                                 default:
907                                         break;
908                         }
909                 }
910         }
911 }
912
913 void DepsgraphNodeBuilder::build_proxy_rig(Object *ob)
914 {
915         ID *obdata = (ID *)ob->data;
916         build_animdata(obdata);
917
918         BLI_assert(ob->pose != NULL);
919
920         /* speed optimization for animation lookups */
921         BKE_pose_channels_hash_make(ob->pose);
922         if (ob->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) {
923                 BKE_pose_update_constraint_flags(ob->pose);
924         }
925
926         add_operation_node(&ob->id,
927                            DEPSNODE_TYPE_EVAL_POSE,
928                            DEPSOP_TYPE_INIT,
929                            function_bind(BKE_pose_eval_proxy_copy, _1, ob),
930                            DEG_OPCODE_POSE_INIT);
931
932         for (bPoseChannel *pchan = (bPoseChannel *)ob->pose->chanbase.first;
933              pchan != NULL;
934              pchan = pchan->next)
935         {
936                 add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
937                                    DEPSOP_TYPE_INIT, NULL,
938                                    DEG_OPCODE_BONE_LOCAL);
939
940                 add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
941                                    DEPSOP_TYPE_EXEC, NULL,
942                                    DEG_OPCODE_BONE_READY);
943
944                 add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
945                                    DEPSOP_TYPE_POST, NULL,
946                                    DEG_OPCODE_BONE_DONE);
947         }
948
949         add_operation_node(&ob->id,
950                            DEPSNODE_TYPE_EVAL_POSE,
951                            DEPSOP_TYPE_POST,
952                            NULL,
953                            DEG_OPCODE_POSE_DONE);
954 }
955
956 /* Shapekeys */
957 void DepsgraphNodeBuilder::build_shapekeys(Key *key)
958 {
959         build_animdata(&key->id);
960
961         add_operation_node(&key->id, DEPSNODE_TYPE_GEOMETRY, DEPSOP_TYPE_EXEC, NULL,
962                            DEG_OPCODE_PLACEHOLDER, "Shapekey Eval");
963 }
964
965 /* ObData Geometry Evaluation */
966 // XXX: what happens if the datablock is shared!
967 void DepsgraphNodeBuilder::build_obdata_geom(Scene *scene, Object *ob)
968 {
969         ID *obdata = (ID *)ob->data;
970
971         /* Temporary uber-update node, which does everything.
972          * It is for the being we're porting old dependencies into the new system.
973          * We'll get rid of this node as soon as all the granular update functions
974          * are filled in.
975          *
976          * TODO(sergey): Get rid of this node.
977          */
978         add_operation_node(&ob->id, DEPSNODE_TYPE_GEOMETRY,
979                            DEPSOP_TYPE_POST, function_bind(BKE_object_eval_uber_data, _1, scene, ob),
980                            DEG_OPCODE_GEOMETRY_UBEREVAL);
981
982         add_operation_node(&ob->id, DEPSNODE_TYPE_GEOMETRY,
983                            DEPSOP_TYPE_INIT, NULL,
984                            DEG_OPCODE_PLACEHOLDER, "Eval Init");
985
986         // TODO: "Done" operation
987
988         /* ShapeKeys */
989         Key *key = BKE_key_from_object(ob);
990         if (key)
991                 build_shapekeys(key);
992
993         /* Modifiers */
994         if (ob->modifiers.first) {
995                 ModifierData *md;
996
997                 for (md = (ModifierData *)ob->modifiers.first; md; md = md->next) {
998                         add_operation_node(&ob->id, DEPSNODE_TYPE_GEOMETRY,
999                                            DEPSOP_TYPE_EXEC, function_bind(BKE_object_eval_modifier, _1, scene, ob, md),
1000                                            DEG_OPCODE_GEOMETRY_MODIFIER, md->name);
1001                 }
1002         }
1003
1004         /* materials */
1005         if (ob->totcol) {
1006                 int a;
1007
1008                 for (a = 1; a <= ob->totcol; a++) {
1009                         Material *ma = give_current_material(ob, a);
1010
1011                         if (ma) {
1012                                 // XXX?!
1013                                 ComponentDepsNode *geom_node = add_component_node(&ob->id, DEPSNODE_TYPE_GEOMETRY);
1014                                 build_material(geom_node, ma);
1015                         }
1016                 }
1017         }
1018
1019         /* geometry collision */
1020         if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_LATTICE)) {
1021                 // add geometry collider relations
1022         }
1023
1024         if (obdata->tag & LIB_TAG_DOIT) {
1025                 return;
1026         }
1027
1028         build_animdata(obdata);
1029
1030         /* nodes for result of obdata's evaluation, and geometry evaluation on object */
1031         switch (ob->type) {
1032                 case OB_MESH:
1033                 {
1034                         //Mesh *me = (Mesh *)ob->data;
1035
1036                         /* evaluation operations */
1037                         add_operation_node(obdata, DEPSNODE_TYPE_GEOMETRY,
1038                                            DEPSOP_TYPE_INIT, function_bind(BKE_mesh_eval_geometry, _1, (Mesh *)obdata),
1039                                            DEG_OPCODE_PLACEHOLDER, "Geometry Eval");
1040                         break;
1041                 }
1042
1043                 case OB_MBALL:
1044                 {
1045                         Object *mom = BKE_mball_basis_find(scene, ob);
1046
1047                         /* motherball - mom depends on children! */
1048                         if (mom == ob) {
1049                                 /* metaball evaluation operations */
1050                                 /* NOTE: only the motherball gets evaluated! */
1051                                 add_operation_node(obdata, DEPSNODE_TYPE_GEOMETRY,
1052                                                    DEPSOP_TYPE_INIT, function_bind(BKE_mball_eval_geometry, _1, (MetaBall *)obdata),
1053                                                    DEG_OPCODE_PLACEHOLDER, "Geometry Eval");
1054                         }
1055                         break;
1056                 }
1057
1058                 case OB_CURVE:
1059                 case OB_FONT:
1060                 {
1061                         /* curve evaluation operations */
1062                         /* - calculate curve geometry (including path) */
1063                         add_operation_node(obdata, DEPSNODE_TYPE_GEOMETRY,
1064                                            DEPSOP_TYPE_INIT, function_bind(BKE_curve_eval_geometry, _1, (Curve *)obdata),
1065                                            DEG_OPCODE_PLACEHOLDER, "Geometry Eval");
1066
1067                         /* - calculate curve path - this is used by constraints, etc. */
1068                         add_operation_node(obdata, DEPSNODE_TYPE_GEOMETRY,
1069                                            DEPSOP_TYPE_EXEC, function_bind(BKE_curve_eval_path, _1, (Curve *)obdata),
1070                                            DEG_OPCODE_GEOMETRY_PATH, "Path");
1071                         break;
1072                 }
1073
1074                 case OB_SURF: /* Nurbs Surface */
1075                 {
1076                         /* nurbs evaluation operations */
1077                         add_operation_node(obdata, DEPSNODE_TYPE_GEOMETRY,
1078                                            DEPSOP_TYPE_INIT, function_bind(BKE_curve_eval_geometry, _1, (Curve *)obdata),
1079                                            DEG_OPCODE_PLACEHOLDER, "Geometry Eval");
1080                         break;
1081                 }
1082
1083                 case OB_LATTICE: /* Lattice */
1084                 {
1085                         /* lattice evaluation operations */
1086                         add_operation_node(obdata, DEPSNODE_TYPE_GEOMETRY,
1087                                            DEPSOP_TYPE_INIT, function_bind(BKE_lattice_eval_geometry, _1, (Lattice *)obdata),
1088                                            DEG_OPCODE_PLACEHOLDER, "Geometry Eval");
1089                         break;
1090                 }
1091         }
1092
1093         add_operation_node(obdata, DEPSNODE_TYPE_GEOMETRY,
1094                            DEPSOP_TYPE_POST, NULL,
1095                            DEG_OPCODE_PLACEHOLDER, "Eval Done");
1096
1097         /* Parameters for driver sources. */
1098         add_operation_node(obdata, DEPSNODE_TYPE_PARAMETERS, DEPSOP_TYPE_EXEC, NULL,
1099                            DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
1100 }
1101
1102 /* Cameras */
1103 void DepsgraphNodeBuilder::build_camera(Object *ob)
1104 {
1105         /* TODO: Link scene-camera links in somehow... */
1106         Camera *cam = (Camera *)ob->data;
1107         ID *camera_id = &cam->id;
1108         if (camera_id->tag & LIB_TAG_DOIT) {
1109                 return;
1110         }
1111
1112         build_animdata(&cam->id);
1113
1114         add_operation_node(camera_id, DEPSNODE_TYPE_PARAMETERS, DEPSOP_TYPE_EXEC, NULL,
1115                            DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
1116
1117         if (cam->dof_ob != NULL) {
1118                 /* TODO(sergey): For now parametrs are on object level. */
1119                 add_operation_node(&ob->id, DEPSNODE_TYPE_PARAMETERS,
1120                                    DEPSOP_TYPE_EXEC, NULL,
1121                                    DEG_OPCODE_PLACEHOLDER,
1122                                    "Camera DOF");
1123         }
1124 }
1125
1126 /* Lamps */
1127 void DepsgraphNodeBuilder::build_lamp(Object *ob)
1128 {
1129         Lamp *la = (Lamp *)ob->data;
1130         ID *lamp_id = &la->id;
1131         if (lamp_id->tag & LIB_TAG_DOIT) {
1132                 return;
1133         }
1134
1135         build_animdata(&la->id);
1136
1137         /* node for obdata */
1138         ComponentDepsNode *param_node = add_component_node(lamp_id, DEPSNODE_TYPE_PARAMETERS);
1139
1140         /* TODO(sergey): Is it really how we're supposed to work with drivers? */
1141         add_operation_node(lamp_id, DEPSNODE_TYPE_PARAMETERS, DEPSOP_TYPE_EXEC, NULL,
1142                            DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
1143
1144         /* lamp's nodetree */
1145         if (la->nodetree) {
1146                 build_nodetree(param_node, la->nodetree);
1147         }
1148
1149         /* textures */
1150         build_texture_stack(param_node, la->mtex);
1151 }
1152
1153 void DepsgraphNodeBuilder::build_nodetree(DepsNode *owner_node, bNodeTree *ntree)
1154 {
1155         if (!ntree)
1156                 return;
1157
1158         /* nodetree itself */
1159         ID *ntree_id = &ntree->id;
1160
1161         build_animdata(ntree_id);
1162
1163         /* Parameters for drivers. */
1164         add_operation_node(ntree_id, DEPSNODE_TYPE_PARAMETERS, DEPSOP_TYPE_POST, NULL,
1165                            DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
1166
1167         /* nodetree's nodes... */
1168         for (bNode *bnode = (bNode *)ntree->nodes.first; bnode; bnode = bnode->next) {
1169                 if (bnode->id) {
1170                         if (GS(bnode->id->name) == ID_MA) {
1171                                 build_material(owner_node, (Material *)bnode->id);
1172                         }
1173                         else if (bnode->type == ID_TE) {
1174                                 build_texture(owner_node, (Tex *)bnode->id);
1175                         }
1176                         else if (bnode->type == NODE_GROUP) {
1177                                 bNodeTree *group_ntree = (bNodeTree *)bnode->id;
1178                                 if ((group_ntree->id.tag & LIB_TAG_DOIT) == 0) {
1179                                         build_nodetree(owner_node, group_ntree);
1180                                 }
1181                         }
1182                 }
1183         }
1184
1185         // TODO: link from nodetree to owner_component?
1186 }
1187
1188 /* Recursively build graph for material */
1189 void DepsgraphNodeBuilder::build_material(DepsNode *owner_node, Material *ma)
1190 {
1191         ID *ma_id = &ma->id;
1192         if (ma_id->tag & LIB_TAG_DOIT) {
1193                 return;
1194         }
1195
1196         /* material itself */
1197         add_id_node(ma_id);
1198
1199         add_operation_node(ma_id, DEPSNODE_TYPE_SHADING,
1200                            DEPSOP_TYPE_EXEC, NULL,
1201                            DEG_OPCODE_PLACEHOLDER, "Material Update");
1202
1203         /* material animation */
1204         build_animdata(ma_id);
1205
1206         /* textures */
1207         build_texture_stack(owner_node, ma->mtex);
1208
1209         /* material's nodetree */
1210         build_nodetree(owner_node, ma->nodetree);
1211 }
1212
1213 /* Texture-stack attached to some shading datablock */
1214 void DepsgraphNodeBuilder::build_texture_stack(DepsNode *owner_node, MTex **texture_stack)
1215 {
1216         int i;
1217
1218         /* for now assume that all texture-stacks have same number of max items */
1219         for (i = 0; i < MAX_MTEX; i++) {
1220                 MTex *mtex = texture_stack[i];
1221                 if (mtex && mtex->tex)
1222                         build_texture(owner_node, mtex->tex);
1223         }
1224 }
1225
1226 /* Recursively build graph for texture */
1227 void DepsgraphNodeBuilder::build_texture(DepsNode *owner_node, Tex *tex)
1228 {
1229         ID *tex_id = &tex->id;
1230         if (tex_id->tag & LIB_TAG_DOIT) {
1231                 return;
1232         }
1233         tex_id->tag |= LIB_TAG_DOIT;
1234         /* texture itself */
1235         build_animdata(tex_id);
1236         /* texture's nodetree */
1237         build_nodetree(owner_node, tex->nodetree);
1238 }
1239
1240 void DepsgraphNodeBuilder::build_compositor(Scene *scene)
1241 {
1242         /* For now, just a plain wrapper? */
1243         // TODO: create compositing component?
1244         // XXX: component type undefined!
1245         //graph->get_node(&scene->id, NULL, DEPSNODE_TYPE_COMPOSITING, NULL);
1246
1247         /* for now, nodetrees are just parameters; compositing occurs in internals of renderer... */
1248         ComponentDepsNode *owner_node = add_component_node(&scene->id, DEPSNODE_TYPE_PARAMETERS);
1249         build_nodetree(owner_node, scene->nodetree);
1250 }
1251
1252 void DepsgraphNodeBuilder::build_gpencil(bGPdata *gpd)
1253 {
1254         ID *gpd_id = &gpd->id;
1255
1256         /* gpencil itself */
1257         // XXX: what about multiple users of same datablock? This should only get added once
1258         add_id_node(gpd_id);
1259
1260         /* The main reason Grease Pencil is included here is because the animation (and drivers)
1261          * need to be hosted somewhere...
1262          */
1263         build_animdata(gpd_id);
1264 }
1265
1266 }  // namespace DEG