2.5 - Start of porting of Animation Editors

* Added new 'Animation' submodule under Editors. This will be used to house all code + features that are used by many different Animation Editors (Action/Dopesheet and IPO) as well as other parts of Blender. 

* Added back some of the core code need by the Action/Dopesheet editor, which will also be used by IPO Editor.
* Brought back file for keyframing management code (i.e. keyframing.c), but there's still quite a lot of missing stuff that I'll need to restore, so in the meantime, it's #if 0'd out.

* Moved markers code to this new module (I'm not sure whether SVN will recognise this change, as TortoiseSVN doesn't seem to have any obvious copy/move commands)
This commit is contained in:
Joshua Leung 2008-12-20 08:24:24 +00:00
parent 3b15fd4707
commit 6343d4e233
13 changed files with 3059 additions and 10 deletions

View File

@ -6,6 +6,7 @@ SConscript(['datafiles/SConscript',
'space_api/SConscript',
'util/SConscript',
'interface/SConscript',
'animation/SConscript',
'mesh/SConscript',
'object/SConscript',
'space_buttons/SConscript',
@ -23,5 +24,5 @@ SConscript(['datafiles/SConscript',
'space_script/SConscript',
'space_text/SConscript',
'space_sequencer/SConscript',
'transform/SConscript',
'transform/SConscript', # XXX this should be moved near start of list, as many modules depend on this?
'screen/SConscript'])

View File

@ -0,0 +1,54 @@
#
# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
#
# ***** 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) 2007 Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
# ***** END GPL LICENSE BLOCK *****
#
# Makes module object directory and bounces make to subdirectories.
LIBNAME = ed_animation
DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
# not very neat....
CPPFLAGS += -I../../windowmanager
CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../makesrna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../python
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
# own include
CPPFLAGS += -I../include

View File

@ -0,0 +1,9 @@
#!/usr/bin/python
Import ('env')
sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
env.BlenderLib ( 'bf_editors_animation', sources, Split(incs), [], libtype=['core','intern'], priority=[35, 40] )

View File

@ -0,0 +1,174 @@
/**
* $Id$
*
* ***** 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.
* All rights reserved.
*
*
* Contributor(s): Joshua Leung
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <string.h>
#include <stdio.h>
#include "DNA_action_types.h"
#include "DNA_curve_types.h"
#include "DNA_ipo_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_screen.h"
#include "BKE_utildefines.h"
#include "ED_anim_api.h"
#include "ED_util.h"
#include "WM_api.h"
#include "WM_types.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
/* *************************************************** */
/* CURRENT FRAME DRAWING */
/* Draw current frame number in a little green box beside the current frame indicator */
static void draw_cfra_number (View2D *v2d, float cfra, short time)
{
float xscale, yscale, yspace, ypixels, x;
short slen;
char str[32];
/* because the frame number text is subject to the same scaling as the contents of the view */
UI_view2d_getscale(v2d, &xscale, &yscale);
glScalef(1.0/xscale, 1.0, 1.0);
if (time)
sprintf(str, " %.2f", FRA2TIME(CFRA));
else
sprintf(str, " %d", CFRA);
slen= UI_GetStringWidth(G.font, str, 0);
/* get starting coordinates for drawing */
x= cfra * xscale;
/* draw green box around/behind text */
UI_ThemeColor(TH_CFRAME);
UI_ThemeColorShadeAlpha(TH_CFRAME, 0, -100);
glRectf(x, 0, x+slen, 15);
/* draw current frame number - black text */
UI_ThemeColor(TH_TEXT);
ui_rasterpos_safe(x-5, 17, 1.0);
UI_DrawString(G.fonts, str, 0);
/* restore view transform */
glScalef(xscale, yscale, 1.0);
}
/* General call for drawing current frame indicator in a */
void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag)
{
Scene *scene= CTX_data_scene(C);
float vec[2];
/* Draw a light green line to indicate current frame */
vec[0]= (float)(scene->r.cfra * scene->r.framelen);
UI_ThemeColor(TH_CFRAME);
glLineWidth(2.0);
glBegin(GL_LINE_STRIP);
vec[1]= v2d->cur.ymin;
glVertex2fv(vec);
vec[1]= v2d->cur.ymax;
glVertex2fv(vec);
glEnd();
/* Draw dark green line if slow-parenting/time-offset is enabled */
if (flag & DRAWCFRA_SHOW_TIMEOFS) {
Object *ob= (scene->basact) ? (scene->basact->object) : 0;
if ((ob) && (ob->ipoflag & OB_OFFS_OB) && (give_timeoffset(ob)!=0.0)) {
vec[0]-= give_timeoffset(ob); /* could avoid calling twice */
UI_ThemeColorShade(TH_CFRAME, -30);
glBegin(GL_LINE_STRIP);
/*vec[1]= v2d->cur.ymax;*/ // this is set already. this line is only included
glVertex2fv(vec);
vec[1]= v2d->cur.ymin;
glVertex2fv(vec);
glEnd();
}
}
glLineWidth(1.0);
/* Draw current frame number in a little box */
if (flag & DRAWCFRA_SHOW_NUMBOX) {
UI_view2d_view_orthoSpecial(C, v2d, 1);
draw_cfra_number(v2d, vec[0], (flag & DRAWCFRA_UNIT_SECONDS));
}
}
/* *************************************************** */
/* PREVIEW RANGE 'CURTAINS' */
/* Draw preview range 'curtains' for highlighting where the animation data is */
void ANIM_draw_previewrange (const bContext *C, View2D *v2d)
{
Scene *scene= CTX_data_scene(C);
/* only draw this if preview range is set */
if (scene->r.psfra) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
/* only draw two separate 'curtains' if there's no overlap between them */
if (PSFRA < PEFRA) {
glRectf(v2d->cur.xmin, v2d->cur.ymin, PSFRA, v2d->cur.ymax);
glRectf(PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
}
else {
glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
}
glDisable(GL_BLEND);
}
}
/* *************************************************** */

View File

@ -0,0 +1,208 @@
/**
* $Id$
*
* ***** 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.
* All rights reserved.
*
*
* Contributor(s): Joshua Leung
*
* ***** END GPL LICENSE BLOCK *****
*/
/* This file defines the system for filtering data into a form suitable for
* use by the Animation Editors, thus acting as a means by which the Animation
* Editors maintain a level of abstraction from the data they actually manipulate.
* Thus, they only need to check on the type of the data they're manipulating, and
* NOT worry about various layers of context/hierarchy checks.
*
* While this is primarily used for the Action/Dopesheet Editor (and its accessory modes),
* the IPO Editor also uses this for it's channel list and for determining which curves
* are being edited.
*
* -- Joshua Leung, Dec 2008
*/
#include <string.h>
#include <stdio.h>
#include "DNA_listbase.h"
#include "DNA_ID.h"
#include "DNA_action_types.h"
#include "DNA_camera_types.h"
#include "DNA_curve_types.h"
#include "DNA_ipo_types.h"
#include "DNA_lattice_types.h"
#include "DNA_key_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_screen.h"
#include "BKE_utildefines.h"
#include "ED_anim_api.h"
#include "ED_types.h"
#include "ED_util.h"
#include "WM_api.h"
#include "WM_types.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
/* ************************************************************ */
/* Blender Context <-> Animation Context mapping */
/* ----------- Private Stuff - Action Editor ------------- */
/* Get shapekey data being edited (for Action Editor -> ShapeKey mode) */
/* Note: there's a similar function in key.c (ob_get_key) */
Key *actedit_get_shapekeys (const bContext *C, SpaceAction *saction)
{
Scene *scene= CTX_data_scene(C);
Object *ob;
Key *key;
ob = OBACT; // XXX er...
if (ob == NULL)
return NULL;
/* pinning is not available in 'ShapeKey' mode... */
//if (saction->pin) return NULL;
/* shapekey data is stored with geometry data */
switch (ob->type) {
case OB_MESH:
key= ((Mesh *)ob->data)->key;
break;
case OB_LATTICE:
key= ((Lattice *)ob->data)->key;
break;
case OB_CURVE:
case OB_SURF:
key= ((Curve *)ob->data)->key;
break;
default:
return NULL;
}
if (key) {
if (key->type == KEY_RELATIVE)
return key;
}
return NULL;
}
/* Get data being edited in Action Editor (depending on current 'mode') */
static void *actedit_get_context (const bContext *C, SpaceAction *saction, short *datatype)
{
Scene *scene= CTX_data_scene(C);
/* sync settings with current view status, then return appropriate data */
switch (saction->mode) {
case SACTCONT_ACTION: /* 'Action Editor' */
/* if not pinned, sync with active object */
if (saction->pin == 0) {
if (OBACT)
saction->action = OBACT->action;
else
saction->action= NULL;
}
*datatype= ANIMCONT_ACTION;
return saction->action;
case SACTCONT_SHAPEKEY: /* 'ShapeKey Editor' */
*datatype= ANIMCONT_SHAPEKEY;
return actedit_get_shapekeys(C, saction);
case SACTCONT_GPENCIL: /* Grease Pencil */ // XXX review how this mode is handled...
*datatype=ANIMCONT_GPENCIL;
return CTX_wm_screen(C); // FIXME: add that dopesheet type thing here!
break;
case SACTCONT_DOPESHEET: /* DopeSheet */
/* update scene-pointer (no need to check for pinning yet, as not implemented) */
saction->ads.source= (ID *)scene;
*datatype= ANIMCONT_DOPESHEET;
return &saction->ads;
default: /* unhandled yet */
*datatype= ANIMCONT_NONE;
return NULL;
}
}
/* ----------- Private Stuff - IPO Editor ------------- */
/* ----------- Public API --------------- */
/* Obtain current anim-data context from Blender Context info */
void *animdata_get_context (const bContext *C, short *datatype)
{
ScrArea *sa= CTX_wm_area(C);
/* set datatype to 'None' for convenience */
if (datatype == NULL) return NULL;
*datatype= ANIMCONT_NONE;
if (sa == NULL) return NULL; /* highly unlikely to happen, but still! */
/* context depends on editor we are currently in */
switch (sa->spacetype) {
case SPACE_ACTION:
{
SpaceAction *saction= (SpaceAction *)CTX_wm_space_data(C);
return actedit_get_context(C, saction, datatype);
}
break;
case SPACE_IPO:
{
SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C);
// ...
}
break;
}
/* nothing appropriate */
return NULL;
}
/* ************************************************************ */
/* ************************************************************ */

File diff suppressed because it is too large Load Diff

View File

@ -105,7 +105,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* verticle line */
/* vertical line */
if (flag & DRAW_MARKERS_LINES) {
setlinestyle(3);
if(marker->flag & SELECT)

View File

@ -0,0 +1,172 @@
/**
* $Id:
*
* ***** 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.
* All rights reserved.
*
*
* Contributor(s): Joshua Leung
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef ED_ANIM_API_H
#define ED_ANIM_API_H
struct ID;
struct ListBase;
struct bContext;
struct View2D;
struct bActionGroup;
/* ************************************************ */
/* ANIMATION CHANNEL FILTERING */
/* --------------- Data Types -------------------- */
/* This struct defines a structure used for quick and uniform access for
* channels of animation data
*/
typedef struct bAnimListElem {
struct bAnimListElem *next, *prev;
void *data; /* source data this elem represents */
int type; /* one of the ANIMTYPE_* values */
int flag; /* copy of elem's flags for quick access */
int index; /* copy of adrcode where applicable */
void *key_data; /* motion data - ipo or ipo-curve */
short datatype; /* type of motion data to expect */
struct ID *id; /* ID block (ID_SC, ID_SCE, or ID_OB) that owns the channel */
struct bActionGroup *grp; /* action group that owns the channel (only for Action/Dopesheet) */
void *owner; /* will either be an action channel or fake ipo-channel (for keys) */
short ownertype; /* type of owner */
} bAnimListElem;
/* Some types for easier type-testing */
typedef enum eAnim_ChannelType {
ANIMTYPE_NONE= 0,
ANIMTYPE_SPECIALDATA,
ANIMTYPE_OBJECT,
ANIMTYPE_GROUP,
ANIMTYPE_FILLIPO,
ANIMTYPE_FILLCON,
ANIMTYPE_FILLACTD,
ANIMTYPE_FILLIPOD,
ANIMTYPE_FILLCOND,
ANIMTYPE_FILLMATD,
ANIMTYPE_DSMAT,
ANIMTYPE_DSLAM,
ANIMTYPE_DSCAM,
ANIMTYPE_DSCUR,
ANIMTYPE_DSSKEY,
ANIMTYPE_ACHAN,
ANIMTYPE_CONCHAN,
ANIMTYPE_CONCHAN2,
ANIMTYPE_ICU,
ANIMTYPE_IPO,
ANIMTYPE_SHAPEKEY,
ANIMTYPE_GPDATABLOCK,
ANIMTYPE_GPLAYER,
} eAnim_ChannelType;
/* types of keyframe data in bAnimListElem */
typedef enum eAnim_KeyType {
ALE_NONE = 0, /* no keyframe data */
ALE_IPO, /* IPO block */
ALE_ICU, /* IPO-Curve block */
ALE_GPFRAME, /* Grease Pencil Frames */
// XXX the following are for summaries... should these be kept?
ALE_OB, /* Object summary */
ALE_ACT, /* Action summary */
ALE_GROUP, /* Action Group summary */
} eAnim_KeyType;
/* Main Data container types */
typedef enum eAnimCont_Types {
ANIMCONT_NONE = 0, /* invalid or no data */
ANIMCONT_ACTION, /* action (bAction) */
ANIMCONT_SHAPEKEY, /* shapekey (Key) */
ANIMCONT_GPENCIL, /* grease pencil (screen) */
ANIMCONT_DOPESHEET, /* dopesheet (bDopesheet) */
} eAnimCont_Types;
/* filtering flags - under what circumstances should a channel be added */
typedef enum eAnimFilter_Flags {
ALEFILTER_VISIBLE = (1<<0), /* should channels be visible */
ALEFILTER_SEL = (1<<1), /* should channels be selected */
ALEFILTER_FOREDIT = (1<<2), /* does editable status matter */
ALEFILTER_CHANNELS = (1<<3), /* do we only care that it is a channel */
ALEFILTER_IPOKEYS = (1<<4), /* only channels referencing ipo's */
ALEFILTER_ONLYICU = (1<<5), /* only reference ipo-curves */
ALEFILTER_FORDRAWING = (1<<6), /* make list for interface drawing */
ALEFILTER_ACTGROUPED = (1<<7), /* belongs to the active actiongroup */
} eAnimFilter_Flags;
/* ---------------- API -------------------- */
/* Obtain list of filtered Animation channels to operate on */
void animdata_filter(struct ListBase *act_data, int filter_mode, void *data, short datatype);
/* Obtain current anim-data context from Blender Context info */
void *animdata_get_context(const struct bContext *C, short *datatype);
/* ************************************************ */
/* DRAWING API */
// XXX should this get its own header file?
/* ---------- Current Frame Drawing ---------------- */
/* flags for Current Frame Drawing */
enum {
/* plain time indicator with no special indicators */
DRAWCFRA_PLAIN = 0,
/* draw box indicating current frame number */
DRAWCFRA_SHOW_NUMBOX = (1<<0),
/* time indication in seconds or frames */
DRAWCFRA_UNIT_SECONDS = (1<<1),
/* show time-offset line */
DRAWCFRA_SHOW_TIMEOFS = (1<<2),
} eAnimEditDraw_CurrentFrame;
/* main call to draw current-frame indicator in an Animation Editor */
void ANIM_draw_cfra(const bContext *C, struct View2D *v2d, short flag);
/* ------------- Preview Range Drawing -------------- */
// XXX should preview range get its own file?
/* main call to draw preview range curtains */
void ANIM_draw_previewrange(const bContext *C, struct View2D *v2d);
/* ************************************************* */
#endif /* ED_ANIM_API_H */

View File

@ -0,0 +1,134 @@
/**
* $Id: BIF_keyframing.h 17216 2008-10-29 11:20:02Z 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 by keyframe creation/deletion calls */
enum {
/* used by isnertkey() and insert_vert_icu() */
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) */
/* used by common_*key() functions - Note: these are generally mutually exclusive (only one will work at a time) */
COMMONKEY_ADDMAP = (1<<10), /* common key: add texture-slot offset bitflag to adrcode before use */
COMMONKEY_PCHANROT = (1<<11), /* common key: extend channel list using relevant pchan-rotations */
/* all possible items for common_*key() functions */
COMMONKEY_MODES = (COMMONKEY_ADDMAP|COMMONKEY_PCHANROT)
} 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);
/* ************ Auto-Keyframing ********************** */
/* Notes:
* - All the defines for this (User-Pref settings and Per-Scene settings)
* are defined in DNA_userdef_types.h
* - Scene settings take presidence over those for userprefs, with old files
* inheriting userpref settings for the scene settings
* - "On/Off + Mode" are stored per Scene, but "settings" are currently stored
* as userprefs
*/
/* Auto-Keying macros for use by various tools */
/* check if auto-keyframing is enabled (per scene takes presidence) */
#define IS_AUTOKEY_ON ((scene) ? (scene->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON))
/* check the mode for auto-keyframing (per scene takes presidence) */
#define IS_AUTOKEY_MODE(mode) ((scene) ? (scene->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode))
/* check if a flag is set for auto-keyframing (as userprefs only!) */
#define IS_AUTOKEY_FLAG(flag) (U.autokey_flag & AUTOKEY_FLAG_##flag)
/* ************ Keyframe Checking ******************** */
/* Main Keyframe Checking API call:
* Checks whether a keyframe exists for the given ID-block one the given frame.
* - It is recommended to call this method over the other keyframe-checkers directly,
* in case some detail of the implementation changes...
* - frame: the value of this is quite often result of frame_to_float(CFRA)
*/
short id_frame_has_keyframe(struct ID *id, float frame, short filter);
/* filter flags for id_cfra_has_keyframe
*
* WARNING: do not alter order of these, as also stored in files
* (for v3d->keyflags)
*/
enum {
/* general */
ANIMFILTER_LOCAL = (1<<0), /* only include locally available anim data */
ANIMFILTER_MUTED = (1<<1), /* include muted elements */
ANIMFILTER_ACTIVE = (1<<2), /* only include active-subelements */
/* object specific */
ANIMFILTER_NOMAT = (1<<9), /* don't include material keyframes */
ANIMFILTER_NOSKEY = (1<<10), /* don't include shape keys (for geometry) */
} eAnimFilterFlags;
#endif /* BIF_KEYFRAMING_H */

View File

@ -6,4 +6,4 @@ sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
env.BlenderLib ( 'bf_editors_space_action', sources, Split(incs), [], libtype=['core','intern'], priority=[35, 40] )
env.BlenderLib ( 'bf_editors_space_action', sources, Split(incs), [], libtype=['core','intern'], priority=[33, 37] )

View File

@ -57,6 +57,7 @@
#include "UI_resources.h"
#include "UI_view2d.h"
#include "ED_anim_api.h"
#include "ED_markers.h"
#include "action_intern.h" // own include
@ -167,7 +168,7 @@ static void action_main_area_draw(const bContext *C, ARegion *ar)
View2DGrid *grid;
View2DScrollers *scrollers;
float col[3];
int unit;
short unit=0, flag=0;
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
@ -184,6 +185,13 @@ static void action_main_area_draw(const bContext *C, ARegion *ar)
/* data? */
/* current frame */
if (saction->flag & SACTION_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS;
if ((saction->flag & SACTION_NODRAWCFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX;
ANIM_draw_cfra(C, v2d, flag);
/* preview range */
ANIM_draw_previewrange(C, v2d);
/* reset view matrix */
UI_view2d_view_restore(C);
@ -298,7 +306,7 @@ void ED_spacetype_action(void)
art->init= action_main_area_init;
art->draw= action_main_area_draw;
art->listener= action_main_area_listener;
art->keymapflag= ED_KEYMAP_VIEW2D;
art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS;
BLI_addhead(&st->regiontypes, art);

View File

@ -85,7 +85,8 @@ static void time_draw_cfra_time(const bContext *C, SpaceTime *stime, ARegion *ar
static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar)
{
View2D *v2d= UI_view2d_fromcontext(C);
View2D *v2d= UI_view2d_fromcontext(C);
//Scene *scene= CTX_data_scene(C);
/* draw darkened area outside of active timeline
* frame range used is preview range or scene range */

View File

@ -181,16 +181,18 @@ void ED_TIME_OT_change_frame(wmOperatorType *ot)
static int toggle_time_exec(bContext *C, wmOperator *op)
{
SpaceTime *stime;
SpaceTime *stime= (SpaceTime *)CTX_wm_space_data(C);
ScrArea *curarea= CTX_wm_area(C);
if (ELEM(NULL, CTX_wm_area(C), CTX_wm_space_data(C)))
if (ELEM(NULL, curarea, stime))
return OPERATOR_CANCELLED;
/* simply toggle draw frames flag for now */
// XXX in past, this displayed menu to choose... (for later!)
stime= (SpaceTime*)CTX_wm_space_data(C);
// in past, this asked user to choose in a menu beforehand, but that is clumsy
stime->flag ^= TIME_DRAWFRAMES;
ED_area_tag_redraw(curarea);
return OPERATOR_FINISHED;
}