| 
									
										
										
										
											2011-02-18 13:05:18 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2008-04-16 22:40:48 +00:00
										 |  |  |  * ***** BEGIN GPL LICENSE BLOCK ***** | 
					
						
							| 
									
										
										
										
											2005-04-30 21:27:05 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							| 
									
										
										
										
											2008-04-16 22:40:48 +00:00
										 |  |  |  * of the License, or (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2005-04-30 21:27:05 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							| 
									
										
										
										
											2010-02-12 13:34:04 +00:00
										 |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							| 
									
										
										
										
											2005-04-30 21:27:05 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * The Original Code is Copyright (C) 2004 Blender Foundation. | 
					
						
							|  |  |  |  * All rights reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Contributor(s): none yet. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-04-16 22:40:48 +00:00
										 |  |  |  * ***** END GPL LICENSE BLOCK ***** | 
					
						
							| 
									
										
										
										
											2005-04-30 21:27:05 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-17 18:59:41 +00:00
										 |  |  | #ifndef __BKE_DEPSGRAPH_H__
 | 
					
						
							|  |  |  | #define __BKE_DEPSGRAPH_H__
 | 
					
						
							| 
									
										
										
										
											2005-04-30 21:27:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-18 13:05:18 +00:00
										 |  |  | /** \file BKE_depsgraph.h
 | 
					
						
							|  |  |  |  *  \ingroup bke | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-26 18:15:51 +00:00
										 |  |  | /* Dependency Graph
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The dependency graph tracks relations between datablocks, and is used to | 
					
						
							|  |  |  |  * determine which datablocks need to be update based on dependencies and | 
					
						
							|  |  |  |  * visibility. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * It does not itself execute changes in objects, but rather sorts the objects | 
					
						
							|  |  |  |  * in the appropriate order and sets flags indicating they should be updated. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-05 00:05:14 +00:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | extern "C" { | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 13:13:16 +00:00
										 |  |  | struct ID; | 
					
						
							|  |  |  | struct Main; | 
					
						
							|  |  |  | struct Object; | 
					
						
							|  |  |  | struct Scene; | 
					
						
							| 
									
										
										
										
											2013-12-26 17:24:42 +06:00
										 |  |  | struct ListBase; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Dependency graph evaluation context
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This structure stores all the local dependency graph data, | 
					
						
							|  |  |  |  * which is needed for it's evaluation, | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | typedef struct EvaluationContext { | 
					
						
							|  |  |  | 	bool for_render;  /* Set to true if evaluation shall be performed for render purposes,
 | 
					
						
							|  |  |  | 	                     keep at false if update shall happen for the viewport. */ | 
					
						
							|  |  |  | } EvaluationContext; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-10 01:45:53 +06:00
										 |  |  | /* DagNode->eval_flags */ | 
					
						
							|  |  |  | enum { | 
					
						
							|  |  |  | 	/* Regardless to curve->path animation flag path is to be evaluated anyway,
 | 
					
						
							|  |  |  | 	 * to meet dependencies with such a things as curve modifier and other guys | 
					
						
							|  |  |  | 	 * who're using curve deform, where_on_path and so. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	DAG_EVAL_NEED_CURVE_PATH = 1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-26 17:24:42 +06:00
										 |  |  | /* Global initialization/deinitialization */ | 
					
						
							|  |  |  | void DAG_init(void); | 
					
						
							|  |  |  | void DAG_exit(void); | 
					
						
							| 
									
										
										
										
											2005-04-30 21:27:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-26 18:15:51 +00:00
										 |  |  | /* Build and Update
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * DAG_scene_relations_update will rebuild the dependency graph for a given | 
					
						
							|  |  |  |  * scene if needed, and sort objects in the scene. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * DAG_relations_tag_update will clear all dependency graphs and mark them to | 
					
						
							|  |  |  |  * be rebuilt later. The graph is not rebuilt immediately to avoid slowdowns | 
					
						
							|  |  |  |  * when this function is call multiple times from different operators. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * DAG_scene_relations_rebuild forces an immediaterebuild of the dependency | 
					
						
							|  |  |  |  * graph, this is only needed in rare cases | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DAG_scene_relations_update(struct Main *bmain, struct Scene *sce); | 
					
						
							|  |  |  | void DAG_relations_tag_update(struct Main *bmain); | 
					
						
							|  |  |  | void DAG_scene_relations_rebuild(struct Main *bmain, struct Scene *scene); | 
					
						
							| 
									
										
										
										
											2013-02-26 20:34:37 +00:00
										 |  |  | void DAG_scene_free(struct Scene *sce); | 
					
						
							| 
									
										
										
										
											2013-02-26 18:15:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Update Tagging
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * DAG_scene_update_flags will mark all objects that depend on time (animation, | 
					
						
							|  |  |  |  * physics, ..) to be recalculated, used when changing the current frame. | 
					
						
							|  |  |  |  *  | 
					
						
							|  |  |  |  * DAG_on_visible_update will mark all objects that are visible for the first | 
					
						
							|  |  |  |  * time to be updated, for example on file load or changing layer visibility. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * DAG_id_tag_update will mark a given datablock to be updated. The flag indicates | 
					
						
							|  |  |  |  * a specific subset to be update (only object transform and data for now). | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * DAG_id_type_tag marks a particular datablock type as having changing. This does | 
					
						
							|  |  |  |  * not cause any updates but is used by external render engines to detect if for | 
					
						
							|  |  |  |  * example a datablock was removed. */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-25 15:44:39 +06:00
										 |  |  | void DAG_scene_update_flags(struct Main *bmain, struct Scene *sce, unsigned int lay, const bool do_time, const bool do_invisible_flush); | 
					
						
							| 
									
										
										
										
											2014-02-03 18:55:59 +11:00
										 |  |  | void DAG_on_visible_update(struct Main *bmain, const bool do_time); | 
					
						
							| 
									
										
										
										
											2013-02-26 18:15:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | void DAG_id_tag_update(struct ID *id, short flag); | 
					
						
							|  |  |  | void DAG_id_tag_update_ex(struct Main *bmain, struct ID *id, short flag); | 
					
						
							|  |  |  | void DAG_id_type_tag(struct Main *bmain, short idtype); | 
					
						
							|  |  |  | int  DAG_id_type_tagged(struct Main *bmain, short idtype); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Flushing Tags
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * DAG_scene_flush_update flushes object recalculation flags immediately to other | 
					
						
							|  |  |  |  * dependencies. Do not use outside of depsgraph.c, this will be removed. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * DAG_ids_flush_tagged will flush datablock update flags flags to dependencies, | 
					
						
							|  |  |  |  * use this right before updating to mark all the needed datablocks for update. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * DAG_ids_check_recalc and DAG_ids_clear_recalc are used for external render | 
					
						
							|  |  |  |  * engines to detect changes. */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned int lay, const short do_time); | 
					
						
							|  |  |  | void DAG_ids_flush_tagged(struct Main *bmain); | 
					
						
							| 
									
										
										
										
											2014-04-01 11:34:00 +11:00
										 |  |  | void DAG_ids_check_recalc(struct Main *bmain, struct Scene *scene, bool time); | 
					
						
							| 
									
										
										
										
											2014-01-17 18:51:31 +06:00
										 |  |  | void DAG_ids_clear_recalc(struct Main *bmain); | 
					
						
							| 
									
										
										
										
											2013-02-26 18:15:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Armature: sorts the bones according to dependencies between them */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DAG_pose_sort(struct Object *ob); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Editors: callbacks to notify editors of datablock changes */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DAG_editors_update_cb(void (*id_func)(struct Main *bmain, struct ID *id), | 
					
						
							|  |  |  |                            void (*scene_func)(struct Main *bmain, struct Scene *scene, int updated)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-26 17:24:42 +06:00
										 |  |  | /* ** Threaded update ** */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Initialize the DAG for threaded update. */ | 
					
						
							|  |  |  | void DAG_threaded_update_begin(struct Scene *scene, | 
					
						
							|  |  |  |                                void (*func)(void *node, void *user_data), | 
					
						
							|  |  |  |                                void *user_data); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DAG_threaded_update_handle_node_updated(void *node_v, | 
					
						
							|  |  |  |                                              void (*func)(void *node, void *user_data), | 
					
						
							|  |  |  |                                              void *user_data); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-26 18:15:51 +00:00
										 |  |  | /* Debugging: print dependency graph for scene or armature object to console */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DAG_print_dependencies(struct Main *bmain, struct Scene *scene, struct Object *ob); | 
					
						
							| 
									
										
										
										
											2011-11-04 13:17:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-10 01:23:49 +06:00
										 |  |  | /* ************************ DAG querying ********************* */ | 
					
						
							| 
									
										
										
										
											2013-12-26 17:24:42 +06:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct Object *DAG_get_node_object(void *node_v); | 
					
						
							| 
									
										
										
										
											2014-04-04 12:42:35 +06:00
										 |  |  | const char *DAG_get_node_name(struct Scene *scene, void *node_v); | 
					
						
							| 
									
										
										
										
											2014-01-10 01:45:53 +06:00
										 |  |  | short DAG_get_eval_flags_for_object(struct Scene *scene, void *object); | 
					
						
							| 
									
										
										
										
											2014-01-10 15:39:06 +06:00
										 |  |  | bool DAG_is_acyclic(struct Scene *scene); | 
					
						
							| 
									
										
										
										
											2013-12-26 17:24:42 +06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-05 00:05:14 +00:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
											  
											
												Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
   enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
   to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
  causing unnecessary slowdown on reading.
Might have missed stuff... :)
											
										 
											2005-12-11 13:23:30 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2005-04-30 23:29:10 +00:00
										 |  |  | #endif
 |