2011-10-10 09:38:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/*
  
						 
					
						
							
								
									
										
										
										
											2008-01-07 19:13:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  * * * * *  BEGIN  GPL  LICENSE  BLOCK  * * * * * 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +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-01-07 19:13:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  of  the  License ,  or  ( at  your  option )  any  later  version . 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +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 . 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  The  Original  Code  is  Copyright  ( C )  2001 - 2002  by  NaN  Holding  BV . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  All  rights  reserved . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  The  Original  Code  is :  all  of  this  file . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Contributor ( s ) :  none  yet . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-07 19:13:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  * * * * *  END  GPL  LICENSE  BLOCK  * * * * * 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 20:40:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/** \file blender/blenkernel/intern/object.c
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *   \ ingroup  bke 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <string.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <math.h> 
  
						 
					
						
							
								
									
										
										
										
											2013-11-01 08:31:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <stdio.h> 
  
						 
					
						
							
								
									
										
										
										
											2002-11-25 12:02:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "MEM_guardedalloc.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												2.5: Blender "Animato" - New Animation System 
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. 
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. 
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) 
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
											 
										 
										
											2009-01-17 03:12:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_anim_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "DNA_armature_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_camera_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_constraint_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_group_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_key_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2014-09-01 20:09:31 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_lamp_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "DNA_lattice_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_material_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-04-01 11:14:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_meta_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2012-02-19 22:17:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_mesh_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2004-03-20 22:55:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_meshdata_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_movieclip_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "DNA_scene_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_screen_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-03-09 13:52:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_sequence_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-11-15 13:45:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_smoke_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "DNA_space_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_view3d_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_world_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2012-04-30 08:24:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_object_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2012-12-16 08:43:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_property_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2013-02-16 16:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_rigidbody_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BLI_blenlib.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-03-22 11:59:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_math.h" 
  
						 
					
						
							
								
									
										
										
										
											2014-01-09 16:19:51 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_threads.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-01-07 18:36:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_utildefines.h" 
  
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_linklist.h" 
  
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_kdtree.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-24 12:13:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLF_translation.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-12-15 15:59:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_pbvh.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_main.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_global.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-02-01 21:24:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_idprop.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												2.5: Blender "Animato" - New Animation System 
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. 
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. 
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) 
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
											 
										 
										
											2009-01-17 03:12:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_armature.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_action.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_bullet.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_deform.h" 
  
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_depsgraph.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												2.5: Blender "Animato" - New Animation System 
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. 
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. 
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) 
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
											 
										 
										
											2009-01-17 03:12:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_DerivedMesh.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_animsys.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_anim.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_constraint.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_curve.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_displist.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons) 
  instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group 
  setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
	- "Point" is most like the old effectors and uses the 
	  effector location as the effector point.
	- "Plane" uses the closest point on effectors local xy-plane 
	  as the effector point.
	- "Surface" uses the closest point on an effector object's 
	  surface as the effector point.
	- "Every Point" uses every point in a mesh effector object 
	  as an effector point.
	- The falloff is calculated from this point, so for example 
	  with "surface" shape and "use only negative z axis" it's 
	  possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer 
  just spherical.
* New effector parameter "flow", which makes the effector act as 
  surrounding air velocity, so the resulting force is 
  proportional to the velocity difference of the point and "air 
  velocity". For example a wind field with flow=1.0 results in 
  proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random 
  flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force 
  (note. the z-axis is the surface normal in the case of 
  effector shape "surface")
* New "force field" submenu in add menu, which adds an empty 
  with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector 
  system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for 
  particles, softbody & cloth, since their final effect depends on many external 
  factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through 
  DAG_id_flush_update(..).
  
Known issues
* Curve guides don't yet have all ui buttons in place, but they 
  should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50 
  frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to 
  free pidlists after use :).
											 
										 
										
											2009-09-30 22:10:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_effect.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-08-03 12:11:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_fcurve.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_group.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_key.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-11-05 13:11:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_lamp.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_lattice.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_library.h" 
  
						 
					
						
							
								
									
										
										
										
											2013-03-23 03:00:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_linestyle.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_mesh.h" 
  
						 
					
						
							
								
									
										
										
										
											2013-04-13 20:31:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_editmesh.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_mball.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												 - shuffled editmesh derived function name/function
 - added ModifierTypeInfo.freeData function
 - added modifier_{new,free] utility function
 - added ccgSubSurf_getUseAgeCounts to query info
 - removed subsurf modifier faking (ME_SUBSURF flag is no
   longer valid). subsurf modifier gets converted on file load
   although there is obscure linked mesh situation where this
   can go wrong, will fix shortly. this also means that some
   places in the code that test/copy subsurf settings are broken
   for the time being.
 - shuffled modifier calculation to be simpler. note that
   all modifiers are currently disabled in editmode (including
   subsurf). don't worry, will return shortly.
 - bug fix, build modifier didn't randomize meshes with only verts
 - cleaned up subsurf_ccg and adapted for future editmode modifier
   work
 - added editmesh.derived{Cage,Final}, not used yet
 - added SubsurfModifierData.{mCache,emCache}, will be used to cache
   subsurf instead of caching in derivedmesh itself
 - removed old subsurf buttons
 - added do_modifiers_buttons to handle modifier events
 - removed count_object counting of modifier (subsurfed) objects...
   this would be nice to add back at some point but requires care.
   probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
											 
										 
										
											2005-07-21 20:30:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_modifier.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_object.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-08-28 21:47:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_paint.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_particle.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
											 
										 
										
											2008-04-10 11:39:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_pointcache.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_property.h" 
  
						 
					
						
							
								
									
										
										
										
											2013-01-23 05:56:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_rigidbody.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_sca.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_scene.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-03-09 13:52:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_sequencer.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-08-04 07:12:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_speaker.h" 
  
						 
					
						
							
								
									
										
										
										
											2004-10-01 14:04:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_softbody.h" 
  
						 
					
						
							
								
									
										
										
										
											2014-10-31 20:06:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_subsurf.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-04-26 07:17:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_material.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-11-05 13:00:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_camera.h" 
  
						 
					
						
							
								
									
										
										
										
											2014-01-13 21:57:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_image.h" 
  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-27 00:17:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# ifdef WITH_MOD_FLUID 
  
						 
					
						
							
								
									
										
										
										
											2006-01-28 20:17:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "LBM_fluidsim.h" 
  
						 
					
						
							
								
									
										
										
										
											2012-03-27 00:17:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2006-01-28 20:17:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-31 04:11:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# ifdef WITH_PYTHON 
  
						 
					
						
							
								
									
										
										
										
											2003-11-23 14:28:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BPY_extern.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-10-28 18:47:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2003-11-23 14:28:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-31 20:06:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "CCGSubSurf.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
  menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
  gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
  storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
  An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
  needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
  be at the origin.
											 
										 
										
											2008-09-04 20:51:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "GPU_material.h" 
  
						 
					
						
							
								
									
										
										
										
											2003-11-23 14:28:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 16:19:51 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Vertex parent modifies original BMesh which is not safe for threading.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Ideally  such  a  modification  should  be  handled  as  a  separate  DAG  update 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  callback  for  mesh  datablock ,  but  for  until  it  is  actually  supported  use 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  simpler  solution  with  a  mutex  lock . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *                                                -  sergey  - 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define VPARENT_THREADING_HACK 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# ifdef VPARENT_THREADING_HACK 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  ThreadMutex  vparent_lock  =  BLI_MUTEX_INITIALIZER ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_workob_clear ( Object  * workob )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2008-12-24 11:08:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									memset ( workob ,  0 ,  sizeof ( Object ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									workob - > size [ 0 ]  =  workob - > size [ 1 ]  =  workob - > size [ 2 ]  =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									workob - > dscale [ 0 ]  =  workob - > dscale [ 1 ]  =  workob - > dscale [ 2 ]  =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									workob - > rotmode  =  ROT_MODE_EUL ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_update_base_layer ( struct  Scene  * scene ,  Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Base  * base  =  scene - > base . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									while  ( base )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( base - > object  = =  ob )  base - > lay  =  ob - > lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										base  =  base - > next ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_free_particlesystems ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2013-08-26 23:37:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ParticleSystem  * psys ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									while  ( ( psys  =  BLI_pophead ( & ob - > particlesystem ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 15:47:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										psys_free ( ob ,  psys ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_free_softbody ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > soft )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										sbFree ( ob - > soft ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > soft  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_free_bulletsoftbody ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2008-09-27 21:52:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > bsoft )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-29 23:46:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bsbFree ( ob - > bsoft ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > bsoft  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-27 21:52:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_free_curve_cache ( Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > curve_cache )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_displist_free ( & ob - > curve_cache - > disp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-18 17:35:51 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_curve_bevelList_free ( & ob - > curve_cache - > bev ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > curve_cache - > path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											free_path ( ob - > curve_cache - > path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 14:44:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_nurbList_free ( & ob - > curve_cache - > deformed_nurbs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										MEM_freeN ( ob - > curve_cache ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > curve_cache  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_free_modifiers ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2005-07-19 20:14:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2013-08-26 23:37:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ModifierData  * md ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									while  ( ( md  =  BLI_pophead ( & ob - > modifiers ) ) )  { 
							 
						 
					
						
							
								
									
										
											 
										
											
												 - shuffled editmesh derived function name/function
 - added ModifierTypeInfo.freeData function
 - added modifier_{new,free] utility function
 - added ccgSubSurf_getUseAgeCounts to query info
 - removed subsurf modifier faking (ME_SUBSURF flag is no
   longer valid). subsurf modifier gets converted on file load
   although there is obscure linked mesh situation where this
   can go wrong, will fix shortly. this also means that some
   places in the code that test/copy subsurf settings are broken
   for the time being.
 - shuffled modifier calculation to be simpler. note that
   all modifiers are currently disabled in editmode (including
   subsurf). don't worry, will return shortly.
 - bug fix, build modifier didn't randomize meshes with only verts
 - cleaned up subsurf_ccg and adapted for future editmode modifier
   work
 - added editmesh.derived{Cage,Final}, not used yet
 - added SubsurfModifierData.{mCache,emCache}, will be used to cache
   subsurf instead of caching in derivedmesh itself
 - removed old subsurf buttons
 - added do_modifiers_buttons to handle modifier events
 - removed count_object counting of modifier (subsurfed) objects...
   this would be nice to add back at some point but requires care.
   probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
											 
										 
										
											2005-07-21 20:30:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										modifier_free ( md ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 20:14:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* particle modifiers were freed, so free the particlesystems as well */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_free_particlesystems ( ob ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* same for softbody */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_free_softbody ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-19 20:14:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-15 20:15:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_modifier_hook_reset ( Object  * ob ,  HookModifierData  * hmd )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* reset functionality */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( hmd - > object )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bPoseChannel  * pchan  =  BKE_pose_channel_find_name ( hmd - > object - > pose ,  hmd - > subtarget ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( hmd - > subtarget [ 0 ]  & &  pchan )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  imat [ 4 ] [ 4 ] ,  mat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* calculate the world-space matrix for the pose-channel target first, then carry on as usual */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											mul_m4_m4m4 ( mat ,  hmd - > object - > obmat ,  pchan - > pose_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											invert_m4_m4 ( imat ,  mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											mul_m4_m4m4 ( hmd - > parentinv ,  imat ,  ob - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											invert_m4_m4 ( hmd - > object - > imat ,  hmd - > object - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											mul_m4_m4m4 ( hmd - > parentinv ,  hmd - > object - > imat ,  ob - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_object_support_modifier_type_check ( Object  * ob ,  int  modifier_type )  
						 
					
						
							
								
									
										
										
										
											2012-03-12 14:35:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ModifierTypeInfo  * mti ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									mti  =  modifierType_getInfo ( modifier_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! ( ( mti - > flags  &  eModifierTypeFlag_AcceptsCVs )  | | 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									      ( ob - > type  = =  OB_MESH  & &  ( mti - > flags  &  eModifierTypeFlag_AcceptsMesh ) ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-12 14:35:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-12 14:35:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-12 14:35:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-13 14:53:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_link_modifiers ( struct  Object  * ob_dst ,  struct  Object  * ob_src )  
						 
					
						
							
								
									
										
										
										
											2010-01-04 16:26:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ModifierData  * md ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-13 14:53:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_free_modifiers ( ob_dst ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 16:26:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-07-20 01:30:29 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! ELEM ( ob_dst - > type ,  OB_MESH ,  OB_CURVE ,  OB_SURF ,  OB_FONT ,  OB_LATTICE ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-12 14:35:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* only objects listed above can have modifiers and linking them to objects
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 *  which  doesn ' t  have  modifiers  stack  is  quite  silly  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-13 14:53:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( md  =  ob_src - > modifiers . first ;  md ;  md  =  md - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 16:26:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ModifierData  * nmd  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-07-20 01:30:29 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ELEM ( md - > type , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										         eModifierType_Hook , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										         eModifierType_Softbody , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										         eModifierType_ParticleInstance , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										         eModifierType_Collision ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-25 22:37:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 16:26:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-13 14:53:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! BKE_object_support_modifier_type_check ( ob_dst ,  md - > type ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-12 14:35:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-01 08:31:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( md - > type  = =  eModifierType_Skin )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* ensure skin-node customdata exists */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-16 21:55:30 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_mesh_ensure_skin_customdata ( ob_dst - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-01 08:31:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-12 14:35:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 16:26:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										nmd  =  modifier_new ( md - > type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-13 14:53:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_strncpy ( nmd - > name ,  md - > name ,  sizeof ( nmd - > name ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 16:26:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										modifier_copyData ( md ,  nmd ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-13 14:53:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_addtail ( & ob_dst - > modifiers ,  nmd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										modifier_unique_name ( & ob_dst - > modifiers ,  nmd ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 16:26:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-13 14:53:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_copy_particlesystems ( ob_dst ,  ob_src ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BKE_object_copy_softbody ( ob_dst ,  ob_src ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 16:26:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-07-06 23:56:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* TODO: smoke?, cloth? */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 16:26:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-05-18 10:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* free data derived from mesh, called when mesh changes or is freed */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  BKE_object_free_derived_caches ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2005-11-27 20:49:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2013-05-18 10:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* also serves as signal to remake texspace */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > type  = =  OB_MESH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Mesh  * me  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( me - > bb )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:58:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											me - > bb - > flag  | =  BOUNDBOX_DIRTY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-20 01:30:29 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( ELEM ( ob - > type ,  OB_SURF ,  OB_CURVE ,  OB_FONT ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:58:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Curve  * cu  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( cu - > bb )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											cu - > bb - > flag  | =  BOUNDBOX_DIRTY ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-18 10:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > bb )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MEM_freeN ( ob - > bb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > bb  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-27 20:49:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-18 10:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > derivedFinal )  { 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
											 
										 
										
											2006-11-20 04:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > derivedFinal - > needsFree  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-27 20:49:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > derivedFinal - > release ( ob - > derivedFinal ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > derivedFinal  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-27 20:49:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-18 10:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > derivedDeform )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > derivedDeform - > needsFree  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > derivedDeform - > release ( ob - > derivedDeform ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > derivedDeform  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-27 20:49:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 14:44:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_free_curve_cache ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-27 20:49:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2011-09-14 00:37:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2003-04-26 13:07:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* do not free object itself */  
						 
					
						
							
								
									
										
										
										
											2013-12-25 16:43:26 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_free_ex ( Object  * ob ,  bool  do_id_user )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2013-05-18 10:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_free_derived_caches ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-27 20:49:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-10-24 13:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* disconnect specific data, but not for lib data (might be indirect data, can get relinked) */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > data )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ID  * id  =  ob - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										id - > us - - ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 09:54:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( id - > us  = =  0  & &  id - > lib  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-15 06:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											switch  ( ob - > type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  OB_MESH : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													BKE_mesh_unlink ( ( Mesh  * ) id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  OB_CURVE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													BKE_curve_unlink ( ( Curve  * ) id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  OB_MBALL : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													BKE_mball_unlink ( ( MetaBall  * ) id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > data  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-15 06:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > mat )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( a  =  0 ;  a  <  ob - > totcol ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ob - > mat [ a ] )  ob - > mat [ a ] - > id . us - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MEM_freeN ( ob - > mat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > matbits )  MEM_freeN ( ob - > matbits ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > mat  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > matbits  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 21:57:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > iuser )  MEM_freeN ( ob - > iuser ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > iuser  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > bb )  MEM_freeN ( ob - > bb ) ;  
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > bb  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > adt )  BKE_free_animdata ( ( ID  * ) ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > poselib )  ob - > poselib - > id . us - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > gpd )  ( ( ID  * ) ob - > gpd ) - > us - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > defbase . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										BLI_freelistN ( & ob - > defbase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > pose ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-25 16:43:26 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_pose_free_ex ( ob - > pose ,  do_id_user ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > mpath ) 
							 
						 
					
						
							
								
									
										
											 
										
											
												Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
											 
										 
										
											2010-01-01 12:24:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										animviz_free_motionpath ( ob - > mpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_bproperty_free_list ( & ob - > prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_free_modifiers ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									free_sensors ( & ob - > sensors ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									free_controllers ( & ob - > controllers ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									free_actuators ( & ob - > actuators ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2014-04-11 11:47:07 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_constraints_free ( & ob - > constraints ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-26 18:18:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										
											
												Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons) 
  instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group 
  setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
	- "Point" is most like the old effectors and uses the 
	  effector location as the effector point.
	- "Plane" uses the closest point on effectors local xy-plane 
	  as the effector point.
	- "Surface" uses the closest point on an effector object's 
	  surface as the effector point.
	- "Every Point" uses every point in a mesh effector object 
	  as an effector point.
	- The falloff is calculated from this point, so for example 
	  with "surface" shape and "use only negative z axis" it's 
	  possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer 
  just spherical.
* New effector parameter "flow", which makes the effector act as 
  surrounding air velocity, so the resulting force is 
  proportional to the velocity difference of the point and "air 
  velocity". For example a wind field with flow=1.0 results in 
  proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random 
  flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force 
  (note. the z-axis is the surface normal in the case of 
  effector shape "surface")
* New "force field" submenu in add menu, which adds an empty 
  with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector 
  system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for 
  particles, softbody & cloth, since their final effect depends on many external 
  factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through 
  DAG_id_flush_update(..).
  
Known issues
* Curve guides don't yet have all ui buttons in place, but they 
  should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50 
  frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to 
  free pidlists after use :).
											 
										 
										
											2009-09-30 22:10:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									free_partdeflect ( ob - > pd ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-23 05:56:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_rigidbody_free_object ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-23 05:56:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_rigidbody_free_constraint ( ob ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons) 
  instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group 
  setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
	- "Point" is most like the old effectors and uses the 
	  effector location as the effector point.
	- "Plane" uses the closest point on effectors local xy-plane 
	  as the effector point.
	- "Surface" uses the closest point on an effector object's 
	  surface as the effector point.
	- "Every Point" uses every point in a mesh effector object 
	  as an effector point.
	- The falloff is calculated from this point, so for example 
	  with "surface" shape and "use only negative z axis" it's 
	  possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer 
  just spherical.
* New effector parameter "flow", which makes the effector act as 
  surrounding air velocity, so the resulting force is 
  proportional to the velocity difference of the point and "air 
  velocity". For example a wind field with flow=1.0 results in 
  proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random 
  flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force 
  (note. the z-axis is the surface normal in the case of 
  effector shape "surface")
* New "force field" submenu in add menu, which adds an empty 
  with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector 
  system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for 
  particles, softbody & cloth, since their final effect depends on many external 
  factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through 
  DAG_id_flush_update(..).
  
Known issues
* Curve guides don't yet have all ui buttons in place, but they 
  should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50 
  frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to 
  free pidlists after use :).
											 
										 
										
											2009-09-30 22:10:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > soft )  sbFree ( ob - > soft ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > bsoft )  bsbFree ( ob - > bsoft ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > gpulamp . first )  GPU_lamp_free ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-15 18:58:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-07 02:59:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_free_sculptsession ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > pc_ids . first )  BLI_freelistN ( & ob - > pc_ids ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_freelistN ( & ob - > lodlevels ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Free runtime curves data. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > curve_cache )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-18 17:35:51 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_curve_bevelList_free ( & ob - > curve_cache - > bev ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > curve_cache - > path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											free_path ( ob - > curve_cache - > path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MEM_freeN ( ob - > curve_cache ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-25 16:43:26 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_free ( Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BKE_object_free_ex ( ob ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												 - added eModifierTypeFlag_RequiresOriginalData for modifiers that
   can only follow deform (for example, they store mesh vertex
   indices)
 - added ModifierType.foreachObjectLink for iterating over Object
   links inside modifier data (used for file load, relinking, etc)
 - switched various modifiers_ functions to take object argument
   instead of ListBase
 - added user editable name field to modifiers
 - bug fix, duplicate and make single user didn't relink object
   pointers in modifier data
 - added modifiers to outliner, needs icon
 - added armature, hook, and softbody modifiers (softbody doesn't
   do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
											 
										 
										
											2005-08-10 22:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  unlink_object__unlinkModifierLinks ( void  * userData ,  Object  * ob ,  Object  * * obpoin )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * unlinkOb  =  userData ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( * obpoin  = =  unlinkOb )  { 
							 
						 
					
						
							
								
									
										
											 
										
											
												 - added eModifierTypeFlag_RequiresOriginalData for modifiers that
   can only follow deform (for example, they store mesh vertex
   indices)
 - added ModifierType.foreachObjectLink for iterating over Object
   links inside modifier data (used for file load, relinking, etc)
 - switched various modifiers_ functions to take object argument
   instead of ListBase
 - added user editable name field to modifiers
 - bug fix, duplicate and make single user didn't relink object
   pointers in modifier data
 - added modifiers to outliner, needs icon
 - added armature, hook, and softbody modifiers (softbody doesn't
   do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
											 
										 
										
											2005-08-10 22:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										* obpoin  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// XXX: should this just be OB_RECALC_DATA?
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										DAG_id_tag_update ( & ob - > id ,  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												 - added eModifierTypeFlag_RequiresOriginalData for modifiers that
   can only follow deform (for example, they store mesh vertex
   indices)
 - added ModifierType.foreachObjectLink for iterating over Object
   links inside modifier data (used for file load, relinking, etc)
 - switched various modifiers_ functions to take object argument
   instead of ListBase
 - added user editable name field to modifiers
 - bug fix, duplicate and make single user didn't relink object
   pointers in modifier data
 - added modifiers to outliner, needs icon
 - added armature, hook, and softbody modifiers (softbody doesn't
   do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
											 
										 
										
											2005-08-10 22:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2010-06-09 15:35:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_unlink ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  G . main ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Object  * obt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Material  * mat ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									World  * wrld ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bScreen  * sc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * sce ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-23 03:00:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SceneRenderLayer  * srl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									FreestyleLineSet  * lineset ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-06 16:38:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bNodeTree  * ntree ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bNode  * node ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Curve  * cu ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Tex  * tex ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Group  * group ; 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-23 18:27:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Camera  * camera ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bConstraint  * con ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												2.5: Blender "Animato" - New Animation System 
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. 
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. 
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) 
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
											 
										 
										
											2009-01-17 03:12:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									//bActionStrip *strip; // XXX animsys 
 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
											 
										 
										
											2008-04-10 11:39:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ModifierData  * md ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-09 15:35:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ARegion  * ar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RegionView3D  * rv3d ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									LodLevel  * lod ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-18 15:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  a ,  found ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									unlink_controllers ( & ob - > controllers ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unlink_actuators ( & ob - > actuators ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2006-11-13 21:43:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* check all objects: parents en bevels and fields, also from libraries */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-06 23:56:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* FIXME: need to check all animation blocks (drivers) */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obt  =  bmain - > object . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( obt )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( obt - > proxy  = =  ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											obt - > proxy  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( obt - > proxy_from  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											obt - > proxy_from  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											DAG_id_tag_update ( & obt - > id ,  OB_RECALC_OB ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-30 15:54:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( obt - > proxy_group  = =  ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											obt - > proxy_group  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-13 21:43:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( obt - > parent  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											obt - > parent  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											DAG_id_tag_update ( & obt - > id ,  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-13 21:43:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										modifiers_foreachObjectLink ( obt ,  unlink_object__unlinkModifierLinks ,  ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-03-25 22:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ELEM ( obt - > type ,  OB_CURVE ,  OB_FONT ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											cu  =  obt - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-12-09 06:17:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( cu - > bevobj  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												cu - > bevobj  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												DAG_id_tag_update ( & obt - > id ,  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( cu - > taperobj  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												cu - > taperobj  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												DAG_id_tag_update ( & obt - > id ,  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( cu - > textoncurve  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												cu - > textoncurve  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												DAG_id_tag_update ( & obt - > id ,  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-13 21:43:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else  if  ( obt - > type  = =  OB_ARMATURE  & &  obt - > pose )  { 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-13 21:43:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bPoseChannel  * pchan ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( pchan  =  obt - > pose - > chanbase . first ;  pchan ;  pchan  =  pchan - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( con  =  pchan - > constraints . first ;  con ;  con  =  con - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-11 11:47:07 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													bConstraintTypeInfo  * cti  =  BKE_constraint_typeinfo_get ( con ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon. 
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too) 
											 
										 
										
											2007-10-21 23:00:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ListBase  targets  =  { NULL ,  NULL } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bConstraintTarget  * ct ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( cti  & &  cti - > get_constraint_targets )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														cti - > get_constraint_targets ( con ,  & targets ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														for  ( ct  =  targets . first ;  ct ;  ct  =  ct - > next )  { 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon. 
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too) 
											 
										 
										
											2007-10-21 23:00:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															if  ( ct - > tar  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																ct - > tar  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																ct - > subtarget [ 0 ]  =  ' \0 ' ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																DAG_id_tag_update ( & obt - > id ,  OB_RECALC_DATA ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon. 
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too) 
											 
										 
										
											2007-10-21 23:00:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( cti - > flush_constraint_targets ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															cti - > flush_constraint_targets ( con ,  & targets ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-07 07:03:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( pchan - > custom  = =  ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													pchan - > custom  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-07 07:03:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-21 05:46:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else  if  ( ELEM ( OB_MBALL ,  ob - > type ,  obt - > type ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 06:38:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( BKE_mball_is_basis_for ( obt ,  ob ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												DAG_id_tag_update ( & obt - > id ,  OB_RECALC_DATA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-13 21:43:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sca_remove_ob_poin ( obt ,  ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( con  =  obt - > constraints . first ;  con ;  con  =  con - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-11 11:47:07 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bConstraintTypeInfo  * cti  =  BKE_constraint_typeinfo_get ( con ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon. 
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too) 
											 
										 
										
											2007-10-21 23:00:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ListBase  targets  =  { NULL ,  NULL } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bConstraintTarget  * ct ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( cti  & &  cti - > get_constraint_targets )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												cti - > get_constraint_targets ( con ,  & targets ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( ct  =  targets . first ;  ct ;  ct  =  ct - > next )  { 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon. 
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too) 
											 
										 
										
											2007-10-21 23:00:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ct - > tar  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ct - > tar  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ct - > subtarget [ 0 ]  =  ' \0 ' ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														DAG_id_tag_update ( & obt - > id ,  OB_RECALC_DATA ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon. 
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too) 
											 
										 
										
											2007-10-21 23:00:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( cti - > flush_constraint_targets ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													cti - > flush_constraint_targets ( con ,  & targets ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-11 10:46:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-13 21:43:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* object is deflector or field */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > pd )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( obt - > soft ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												DAG_id_tag_update ( & obt - > id ,  OB_RECALC_DATA ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
											 
										 
										
											2008-04-10 11:39:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* cloth */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( md  =  obt - > modifiers . first ;  md ;  md  =  md - > next ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( md - > type  = =  eModifierType_Cloth ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													DAG_id_tag_update ( & obt - > id ,  OB_RECALC_DATA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-13 21:43:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* strips */ 
							 
						 
					
						
							
								
									
										
											 
										
											
												2.5: Blender "Animato" - New Animation System 
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. 
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. 
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) 
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
											 
										 
										
											2009-01-17 03:12:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#if 0  // XXX old animation system
  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( strip  =  obt - > nlastrips . first ;  strip ;  strip  =  strip - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( strip - > object  = =  ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												strip - > object  =  NULL ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( strip - > modifiers . first )  { 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-13 21:43:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												bActionModifier  * amod ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( amod  =  strip - > modifiers . first ;  amod ;  amod  =  amod - > next ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( amod - > ob  = =  ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														amod - > ob  =  NULL ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
											 
										
											
												2.5: Blender "Animato" - New Animation System 
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. 
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. 
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) 
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
											 
										 
										
											2009-01-17 03:12:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif  // XXX old animation system
  
						 
					
						
							
								
									
										
										
										
											2006-11-13 21:43:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* particle systems */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( obt - > particlesystem . first )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ParticleSystem  * tpsys  =  obt - > particlesystem . first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( ;  tpsys ;  tpsys  =  tpsys - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-20 23:52:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BoidState  * state  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												BoidRule  * rule  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ParticleTarget  * pt  =  tpsys - > targets . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( ;  pt ;  pt  =  pt - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( pt - > ob  = =  ob )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-20 23:52:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														pt - > ob  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														DAG_id_tag_update ( & obt - > id ,  OB_RECALC_DATA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-12 23:38:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( tpsys - > target_ob  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													tpsys - > target_ob  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													DAG_id_tag_update ( & obt - > id ,  OB_RECALC_DATA ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( tpsys - > part - > dup_ob  = =  ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													tpsys - > part - > dup_ob  =  NULL ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( tpsys - > part - > phystype  = =  PART_PHYS_BOIDS )  { 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ParticleData  * pa ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													BoidParticle  * bpa ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													int  p ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													for  ( p  =  0 ,  pa  =  tpsys - > particles ;  p  <  tpsys - > totpart ;  p + + ,  pa + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														bpa  =  pa - > boid ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( bpa - > ground  = =  ob ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															bpa - > ground  =  NULL ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( tpsys - > part - > boids )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													for  ( state  =  tpsys - > part - > boids - > states . first ;  state ;  state  =  state - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														for  ( rule  =  state - > rules . first ;  rule ;  rule  =  rule - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( rule - > type  = =  eBoidRuleType_Avoid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																BoidRuleGoalAvoid  * gabr  =  ( BoidRuleGoalAvoid  * ) rule ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																if  ( gabr - > ob  = =  ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	gabr - > ob  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-20 23:52:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															else  if  ( rule - > type  = =  eBoidRuleType_FollowLeader )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																BoidRuleFollowLeader  * flbr  =  ( BoidRuleFollowLeader  * ) rule ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																if  ( flbr - > ob  = =  ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	flbr - > ob  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-20 23:52:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2013-10-17 19:31:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( tpsys - > parent  = =  ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													tpsys - > parent  =  NULL ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ob - > pd ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												DAG_id_tag_update ( & obt - > id ,  OB_RECALC_DATA ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* levels of detail */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( lod  =  obt - > lodlevels . first ;  lod ;  lod  =  lod - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( lod - > source  = =  ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												lod - > source  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										obt  =  obt - > id . next ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2003-04-26 13:07:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* materials */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									mat  =  bmain - > mat . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( mat )  { 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( a  =  0 ;  a  <  MAX_MTEX ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( mat - > mtex [ a ]  & &  ob  = =  mat - > mtex [ a ] - > object )  { 
							 
						 
					
						
							
								
									
										
										
										
											2003-04-26 13:07:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* actually, test for lib here... to do */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												mat - > mtex [ a ] - > object  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										mat  =  mat - > id . next ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* textures */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( tex  =  bmain - > tex . first ;  tex ;  tex  =  tex - > id . next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( tex - > env  & &  ( ob  = =  tex - > env - > object ) )  tex - > env - > object  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( tex - > pd   & &  ( ob  = =  tex - > pd - > object ) )  tex - > pd - > object  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( tex - > vd   & &  ( ob  = =  tex - > vd - > object ) )  tex - > vd - > object  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-27 12:45:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									/* worlds */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									wrld  =  bmain - > world . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( wrld )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( wrld - > id . lib  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( a  =  0 ;  a  <  MAX_MTEX ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( wrld - > mtex [ a ]  & &  ob  = =  wrld - > mtex [ a ] - > object ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													wrld - > mtex [ a ] - > object  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										wrld  =  wrld - > id . next ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2003-04-26 13:07:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* scenes */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sce  =  bmain - > scene . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( sce )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( sce - > id . lib  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( sce - > camera  = =  ob )  sce - > camera  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( sce - > toolsettings - > skgen_template  = =  ob )  sce - > toolsettings - > skgen_template  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( sce - > toolsettings - > particle . object  = =  ob )  sce - > toolsettings - > particle . object  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-16 19:49:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# ifdef DURIAN_CAMERA_SWITCH 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TimeMarker  * m ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( m  =  sce - > markers . first ;  m ;  m  =  m - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( m - > camera  = =  ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														m - > camera  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-16 19:49:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( sce - > ed )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-09 13:52:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Sequence  * seq ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												SEQ_BEGIN ( sce - > ed ,  seq ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( seq - > scene_camera  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														seq - > scene_camera  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-09 13:52:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-09 13:52:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												SEQ_END 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-29 21:24:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-04-05 16:55:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( srl  =  sce - > r . layers . first ;  srl ;  srl  =  srl - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-26 08:32:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( lineset  =  ( FreestyleLineSet  * ) srl - > freestyleConfig . linesets . first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												     lineset ;  lineset  =  lineset - > next ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-30 09:28:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( lineset - > linestyle )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-16 15:13:40 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														BKE_linestyle_target_object_unlink ( lineset - > linestyle ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-30 09:28:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-29 21:24:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-09 13:52:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										sce  =  sce - > id . next ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										
											
												2.5: Blender "Animato" - New Animation System 
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. 
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. 
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) 
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
											 
										 
										
											2009-01-17 03:12:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									/* screens */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sc  =  bmain - > screen . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( sc )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ScrArea  * sa  =  sc - > areabase . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										while  ( sa )  { 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											SpaceLink  * sl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( sl  =  sa - > spacedata . first ;  sl ;  sl  =  sl - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( sl - > spacetype  = =  SPACE_VIEW3D )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													View3D  * v3d  =  ( View3D  * )  sl ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-26 07:28:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													/* found doesn't need to be set here */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( v3d - > ob_centre  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														v3d - > ob_centre  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														v3d - > ob_centre_bone [ 0 ]  =  ' \0 ' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( v3d - > localvd  & &  v3d - > localvd - > ob_centre  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														v3d - > localvd - > ob_centre  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														v3d - > localvd - > ob_centre_bone [ 0 ]  =  ' \0 ' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													found  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( v3d - > camera  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														v3d - > camera  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														found  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( v3d - > localvd  & &  v3d - > localvd - > camera  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														v3d - > localvd - > camera  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-18 15:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														found  + =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( found )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( sa - > spacetype  = =  SPACE_VIEW3D )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															for  ( ar  =  sa - > regionbase . first ;  ar ;  ar  =  ar - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																if  ( ar - > regiontype  = =  RGN_TYPE_WINDOW )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	rv3d  =  ( RegionView3D  * ) ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-18 15:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																	if  ( found  = =  1  | |  found  = =  3 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																		if  ( rv3d - > persp  = =  RV3D_CAMOB ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																			rv3d - > persp  =  RV3D_PERSP ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-18 15:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																	} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	if  ( found  = =  2  | |  found  = =  3 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																		if  ( rv3d - > localvd  & &  rv3d - > localvd - > persp  = =  RV3D_CAMOB ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																			rv3d - > localvd - > persp  =  RV3D_PERSP ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-18 15:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																	} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												else  if  ( sl - > spacetype  = =  SPACE_OUTLINER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													SpaceOops  * so  =  ( SpaceOops  * ) sl ; 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-10 11:33:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( so - > treestore )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-03 11:35:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														TreeStoreElem  * tselem ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														BLI_mempool_iter  iter ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														BLI_mempool_iternew ( so - > treestore ,  & iter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														while  ( ( tselem  =  BLI_mempool_iterstep ( & iter ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															if  ( tselem - > id  = =  ( ID  * ) ob )  tselem - > id  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2004-10-10 11:33:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2004-09-05 13:43:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												else  if  ( sl - > spacetype  = =  SPACE_BUTS )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													SpaceButs  * sbuts  =  ( SpaceButs  * ) sl ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-25 11:41:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( sbuts - > pinid  = =  ( ID  * ) ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														sbuts - > flag  & =  ~ SB_PIN_CONTEXT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														sbuts - > pinid  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-25 11:41:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-26 16:19:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												else  if  ( sl - > spacetype  = =  SPACE_NODE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													SpaceNode  * snode  =  ( SpaceNode  * ) sl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( snode - > from  = =  ( ID  * ) ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														snode - > flag  & =  ~ SNODE_PIN ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														snode - > from  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											sa  =  sa - > next ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										sc  =  sc - > id . next ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* groups */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									group  =  bmain - > group . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( group )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-03 11:28:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_group_object_unlink ( group ,  ob ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										group  =  group - > id . next ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-23 18:27:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* cameras */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									camera  =  bmain - > camera . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( camera )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( camera - > dof_ob  = =  ob )  { 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-23 18:27:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											camera - > dof_ob  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										camera  =  camera - > id . next ; 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-23 18:27:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-06 16:38:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* nodes */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( ntree  =  bmain - > nodetree . first ;  ntree ;  ntree  =  ntree - > id . next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( node  =  ntree - > nodes . first ;  node ;  node  =  node - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( node - > id  = =  & ob - > id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												node - > id  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-12-17 14:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* actual check for internal data, not context or flags */  
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_object_is_in_editmode ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2012-12-17 14:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > data  = =  NULL ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-17 14:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > type  = =  OB_MESH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Mesh  * me  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( me - > edit_btmesh ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-17 14:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if  ( ob - > type  = =  OB_ARMATURE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bArmature  * arm  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( arm - > edbo ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-17 14:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if  ( ob - > type  = =  OB_FONT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Curve  * cu  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( cu - > editfont ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-17 14:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if  ( ob - > type  = =  OB_MBALL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MetaBall  * mb  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( mb - > editelems ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-17 14:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if  ( ob - > type  = =  OB_LATTICE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Lattice  * lt  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( lt - > editlatt ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-17 14:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if  ( ob - > type  = =  OB_SURF  | |  ob - > type  = =  OB_CURVE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Curve  * cu  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( cu - > editnurb ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-17 14:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-17 14:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-01 20:27:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_object_is_in_editmode_vgroup ( Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ( OB_TYPE_SUPPORT_VGROUP ( ob - > type )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									        BKE_object_is_in_editmode ( ob ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  BKE_object_is_in_wpaint_select_vert ( Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > type  = =  OB_MESH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Mesh  * me  =  ob - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-27 09:49:31 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  ( ( ob - > mode  &  OB_MODE_WEIGHT_PAINT )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										        ( me - > edit_btmesh  = =  NULL )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										        ( ME_EDIT_PAINT_SEL_MODE ( me )  = =  SCE_SELECT_VERTEX ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-01 20:27:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_object_exists_check ( Object  * obtest )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( obtest  = =  NULL )  return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-08-24 20:18:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob  =  G . main - > object . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( ob )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob  = =  obtest )  return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob  =  ob - > id . next ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* *************************************************** */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-04-18 08:58:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  * BKE_object_obdata_add_from_type ( Main  * bmain ,  int  type )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-18 08:58:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  OB_MESH :       return  BKE_mesh_add ( bmain ,  " Mesh " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_CURVE :      return  BKE_curve_add ( bmain ,  " Curve " ,  OB_CURVE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_SURF :       return  BKE_curve_add ( bmain ,  " Surf " ,  OB_SURF ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_FONT :       return  BKE_curve_add ( bmain ,  " Text " ,  OB_FONT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_MBALL :      return  BKE_mball_add ( bmain ,  " Meta " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_CAMERA :     return  BKE_camera_add ( bmain ,  " Camera " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_LAMP :       return  BKE_lamp_add ( bmain ,  " Lamp " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_LATTICE :    return  BKE_lattice_add ( bmain ,  " Lattice " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_ARMATURE :   return  BKE_armature_add ( bmain ,  " Armature " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_SPEAKER :    return  BKE_speaker_add ( bmain ,  " Speaker " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  OB_EMPTY :      return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											printf ( " BKE_object_obdata_add_from_type: Internal error, bad type: %d \n " ,  type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-03 17:05:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  const  char  * get_obdata_defname ( int  type )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-24 12:13:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  OB_MESH :  return  DATA_ ( " Mesh " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_CURVE :  return  DATA_ ( " Curve " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_SURF :  return  DATA_ ( " Surf " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_FONT :  return  DATA_ ( " Text " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_MBALL :  return  DATA_ ( " Mball " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_CAMERA :  return  DATA_ ( " Camera " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_LAMP :  return  DATA_ ( " Lamp " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_LATTICE :  return  DATA_ ( " Lattice " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_ARMATURE :  return  DATA_ ( " Armature " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_SPEAKER :  return  DATA_ ( " Speaker " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_EMPTY :  return  DATA_ ( " Empty " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											printf ( " get_obdata_defname: Internal error, bad type: %d \n " ,  type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-24 12:13:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  DATA_ ( " Empty " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2006-09-11 17:55:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* more general add: creates minimum required data, but without vertices etc. */  
						 
					
						
							
								
									
										
										
										
											2013-02-05 12:46:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Object  * BKE_object_add_only_object ( Main  * bmain ,  int  type ,  const  char  * name )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! name ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-03 21:32:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										name  =  get_obdata_defname ( type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-15 16:37:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob  =  BKE_libblock_alloc ( bmain ,  ID_OB ,  name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-09-11 17:55:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									/* default object vars */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > type  =  type ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 23:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > col [ 0 ]  =  ob - > col [ 1 ]  =  ob - > col [ 2 ]  =  1.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > col [ 3 ]  =  1.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 23:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > size [ 0 ]  =  ob - > size [ 1 ]  =  ob - > size [ 2 ]  =  1.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > dscale [ 0 ]  =  ob - > dscale [ 1 ]  =  ob - > dscale [ 2 ]  =  1.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 23:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* objects should default to having Euler XYZ rotations, 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  but  rotations  default  to  quaternions  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > rotmode  =  ROT_MODE_EUL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-02 00:40:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unit_axis_angle ( ob - > rotAxis ,  & ob - > rotAngle ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unit_axis_angle ( ob - > drotAxis ,  & ob - > drotAngle ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unit_qt ( ob - > quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unit_qt ( ob - > dquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 23:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* rotation locks should be 4D for 4 component rotations by default... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > protectflag  =  OB_LOCK_ROT4D ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
											 
										 
										
											2010-01-01 12:24:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									unit_m4 ( ob - > constinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unit_m4 ( ob - > parentinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unit_m4 ( ob - > obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > dt  =  OB_TEXTURE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > empty_drawtype  =  OB_PLAINAXES ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > empty_drawsize  =  1.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-09-11 17:55:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-07-20 01:30:29 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ELEM ( type ,  OB_LAMP ,  OB_CAMERA ,  OB_SPEAKER ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > trackflag  =  OB_NEGZ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > upflag  =  OB_POSY ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > trackflag  =  OB_POSY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > upflag  =  OB_POSZ ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										
											
												2.5: Blender "Animato" - New Animation System 
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. 
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. 
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) 
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
											 
										 
										
											2009-01-17 03:12:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > dupon  =  1 ;  ob - > dupoff  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > dupsta  =  1 ;  ob - > dupend  =  100 ; 
							 
						 
					
						
							
								
									
										
										
										
											2007-11-30 14:10:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > dupfacesca  =  1.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2003-04-26 13:07:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Game engine defaults*/ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > mass  =  ob - > inertia  =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > formfactor  =  0.4f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > damping  =  0.04f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > rdamping  =  0.1f ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ob - > anisotropicFriction [ 0 ]  =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > anisotropicFriction [ 1 ]  =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > anisotropicFriction [ 2 ]  =  1.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > gameflag  =  OB_PROP  |  OB_COLLISION ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-26 16:27:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > margin  =  0.04f ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > init_state  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > state  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-11 08:15:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > obstacleRad  =  1.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-28 21:36:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > step_height  =  0.15f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > jump_speed  =  10.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > fall_speed  =  55.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-30 15:44:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > col_group  =  0x01 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > col_mask  =  0xff ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-09-18 13:27:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* NT fluid sim defaults */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > fluidsimSettings  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-09-11 17:55:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 06:07:10 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_listbase_clear ( & ob - > pc_ids ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
											 
										 
										
											2010-01-01 12:24:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-07-03 19:09:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Animation Visualization defaults */ 
							 
						 
					
						
							
								
									
										
											 
										
											
												Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
											 
										 
										
											2010-01-01 12:24:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									animviz_settings_init ( & ob - > avs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2006-09-11 17:55:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-04 14:14:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* general add: to scene, with layer from area and default name */  
						 
					
						
							
								
									
										
										
										
											2006-09-11 17:55:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* creates minimum required data, but without vertices etc. */  
						 
					
						
							
								
									
										
										
										
											2013-04-18 08:58:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Object  * BKE_object_add ( Main  * bmain ,  Scene  * scene ,  int  type )  
						 
					
						
							
								
									
										
										
										
											2006-09-11 17:55:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Base  * base ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 08:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									char  name [ MAX_ID_NAME ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-09-11 17:55:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-13 03:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_strncpy ( name ,  get_obdata_defname ( type ) ,  sizeof ( name ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-18 08:58:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob  =  BKE_object_add_only_object ( bmain ,  type ,  name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-09-11 17:55:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-04-18 08:58:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > data  =  BKE_object_obdata_add_from_type ( bmain ,  type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-09-11 17:55:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > lay  =  scene - > lay ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 10:19:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									base  =  BKE_scene_base_add ( scene ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:33:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_scene_base_deselect_all ( scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BKE_scene_base_select ( scene ,  base ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-06-27 22:13:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_id_tag_update_ex ( bmain ,  & ob - > id ,  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-09-11 17:55:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									return  ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-09 11:48:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# ifdef WITH_GAMEENGINE 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_lod_add ( Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									LodLevel  * lod  =  MEM_callocN ( sizeof ( LodLevel ) ,  " LoD Level " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									LodLevel  * last  =  ob - > lodlevels . last ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* If the lod list is empty, initialize it with the base lod level */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! last )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										LodLevel  * base  =  MEM_callocN ( sizeof ( LodLevel ) ,  " Base LoD Level " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BLI_addtail ( & ob - > lodlevels ,  base ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										base - > flags  =  OB_LOD_USE_MESH  |  OB_LOD_USE_MAT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										base - > source  =  ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										last  =  ob - > currentlod  =  base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									lod - > distance  =  last - > distance  +  25.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									lod - > flags  =  OB_LOD_USE_MESH  |  OB_LOD_USE_MAT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BLI_addtail ( & ob - > lodlevels ,  lod ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-09-24 20:45:52 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  lod_cmp ( const  void  * a ,  const  void  * b )  
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2014-09-24 20:45:52 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  LodLevel  * loda  =  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  LodLevel  * lodb  =  b ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( loda - > distance  <  lodb - > distance )  return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  loda - > distance  >  lodb - > distance ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  BKE_object_lod_sort ( Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BLI_sortlist ( & ob - > lodlevels ,  lod_cmp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  BKE_object_lod_remove ( Object  * ob ,  int  level )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									LodLevel  * rem ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( level  <  1  | |  level  >  BLI_countlist ( & ob - > lodlevels )  -  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rem  =  BLI_findlink ( & ob - > lodlevels ,  level ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( rem  = =  ob - > currentlod )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > currentlod  =  rem - > prev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BLI_remlink ( & ob - > lodlevels ,  rem ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MEM_freeN ( rem ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* If there are no user defined lods, remove the base lod as well */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( BLI_countlist ( & ob - > lodlevels )  = =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										LodLevel  * base  =  ob - > lodlevels . first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BLI_remlink ( & ob - > lodlevels ,  base ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MEM_freeN ( base ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > currentlod  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-09 11:48:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  LodLevel  * lod_level_select ( Object  * ob ,  const  float  camera_position [ 3 ] )  
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									LodLevel  * current  =  ob - > currentlod ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-09 11:48:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  dist_sq ,  dist_sq_curr ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! current )  return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-09 11:48:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									dist_sq  =  len_squared_v3v3 ( ob - > obmat [ 3 ] ,  camera_position ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dist_sq_curr  =  current - > distance  *  current - > distance ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-09 11:48:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( dist_sq  <  dist_sq_curr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-18 15:34:56 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* check for higher LoD */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-09 11:48:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										while  ( current - > prev  & &  dist_sq  <  dist_sq_curr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											current  =  current - > prev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-18 15:34:56 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* check for lower LoD */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-13 15:35:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										while  ( current - > next  & &  dist_sq  >  SQUARE ( current - > next - > distance ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											current  =  current - > next ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  current ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  BKE_object_lod_is_usable ( Object  * ob ,  Scene  * scene )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  active  =  ( scene )  ?  ob  = =  OBACT  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ( ob - > mode  = =  OB_MODE_OBJECT  | |  ! active ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-09 11:48:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_lod_update ( Object  * ob ,  const  float  camera_position [ 3 ] )  
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2013-12-18 15:34:56 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									LodLevel  * cur_level  =  ob - > currentlod ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									LodLevel  * new_level  =  lod_level_select ( ob ,  camera_position ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( new_level  ! =  cur_level )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > currentlod  =  new_level ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  Object  * lod_ob_get ( Object  * ob ,  Scene  * scene ,  int  flag )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									LodLevel  * current  =  ob - > currentlod ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! current  | |  ! BKE_object_lod_is_usable ( ob ,  scene ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-18 15:34:56 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( current - > prev  & &  ( ! ( current - > flags  &  flag )  | |  ! current - > source  | |  current - > source - > type  ! =  OB_MESH ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										current  =  current - > prev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  current - > source ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								struct  Object  * BKE_object_lod_meshob_get ( Object  * ob ,  Scene  * scene )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  lod_ob_get ( ob ,  scene ,  OB_LOD_USE_MESH ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								struct  Object  * BKE_object_lod_matob_get ( Object  * ob ,  Scene  * scene )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  lod_ob_get ( ob ,  scene ,  OB_LOD_USE_MAT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-09 11:48:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif   /* WITH_GAMEENGINE */ 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-03-31 23:39:08 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								SoftBody  * copy_softbody ( SoftBody  * sb ,  bool  copy_caches )  
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:06:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SoftBody  * sbn ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( sb  = =  NULL )  return ( NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 16:56:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sbn  =  MEM_dupallocN ( sb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-27 14:37:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( copy_caches  = =  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-27 14:37:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										sbn - > totspring  =  sbn - > totpoint  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sbn - > bpoint  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sbn - > bspring  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sbn - > totspring  =  sb - > totspring ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sbn - > totpoint  =  sb - > totpoint ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( sbn - > bpoint )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											sbn - > bpoint  =  MEM_dupallocN ( sbn - > bpoint ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( i  =  0 ;  i  <  sbn - > totpoint ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( sbn - > bpoint [ i ] . springs ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													sbn - > bpoint [ i ] . springs  =  MEM_dupallocN ( sbn - > bpoint [ i ] . springs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( sb - > bspring ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											sbn - > bspring  =  MEM_dupallocN ( sb - > bspring ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:06:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sbn - > keys  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sbn - > totkey  =  sbn - > totpointkey  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-05-12 14:00:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sbn - > scratch  =  NULL ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
											 
										 
										
											2008-04-10 11:39:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-09-27 14:37:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sbn - > pointcache  =  BKE_ptcache_copy_list ( & sbn - > ptcaches ,  & sb - > ptcaches ,  copy_caches ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
											 
										 
										
											2008-04-10 11:39:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( sb - > effector_weights ) 
							 
						 
					
						
							
								
									
										
											 
										
											
												Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons) 
  instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group 
  setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
	- "Point" is most like the old effectors and uses the 
	  effector location as the effector point.
	- "Plane" uses the closest point on effectors local xy-plane 
	  as the effector point.
	- "Surface" uses the closest point on an effector object's 
	  surface as the effector point.
	- "Every Point" uses every point in a mesh effector object 
	  as an effector point.
	- The falloff is calculated from this point, so for example 
	  with "surface" shape and "use only negative z axis" it's 
	  possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer 
  just spherical.
* New effector parameter "flow", which makes the effector act as 
  surrounding air velocity, so the resulting force is 
  proportional to the velocity difference of the point and "air 
  velocity". For example a wind field with flow=1.0 results in 
  proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random 
  flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force 
  (note. the z-axis is the surface normal in the case of 
  effector shape "surface")
* New "force field" submenu in add menu, which adds an empty 
  with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector 
  system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for 
  particles, softbody & cloth, since their final effect depends on many external 
  factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through 
  DAG_id_flush_update(..).
  
Known issues
* Curve guides don't yet have all ui buttons in place, but they 
  should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50 
  frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to 
  free pidlists after use :).
											 
										 
										
											2009-09-30 22:10:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										sbn - > effector_weights  =  MEM_dupallocN ( sb - > effector_weights ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:06:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  sbn ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2004-10-14 08:52:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-09-27 21:52:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								BulletSoftBody  * copy_bulletsoftbody ( BulletSoftBody  * bsb )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BulletSoftBody  * bsbn ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( bsb  = =  NULL ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bsbn  =  MEM_dupallocN ( bsb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* no pointer in this structure yet */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  bsbn ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-13 10:52:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  ParticleSystem  * copy_particlesystem ( ParticleSystem  * psys )  
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ParticleSystem  * psysn ; 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-01 20:08:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ParticleData  * pa ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  p ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									psysn  =  MEM_dupallocN ( psys ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									psysn - > particles  =  MEM_dupallocN ( psys - > particles ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									psysn - > child  =  MEM_dupallocN ( psys - > child ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( psys - > part - > type  = =  PART_HAIR )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( p  =  0 ,  pa  =  psysn - > particles ;  p  <  psysn - > totpart ;  p + + ,  pa + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											pa - > hair  =  MEM_dupallocN ( pa - > hair ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( psysn - > particles  & &  ( psysn - > particles - > keys  | |  psysn - > particles - > boid ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ParticleKey  * key  =  psysn - > particles - > keys ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BoidParticle  * boid  =  psysn - > particles - > boid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( key ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											key  =  MEM_dupallocN ( key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( boid ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											boid  =  MEM_dupallocN ( boid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( p  =  0 ,  pa  =  psysn - > particles ;  p  <  psysn - > totpart ;  p + + ,  pa + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( boid ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												pa - > boid  =  boid + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( key )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												pa - > keys  =  key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												key  + =  pa - > totkey ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-01 20:08:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( psys - > clmd )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-04 09:59:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										psysn - > clmd  =  ( ClothModifierData  * ) modifier_new ( eModifierType_Cloth ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										modifier_copyData ( ( ModifierData  * ) psys - > clmd ,  ( ModifierData  * ) psysn - > clmd ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-10 22:32:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										psys - > hair_in_dm  =  psys - > hair_out_dm  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-17 12:46:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-12 23:38:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 23:06:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_duplicatelist ( & psysn - > targets ,  & psys - > targets ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-06 21:31:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									psysn - > pathcache  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									psysn - > childcache  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									psysn - > edit  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									psysn - > pdd  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									psysn - > effectors  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-16 00:55:38 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									psysn - > tree  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-14 11:03:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									psysn - > bvhtree  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-05-11 11:34:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 06:07:10 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_listbase_clear ( & psysn - > pathcachebufs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BLI_listbase_clear ( & psysn - > childcachebufs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-05-11 11:34:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									psysn - > renderdata  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									psysn - > pointcache  =  BKE_ptcache_copy_list ( & psysn - > ptcaches ,  & psys - > ptcaches ,  false ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-04 16:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* XXX - from reading existing code this seems correct but intended usage of
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  pointcache  should  / w  cloth  should  be  added  in  ' ParticleSystem '  -  campbell  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( psysn - > clmd )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										psysn - > clmd - > point_cache  =  psysn - > pointcache ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-04 16:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									id_us_plus ( ( ID  * ) psysn - > part ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  psysn ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_copy_particlesystems ( Object  * obn ,  Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ParticleSystem  * psys ,  * npsys ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ModifierData  * md ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-12 14:35:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( obn - > type  ! =  OB_MESH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* currently only mesh objects can have soft body */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 06:07:10 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_listbase_clear ( & obn - > particlesystem ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( psys  =  ob - > particlesystem . first ;  psys ;  psys  =  psys - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										npsys  =  copy_particlesystem ( psys ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BLI_addtail ( & obn - > particlesystem ,  npsys ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* need to update particle modifiers too */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( md  =  obn - > modifiers . first ;  md ;  md  =  md - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( md - > type  = =  eModifierType_ParticleSystem )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ParticleSystemModifierData  * psmd  =  ( ParticleSystemModifierData  * ) md ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( psmd - > psys  = =  psys ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													psmd - > psys  =  npsys ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else  if  ( md - > type  = =  eModifierType_DynamicPaint )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												DynamicPaintModifierData  * pmd  =  ( DynamicPaintModifierData  * ) md ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-15 13:45:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( pmd - > brush )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( pmd - > brush - > psys  = =  psys )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														pmd - > brush - > psys  =  npsys ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-15 13:45:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else  if  ( md - > type  = =  eModifierType_Smoke )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												SmokeModifierData  * smd  =  ( SmokeModifierData  * )  md ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-03 10:55:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( smd - > type  = =  MOD_SMOKE_TYPE_FLOW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-15 13:45:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( smd - > flow )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( smd - > flow - > psys  = =  psys ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															smd - > flow - > psys  =  npsys ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-15 13:45:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_copy_softbody ( Object  * obn ,  Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > soft ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										obn - > soft  =  copy_softbody ( ob - > soft ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-27 17:04:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  copy_object_pose ( Object  * obn ,  Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bPoseChannel  * chan ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 16:03:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* note: need to clear obn->pose pointer first, so that BKE_pose_copy_data works (otherwise there's a crash) */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obn - > pose  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BKE_pose_copy_data ( & obn - > pose ,  ob - > pose ,  1 ) ;     /* 1 = copy constraints */ 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( chan  =  obn - > pose - > chanbase . first ;  chan ;  chan  =  chan - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bConstraint  * con ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon. 
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too) 
											 
										 
										
											2007-10-21 23:00:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										chan - > flag  & =  ~ ( POSE_LOC  |  POSE_ROT  |  POSE_SIZE ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon. 
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too) 
											 
										 
										
											2007-10-21 23:00:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( con  =  chan - > constraints . first ;  con ;  con  =  con - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-11 11:47:07 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bConstraintTypeInfo  * cti  =  BKE_constraint_typeinfo_get ( con ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon. 
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too) 
											 
										 
										
											2007-10-21 23:00:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ListBase  targets  =  { NULL ,  NULL } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bConstraintTarget  * ct ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( cti  & &  cti - > get_constraint_targets )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												cti - > get_constraint_targets ( con ,  & targets ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( ct  =  targets . first ;  ct ;  ct  =  ct - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2007-10-28 01:01:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ct - > tar  = =  ob ) 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon. 
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too) 
											 
										 
										
											2007-10-21 23:00:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ct - > tar  =  obn ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( cti - > flush_constraint_targets ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													cti - > flush_constraint_targets ( con ,  & targets ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  copy_object_lod ( Object  * obn ,  Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BLI_duplicatelist ( & obn - > lodlevels ,  & ob - > lodlevels ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( obn - > lodlevels . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-18 15:34:56 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										( ( LodLevel  * ) obn - > lodlevels . first ) - > source  =  obn ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-18 15:34:56 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obn - > currentlod  =  ( LodLevel  * ) obn - > lodlevels . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-06-09 21:25:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_object_pose_context_check ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2011-09-14 01:48:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ( ob )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    ( ob - > type  = =  OB_ARMATURE )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    ( ob - > pose )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    ( ob - > mode  &  OB_MODE_POSE ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 01:48:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Object  * BKE_object_pose_armature_get ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2011-09-14 01:48:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob  = =  NULL ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 01:48:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BKE_object_pose_context_check ( ob ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 01:48:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob  =  modifiers_isDeformedByArmature ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 01:48:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BKE_object_pose_context_check ( ob ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 01:48:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-22 15:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_transform_copy ( Object  * ob_tar ,  const  Object  * ob_src )  
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:47:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( ob_tar - > loc ,  ob_src - > loc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( ob_tar - > rot ,  ob_src - > rot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( ob_tar - > quat ,  ob_src - > quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( ob_tar - > rotAxis ,  ob_src - > rotAxis ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob_tar - > rotAngle  =  ob_src - > rotAngle ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob_tar - > rotmode  =  ob_src - > rotmode ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:47:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_v3_v3 ( ob_tar - > size ,  ob_src - > size ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Object  * BKE_object_copy_ex ( Main  * bmain ,  Object  * ob ,  bool  copy_caches )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * obn ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-27 20:16:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ModifierData  * md ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-05 12:46:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obn  =  BKE_libblock_copy_ex ( bmain ,  & ob - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > totcol )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										obn - > mat  =  MEM_dupallocN ( ob - > mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										obn - > matbits  =  MEM_dupallocN ( ob - > matbits ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										obn - > totcol  =  ob - > totcol ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 21:57:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > iuser )  obn - > iuser  =  MEM_dupallocN ( ob - > iuser ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > bb )  obn - > bb  =  MEM_dupallocN ( ob - > bb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									obn - > flag  & =  ~ OB_FROMGROUP ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 06:07:10 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_listbase_clear ( & obn - > modifiers ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-27 20:16:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( md  =  ob - > modifiers . first ;  md ;  md  =  md - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-27 20:16:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ModifierData  * nmd  =  modifier_new ( md - > type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-10 21:23:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_strncpy ( nmd - > name ,  md - > name ,  sizeof ( nmd - > name ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-27 20:16:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										modifier_copyData ( md ,  nmd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BLI_addtail ( & obn - > modifiers ,  nmd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-22 09:41:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 06:07:10 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_listbase_clear ( & obn - > prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_bproperty_copy_list ( & obn - > prop ,  & ob - > prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-22 07:17:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									copy_sensors ( & obn - > sensors ,  & ob - > sensors ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_controllers ( & obn - > controllers ,  & ob - > controllers ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_actuators ( & obn - > actuators ,  & ob - > actuators ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > pose )  { 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										copy_object_pose ( obn ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-04-17 14:26:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* backwards compat... non-armatures can get poses in older files? */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > type  = =  OB_ARMATURE ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 16:03:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_pose_rebuild ( obn ,  obn - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-09-29 16:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-26 13:50:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									defgroup_copy_list ( & obn - > defbase ,  & ob - > defbase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-11 11:47:07 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_constraints_copy ( & obn - > constraints ,  & ob - > constraints ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-26 18:18:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-06-18 16:01:51 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obn - > mode  =  OB_MODE_OBJECT ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-15 18:58:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obn - > sculpt  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2003-04-26 13:07:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* increase user numbers */ 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									id_us_plus ( ( ID  * ) obn - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-08 14:40:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									id_us_plus ( ( ID  * ) obn - > gpd ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-13 16:53:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									id_lib_extern ( ( ID  * ) obn - > dup_group ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-01-05 19:16:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( a  =  0 ;  a  <  obn - > totcol ;  a + + )  id_us_plus ( ( ID  * ) obn - > mat [ a ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > pd )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										obn - > pd  =  MEM_dupallocN ( ob - > pd ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( obn - > pd - > tex ) 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											id_us_plus ( & ( obn - > pd - > tex - > id ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( obn - > pd - > rng ) 
							 
						 
					
						
							
								
									
										
											 
										
											
												Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons) 
  instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group 
  setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
	- "Point" is most like the old effectors and uses the 
	  effector location as the effector point.
	- "Plane" uses the closest point on effectors local xy-plane 
	  as the effector point.
	- "Surface" uses the closest point on an effector object's 
	  surface as the effector point.
	- "Every Point" uses every point in a mesh effector object 
	  as an effector point.
	- The falloff is calculated from this point, so for example 
	  with "surface" shape and "use only negative z axis" it's 
	  possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer 
  just spherical.
* New effector parameter "flow", which makes the effector act as 
  surrounding air velocity, so the resulting force is 
  proportional to the velocity difference of the point and "air 
  velocity". For example a wind field with flow=1.0 results in 
  proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random 
  flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force 
  (note. the z-axis is the surface normal in the case of 
  effector shape "surface")
* New "force field" submenu in add menu, which adds an empty 
  with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector 
  system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for 
  particles, softbody & cloth, since their final effect depends on many external 
  factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through 
  DAG_id_flush_update(..).
  
Known issues
* Curve guides don't yet have all ui buttons in place, but they 
  should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50 
  frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to 
  free pidlists after use :).
											 
										 
										
											2009-09-30 22:10:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											obn - > pd - > rng  =  MEM_dupallocN ( ob - > pd - > rng ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-27 14:37:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obn - > soft  =  copy_softbody ( ob - > soft ,  copy_caches ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-27 21:52:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obn - > bsoft  =  copy_bulletsoftbody ( ob - > bsoft ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-23 05:56:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obn - > rigidbody_object  =  BKE_rigidbody_copy_object ( ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									obn - > rigidbody_constraint  =  BKE_rigidbody_copy_constraint ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-09-18 13:27:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_copy_particlesystems ( obn ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										
											
												Three new features:
1) Stride Bone
For walkcycles, you could already set an NLA strip to cycle over a path
based on a preset distance value. This cycling happens based on a linear
interpolation, with constant speed.
Not all cycles have a constant speed however, like hopping or jumping.
To ensure a perfect slipping-less foot contact, you now can set a Bone
in an Armature to define the stride. This "Stride Bone" then becomes a
sort-of ruler, a conveyor belt, on which the character walks. When using
the NLA "Use Path" option, it then tries to keep the Stride Bone entirely
motionless on the path, by cancelling out its motion (for the entire
Armature). This means that the animation keys for a Stride Bone have to be
exactly negative of the desired path. Only, at choice, the X,Y or Z Ipo
curve is used for this stride.
Examples:
http://www.blender.org/bf/0001_0040.avi
The top armature shows the actual Action, the bottom armature has been
parented to a Path, using the Stride Bone feature.
http://www.blender.org/bf/0001_0080.avi
Here the Stride Bone has a number of children, creating a ruler to be
used as reference while animating.
Test .blend:
http://www.blender.org/bf/motionblender1.blend
Notes:
- Note that action keys for Bones work local, based on the Bone's
  orientation as set in EditMode. Therefore, an Y translation always
  goes in the Bone's direction.
- To be able to get a "solvable" stride, the animation curve has
  to be inverse evaluated, using a Newton Raphson root solver. That
  means you can only create stride curves that keep moving forward, and
  cannot return halfway.
- Set the Stride Bone in the Editing Buttons, Bone Panel. You can set
  change the name or set the axis in the NLA Window, Strip Properties Panel.
- Files in this commit will move to the blender.org release section.
2) Armature Ghosting
In EditButtons, Armature Panel, you can set an armature to draw ghosts.
The number value denotes the amount of frames that have to be drawn extra
(for the active action!) around the current frame.
Ghosts only evaluate its own Pose, executing it's Actions, Constraints and
IK. No external dependencies are re-evaluated for it.
3) NLA/Action time control
If you click in the NLA window on the action (linked to Object), it makes
sure the Timing as drawn in the Action editor is not corrected for NLA.
If you also set the Object to "Action", this timing will be executed on the
Object as well (not NLA time).
(It's a bit confusing... will make a good doc & maybe review UI!)
											 
										 
										
											2005-11-01 12:44:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obn - > derivedDeform  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									obn - > derivedFinal  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-17 05:34:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 06:07:10 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_listbase_clear ( & obn - > gpulamp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BLI_listbase_clear ( & obn - > pc_ids ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-18 04:08:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obn - > mpath  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-17 14:42:47 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_object_lod ( obn ,  ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Copy runtime surve data. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									obn - > curve_cache  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									return  obn ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-09-27 14:37:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* copy objects, will re-initialize cached simulation data */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Object  * BKE_object_copy ( Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  BKE_object_copy_ex ( G . main ,  ob ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-27 14:37:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-08-26 19:11:00 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  extern_local_object__modifiersForeachIDLink (  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        void  * UNUSED ( userData ) ,  Object  * UNUSED ( ob ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ID  * * idpoin ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( * idpoin )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* intentionally omit ID_OB */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ELEM ( GS ( ( * idpoin ) - > name ) ,  ID_IM ,  ID_TE ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id_lib_extern ( * idpoin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-04-26 07:17:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  extern_local_object ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2008-04-30 13:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ParticleSystem  * psys ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												2.5: Blender "Animato" - New Animation System 
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. 
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. 
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) 
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
											 
										 
										
											2009-01-17 03:12:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									id_lib_extern ( ( ID  * ) ob - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-11 03:16:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									id_lib_extern ( ( ID  * ) ob - > dup_group ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-26 07:17:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									id_lib_extern ( ( ID  * ) ob - > poselib ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id_lib_extern ( ( ID  * ) ob - > gpd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									extern_local_matarar ( ob - > mat ,  ob - > totcol ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( psys  =  ob - > particlesystem . first ;  psys ;  psys  =  psys - > next ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-30 13:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										id_lib_extern ( ( ID  * ) psys - > part ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-26 19:11:00 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									modifiers_foreachIDLink ( ob ,  extern_local_object__modifiersForeachIDLink ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_make_local ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  G . main ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Scene  * sce ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Base  * base ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  is_local  =  false ,  is_lib  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2003-04-26 13:07:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* - only lib users: do nothing
 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-26 07:17:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 *  -  only  local  users :  set  flag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  -  mixed :  make  copy 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > id . lib  = =  NULL )  return ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-30 15:54:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > proxy  =  ob - > proxy_from  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > id . us  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 05:34:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										id_clear_lib_data ( bmain ,  & ob - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-23 17:52:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										extern_local_object ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( sce  =  bmain - > scene . first ;  sce  & &  ELEM ( 0 ,  is_lib ,  is_local ) ;  sce  =  sce - > id . next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:33:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( BKE_scene_base_find ( sce ,  ob ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( sce - > id . lib )  is_lib  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  is_local  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-26 07:17:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( is_local  & &  is_lib  = =  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 05:34:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											id_clear_lib_data ( bmain ,  & ob - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-23 17:52:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											extern_local_object ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else  if  ( is_local  & &  is_lib )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Object  * ob_new  =  BKE_object_copy ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 05:34:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ob_new - > id . us  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 05:34:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* Remap paths of new ID using old library as base. */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-30 00:32:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_id_lib_local_paths ( bmain ,  ob - > id . lib ,  & ob_new - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 05:34:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											sce  =  bmain - > scene . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											while  ( sce )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( sce - > id . lib  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													base  =  sce - > base . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													while  ( base )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( base - > object  = =  ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															base - > object  =  ob_new ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-30 00:32:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															ob_new - > id . us + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
															ob - > id . us - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														base  =  base - > next ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												sce  =  sce - > id . next ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-19 00:49:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/*
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Returns  true  if  the  Object  is  a  from  an  external  blend  file  ( libdata ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_object_is_libdata ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2009-07-19 00:49:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! ob )  return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > proxy )  return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > id . lib )  return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-19 00:49:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Returns true if the Object data is a from an external blend file (libdata) */  
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_object_obdata_is_libdata ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! ob )  return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > proxy  & &  ( ob - > data  = =  NULL  | |  ( ( ID  * ) ob - > data ) - > lib  = =  NULL ) )  return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > id . lib )  return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > data  = =  NULL )  return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ( ( ID  * ) ob - > data ) - > lib )  return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* *************** PROXY **************** */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-11-15 12:15:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* when you make proxy, ensure the exposed layers are extern */  
						 
					
						
							
								
									
										
										
										
											2009-09-14 16:52:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  armature_set_id_extern ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2007-11-15 12:15:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bArmature  * arm  =  ob - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2007-11-15 12:15:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bPoseChannel  * pchan ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									unsigned  int  lay  =  arm - > layer_protected ; 
							 
						 
					
						
							
								
									
										
										
										
											2007-11-15 12:15:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( pchan  =  ob - > pose - > chanbase . first ;  pchan ;  pchan  =  pchan - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! ( pchan - > bone - > layer  &  lay ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-11-15 12:15:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											id_lib_extern ( ( ID  * ) pchan - > custom ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_copy_proxy_drivers ( Object  * ob ,  Object  * target )  
						 
					
						
							
								
									
										
										
										
											2010-01-20 14:28:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ( target - > adt )  & &  ( target - > adt - > drivers . first ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										FCurve  * fcu ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* add new animdata block */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! ob - > adt ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ob - > adt  =  BKE_id_add_animdata ( & ob - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 14:28:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* make a copy of all the drivers (for now), then correct any links that need fixing */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										free_fcurves ( & ob - > adt - > drivers ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										copy_fcurves ( & ob - > adt - > drivers ,  & target - > adt - > drivers ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( fcu  =  ob - > adt - > drivers . first ;  fcu ;  fcu  =  fcu - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ChannelDriver  * driver  =  fcu - > driver ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 14:28:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											DriverVar  * dvar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( dvar  =  driver - > variables . first ;  dvar ;  dvar  =  dvar - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 14:28:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* all drivers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												DRIVER_TARGETS_LOOPER ( dvar )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( dtar - > id )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-25 00:19:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ( Object  * ) dtar - > id  = =  target ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															dtar - > id  =  ( ID  * ) ob ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-25 00:19:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-25 22:37:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															/* only on local objects because this causes indirect links
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															 *  ' a  - >  b  - >  c ' ,  blend  to  point  directly  to  a . blend 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-25 00:19:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															 *  when  a . blend  has  a  proxy  thats  linked  into  c . blend   */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															if  ( ob - > id . lib  = =  NULL ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-25 00:19:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																id_lib_extern ( ( ID  * ) dtar - > id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 14:28:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												DRIVER_TARGETS_LOOPER_END 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2006-11-30 15:54:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* proxy rule: lib_object->proxy_from == the one we borrow from, set temporally while object_update */  
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/*             local_object->proxy == pointer to library object, saved in files and read */  
						 
					
						
							
								
									
										
										
										
											2006-11-14 15:27:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/*             local_object->proxy_group == pointer to group dupli-object, saved in files and read */  
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_make_proxy ( Object  * ob ,  Object  * target ,  Object  * gob )  
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* paranoia checks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > id . lib  | |  target - > id . lib  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										printf ( " cannot make proxy \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > proxy  =  target ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > proxy_group  =  gob ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-14 15:27:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									id_lib_extern ( & target - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2013-02-21 19:33:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_id_tag_update ( & ob - > id ,  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DAG_id_tag_update ( & target - > id ,  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:47:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* copy transform
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  -  gob  means  this  proxy  comes  from  a  group ,  just  apply  the  matrix 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *    so  the  object  wont  move  from  its  dupli - transform . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  -  no  gob  means  this  is  being  made  from  a  linked  object , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *    this  is  closer  to  making  a  copy  of  the  object  -  in - place .  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( gob )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > rotmode  =  target - > rotmode ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-26 18:36:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										mul_m4_m4m4 ( ob - > obmat ,  gob - > obmat ,  target - > obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( gob - > dup_group )  {  /* should always be true */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-28 17:19:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											float  tvec [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											copy_v3_v3 ( tvec ,  gob - > dup_group - > dupli_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											mul_mat3_m4_v3 ( ob - > obmat ,  tvec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											sub_v3_v3 ( ob - > obmat [ 3 ] ,  tvec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-02 01:36:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_object_apply_mat4 ( ob ,  ob - > obmat ,  false ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-14 15:27:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-22 15:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_object_transform_copy ( ob ,  target ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > parent  =  target - > parent ;  /* libdata */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:47:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										copy_m4_m4 ( ob - > parentinv ,  target - > parentinv ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-14 15:27:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-08-03 12:11:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* copy animdata stuff - drivers only for now... */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_copy_proxy_drivers ( ob ,  target ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 14:28:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-08-03 12:11:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* skip constraints? */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-06 23:56:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* FIXME: this is considered by many as a bug */ 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2008-04-19 11:23:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* set object type and link to data */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > type  =  target - > type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > data  =  target - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id_us_plus ( ( ID  * ) ob - > data ) ;      /* ensures lib data becomes LIB_EXTERN */ 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2008-04-19 11:23:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* copy material and index information */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > actcol  =  ob - > totcol  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > mat )  MEM_freeN ( ob - > mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > matbits )  MEM_freeN ( ob - > matbits ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-19 11:23:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > mat  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > matbits  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 17:29:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ( target - > totcol )  & &  ( target - > mat )  & &  OB_TYPE_SUPPORT_MATERIAL ( ob - > type ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-19 11:23:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > actcol  =  target - > actcol ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > totcol  =  target - > totcol ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-19 11:23:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > mat  =  MEM_dupallocN ( target - > mat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 00:40:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > matbits  =  MEM_dupallocN ( target - > matbits ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( i  =  0 ;  i  <  target - > totcol ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-18 07:38:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* don't need to run test_object_materials since we know this object is new and not used elsewhere */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-23 14:04:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											id_us_plus ( ( ID  * ) ob - > mat [ i ] ) ;  
							 
						 
					
						
							
								
									
										
										
										
											2008-04-19 11:23:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* type conversions */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( target - > type  = =  OB_ARMATURE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										copy_object_pose ( ob ,  target ) ;    /* data copy, object pointers in constraints */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_pose_rest ( ob - > pose ) ;             /* clear all transforms in channels */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_pose_rebuild ( ob ,  ob - > data ) ;  /* set all internal links */ 
							 
						 
					
						
							
								
									
										
										
										
											2007-11-15 12:15:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										armature_set_id_extern ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-03 00:13:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( target - > type  = =  OB_EMPTY )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > empty_drawtype  =  target - > empty_drawtype ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > empty_drawsize  =  target - > empty_drawsize ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-01 21:24:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* copy IDProperties */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > id . properties )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-01 21:24:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										IDP_FreeProperty ( ob - > id . properties ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MEM_freeN ( ob - > id . properties ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > id . properties  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-01 21:24:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( target - > id . properties )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > id . properties  =  IDP_CopyProperty ( target - > id . properties ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-01 21:24:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-08-03 12:11:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* copy drawtype info */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > dt  =  target - > dt ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-09-01 20:09:31 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/**
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Use  with  newly  created  objects  to  set  their  size 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  ( used  to  apply  scene - scale ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  BKE_object_obdata_size_init ( struct  Object  * ob ,  const  float  size )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* apply radius as a scale to types that support it */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( ob - > type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_EMPTY : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > empty_drawsize  * =  size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_FONT : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Curve  * cu  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											cu - > fsize  * =  size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_CAMERA : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Camera  * cam  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											cam - > drawsize  * =  size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_LAMP : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Lamp  * lamp  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											lamp - > dist  * =  size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											lamp - > area_size   * =  size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											lamp - > area_sizey  * =  size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											lamp - > area_sizez  * =  size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* Only lattice (not mesh, curve, mball...),
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 *  because  its  got  data  when  newly  added  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_LATTICE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											struct  Lattice  * lt  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  mat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											unit_m4 ( mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											scale_m4_fl ( mat ,  size ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											BKE_lattice_transform ( lt ,  ( float  ( * ) [ 4 ] ) mat ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/* *************** CALC ****************** */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-12-11 14:29:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_scale_to_mat3 ( Object  * ob ,  float  mat [ 3 ] [ 3 ] )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2008-09-29 20:13:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  vec [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-04 03:35:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									mul_v3_v3v3 ( vec ,  ob - > size ,  ob - > dscale ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 15:47:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									size_to_mat3 ( mat ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-29 20:13:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-24 12:13:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_rot_to_mat3 ( Object  * ob ,  float  mat [ 3 ] [ 3 ] ,  bool  use_drot )  
						 
					
						
							
								
									
										
										
										
											2008-09-29 20:13:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-09-28 10:19:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  rmat [ 3 ] [ 3 ] ,  dmat [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2011-05-14 05:42:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* 'dmat' is the delta-rotation matrix, which will get (pre)multiplied
 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 10:19:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 *  with  the  rotation  matrix  to  yield  the  appropriate  rotation 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-14 05:42:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 10:19:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* rotations may either be quats, eulers (with various rotation orders), or axis-angle */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > rotmode  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* euler rotations (will cause gimble lock, but this can be alleviated a bit with rotation orders) */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-14 05:42:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										eulO_to_mat3 ( rmat ,  ob - > rot ,  ob - > rotmode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										eulO_to_mat3 ( dmat ,  ob - > drot ,  ob - > rotmode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 10:19:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if  ( ob - > rotmode  = =  ROT_MODE_AXISANGLE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-23 23:22:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* axis-angle - not really that great for 3D-changing orientations */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-14 05:42:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										axis_angle_to_mat3 ( rmat ,  ob - > rotAxis ,  ob - > rotAngle ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										axis_angle_to_mat3 ( dmat ,  ob - > drotAxis ,  ob - > drotAngle ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 10:19:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-03 19:09:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* quats are normalized before use to eliminate scaling issues */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-07 01:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  tquat [ 4 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-16 09:59:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-12-07 01:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										normalize_qt_qt ( tquat ,  ob - > quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										quat_to_mat3 ( rmat ,  tquat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-16 09:59:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 15:02:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										normalize_qt_qt ( tquat ,  ob - > dquat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-07 01:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										quat_to_mat3 ( dmat ,  tquat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 10:19:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 11:45:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 10:19:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* combine these rotations */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-18 01:46:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( use_drot ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-17 21:40:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										mul_m3_m3m3 ( mat ,  dmat ,  rmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										copy_m3_m3 ( mat ,  rmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-29 20:13:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-24 12:13:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_mat3_to_rot ( Object  * ob ,  float  mat [ 3 ] [ 3 ] ,  bool  use_compat )  
						 
					
						
							
								
									
										
										
										
											2009-12-19 10:27:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 06:31:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( ob - > rotmode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  ROT_MODE_QUAT : 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-02 01:01:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  dquat [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											mat3_to_quat ( ob - > quat ,  mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											normalize_qt_qt ( dquat ,  ob - > dquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											invert_qt ( dquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											mul_qt_qtqt ( ob - > quat ,  dquat ,  ob - > quat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-19 15:23:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-02 01:01:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  ROT_MODE_AXISANGLE : 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-19 15:23:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											mat3_to_axis_angle ( ob - > rotAxis ,  & ob - > rotAngle ,  mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											sub_v3_v3 ( ob - > rotAxis ,  ob - > drotAxis ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > rotAngle  - =  ob - > drotAngle ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-19 15:23:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										default :  /* euler */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-14 04:59:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  quat [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  dquat [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  tmat [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* without drot we could apply 'mat' directly */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											mat3_to_quat ( quat ,  mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											eulO_to_quat ( dquat ,  ob - > drot ,  ob - > rotmode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											invert_qt ( dquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											mul_qt_qtqt ( quat ,  dquat ,  quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											quat_to_mat3 ( tmat ,  quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* end drot correction */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( use_compat )  mat3_to_compatible_eulO ( ob - > rot ,  ob - > rot ,  ob - > rotmode ,  tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-25 12:55:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else             mat3_to_eulO ( ob - > rot ,  ob - > rotmode ,  tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-21 08:16:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-14 04:59:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-19 10:27:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_tfm_protected_backup ( const  Object  * ob ,  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                     ObjectTfmProtectedChannels  * obtfm ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-11 05:34:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# define TFMCPY(_v) (obtfm->_v = ob->_v) 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define TFMCPY3D(_v) copy_v3_v3(obtfm->_v, ob->_v) 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define TFMCPY4D(_v) copy_v4_v4(obtfm->_v, ob->_v) 
  
						 
					
						
							
								
									
										
										
										
											2011-11-11 05:34:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TFMCPY3D ( loc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TFMCPY3D ( dloc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TFMCPY3D ( size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-04 03:35:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TFMCPY3D ( dscale ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-11 05:34:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TFMCPY3D ( rot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TFMCPY3D ( drot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TFMCPY4D ( quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TFMCPY4D ( dquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TFMCPY3D ( rotAxis ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TFMCPY3D ( drotAxis ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TFMCPY ( rotAngle ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TFMCPY ( drotAngle ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# undef TFMCPY 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# undef TFMCPY3D 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# undef TFMCPY4D 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_tfm_protected_restore ( Object  * ob ,  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                      const  ObjectTfmProtectedChannels  * obtfm , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                      const  short  protectflag ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-11 05:34:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unsigned  int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  3 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( protectflag  &  ( OB_LOCK_LOCX  < <  i ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > loc [ i ]  =   obtfm - > loc [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > dloc [ i ]  =  obtfm - > dloc [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-11 05:34:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( protectflag  &  ( OB_LOCK_SCALEX  < <  i ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > size [ i ]  =   obtfm - > size [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > dscale [ i ]  =  obtfm - > dscale [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-11 05:34:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( protectflag  &  ( OB_LOCK_ROTX  < <  i ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > rot [ i ]  =   obtfm - > rot [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > drot [ i ]  =  obtfm - > drot [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-11 05:34:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ob - > quat [ i  +  1 ]  =   obtfm - > quat [ i  +  1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > dquat [ i  +  1 ]  =  obtfm - > dquat [ i  +  1 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-11 05:34:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ob - > rotAxis [ i ]  =   obtfm - > rotAxis [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > drotAxis [ i ]  =  obtfm - > drotAxis [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-11 05:34:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ( protectflag  &  OB_LOCK_ROT4D )  & &  ( protectflag  &  OB_LOCK_ROTW ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > quat [ 0 ]  =   obtfm - > quat [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > dquat [ 0 ]  =  obtfm - > dquat [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-11 05:34:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > rotAngle  =   obtfm - > rotAngle ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > drotAngle  =  obtfm - > drotAngle ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-11 05:34:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-12-11 14:29:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_to_mat3 ( Object  * ob ,  float  mat [ 3 ] [ 3 ] )  /* no parent */  
						 
					
						
							
								
									
										
										
										
											2008-09-29 20:13:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  smat [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  rmat [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/*float q1[4];*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* size */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_scale_to_mat3 ( ob ,  smat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* rot */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_rot_to_mat3 ( ob ,  rmat ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									mul_m3_m3m3 ( mat ,  rmat ,  smat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-12-11 14:29:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_to_mat4 ( Object  * ob ,  float  mat [ 4 ] [ 4 ] )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  tmat [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_to_mat3 ( ob ,  tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_m4_m3 ( mat ,  tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-03 17:47:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_v3_v3v3 ( mat [ 3 ] ,  ob - > loc ,  ob - > dloc ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-12 12:58:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_matrix_local_get ( struct  Object  * ob ,  float  mat [ 4 ] [ 4 ] )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > parent )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  invmat [ 4 ] [ 4 ] ;  /* for inverse of parent's matrix */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										invert_m4_m4 ( invmat ,  ob - > parent - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										mul_m4_m4m4 ( mat ,  invmat ,  ob - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										copy_m4_m4 ( mat ,  ob - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-14 17:55:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* extern */  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  enable_cu_speed  =  1 ;  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-12-11 14:29:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  ob_parcurve ( Scene  * scene ,  Object  * ob ,  Object  * par ,  float  mat [ 4 ] [ 4 ] )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Curve  * cu ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-10 07:01:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  vec [ 4 ] ,  dir [ 3 ] ,  quat [ 4 ] ,  radius ,  ctime ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									unit_m4 ( mat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cu  =  par - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-20 01:30:29 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ELEM ( NULL ,  par - > curve_cache ,  par - > curve_cache - > path ,  par - > curve_cache - > path - > data ) )  /* only happens on reload file, but violates depsgraph still... fix! */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 06:58:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_displist_make_curveTypes ( scene ,  par ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( par - > curve_cache - > path  = =  NULL )  return ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-02-11 12:42:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2005-11-15 22:39:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* catch exceptions: feature for nla stride editing */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > ipoflag  &  OB_DISABLE_PATH )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ctime  =  0.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-15 22:39:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2003-04-26 13:07:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* catch exceptions: curve paths used as a duplicator */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( enable_cu_speed )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-20 11:44:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 *  but  this  will  only  work  if  it  actually  is  animated . . .  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 * 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 06:25:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 *  we  divide  the  curvetime  calculated  in  the  previous  step  by  the  length  of  the  path ,  to  get  a  time 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 *  factor ,  which  then  gets  clamped  to  lie  within  0.0  -  1.0  range 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-20 11:44:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-04 10:15:25 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( cu - > pathlen )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ctime  =  cu - > ctime  /  cu - > pathlen ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-04 10:15:25 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ctime  =  cu - > ctime ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-04 10:15:25 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 23:11:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CLAMP ( ctime ,  0.0f ,  1.0f ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-27 16:45:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ctime  =  BKE_scene_frame_get ( scene ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-04 10:15:25 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( cu - > pathlen )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-16 21:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ctime  / =  cu - > pathlen ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-04 10:15:25 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 23:11:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										CLAMP ( ctime ,  0.0f ,  1.0f ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2005-02-11 12:42:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2004-11-21 10:42:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* vec: 4 items! */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( where_on_path ( par ,  ctime ,  vec ,  dir ,  cu - > flag  &  CU_FOLLOW  ?  quat  :  NULL ,  & radius ,  NULL ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( cu - > flag  &  CU_FOLLOW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 07:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#if 0 
  
						 
					
						
							
								
									
										
										
										
											2012-07-22 18:40:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											float  si ,  q [ 4 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 15:47:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											vec_to_quat ( quat ,  dir ,  ob - > trackflag ,  ob - > upflag ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2004-09-14 19:03:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* the tilt */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											normalize_v3 ( dir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-04 04:22:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											q [ 0 ]  =  cosf ( 0.5  *  vec [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											si  =  sinf ( 0.5  *  vec [ 3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-22 18:40:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											q [ 1 ]  =  - si  *  dir [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											q [ 2 ]  =  - si  *  dir [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											q [ 3 ]  =  - si  *  dir [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											mul_qt_qtqt ( quat ,  q ,  quat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 07:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# else 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											quat_apply_track ( quat ,  ob - > trackflag ,  ob - > upflag ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2010-12-07 01:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											normalize_qt ( quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											quat_to_mat4 ( mat ,  quat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( cu - > flag  &  CU_PATH_RADIUS )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-12 16:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											float  tmat [ 4 ] [ 4 ] ,  rmat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											scale_m4_fl ( tmat ,  radius ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-26 18:36:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											mul_m4_m4m4 ( rmat ,  tmat ,  mat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											copy_m4_m4 ( mat ,  rmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-12 16:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-06 08:27:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										copy_v3_v3 ( mat [ 3 ] ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-12-11 14:29:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  ob_parbone ( Object  * ob ,  Object  * par ,  float  mat [ 4 ] [ 4 ] )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ 	 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bPoseChannel  * pchan ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  vec [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( par - > type  ! =  OB_ARMATURE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										unit_m4 ( mat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									/* Make sure the bone is still valid */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									pchan  =  BKE_pose_channel_find_name ( par - > pose ,  ob - > parsubstr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-04 12:13:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! pchan  | |  ! pchan - > bone )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										printf ( " Object %s with Bone parent: bone %s doesn't exist \n " ,  ob - > id . name  +  2 ,  ob - > parsubstr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										unit_m4 ( mat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* get bone transform */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-22 11:08:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( pchan - > bone - > flag  &  BONE_RELATIVE_PARENTING )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* the new option uses the root - expected bahaviour, but differs from old... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* XXX check on version patching? */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-21 12:07:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										copy_m4_m4 ( mat ,  pchan - > chan_mat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-22 11:08:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-21 12:07:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										copy_m4_m4 ( mat ,  pchan - > pose_mat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-12-22 11:08:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* but for backwards compatibility, the child has to move to the tail */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										copy_v3_v3 ( vec ,  mat [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										mul_v3_fl ( vec ,  pchan - > bone - > length ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_v3_v3 ( mat [ 3 ] ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-28 14:05:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  give_parvert ( Object  * par ,  int  nr ,  float  vec [ 3 ] )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-09-15 06:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									zero_v3 ( vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( par - > type  = =  OB_MESH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Mesh  * me  =  par - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 16:19:51 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BMEditMesh  * em  =  me - > edit_btmesh ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-28 16:47:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										DerivedMesh  * dm ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-30 07:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										dm  =  ( em )  ?  em - > derivedFinal  :  par - > derivedFinal ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-09-08 12:05:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( dm )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  count  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  numVerts  =  dm - > getNumVerts ( dm ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( nr  <  numVerts )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-31 20:06:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												bool  use_special_ss_case  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-31 20:06:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( dm - > type  = =  DM_TYPE_CCGDM )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ModifierData  * md ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													VirtualModifierData  virtualModifierData ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													use_special_ss_case  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( md  =  modifiers_getVirtualModifierList ( par ,  & virtualModifierData ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													     md  ! =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													     md  =  md - > next ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ModifierTypeInfo  * mti  =  modifierType_getInfo ( md - > type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														/* TODO(sergey): Check for disabled modifiers. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( mti - > type  ! =  eModifierTypeType_OnlyDeform  & &  md - > next  ! =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															use_special_ss_case  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-31 20:15:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ! use_special_ss_case )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* avoid dm->getVertDataArray() since it allocates arrays in the dm (not thread safe) */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( em  & &  dm - > type  = =  DM_TYPE_EDITBMESH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( em - > bm - > elem_table_dirty  &  BM_VERT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# ifdef VPARENT_THREADING_HACK 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															BLI_mutex_lock ( & vparent_lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( em - > bm - > elem_table_dirty  &  BM_VERT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																BM_mesh_elem_table_ensure ( em - > bm ,  BM_VERT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															BLI_mutex_unlock ( & vparent_lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# else 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															BLI_assert ( ! " Not safe for threading " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															BM_mesh_elem_table_ensure ( em - > bm ,  BM_VERT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-31 20:06:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( use_special_ss_case )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* Special case if the last modifier is SS and no constructive modifier
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													 *  are  in  front  of  it . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													CCGDerivedMesh  * ccgdm  =  ( CCGDerivedMesh  * ) dm ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													CCGVert  * ccg_vert  =  ccgSubSurf_getVert ( ccgdm - > ss ,  SET_INT_IN_POINTER ( nr ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  * co  =  ccgSubSurf_getVertData ( ccgdm - > ss ,  ccg_vert ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													add_v3_v3 ( vec ,  co ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													count + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-31 20:15:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												else  if  ( CustomData_has_layer ( & dm - > vertData ,  CD_ORIGINDEX )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												         ! ( em  & &  dm - > type  = =  DM_TYPE_EDITBMESH ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-31 20:06:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													/* Get the average of all verts with (original index == nr). */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													for  ( i  =  0 ;  i  <  numVerts ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 16:19:51 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														const  int  * index  =  dm - > getVertData ( dm ,  i ,  CD_ORIGINDEX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( * index  = =  nr )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															float  co [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															dm - > getVertCo ( dm ,  i ,  co ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															add_v3_v3 ( vec ,  co ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															count + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( nr  <  numVerts )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 16:19:51 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														float  co [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														dm - > getVertCo ( dm ,  nr ,  co ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														add_v3_v3 ( vec ,  co ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														count + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2007-05-04 16:36:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( count  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 15:47:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* keep as 0, 0, 0 */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:18:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  if  ( count  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-28 16:47:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												mul_v3_fl ( vec ,  1.0f  /  count ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:18:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-28 16:47:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* use first index if its out of range */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												dm - > getVertCo ( dm ,  0 ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-16 18:26:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-25 22:37:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											fprintf ( stderr , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											        " %s: DerivedMesh is needed to solve parenting,  " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											        " object position can be wrong now \n " ,  __func__ ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-02 19:10:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( ELEM ( par - > type ,  OB_CURVE ,  OB_SURF ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-21 14:44:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ListBase  * nurb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* Unless there's some weird depsgraph failure the cache should exist. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BLI_assert ( par - > curve_cache  ! =  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( par - > curve_cache - > deformed_nurbs . first  ! =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											nurb  =  & par - > curve_cache - > deformed_nurbs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Curve  * cu  =  par - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											nurb  =  BKE_curve_nurbs_get ( cu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_nurbList_index_get_co ( nurb ,  nr ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( par - > type  = =  OB_LATTICE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Lattice  * latt   =  par - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										DispList  * dl    =  par - > curve_cache  ?  BKE_displist_find ( & par - > curve_cache - > disp ,  DL_VERTS )  :  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  ( * co ) [ 3 ]  =  dl  ?  ( float  ( * ) [ 3 ] ) dl - > verts  :  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  tot ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( latt - > editlatt )  latt  =  latt - > editlatt - > latt ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										tot  =  latt - > pntsu  *  latt - > pntsv  *  latt - > pntsw ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* ensure dl is correct size */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BLI_assert ( dl  = =  NULL  | |  dl - > nr  = =  tot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( nr  <  tot )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( co )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												copy_v3_v3 ( vec ,  co [ nr ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												copy_v3_v3 ( vec ,  latt - > def [ nr ] . vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-09-08 12:05:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-12-11 14:29:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  ob_parvert3 ( Object  * ob ,  Object  * par ,  float  mat [ 4 ] [ 4 ] )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2003-04-26 13:07:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* in local ob space */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:38:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( OB_TYPE_SUPPORT_PARVERT ( par - > type ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  cmat [ 3 ] [ 3 ] ,  v1 [ 3 ] ,  v2 [ 3 ] ,  v3 [ 3 ] ,  q [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										give_parvert ( par ,  ob - > par1 ,  v1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										give_parvert ( par ,  ob - > par2 ,  v2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										give_parvert ( par ,  ob - > par3 ,  v3 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:38:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 15:47:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										tri_to_quat ( q ,  v1 ,  v2 ,  v3 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										quat_to_mat3 ( cmat ,  q ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										copy_m4_m3 ( mat ,  cmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:38:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										mid_v3_v3v3v3 ( mat [ 3 ] ,  v1 ,  v2 ,  v3 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										unit_m4 ( mat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  ob_get_parent_matrix ( Scene  * scene ,  Object  * ob ,  Object  * par ,  float  parentmat [ 4 ] [ 4 ] )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  tmat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  vec [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-11 11:25:41 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  ok ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 06:31:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( ob - > partype  &  PARTYPE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  PAROBJECT : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ok  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( par - > type  = =  OB_CURVE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( scene  & &  ( ( Curve  * ) par - > data ) - > flag  &  CU_PATH )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ob_parcurve ( scene ,  ob ,  par ,  tmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ok  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-07 05:39:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ok )  mul_m4_m4m4 ( parentmat ,  par - > obmat ,  tmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  copy_m4_m4 ( parentmat ,  par - > obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-07 05:39:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  PARBONE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob_parbone ( ob ,  par ,  tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											mul_m4_m4m4 ( parentmat ,  par - > obmat ,  tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  PARVERT1 : 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											unit_m4 ( parentmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											give_parvert ( par ,  ob - > par1 ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											mul_v3_m4v3 ( parentmat [ 3 ] ,  par - > obmat ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  PARVERT3 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob_parvert3 ( ob ,  par ,  tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-07 05:39:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											mul_m4_m4m4 ( parentmat ,  par - > obmat ,  tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  PARSKEL : 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											copy_m4_m4 ( parentmat ,  par - > obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  \ param  r_originmat   Optional  matrix  that  stores  the  space  the  object  is  in  ( without  its  own  matrix  applied ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  solve_parenting ( Scene  * scene ,  Object  * ob ,  Object  * par ,  float  obmat [ 4 ] [ 4 ] ,  float  slowmat [ 4 ] [ 4 ] ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            float  r_originmat [ 3 ] [ 3 ] ,  const  bool  set_origin ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  totmat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  tmat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  locmat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BKE_object_to_mat4 ( ob ,  locmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > partype  &  PARSLOW )  copy_m4_m4 ( slowmat ,  obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob_get_parent_matrix ( scene ,  ob ,  par ,  totmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-07-07 22:51:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* total */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-06 01:45:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									mul_m4_m4m4 ( tmat ,  totmat ,  ob - > parentinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									mul_m4_m4m4 ( obmat ,  tmat ,  locmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( r_originmat )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* usable originmat */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										copy_m3_m4 ( r_originmat ,  tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* origin, for help line */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( set_origin )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ( ob - > partype  &  PARTYPE )  = =  PARSKEL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 12:40:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											copy_v3_v3 ( ob - > orig ,  par - > obmat [ 3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 12:40:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											copy_v3_v3 ( ob - > orig ,  totmat [ 3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-07 05:39:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-05 22:36:15 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  bool  where_is_object_parslow ( Object  * ob ,  float  obmat [ 4 ] [ 4 ] ,  float  slowmat [ 4 ] [ 4 ] )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  * fp1 ,  * fp2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  fac1 ,  fac2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-07-06 23:56:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* include framerate */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-27 09:49:31 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fac1  =  ( 1.0f  /  ( 1.0f  +  fabsf ( ob - > sf ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( fac1  > =  1.0f )  return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fac2  =  1.0f  -  fac1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fp1  =  obmat [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fp2  =  slowmat [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( a  =  0 ;  a  <  16 ;  a + + ,  fp1 + + ,  fp2 + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										fp1 [ 0 ]  =  fac1  *  fp1 [ 0 ]  +  fac2  *  fp2 [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 16:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* note, scene is the active scene while actual_scene is the scene the object resides in */  
						 
					
						
							
								
									
										
										
										
											2013-02-17 03:57:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_where_is_calc_time_ex ( Scene  * scene ,  Object  * ob ,  float  ctime ,  
						 
					
						
							
								
									
										
										
										
											2013-07-12 11:18:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                      RigidBodyWorld  * rbw ,  float  r_originmat [ 3 ] [ 3 ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob  = =  NULL )  return ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-22 19:24:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										
											
												2.5: Blender "Animato" - New Animation System 
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. 
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. 
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) 
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
											 
										 
										
											2009-01-17 03:12:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* execute drivers only, as animation has already been done */ 
							 
						 
					
						
							
								
									
										
											 
										
											
												== RNA Property Updates get called by Animation System now ==
This fixes bug #26764 and several others like it, where modifier
properties (and others, but most visibly modifiers) would not do
anything when animated or driven, as modifier properties require the
RNA update calls to tag the modifiers to get recalculated.
While just adding a call to RNA_property_update() could have gotten
this working (as per the Campbell's patch attached in the report, and
also my own attempt #25881). However, on production rigs, the
performance cost of this is untenatable (on my own tests, without
these updates, I was getting ~5fps on such a rig, but only 0.9fps or
possibly even worse with the updates added).
Hence, this commit adds a property-update caching system to the RNA
level, which aims to reduce to the number of times that the update
functions end up needing to get called.
While this is much faster than without the caching, I also added an
optimisation for pose bones (which are numerous in production rigs) so
that their property updates are skipped, since they are useless to the
animsys (they only tag the depsgraph for updating). This gets things
moving at a more acceptable framerate.
											 
										 
										
											2011-07-24 04:34:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_animsys_evaluate_animdata ( scene ,  & ob - > id ,  ob - > adt ,  ctime ,  ADT_RECALC_DRIVERS ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
  to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
											 
										 
										
											2005-10-02 20:51:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > parent )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Object  * par  =  ob - > parent ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-29 18:12:44 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  slowmat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-06-07 05:29:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* calculate parent matrix */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										solve_parenting ( scene ,  ob ,  par ,  ob - > obmat ,  slowmat ,  r_originmat ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2011-11-06 05:46:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* "slow parent" is definitely not threadsafe, and may also give bad results jumping around 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 *  An  old - fashioned  hack  which  probably  doesn ' t  really  cut  it  anymore 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > partype  &  PARSLOW )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! where_is_object_parslow ( ob ,  ob - > obmat ,  slowmat ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_object_to_mat4 ( ob ,  ob - > obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										
											
												Bugfix [#33970] Background Scene does not show animation of rigid body objects
This was caused by multiple instantiations of the same basic problem. The
rigidbody handling code often assumed that "scene" pointers referred to the
scene where an object participating in the sim resided (and where the rigidbody
world for that sim lived). However, when dealing with background sets, "scene"
often only refers to the active scene, and not the set that the object actually
came from. Hence, the rigidbody code would often (wrongly) conclude that there
was nothing to do.
For example, we may have the following backgound set/scene chaining scenario:
"active"  <-- ... <-- set i (rigidbody objects live here) <-- ... <-- set n
The fix here is a multi-part fix:
1) Moved sim-world calculation from BKE_scene_update_newframe() to
scene_update_tagged_recursive()
    + This is currently the only way that rigidbody sims in background sets will
get calculated, as part of the recursion
     - These checks will get run on each update. <--- FIXME!!!
2) Tweaked depsgraph code so that when checking if there are any time-dependent
features on objects to tag for updating, the checking is done relative to the
scene that the object actually resides in (and not the active scene). Otherwise,
even if we recalculate the sim, the affected objects won't get tagged for
updating. This tagging is needed to actually flush the transforms out of the
RigidBodyObject structs (written by the sim/cache) and into the Object
transforms (obmat's)
3) Removed the requirement for rigidbody world to actually exist before we can
flush rigidbody transforms. In many cases, it should be sufficient to assume
that because the object with rigidbody data attached has been tagged for
updates, it should have updates to perform. Of course, we still check on this
data if we've got it, but that's only if the sim is in the active scene.
   - TODO: if we have further problems, we should investigate passing the
"actual" scene down alongside the "active" scene for BKE_object_handle_update().
											 
										 
										
											2013-02-15 11:49:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 19:38:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* try to fall back to the scene rigid body world if none given */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rbw  =  rbw  ?  rbw  :  scene - > rigidbody_world ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Bugfix [#33970] Background Scene does not show animation of rigid body objects
This was caused by multiple instantiations of the same basic problem. The
rigidbody handling code often assumed that "scene" pointers referred to the
scene where an object participating in the sim resided (and where the rigidbody
world for that sim lived). However, when dealing with background sets, "scene"
often only refers to the active scene, and not the set that the object actually
came from. Hence, the rigidbody code would often (wrongly) conclude that there
was nothing to do.
For example, we may have the following backgound set/scene chaining scenario:
"active"  <-- ... <-- set i (rigidbody objects live here) <-- ... <-- set n
The fix here is a multi-part fix:
1) Moved sim-world calculation from BKE_scene_update_newframe() to
scene_update_tagged_recursive()
    + This is currently the only way that rigidbody sims in background sets will
get calculated, as part of the recursion
     - These checks will get run on each update. <--- FIXME!!!
2) Tweaked depsgraph code so that when checking if there are any time-dependent
features on objects to tag for updating, the checking is done relative to the
scene that the object actually resides in (and not the active scene). Otherwise,
even if we recalculate the sim, the affected objects won't get tagged for
updating. This tagging is needed to actually flush the transforms out of the
RigidBodyObject structs (written by the sim/cache) and into the Object
transforms (obmat's)
3) Removed the requirement for rigidbody world to actually exist before we can
flush rigidbody transforms. In many cases, it should be sufficient to assume
that because the object with rigidbody data attached has been tagged for
updates, it should have updates to perform. Of course, we still check on this
data if we've got it, but that's only if the sim is in the active scene.
   - TODO: if we have further problems, we should investigate passing the
"actual" scene down alongside the "active" scene for BKE_object_handle_update().
											 
										 
										
											2013-02-15 11:49:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* read values pushed into RBO from sim/cache... */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 16:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_rigidbody_sync_transforms ( rbw ,  ob ,  ctime ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-23 05:56:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme. 
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already. 
* Tidy up UI buttons of constraints
											 
										 
										
											2007-07-15 03:35:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* solve constraints */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-27 01:29:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > constraints . first  & &  ! ( ob - > transflag  &  OB_NO_CONSTRAINTS ) )  { 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme. 
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already. 
* Tidy up UI buttons of constraints
											 
										 
										
											2007-07-15 03:35:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bConstraintOb  * cob ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-23 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										cob  =  BKE_constraints_make_evalob ( scene ,  ob ,  NULL ,  CONSTRAINT_OBTYPE_OBJECT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-11 11:47:07 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_constraints_solve ( & ob - > constraints ,  cob ,  ctime ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-23 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_constraints_clear_evalob ( cob ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme. 
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already. 
* Tidy up UI buttons of constraints
											 
										 
										
											2007-07-15 03:35:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2004-05-29 16:17:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* set negative scale flag in object */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( is_negative_m4 ( ob - > obmat ) )  ob - > transflag  | =  OB_NEG_SCALE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  ob - > transflag  & =  ~ OB_NEG_SCALE ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 16:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_where_is_calc_time ( Scene  * scene ,  Object  * ob ,  float  ctime )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2013-07-12 11:18:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_where_is_calc_time_ex ( scene ,  ob ,  ctime ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 16:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* get object transformation matrix without recalculating dependencies and
  
						 
					
						
							
								
									
										
										
										
											2012-03-03 20:19:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  constraints  - -  assume  dependencies  are  already  solved  by  depsgraph . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  no  changes  to  object  and  it ' s  parent  would  be  done . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  used  for  bundles  orientation  in  3 d  space  relative  to  parented  blender  camera  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_where_is_calc_mat4 ( Scene  * scene ,  Object  * ob ,  float  obmat [ 4 ] [ 4 ] )  
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > parent )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-29 18:12:44 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  slowmat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Object  * par  =  ob - > parent ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-07 05:39:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										solve_parenting ( scene ,  ob ,  par ,  obmat ,  slowmat ,  NULL ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-07 05:39:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > partype  &  PARSLOW ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											where_is_object_parslow ( ob ,  obmat ,  slowmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_object_to_mat4 ( ob ,  obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-12 11:18:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_where_is_calc_ex ( Scene  * scene ,  RigidBodyWorld  * rbw ,  Object  * ob ,  float  r_originmat [ 3 ] [ 3 ] )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2013-07-12 11:18:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_where_is_calc_time_ex ( scene ,  ob ,  BKE_scene_frame_get ( scene ) ,  rbw ,  r_originmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 16:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  BKE_object_where_is_calc ( Scene  * scene ,  Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2013-07-12 11:18:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_where_is_calc_time_ex ( scene ,  ob ,  BKE_scene_frame_get ( scene ) ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* for calculation of the inverse parent transform, only used for editor */  
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_workob_calc_parent ( Scene  * scene ,  Object  * ob ,  Object  * workob )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_workob_clear ( workob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-24 11:08:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									unit_m4 ( workob - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unit_m4 ( workob - > parentinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unit_m4 ( workob - > constinv ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									workob - > parent  =  ob - > parent ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									workob - > trackflag  =  ob - > trackflag ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									workob - > upflag  =  ob - > upflag ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									workob - > partype  =  ob - > partype ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									workob - > par1  =  ob - > par1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									workob - > par2  =  ob - > par2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									workob - > par3  =  ob - > par3 ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-24 11:08:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									workob - > constraints . first  =  ob - > constraints . first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									workob - > constraints . last  =  ob - > constraints . last ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-04-20 02:56:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_strncpy ( workob - > parsubstr ,  ob - > parsubstr ,  sizeof ( workob - > parsubstr ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_where_is_calc ( scene ,  workob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* see BKE_pchan_apply_mat4() for the equivalent 'pchan' function */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  BKE_object_apply_mat4 ( Object  * ob ,  float  mat [ 4 ] [ 4 ] ,  const  bool  use_compat ,  const  bool  use_parent )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  rot [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( use_parent  & &  ob - > parent )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  rmat [ 4 ] [ 4 ] ,  diff_mat [ 4 ] [ 4 ] ,  imat [ 4 ] [ 4 ] ,  parent_mat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob_get_parent_matrix ( NULL ,  ob ,  ob - > parent ,  parent_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										mul_m4_m4m4 ( diff_mat ,  parent_mat ,  ob - > parentinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										invert_m4_m4 ( imat ,  diff_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										mul_m4_m4m4 ( rmat ,  imat ,  mat ) ;  /* get the parent relative matrix */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_object_apply_mat4 ( ob ,  rmat ,  use_compat ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-09 00:37:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* same as below, use rmat rather than mat */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										mat4_to_loc_rot_size ( ob - > loc ,  rot ,  ob - > size ,  rmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_object_mat3_to_rot ( ob ,  rot ,  use_compat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										mat4_to_loc_rot_size ( ob - > loc ,  rot ,  ob - > size ,  mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_object_mat3_to_rot ( ob ,  rot ,  use_compat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sub_v3_v3 ( ob - > loc ,  ob - > dloc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > dscale [ 0 ]  ! =  0.0f )  ob - > size [ 0 ]  / =  ob - > dscale [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > dscale [ 1 ]  ! =  0.0f )  ob - > size [ 1 ]  / =  ob - > dscale [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > dscale [ 2 ]  ! =  0.0f )  ob - > size [ 2 ]  / =  ob - > dscale [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* BKE_object_mat3_to_rot handles delta rotations */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								BoundBox  * BKE_boundbox_alloc_unit ( void )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BoundBox  * bb ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-06-09 21:25:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  float  min [ 3 ]  =  { - 1.0f ,  - 1.0f ,  - 1.0f } ,  max [ 3 ]  =  { - 1.0f ,  - 1.0f ,  - 1.0f } ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bb  =  MEM_callocN ( sizeof ( BoundBox ) ,  " OB-BoundBox " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_boundbox_init_from_minmax ( bb ,  min ,  max ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2005-07-18 17:33:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  bb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-06-09 21:25:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_boundbox_init_from_minmax ( BoundBox  * bb ,  const  float  min [ 3 ] ,  const  float  max [ 3 ] )  
						 
					
						
							
								
									
										
										
										
											2005-07-18 17:33:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bb - > vec [ 0 ] [ 0 ]  =  bb - > vec [ 1 ] [ 0 ]  =  bb - > vec [ 2 ] [ 0 ]  =  bb - > vec [ 3 ] [ 0 ]  =  min [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bb - > vec [ 4 ] [ 0 ]  =  bb - > vec [ 5 ] [ 0 ]  =  bb - > vec [ 6 ] [ 0 ]  =  bb - > vec [ 7 ] [ 0 ]  =  max [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bb - > vec [ 0 ] [ 1 ]  =  bb - > vec [ 1 ] [ 1 ]  =  bb - > vec [ 4 ] [ 1 ]  =  bb - > vec [ 5 ] [ 1 ]  =  min [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bb - > vec [ 2 ] [ 1 ]  =  bb - > vec [ 3 ] [ 1 ]  =  bb - > vec [ 6 ] [ 1 ]  =  bb - > vec [ 7 ] [ 1 ]  =  max [ 1 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-18 17:33:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bb - > vec [ 0 ] [ 2 ]  =  bb - > vec [ 3 ] [ 2 ]  =  bb - > vec [ 4 ] [ 2 ]  =  bb - > vec [ 7 ] [ 2 ]  =  min [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bb - > vec [ 1 ] [ 2 ]  =  bb - > vec [ 2 ] [ 2 ]  =  bb - > vec [ 5 ] [ 2 ]  =  bb - > vec [ 6 ] [ 2 ]  =  max [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-08-11 13:25:25 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_boundbox_calc_center_aabb ( const  BoundBox  * bb ,  float  r_cent [ 3 ] )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r_cent [ 0 ]  =  0.5f  *  ( bb - > vec [ 0 ] [ 0 ]  +  bb - > vec [ 4 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r_cent [ 1 ]  =  0.5f  *  ( bb - > vec [ 0 ] [ 1 ]  +  bb - > vec [ 2 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r_cent [ 2 ]  =  0.5f  *  ( bb - > vec [ 0 ] [ 2 ]  +  bb - > vec [ 1 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  BKE_boundbox_calc_size_aabb ( const  BoundBox  * bb ,  float  r_size [ 3 ] )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r_size [ 0 ]  =  0.5f  *  fabsf ( bb - > vec [ 0 ] [ 0 ]  -  bb - > vec [ 4 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r_size [ 1 ]  =  0.5f  *  fabsf ( bb - > vec [ 0 ] [ 1 ]  -  bb - > vec [ 2 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r_size [ 2 ]  =  0.5f  *  fabsf ( bb - > vec [ 0 ] [ 2 ]  -  bb - > vec [ 1 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								BoundBox  * BKE_object_boundbox_get ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2006-06-14 08:50:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BoundBox  * bb  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-14 08:50:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > type  = =  OB_MESH )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 21:28:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bb  =  BKE_mesh_boundbox_get ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-14 08:50:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-20 01:30:29 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( ELEM ( ob - > type ,  OB_CURVE ,  OB_SURF ,  OB_FONT ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-21 07:40:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bb  =  BKE_curve_boundbox_get ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-14 08:50:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( ob - > type  = =  OB_MBALL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bb  =  ob - > bb ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-14 08:50:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  bb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2006-11-29 12:44:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* used to temporally disable/enable boundbox */  
						 
					
						
							
								
									
										
										
										
											2014-08-11 13:25:25 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_boundbox_flag ( Object  * ob ,  int  flag ,  const  bool  set )  
						 
					
						
							
								
									
										
										
										
											2006-11-29 12:44:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BoundBox  * bb  =  BKE_object_boundbox_get ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( bb )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( set )  bb - > flag  | =  flag ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-29 12:44:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else  bb - > flag  & =  ~ flag ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_dimensions_get ( Object  * ob ,  float  vec [ 3 ] )  
						 
					
						
							
								
									
										
										
										
											2010-03-25 06:27:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BoundBox  * bb  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bb  =  BKE_object_boundbox_get ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-25 06:27:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( bb )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  scale [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 15:47:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										mat4_to_size ( scale ,  ob - > obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-25 06:27:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-02-28 14:05:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										vec [ 0 ]  =  fabsf ( scale [ 0 ] )  *  ( bb - > vec [ 4 ] [ 0 ]  -  bb - > vec [ 0 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										vec [ 1 ]  =  fabsf ( scale [ 1 ] )  *  ( bb - > vec [ 2 ] [ 1 ]  -  bb - > vec [ 0 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										vec [ 2 ]  =  fabsf ( scale [ 2 ] )  *  ( bb - > vec [ 1 ] [ 2 ]  -  bb - > vec [ 0 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:18:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										zero_v3 ( vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-25 06:27:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-03-30 11:08:33 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_dimensions_set ( Object  * ob ,  const  float  value [ 3 ] )  
						 
					
						
							
								
									
										
										
										
											2010-03-25 06:27:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BoundBox  * bb  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bb  =  BKE_object_boundbox_get ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-25 06:27:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( bb )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  scale [ 3 ] ,  len [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 15:47:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										mat4_to_size ( scale ,  ob - > obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-25 06:27:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										len [ 0 ]  =  bb - > vec [ 4 ] [ 0 ]  -  bb - > vec [ 0 ] [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										len [ 1 ]  =  bb - > vec [ 2 ] [ 1 ]  -  bb - > vec [ 0 ] [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										len [ 2 ]  =  bb - > vec [ 1 ] [ 2 ]  -  bb - > vec [ 0 ] [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( len [ 0 ]  >  0.f )  ob - > size [ 0 ]  =  value [ 0 ]  /  len [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( len [ 1 ]  >  0.f )  ob - > size [ 1 ]  =  value [ 1 ]  /  len [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( len [ 2 ]  >  0.f )  ob - > size [ 2 ]  =  value [ 2 ]  /  len [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-24 12:13:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_minmax ( Object  * ob ,  float  min_r [ 3 ] ,  float  max_r [ 3 ] ,  const  bool  use_hidden )  
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BoundBox  bb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  vec [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-26 06:39:14 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  changed  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 06:31:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( ob - > type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  OB_CURVE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_FONT : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_SURF : 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:58:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bb  =  * BKE_curve_boundbox_get ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( a  =  0 ;  a  <  8 ;  a + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												mul_m4_v3 ( ob - > obmat ,  bb . vec [ a ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-13 11:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												minmax_v3v3_v3 ( min_r ,  max_r ,  bb . vec [ a ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-26 06:39:14 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											changed  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-19 10:40:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  OB_LATTICE : 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Lattice  * lt  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											BPoint  * bp  =  lt - > def ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  u ,  v ,  w ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( w  =  0 ;  w  <  lt - > pntsw ;  w + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( v  =  0 ;  v  <  lt - > pntsv ;  v + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( u  =  0 ;  u  <  lt - > pntsu ;  u + + ,  bp + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														mul_v3_m4v3 ( vec ,  ob - > obmat ,  bp - > vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-13 11:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														minmax_v3v3_v3 ( min_r ,  max_r ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-26 06:39:14 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											changed  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-19 10:40:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  OB_ARMATURE : 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-19 10:40:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ob - > pose )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-18 14:27:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												bArmature  * arm  =  ob - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												bPoseChannel  * pchan ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-18 14:27:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( pchan  =  ob - > pose - > chanbase . first ;  pchan ;  pchan  =  pchan - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-19 19:16:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													/* XXX pchan->bone may be NULL for duplicated bones, see duplicateEditBoneObjects() comment
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													 *      ( editarmature . c : 2592 ) . . .  Skip  in  this  case  too !  */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( pchan - > bone  & &  ! ( ( use_hidden  = =  false )  & &  ( PBONE_VISIBLE ( arm ,  pchan - > bone )  = =  false ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-18 14:27:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														mul_v3_m4v3 ( vec ,  ob - > obmat ,  pchan - > pose_head ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														minmax_v3v3_v3 ( min_r ,  max_r ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														mul_v3_m4v3 ( vec ,  ob - > obmat ,  pchan - > pose_tail ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														minmax_v3v3_v3 ( min_r ,  max_r ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-26 06:39:14 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														changed  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-18 14:27:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2005-07-11 17:12:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-19 10:40:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  OB_MESH : 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Mesh  * me  =  BKE_mesh_from_object ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( me )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 21:28:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												bb  =  * BKE_mesh_boundbox_get ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( a  =  0 ;  a  <  8 ;  a + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													mul_m4_v3 ( ob - > obmat ,  bb . vec [ a ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-13 11:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													minmax_v3v3_v3 ( min_r ,  max_r ,  bb . vec [ a ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-26 06:39:14 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												changed  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-19 10:40:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2013-06-28 18:19:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  OB_MBALL : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  ob_min [ 3 ] ,  ob_max [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-26 06:39:14 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											changed  =  BKE_mball_minmax_ex ( ob - > data ,  ob_min ,  ob_max ,  ob - > obmat ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( changed )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-06-28 18:19:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												minmax_v3v3_v3 ( min_r ,  max_r ,  ob_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												minmax_v3v3_v3 ( min_r ,  max_r ,  ob_max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-06 07:29:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-26 06:39:14 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( changed  = =  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-12 10:27:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  size [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										copy_v3_v3 ( size ,  ob - > size ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ob - > type  = =  OB_EMPTY )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											mul_v3_fl ( size ,  ob - > empty_drawsize ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-13 11:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										minmax_v3v3_v3 ( min_r ,  max_r ,  ob - > obmat [ 3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-04-23 23:57:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										copy_v3_v3 ( vec ,  ob - > obmat [ 3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-12 10:27:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										add_v3_v3 ( vec ,  size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-13 11:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										minmax_v3v3_v3 ( min_r ,  max_r ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-04-23 23:57:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										copy_v3_v3 ( vec ,  ob - > obmat [ 3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-12 10:27:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										sub_v3_v3 ( vec ,  size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-13 11:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										minmax_v3v3_v3 ( min_r ,  max_r ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2002-10-12 11:37:38 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 21:57:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_empty_draw_type_set ( Object  * ob ,  const  int  value )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2014-02-03 13:55:26 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > empty_drawtype  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > type  = =  OB_EMPTY  & &  ob - > empty_drawtype  = =  OB_EMPTY_IMAGE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! ob - > iuser )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > iuser  =  MEM_callocN ( sizeof ( ImageUser ) ,  " image user " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > iuser - > ok  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > iuser - > frames  =  100 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > iuser - > sfra  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > iuser - > fie_ima  =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ob - > iuser )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											MEM_freeN ( ob - > iuser ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > iuser  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 21:57:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-06-09 21:25:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_object_minmax_dupli ( Scene  * scene ,  Object  * ob ,  float  r_min [ 3 ] ,  float  r_max [ 3 ] ,  const  bool  use_hidden )  
						 
					
						
							
								
									
										
										
										
											2007-04-14 13:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2013-06-09 21:25:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  ok  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ( ob - > transflag  &  OB_DUPLI )  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-24 20:11:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  ok ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:18:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2007-04-14 13:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ListBase  * lb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										DupliObject  * dob ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-26 17:24:42 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										lb  =  object_duplilist ( G . main - > eval_ctx ,  scene ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( dob  =  lb - > first ;  dob ;  dob  =  dob - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-24 12:13:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ( use_hidden  = =  false )  & &  ( dob - > no_draw  ! =  0 ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-18 14:27:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* pass */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BoundBox  * bb  =  BKE_object_boundbox_get ( dob - > ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-24 20:11:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( bb )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-24 20:11:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													int  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													for  ( i  =  0 ;  i  <  8 ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-24 20:11:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														float  vec [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														mul_v3_m4v3 ( vec ,  dob - > mat ,  bb - > vec [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-13 11:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														minmax_v3v3_v3 ( r_min ,  r_max ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-24 20:11:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-26 06:39:14 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ok  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-24 20:11:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2007-04-14 13:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										free_object_duplilist ( lb ) ;   /* does restore */ 
							 
						 
					
						
							
								
									
										
										
										
											2007-04-14 13:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-24 20:11:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ok ; 
							 
						 
					
						
							
								
									
										
										
										
											2007-04-14 13:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-14 03:54:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_foreach_display_point (  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        Object  * ob ,  float  obmat [ 4 ] [ 4 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        void  ( * func_cb ) ( const  float [ 3 ] ,  void  * ) ,  void  * user_data ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  co [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > derivedFinal )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										DerivedMesh  * dm  =  ob - > derivedFinal ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MVert  * mv  =  dm - > getVertArray ( dm ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  totvert  =  dm - > getNumVerts ( dm ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-14 03:54:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( i  =  0 ;  i  <  totvert ;  i + + ,  mv + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-14 03:54:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											mul_v3_m4v3 ( co ,  obmat ,  mv - > co ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											func_cb ( co ,  user_data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( ob - > curve_cache  & &  ob - > curve_cache - > disp . first )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-14 03:54:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										DispList  * dl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:25:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( dl  =  ob - > curve_cache - > disp . first ;  dl ;  dl  =  dl - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-27 00:20:13 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											const  float  * v3  =  dl - > verts ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  totvert  =  dl - > nr ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-14 03:54:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( i  =  0 ;  i  <  totvert ;  i + + ,  v3  + =  3 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-14 03:54:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												mul_v3_m4v3 ( co ,  obmat ,  v3 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												func_cb ( co ,  user_data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  BKE_scene_foreach_display_point (  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        Scene  * scene ,  View3D  * v3d ,  const  short  flag , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        void  ( * func_cb ) ( const  float [ 3 ] ,  void  * ) ,  void  * user_data ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Base  * base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( base  =  FIRSTBASE ;  base ;  base  =  base - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 04:35:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( BASE_VISIBLE_BGMODE ( v3d ,  scene ,  base )  & &  ( base - > flag  &  flag )  = =  flag )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ob  =  base - > object ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-14 03:54:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ( ob - > transflag  &  OB_DUPLI )  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-14 03:54:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BKE_object_foreach_display_point ( ob ,  ob - > obmat ,  func_cb ,  user_data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ListBase  * lb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												DupliObject  * dob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-26 17:24:42 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												lb  =  object_duplilist ( G . main - > eval_ctx ,  scene ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( dob  =  lb - > first ;  dob ;  dob  =  dob - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( dob - > no_draw  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-14 03:54:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														BKE_object_foreach_display_point ( dob - > ob ,  dob - > mat ,  func_cb ,  user_data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												free_object_duplilist ( lb ) ;   /* does restore */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-14 03:54:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* copied from DNA_object_types.h */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								typedef  struct  ObTfmBack  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  loc [ 3 ] ,  dloc [ 3 ] ,  orig [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  size [ 3 ] ,  dscale [ 3 ] ;    /* scale and delta scale */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  rot [ 3 ] ,  drot [ 3 ] ;       /* euler rotation */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  quat [ 4 ] ,  dquat [ 4 ] ;     /* quaternion rotation */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  rotAxis [ 3 ] ,  drotAxis [ 3 ] ;   /* axis angle rotation - axis part */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  rotAngle ,  drotAngle ;   /* axis angle rotation - angle part */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  obmat [ 4 ] [ 4 ] ;       /* final worldspace matrix with constraints & animsys applied */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  parentinv [ 4 ] [ 4 ] ;  /* inverse result of parent, so that object doesn't 'stick' to parent */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  constinv [ 4 ] [ 4 ] ;  /* inverse result of constraints. doesn't include effect of parent or object local transform */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  imat [ 4 ] [ 4 ] ;    /* inverse matrix of 'obmat' for during render, old game engine, temporally: ipokeys of transform  */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  ObTfmBack ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  * BKE_object_tfm_backup ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ObTfmBack  * obtfm  =  MEM_mallocN ( sizeof ( ObTfmBack ) ,  " ObTfmBack " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_v3_v3 ( obtfm - > loc ,  ob - > loc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( obtfm - > dloc ,  ob - > dloc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( obtfm - > orig ,  ob - > orig ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( obtfm - > size ,  ob - > size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-04 03:35:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_v3_v3 ( obtfm - > dscale ,  ob - > dscale ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_v3_v3 ( obtfm - > rot ,  ob - > rot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( obtfm - > drot ,  ob - > drot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_qt_qt ( obtfm - > quat ,  ob - > quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_qt_qt ( obtfm - > dquat ,  ob - > dquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( obtfm - > rotAxis ,  ob - > rotAxis ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( obtfm - > drotAxis ,  ob - > drotAxis ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									obtfm - > rotAngle  =  ob - > rotAngle ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									obtfm - > drotAngle  =  ob - > drotAngle ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_m4_m4 ( obtfm - > obmat ,  ob - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_m4_m4 ( obtfm - > parentinv ,  ob - > parentinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_m4_m4 ( obtfm - > constinv ,  ob - > constinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_m4_m4 ( obtfm - > imat ,  ob - > imat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ( void  * ) obtfm ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_tfm_restore ( Object  * ob ,  void  * obtfm_pt )  
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ObTfmBack  * obtfm  =  ( ObTfmBack  * ) obtfm_pt ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_v3_v3 ( ob - > loc ,  obtfm - > loc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( ob - > dloc ,  obtfm - > dloc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( ob - > orig ,  obtfm - > orig ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( ob - > size ,  obtfm - > size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-04 03:35:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_v3_v3 ( ob - > dscale ,  obtfm - > dscale ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_v3_v3 ( ob - > rot ,  obtfm - > rot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( ob - > drot ,  obtfm - > drot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_qt_qt ( ob - > quat ,  obtfm - > quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_qt_qt ( ob - > dquat ,  obtfm - > dquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( ob - > rotAxis ,  obtfm - > rotAxis ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( ob - > drotAxis ,  obtfm - > drotAxis ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > rotAngle  =  obtfm - > rotAngle ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > drotAngle  =  obtfm - > drotAngle ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_m4_m4 ( ob - > obmat ,  obtfm - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_m4_m4 ( ob - > parentinv ,  obtfm - > parentinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_m4_m4 ( ob - > constinv ,  obtfm - > constinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_m4_m4 ( ob - > imat ,  obtfm - > imat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2007-04-14 13:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_object_parent_loop_check ( const  Object  * par ,  const  Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2011-12-16 10:39:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* test if 'ob' is a parent somewhere in par's parents */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( par  = =  NULL )  return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob  = =  par )  return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-16 10:39:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  BKE_object_parent_loop_check ( par - > parent ,  ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2006-11-30 15:54:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* proxy rule: lib_object->proxy_from == the one we borrow from, only set temporal and cleared here */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*           local_object->proxy      == pointer to library object, saved in files and read */  
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2006-11-14 15:27:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* function below is polluted with proxy exceptions, cleanup will follow! */  
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* the main object update call, for object matrix, constraints, keys and displist (modifiers) */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* requires flags to be set! */  
						 
					
						
							
								
									
										
										
										
											2013-02-16 16:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Ideally we shouldn't have to pass the rigid body world, but need bigger restructuring to avoid id */  
						 
					
						
							
								
									
										
										
										
											2013-12-26 17:24:42 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_handle_update_ex ( EvaluationContext  * eval_ctx ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                 Scene  * scene ,  Object  * ob , 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-24 15:10:16 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                 RigidBodyWorld  * rbw , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                 const  bool  do_proxy_update ) 
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > recalc  &  OB_RECALC_ALL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-26 10:33:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* speed optimization for animation lookups */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > pose ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 16:03:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_pose_channels_hash_make ( ob - > pose ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-26 10:33:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > recalc  &  OB_RECALC_DATA )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ob - > type  = =  OB_ARMATURE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 18:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* this happens for reading old files and to match library armatures
 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												 *  with  poses  we  do  it  ahead  of  BKE_object_where_is_calc  to  ensure  animation 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-03 20:19:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												 *  is  evaluated  on  the  rebuilt  pose ,  otherwise  we  get  incorrect  poses 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												 *  on  file  load  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ob - > pose  = =  NULL  | |  ( ob - > pose - > flag  &  POSE_RECALC ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 16:03:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													BKE_pose_rebuild ( ob ,  ob - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 18:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-20 16:18:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* XXX new animsys warning: depsgraph tag OB_RECALC_DATA should not skip drivers, 
 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 *  which  is  only  in  BKE_object_where_is_calc  now  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-07 22:51:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* XXX: should this case be OB_RECALC_OB instead? */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > recalc  &  OB_RECALC_ALL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-29 23:27:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2014-01-29 17:37:45 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( G . debug  &  G_DEBUG_DEPSGRAPH ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												printf ( " recalcob %s \n " ,  ob - > id . name  +  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-30 15:54:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* handle proxy copy for target */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ob - > id . lib  & &  ob - > proxy_from )  { 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-30 15:54:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												// printf("ob proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name);
 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ob - > proxy_from - > proxy_group )  {  /* transform proxy into group space */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Object  * obg  =  ob - > proxy_from - > proxy_group ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													invert_m4_m4 ( obg - > imat ,  obg - > obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-26 18:36:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													mul_m4_m4m4 ( ob - > obmat ,  obg - > imat ,  ob - > proxy_from - > obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( obg - > dup_group )  {  /* should always be true */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-03 05:41:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														add_v3_v3 ( ob - > obmat [ 3 ] ,  obg - > dup_group - > dupli_ofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-02 01:36:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-14 15:27:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													copy_m4_m4 ( ob - > obmat ,  ob - > proxy_from - > obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-14 15:27:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-12 11:18:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BKE_object_where_is_calc_ex ( scene ,  rbw ,  ob ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-11 16:45:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > recalc  &  OB_RECALC_DATA )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ID  * data_id  =  ( ID  * ) ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											AnimData  * adt  =  BKE_animdata_from_id ( data_id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-17 13:15:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Key  * key ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-27 16:45:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											float  ctime  =  BKE_scene_frame_get ( scene ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2014-01-29 17:37:45 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( G . debug  &  G_DEBUG_DEPSGRAPH ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												printf ( " recalcdata %s \n " ,  ob - > id . name  +  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-19 07:40:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( adt )  { 
							 
						 
					
						
							
								
									
										
											 
										
											
												Bugfix [#31834] Cycles materials cannot be manipulated using drivers
Until now, there was never any code for making drivers on materials get
recalculated when their dependencies were changed. However, since changing
material colors with drivers is something that is quite common, a workaround was
introduced to ensure that materials could still be driven (albeit with the
relevant drivers rooted at object level). This worked well enough so far with
traditional materials - though it was sometimes clunky and confusing for some
users - and would have been ok to tide us over until the depsgraph refactor.
The introduction of Cycles changed this, as it has in many other ways. Now that
people use Cycles to render, they'll need to drive the material colors through
the nested nodetree (and other things nested deeply within that). However, this
is much more difficult to generate hacks to create the relevant paths needed to
work around the problem.
== This Commit... ==
* Adds a recursive driver calculation step to the BKE_object_handle_update()
(which gets called whenever the depsgraph has finished tagging object datablocks
for updates), which goes through calculating the drivers attached to the object
(and the materials/nodetrees attached to that). This case gets handled everytime
the object is tagged as needing updates to its "data" (OB_RECALC_DATA)
* When building the depsgraph, every dependency that the drivers there have are
treated as if they were attached to object.data instead. This should trick the
depsgraph into tagging OB_RECALC_DATA to force recalculation of drivers, at the
expense perhaps of modifiers getting recalculated again.
== Todo ==
* The old workarounds noted are still in place (will be commented out in the
next commit). This fix renders at least the material case redundant, although
the textures case still needs a bit more work.
* Check on whether similar hacks can be done for other datablock combinations
* So far, only simple test cases have been tested. There is probably some
performance penalty for heavy setups still (due to need to traverse down all
parts of material/node hierarchy to find things that need updates). If there
really is a problem here, we could try introducing some tags to limit this
traversal (which get added at depsgraph build time).  <--- USER TESTING
NEEDED!!!
											 
										 
										
											2012-07-03 05:11:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* evaluate drivers - datalevel */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-07 22:51:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* XXX: for mesh types, should we push this to derivedmesh instead? */ 
							 
						 
					
						
							
								
									
										
											 
										
											
												== RNA Property Updates get called by Animation System now ==
This fixes bug #26764 and several others like it, where modifier
properties (and others, but most visibly modifiers) would not do
anything when animated or driven, as modifier properties require the
RNA update calls to tag the modifiers to get recalculated.
While just adding a call to RNA_property_update() could have gotten
this working (as per the Campbell's patch attached in the report, and
also my own attempt #25881). However, on production rigs, the
performance cost of this is untenatable (on my own tests, without
these updates, I was getting ~5fps on such a rig, but only 0.9fps or
possibly even worse with the updates added).
Hence, this commit adds a property-update caching system to the RNA
level, which aims to reduce to the number of times that the update
functions end up needing to get called.
While this is much faster than without the caching, I also added an
optimisation for pose bones (which are numerous in production rigs) so
that their property updates are skipped, since they are useless to the
animsys (they only tag the depsgraph for updating). This gets things
moving at a more acceptable framerate.
											 
										 
										
											2011-07-24 04:34:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BKE_animsys_evaluate_animdata ( scene ,  data_id ,  adt ,  ctime ,  ADT_RECALC_DRIVERS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-19 02:19:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-17 13:15:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											key  =  BKE_key_from_object ( ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( key  & &  key - > block . first )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! ( ob - > shapeflag  &  OB_SHAPE_LOCK ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													BKE_animsys_evaluate_animdata ( scene ,  & key - > id ,  key - > adt ,  ctime ,  ADT_RECALC_DRIVERS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-19 07:40:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* includes all keys and modifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 06:31:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											switch  ( ob - > type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												case  OB_MESH : 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-19 07:40:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-16 05:59:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													BMEditMesh  * em  =  ( ob  = =  scene - > obedit )  ?  BKE_editmesh_from_object ( ob )  :  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-01 14:34:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													uint64_t  data_mask  =  scene - > customdata_mask  |  CD_MASK_BAREMESH ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-29 17:24:25 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# ifdef WITH_FREESTYLE 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* make sure Freestyle edge/face marks appear in DM for render (see T40315) */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-07 16:29:04 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( eval_ctx - > mode  ! =  DAG_EVAL_VIEWPORT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-29 17:24:25 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														data_mask  | =  CD_MASK_FREESTYLE_EDGE  |  CD_MASK_FREESTYLE_FACE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( em )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-26 20:48:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														makeDerivedMesh ( scene ,  ob ,  em ,   data_mask ,  0 ) ;  /* was CD_MASK_BAREMESH */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 16:21:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-26 20:48:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														makeDerivedMesh ( scene ,  ob ,  NULL ,  data_mask ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 16:21:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-19 15:23:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-19 07:40:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												case  OB_ARMATURE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ob - > id . lib  & &  ob - > proxy_from )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-24 14:48:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( BKE_pose_copy_result ( ob - > pose ,  ob - > proxy_from - > pose )  = =  false )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															printf ( " Proxy copy error, lib Object: %s proxy Object: %s \n " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															       ob - > id . name  +  2 ,  ob - > proxy_from - > id . name  +  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														BKE_pose_where_is ( scene ,  ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-19 07:40:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												case  OB_MBALL : 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-26 17:24:42 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													BKE_displist_make_mball ( eval_ctx ,  scene ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-19 07:40:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												case  OB_CURVE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  OB_SURF : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  OB_FONT : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 06:58:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													BKE_displist_make_curveTypes ( scene ,  ob ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-19 07:40:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												case  OB_LATTICE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													BKE_lattice_modifiers_calc ( scene ,  ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 21:57:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  OB_EMPTY : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ob - > empty_drawtype  = =  OB_EMPTY_IMAGE  & &  ob - > data ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( BKE_image_is_animated ( ob - > data ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															BKE_image_user_check_frame_calc ( ob - > iuser ,  ( int ) ctime ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
											 
										
											
												Bugfix [#31834] Cycles materials cannot be manipulated using drivers
Until now, there was never any code for making drivers on materials get
recalculated when their dependencies were changed. However, since changing
material colors with drivers is something that is quite common, a workaround was
introduced to ensure that materials could still be driven (albeit with the
relevant drivers rooted at object level). This worked well enough so far with
traditional materials - though it was sometimes clunky and confusing for some
users - and would have been ok to tide us over until the depsgraph refactor.
The introduction of Cycles changed this, as it has in many other ways. Now that
people use Cycles to render, they'll need to drive the material colors through
the nested nodetree (and other things nested deeply within that). However, this
is much more difficult to generate hacks to create the relevant paths needed to
work around the problem.
== This Commit... ==
* Adds a recursive driver calculation step to the BKE_object_handle_update()
(which gets called whenever the depsgraph has finished tagging object datablocks
for updates), which goes through calculating the drivers attached to the object
(and the materials/nodetrees attached to that). This case gets handled everytime
the object is tagged as needing updates to its "data" (OB_RECALC_DATA)
* When building the depsgraph, every dependency that the drivers there have are
treated as if they were attached to object.data instead. This should trick the
depsgraph into tagging OB_RECALC_DATA to force recalculation of drivers, at the
expense perhaps of modifiers getting recalculated again.
== Todo ==
* The old workarounds noted are still in place (will be commented out in the
next commit). This fix renders at least the material case redundant, although
the textures case still needs a bit more work.
* Check on whether similar hacks can be done for other datablock combinations
* So far, only simple test cases have been tested. There is probably some
performance penalty for heavy setups still (due to need to traverse down all
parts of material/node hierarchy to find things that need updates). If there
really is a problem here, we could try introducing some tags to limit this
traversal (which get added at depsgraph build time).  <--- USER TESTING
NEEDED!!!
											 
										 
										
											2012-07-03 05:11:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* related materials */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* XXX: without depsgraph tagging, this will always need to be run, which will be slow! 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											 *  However ,  not  doing  anything  ( or  trying  to  hack  around  this  lack )  is  not  an  option  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											 *  anymore ,  especially  due  to  Cycles  [ # 31834 ]  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ob - > totcol )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( a  =  1 ;  a  < =  ob - > totcol ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Material  * ma  =  give_current_material ( ob ,  a ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													
							 
						 
					
						
							
								
									
										
										
										
											2012-07-03 05:46:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ma )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														/* recursively update drivers for this material */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														material_drivers_update ( scene ,  ma ,  ctime ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
											 
										
											
												Bugfix [#31834] Cycles materials cannot be manipulated using drivers
Until now, there was never any code for making drivers on materials get
recalculated when their dependencies were changed. However, since changing
material colors with drivers is something that is quite common, a workaround was
introduced to ensure that materials could still be driven (albeit with the
relevant drivers rooted at object level). This worked well enough so far with
traditional materials - though it was sometimes clunky and confusing for some
users - and would have been ok to tide us over until the depsgraph refactor.
The introduction of Cycles changed this, as it has in many other ways. Now that
people use Cycles to render, they'll need to drive the material colors through
the nested nodetree (and other things nested deeply within that). However, this
is much more difficult to generate hacks to create the relevant paths needed to
work around the problem.
== This Commit... ==
* Adds a recursive driver calculation step to the BKE_object_handle_update()
(which gets called whenever the depsgraph has finished tagging object datablocks
for updates), which goes through calculating the drivers attached to the object
(and the materials/nodetrees attached to that). This case gets handled everytime
the object is tagged as needing updates to its "data" (OB_RECALC_DATA)
* When building the depsgraph, every dependency that the drivers there have are
treated as if they were attached to object.data instead. This should trick the
depsgraph into tagging OB_RECALC_DATA to force recalculation of drivers, at the
expense perhaps of modifiers getting recalculated again.
== Todo ==
* The old workarounds noted are still in place (will be commented out in the
next commit). This fix renders at least the material case redundant, although
the textures case still needs a bit more work.
* Check on whether similar hacks can be done for other datablock combinations
* So far, only simple test cases have been tested. There is probably some
performance penalty for heavy setups still (due to need to traverse down all
parts of material/node hierarchy to find things that need updates). If there
really is a problem here, we could try introducing some tags to limit this
traversal (which get added at depsgraph build time).  <--- USER TESTING
NEEDED!!!
											 
										 
										
											2012-07-03 05:11:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-09 13:57:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else  if  ( ob - > type  = =  OB_LAMP ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												lamp_drivers_update ( scene ,  ob - > data ,  ctime ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Bugfix [#31834] Cycles materials cannot be manipulated using drivers
Until now, there was never any code for making drivers on materials get
recalculated when their dependencies were changed. However, since changing
material colors with drivers is something that is quite common, a workaround was
introduced to ensure that materials could still be driven (albeit with the
relevant drivers rooted at object level). This worked well enough so far with
traditional materials - though it was sometimes clunky and confusing for some
users - and would have been ok to tide us over until the depsgraph refactor.
The introduction of Cycles changed this, as it has in many other ways. Now that
people use Cycles to render, they'll need to drive the material colors through
the nested nodetree (and other things nested deeply within that). However, this
is much more difficult to generate hacks to create the relevant paths needed to
work around the problem.
== This Commit... ==
* Adds a recursive driver calculation step to the BKE_object_handle_update()
(which gets called whenever the depsgraph has finished tagging object datablocks
for updates), which goes through calculating the drivers attached to the object
(and the materials/nodetrees attached to that). This case gets handled everytime
the object is tagged as needing updates to its "data" (OB_RECALC_DATA)
* When building the depsgraph, every dependency that the drivers there have are
treated as if they were attached to object.data instead. This should trick the
depsgraph into tagging OB_RECALC_DATA to force recalculation of drivers, at the
expense perhaps of modifiers getting recalculated again.
== Todo ==
* The old workarounds noted are still in place (will be commented out in the
next commit). This fix renders at least the material case redundant, although
the textures case still needs a bit more work.
* Check on whether similar hacks can be done for other datablock combinations
* So far, only simple test cases have been tested. There is probably some
performance penalty for heavy setups still (due to need to traverse down all
parts of material/node hierarchy to find things that need updates). If there
really is a problem here, we could try introducing some tags to limit this
traversal (which get added at depsgraph build time).  <--- USER TESTING
NEEDED!!!
											 
										 
										
											2012-07-03 05:11:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* particles */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-09 17:32:19 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ob  ! =  scene - > obedit  & &  ob - > particlesystem . first )  { 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ParticleSystem  * tpsys ,  * psys ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-17 12:02:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												DerivedMesh  * dm ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-20 23:52:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > transflag  & =  ~ OB_DUPLIPARTS ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												psys  =  ob - > particlesystem . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												while  ( psys )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-05 13:53:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													/* ensure this update always happens even if psys is disabled */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( psys - > recalc  &  PSYS_RECALC_TYPE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														psys_changed_type ( ob ,  psys ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( psys_check_enabled ( ob ,  psys ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-20 23:52:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														/* check use of dupli objects here */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-07 10:50:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( psys - > part  & &  ( psys - > part - > draw_as  = =  PART_DRAW_REND  | |  eval_ctx - > mode  = =  DAG_EVAL_RENDER )  & & 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-21 15:11:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														    ( ( psys - > part - > ren_as  = =  PART_DRAW_OB  & &  psys - > part - > dup_ob )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														     ( psys - > part - > ren_as  = =  PART_DRAW_GR  & &  psys - > part - > dup_group ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-20 23:52:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															ob - > transflag  | =  OB_DUPLIPARTS ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-21 15:11:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-20 23:52:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-04 14:14:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														particle_system_update ( scene ,  ob ,  psys ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														psys  =  psys - > next ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													else  if  ( psys - > flag  &  PSYS_DELETE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														tpsys  =  psys - > next ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														BLI_remlink ( & ob - > particlesystem ,  psys ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 15:47:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														psys_free ( ob ,  psys ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														psys  =  tpsys ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													else 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														psys  =  psys - > next ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-17 12:02:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-07-07 10:50:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( eval_ctx - > mode  = =  DAG_EVAL_RENDER  & &  ob - > transflag  &  OB_DUPLIPARTS )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-17 12:02:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													/* this is to make sure we get render level duplis in groups:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													 *  the  derivedmesh  must  be  created  before  init_render_mesh , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													 *  since  object_duplilist  does  dupliparticles  before  that  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													dm  =  mesh_create_derived_render ( scene ,  ob ,  CD_MASK_BAREMESH  |  CD_MASK_MTFACE  |  CD_MASK_MCOL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-17 12:02:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													dm - > release ( dm ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-18 14:30:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													for  ( psys  =  ob - > particlesystem . first ;  psys ;  psys  =  psys - > next ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-18 14:30:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														psys_get_modifier ( ob ,  psys ) - > flag  & =  ~ eParticleSystemFlag_psys_updated ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-17 12:02:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-23 14:07:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* quick cache removed */ 
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
											 
										
											
												
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
											 
										 
										
											2007-11-26 22:09:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-05 03:55:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > recalc  & =  ~ OB_RECALC_ALL ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-14 15:27:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* the case when this is a group proxy, object_update is called in group.c */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > proxy )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-23 21:55:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* set pointer in library proxy target, for copying, but restore it */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > proxy - > proxy_from  =  ob ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-30 15:54:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// printf("set proxy pointer for later group stuff %s\n", ob->id.name);
 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-23 21:55:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* the no-group proxy case, we call update */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ob - > proxy_group  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-24 15:10:16 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( do_proxy_update )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// printf("call update, lib ob %s proxy %s\n", ob->proxy->id.name, ob->id.name);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												BKE_object_handle_update ( eval_ctx ,  scene ,  ob - > proxy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-23 21:55:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2006-11-14 15:27:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										
											
												Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
											 
										 
										
											2005-07-03 17:35:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2013-02-16 16:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* WARNING: "scene" here may not be the scene object actually resides in. 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  When  dealing  with  background - sets ,  " scene "  is  actually  the  active  scene . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  e . g .  " scene "  < - -  set  1  < - -  set  2  ( " ob "  lives  here )  < - -  set  3  < - -  . . .  < - -  set  n 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  rigid  bodies  depend  on  their  world  so  use  BKE_object_handle_update_ex ( )  to  also  pass  along  the  corrent  rigid  body  world 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-26 17:24:42 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_handle_update ( EvaluationContext  * eval_ctx ,  Scene  * scene ,  Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2013-02-16 16:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2014-03-24 15:10:16 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_object_handle_update_ex ( eval_ctx ,  scene ,  ob ,  NULL ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 16:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2008-01-19 16:32:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_sculpt_modifiers_changed ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2011-09-14 00:37:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SculptSession  * ss  =  ob - > sculpt ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 00:37:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-05-18 10:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ss )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! ss - > cache )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* we free pbvh on changes, except during sculpt since it can't deal with
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											 *  changing  PVBH  node  organization ,  we  hope  topology  does  not  change  in 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											 *  the  meantime  . .  weak  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ss - > pbvh )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												BKE_pbvh_free ( ss - > pbvh ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ss - > pbvh  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 00:37:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-07 02:59:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_free_sculptsession_deformMats ( ob - > sculpt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-18 10:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PBVHNode  * * nodes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  n ,  totnode ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 00:37:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-05-18 10:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_pbvh_search_gather ( ss - > pbvh ,  NULL ,  NULL ,  & nodes ,  & totnode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 00:37:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-05-18 10:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( n  =  0 ;  n  <  totnode ;  n + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												BKE_pbvh_node_mark_update ( nodes [ n ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 00:37:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-05-18 10:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											MEM_freeN ( nodes ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 00:37:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  BKE_object_obdata_texspace_get ( Object  * ob ,  short  * * r_texflag ,  float  * * r_loc ,  float  * * r_size ,  float  * * r_rot )  
						 
					
						
							
								
									
										
										
										
											2011-09-28 05:53:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2008-04-01 11:14:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > data  = =  NULL ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-01 11:14:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( GS ( ( ( ID  * ) ob - > data ) - > name ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  ID_ME : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Mesh  * me  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_texflag )  * r_texflag  =  & me - > texflag ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_loc )  * r_loc  =  me - > loc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_size )  * r_size  =  me - > size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_rot )  * r_rot  =  me - > rot ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  ID_CU : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Curve  * cu  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_texflag )  * r_texflag  =  & cu - > texflag ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_loc )  * r_loc  =  cu - > loc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_size )  * r_size  =  cu - > size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_rot )  * r_rot  =  cu - > rot ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  ID_MB : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											MetaBall  * mb  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_texflag )  * r_texflag  =  & mb - > texflag ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_loc )  * r_loc  =  mb - > loc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_size )  * r_size  =  mb - > size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_rot )  * r_rot  =  mb - > rot ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-01 11:14:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2008-06-09 17:50:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Test  a  bounding  box  for  ray  intersection 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  assumes  the  ray  is  already  local  to  the  boundbox  space 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-11 13:25:25 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_boundbox_ray_hit_check (  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  struct  BoundBox  * bb , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  float  ray_start [ 3 ] ,  const  float  ray_normal [ 3 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        float  * r_lambda ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-06-09 21:25:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  int  triangle_indexes [ 12 ] [ 3 ]  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    { 0 ,  1 ,  2 } ,  { 0 ,  2 ,  3 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    { 3 ,  2 ,  6 } ,  { 3 ,  6 ,  7 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    { 1 ,  2 ,  6 } ,  { 1 ,  6 ,  5 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    { 5 ,  6 ,  7 } ,  { 4 ,  5 ,  7 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    { 0 ,  3 ,  7 } ,  { 0 ,  4 ,  7 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    { 0 ,  1 ,  5 } ,  { 0 ,  4 ,  5 } } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  result  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-09 17:50:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-30 18:48:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-29 20:10:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  12  & &  ( ! result  | |  r_lambda ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-09 17:50:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  lambda ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  v1 ,  v2 ,  v3 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										v1  =  triangle_indexes [ i ] [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										v2  =  triangle_indexes [ i ] [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										v3  =  triangle_indexes [ i ] [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-29 20:10:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( isect_ray_tri_v3 ( ray_start ,  ray_normal ,  bb - > vec [ v1 ] ,  bb - > vec [ v2 ] ,  bb - > vec [ v3 ] ,  & lambda ,  NULL )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    ( ! r_lambda  | |  * r_lambda  >  lambda ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											result  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-30 17:11:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( r_lambda )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												* r_lambda  =  lambda ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-29 20:10:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-09 17:50:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-30 18:48:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-09 17:50:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  result ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-09-23 01:28:46 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  pc_cmp ( const  void  * a ,  const  void  * b )  
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2014-09-23 01:28:46 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  LinkData  * ad  =  a ,  * bd  =  b ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( GET_INT_FROM_POINTER ( ad - > data )  >  GET_INT_FROM_POINTER ( bd - > data ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  BKE_object_insert_ptcache ( Object  * ob )   
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									LinkData  * link  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  i  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BLI_sortlist ( & ob - > pc_ids ,  pc_cmp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( link  =  ob - > pc_ids . first ,  i  =  0 ;  link ;  link  =  link - > next ,  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-17 14:46:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  index  =  GET_INT_FROM_POINTER ( link - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( i  <  index ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									link  =  MEM_callocN ( sizeof ( LinkData ) ,  " PCLink " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-17 14:46:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									link - > data  =  SET_INT_IN_POINTER ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_addtail ( & ob - > pc_ids ,  link ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  pc_findindex ( ListBase  * listbase ,  int  index )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									LinkData  * link  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  number  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( listbase  = =  NULL )  return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									link  =  listbase - > first ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( link )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-05 23:46:10 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( GET_INT_FROM_POINTER ( link - > data )  = =  index ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  number ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										number + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										link  =  link - > next ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-05 23:46:10 +06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_delete_ptcache ( Object  * ob ,  int  index )  
						 
					
						
							
								
									
										
										
										
											2009-08-25 18:41:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  list_index  =  pc_findindex ( & ob - > pc_ids ,  index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									LinkData  * link  =  BLI_findlink ( & ob - > pc_ids ,  list_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BLI_freelinkN ( & ob - > pc_ids ,  link ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* shape key utility function */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/************************* Mesh ************************/  
						 
					
						
							
								
									
										
										
										
											2014-02-03 18:55:59 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  KeyBlock  * insert_meshkey ( Scene  * scene ,  Object  * ob ,  const  char  * name ,  const  bool  from_mix )  
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Mesh  * me  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Key  * key  =  me - > key ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									KeyBlock  * kb ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  newkey  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( key  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										key  =  me - > key  =  BKE_key_add ( ( ID  * ) me ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										key - > type  =  KEY_RELATIVE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										newkey  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( newkey  | |  from_mix  = =  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* create from mesh */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										kb  =  BKE_keyblock_add_ctime ( key ,  name ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_key_convert_from_mesh ( me ,  kb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* copy from current values */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-03 06:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  totelem ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  * data  =  BKE_key_evaluate_object ( scene ,  ob ,  & totelem ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 14:00:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* create new block with prepared data */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										kb  =  BKE_keyblock_add_ctime ( key ,  name ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										kb - > data  =  data ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-03 06:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										kb - > totelem  =  totelem ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 18:03:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  kb ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/************************* Lattice ************************/  
						 
					
						
							
								
									
										
										
										
											2014-02-03 18:55:59 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  KeyBlock  * insert_lattkey ( Scene  * scene ,  Object  * ob ,  const  char  * name ,  const  bool  from_mix )  
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Lattice  * lt  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Key  * key  =  lt - > key ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									KeyBlock  * kb ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  newkey  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( key  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										key  =  lt - > key  =  BKE_key_add ( ( ID  * ) lt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										key - > type  =  KEY_RELATIVE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										newkey  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( newkey  | |  from_mix  = =  false )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										kb  =  BKE_keyblock_add_ctime ( key ,  name ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-26 06:34:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! newkey )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											KeyBlock  * basekb  =  ( KeyBlock  * ) key - > block . first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											kb - > data  =  MEM_dupallocN ( basekb - > data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											kb - > totelem  =  basekb - > totelem ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-26 06:34:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_key_convert_from_lattice ( lt ,  kb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-26 06:34:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* copy from current values */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-03 06:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  totelem ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  * data  =  BKE_key_evaluate_object ( scene ,  ob ,  & totelem ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 14:00:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* create new block with prepared data */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										kb  =  BKE_keyblock_add_ctime ( key ,  name ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-03 06:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										kb - > totelem  =  totelem ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										kb - > data  =  data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 18:03:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  kb ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/************************* Curve ************************/  
						 
					
						
							
								
									
										
										
										
											2014-02-03 18:55:59 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  KeyBlock  * insert_curvekey ( Scene  * scene ,  Object  * ob ,  const  char  * name ,  const  bool  from_mix )  
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Curve  * cu  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Key  * key  =  cu - > key ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									KeyBlock  * kb ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ListBase  * lb  =  BKE_curve_nurbs_get ( cu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  newkey  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( key  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										key  =  cu - > key  =  BKE_key_add ( ( ID  * ) cu ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										key - > type  =  KEY_RELATIVE ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										newkey  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( newkey  | |  from_mix  = =  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* create from curve */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										kb  =  BKE_keyblock_add_ctime ( key ,  name ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-26 19:07:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! newkey )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											KeyBlock  * basekb  =  ( KeyBlock  * ) key - > block . first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											kb - > data  =  MEM_dupallocN ( basekb - > data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											kb - > totelem  =  basekb - > totelem ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-26 06:34:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_key_convert_from_curve ( cu ,  kb ,  lb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-26 06:34:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* copy from current values */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-03 06:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  totelem ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  * data  =  BKE_key_evaluate_object ( scene ,  ob ,  & totelem ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 14:00:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* create new block with prepared data */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										kb  =  BKE_keyblock_add_ctime ( key ,  name ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-03 06:47:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										kb - > totelem  =  totelem ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										kb - > data  =  data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 18:03:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  kb ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-03 18:55:59 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								KeyBlock  * BKE_object_insert_shape_key ( Scene  * scene ,  Object  * ob ,  const  char  * name ,  const  bool  from_mix )  
						 
					
						
							
								
									
										
										
										
											2012-03-25 22:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ 	 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( ob - > type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_MESH : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  insert_meshkey ( scene ,  ob ,  name ,  from_mix ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_CURVE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_SURF : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  insert_curvekey ( scene ,  ob ,  name ,  from_mix ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_LATTICE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  insert_lattkey ( scene ,  ob ,  name ,  from_mix ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 15:26:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 03:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_object_is_child_recursive ( Object  * ob_parent ,  Object  * ob_child )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2013-03-11 16:23:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( ob_child  =  ob_child - > parent ;  ob_child ;  ob_child  =  ob_child - > parent )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ob_child  = =  ob_parent )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 03:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 08:53:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* most important if this is modified it should _always_ return True, in certain
  
						 
					
						
							
								
									
										
										
										
											2012-04-30 12:49:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  cases  false  positives  are  hard  to  avoid  ( shape  keys  for  example )  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  BKE_object_is_modified ( Scene  * scene ,  Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2011-03-16 08:53:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  flag  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 08:53:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-09-23 18:50:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BKE_key_from_object ( ob ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 14:53:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										flag  | =  eModifierMode_Render  |  eModifierMode_Realtime ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 08:53:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ModifierData  * md ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:05:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										VirtualModifierData  virtualModifierData ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 08:53:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* cloth */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:05:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( md  =  modifiers_getVirtualModifierList ( ob ,  & virtualModifierData ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										     md  & &  ( flag  ! =  ( eModifierMode_Render  |  eModifierMode_Realtime ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										     md  =  md - > next ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 12:49:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ( flag  &  eModifierMode_Render )  = =  0  & &  modifier_isEnabled ( scene ,  md ,  eModifierMode_Render ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												flag  | =  eModifierMode_Render ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 12:49:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ( flag  &  eModifierMode_Realtime )  = =  0  & &  modifier_isEnabled ( scene ,  md ,  eModifierMode_Realtime ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												flag  | =  eModifierMode_Realtime ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  flag ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* test if object is affected by deforming modifiers (for motion blur). again
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  most  important  is  to  avoid  false  positives ,  this  is  to  skip  computations 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  and  we  can  still  if  there  was  actual  deformation  afterwards  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  BKE_object_is_deform_modified ( Scene  * scene ,  Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2012-04-30 12:49:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ModifierData  * md ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:05:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VirtualModifierData  virtualModifierData ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  flag  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 12:49:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-20 00:11:16 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BKE_key_from_object ( ob ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										flag  | =  eModifierMode_Realtime  |  eModifierMode_Render ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-19 14:23:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 12:49:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* cloth */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:05:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( md  =  modifiers_getVirtualModifierList ( ob ,  & virtualModifierData ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									     md  & &  ( flag  ! =  ( eModifierMode_Render  |  eModifierMode_Realtime ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									     md  =  md - > next ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 12:49:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ModifierTypeInfo  * mti  =  modifierType_getInfo ( md - > type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( mti - > type  = =  eModifierTypeType_OnlyDeform )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! ( flag  &  eModifierMode_Render )  & &  modifier_isEnabled ( scene ,  md ,  eModifierMode_Render ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												flag  | =  eModifierMode_Render ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! ( flag  &  eModifierMode_Realtime )  & &  modifier_isEnabled ( scene ,  md ,  eModifierMode_Realtime ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												flag  | =  eModifierMode_Realtime ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 08:53:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  flag ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2011-03-27 23:11:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-15 13:39:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* See if an object is using an animated modifier */  
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  BKE_object_is_animated ( Scene  * scene ,  Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2012-05-15 13:39:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ModifierData  * md ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:05:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VirtualModifierData  virtualModifierData ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-15 13:39:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 09:05:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( md  =  modifiers_getVirtualModifierList ( ob ,  & virtualModifierData ) ;  md ;  md  =  md - > next ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-22 22:03:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( modifier_dependsOnTime ( md )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    ( modifier_isEnabled ( scene ,  md ,  eModifierMode_Realtime )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										     modifier_isEnabled ( scene ,  md ,  eModifierMode_Render ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-22 22:03:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 05:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-15 13:39:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 23:11:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  copy_object__forwardModifierLinks ( void  * UNUSED ( userData ) ,  Object  * UNUSED ( ob ) ,  ID  * * idpoin )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* this is copied from ID_NEW; it might be better to have a macro */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( * idpoin  & &  ( * idpoin ) - > newid )  * idpoin  =  ( * idpoin ) - > newid ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 23:11:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  BKE_object_relink ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2011-03-27 23:11:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > id . lib ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 23:11:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-11 11:47:07 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BKE_constraints_relink ( & ob - > constraints ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > pose )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 23:11:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bPoseChannel  * chan ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( chan  =  ob - > pose - > chanbase . first ;  chan ;  chan  =  chan - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-11 11:47:07 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_constraints_relink ( & chan - > constraints ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 23:11:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									modifiers_foreachIDLink ( ob ,  copy_object__forwardModifierLinks ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > adt ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 23:11:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_relink_animdata ( ob - > adt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-09 10:04:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > rigidbody_constraint ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_rigidbody_relink_constraint ( ob - > rigidbody_constraint ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 23:11:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ID_NEW ( ob - > parent ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ID_NEW ( ob - > proxy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ID_NEW ( ob - > proxy_group ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-09-09 11:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								MovieClip  * BKE_object_movieclip_get ( Scene  * scene ,  Object  * ob ,  bool  use_default )  
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									MovieClip  * clip  =  use_default  ?  scene - > clip  :  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bConstraint  * con  =  ob - > constraints . first ,  * scon  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( con )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( con - > type  = =  CONSTRAINT_TYPE_CAMERASOLVER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( scon  = =  NULL  | |  ( scon - > flag  &  CONSTRAINT_OFF ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												scon  =  con ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										con  =  con - > next ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-23 02:17:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( scon )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bCameraSolverConstraint  * solver  =  scon - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ( solver - > flag  &  CAMERASOLVER_ACTIVECLIP )  = =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											clip  =  solver - > clip ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-06 15:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											clip  =  scene - > clip ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  clip ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Find  an  associated  Armature  object 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  Object  * obrel_armature_find ( Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob_arm  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > parent  & &  ob - > partype  = =  PARSKEL  & &  ob - > parent - > type  = =  OB_ARMATURE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob_arm  =  ob - > parent ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 22:05:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ModifierData  * mod ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( mod  =  ( ModifierData  * ) ob - > modifiers . first ;  mod ;  mod  =  mod - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( mod - > type  = =  eModifierType_Armature )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 22:05:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob_arm  =  ( ( ArmatureModifierData  * ) mod ) - > object ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ob_arm ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-22 02:48:11 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  bool  obrel_list_test ( Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ob  & &  ! ( ob - > id . flag  &  LIB_DOIT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  obrel_list_add ( LinkNode  * * links ,  Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BLI_linklist_prepend ( links ,  ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > id . flag  | =  LIB_DOIT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Iterates  over  all  objects  of  the  given  scene . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Depending  on  the  eObjectSet  flag : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  collect  either  OB_SET_ALL ,  OB_SET_VISIBLE  or  OB_SET_SELECTED  objects . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  If  OB_SET_VISIBLE  or  OB_SET_SELECTED  are  collected ,  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  then  also  add  related  objects  according  to  the  given  includeFilters . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-18 09:45:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								LinkNode  * BKE_object_relational_superset ( struct  Scene  * scene ,  eObjectSet  objectSet ,  eObRelationTypes  includeFilter )  
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									LinkNode  * links  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Base  * base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* Remove markers from all objects */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( base  =  scene - > base . first ;  base ;  base  =  base - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										base - > object - > id . flag  & =  ~ LIB_DOIT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* iterate over all selected and visible objects */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( base  =  scene - > base . first ;  base ;  base  =  base - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( objectSet  = =  OB_SET_ALL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-07 22:51:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* as we get all anyways just add it */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Object  * ob  =  base - > object ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											obrel_list_add ( & links ,  ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 22:05:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ( objectSet  = =  OB_SET_SELECTED  & &  TESTBASELIB_BGMODE ( ( ( View3D  * ) NULL ) ,  scene ,  base ) )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											    ( objectSet  = =  OB_SET_VISIBLE   & &  BASE_EDITABLE_BGMODE ( ( ( View3D  * ) NULL ) ,  scene ,  base ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Object  * ob  =  base - > object ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( obrel_list_test ( ob ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													obrel_list_add ( & links ,  ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* parent relationship */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 22:05:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( includeFilter  &  ( OB_REL_PARENT  |  OB_REL_PARENT_RECURSIVE ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Object  * parent  =  ob - > parent ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( obrel_list_test ( parent ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														obrel_list_add ( & links ,  parent ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														/* recursive parent relationship */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( includeFilter  &  OB_REL_PARENT_RECURSIVE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															parent  =  parent - > parent ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 22:05:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															while  ( obrel_list_test ( parent ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																obrel_list_add ( & links ,  parent ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																parent  =  parent - > parent ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* child relationship */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 22:05:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( includeFilter  &  ( OB_REL_CHILDREN  |  OB_REL_CHILDREN_RECURSIVE ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Base  * local_base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( local_base  =  scene - > base . first ;  local_base ;  local_base  =  local_base - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( BASE_EDITABLE_BGMODE ( ( ( View3D  * ) NULL ) ,  scene ,  local_base ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															Object  * child  =  local_base - > object ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( obrel_list_test ( child ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-09 03:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																if  ( ( includeFilter  &  OB_REL_CHILDREN_RECURSIVE  & &  BKE_object_is_child_recursive ( ob ,  child ) )  | | 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 22:05:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																    ( includeFilter  &  OB_REL_CHILDREN  & &  child - > parent  & &  child - > parent  = =  ob ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																	obrel_list_add ( & links ,  child ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* include related armatures */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( includeFilter  &  OB_REL_MOD_ARMATURE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Object  * arm  =  obrel_armature_find ( ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( obrel_list_test ( arm ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														obrel_list_add ( & links ,  arm ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 22:05:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-12 21:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  links ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2012-07-18 09:45:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  return  all  groups  this  object  is  apart  of ,  caller  must  free . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								struct  LinkNode  * BKE_object_groups ( Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									LinkNode  * group_linknode  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Group  * group  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-03 11:28:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( ( group  =  BKE_group_object_find ( group ,  ob ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-18 09:45:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_linklist_prepend ( & group_linknode ,  group ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  group_linknode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  BKE_object_groups_clear ( Scene  * scene ,  Base  * base ,  Object  * object )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Group  * group  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-09-15 07:31:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_assert ( ( base  = =  NULL )  | |  ( base - > object  = =  object ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-18 09:45:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( scene  & &  base  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										base  =  BKE_scene_base_find ( scene ,  object ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-04-03 11:28:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( ( group  =  BKE_group_object_find ( group ,  base - > object ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_group_object_unlink ( group ,  object ,  scene ,  base ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-18 09:45:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Return  a  KDTree  from  the  deformed  object  ( in  worldspace ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  \ note  Only  mesh  objects  currently  support  deforming ,  others  are  TODO . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  \ param  ob 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  \ param  r_tot 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  \ return  The  kdtree  or  NULL  if  it  can ' t  be  created . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								KDTree  * BKE_object_as_kdtree ( Object  * ob ,  int  * r_tot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									KDTree  * tree  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unsigned  int  tot  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( ob - > type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_MESH : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Mesh  * me  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											unsigned  int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DerivedMesh  * dm  =  ob - > derivedDeform  ?  ob - > derivedDeform  :  ob - > derivedFinal ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-27 00:20:13 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											const  int  * index ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( dm  & &  ( index  =  CustomData_get_layer ( & dm - > vertData ,  CD_ORIGINDEX ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												MVert  * mvert  =  dm - > getVertArray ( dm ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												unsigned  int  totvert  =  dm - > getNumVerts ( dm ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* tree over-allocs in case where some verts have ORIGINDEX_NONE */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												tot  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												tree  =  BLI_kdtree_new ( totvert ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* we don't how how many verts from the DM we can use */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( i  =  0 ;  i  <  totvert ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( index [ i ]  ! =  ORIGINDEX_NONE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-12 19:51:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														float  co [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														mul_v3_m4v3 ( co ,  ob - > obmat ,  mvert [ i ] . co ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-18 09:05:07 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														BLI_kdtree_insert ( tree ,  index [ i ] ,  co ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														tot + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												MVert  * mvert  =  me - > mvert ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												tot  =  me - > totvert ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												tree  =  BLI_kdtree_new ( tot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( i  =  0 ;  i  <  tot ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-12 19:51:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													float  co [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													mul_v3_m4v3 ( co ,  ob - > obmat ,  mvert [ i ] . co ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-18 09:05:07 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													BLI_kdtree_insert ( tree ,  i ,  co ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											BLI_kdtree_balance ( tree ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_CURVE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_SURF : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* TODO: take deformation into account */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Curve  * cu  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											unsigned  int  i ,  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Nurb  * nu ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											tot  =  BKE_nurbList_verts_count_without_handles ( & cu - > nurb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											tree  =  BLI_kdtree_new ( tot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											i  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											nu  =  cu - > nurb . first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											while  ( nu )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( nu - > bezt )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													BezTriple  * bezt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bezt  =  nu - > bezt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													a  =  nu - > pntsu ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													while  ( a - - )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-12 19:51:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														float  co [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														mul_v3_m4v3 ( co ,  ob - > obmat ,  bezt - > vec [ 1 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-18 09:05:07 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														BLI_kdtree_insert ( tree ,  i + + ,  co ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														bezt + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													BPoint  * bp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bp  =  nu - > bp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													a  =  nu - > pntsu  *  nu - > pntsv ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													while  ( a - - )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-12 19:51:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														float  co [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														mul_v3_m4v3 ( co ,  ob - > obmat ,  bp - > vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-18 09:05:07 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														BLI_kdtree_insert ( tree ,  i + + ,  co ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														bp + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												nu  =  nu - > next ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											BLI_kdtree_balance ( tree ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  OB_LATTICE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* TODO: take deformation into account */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Lattice  * lt  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											BPoint  * bp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											unsigned  int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											tot  =  lt - > pntsu  *  lt - > pntsv  *  lt - > pntsw ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											tree  =  BLI_kdtree_new ( tot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											i  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( bp  =  lt - > def ;  i  <  tot ;  bp + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  co [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												mul_v3_m4v3 ( co ,  ob - > obmat ,  bp - > vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-18 09:05:07 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BLI_kdtree_insert ( tree ,  i + + ,  co ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 22:01:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											BLI_kdtree_balance ( tree ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* r_tot  =  tot ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  tree ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}