2011-02-23 10:52:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/*
  
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 *  * * * * *  BEGIN  GPL  LICENSE  BLOCK  * * * * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  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 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  of  the  License ,  or  ( at  your  option )  any  later  version . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  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 . 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  The  Original  Code  is  Copyright  ( C )  2008  Blender  Foundation 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  All  rights  reserved . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Contributor ( s ) :  Joshua  Leung 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  * * * * *  END  GPL  LICENSE  BLOCK  * * * * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 20:29:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/** \file blender/editors/animation/keyframes_general.c
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *   \ ingroup  edanimation 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <stdlib.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <string.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <math.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <float.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "MEM_guardedalloc.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BLI_blenlib.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-01-07 18:36:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_utildefines.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_anim_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "DNA_object_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_scene_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-16 04:45:52 +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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_fcurve.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_report.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_library.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_global.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "RNA_access.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-02-14 17:55:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "RNA_enum_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "ED_anim_api.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "ED_keyframing.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "ED_keyframes_edit.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* This file contains code for various keyframe-editing tools which are 'destructive'
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  ( i . e .  they  will  modify  the  order  of  the  keyframes ,  and  change  the  size  of  the  array ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  While  some  of  these  tools  may  eventually  be  moved  out  into  blenkernel ,  for  now ,  it  is 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  fine  to  have  these  calls  here . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  There  are  also  a  few  tools  here  which  cannot  be  easily  coded  for  in  the  other  system  ( yet ) . 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-22 10:14:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  These  may  also  be  moved  around  at  some  point ,  but  for  now ,  they  are  best  added  here . 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  -  Joshua  Leung ,  Dec  2008 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* **************************************************** */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-30 10:21:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Only delete the nominated keyframe from provided F-Curve. 
  
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 *  Not  recommended  to  be  used  many  times  successively .  For  that 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-30 10:21:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  there  is  delete_fcurve_keys ( ) .  
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-03 18:55:59 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  delete_fcurve_key ( FCurve  * fcu ,  int  index ,  bool  do_recalc )  
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-30 10:21:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* sanity check */ 
							 
						 
					
						
							
								
									
										
											 
										
											
												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  ( fcu  = =  NULL )  
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-30 10:21:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* verify the index:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 	1 )  cannot  be  greater  than  the  number  of  available  keyframes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 	2 )  negative  indices  are  for  specifying  a  value  from  the  end  of  the  array 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( abs ( index )  > =  fcu - > totvert ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-30 10:21:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( index  <  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										index  + =  fcu - > totvert ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-12-30 10:21:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Delete this keyframe */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									memmove ( & fcu - > bezt [ index ] ,  & fcu - > bezt [ index  +  1 ] ,  sizeof ( BezTriple )  *  ( fcu - > totvert  -  index  -  1 ) ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fcu - > totvert - - ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-25 20:19:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( fcu - > totvert  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( fcu - > bezt ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											MEM_freeN ( fcu - > bezt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fcu - > bezt  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-25 20:19:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* recalc handles - only if it won't cause problems */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( do_recalc ) 
							 
						 
					
						
							
								
									
										
											 
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										calchandles_fcurve ( fcu ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:56:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Delete selected keyframes in given F-Curve */  
						 
					
						
							
								
									
										
										
										
											2013-11-25 04:55:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  delete_fcurve_keys ( FCurve  * fcu )  
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-26 06:39:14 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  changed  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( fcu - > bezt  = =  NULL )  /* ignore baked curves */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-25 04:55:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-21 13:11:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:56:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Delete selected BezTriples */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  fcu - > totvert ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:56:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( fcu - > bezt [ i ] . f2  &  SELECT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											memmove ( & fcu - > bezt [ i ] ,  & fcu - > bezt [ i  +  1 ] ,  sizeof ( BezTriple )  *  ( fcu - > totvert  -  i  -  1 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:56:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											fcu - > totvert - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											i - - ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-26 06:39:14 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											changed  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:56:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 11:05:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Free the array of BezTriples if there are not keyframes */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-02 12:21:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( fcu - > totvert  = =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										clear_fcurve_keys ( fcu ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-25 04:55:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-26 06:39:14 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  changed ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  clear_fcurve_keys ( FCurve  * fcu )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( fcu - > bezt ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MEM_freeN ( fcu - > bezt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fcu - > bezt  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fcu - > totvert  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* ---------------- */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:56:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* duplicate selected keyframes for the given F-Curve */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  duplicate_fcurve_keys ( FCurve  * fcu )  
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BezTriple  * newbezt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* this can only work when there is an F-Curve, and also when there are some BezTriples */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-25 22:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ELEM ( NULL ,  fcu ,  fcu - > bezt ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:56:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  fcu - > totvert ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:56:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* If a key is selected */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( fcu - > bezt [ i ] . f2  &  SELECT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* Expand the list */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											newbezt  =  MEM_callocN ( sizeof ( BezTriple )  *  ( fcu - > totvert  +  1 ) ,  " beztriple " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:56:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											memcpy ( newbezt ,  fcu - > bezt ,  sizeof ( BezTriple )  *  ( i  +  1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											memcpy ( newbezt  +  i  +  1 ,  fcu - > bezt  +  i ,  sizeof ( BezTriple ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-17 09:58:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											memcpy ( newbezt  +  i  +  2 ,  fcu - > bezt  +  i  +  1 ,  sizeof ( BezTriple )  *  ( fcu - > totvert  -  ( i  +  1 ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:56:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											fcu - > totvert + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* reassign pointers... (free old, and add new) */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											MEM_freeN ( fcu - > bezt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											fcu - > bezt  =  newbezt ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:56:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* Unselect the current key */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											BEZ_DESEL ( & fcu - > bezt [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											i + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* Select the copied key */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											BEZ_SEL ( & fcu - > bezt [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* **************************************************** */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Various Tools */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Basic F-Curve 'cleanup' function that removes 'double points' and unnecessary keyframes on linear-segments only */  
						 
					
						
							
								
									
										
											 
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  clean_fcurve ( FCurve  * fcu ,  float  thresh )  
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BezTriple  * old_bezts ,  * bezt ,  * beztn ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BezTriple  * lastb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  totCount ,  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* check if any points  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-11 08:15:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ( fcu  = =  NULL )  | |  ( fcu - > bezt  = =  NULL )  | |  ( fcu - > totvert  < =  1 ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-06-11 11:11:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* make a copy of the old BezTriples, and clear F-Curve */ 
							 
						 
					
						
							
								
									
										
											 
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									old_bezts  =  fcu - > bezt ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-21 05:46:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									totCount  =  fcu - > totvert ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fcu - > bezt  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fcu - > totvert  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* now insert first keyframe, as it should be ok */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezt  =  old_bezts ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-28 09:55:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									insert_vert_fcurve ( fcu ,  bezt - > vec [ 1 ] [ 0 ] ,  bezt - > vec [ 1 ] [ 1 ] ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* Loop through BezTriples, comparing them. Skip any that do 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  not  fit  the  criteria  for  " ok "  points . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  1 ;  i  <  totCount ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										float  prev [ 2 ] ,  cur [ 2 ] ,  next [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* get BezTriples and their values */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( i  <  ( totCount  -  1 ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											beztn  =  ( old_bezts  +  ( i  +  1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											next [ 0 ]  =  beztn - > vec [ 1 ] [ 0 ] ;  next [ 1 ]  =  beztn - > vec [ 1 ] [ 1 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											beztn  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											next [ 0 ]  =  next [ 1 ]  =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										lastb  =  ( fcu - > bezt  +  ( fcu - > totvert  -  1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bezt  =  ( old_bezts  +  i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* get references for quicker access */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										prev [ 0 ]  =  lastb - > vec [ 1 ] [ 0 ] ;  prev [ 1 ]  =  lastb - > vec [ 1 ] [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										cur [ 0 ]  =  bezt - > vec [ 1 ] [ 0 ] ;  cur [ 1 ]  =  bezt - > vec [ 1 ] [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* check if current bezt occurs at same time as last ok */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( IS_EQT ( cur [ 0 ] ,  prev [ 0 ] ,  thresh ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* If there is a next beztriple, and if occurs at the same time, only insert 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											 *  if  there  is  a  considerable  distance  between  the  points ,  and  also  if  the  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											 *  current  is  further  away  than  the  next  one  is  to  the  previous . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( beztn  & &  ( IS_EQT ( cur [ 0 ] ,  next [ 0 ] ,  thresh ) )  & &  
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											    ( IS_EQT ( next [ 1 ] ,  prev [ 1 ] ,  thresh )  = =  0 ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* only add if current is further away from previous */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( cur [ 1 ]  >  next [ 1 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( IS_EQT ( cur [ 1 ] ,  prev [ 1 ] ,  thresh )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														/* add new keyframe */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-28 09:55:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														insert_vert_fcurve ( fcu ,  cur [ 0 ] ,  cur [ 1 ] ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* only add if values are a considerable distance apart */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( IS_EQT ( cur [ 1 ] ,  prev [ 1 ] ,  thresh )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* add new keyframe */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-28 09:55:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													insert_vert_fcurve ( fcu ,  cur [ 0 ] ,  cur [ 1 ] ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* checks required are dependent on whether this is last keyframe or not */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( beztn )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* does current have same value as previous and next? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( IS_EQT ( cur [ 1 ] ,  prev [ 1 ] ,  thresh )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* add new keyframe*/ 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-28 09:55:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													insert_vert_fcurve ( fcu ,  cur [ 0 ] ,  cur [ 1 ] ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  if  ( IS_EQT ( cur [ 1 ] ,  next [ 1 ] ,  thresh )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* add new keyframe */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-28 09:55:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													insert_vert_fcurve ( fcu ,  cur [ 0 ] ,  cur [ 1 ] ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-21 05:46:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												/* add if value doesn't equal that of previous */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( IS_EQT ( cur [ 1 ] ,  prev [ 1 ] ,  thresh )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* add new keyframe */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-28 09:55:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													insert_vert_fcurve ( fcu ,  cur [ 0 ] ,  cur [ 1 ] ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* now free the memory used by the old BezTriples */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( old_bezts ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MEM_freeN ( old_bezts ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* ---------------- */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-30 10:21:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* temp struct used for smooth_fcurve */  
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								typedef  struct  tSmooth_Bezt  {  
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  * h1 ,  * h2 ,  * h3 ;     /* bezt->vec[0,1,2][1] */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  y1 ,  y2 ,  y3 ;        /* averaged before/new/after y-values */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  tSmooth_Bezt ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Use a weighted moving-means method to reduce intensity of fluctuations */  
						 
					
						
							
								
									
										
										
										
											2011-03-12 01:09:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// TODO: introduce scaling factor for weighting falloff
  
						 
					
						
							
								
									
										
										
										
											2012-04-29 17:11:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  smooth_fcurve ( FCurve  * fcu )  
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BezTriple  * bezt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  i ,  x ,  totSel  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-11 08:15:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( fcu - > bezt  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-12 01:09:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* first loop through - count how many verts are selected */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bezt  =  fcu - > bezt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  fcu - > totvert ;  i + + ,  bezt + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-12 01:09:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( BEZSELECTED ( bezt ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											totSel + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* if any points were selected, allocate tSmooth_Bezt points to work on */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( totSel  > =  3 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										tSmooth_Bezt  * tarray ,  * tsb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* allocate memory in one go */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										tsb  =  tarray  =  MEM_callocN ( totSel  *  sizeof ( tSmooth_Bezt ) ,  " tSmooth_Bezt Array " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* populate tarray with data of selected points */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bezt  =  fcu - > bezt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( i  =  0 ,  x  =  0 ;  ( i  <  fcu - > totvert )  & &  ( x  <  totSel ) ;  i + + ,  bezt + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( BEZSELECTED ( bezt ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* tsb simply needs pointer to vec, and index */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												tsb - > h1  =  & bezt - > vec [ 0 ] [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												tsb - > h2  =  & bezt - > vec [ 1 ] [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												tsb - > h3  =  & bezt - > vec [ 2 ] [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* advance to the next tsb to populate */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( x  <  totSel  -  1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													tsb + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* calculate the new smoothed F-Curve's with weighted averages:
 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 01:53:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 * 	-  this  is  done  with  two  passes  to  avoid  progressive  corruption  errors 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 * 	-  uses  5  points  for  each  operation  ( which  stores  in  the  relevant  handles ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 * 	-    previous :  w / a  ratio  =  3 : 5 : 2 : 1 : 1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 * 	-    next :  w / a  ratio  =  1 : 1 : 2 : 5 : 3 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2011-03-12 01:09:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* round 1: calculate smoothing deltas and new values */  
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										tsb  =  tarray ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( i  =  0 ;  i  <  totSel ;  i + + ,  tsb + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-12 01:09:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* don't touch end points (otherwise, curves slowly explode, as we don't have enough data there) */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ELEM ( i ,  0 ,  ( totSel  -  1 ) )  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												const  tSmooth_Bezt  * tP1  =  tsb  -  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												const  tSmooth_Bezt  * tP2  =  ( i  -  2  >  0 )  ?  ( tsb  -  2 )  :  ( NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												const  tSmooth_Bezt  * tN1  =  tsb  +  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												const  tSmooth_Bezt  * tN2  =  ( i  +  2  <  totSel )  ?  ( tsb  +  2 )  :  ( NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  float  p1  =  * tP1 - > h2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  float  p2  =  ( tP2 )  ?  ( * tP2 - > h2 )  :  ( * tP1 - > h2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  float  c1  =  * tsb - > h2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  float  n1  =  * tN1 - > h2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  float  n2  =  ( tN2 )  ?  ( * tN2 - > h2 )  :  ( * tN1 - > h2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2011-03-12 01:09:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* calculate previous and next, then new position by averaging these */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												tsb - > y1  =  ( 3  *  p2  +  5  *  p1  +  2  *  c1  +  n1  +  n2 )  /  12 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												tsb - > y3  =  ( p2  +  p1  +  2  *  c1  +  5  *  n1  +  3  *  n2 )  /  12 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-12 01:09:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												tsb - > y2  =  ( tsb - > y1  +  tsb - > y3 )  /  2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2011-03-12 01:09:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* round 2: apply new values */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										tsb  =  tarray ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( i  =  0 ;  i  <  totSel ;  i + + ,  tsb + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-03-22 16:57:57 +13:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* don't touch end points, as their values weren't touched above */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ELEM ( i ,  0 ,  ( totSel  -  1 ) )  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-12 01:09:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* y2 takes the average of the 2 points */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												* tsb - > h2  =  tsb - > y2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* handles are weighted between their original values and the averaged values */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												* tsb - > h1  =  ( ( * tsb - > h1 )  *  0.7f )  +  ( tsb - > y1  *  0.3f ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												* tsb - > h3  =  ( ( * tsb - > h3 )  *  0.7f )  +  ( tsb - > y3  *  0.3f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-28 09:55:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-08-26 00:38:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* free memory required for tarray */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MEM_freeN ( tarray ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-28 09:55:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									/* recalculate handles */ 
							 
						 
					
						
							
								
									
										
											 
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									calchandles_fcurve ( fcu ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* ---------------- */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* little cache for values... */  
						 
					
						
							
								
									
										
										
										
											2012-06-10 15:20:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								typedef  struct  TempFrameValCache  {  
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  frame ,  val ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-10 15:20:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  TempFrameValCache ;  
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Evaluates the curves between each selected keyframe on each frame, and keys the value  */  
						 
					
						
							
								
									
										
										
										
											2012-04-29 17:11:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  sample_fcurve ( FCurve  * fcu )  
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BezTriple  * bezt ,  * start  =  NULL ,  * end  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-10 15:20:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TempFrameValCache  * value_cache ,  * fp ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  sfra ,  range ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  i ,  n ,  nIndex ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-03 13:20:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( fcu - > bezt  = =  NULL )  /* ignore baked */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-03 13:59:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* find selected keyframes... once pair has been found, add keyframes  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  0 ,  bezt  =  fcu - > bezt ;  i  <  fcu - > totvert ;  i + + ,  bezt + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* check if selected, and which end this is */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( BEZSELECTED ( bezt ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( start )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* set end */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												end  =  bezt ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* cache values then add keyframes using these values, as adding
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												 *  keyframes  while  sampling  will  affect  the  outcome . . . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												 * 	-  only  start  sampling + adding  from  index = 1 ,  so  that  we  don ' t  overwrite  original  keyframe 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												 */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-27 09:49:31 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												range  =  ( int ) ( ceil ( end - > vec [ 1 ] [ 0 ]  -  start - > vec [ 1 ] [ 0 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sfra  =  ( int ) ( floor ( start - > vec [ 1 ] [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( range )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-10 15:20:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													value_cache  =  MEM_callocN ( sizeof ( TempFrameValCache )  *  range ,  " IcuFrameValCache " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													
							 
						 
					
						
							
								
									
										
										
										
											2012-06-11 11:11:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													/* sample values */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													for  ( n  =  1 ,  fp  =  value_cache ;  n  <  range  & &  fp ;  n + + ,  fp + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														fp - > frame  =  ( float ) ( sfra  +  n ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														fp - > val  =  evaluate_fcurve ( fcu ,  fp - > frame ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													
							 
						 
					
						
							
								
									
										
										
										
											2012-06-11 11:11:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													/* add keyframes with these, tagging as 'breakdowns' */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													for  ( n  =  1 ,  fp  =  value_cache ;  n  <  range  & &  fp ;  n + + ,  fp + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														nIndex  =  insert_vert_fcurve ( fcu ,  fp - > frame ,  fp - > val ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														BEZKEYTYPE ( fcu - > bezt  +  nIndex )  =  BEZT_KEYTYPE_BREAKDOWN ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* free temp cache */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													MEM_freeN ( value_cache ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* as we added keyframes, we need to compensate so that bezt is at the right place */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bezt  =  fcu - > bezt  +  i  +  range  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													i  + =  ( range  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* bezt was selected, so it now marks the start of a whole new chain to search */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												start  =  bezt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												end  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* just set start keyframe */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												start  =  bezt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												end  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* recalculate channel's handles? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									calchandles_fcurve ( fcu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-29 01:19:25 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/* **************************************************** */  
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Copy/Paste Tools */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* - The copy/paste buffer currently stores a set of temporary F-Curves containing only the keyframes 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *    that  were  selected  in  each  of  the  original  F - Curves 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  -  All  pasted  frames  are  offset  by  the  same  amount .  This  is  calculated  as  the  difference  in  the  times  of 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 	the  current  frame  and  the  ' first  keyframe '  ( i . e .  the  earliest  one  in  all  channels ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  -  The  earliest  frame  is  calculated  per  copy  operation . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* globals for copy/paste data (like for other copy/paste buffers) */  
						 
					
						
							
								
									
										
										
										
											2011-02-14 17:55:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  ListBase  animcopybuf  =  { NULL ,  NULL } ;  
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  float  animcopy_firstframe  =  999999999.0f ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  float  animcopy_lastframe  =  - 999999999.0f ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  float  animcopy_cfra  =  0.0 ;  
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* datatype for use in copy/paste buffer */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								typedef  struct  tAnimCopybufItem  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									struct  tAnimCopybufItem  * next ,  * prev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ID  * id ;              /* ID which owns the curve */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bActionGroup  * grp ;   /* Action Group */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									char  * rna_path ;      /* RNA-Path */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  array_index ;     /* array index */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  totvert ;         /* number of keyframes stored for this channel */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BezTriple  * bezt ;     /* keyframes in buffer */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									short  id_type ;       /* Result of GS(id->name)*/ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  tAnimCopybufItem ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* This function frees any MEM_calloc'ed copy/paste buffer data */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// XXX find some header to put this in!
  
						 
					
						
							
								
									
										
										
										
											2012-04-29 17:11:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  free_anim_copybuf ( void )  
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tAnimCopybufItem  * aci ,  * acn ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* free each buffer element */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( aci  =  animcopybuf . first ;  aci ;  aci  =  acn )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										acn  =  aci - > next ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* free keyframes */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( aci - > bezt )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											MEM_freeN ( aci - > bezt ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* free RNA-path */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( aci - > rna_path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											MEM_freeN ( aci - > rna_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* free ourself */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BLI_freelinkN ( & animcopybuf ,  aci ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* restore initial state */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 06:07:10 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_listbase_clear ( & animcopybuf ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									animcopy_firstframe  =  999999999.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									animcopy_lastframe  =  - 999999999.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* ------------------- */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* This function adds data to the keyframes copy/paste buffer, freeing existing data first */  
						 
					
						
							
								
									
										
										
										
											2012-04-29 17:11:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								short  copy_animedit_keys ( bAnimContext  * ac ,  ListBase  * anim_data )  
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ 	 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bAnimListElem  * ale ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Scene  * scene  =  ac - > scene ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* clear buffer first */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									free_anim_copybuf ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-03-07 04:24:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* assume that each of these is an F-Curve */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( ale  =  anim_data - > first ;  ale ;  ale  =  ale - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										FCurve  * fcu  =  ( FCurve  * ) ale - > key_data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										tAnimCopybufItem  * aci ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-15 17:36:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BezTriple  * bezt ,  * nbezt ,  * newbuf ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-03-07 04:24:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* firstly, check if F-Curve has any selected keyframes
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 * 	-  skip  if  no  selected  keyframes  found  ( so  no  need  to  create  unnecessary  copy - buffer  data ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 * 	-  this  check  should  also  eliminate  any  problems  associated  with  using  sample - data 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-02 12:02:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ANIM_fcurve_keyframes_loop ( NULL ,  fcu ,  NULL ,  ANIM_editkeyframes_ok ( BEZT_OK_SELECTED ) ,  NULL )  = =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-07 04:24:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* init copybuf item info */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										aci  =  MEM_callocN ( sizeof ( tAnimCopybufItem ) ,  " AnimCopybufItem " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										aci - > id  =  ale - > id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										aci - > id_type  =  GS ( ale - > id - > name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										aci - > grp  =  fcu - > grp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										aci - > rna_path  =  MEM_dupallocN ( fcu - > rna_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										aci - > array_index  =  fcu - > array_index ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_addtail ( & animcopybuf ,  aci ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* add selected keyframes to buffer */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-26 12:02:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* TODO: currently, we resize array every time we add a new vert -
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 *  this  works  ok  as  long  as  it  is  assumed  only  a  few  keys  are  copied  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( i  =  0 ,  bezt  =  fcu - > bezt ;  i  <  fcu - > totvert ;  i + + ,  bezt + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( BEZSELECTED ( bezt ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* add to buffer */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												newbuf  =  MEM_callocN ( sizeof ( BezTriple )  *  ( aci - > totvert  +  1 ) ,  " copybuf beztriple " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-03-08 04:12:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* assume that since we are just re-sizing the array, just copy all existing data across */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( aci - > bezt ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													memcpy ( newbuf ,  aci - > bezt ,  sizeof ( BezTriple )  *  ( aci - > totvert ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* copy current beztriple across too */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												nbezt  =  & newbuf [ aci - > totvert ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												* nbezt  =  * bezt ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2010-12-15 17:36:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* ensure copy buffer is selected so pasted keys are selected */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BEZ_SEL ( nbezt ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* free old array and set the new */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( aci - > bezt )  MEM_freeN ( aci - > bezt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												aci - > bezt  =  newbuf ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												aci - > totvert + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* check if this is the earliest frame encountered so far */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( bezt - > vec [ 1 ] [ 0 ]  <  animcopy_firstframe ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													animcopy_firstframe  =  bezt - > vec [ 1 ] [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( bezt - > vec [ 1 ] [ 0 ]  >  animcopy_lastframe ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													animcopy_lastframe  =  bezt - > vec [ 1 ] [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* check if anything ended up in the buffer */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ELEM ( NULL ,  animcopybuf . first ,  animcopybuf . last ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-09 00:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* in case 'relative' paste method is used */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									animcopy_cfra  =  CFRA ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* everything went fine */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* ------------------- */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* most strict method: exact matches only */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  tAnimCopybufItem  * pastebuf_match_path_full ( FCurve  * fcu ,  const  short  from_single ,  const  short  to_simple )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									tAnimCopybufItem  * aci ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( aci  =  animcopybuf . first ;  aci ;  aci  =  aci - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* check that paths exist */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( to_simple  | |  ( aci - > rna_path  & &  fcu - > rna_path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( to_simple  | |  ( strcmp ( aci - > rna_path ,  fcu - > rna_path )  = =  0 ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ( from_single )  | |  ( aci - > array_index  = =  fcu - > array_index ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  aci ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* medium match strictness: path match only (i.e. ignore ID) */  
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  tAnimCopybufItem  * pastebuf_match_path_property ( FCurve  * fcu ,  const  short  from_single ,  const  short  UNUSED ( to_simple ) )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tAnimCopybufItem  * aci ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( aci  =  animcopybuf . first ;  aci ;  aci  =  aci - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* check that paths exist */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( aci - > rna_path  & &  fcu - > rna_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* find the property of the fcurve and compare against the end of the tAnimCopybufItem
 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											 *  more  involved  since  it  needs  to  to  path  lookups . 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											 *  This  is  not  100 %  reliable  since  the  user  could  be  editing  the  curves  on  a  path  that  wont 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											 *  resolve ,  or  a  bone  could  be  renamed  after  copying  for  eg .  but  in  normal  copy  &  paste 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											 *  this  should  work  out  ok .  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( BLI_findindex ( which_libbase ( G . main ,  aci - > id_type ) ,  aci - > id )  = =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* pedantic but the ID could have been removed, and beats crashing! */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												printf ( " paste_animedit_keys: error ID has been removed! \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												PointerRNA  id_ptr ,  rptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												PropertyRNA  * prop ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												RNA_id_pointer_create ( aci - > id ,  & id_ptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-27 11:54:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( RNA_path_resolve_property ( & id_ptr ,  aci - > rna_path ,  & rptr ,  & prop ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													const  char  * identifier  =  RNA_property_identifier ( prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													int  len_id  =  strlen ( identifier ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  len_path  =  strlen ( fcu - > rna_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( len_id  < =  len_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														/* note, paths which end with "] will fail with this test - Animated ID Props */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( strcmp ( identifier ,  fcu - > rna_path  +  ( len_path  -  len_id ) )  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															if  ( ( from_single )  | |  ( aci - > array_index  = =  fcu - > array_index ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													printf ( " paste_animedit_keys: failed to resolve path id:%s, '%s'! \n " ,  aci - > id - > name ,  aci - > rna_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  aci ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* least strict matching heuristic: indices only */  
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  tAnimCopybufItem  * pastebuf_match_index_only ( FCurve  * fcu ,  const  short  from_single ,  const  short  UNUSED ( to_simple ) )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tAnimCopybufItem  * aci ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( aci  =  animcopybuf . first ;  aci ;  aci  =  aci - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* check that paths exist */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ( from_single )  | |  ( aci - > array_index  = =  fcu - > array_index ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  aci ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* ................ */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* helper for paste_animedit_keys() - performs the actual pasting */  
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  paste_animedit_keys_fcurve ( FCurve  * fcu ,  tAnimCopybufItem  * aci ,  float  offset ,  const  eKeyMergeMode  merge_mode )  
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BezTriple  * bezt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-06-01 13:54:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* First de-select existing FCurve's keyframes */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  0 ,  bezt  =  fcu - > bezt ;  i  <  fcu - > totvert ;  i + + ,  bezt + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bezt - > f2  & =  ~ SELECT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* mix mode with existing data */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( merge_mode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  KEYFRAME_PASTE_MERGE_MIX : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* do-nothing */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  KEYFRAME_PASTE_MERGE_OVER : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* remove all keys */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											clear_fcurve_keys ( fcu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  KEYFRAME_PASTE_MERGE_OVER_RANGE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  f_min ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  f_max ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( merge_mode  = =  KEYFRAME_PASTE_MERGE_OVER_RANGE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												f_min  =  aci - > bezt [ 0 ] . vec [ 1 ] [ 0 ]  +  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												f_max  =  aci - > bezt [ aci - > totvert  -  1 ] . vec [ 1 ] [ 0 ]  +  offset ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  {  /* Entire Range */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												f_min  =  animcopy_firstframe  +  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												f_max  =  animcopy_lastframe  +  offset ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* remove keys in range */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( f_min  <  f_max )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* select verts in range for removal */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( i  =  0 ,  bezt  =  fcu - > bezt ;  i  <  fcu - > totvert ;  i + + ,  bezt + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ( f_min  <  bezt [ 0 ] . vec [ 1 ] [ 0 ] )  & &  ( bezt [ 0 ] . vec [ 1 ] [ 0 ]  <  f_max ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														bezt - > f2  | =  SELECT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* remove frames in the range */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												delete_fcurve_keys ( fcu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* just start pasting, with the the first keyframe on the current frame, and so on */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  0 ,  bezt  =  aci - > bezt ;  i  <  aci - > totvert ;  i + + ,  bezt + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* temporarily apply offset to src beztriple while copying */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bezt - > vec [ 0 ] [ 0 ]  + =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bezt - > vec [ 1 ] [ 0 ]  + =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bezt - > vec [ 2 ] [ 0 ]  + =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* insert the keyframe
 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-26 19:30:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 *  NOTE :  we  do  not  want  to  inherit  handles  from  existing  keyframes  in  this  case ! 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-26 19:30:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										insert_bezt_fcurve ( fcu ,  bezt ,  INSERTKEY_OVERWRITE_FULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* un-apply offset from src beztriple after copying */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bezt - > vec [ 0 ] [ 0 ]  - =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bezt - > vec [ 1 ] [ 0 ]  - =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bezt - > vec [ 2 ] [ 0 ]  - =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* recalculate F-Curve's handles? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									calchandles_fcurve ( fcu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* ------------------- */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								EnumPropertyItem  keyframe_paste_offset_items [ ]  =  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ KEYFRAME_PASTE_OFFSET_CFRA_START ,  " START " ,  0 ,  " Frame Start " ,  " Paste keys starting at current frame " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ KEYFRAME_PASTE_OFFSET_CFRA_END ,  " END " ,  0 ,  " Frame End " ,  " Paste keys ending at current frame " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE ,  " RELATIVE " ,  0 ,  " Frame Relative " ,  " Paste keys relative to the current frame when copying " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ KEYFRAME_PASTE_OFFSET_NONE ,  " NONE " ,  0 ,  " No Offset " ,  " Paste keys from original time " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 0 ,  NULL ,  0 ,  NULL ,  NULL } } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EnumPropertyItem  keyframe_paste_merge_items [ ]  =  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ KEYFRAME_PASTE_MERGE_MIX ,  " MIX " ,  0 ,  " Mix " ,  " Overlay existing with new keys " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ KEYFRAME_PASTE_MERGE_OVER ,  " OVER_ALL " ,  0 ,  " Overwrite All " ,  " Replace all keys " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ KEYFRAME_PASTE_MERGE_OVER_RANGE ,  " OVER_RANGE " ,  0 ,  " Overwrite Range " ,  " Overwrite keys in pasted range " } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL ,  " OVER_RANGE_ALL " ,  0 ,  " Overwrite Entire Range " ,  " Overwrite keys in pasted range, using the range of all copied keys " } , 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 0 ,  NULL ,  0 ,  NULL ,  NULL } } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-29 21:16:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/**
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  This  function  pastes  data  from  the  keyframes  copy / paste  buffer 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  \ return  Status  code  is  whether  the  method  FAILED  to  do  anything 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 01:55:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 17:11:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								short  paste_animedit_keys ( bAnimContext  * ac ,  ListBase  * anim_data ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                          const  eKeyPasteOffset  offset_mode ,  const  eKeyMergeMode  merge_mode ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bAnimListElem  * ale ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Scene  * scene  =  ( ac - > scene ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 06:07:10 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  bool  from_single  =  BLI_listbase_is_single ( & animcopybuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  bool  to_simple  =  BLI_listbase_is_single ( anim_data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  offset  =  0.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  pass ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* check if buffer is empty */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 06:07:10 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BLI_listbase_is_empty ( & animcopybuf ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 01:55:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_report ( ac - > reports ,  RPT_ERROR ,  " No animation data in buffer to paste " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 06:07:10 +11:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BLI_listbase_is_empty ( anim_data ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 01:55:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_report ( ac - > reports ,  RPT_ERROR ,  " No selected F-Curves to paste into " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-15 16:57:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* mathods of offset */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 01:55:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( offset_mode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  KEYFRAME_PASTE_OFFSET_CFRA_START : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											offset  =  ( float ) ( CFRA  -  animcopy_firstframe ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  KEYFRAME_PASTE_OFFSET_CFRA_END : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											offset  =  ( float ) ( CFRA  -  animcopy_lastframe ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											offset  =  ( float ) ( CFRA  -  animcopy_cfra ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  KEYFRAME_PASTE_OFFSET_NONE : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											offset  =  0.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( from_single  & &  to_simple )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* 1:1 match, no tricky checking, just paste */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										FCurve  * fcu ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										tAnimCopybufItem  * aci ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ale  =  anim_data - > first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										fcu  =  ( FCurve  * ) ale - > data ;   /* destination F-Curve */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										aci  =  animcopybuf . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										paste_animedit_keys_fcurve ( fcu ,  aci ,  offset ,  merge_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* from selected channels 
 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 *   This  " passes "  system  aims  to  try  to  find  " matching "  channels  to  paste  keyframes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 *   into  with  increasingly  loose  matching  heuristics .  The  process  finishes  when  at  least 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 *   one  F - Curve  has  been  pasted  into . 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( pass  =  0 ;  pass  <  3 ;  pass + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											unsigned  int  totmatch  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( ale  =  anim_data - > first ;  ale ;  ale  =  ale - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* find buffer item to paste from 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												 * 	-  if  names  don ' t  matter  ( i . e .  only  1  channel  in  buffer ) ,  don ' t  check  id / group 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												 * 	-  if  names  do  matter ,  only  check  if  id - type  is  ok  for  now  ( group  check  is  not  that  important ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												 * 	-  most  importantly ,  rna - paths  should  match  ( array  indices  are  unimportant  for  now ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 04:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												 */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												FCurve  * fcu  =  ( FCurve  * ) ale - > data ;   /* destination F-Curve */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												tAnimCopybufItem  * aci  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												switch  ( pass )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  0 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														/* most strict, must be exact path match data_path & index */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														aci  =  pastebuf_match_path_full ( fcu ,  from_single ,  to_simple ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  1 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														/* less strict, just compare property names */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														aci  =  pastebuf_match_path_property ( fcu ,  from_single ,  to_simple ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  2 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														/* Comparing properties gave no results, so just do index comparisons */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 15:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														aci  =  pastebuf_match_index_only ( fcu ,  from_single ,  to_simple ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* copy the relevant data from the matching buffer curve */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( aci )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													totmatch + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-14 15:14:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													paste_animedit_keys_fcurve ( fcu ,  aci ,  offset ,  merge_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-19 00:24:45 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ale - > update  | =  ANIM_UPDATE_DEFAULT ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-03-18 07:38:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* don't continue if some fcurves were pasted */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( totmatch ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 11:49:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-28 06:24:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2014-05-19 00:24:45 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ANIM_animdata_update ( ac ,  anim_data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-24 11:18:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* **************************************************** */