2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-01-09 06:25:14 +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.
|
2009-01-09 06:25:14 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Joshua Leung (2009 Recode)
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/space_graph/graph_draw.c
|
|
|
|
|
* \ingroup spgraph
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2009-01-09 06:25:14 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <string.h>
|
2009-03-15 10:39:02 +00:00
|
|
|
#include <float.h>
|
2009-01-09 06:25:14 +00:00
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2014-11-16 23:32:23 +13:00
|
|
|
#include "BLI_math.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2009-01-09 06:25:14 +00:00
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
#include "DNA_anim_types.h"
|
2009-01-09 06:25:14 +00:00
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
|
#include "DNA_windowmanager_types.h"
|
2012-03-22 12:19:31 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
2009-01-09 06:25:14 +00:00
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
#include "BKE_context.h"
|
2014-11-16 23:32:23 +13:00
|
|
|
#include "BKE_curve.h"
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
#include "BKE_fcurve.h"
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2009-01-09 06:25:14 +00:00
|
|
|
|
|
|
|
|
#include "BIF_gl.h"
|
|
|
|
|
#include "BIF_glutil.h"
|
|
|
|
|
|
|
|
|
|
#include "ED_anim_api.h"
|
|
|
|
|
|
2009-02-03 12:04:05 +00:00
|
|
|
#include "graph_intern.h"
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
|
|
|
|
#include "UI_interface.h"
|
2009-01-09 06:25:14 +00:00
|
|
|
#include "UI_resources.h"
|
|
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
|
2009-09-25 10:52:29 +00:00
|
|
|
/* *************************** */
|
|
|
|
|
/* Utility Drawing Defines */
|
|
|
|
|
|
|
|
|
|
/* determine the alpha value that should be used when
|
|
|
|
|
* drawing components for some F-Curve (fcu)
|
|
|
|
|
* - selected F-Curves should be more visible than partially visible ones
|
|
|
|
|
*/
|
2012-03-31 04:04:58 +00:00
|
|
|
static float fcurve_display_alpha(FCurve *fcu)
|
|
|
|
|
{
|
|
|
|
|
return (fcu->flag & FCURVE_SELECTED) ? 1.0f : U.fcu_inactive_alpha;
|
|
|
|
|
}
|
2009-09-25 10:52:29 +00:00
|
|
|
|
2009-01-09 06:25:14 +00:00
|
|
|
/* *************************** */
|
2009-03-21 03:49:22 +00:00
|
|
|
/* F-Curve Modifier Drawing */
|
|
|
|
|
|
|
|
|
|
/* Envelope -------------- */
|
|
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* TODO: draw a shaded poly showing the region of influence too!!! */
|
2012-05-08 20:18:33 +00:00
|
|
|
static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
|
2009-03-21 03:49:22 +00:00
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
FMod_Envelope *env = (FMod_Envelope *)fcm->data;
|
2009-03-21 03:49:22 +00:00
|
|
|
FCM_EnvelopeData *fed;
|
2012-09-15 11:48:20 +00:00
|
|
|
const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur);
|
2009-03-21 03:49:22 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* draw two black lines showing the standard reference levels */
|
|
|
|
|
glColor3f(0.0f, 0.0f, 0.0f);
|
|
|
|
|
setlinestyle(5);
|
|
|
|
|
|
|
|
|
|
glBegin(GL_LINES);
|
2012-05-08 20:18:33 +00:00
|
|
|
glVertex2f(v2d->cur.xmin, env->midval + env->min);
|
|
|
|
|
glVertex2f(v2d->cur.xmax, env->midval + env->min);
|
2009-03-21 03:49:22 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
glVertex2f(v2d->cur.xmin, env->midval + env->max);
|
|
|
|
|
glVertex2f(v2d->cur.xmax, env->midval + env->max);
|
2012-10-20 20:20:02 +00:00
|
|
|
glEnd(); /* GL_LINES */
|
2009-03-21 03:49:22 +00:00
|
|
|
setlinestyle(0);
|
|
|
|
|
|
|
|
|
|
/* set size of vertices (non-adjustable for now) */
|
|
|
|
|
glPointSize(2.0f);
|
|
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* for now, point color is fixed, and is white */
|
2009-03-21 03:49:22 +00:00
|
|
|
glColor3f(1.0f, 1.0f, 1.0f);
|
|
|
|
|
|
|
|
|
|
/* we use bgl points not standard gl points, to workaround vertex
|
|
|
|
|
* drawing bugs that some drivers have (probably legacy ones only though)
|
|
|
|
|
*/
|
|
|
|
|
bglBegin(GL_POINTS);
|
2012-05-08 20:18:33 +00:00
|
|
|
for (i = 0, fed = env->data; i < env->totvert; i++, fed++) {
|
2009-03-21 03:49:22 +00:00
|
|
|
/* only draw if visible
|
|
|
|
|
* - min/max here are fixed, not relative
|
|
|
|
|
*/
|
2012-04-02 02:41:28 +00:00
|
|
|
if (IN_RANGE(fed->time, (v2d->cur.xmin - fac), (v2d->cur.xmax + fac))) {
|
2009-03-21 03:49:22 +00:00
|
|
|
glVertex2f(fed->time, fed->min);
|
|
|
|
|
glVertex2f(fed->time, fed->max);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-10-20 20:20:02 +00:00
|
|
|
bglEnd(); /* GL_POINTS */
|
2009-03-21 03:49:22 +00:00
|
|
|
|
|
|
|
|
glPointSize(1.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* *************************** */
|
|
|
|
|
/* F-Curve Drawing */
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
|
|
|
|
/* Points ---------------- */
|
2009-01-09 06:25:14 +00:00
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
/* helper func - draw keyframe vertices only for an F-Curve */
|
2012-05-08 20:18:33 +00:00
|
|
|
static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo), View2D *v2d, short edit, short sel)
|
2009-01-09 06:25:14 +00:00
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
BezTriple *bezt = fcu->bezt;
|
2012-09-15 11:48:20 +00:00
|
|
|
const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur);
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
int i;
|
2009-01-09 06:25:14 +00:00
|
|
|
|
2009-01-29 03:43:04 +00:00
|
|
|
/* we use bgl points not standard gl points, to workaround vertex
|
|
|
|
|
* drawing bugs that some drivers have (probably legacy ones only though)
|
|
|
|
|
*/
|
2009-01-09 06:25:14 +00:00
|
|
|
bglBegin(GL_POINTS);
|
|
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
for (i = 0; i < fcu->totvert; i++, bezt++) {
|
2012-03-02 16:05:54 +00:00
|
|
|
/* as an optimization step, only draw those in view
|
2009-01-29 03:43:04 +00:00
|
|
|
* - we apply a correction factor to ensure that points don't pop in/out due to slight twitches of view size
|
|
|
|
|
*/
|
2012-04-02 02:41:28 +00:00
|
|
|
if (IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac))) {
|
2009-01-29 03:43:04 +00:00
|
|
|
if (edit) {
|
|
|
|
|
/* 'Keyframe' vertex only, as handle lines and handles have already been drawn
|
|
|
|
|
* - only draw those with correct selection state for the current drawing color
|
|
|
|
|
* -
|
|
|
|
|
*/
|
|
|
|
|
if ((bezt->f2 & SELECT) == sel)
|
|
|
|
|
bglVertex3fv(bezt->vec[1]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* no check for selection here, as curve is not editable... */
|
2012-10-20 20:20:02 +00:00
|
|
|
/* XXX perhaps we don't want to even draw points? maybe add an option for that later */
|
2009-01-09 06:25:14 +00:00
|
|
|
bglVertex3fv(bezt->vec[1]);
|
2009-01-29 03:43:04 +00:00
|
|
|
}
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
|
|
|
|
}
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
bglEnd(); /* GL_POINTS */
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
|
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
2009-10-20 23:51:31 +00:00
|
|
|
/* helper func - draw handle vertex for an F-Curve as a round unfilled circle
|
|
|
|
|
* NOTE: the caller MUST HAVE GL_LINE_SMOOTH & GL_BLEND ENABLED, otherwise, the controls don't
|
|
|
|
|
* have a consistent appearance (due to off-pixel alignments)...
|
|
|
|
|
*/
|
2012-05-08 20:18:33 +00:00
|
|
|
static void draw_fcurve_handle_control(float x, float y, float xscale, float yscale, float hsize)
|
2009-01-09 06:25:14 +00:00
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
static GLuint displist = 0;
|
2009-01-09 06:25:14 +00:00
|
|
|
|
2012-03-02 16:05:54 +00:00
|
|
|
/* initialize round circle shape */
|
2009-01-09 06:25:14 +00:00
|
|
|
if (displist == 0) {
|
|
|
|
|
GLUquadricObj *qobj;
|
|
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
displist = glGenLists(1);
|
2009-01-27 05:04:23 +00:00
|
|
|
glNewList(displist, GL_COMPILE);
|
2009-01-09 06:25:14 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
qobj = gluNewQuadric();
|
2009-01-09 06:25:14 +00:00
|
|
|
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
|
2009-01-27 05:04:23 +00:00
|
|
|
gluDisk(qobj, 0, 0.7, 8, 1);
|
2009-01-09 06:25:14 +00:00
|
|
|
gluDeleteQuadric(qobj);
|
|
|
|
|
|
|
|
|
|
glEndList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* adjust view transform before starting */
|
|
|
|
|
glTranslatef(x, y, 0.0f);
|
2012-05-08 20:18:33 +00:00
|
|
|
glScalef(1.0f / xscale * hsize, 1.0f / yscale * hsize, 1.0f);
|
2009-01-09 06:25:14 +00:00
|
|
|
|
|
|
|
|
/* draw! */
|
|
|
|
|
glCallList(displist);
|
|
|
|
|
|
|
|
|
|
/* restore view transform */
|
2012-05-08 20:18:33 +00:00
|
|
|
glScalef(xscale / hsize, yscale / hsize, 1.0);
|
2009-01-09 06:25:14 +00:00
|
|
|
glTranslatef(-x, -y, 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
/* helper func - draw handle vertices only for an F-Curve (if it is not protected) */
|
2013-10-29 18:10:48 +00:00
|
|
|
static void draw_fcurve_vertices_handles(FCurve *fcu, SpaceIpo *sipo, View2D *v2d, short sel, short sel_handle_only, float units_scale)
|
2009-01-09 06:25:14 +00:00
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
BezTriple *bezt = fcu->bezt;
|
2009-01-09 06:25:14 +00:00
|
|
|
BezTriple *prevbezt = NULL;
|
|
|
|
|
float hsize, xscale, yscale;
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
int i;
|
2009-01-09 06:25:14 +00:00
|
|
|
|
|
|
|
|
/* get view settings */
|
2013-06-30 21:41:06 +00:00
|
|
|
hsize = UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE) * U.pixelsize;
|
2014-04-21 18:46:52 +10:00
|
|
|
UI_view2d_scale_get(v2d, &xscale, &yscale);
|
2013-10-29 18:10:48 +00:00
|
|
|
|
|
|
|
|
/* Compensate OGL scale sued for unit mapping, so circle will be circle, not ellipse */
|
|
|
|
|
yscale *= units_scale;
|
2009-01-09 06:25:14 +00:00
|
|
|
|
|
|
|
|
/* set handle color */
|
|
|
|
|
if (sel) UI_ThemeColor(TH_HANDLE_VERTEX_SELECT);
|
|
|
|
|
else UI_ThemeColor(TH_HANDLE_VERTEX);
|
|
|
|
|
|
2009-10-20 23:51:31 +00:00
|
|
|
/* anti-aliased lines for more consistent appearance */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
|
2009-10-20 23:51:31 +00:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
for (i = 0; i < fcu->totvert; i++, prevbezt = bezt, bezt++) {
|
2009-11-30 11:37:27 +00:00
|
|
|
/* Draw the editmode handles for a bezier curve (others don't have handles)
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
* if their selection status matches the selection status we're drawing for
|
|
|
|
|
* - first handle only if previous beztriple was bezier-mode
|
|
|
|
|
* - second handle only if current beztriple is bezier-mode
|
2009-11-30 11:37:27 +00:00
|
|
|
*
|
|
|
|
|
* Also, need to take into account whether the keyframe was selected
|
|
|
|
|
* if a Graph Editor option to only show handles of selected keys is on.
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
*/
|
2014-01-16 19:15:53 +11:00
|
|
|
if (!sel_handle_only || BEZSELECTED(bezt)) {
|
2012-09-09 00:00:21 +00:00
|
|
|
if ((!prevbezt && (bezt->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ))) {
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((bezt->f1 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/
|
2009-11-30 11:37:27 +00:00
|
|
|
draw_fcurve_handle_control(bezt->vec[0][0], bezt->vec[0][1], xscale, yscale, hsize);
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
if (bezt->ipo == BEZT_IPO_BEZ) {
|
|
|
|
|
if ((bezt->f3 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[2][0] < v2d->cur.xmax)*/
|
2009-11-30 11:37:27 +00:00
|
|
|
draw_fcurve_handle_control(bezt->vec[2][0], bezt->vec[2][1], xscale, yscale, hsize);
|
|
|
|
|
}
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-10-20 23:51:31 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
|
2009-10-20 23:51:31 +00:00
|
|
|
glDisable(GL_BLEND);
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
|
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
/* helper func - set color to draw F-Curve data with */
|
2012-05-08 20:18:33 +00:00
|
|
|
static void set_fcurve_vertex_color(FCurve *fcu, short sel)
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
{
|
2009-09-25 10:52:29 +00:00
|
|
|
/* Fade the 'intensity' of the vertices based on the selection of the curves too */
|
2012-05-08 20:18:33 +00:00
|
|
|
int alphaOffset = (int)((fcurve_display_alpha(fcu) - 1.0f) * 255);
|
2009-09-25 10:52:29 +00:00
|
|
|
|
|
|
|
|
/* Set color of curve vertex based on state of curve (i.e. 'Edit' Mode) */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((fcu->flag & FCURVE_PROTECTED) == 0) {
|
2009-09-25 10:52:29 +00:00
|
|
|
/* Curve's points ARE BEING edited */
|
|
|
|
|
if (sel) UI_ThemeColorShadeAlpha(TH_VERTEX_SELECT, 0, alphaOffset);
|
|
|
|
|
else UI_ThemeColorShadeAlpha(TH_VERTEX, 0, alphaOffset);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2009-09-25 10:52:29 +00:00
|
|
|
else {
|
|
|
|
|
/* Curve's points CANNOT BE edited */
|
|
|
|
|
if (sel) UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, alphaOffset);
|
|
|
|
|
else UI_ThemeColorShadeAlpha(TH_TEXT, 0, alphaOffset);
|
|
|
|
|
}
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-10-29 18:10:48 +00:00
|
|
|
static void draw_fcurve_vertices(SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only, float units_scale)
|
2009-01-09 06:25:14 +00:00
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
View2D *v2d = &ar->v2d;
|
2009-01-09 06:25:14 +00:00
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
/* only draw points if curve is visible
|
2012-07-04 15:04:38 +00:00
|
|
|
* - draw unselected points before selected points as separate passes to minimize color-changing overhead
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
* (XXX dunno if this is faster than drawing all in one pass though)
|
2012-05-08 20:18:33 +00:00
|
|
|
* and also to make sure in the case of overlapping points that the selected is always visible
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
* - draw handles before keyframes, so that keyframes will overlap handles (keyframes are more important for users)
|
|
|
|
|
*/
|
2009-01-09 06:25:14 +00:00
|
|
|
|
|
|
|
|
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
|
|
|
|
|
|
2009-11-08 06:43:08 +00:00
|
|
|
/* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
|
2012-03-06 18:40:15 +00:00
|
|
|
if (do_handles) {
|
2010-10-16 08:03:28 +00:00
|
|
|
set_fcurve_vertex_color(fcu, 0);
|
2013-10-29 18:10:48 +00:00
|
|
|
draw_fcurve_vertices_handles(fcu, sipo, v2d, 0, sel_handle_only, units_scale);
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
2010-10-16 08:03:28 +00:00
|
|
|
set_fcurve_vertex_color(fcu, 1);
|
2013-10-29 18:10:48 +00:00
|
|
|
draw_fcurve_vertices_handles(fcu, sipo, v2d, 1, sel_handle_only, units_scale);
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
|
|
|
|
/* draw keyframes over the handles */
|
2010-10-16 08:03:28 +00:00
|
|
|
set_fcurve_vertex_color(fcu, 0);
|
2011-02-09 02:09:25 +00:00
|
|
|
draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 0);
|
2009-01-09 06:25:14 +00:00
|
|
|
|
2010-10-16 08:03:28 +00:00
|
|
|
set_fcurve_vertex_color(fcu, 1);
|
2011-02-09 02:09:25 +00:00
|
|
|
draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 1);
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
|
|
|
|
glPointSize(1.0f);
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
|
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
/* Handles ---------------- */
|
|
|
|
|
|
2014-01-22 02:48:11 +11:00
|
|
|
static bool draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
|
2010-01-30 17:17:23 +00:00
|
|
|
{
|
2010-01-30 21:11:46 +00:00
|
|
|
/* don't draw handle lines if handles are not to be shown */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ( (sipo->flag & SIPO_NOHANDLES) || /* handles shouldn't be shown anywhere */
|
|
|
|
|
(fcu->flag & FCURVE_PROTECTED) || /* keyframes aren't editable */
|
|
|
|
|
#if 0 /* handles can still be selected and handle types set, better draw - campbell */
|
|
|
|
|
(fcu->flag & FCURVE_INT_VALUES) || /* editing the handles here will cause weird/incorrect interpolation issues */
|
2011-05-20 01:02:00 +00:00
|
|
|
#endif
|
2012-05-08 20:18:33 +00:00
|
|
|
((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) || /* group that curve belongs to is not editable */
|
|
|
|
|
(fcu->totvert <= 1) /* do not show handles if there is only 1 keyframe, otherwise they all clump together in an ugly ball */
|
|
|
|
|
)
|
2010-01-30 21:11:46 +00:00
|
|
|
{
|
2010-01-30 17:17:23 +00:00
|
|
|
return 0;
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2010-01-30 17:17:23 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* draw lines for F-Curve handles only (this is only done in EditMode)
|
|
|
|
|
* note: draw_fcurve_handles_check must be checked before running this. */
|
2012-05-08 20:18:33 +00:00
|
|
|
static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
|
2009-01-09 06:25:14 +00:00
|
|
|
{
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
int sel, b;
|
2009-01-09 06:25:14 +00:00
|
|
|
|
2009-10-16 10:01:15 +00:00
|
|
|
/* a single call to GL_LINES here around these calls should be sufficient to still
|
2011-10-15 14:14:22 +00:00
|
|
|
* get separate line segments, but which aren't wrapped with GL_LINE_STRIP every time we
|
2009-10-16 10:01:15 +00:00
|
|
|
* want a single line
|
|
|
|
|
*/
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
|
2009-11-30 11:37:27 +00:00
|
|
|
/* slightly hacky, but we want to draw unselected points before selected ones
|
|
|
|
|
* so that selected points are clearly visible
|
|
|
|
|
*/
|
2012-05-08 20:18:33 +00:00
|
|
|
for (sel = 0; sel < 2; sel++) {
|
|
|
|
|
BezTriple *bezt = fcu->bezt, *prevbezt = NULL;
|
|
|
|
|
int basecol = (sel) ? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE;
|
2014-04-27 00:22:49 +10:00
|
|
|
const float *fp;
|
2010-12-20 03:59:22 +00:00
|
|
|
unsigned char col[4];
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
for (b = 0; b < fcu->totvert; b++, prevbezt = bezt, bezt++) {
|
2009-11-30 11:37:27 +00:00
|
|
|
/* if only selected keyframes can get their handles shown,
|
|
|
|
|
* check that keyframe is selected
|
|
|
|
|
*/
|
|
|
|
|
if (sipo->flag & SIPO_SELVHANDLESONLY) {
|
|
|
|
|
if (BEZSELECTED(bezt) == 0)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* draw handle with appropriate set of colors if selection is ok */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((bezt->f2 & SELECT) == sel) {
|
|
|
|
|
fp = bezt->vec[0];
|
2011-07-30 05:04:49 +00:00
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
/* only draw first handle if previous segment had handles */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((!prevbezt && (bezt->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ))) {
|
2010-03-12 16:43:04 +00:00
|
|
|
UI_GetThemeColor3ubv(basecol + bezt->h1, col);
|
2012-05-08 20:18:33 +00:00
|
|
|
col[3] = fcurve_display_alpha(fcu) * 255;
|
2010-03-12 16:43:04 +00:00
|
|
|
glColor4ubv((GLubyte *)col);
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
glVertex2fv(fp); glVertex2fv(fp + 3);
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
2011-07-30 05:04:49 +00:00
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
/* only draw second handle if this segment is bezier */
|
2012-03-06 18:40:15 +00:00
|
|
|
if (bezt->ipo == BEZT_IPO_BEZ) {
|
2010-03-12 16:43:04 +00:00
|
|
|
UI_GetThemeColor3ubv(basecol + bezt->h2, col);
|
2012-05-08 20:18:33 +00:00
|
|
|
col[3] = fcurve_display_alpha(fcu) * 255;
|
2010-03-12 16:43:04 +00:00
|
|
|
glColor4ubv((GLubyte *)col);
|
2011-07-30 05:04:49 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
glVertex2fv(fp + 3); glVertex2fv(fp + 6);
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* only draw first handle if previous segment was had handles, and selection is ok */
|
2012-09-09 00:00:21 +00:00
|
|
|
if (((bezt->f1 & SELECT) == sel) &&
|
|
|
|
|
((!prevbezt && (bezt->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ))))
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
fp = bezt->vec[0];
|
2010-03-12 16:43:04 +00:00
|
|
|
UI_GetThemeColor3ubv(basecol + bezt->h1, col);
|
2012-05-08 20:18:33 +00:00
|
|
|
col[3] = fcurve_display_alpha(fcu) * 255;
|
2010-03-12 16:43:04 +00:00
|
|
|
glColor4ubv((GLubyte *)col);
|
2011-07-30 05:04:49 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
glVertex2fv(fp); glVertex2fv(fp + 3);
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* only draw second handle if this segment is bezier, and selection is ok */
|
2012-09-09 00:00:21 +00:00
|
|
|
if (((bezt->f3 & SELECT) == sel) &&
|
|
|
|
|
(bezt->ipo == BEZT_IPO_BEZ))
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
fp = bezt->vec[1];
|
2010-03-12 16:43:04 +00:00
|
|
|
UI_GetThemeColor3ubv(basecol + bezt->h2, col);
|
2012-05-08 20:18:33 +00:00
|
|
|
col[3] = fcurve_display_alpha(fcu) * 255;
|
2010-03-12 16:43:04 +00:00
|
|
|
glColor4ubv((GLubyte *)col);
|
2011-02-09 02:09:25 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
glVertex2fv(fp); glVertex2fv(fp + 3);
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
}
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-16 10:01:15 +00:00
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
glEnd(); /* GL_LINES */
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-09 23:46:13 +00:00
|
|
|
/* Samples ---------------- */
|
|
|
|
|
|
2009-10-20 23:51:31 +00:00
|
|
|
/* helper func - draw sample-range marker for an F-Curve as a cross
|
|
|
|
|
* NOTE: the caller MUST HAVE GL_LINE_SMOOTH & GL_BLEND ENABLED, otherwise, the controls don't
|
|
|
|
|
* have a consistent appearance (due to off-pixel alignments)...
|
|
|
|
|
*/
|
2012-05-08 20:18:33 +00:00
|
|
|
static void draw_fcurve_sample_control(float x, float y, float xscale, float yscale, float hsize)
|
2009-02-09 23:46:13 +00:00
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
static GLuint displist = 0;
|
2009-02-09 23:46:13 +00:00
|
|
|
|
2012-03-02 16:05:54 +00:00
|
|
|
/* initialize X shape */
|
2009-02-09 23:46:13 +00:00
|
|
|
if (displist == 0) {
|
2012-05-08 20:18:33 +00:00
|
|
|
displist = glGenLists(1);
|
2009-02-09 23:46:13 +00:00
|
|
|
glNewList(displist, GL_COMPILE);
|
|
|
|
|
|
|
|
|
|
glBegin(GL_LINES);
|
2012-05-08 20:18:33 +00:00
|
|
|
glVertex2f(-0.7f, -0.7f);
|
|
|
|
|
glVertex2f(+0.7f, +0.7f);
|
2009-02-09 23:46:13 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
glVertex2f(-0.7f, +0.7f);
|
|
|
|
|
glVertex2f(+0.7f, -0.7f);
|
2012-10-20 20:20:02 +00:00
|
|
|
glEnd(); /* GL_LINES */
|
2009-02-09 23:46:13 +00:00
|
|
|
|
|
|
|
|
glEndList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* adjust view transform before starting */
|
|
|
|
|
glTranslatef(x, y, 0.0f);
|
2012-05-08 20:18:33 +00:00
|
|
|
glScalef(1.0f / xscale * hsize, 1.0f / yscale * hsize, 1.0f);
|
2009-02-09 23:46:13 +00:00
|
|
|
|
|
|
|
|
/* draw! */
|
|
|
|
|
glCallList(displist);
|
|
|
|
|
|
|
|
|
|
/* restore view transform */
|
2012-05-08 20:18:33 +00:00
|
|
|
glScalef(xscale / hsize, yscale / hsize, 1.0);
|
2009-02-09 23:46:13 +00:00
|
|
|
glTranslatef(-x, -y, 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* helper func - draw keyframe vertices only for an F-Curve */
|
2012-05-08 20:18:33 +00:00
|
|
|
static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
|
2009-02-09 23:46:13 +00:00
|
|
|
{
|
|
|
|
|
FPoint *first, *last;
|
|
|
|
|
float hsize, xscale, yscale;
|
|
|
|
|
|
|
|
|
|
/* get view settings */
|
2012-05-08 20:18:33 +00:00
|
|
|
hsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
|
2014-04-21 18:46:52 +10:00
|
|
|
UI_view2d_scale_get(&ar->v2d, &xscale, &yscale);
|
2009-02-09 23:46:13 +00:00
|
|
|
|
|
|
|
|
/* set vertex color */
|
2012-05-08 20:18:33 +00:00
|
|
|
if (fcu->flag & (FCURVE_ACTIVE | FCURVE_SELECTED)) UI_ThemeColor(TH_TEXT_HI);
|
2009-02-09 23:46:13 +00:00
|
|
|
else UI_ThemeColor(TH_TEXT);
|
|
|
|
|
|
|
|
|
|
/* get verts */
|
2012-05-08 20:18:33 +00:00
|
|
|
first = fcu->fpt;
|
|
|
|
|
last = (first) ? (first + (fcu->totvert - 1)) : (NULL);
|
2009-02-09 23:46:13 +00:00
|
|
|
|
|
|
|
|
/* draw */
|
|
|
|
|
if (first && last) {
|
2009-10-20 23:51:31 +00:00
|
|
|
/* anti-aliased lines for more consistent appearance */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
|
2009-10-20 23:51:31 +00:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
2009-02-09 23:46:13 +00:00
|
|
|
draw_fcurve_sample_control(first->vec[0], first->vec[1], xscale, yscale, hsize);
|
|
|
|
|
draw_fcurve_sample_control(last->vec[0], last->vec[1], xscale, yscale, hsize);
|
2009-10-20 23:51:31 +00:00
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
|
2009-02-09 23:46:13 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
/* Curve ---------------- */
|
|
|
|
|
|
2009-03-15 10:39:02 +00:00
|
|
|
/* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */
|
2012-05-08 20:18:33 +00:00
|
|
|
static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid)
|
2009-03-15 10:39:02 +00:00
|
|
|
{
|
2014-11-16 23:02:31 +13:00
|
|
|
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
|
2009-03-15 10:39:02 +00:00
|
|
|
ChannelDriver *driver;
|
2014-07-01 13:22:55 +06:00
|
|
|
float samplefreq;
|
2009-03-15 10:39:02 +00:00
|
|
|
float stime, etime;
|
2010-01-26 03:16:14 +00:00
|
|
|
float unitFac;
|
2010-05-11 21:46:20 +00:00
|
|
|
float dx, dy;
|
2013-10-29 18:10:52 +00:00
|
|
|
short mapping_flag = ANIM_get_normalization_flags(ac);
|
2014-07-01 13:22:55 +06:00
|
|
|
int i, n;
|
2010-05-11 21:46:20 +00:00
|
|
|
|
|
|
|
|
/* when opening a blend file on a different sized screen or while dragging the toolbar this can happen
|
|
|
|
|
* best just bail out in this case */
|
|
|
|
|
UI_view2d_grid_size(grid, &dx, &dy);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (dx <= 0.0f)
|
2010-05-11 21:46:20 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
2009-03-15 10:39:02 +00:00
|
|
|
/* disable any drivers temporarily */
|
2012-05-08 20:18:33 +00:00
|
|
|
driver = fcu->driver;
|
|
|
|
|
fcu->driver = NULL;
|
2009-03-15 10:39:02 +00:00
|
|
|
|
2010-01-26 03:16:14 +00:00
|
|
|
/* compute unit correction factor */
|
2013-10-29 18:10:52 +00:00
|
|
|
unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
/* Note about sampling frequency:
|
2012-05-08 20:18:33 +00:00
|
|
|
* Ideally, this is chosen such that we have 1-2 pixels = 1 segment
|
2009-03-15 10:39:02 +00:00
|
|
|
* which means that our curves can be as smooth as possible. However,
|
2012-05-08 20:18:33 +00:00
|
|
|
* this does mean that curves may not be fully accurate (i.e. if they have
|
|
|
|
|
* sudden spikes which happen at the sampling point, we may have problems).
|
2014-11-16 22:16:01 +13:00
|
|
|
* Also, this may introduce lower performance on less densely detailed curves,
|
2009-03-15 10:39:02 +00:00
|
|
|
* though it is impossible to predict this from the modifiers!
|
|
|
|
|
*
|
|
|
|
|
* If the automatically determined sampling frequency is likely to cause an infinite
|
2010-04-01 11:59:27 +00:00
|
|
|
* loop (i.e. too close to 0), then clamp it to a determined "safe" value. The value
|
2012-05-08 20:18:33 +00:00
|
|
|
* chosen here is just the coarsest value which still looks reasonable...
|
2009-03-15 10:39:02 +00:00
|
|
|
*/
|
2012-05-08 20:18:33 +00:00
|
|
|
/* grid->dx represents the number of 'frames' between gridlines, but we divide by U.v2d_min_gridsize to get pixels-steps */
|
2012-10-20 20:20:02 +00:00
|
|
|
/* TODO: perhaps we should have 1.0 frames as upper limit so that curves don't get too distorted? */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
samplefreq = dx / (U.v2d_min_gridsize * U.pixelsize);
|
2014-11-16 23:02:31 +13:00
|
|
|
|
|
|
|
|
if (sipo->flag & SIPO_BEAUTYDRAW_OFF) {
|
|
|
|
|
/* Low Precision = coarse lower-bound clamping
|
|
|
|
|
*
|
|
|
|
|
* Although the "Beauty Draw" flag was originally for AA'd
|
|
|
|
|
* line drawing, the sampling rate here has a much greater
|
|
|
|
|
* impact on performance (e.g. for T40372)!
|
|
|
|
|
*
|
|
|
|
|
* This one still amounts to 10 sample-frames for each 1-frame interval
|
|
|
|
|
* which should be quite a decent approximation in many situations.
|
|
|
|
|
*/
|
|
|
|
|
if (samplefreq < 0.1f)
|
|
|
|
|
samplefreq = 0.1f;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* "Higher Precision" but slower - especially on larger windows (e.g. T40372) */
|
|
|
|
|
if (samplefreq < 0.00001f)
|
|
|
|
|
samplefreq = 0.00001f;
|
|
|
|
|
}
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* the start/end times are simply the horizontal extents of the 'cur' rect */
|
2012-05-08 20:18:33 +00:00
|
|
|
stime = v2d->cur.xmin;
|
|
|
|
|
etime = v2d->cur.xmax + samplefreq; /* + samplefreq here so that last item gets included... */
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
|
2010-01-26 03:16:14 +00:00
|
|
|
/* at each sampling interval, add a new vertex
|
|
|
|
|
* - apply the unit correction factor to the calculated values so that
|
|
|
|
|
* the displayed values appear correctly in the viewport
|
|
|
|
|
*/
|
2009-03-15 10:39:02 +00:00
|
|
|
glBegin(GL_LINE_STRIP);
|
2014-11-16 22:16:01 +13:00
|
|
|
|
|
|
|
|
n = (etime - stime) / samplefreq + 0.5f;
|
2014-11-16 23:02:31 +13:00
|
|
|
for (i = 0; i <= n; i++) {
|
2014-07-01 13:22:55 +06:00
|
|
|
float ctime = stime + i * samplefreq;
|
2012-04-29 17:11:40 +00:00
|
|
|
glVertex2f(ctime, evaluate_fcurve(fcu, ctime) * unitFac);
|
2014-07-01 13:22:55 +06:00
|
|
|
}
|
2014-11-16 22:16:01 +13:00
|
|
|
|
2009-03-15 10:39:02 +00:00
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
/* restore driver */
|
2012-05-08 20:18:33 +00:00
|
|
|
fcu->driver = driver;
|
2009-03-15 10:39:02 +00:00
|
|
|
}
|
|
|
|
|
|
2009-03-01 11:47:29 +00:00
|
|
|
/* helper func - draw a samples-based F-Curve */
|
2012-05-08 20:18:33 +00:00
|
|
|
static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d)
|
2009-03-01 11:47:29 +00:00
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
FPoint *prevfpt = fcu->fpt;
|
|
|
|
|
FPoint *fpt = prevfpt + 1;
|
2009-03-01 11:47:29 +00:00
|
|
|
float fac, v[2];
|
2012-05-08 20:18:33 +00:00
|
|
|
int b = fcu->totvert - 1;
|
2013-10-29 18:10:48 +00:00
|
|
|
float unit_scale;
|
2013-10-29 18:10:52 +00:00
|
|
|
short mapping_flag = ANIM_get_normalization_flags(ac);
|
2013-10-29 18:10:48 +00:00
|
|
|
|
2010-01-26 03:16:14 +00:00
|
|
|
/* apply unit mapping */
|
2013-10-29 18:10:48 +00:00
|
|
|
glPushMatrix();
|
2013-10-29 18:10:52 +00:00
|
|
|
unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
|
2013-10-29 18:10:48 +00:00
|
|
|
glScalef(1.0f, unit_scale, 1.0f);
|
|
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
2010-01-26 03:16:14 +00:00
|
|
|
|
2009-03-15 10:39:02 +00:00
|
|
|
/* extrapolate to left? - left-side of view comes before first keyframe? */
|
|
|
|
|
if (prevfpt->vec[0] > v2d->cur.xmin) {
|
2012-05-08 20:18:33 +00:00
|
|
|
v[0] = v2d->cur.xmin;
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
/* y-value depends on the interpolation */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (fcu->totvert == 1)) {
|
2009-03-15 10:39:02 +00:00
|
|
|
/* just extend across the first keyframe's value */
|
2012-05-08 20:18:33 +00:00
|
|
|
v[1] = prevfpt->vec[1];
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2009-03-15 10:39:02 +00:00
|
|
|
else {
|
2014-03-22 16:57:57 +13:00
|
|
|
/* extrapolate linear doesn't use the handle, use the next points center instead */
|
2012-05-08 20:18:33 +00:00
|
|
|
fac = (prevfpt->vec[0] - fpt->vec[0]) / (prevfpt->vec[0] - v[0]);
|
|
|
|
|
if (fac) fac = 1.0f / fac;
|
|
|
|
|
v[1] = prevfpt->vec[1] - fac * (prevfpt->vec[1] - fpt->vec[1]);
|
2009-03-01 11:47:29 +00:00
|
|
|
}
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
glVertex2fv(v);
|
2009-03-01 11:47:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* if only one sample, add it now */
|
|
|
|
|
if (fcu->totvert == 1)
|
|
|
|
|
glVertex2fv(prevfpt->vec);
|
|
|
|
|
|
|
|
|
|
/* loop over samples, drawing segments */
|
|
|
|
|
/* draw curve between first and last keyframe (if there are enough to do so) */
|
|
|
|
|
while (b--) {
|
|
|
|
|
/* Linear interpolation: just add one point (which should add a new line segment) */
|
|
|
|
|
glVertex2fv(prevfpt->vec);
|
|
|
|
|
|
|
|
|
|
/* get next pointers */
|
2012-05-08 20:18:33 +00:00
|
|
|
prevfpt = fpt;
|
2009-03-01 11:47:29 +00:00
|
|
|
fpt++;
|
|
|
|
|
|
|
|
|
|
/* last point? */
|
|
|
|
|
if (b == 0)
|
|
|
|
|
glVertex2fv(prevfpt->vec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* extrapolate to right? (see code for left-extrapolation above too) */
|
2009-03-15 10:39:02 +00:00
|
|
|
if (prevfpt->vec[0] < v2d->cur.xmax) {
|
2012-05-08 20:18:33 +00:00
|
|
|
v[0] = v2d->cur.xmax;
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
/* y-value depends on the interpolation */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (fcu->totvert == 1)) {
|
2009-03-15 10:39:02 +00:00
|
|
|
/* based on last keyframe's value */
|
2012-05-08 20:18:33 +00:00
|
|
|
v[1] = prevfpt->vec[1];
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2009-03-15 10:39:02 +00:00
|
|
|
else {
|
2014-03-22 16:57:57 +13:00
|
|
|
/* extrapolate linear doesn't use the handle, use the previous points center instead */
|
2012-05-08 20:18:33 +00:00
|
|
|
fpt = prevfpt - 1;
|
|
|
|
|
fac = (prevfpt->vec[0] - fpt->vec[0]) / (prevfpt->vec[0] - v[0]);
|
|
|
|
|
if (fac) fac = 1.0f / fac;
|
|
|
|
|
v[1] = prevfpt->vec[1] - fac * (prevfpt->vec[1] - fpt->vec[1]);
|
2009-03-01 11:47:29 +00:00
|
|
|
}
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
glVertex2fv(v);
|
2009-03-01 11:47:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glEnd();
|
2013-10-29 18:10:48 +00:00
|
|
|
glPopMatrix();
|
2009-03-01 11:47:29 +00:00
|
|
|
}
|
|
|
|
|
|
2014-11-16 23:32:23 +13:00
|
|
|
/* helper func - check if the F-Curve only contains easily drawable segments
|
|
|
|
|
* (i.e. no easing equation interpolations)
|
|
|
|
|
*/
|
|
|
|
|
static bool fcurve_can_use_simple_bezt_drawing(FCurve *fcu)
|
|
|
|
|
{
|
|
|
|
|
BezTriple *bezt;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
|
|
|
|
if (ELEM(bezt->ipo, BEZT_IPO_CONST, BEZT_IPO_LIN, BEZT_IPO_BEZ) == false) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* helper func - draw one repeat of an F-Curve (using Bezier curve approximations) */
|
2012-05-08 20:18:33 +00:00
|
|
|
static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d)
|
2009-01-09 06:25:14 +00:00
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
BezTriple *prevbezt = fcu->bezt;
|
|
|
|
|
BezTriple *bezt = prevbezt + 1;
|
2009-01-09 06:25:14 +00:00
|
|
|
float v1[2], v2[2], v3[2], v4[2];
|
|
|
|
|
float *fp, data[120];
|
2012-05-08 20:18:33 +00:00
|
|
|
float fac = 0.0f;
|
|
|
|
|
int b = fcu->totvert - 1;
|
2009-01-09 06:25:14 +00:00
|
|
|
int resol;
|
2013-10-29 18:10:48 +00:00
|
|
|
float unit_scale;
|
2013-10-29 18:10:52 +00:00
|
|
|
short mapping_flag = ANIM_get_normalization_flags(ac);
|
2014-11-16 23:32:23 +13:00
|
|
|
|
2010-01-26 03:16:14 +00:00
|
|
|
/* apply unit mapping */
|
2013-10-29 18:10:48 +00:00
|
|
|
glPushMatrix();
|
2013-10-29 18:10:52 +00:00
|
|
|
unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
|
2013-10-29 18:10:48 +00:00
|
|
|
glScalef(1.0f, unit_scale, 1.0f);
|
2014-11-16 23:32:23 +13:00
|
|
|
|
2013-10-29 18:10:48 +00:00
|
|
|
glBegin(GL_LINE_STRIP);
|
2010-01-26 03:16:14 +00:00
|
|
|
|
2009-01-09 06:25:14 +00:00
|
|
|
/* extrapolate to left? */
|
2009-03-15 10:39:02 +00:00
|
|
|
if (prevbezt->vec[1][0] > v2d->cur.xmin) {
|
2009-01-09 06:25:14 +00:00
|
|
|
/* left-side of view comes before first keyframe, so need to extend as not cyclic */
|
2012-05-08 20:18:33 +00:00
|
|
|
v1[0] = v2d->cur.xmin;
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
/* y-value depends on the interpolation */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (prevbezt->ipo == BEZT_IPO_CONST) || (fcu->totvert == 1)) {
|
2009-03-15 10:39:02 +00:00
|
|
|
/* just extend across the first keyframe's value */
|
2012-05-08 20:18:33 +00:00
|
|
|
v1[1] = prevbezt->vec[1][1];
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2012-05-08 20:18:33 +00:00
|
|
|
else if (prevbezt->ipo == BEZT_IPO_LIN) {
|
2009-03-15 10:39:02 +00:00
|
|
|
/* extrapolate linear dosnt use the handle, use the next points center instead */
|
2012-05-08 20:18:33 +00:00
|
|
|
fac = (prevbezt->vec[1][0] - bezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
|
|
|
|
|
if (fac) fac = 1.0f / fac;
|
|
|
|
|
v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[1][1] - bezt->vec[1][1]);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2009-03-15 10:39:02 +00:00
|
|
|
else {
|
|
|
|
|
/* based on angle of handle 1 (relative to keyframe) */
|
2012-05-08 20:18:33 +00:00
|
|
|
fac = (prevbezt->vec[0][0] - prevbezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
|
|
|
|
|
if (fac) fac = 1.0f / fac;
|
|
|
|
|
v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[0][1] - prevbezt->vec[1][1]);
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
glVertex2fv(v1);
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* if only one keyframe, add it now */
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
if (fcu->totvert == 1) {
|
2012-05-08 20:18:33 +00:00
|
|
|
v1[0] = prevbezt->vec[1][0];
|
|
|
|
|
v1[1] = prevbezt->vec[1][1];
|
2009-01-09 06:25:14 +00:00
|
|
|
glVertex2fv(v1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* draw curve between first and last keyframe (if there are enough to do so) */
|
2012-10-20 20:20:02 +00:00
|
|
|
/* TODO: optimize this to not have to calc stuff out of view too? */
|
2009-01-09 06:25:14 +00:00
|
|
|
while (b--) {
|
2012-05-08 20:18:33 +00:00
|
|
|
if (prevbezt->ipo == BEZT_IPO_CONST) {
|
2009-01-09 06:25:14 +00:00
|
|
|
/* Constant-Interpolation: draw segment between previous keyframe and next, but holding same value */
|
2012-05-08 20:18:33 +00:00
|
|
|
v1[0] = prevbezt->vec[1][0];
|
|
|
|
|
v1[1] = prevbezt->vec[1][1];
|
2009-01-09 06:25:14 +00:00
|
|
|
glVertex2fv(v1);
|
|
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
v1[0] = bezt->vec[1][0];
|
|
|
|
|
v1[1] = prevbezt->vec[1][1];
|
2009-01-09 06:25:14 +00:00
|
|
|
glVertex2fv(v1);
|
|
|
|
|
}
|
2012-05-08 20:18:33 +00:00
|
|
|
else if (prevbezt->ipo == BEZT_IPO_LIN) {
|
2009-01-09 06:25:14 +00:00
|
|
|
/* Linear interpolation: just add one point (which should add a new line segment) */
|
2012-05-08 20:18:33 +00:00
|
|
|
v1[0] = prevbezt->vec[1][0];
|
|
|
|
|
v1[1] = prevbezt->vec[1][1];
|
2009-01-09 06:25:14 +00:00
|
|
|
glVertex2fv(v1);
|
|
|
|
|
}
|
2014-11-16 23:32:23 +13:00
|
|
|
else if (prevbezt->ipo == BEZT_IPO_BEZ) {
|
2009-01-09 06:25:14 +00:00
|
|
|
/* Bezier-Interpolation: draw curve as series of segments between keyframes
|
|
|
|
|
* - resol determines number of points to sample in between keyframes
|
|
|
|
|
*/
|
|
|
|
|
|
2011-07-26 13:09:10 +00:00
|
|
|
/* resol depends on distance between points (not just horizontal) OR is a fixed high res */
|
2012-10-20 20:20:02 +00:00
|
|
|
/* TODO: view scale should factor into this someday too... */
|
2014-11-16 23:32:23 +13:00
|
|
|
if (fcu->driver) {
|
2012-05-08 20:18:33 +00:00
|
|
|
resol = 32;
|
2014-11-16 23:32:23 +13:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-08 20:18:33 +00:00
|
|
|
resol = (int)(5.0f * len_v2v2(bezt->vec[1], prevbezt->vec[1]));
|
2014-11-16 23:32:23 +13:00
|
|
|
}
|
2009-01-09 06:25:14 +00:00
|
|
|
|
|
|
|
|
if (resol < 2) {
|
|
|
|
|
/* only draw one */
|
2012-05-08 20:18:33 +00:00
|
|
|
v1[0] = prevbezt->vec[1][0];
|
|
|
|
|
v1[1] = prevbezt->vec[1][1];
|
2009-01-09 06:25:14 +00:00
|
|
|
glVertex2fv(v1);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* clamp resolution to max of 32 */
|
2012-10-20 20:20:02 +00:00
|
|
|
/* NOTE: higher values will crash */
|
2012-05-08 20:18:33 +00:00
|
|
|
if (resol > 32) resol = 32;
|
2009-01-09 06:25:14 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
v1[0] = prevbezt->vec[1][0];
|
|
|
|
|
v1[1] = prevbezt->vec[1][1];
|
|
|
|
|
v2[0] = prevbezt->vec[2][0];
|
|
|
|
|
v2[1] = prevbezt->vec[2][1];
|
2013-03-22 02:28:55 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
v3[0] = bezt->vec[0][0];
|
|
|
|
|
v3[1] = bezt->vec[0][1];
|
|
|
|
|
v4[0] = bezt->vec[1][0];
|
|
|
|
|
v4[1] = bezt->vec[1][1];
|
2009-01-09 06:25:14 +00:00
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
correct_bezpart(v1, v2, v3, v4);
|
2009-01-09 06:25:14 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
BKE_curve_forward_diff_bezier(v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float) * 3);
|
|
|
|
|
BKE_curve_forward_diff_bezier(v1[1], v2[1], v3[1], v4[1], data + 1, resol, sizeof(float) * 3);
|
2009-01-09 06:25:14 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
for (fp = data; resol; resol--, fp += 3)
|
2009-01-09 06:25:14 +00:00
|
|
|
glVertex2fv(fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* get next pointers */
|
2012-05-08 20:18:33 +00:00
|
|
|
prevbezt = bezt;
|
2009-01-09 06:25:14 +00:00
|
|
|
bezt++;
|
|
|
|
|
|
|
|
|
|
/* last point? */
|
|
|
|
|
if (b == 0) {
|
2012-05-08 20:18:33 +00:00
|
|
|
v1[0] = prevbezt->vec[1][0];
|
|
|
|
|
v1[1] = prevbezt->vec[1][1];
|
2009-01-09 06:25:14 +00:00
|
|
|
glVertex2fv(v1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* extrapolate to right? (see code for left-extrapolation above too) */
|
2009-03-15 10:39:02 +00:00
|
|
|
if (prevbezt->vec[1][0] < v2d->cur.xmax) {
|
2012-05-08 20:18:33 +00:00
|
|
|
v1[0] = v2d->cur.xmax;
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
/* y-value depends on the interpolation */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) || (fcu->flag & FCURVE_INT_VALUES) || (prevbezt->ipo == BEZT_IPO_CONST) || (fcu->totvert == 1)) {
|
2009-03-15 10:39:02 +00:00
|
|
|
/* based on last keyframe's value */
|
2012-05-08 20:18:33 +00:00
|
|
|
v1[1] = prevbezt->vec[1][1];
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2012-05-08 20:18:33 +00:00
|
|
|
else if (prevbezt->ipo == BEZT_IPO_LIN) {
|
2009-03-15 10:39:02 +00:00
|
|
|
/* extrapolate linear dosnt use the handle, use the previous points center instead */
|
2012-05-08 20:18:33 +00:00
|
|
|
bezt = prevbezt - 1;
|
|
|
|
|
fac = (prevbezt->vec[1][0] - bezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
|
|
|
|
|
if (fac) fac = 1.0f / fac;
|
|
|
|
|
v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[1][1] - bezt->vec[1][1]);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2009-03-15 10:39:02 +00:00
|
|
|
else {
|
|
|
|
|
/* based on angle of handle 1 (relative to keyframe) */
|
2012-05-08 20:18:33 +00:00
|
|
|
fac = (prevbezt->vec[2][0] - prevbezt->vec[1][0]) / (prevbezt->vec[1][0] - v1[0]);
|
|
|
|
|
if (fac) fac = 1.0f / fac;
|
|
|
|
|
v1[1] = prevbezt->vec[1][1] - fac * (prevbezt->vec[2][1] - prevbezt->vec[1][1]);
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
glVertex2fv(v1);
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glEnd();
|
2013-10-29 18:10:48 +00:00
|
|
|
glPopMatrix();
|
2014-03-22 02:50:24 +13:00
|
|
|
}
|
2009-01-09 06:25:14 +00:00
|
|
|
|
2013-03-22 02:28:55 +00:00
|
|
|
/* Debugging -------------------------------- */
|
|
|
|
|
|
|
|
|
|
/* Draw indicators which show the value calculated from the driver,
|
|
|
|
|
* and how this is mapped to the value that comes out of it. This
|
|
|
|
|
* is handy for helping users better understand how to interpret
|
|
|
|
|
* the graphs, and also facilitates debugging.
|
|
|
|
|
*/
|
|
|
|
|
static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
|
|
|
|
|
{
|
|
|
|
|
ChannelDriver *driver = fcu->driver;
|
|
|
|
|
View2D *v2d = &ac->ar->v2d;
|
2013-10-29 18:10:52 +00:00
|
|
|
short mapping_flag = ANIM_get_normalization_flags(ac);
|
|
|
|
|
float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
|
2013-03-22 02:28:55 +00:00
|
|
|
|
|
|
|
|
/* for now, only show when debugging driver... */
|
|
|
|
|
//if ((driver->flag & DRIVER_FLAG_SHOWDEBUG) == 0)
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
|
|
/* No curve to modify/visualise the result?
|
|
|
|
|
* => We still want to show the 1-1 default...
|
|
|
|
|
*/
|
2014-02-08 06:07:10 +11:00
|
|
|
if ((fcu->totvert == 0) && BLI_listbase_is_empty(&fcu->modifiers)) {
|
2013-03-22 02:28:55 +00:00
|
|
|
float t;
|
|
|
|
|
|
|
|
|
|
/* draw with thin dotted lines in style of what curve would have been */
|
|
|
|
|
glColor3fv(fcu->color);
|
|
|
|
|
|
|
|
|
|
setlinestyle(20);
|
|
|
|
|
glLineWidth(2.0f);
|
|
|
|
|
|
|
|
|
|
/* draw 1-1 line, stretching just past the screen limits
|
|
|
|
|
* NOTE: we need to scale the y-values to be valid for the units
|
|
|
|
|
*/
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
t = v2d->cur.xmin;
|
|
|
|
|
glVertex2f(t, t * unitfac);
|
|
|
|
|
|
|
|
|
|
t = v2d->cur.xmax;
|
|
|
|
|
glVertex2f(t, t * unitfac);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
/* cleanup line drawing */
|
|
|
|
|
setlinestyle(0);
|
|
|
|
|
glLineWidth(1.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* draw driver only if actually functional */
|
|
|
|
|
if ((driver->flag & DRIVER_FLAG_INVALID) == 0) {
|
|
|
|
|
/* grab "coordinates" for driver outputs */
|
|
|
|
|
float x = driver->curval;
|
|
|
|
|
float y = fcu->curval * unitfac;
|
|
|
|
|
|
|
|
|
|
/* only draw indicators if the point is in range*/
|
2013-03-22 03:25:31 +00:00
|
|
|
if (x >= v2d->cur.xmin) {
|
2013-03-22 02:28:55 +00:00
|
|
|
float co[2];
|
|
|
|
|
|
|
|
|
|
/* draw dotted lines leading towards this point from both axes ....... */
|
|
|
|
|
glColor3f(0.9f, 0.9f, 0.9f);
|
|
|
|
|
setlinestyle(5);
|
|
|
|
|
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
/* x-axis lookup */
|
|
|
|
|
co[0] = x;
|
|
|
|
|
|
|
|
|
|
if (y >= v2d->cur.ymin) {
|
2013-03-22 03:25:31 +00:00
|
|
|
co[1] = v2d->cur.ymin - 1.0f;
|
2013-03-22 02:28:55 +00:00
|
|
|
glVertex2fv(co);
|
|
|
|
|
|
|
|
|
|
co[1] = y;
|
|
|
|
|
glVertex2fv(co);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* y-axis lookup */
|
|
|
|
|
co[1] = y;
|
|
|
|
|
|
2013-03-22 03:25:31 +00:00
|
|
|
co[0] = v2d->cur.xmin - 1.0f;
|
2013-03-22 02:28:55 +00:00
|
|
|
glVertex2fv(co);
|
|
|
|
|
|
|
|
|
|
co[0] = x;
|
|
|
|
|
glVertex2fv(co);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
setlinestyle(0);
|
|
|
|
|
|
|
|
|
|
/* x marks the spot .................................................... */
|
|
|
|
|
/* -> outer frame */
|
|
|
|
|
glColor3f(0.9f, 0.9f, 0.9f);
|
|
|
|
|
glPointSize(7.0);
|
|
|
|
|
|
|
|
|
|
glBegin(GL_POINTS);
|
|
|
|
|
glVertex2f(x, y);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
/* inner frame */
|
|
|
|
|
glColor3f(0.9f, 0.0f, 0.0f);
|
|
|
|
|
glPointSize(3.0);
|
|
|
|
|
|
|
|
|
|
glBegin(GL_POINTS);
|
|
|
|
|
glVertex2f(x, y);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
glPointSize(1.0f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-15 10:39:02 +00:00
|
|
|
/* Public Curve-Drawing API ---------------- */
|
|
|
|
|
|
2010-01-26 03:16:14 +00:00
|
|
|
/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve)
|
|
|
|
|
* NOTE: unit mapping has already been applied to the values, so do not try and apply again
|
|
|
|
|
*/
|
2012-04-29 17:11:40 +00:00
|
|
|
void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
|
2009-04-08 01:07:46 +00:00
|
|
|
{
|
|
|
|
|
FCurve *fcu;
|
|
|
|
|
|
|
|
|
|
/* draw with thick dotted lines */
|
2009-05-28 01:57:29 +00:00
|
|
|
setlinestyle(10);
|
2009-04-08 01:07:46 +00:00
|
|
|
glLineWidth(3.0f);
|
|
|
|
|
|
|
|
|
|
/* anti-aliased lines for less jagged appearance */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
|
2009-04-08 01:07:46 +00:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
/* the ghost curves are simply sampled F-Curves stored in sipo->ghostCurves */
|
2012-05-08 20:18:33 +00:00
|
|
|
for (fcu = sipo->ghostCurves.first; fcu; fcu = fcu->next) {
|
2009-04-08 01:07:46 +00:00
|
|
|
/* set whatever color the curve has set
|
2012-05-08 20:18:33 +00:00
|
|
|
* - this is set by the function which creates these
|
2009-04-08 01:07:46 +00:00
|
|
|
* - draw with a fixed opacity of 2
|
|
|
|
|
*/
|
|
|
|
|
glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], 0.5f);
|
|
|
|
|
|
|
|
|
|
/* simply draw the stored samples */
|
2010-01-26 03:16:14 +00:00
|
|
|
draw_fcurve_curve_samples(ac, NULL, fcu, &ar->v2d);
|
2009-04-08 01:07:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* restore settings */
|
|
|
|
|
setlinestyle(0);
|
|
|
|
|
glLineWidth(1.0f);
|
|
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
|
2009-04-08 01:07:46 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This is called twice from space_graph.c -> graph_main_area_draw()
|
|
|
|
|
* Unselected then selected F-Curves are drawn so that they do not occlude each other.
|
|
|
|
|
*/
|
2012-04-29 17:11:40 +00:00
|
|
|
void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid, short sel)
|
2009-01-09 06:25:14 +00:00
|
|
|
{
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
|
bAnimListElem *ale;
|
|
|
|
|
int filter;
|
2009-01-09 06:25:14 +00:00
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
/* build list of curves to draw */
|
2012-05-08 20:18:33 +00:00
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE);
|
2009-04-12 13:19:21 +00:00
|
|
|
filter |= ((sel) ? (ANIMFILTER_SEL) : (ANIMFILTER_UNSEL));
|
2009-02-15 10:58:24 +00:00
|
|
|
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
2009-01-09 06:25:14 +00:00
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
/* for each curve:
|
|
|
|
|
* draw curve, then handle-lines, and finally vertices in this order so that
|
2012-05-08 20:18:33 +00:00
|
|
|
* the data will be layered correctly
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
*/
|
2012-05-08 20:18:33 +00:00
|
|
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
|
|
|
|
FCurve *fcu = (FCurve *)ale->key_data;
|
|
|
|
|
FModifier *fcm = find_active_fmodifier(&fcu->modifiers);
|
|
|
|
|
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
|
2009-01-09 06:25:14 +00:00
|
|
|
|
2009-02-09 23:46:13 +00:00
|
|
|
/* map keyframes for drawing if scaled F-Curve */
|
2009-06-23 13:25:31 +00:00
|
|
|
if (adt)
|
2010-01-15 10:34:39 +00:00
|
|
|
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
2009-03-15 10:39:02 +00:00
|
|
|
/* draw curve:
|
|
|
|
|
* - curve line may be result of one or more destructive modifiers or just the raw data,
|
|
|
|
|
* so we need to check which method should be used
|
2012-03-01 12:20:18 +00:00
|
|
|
* - controls from active modifier take precedence over keyframes
|
2009-03-15 10:39:02 +00:00
|
|
|
* (XXX! editing tools need to take this into account!)
|
2009-02-21 10:38:58 +00:00
|
|
|
*/
|
2009-03-15 10:39:02 +00:00
|
|
|
|
|
|
|
|
/* 1) draw curve line */
|
|
|
|
|
{
|
2009-02-12 01:47:45 +00:00
|
|
|
/* set color/drawing style for curve itself */
|
2013-10-02 16:37:47 +00:00
|
|
|
if (BKE_fcurve_is_protected(fcu)) {
|
2009-02-12 01:47:45 +00:00
|
|
|
/* protected curves (non editable) are drawn with dotted lines */
|
|
|
|
|
setlinestyle(2);
|
|
|
|
|
}
|
2012-09-09 00:00:21 +00:00
|
|
|
if (((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) || (fcu->flag & FCURVE_MUTED)) {
|
2012-07-03 19:09:07 +00:00
|
|
|
/* muted curves are drawn in a grayish hue */
|
2012-10-20 20:20:02 +00:00
|
|
|
/* XXX should we have some variations? */
|
2009-02-12 01:47:45 +00:00
|
|
|
UI_ThemeColorShade(TH_HEADER, 50);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2009-05-18 02:23:20 +00:00
|
|
|
/* set whatever color the curve has set
|
|
|
|
|
* - unselected curves draw less opaque to help distinguish the selected ones
|
|
|
|
|
*/
|
2012-03-31 04:04:58 +00:00
|
|
|
glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], fcurve_display_alpha(fcu));
|
2009-02-12 01:47:45 +00:00
|
|
|
}
|
2009-02-09 11:05:34 +00:00
|
|
|
|
2011-07-26 12:49:43 +00:00
|
|
|
/* draw active F-Curve thicker than the rest to make it stand out */
|
|
|
|
|
if (fcu->flag & FCURVE_ACTIVE) {
|
|
|
|
|
glLineWidth(2.0);
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-15 10:39:02 +00:00
|
|
|
/* anti-aliased lines for less jagged appearance */
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
|
2009-03-15 10:39:02 +00:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
2009-02-12 01:47:45 +00:00
|
|
|
/* draw F-Curve */
|
2009-03-18 10:58:18 +00:00
|
|
|
if ((fcu->modifiers.first) || (fcu->flag & FCURVE_INT_VALUES)) {
|
|
|
|
|
/* draw a curve affected by modifiers or only allowed to have integer values
|
|
|
|
|
* by sampling it at various small-intervals over the visible region
|
|
|
|
|
*/
|
2010-10-16 08:03:28 +00:00
|
|
|
draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, grid);
|
2009-03-15 10:39:02 +00:00
|
|
|
}
|
2012-09-09 00:00:21 +00:00
|
|
|
else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) {
|
2009-03-15 10:39:02 +00:00
|
|
|
/* just draw curve based on defined data (i.e. no modifiers) */
|
2014-11-16 23:32:23 +13:00
|
|
|
if (fcu->bezt) {
|
|
|
|
|
if (fcurve_can_use_simple_bezt_drawing(fcu))
|
|
|
|
|
draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d);
|
|
|
|
|
else
|
|
|
|
|
draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, grid);
|
|
|
|
|
}
|
|
|
|
|
else if (fcu->fpt) {
|
2010-01-26 03:16:14 +00:00
|
|
|
draw_fcurve_curve_samples(ac, ale->id, fcu, &ar->v2d);
|
2014-11-16 23:32:23 +13:00
|
|
|
}
|
2009-03-15 10:39:02 +00:00
|
|
|
}
|
2009-02-09 11:05:34 +00:00
|
|
|
|
2009-02-12 01:47:45 +00:00
|
|
|
/* restore settings */
|
|
|
|
|
setlinestyle(0);
|
2011-07-26 12:49:43 +00:00
|
|
|
glLineWidth(1.0);
|
2009-02-12 01:47:45 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
|
2009-03-15 10:39:02 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-28 06:50:30 +00:00
|
|
|
/* 2) draw handles and vertices as appropriate based on active
|
|
|
|
|
* - if the option to only show controls if the F-Curve is selected is enabled, we must obey this
|
|
|
|
|
*/
|
|
|
|
|
if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) {
|
2010-11-17 12:02:36 +00:00
|
|
|
if (fcurve_are_keyframes_usable(fcu) == 0) {
|
2009-07-28 06:50:30 +00:00
|
|
|
/* only draw controls if this is the active modifier */
|
|
|
|
|
if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
|
|
|
|
|
switch (fcm->type) {
|
|
|
|
|
case FMODIFIER_TYPE_ENVELOPE: /* envelope */
|
2010-10-16 08:03:28 +00:00
|
|
|
draw_fcurve_modifier_controls_envelope(fcm, &ar->v2d);
|
2009-07-28 06:50:30 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2009-03-21 03:49:22 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-09-09 00:00:21 +00:00
|
|
|
else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) {
|
2013-10-29 18:10:52 +00:00
|
|
|
short mapping_flag = ANIM_get_normalization_flags(ac);
|
|
|
|
|
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag);
|
2013-10-29 18:10:48 +00:00
|
|
|
|
|
|
|
|
glPushMatrix();
|
|
|
|
|
glScalef(1.0f, unit_scale, 1.0f);
|
|
|
|
|
|
2009-07-28 06:50:30 +00:00
|
|
|
if (fcu->bezt) {
|
2014-04-01 11:34:00 +11:00
|
|
|
bool do_handles = draw_fcurve_handles_check(sipo, fcu);
|
2010-01-30 21:11:46 +00:00
|
|
|
|
|
|
|
|
if (do_handles) {
|
2010-01-30 17:17:23 +00:00
|
|
|
/* only draw handles/vertices on keyframes */
|
|
|
|
|
glEnable(GL_BLEND);
|
2010-10-16 08:03:28 +00:00
|
|
|
draw_fcurve_handles(sipo, fcu);
|
2010-01-30 17:17:23 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
}
|
2010-01-30 21:11:46 +00:00
|
|
|
|
2013-10-29 18:10:48 +00:00
|
|
|
draw_fcurve_vertices(sipo, ar, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY), unit_scale);
|
2009-07-28 06:50:30 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2009-10-22 09:07:19 +00:00
|
|
|
/* samples: only draw two indicators at either end as indicators */
|
2011-02-09 02:09:25 +00:00
|
|
|
draw_fcurve_samples(sipo, ar, fcu);
|
2009-07-28 06:50:30 +00:00
|
|
|
}
|
2013-10-29 18:10:48 +00:00
|
|
|
|
|
|
|
|
glPopMatrix();
|
2009-02-09 23:46:13 +00:00
|
|
|
}
|
2009-02-09 11:05:34 +00:00
|
|
|
}
|
2009-01-09 06:25:14 +00:00
|
|
|
|
2013-03-22 02:28:55 +00:00
|
|
|
/* 3) draw driver debugging stuff */
|
|
|
|
|
if ((ac->datatype == ANIMCONT_DRIVERS) && (fcu->flag & FCURVE_ACTIVE)) {
|
|
|
|
|
graph_draw_driver_debug(ac, ale->id, fcu);
|
|
|
|
|
}
|
|
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
/* undo mapping of keyframes for drawing if scaled F-Curve */
|
2009-06-23 13:25:31 +00:00
|
|
|
if (adt)
|
2010-01-15 10:34:39 +00:00
|
|
|
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
|
|
|
|
/* free list of curves */
|
2014-05-19 00:24:45 +10:00
|
|
|
ANIM_animdata_freelist(&anim_data);
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
|
|
/* Channel List */
|
|
|
|
|
|
|
|
|
|
/* left hand part */
|
2010-10-16 08:03:28 +00:00
|
|
|
void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
{
|
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
|
bAnimListElem *ale;
|
|
|
|
|
int filter;
|
|
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
View2D *v2d = &ar->v2d;
|
|
|
|
|
float y = 0.0f, height;
|
2011-06-21 04:01:51 +00:00
|
|
|
size_t items;
|
2012-05-08 20:18:33 +00:00
|
|
|
int i = 0;
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
|
|
|
|
/* build list of channels to draw */
|
2012-05-08 20:18:33 +00:00
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
|
|
|
|
|
items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
|
|
|
|
/* Update max-extent of channels here (taking into account scrollers):
|
2012-05-08 20:18:33 +00:00
|
|
|
* - this is done to allow the channel list to be scrollable, but must be done here
|
|
|
|
|
* to avoid regenerating the list again and/or also because channels list is drawn first
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
* - offset of ACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for
|
|
|
|
|
* start of list offset, and the second is as a correction for the scrollers.
|
|
|
|
|
*/
|
2012-05-08 20:18:33 +00:00
|
|
|
height = (float)((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT * 2));
|
2009-02-19 17:13:04 +00:00
|
|
|
UI_view2d_totRect_set(v2d, ar->winx, height);
|
2009-01-28 18:26:47 +00:00
|
|
|
|
2012-10-21 05:46:41 +00:00
|
|
|
/* loop through channels, and set up drawing depending on their type */
|
2012-05-08 20:18:33 +00:00
|
|
|
{ /* first pass: just the standard GL-drawing for backdrop + text */
|
|
|
|
|
y = (float)ACHANNEL_FIRST;
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
for (ale = anim_data.first, i = 0; ale; ale = ale->next, i++) {
|
|
|
|
|
const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF);
|
|
|
|
|
const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF);
|
2009-08-16 02:21:43 +00:00
|
|
|
|
|
|
|
|
/* check if visible */
|
2012-05-08 20:18:33 +00:00
|
|
|
if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
|
|
|
|
|
IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
|
2009-08-16 02:21:43 +00:00
|
|
|
{
|
|
|
|
|
/* draw all channels using standard channel-drawing API */
|
|
|
|
|
ANIM_channel_draw(ac, ale, yminc, ymaxc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* adjust y-position for next one */
|
|
|
|
|
y -= ACHANNEL_STEP;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-05-08 20:18:33 +00:00
|
|
|
{ /* second pass: widgets */
|
2014-11-09 21:20:40 +01:00
|
|
|
uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
|
Animation channels can now be renamed by Ctrl-Clicking on them, as in
the Outliner
Channels which can be renamed include:
- Scenes, Objects, World, Material, Texture, etc. (i.e. "ID-blocks",
or the dark and light blue channels)
- Action Groups (green channels)
- Action expanders (i.e. "CubeAction", "WorldAction", etc.)
- Grease Pencil stuff
Channels which CANNOT be renamed, as they mostly use hardcoded values
or otherwise include:
- Drivers expander
- FCurves (they don't technically have a "name"; what is shown is just
a user-friendly representation of their rna_paths)
2011-08-03 01:22:31 +00:00
|
|
|
size_t channel_index = 0;
|
2009-08-16 02:21:43 +00:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
y = (float)ACHANNEL_FIRST;
|
2009-08-16 02:21:43 +00:00
|
|
|
|
2009-08-18 11:48:34 +00:00
|
|
|
/* set blending again, as may not be set in previous step */
|
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
for (ale = anim_data.first, i = 0; ale; ale = ale->next, i++) {
|
|
|
|
|
const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF);
|
|
|
|
|
const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF);
|
2009-08-16 02:21:43 +00:00
|
|
|
|
|
|
|
|
/* check if visible */
|
2012-05-08 20:18:33 +00:00
|
|
|
if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
|
|
|
|
|
IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
|
2009-08-16 02:21:43 +00:00
|
|
|
{
|
|
|
|
|
/* draw all channels using standard channel-drawing API */
|
Animation channels can now be renamed by Ctrl-Clicking on them, as in
the Outliner
Channels which can be renamed include:
- Scenes, Objects, World, Material, Texture, etc. (i.e. "ID-blocks",
or the dark and light blue channels)
- Action Groups (green channels)
- Action expanders (i.e. "CubeAction", "WorldAction", etc.)
- Grease Pencil stuff
Channels which CANNOT be renamed, as they mostly use hardcoded values
or otherwise include:
- Drivers expander
- FCurves (they don't technically have a "name"; what is shown is just
a user-friendly representation of their rna_paths)
2011-08-03 01:22:31 +00:00
|
|
|
ANIM_channel_draw_widgets(C, ac, ale, block, yminc, ymaxc, channel_index);
|
2009-08-16 02:21:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* adjust y-position for next one */
|
|
|
|
|
y -= ACHANNEL_STEP;
|
Animation channels can now be renamed by Ctrl-Clicking on them, as in
the Outliner
Channels which can be renamed include:
- Scenes, Objects, World, Material, Texture, etc. (i.e. "ID-blocks",
or the dark and light blue channels)
- Action Groups (green channels)
- Action expanders (i.e. "CubeAction", "WorldAction", etc.)
- Grease Pencil stuff
Channels which CANNOT be renamed, as they mostly use hardcoded values
or otherwise include:
- Drivers expander
- FCurves (they don't technically have a "name"; what is shown is just
a user-friendly representation of their rna_paths)
2011-08-03 01:22:31 +00:00
|
|
|
channel_index++;
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
}
|
|
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_block_end(C, block);
|
|
|
|
|
UI_block_draw(C, block);
|
2009-08-18 11:48:34 +00:00
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* free tempolary channels */
|
2014-05-19 00:24:45 +10:00
|
|
|
ANIM_animdata_freelist(&anim_data);
|
2009-01-09 06:25:14 +00:00
|
|
|
}
|