[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16513] trunk/blender/source/blender: == Keyframing - Cleanup of API ==

Joshua Leung aligorith at gmail.com
Sun Sep 14 06:32:17 CEST 2008


Revision: 16513
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16513
Author:   aligorith
Date:     2008-09-14 06:32:17 +0200 (Sun, 14 Sep 2008)

Log Message:
-----------
== Keyframing - Cleanup of API ==

* Moved all keyframing functions to their own file (keyframing.c)

* Merged all the different keyframing options (needed, visual, fast) into a single API call. The direct benefit of this is that it allows them to be used in conjunction with each other. Also, this means that when using the IKEY, autokeying settings for these are respected too.

* Implemented 'keyingsets' system (instead of directly calling insertkey on relevant channels), which is easier to maintain and cleaner. A keyingset basically defines all the channels that can be keyframed together. This paves the way for custom keyingsets sometime down the track (and also for quick-insert keyframes for previously used keyingset).

Menus for choosing the keying set to use are generated automatically from the definitions.

Modified Paths:
--------------
    trunk/blender/source/blender/include/BSE_editipo.h
    trunk/blender/source/blender/makesdna/DNA_action_types.h
    trunk/blender/source/blender/python/api2_2x/Camera.c
    trunk/blender/source/blender/python/api2_2x/Constraint.c
    trunk/blender/source/blender/python/api2_2x/Ipo.c
    trunk/blender/source/blender/python/api2_2x/Ipocurve.c
    trunk/blender/source/blender/python/api2_2x/Lamp.c
    trunk/blender/source/blender/python/api2_2x/Material.c
    trunk/blender/source/blender/python/api2_2x/Object.c
    trunk/blender/source/blender/python/api2_2x/Pose.c
    trunk/blender/source/blender/python/api2_2x/World.c
    trunk/blender/source/blender/src/editaction.c
    trunk/blender/source/blender/src/editipo.c
    trunk/blender/source/blender/src/editmesh_add.c
    trunk/blender/source/blender/src/editview.c
    trunk/blender/source/blender/src/header_view3d.c
    trunk/blender/source/blender/src/poselib.c
    trunk/blender/source/blender/src/poseobject.c
    trunk/blender/source/blender/src/toets.c
    trunk/blender/source/blender/src/toolbox.c
    trunk/blender/source/blender/src/transform_conversions.c

Added Paths:
-----------
    trunk/blender/source/blender/include/BIF_keyframing.h
    trunk/blender/source/blender/src/keyframing.c

Added: trunk/blender/source/blender/include/BIF_keyframing.h
===================================================================
--- trunk/blender/source/blender/include/BIF_keyframing.h	                        (rev 0)
+++ trunk/blender/source/blender/include/BIF_keyframing.h	2008-09-14 04:32:17 UTC (rev 16513)
@@ -0,0 +1,99 @@
+/**
+ * $Id: BDR_gpencil.h 14444 2008*04*16 22:40:48Z aligorith $
+ *
+ * ***** 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,
+ * Inc., 59 Temple Place * Suite 330, Boston, MA  02111*1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008, Blender Foundation
+ * This is a new part of Blender (with some old code)
+ *
+ * Contributor(s): Joshua Leung
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_KEYFRAMING_H
+#define BIF_KEYFRAMING_H
+
+struct ListBase;
+struct ID;
+
+struct IpoCurve;
+struct BezTriple;
+
+/* ************ Keyframing Management **************** */
+
+/* Lesser Keyframing API call:
+ *	Use this when validation of necessary animation data isn't necessary as it already
+ * 	exists, and there is a beztriple that can be directly copied into the array.
+ */
+int insert_bezt_icu(struct IpoCurve *icu, struct BezTriple *bezt);
+
+/* Main Keyframing API call: 
+ *	Use this when validation of necessary animation data isn't necessary as it
+ *	already exists. It will insert a keyframe using the current value being keyframed.
+ */
+void insert_vert_icu(struct IpoCurve *icu, float x, float y, short flag);
+
+
+/* flags for use in insert_key(), and insert_vert_icu() */
+enum {
+	INSERTKEY_NEEDED 	= (1<<0),	/* only insert keyframes where they're needed */
+	INSERTKEY_MATRIX 	= (1<<1),	/* insert 'visual' keyframes where possible/needed */
+	INSERTKEY_FAST 		= (1<<2),	/* don't recalculate handles,etc. after adding key */
+	INSERTKEY_FASTR		= (1<<3),	/* don't realloc mem (or increase count, as array has already been set out) */
+	INSERTKEY_REPLACE 	= (1<<4),	/* only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */
+} eInsertKeyFlags;
+
+/* -------- */
+
+/* Main Keyframing API calls: 
+ *	Use this to create any necessary animation data,, and then insert a keyframe
+ *	using the current value being keyframed, in the relevant place. Returns success.
+ */
+	// TODO: adapt this for new data-api -> this blocktype, etc. stuff is evil!
+short insertkey(struct ID *id, int blocktype, char *actname, char *constname, int adrcode, short flag);
+
+/* Main Keyframing API call: 
+ * 	Use this to delete keyframe on current frame for relevant channel. Will perform checks just in case.
+ */
+short deletekey(struct ID *id, int blocktype, char *actname, char *constname, int adrcode, short flag);
+
+
+/* Main Keyframe Management calls: 
+ *	These handle keyframes management from various spaces. They will handle the menus 
+ * 	required for each space.
+ */
+void common_insertkey(void);
+void common_deletekey(void);
+
+/* ************ Keyframe Checking ******************** */
+
+/* Checks whether a keyframe exists for the given ID-block one the given frame */
+short id_cfra_has_keyframe(struct ID *id, short filter);
+
+/* filter flags fr id_cfra_has_keyframe */
+enum {
+		/* general */
+	ANIMFILTER_ALL		= 0,			/* include all available animation data */
+	ANIMFILTER_LOCAL	= (1<<0),		/* only include locally available anim data */
+	
+		/* object specific */
+	ANIMFILTER_MAT		= (1<<1),		/* include material keyframes too */
+	ANIMFILTER_SKEY		= (1<<2),		/* shape keys (for geometry) */
+} eAnimFilterFlags;
+
+#endif /*  BIF_KEYFRAMING_H */

Modified: trunk/blender/source/blender/include/BSE_editipo.h
===================================================================
--- trunk/blender/source/blender/include/BSE_editipo.h	2008-09-14 03:51:51 UTC (rev 16512)
+++ trunk/blender/source/blender/include/BSE_editipo.h	2008-09-14 04:32:17 UTC (rev 16513)
@@ -90,9 +90,6 @@
 struct Ipo *verify_ipo(struct ID *, short, char *, char *, char *);
 int texchannel_to_adrcode(int channel);
 
-int insert_bezt_icu(struct IpoCurve *icu, struct BezTriple *bezt);
-void insert_vert_icu(struct IpoCurve *icu, float x, float y, short fast);
-void add_vert_ipo(void);
 
 void add_duplicate_editipo(void);
 void remove_doubles_ipo(void);
@@ -121,10 +118,8 @@
 void set_exprap_ipo(int mode);
 
 void set_speed_editipo(float speed);
-void insertkey(ID *id, int blocktype, char *actname, char *constname, int adrcode, short fast);
-void insertkey_smarter(ID *id, int blocktype, char *actname, char *constname, int adrcode);
 void insertkey_editipo(void);
-void common_insertkey(void);
+void add_vert_ipo(void);
 void free_ipokey(struct ListBase *lb);
 void add_to_ipokey(struct ListBase *lb, struct BezTriple *bezt, int nr, int len);
 void make_ipokey(void);
@@ -163,8 +158,6 @@
 void borderselect_ipo_key(struct Ipo *ipo, float xmin, float xmax, int val);
 void borderselect_icu_key(struct IpoCurve *icu, float xmin, float xmax, 
 						  int (*select_function)(struct BezTriple *));
-int insertmatrixkey(ID *id, int blocktype, char *actname, char *constname, int adrcode);
-void insertfloatkey(ID *id, int blocktype, char *actname, char *constname, int adrcode, float floatkey);
 void select_ipo_key(struct Ipo *ipo, float selx, int sel);
 void select_icu_key(struct IpoCurve *icu, float selx, int selectmode);
 void setexprap_ipoloop(struct Ipo *ipo, int code);

Modified: trunk/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_action_types.h	2008-09-14 03:51:51 UTC (rev 16512)
+++ trunk/blender/source/blender/makesdna/DNA_action_types.h	2008-09-14 04:32:17 UTC (rev 16513)
@@ -277,7 +277,9 @@
 		/* clears the POSE_LOCKED flag for the next time the pose is evaluated */
 	POSE_DO_UNLOCK	= (1<<2),
 		/* pose has constraints which depend on time (used when depsgraph updates for a new frame) */
-	POSE_CONSTRAINTS_TIMEDEPEND = (1<<3)
+	POSE_CONSTRAINTS_TIMEDEPEND = (1<<3),
+		/* recalculate bone paths */
+	POSE_RECALCPATHS = (1<<4),
 } POSE_FLAG;
 
 /* PoseChannel (transform) flags */

Modified: trunk/blender/source/blender/python/api2_2x/Camera.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Camera.c	2008-09-14 03:51:51 UTC (rev 16512)
+++ trunk/blender/source/blender/python/api2_2x/Camera.c	2008-09-14 04:32:17 UTC (rev 16513)
@@ -37,6 +37,7 @@
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h" /* for M_PI */
 #include "BSE_editipo.h"
+#include "BIF_keyframing.h"
 #include "BIF_space.h"
 #include "mydevice.h"
 #include "gen_utils.h"

Modified: trunk/blender/source/blender/python/api2_2x/Constraint.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Constraint.c	2008-09-14 03:51:51 UTC (rev 16512)
+++ trunk/blender/source/blender/python/api2_2x/Constraint.c	2008-09-14 04:32:17 UTC (rev 16513)
@@ -44,6 +44,7 @@
 #include "BKE_constraint.h"
 #include "BLI_blenlib.h"
 #include "BIF_editconstraint.h"
+#include "BIF_keyframing.h"
 #include "BIF_poseobject.h"
 #include "BSE_editipo.h"
 #include "MEM_guardedalloc.h"

Modified: trunk/blender/source/blender/python/api2_2x/Ipo.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Ipo.c	2008-09-14 03:51:51 UTC (rev 16512)
+++ trunk/blender/source/blender/python/api2_2x/Ipo.c	2008-09-14 04:32:17 UTC (rev 16513)
@@ -36,6 +36,7 @@
 #include "BKE_object.h"
 #include "BKE_ipo.h"
 #include "BLI_blenlib.h"
+#include "BIF_keyframing.h"
 #include "BIF_space.h"
 #include "BSE_editipo.h"
 #include "MEM_guardedalloc.h"

Modified: trunk/blender/source/blender/python/api2_2x/Ipocurve.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Ipocurve.c	2008-09-14 03:51:51 UTC (rev 16512)
+++ trunk/blender/source/blender/python/api2_2x/Ipocurve.c	2008-09-14 04:32:17 UTC (rev 16513)
@@ -35,6 +35,7 @@
 #include "BKE_depsgraph.h"
 #include "BKE_ipo.h"
 #include "BKE_utildefines.h"
+#include "BIF_keyframing.h"
 #include "BIF_space.h"
 #include "BSE_editipo.h"
 #include "MEM_guardedalloc.h"

Modified: trunk/blender/source/blender/python/api2_2x/Lamp.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Lamp.c	2008-09-14 03:51:51 UTC (rev 16512)
+++ trunk/blender/source/blender/python/api2_2x/Lamp.c	2008-09-14 04:32:17 UTC (rev 16513)
@@ -36,6 +36,7 @@
 #include "BKE_library.h"
 #include "BKE_texture.h"
 #include "BLI_blenlib.h"
+#include "BIF_keyframing.h"
 #include "BIF_space.h"
 #include "BSE_editipo.h"
 #include "mydevice.h"

Modified: trunk/blender/source/blender/python/api2_2x/Material.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Material.c	2008-09-14 03:51:51 UTC (rev 16512)
+++ trunk/blender/source/blender/python/api2_2x/Material.c	2008-09-14 04:32:17 UTC (rev 16513)
@@ -43,6 +43,7 @@
 #include "MEM_guardedalloc.h"
 #include "BLI_blenlib.h"
 #include "BSE_editipo.h"
+#include "BIF_keyframing.h"
 #include "BIF_space.h"
 #include "mydevice.h"
 #include "constant.h"

Modified: trunk/blender/source/blender/python/api2_2x/Object.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Object.c	2008-09-14 03:51:51 UTC (rev 16512)
+++ trunk/blender/source/blender/python/api2_2x/Object.c	2008-09-14 04:32:17 UTC (rev 16513)
@@ -81,6 +81,7 @@
 #include "BIF_editarmature.h"
 #include "BIF_editaction.h"
 #include "BIF_editnla.h"
+#include "BIF_keyframing.h"
 
 #include "BLI_arithb.h"
 #include "BLI_blenlib.h"

Modified: trunk/blender/source/blender/python/api2_2x/Pose.c

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list