Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/editors/space_nla/nla_draw.c138
-rw-r--r--source/blender/editors/space_nla/nla_intern.h1
-rw-r--r--source/blender/editors/space_nla/nla_ops.c121
-rw-r--r--source/blender/editors/space_nla/space_nla.c2
-rw-r--r--source/blender/makesdna/DNA_anim_types.h2
5 files changed, 263 insertions, 1 deletions
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 8b8ae7c5b8b..8da59ced436 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -83,6 +83,144 @@
extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
/* *********************************************** */
+/* Strips */
+
+static void nla_draw_strip (NlaTrack *nlt, NlaStrip *strip, View2D *v2d, float yminc, float ymaxc)
+{
+ /* draw extrapolation info first (as backdrop) */
+ // TODO...
+
+ /* draw 'inside' of strip itself */
+ /* set color of strip - color is used to indicate status here */
+ if (strip->flag & NLASTRIP_FLAG_ACTIVE) {
+ /* tweaking strip should be drawn green when it is acting as the tweaking strip */
+ // FIXME: hardcoded temp-hack colors
+ glColor3f(0.3f, 0.95f, 0.1f);
+ }
+ else if (strip->flag & NLASTRIP_FLAG_TWEAKUSER) {
+ /* alert user that this strip is also used by the tweaking track (this is set when going into
+ * 'editmode' for that strip), since the edits made here may not be what the user anticipated
+ */
+ // FIXME: hardcoded temp-hack colors
+ glColor3f(0.85f, 0.0f, 0.0f);
+ }
+ else if (strip->flag & NLASTRIP_FLAG_SELECT) {
+ /* selected strip - use theme color for selected */
+ UI_ThemeColor(TH_STRIP_SELECT);
+ }
+ else {
+ /* normal, unselected strip - use standard strip theme color */
+ UI_ThemeColor(TH_STRIP);
+ }
+ uiSetRoundBox(15); /* all corners rounded */
+ gl_round_box(GL_POLYGON, strip->start, yminc, strip->end, ymaxc, 9);
+
+ /* draw strip outline */
+ if (strip->flag & NLASTRIP_FLAG_ACTIVE) {
+ /* strip should appear 'sunken', so draw a light border around it */
+ glColor3f(0.9f, 1.0f, 0.9f); // FIXME: hardcoded temp-hack colors
+ }
+ else {
+ /* strip should appear to stand out, so draw a dark border around it */
+ glColor3f(0.0f, 0.0f, 0.0f);
+ }
+ gl_round_box(GL_LINES, strip->start, yminc, strip->end, ymaxc, 9);
+}
+
+/* ---------------------- */
+
+void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+
+ View2D *v2d= &ar->v2d;
+ float y= 0.0f;
+ int items, height;
+
+ /* build list of channels to draw */
+ filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS);
+ items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* Update max-extent of channels here (taking into account scrollers):
+ * - 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
+ * - offset of NLACHANNEL_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.
+ */
+ height= ((items*NLACHANNEL_STEP) + (NLACHANNEL_HEIGHT*2));
+ if (height > (v2d->mask.ymax - v2d->mask.ymin)) {
+ /* don't use totrect set, as the width stays the same
+ * (NOTE: this is ok here, the configuration is pretty straightforward)
+ */
+ v2d->tot.ymax= (float)(height);
+ }
+
+ /* loop through channels, and set up drawing depending on their type */
+ y= (float)(-NLACHANNEL_FIRST);
+
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF);
+ const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF);
+
+ /* check if visible */
+ if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
+ IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
+ {
+ /* data to draw depends on the type of channel */
+ switch (ale->type) {
+ case ANIMTYPE_NLATRACK:
+ {
+ NlaTrack *nlt= (NlaTrack *)ale->data;
+ NlaStrip *strip;
+
+ /* draw backdrop? */
+ // TODO...
+
+ /* draw each strip in the track */
+ for (strip= nlt->strips.first; strip; strip= strip->next) {
+ /* only draw if at least part of the strip is within view */
+ if ( IN_RANGE(v2d->cur.xmin, strip->start, strip->end) ||
+ IN_RANGE(v2d->cur.xmax, strip->start, strip->end) )
+ {
+ nla_draw_strip(nlt, strip, v2d, yminc, ymaxc);
+ }
+ }
+ }
+ break;
+
+ case ANIMTYPE_NLAACTION:
+ {
+ /* just draw a semi-shaded rect spanning the width of the viewable area if there's data */
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+
+ if (ale->data)
+ glColor4f(0.8f, 0.2f, 0.0f, 0.4f); // reddish color - hardcoded for now
+ else
+ glColor4f(0.6f, 0.5f, 0.5f, 0.3f); // greyish-red color - hardcoded for now
+
+ glBegin(GL_QUADS);
+ glVertex2f(v2d->cur.xmin, yminc);
+ glVertex2f(v2d->cur.xmin, ymaxc);
+ glVertex2f(v2d->cur.xmax, ymaxc);
+ glVertex2f(v2d->cur.xmax, yminc);
+ glEnd();
+
+ glDisable(GL_BLEND);
+ }
+ break;
+ }
+ }
+
+ /* adjust y-position for next one */
+ y += NLACHANNEL_STEP;
+ }
+
+ /* free tempolary channels */
+ BLI_freelistN(&anim_data);
+}
/* *********************************************** */
/* Channel List */
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 4d013db8be9..3728ba2cbc8 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -49,6 +49,7 @@
/* **************************************** */
/* nla_draw.c */
+void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar);
void draw_nla_channel_list(bAnimContext *ac, SpaceNla *snla, ARegion *ar);
/* **************************************** */
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
new file mode 100644
index 00000000000..f0e3bd5bca5
--- /dev/null
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -0,0 +1,121 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Joshua Leung (major recode)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string.h>
+#include <stdio.h>
+
+#include "DNA_anim_types.h"
+#include "DNA_action_types.h"
+#include "DNA_nla_types.h"
+#include "DNA_object_types.h"
+#include "DNA_space_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_rand.h"
+
+#include "BKE_animsys.h"
+#include "BKE_nla.h"
+#include "BKE_context.h"
+#include "BKE_report.h"
+#include "BKE_screen.h"
+
+#include "ED_anim_api.h"
+#include "ED_space_api.h"
+#include "ED_screen.h"
+
+#include "BIF_gl.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+#include "UI_view2d.h"
+
+#include "ED_markers.h"
+
+#include "nla_intern.h" // own include
+
+
+/* ************************** registration - operator types **********************************/
+
+void nla_operatortypes(void)
+{
+ //WM_operatortype_append();
+
+}
+
+/* ************************** registration - keymaps **********************************/
+
+static void nla_keymap_channels (wmWindowManager *wm, ListBase *keymap)
+{
+ //wmKeymapItem *kmi;
+
+
+
+ /* transform system */
+ //transform_keymap_for_space(wm, keymap, SPACE_NLA);
+}
+
+static void nla_keymap_main (wmWindowManager *wm, ListBase *keymap)
+{
+ //wmKeymapItem *kmi;
+
+
+
+ /* transform system */
+ //transform_keymap_for_space(wm, keymap, SPACE_NLA);
+}
+
+/* --------------- */
+
+void nla_keymap(wmWindowManager *wm)
+{
+ ListBase *keymap;
+
+ /* channels */
+ /* Channels are not directly handled by the NLA Editor module, but are inherited from the Animation module.
+ * Most of the relevant operations, keymaps, drawing, etc. can therefore all be found in that module instead, as there
+ * are many similarities with the other Animation Editors.
+ *
+ * However, those operations which involve clicking on channels and/or the placement of them in the view are implemented here instead
+ */
+ keymap= WM_keymap_listbase(wm, "NLA_Channels", SPACE_NLA, 0);
+ nla_keymap_channels(wm, keymap);
+
+ /* data */
+ keymap= WM_keymap_listbase(wm, "NLA_Data", SPACE_NLA, 0);
+ nla_keymap_main(wm, keymap);
+}
+
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 39888162a95..bf122227a8b 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -246,7 +246,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
/* data */
if (ANIM_animdata_get_context(C, &ac)) {
- //draw_channel_strips(&ac, saction, ar);
+ draw_nla_main_data(&ac, snla, ar);
}
/* current frame */
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index b20ec7ba37f..fe535b671f8 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -444,6 +444,8 @@ enum {
NLASTRIP_FLAG_SELECT = (1<<1),
// NLASTRIP_FLAG_SELECT_L = (1<<2), // left handle selected
// NLASTRIP_FLAG_SELECT_R = (1<<3), // right handle selected
+ /* NLA strip uses the same action that the action being tweaked uses (not set for the twaking one though) */
+ NLASTRIP_FLAG_TWEAKUSER = (1<<4),
/* controls driven by local F-Curves */
/* strip influence is controlled by local F-Curve */