2008-11-24 18:59:59 +00:00
|
|
|
/**
|
|
|
|
* $Id:
|
|
|
|
*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
#include <math.h>
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_view2d_types.h"
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
2008-11-24 18:59:59 +00:00
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2008-11-24 18:59:59 +00:00
|
|
|
#include "BKE_global.h"
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
#include "BKE_utildefines.h"
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
#include "BIF_gl.h"
|
|
|
|
#include "BIF_glutil.h"
|
|
|
|
|
|
|
|
#include "UI_interface.h"
|
2008-11-27 17:58:46 +00:00
|
|
|
#include "UI_interface_icons.h"
|
2008-11-24 18:59:59 +00:00
|
|
|
#include "UI_view2d.h"
|
|
|
|
#include "UI_resources.h"
|
2008-12-03 13:44:16 +00:00
|
|
|
#include "UI_text.h"
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
#include "ED_markers.h"
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
#include "ED_screen.h"
|
2008-11-24 18:59:59 +00:00
|
|
|
#include "ED_types.h"
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
#include "ED_util.h"
|
|
|
|
|
|
|
|
/* ************* Marker API **************** */
|
|
|
|
|
|
|
|
static ListBase *context_get_markers(const bContext *C)
|
|
|
|
{
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* XXX get them from pose */
|
|
|
|
if ((slink->spacetype == SPACE_ACTION) && (saction->flag & SACTION_POSEMARKERS_MOVE)) {
|
|
|
|
if (saction->action)
|
|
|
|
markers= &saction->action->markers;
|
|
|
|
else
|
|
|
|
markers= NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
return &CTX_data_scene(C)->markers;
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
}
|
|
|
|
|
2008-11-24 18:59:59 +00:00
|
|
|
/* ************* Marker Drawing ************ */
|
|
|
|
|
|
|
|
/* XXX */
|
|
|
|
extern void ui_rasterpos_safe(float x, float y, float aspect);
|
|
|
|
|
|
|
|
/* function to draw markers */
|
|
|
|
static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
|
|
|
|
{
|
|
|
|
float xpos, ypixels, xscale, yscale;
|
|
|
|
int icon_id= 0;
|
|
|
|
|
|
|
|
xpos = marker->frame;
|
|
|
|
|
2008-12-21 03:14:01 +00:00
|
|
|
/* no time correction for framelen! space is drawn with old values */
|
2008-11-24 18:59:59 +00:00
|
|
|
ypixels= v2d->mask.ymax-v2d->mask.ymin;
|
|
|
|
UI_view2d_getscale(v2d, &xscale, &yscale);
|
|
|
|
|
2008-12-02 09:43:23 +00:00
|
|
|
glScalef(1.0/xscale, 1.0, 1.0);
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
|
2008-12-21 03:14:01 +00:00
|
|
|
/* vertical line - dotted */
|
2008-11-24 18:59:59 +00:00
|
|
|
if (flag & DRAW_MARKERS_LINES) {
|
|
|
|
setlinestyle(3);
|
2008-12-21 03:14:01 +00:00
|
|
|
|
|
|
|
if (marker->flag & SELECT)
|
|
|
|
glColor4ub(255, 255, 255, 96);
|
2008-11-24 18:59:59 +00:00
|
|
|
else
|
2008-12-21 03:14:01 +00:00
|
|
|
glColor4ub(0, 0, 0, 96);
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
glBegin(GL_LINES);
|
2008-12-21 03:14:01 +00:00
|
|
|
glVertex2f((xpos*xscale)+0.5, 12);
|
|
|
|
glVertex2f((xpos*xscale)+0.5, 34*yscale); /* a bit lazy but we know it cant be greater then 34 strips high*/
|
2008-11-24 18:59:59 +00:00
|
|
|
glEnd();
|
2008-12-21 03:14:01 +00:00
|
|
|
|
2008-11-24 18:59:59 +00:00
|
|
|
setlinestyle(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 5 px to offset icon to align properly, space / pixels corrects for zoom */
|
|
|
|
if (flag & DRAW_MARKERS_LOCAL) {
|
|
|
|
icon_id= (marker->flag & ACTIVE) ? ICON_PMARKER_ACT :
|
|
|
|
(marker->flag & SELECT) ? ICON_PMARKER_SEL :
|
|
|
|
ICON_PMARKER;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
icon_id= (marker->flag & SELECT) ? ICON_MARKER_HLT :
|
|
|
|
ICON_MARKER;
|
|
|
|
}
|
|
|
|
|
2008-12-02 09:43:23 +00:00
|
|
|
UI_icon_draw(xpos*xscale-5.0, 16.0, icon_id);
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
glBlendFunc(GL_ONE, GL_ZERO);
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
/* and the marker name too, shifted slightly to the top-right */
|
2008-12-21 03:14:01 +00:00
|
|
|
if (marker->name && marker->name[0]) {
|
2008-11-24 18:59:59 +00:00
|
|
|
if(marker->flag & SELECT) {
|
2008-12-02 09:43:23 +00:00
|
|
|
UI_ThemeColor(TH_TEXT_HI);
|
2008-11-24 18:59:59 +00:00
|
|
|
ui_rasterpos_safe(xpos*xscale+4.0, (ypixels<=39.0)?(ypixels-10.0):29.0, 1.0);
|
|
|
|
}
|
|
|
|
else {
|
2008-12-02 09:43:23 +00:00
|
|
|
UI_ThemeColor(TH_TEXT);
|
2008-11-24 18:59:59 +00:00
|
|
|
if((marker->frame <= cfra) && (marker->frame+5 > cfra))
|
|
|
|
ui_rasterpos_safe(xpos*xscale+4.0, (ypixels<=39.0)?(ypixels-10.0):29.0, 1.0);
|
|
|
|
else
|
|
|
|
ui_rasterpos_safe(xpos*xscale+4.0, 17.0, 1.0);
|
|
|
|
}
|
2008-12-02 09:43:23 +00:00
|
|
|
UI_DrawString(G.font, marker->name, 0);
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
2008-12-02 09:43:23 +00:00
|
|
|
glScalef(xscale, 1.0, 1.0);
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
|
|
|
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
/* Draw Scene-Markers in time window */
|
2008-11-24 18:59:59 +00:00
|
|
|
void draw_markers_time(const bContext *C, int flag)
|
|
|
|
{
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
ListBase *markers= context_get_markers(C);
|
2008-12-02 09:43:23 +00:00
|
|
|
View2D *v2d= UI_view2d_fromcontext(C);
|
2008-11-24 18:59:59 +00:00
|
|
|
TimeMarker *marker;
|
|
|
|
|
|
|
|
/* unselected markers are drawn at the first time */
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
for (marker= markers->first; marker; marker= marker->next) {
|
2008-12-18 02:56:48 +00:00
|
|
|
if (!(marker->flag & SELECT)) draw_marker(v2d, marker, CTX_data_scene(C)->r.cfra, flag);
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* selected markers are drawn later */
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
for (marker= markers->first; marker; marker= marker->next) {
|
2008-12-18 02:56:48 +00:00
|
|
|
if (marker->flag & SELECT) draw_marker(v2d, marker, CTX_data_scene(C)->r.cfra, flag);
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
/* ************************** add markers *************************** */
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
/* add TimeMarker at curent frame */
|
|
|
|
static int ed_marker_add(bContext *C, wmOperator *op)
|
|
|
|
{
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
ListBase *markers= context_get_markers(C);
|
2008-11-24 18:59:59 +00:00
|
|
|
TimeMarker *marker;
|
2008-12-18 02:56:48 +00:00
|
|
|
int frame= CTX_data_scene(C)->r.cfra;
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
/* two markers can't be at the same place */
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
for(marker= markers->first; marker; marker= marker->next)
|
2008-11-24 18:59:59 +00:00
|
|
|
if(marker->frame == frame)
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
/* deselect all */
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
for(marker= markers->first; marker; marker= marker->next)
|
2008-11-24 18:59:59 +00:00
|
|
|
marker->flag &= ~SELECT;
|
|
|
|
|
|
|
|
marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
|
|
|
|
marker->flag= SELECT;
|
|
|
|
marker->frame= frame;
|
2008-12-02 09:43:23 +00:00
|
|
|
sprintf(marker->name, "Frame %d", frame); // XXX - temp code only
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
BLI_addtail(markers, marker);
|
2008-11-24 18:59:59 +00:00
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2008-11-24 18:59:59 +00:00
|
|
|
//BIF_undo_push("Add Marker");
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
2008-12-26 11:33:41 +00:00
|
|
|
static void MARKER_OT_add(wmOperatorType *ot)
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Add Time Marker";
|
2008-12-26 11:33:41 +00:00
|
|
|
ot->idname= "MARKER_OT_add";
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= ed_marker_add;
|
|
|
|
ot->poll= ED_operator_areaactive;
|
|
|
|
|
|
|
|
}
|
2008-11-24 18:59:59 +00:00
|
|
|
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
/* ************************** transform markers *************************** */
|
|
|
|
|
|
|
|
|
|
|
|
/* operator state vars used:
|
|
|
|
frs: delta movement
|
|
|
|
|
|
|
|
functions:
|
|
|
|
|
|
|
|
init() check selection, add customdata with old values and some lookups
|
|
|
|
|
|
|
|
apply() do the actual movement
|
|
|
|
|
|
|
|
exit() cleanup, send notifier
|
|
|
|
|
|
|
|
cancel() to escpae from modal
|
|
|
|
|
|
|
|
callbacks:
|
|
|
|
|
|
|
|
exec() calls init, apply, exit
|
|
|
|
|
|
|
|
invoke() calls init, adds modal handler
|
|
|
|
|
|
|
|
modal() accept modal events while doing it, ends with apply and exit, or cancel
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct MarkerMove {
|
|
|
|
SpaceLink *slink;
|
|
|
|
ListBase *markers;
|
|
|
|
int event_type; /* store invoke-event, to verify */
|
|
|
|
int *oldframe, evtx, firstx;
|
|
|
|
} MarkerMove;
|
|
|
|
|
|
|
|
/* copy selection to temp buffer */
|
|
|
|
/* return 0 if not OK */
|
|
|
|
static int ed_marker_move_init(bContext *C, wmOperator *op)
|
2008-11-24 18:59:59 +00:00
|
|
|
{
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
ListBase *markers= context_get_markers(C);
|
|
|
|
MarkerMove *mm;
|
|
|
|
TimeMarker *marker;
|
2008-12-03 17:36:30 +00:00
|
|
|
int totmark=0;
|
|
|
|
int a;
|
2008-11-24 18:59:59 +00:00
|
|
|
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
for (marker= markers->first; marker; marker= marker->next)
|
|
|
|
if (marker->flag & SELECT) totmark++;
|
|
|
|
|
|
|
|
if (totmark==0) return 0;
|
|
|
|
|
|
|
|
op->customdata= mm= MEM_callocN(sizeof(MarkerMove), "Markermove");
|
2008-12-18 02:56:48 +00:00
|
|
|
mm->slink= CTX_wm_space_data(C);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
mm->markers= markers;
|
|
|
|
mm->oldframe= MEM_callocN(totmark*sizeof(int), "MarkerMove oldframe");
|
|
|
|
|
|
|
|
for (a=0, marker= markers->first; marker; marker= marker->next) {
|
|
|
|
if (marker->flag & SELECT) {
|
|
|
|
mm->oldframe[a]= marker->frame;
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free stuff */
|
|
|
|
static void ed_marker_move_exit(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
MarkerMove *mm= op->customdata;
|
|
|
|
|
|
|
|
MEM_freeN(mm->oldframe);
|
|
|
|
MEM_freeN(op->customdata);
|
|
|
|
op->customdata= NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
|
|
|
if(ed_marker_move_init(C, op)) {
|
|
|
|
MarkerMove *mm= op->customdata;
|
|
|
|
|
|
|
|
mm->evtx= evt->x;
|
|
|
|
mm->firstx= evt->x;
|
|
|
|
mm->event_type= evt->type;
|
|
|
|
|
|
|
|
/* add temp handler */
|
2008-12-18 02:56:48 +00:00
|
|
|
WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
/* reset frs delta */
|
|
|
|
RNA_int_set(op->ptr, "frs", 0);
|
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* note, init has to be called succesfully */
|
|
|
|
static void ed_marker_move_apply(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
MarkerMove *mm= op->customdata;
|
|
|
|
TimeMarker *marker;
|
|
|
|
int a, offs;
|
|
|
|
|
|
|
|
offs= RNA_int_get(op->ptr, "frs");
|
|
|
|
for (a=0, marker= mm->markers->first; marker; marker= marker->next) {
|
|
|
|
if (marker->flag & SELECT) {
|
|
|
|
marker->frame= mm->oldframe[a] + offs;
|
|
|
|
a++;
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
|
|
|
}
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* only for modal */
|
|
|
|
static void ed_marker_move_cancel(bContext *C, wmOperator *op)
|
|
|
|
{
|
2008-11-24 18:59:59 +00:00
|
|
|
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
RNA_int_set(op->ptr, "frs", 0);
|
|
|
|
ed_marker_move_apply(C, op);
|
|
|
|
ed_marker_move_exit(C, op);
|
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
2008-12-22 09:43:29 +00:00
|
|
|
Scene *scene= CTX_data_scene(C);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
MarkerMove *mm= op->customdata;
|
2008-12-02 09:43:23 +00:00
|
|
|
View2D *v2d= UI_view2d_fromcontext(C);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
TimeMarker *marker, *selmarker=NULL;
|
|
|
|
float dx, fac;
|
|
|
|
char str[256];
|
|
|
|
|
|
|
|
switch(evt->type) {
|
|
|
|
case ESCKEY:
|
|
|
|
ed_marker_move_cancel(C, op);
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
case LEFTMOUSE:
|
|
|
|
case MIDDLEMOUSE:
|
|
|
|
case RIGHTMOUSE:
|
2009-01-01 18:05:12 +00:00
|
|
|
if(WM_modal_tweak_exit(evt, mm->event_type)) {
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
ed_marker_move_exit(C, op);
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
case MOUSEMOVE:
|
|
|
|
|
|
|
|
dx= v2d->mask.xmax-v2d->mask.xmin;
|
|
|
|
dx= (v2d->cur.xmax-v2d->cur.xmin)/dx;
|
|
|
|
|
|
|
|
if (evt->x != mm->evtx) { /* XXX maybe init for firsttime */
|
|
|
|
int a, offs, totmark=0;
|
|
|
|
|
|
|
|
mm->evtx= evt->x;
|
|
|
|
|
|
|
|
fac= ((float)(evt->x - mm->firstx)*dx);
|
|
|
|
|
|
|
|
if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND))
|
2008-12-19 19:11:02 +00:00
|
|
|
apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, FPS, 0.1*FPS, 0);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
else
|
2008-12-19 19:11:02 +00:00
|
|
|
apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
offs= (int)fac;
|
|
|
|
RNA_int_set(op->ptr, "frs", offs);
|
|
|
|
ed_marker_move_apply(C, op);
|
|
|
|
|
|
|
|
/* cruft below is for header print */
|
|
|
|
for (a=0, marker= mm->markers->first; marker; marker= marker->next) {
|
|
|
|
if (marker->flag & SELECT) {
|
|
|
|
selmarker= marker;
|
|
|
|
a++; totmark++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (totmark==1) {
|
|
|
|
/* we print current marker value */
|
|
|
|
if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND)) {
|
|
|
|
SpaceTime *stime= (SpaceTime *)mm->slink;
|
|
|
|
if (stime->flag & TIME_DRAWFRAMES)
|
|
|
|
sprintf(str, "Marker %d offset %d", selmarker->frame, offs);
|
|
|
|
else
|
|
|
|
sprintf(str, "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
|
|
|
|
}
|
|
|
|
else if (mm->slink->spacetype == SPACE_ACTION) {
|
|
|
|
#if 0
|
|
|
|
XXX if (saction->flag & SACTION_DRAWTIME)
|
|
|
|
sprintf(str, "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
|
|
|
|
else
|
|
|
|
sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* we only print the offset */
|
|
|
|
if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND)) {
|
|
|
|
SpaceTime *stime= (SpaceTime *)mm->slink;
|
|
|
|
if (stime->flag & TIME_DRAWFRAMES)
|
|
|
|
sprintf(str, "Marker offset %d ", offs);
|
|
|
|
else
|
|
|
|
sprintf(str, "Marker offset %.2f ", FRA2TIME(offs));
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
XXX else if (mm->slink->spacetype == SPACE_ACTION) {
|
|
|
|
if (saction->flag & SACTION_DRAWTIME)
|
|
|
|
sprintf(str, "Marker offset %.2f ", FRA2TIME(offs));
|
|
|
|
else
|
|
|
|
sprintf(str, "Marker offset %.2f ", (double)(offs));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else {
|
|
|
|
sprintf(str, "Marker offset %.2f ", (double)(offs));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
// headerprint(str); XXX
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ed_marker_move_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
if(ed_marker_move_init(C, op)) {
|
|
|
|
ed_marker_move_apply(C, op);
|
|
|
|
ed_marker_move_exit(C, op);
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
2008-12-26 11:33:41 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 11:33:41 +00:00
|
|
|
static void MARKER_OT_move(wmOperatorType *ot)
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Move Time Marker";
|
2008-12-26 11:33:41 +00:00
|
|
|
ot->idname= "MARKER_OT_move";
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= ed_marker_move_exec;
|
|
|
|
ot->invoke= ed_marker_move_invoke;
|
|
|
|
ot->modal= ed_marker_move_modal;
|
|
|
|
ot->poll= ED_operator_areaactive;
|
|
|
|
|
|
|
|
/* rna storage */
|
|
|
|
RNA_def_property(ot->srna, "frs", PROP_INT, PROP_NONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** duplicate markers *************************** */
|
|
|
|
|
|
|
|
/* operator state vars used:
|
|
|
|
frs: delta movement
|
|
|
|
|
|
|
|
functions:
|
|
|
|
|
|
|
|
apply() do the actual duplicate
|
|
|
|
|
|
|
|
callbacks:
|
|
|
|
|
|
|
|
exec() calls apply, move_exec
|
|
|
|
|
|
|
|
invoke() calls apply, move_invoke
|
|
|
|
|
|
|
|
modal() uses move_modal
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2008-11-24 18:59:59 +00:00
|
|
|
/* duplicate selected TimeMarkers */
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
static void ed_marker_duplicate_apply(bContext *C, wmOperator *op)
|
2008-11-24 18:59:59 +00:00
|
|
|
{
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
ListBase *markers= context_get_markers(C);
|
2008-11-24 18:59:59 +00:00
|
|
|
TimeMarker *marker, *newmarker;
|
|
|
|
|
|
|
|
/* go through the list of markers, duplicate selected markers and add duplicated copies
|
|
|
|
* to the begining of the list (unselect original markers) */
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
for(marker= markers->first; marker; marker= marker->next) {
|
2008-11-24 18:59:59 +00:00
|
|
|
if(marker->flag & SELECT){
|
|
|
|
/* unselect selected marker */
|
|
|
|
marker->flag &= ~SELECT;
|
|
|
|
/* create and set up new marker */
|
|
|
|
newmarker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
|
|
|
|
newmarker->flag= SELECT;
|
|
|
|
newmarker->frame= marker->frame;
|
|
|
|
BLI_strncpy(newmarker->name, marker->name, sizeof(marker->name));
|
|
|
|
/* new marker is added to the begining of list */
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
BLI_addhead(markers, newmarker);
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
|
|
|
}
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int ed_marker_duplicate_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
ed_marker_duplicate_apply(C, op);
|
|
|
|
ed_marker_move_exec(C, op); /* assumes frs delta set */
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
|
|
|
ed_marker_duplicate_apply(C, op);
|
|
|
|
return ed_marker_move_invoke(C, op, evt);
|
|
|
|
}
|
|
|
|
|
2008-12-26 11:33:41 +00:00
|
|
|
static void MARKER_OT_duplicate(wmOperatorType *ot)
|
2008-11-24 18:59:59 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
ot->name= "Duplicate Time Marker";
|
2008-12-26 11:33:41 +00:00
|
|
|
ot->idname= "MARKER_OT_duplicate";
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
ot->exec= ed_marker_duplicate_exec;
|
|
|
|
ot->invoke= ed_marker_duplicate_invoke;
|
|
|
|
ot->modal= ed_marker_move_modal;
|
|
|
|
ot->poll= ED_operator_areaactive;
|
2008-11-24 18:59:59 +00:00
|
|
|
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
/* rna storage */
|
|
|
|
RNA_def_property(ot->srna, "frs", PROP_INT, PROP_NONE);
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
|
|
|
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
/* ************************** selection ************************************/
|
|
|
|
|
|
|
|
/* select/deselect TimeMarker at current frame */
|
2008-12-18 02:56:48 +00:00
|
|
|
static void select_timeline_marker_frame(ListBase *markers, int frame, unsigned char shift)
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
{
|
|
|
|
TimeMarker *marker;
|
|
|
|
int select=0;
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
for(marker= markers->first; marker; marker= marker->next) {
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
/* if Shift is not set, then deselect Markers */
|
|
|
|
if(!shift) marker->flag &= ~SELECT;
|
|
|
|
/* this way a not-shift select will allways give 1 selected marker */
|
|
|
|
if((marker->frame == frame) && (!select)) {
|
|
|
|
if(marker->flag & SELECT)
|
|
|
|
marker->flag &= ~SELECT;
|
|
|
|
else
|
|
|
|
marker->flag |= SELECT;
|
|
|
|
select = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-14 16:37:52 +00:00
|
|
|
int find_nearest_marker_time(ListBase *markers, float dx)
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
{
|
|
|
|
TimeMarker *marker, *nearest= NULL;
|
|
|
|
float dist, min_dist= 1000000;
|
|
|
|
|
|
|
|
for(marker= markers->first; marker; marker= marker->next) {
|
|
|
|
dist = ABS((float)marker->frame - dx);
|
|
|
|
if(dist < min_dist){
|
|
|
|
min_dist= dist;
|
|
|
|
nearest= marker;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nearest) return nearest->frame;
|
|
|
|
else return (int)floor(dx); /* hrmf? */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int ed_marker_select(bContext *C, wmEvent *evt, int extend)
|
|
|
|
{
|
|
|
|
ListBase *markers= context_get_markers(C);
|
2008-12-02 09:43:23 +00:00
|
|
|
View2D *v2d= UI_view2d_fromcontext(C);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
float viewx;
|
|
|
|
int x, y, cfra;
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
x= evt->x - CTX_wm_region(C)->winrct.xmin;
|
|
|
|
y= evt->y - CTX_wm_region(C)->winrct.ymin;
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
UI_view2d_region_to_view(v2d, x, y, &viewx, NULL);
|
|
|
|
|
|
|
|
cfra= find_nearest_marker_time(markers, viewx);
|
|
|
|
|
|
|
|
if (extend)
|
2008-12-18 02:56:48 +00:00
|
|
|
select_timeline_marker_frame(markers, cfra, 1);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
else
|
2008-12-18 02:56:48 +00:00
|
|
|
select_timeline_marker_frame(markers, cfra, 0);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
2009-01-01 18:05:12 +00:00
|
|
|
/* allowing tweaks */
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ed_marker_select_extend_invoke(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
|
|
|
return ed_marker_select(C, evt, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ed_marker_select_invoke(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
|
|
|
return ed_marker_select(C, evt, 0);
|
|
|
|
}
|
|
|
|
|
2008-12-26 11:33:41 +00:00
|
|
|
static void MARKER_OT_mouseselect(wmOperatorType *ot)
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Select Time Marker";
|
2008-12-26 11:33:41 +00:00
|
|
|
ot->idname= "MARKER_OT_mouseselect";
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->invoke= ed_marker_select_invoke;
|
|
|
|
ot->poll= ED_operator_areaactive;
|
|
|
|
}
|
|
|
|
|
2008-12-26 11:33:41 +00:00
|
|
|
static void MARKER_OT_mouseselect_extend(wmOperatorType *ot)
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Extend Select Time Marker";
|
2008-12-26 11:33:41 +00:00
|
|
|
ot->idname= "MARKER_OT_mouseselect_extend";
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->invoke= ed_marker_select_extend_invoke;
|
|
|
|
ot->poll= ED_operator_areaactive;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* *************************** border select markers **************** */
|
|
|
|
|
|
|
|
/* operator state vars used: (added by default WM callbacks)
|
|
|
|
xmin, ymin
|
|
|
|
xmax, ymax
|
|
|
|
|
|
|
|
customdata: the wmGesture pointer, with subwindow
|
|
|
|
|
|
|
|
callbacks:
|
|
|
|
|
|
|
|
exec() has to be filled in by user
|
|
|
|
|
|
|
|
invoke() default WM function
|
|
|
|
adds modal handler
|
|
|
|
|
|
|
|
modal() default WM function
|
|
|
|
accept modal events while doing it, calls exec(), handles ESC and border drawing
|
|
|
|
|
|
|
|
poll() has to be filled in by user for context
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2008-12-02 09:43:23 +00:00
|
|
|
View2D *v2d= UI_view2d_fromcontext(C);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
ListBase *markers= context_get_markers(C);
|
|
|
|
TimeMarker *marker;
|
|
|
|
float xminf, xmaxf, yminf, ymaxf;
|
|
|
|
int event_type= RNA_int_get(op->ptr, "event_type");
|
|
|
|
int xmin= RNA_int_get(op->ptr, "xmin");
|
|
|
|
int xmax= RNA_int_get(op->ptr, "xmax");
|
|
|
|
int ymin= RNA_int_get(op->ptr, "ymin");
|
|
|
|
int ymax= RNA_int_get(op->ptr, "ymax");
|
|
|
|
|
|
|
|
UI_view2d_region_to_view(v2d, xmin, ymin, &xminf, &yminf);
|
|
|
|
UI_view2d_region_to_view(v2d, xmax, ymax, &xmaxf, &ymaxf);
|
|
|
|
|
|
|
|
/* XXX disputable */
|
|
|
|
if(yminf > 30.0f || ymaxf < 0.0f)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* XXX marker context */
|
|
|
|
for(marker= markers->first; marker; marker= marker->next) {
|
|
|
|
if ((marker->frame > xminf) && (marker->frame <= xmaxf)) {
|
|
|
|
switch (event_type) {
|
|
|
|
case LEFTMOUSE:
|
|
|
|
if ((marker->flag & SELECT) == 0)
|
|
|
|
marker->flag |= SELECT;
|
|
|
|
break;
|
|
|
|
case RIGHTMOUSE:
|
|
|
|
if (marker->flag & SELECT)
|
|
|
|
marker->flag &= ~SELECT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-12-26 11:33:41 +00:00
|
|
|
static void MARKER_OT_border_select(wmOperatorType *ot)
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Marker Border select";
|
2008-12-26 11:33:41 +00:00
|
|
|
ot->idname= "MARKER_OT_border_select";
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= ed_marker_border_select_exec;
|
|
|
|
ot->invoke= WM_border_select_invoke;
|
|
|
|
ot->modal= WM_border_select_modal;
|
|
|
|
|
|
|
|
ot->poll= ED_operator_areaactive;
|
|
|
|
|
|
|
|
/* rna */
|
|
|
|
RNA_def_property(ot->srna, "event_type", PROP_INT, PROP_NONE);
|
|
|
|
RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE);
|
|
|
|
RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE);
|
|
|
|
RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE);
|
|
|
|
RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* *********************** (de)select all ***************** */
|
|
|
|
|
|
|
|
static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
ListBase *markers= context_get_markers(C);
|
|
|
|
TimeMarker *marker;
|
|
|
|
int select= RNA_int_get(op->ptr, "select_type");
|
|
|
|
|
|
|
|
if(RNA_int_get(op->ptr, "select_swap")) {
|
|
|
|
for(marker= markers->first; marker; marker= marker->next) {
|
|
|
|
if(marker->flag & SELECT)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(marker)
|
|
|
|
select= 0;
|
|
|
|
else
|
|
|
|
select= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(marker= markers->first; marker; marker= marker->next) {
|
|
|
|
if(select)
|
|
|
|
marker->flag |= SELECT;
|
|
|
|
else
|
|
|
|
marker->flag &= ~SELECT;
|
|
|
|
}
|
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ed_marker_select_all_invoke(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
|
|
|
RNA_int_set(op->ptr, "select_swap", 1);
|
|
|
|
|
|
|
|
return ed_marker_select_all_exec(C, op);
|
|
|
|
}
|
|
|
|
|
2008-12-26 11:33:41 +00:00
|
|
|
static void MARKER_OT_select_all(wmOperatorType *ot)
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "(De)select all markers";
|
2008-12-26 11:33:41 +00:00
|
|
|
ot->idname= "MARKER_OT_select_all";
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= ed_marker_select_all_exec;
|
|
|
|
ot->invoke= ed_marker_select_all_invoke;
|
|
|
|
ot->poll= ED_operator_areaactive;
|
|
|
|
|
|
|
|
/* rna */
|
|
|
|
RNA_def_property(ot->srna, "select_swap", PROP_INT, PROP_NONE);
|
|
|
|
RNA_def_property(ot->srna, "select_type", PROP_INT, PROP_NONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ******************************* remove marker ***************** */
|
|
|
|
|
|
|
|
/* remove selected TimeMarkers */
|
|
|
|
static int ed_marker_delete_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
ListBase *markers= context_get_markers(C);
|
|
|
|
TimeMarker *marker, *nmarker;
|
|
|
|
short changed= 0;
|
|
|
|
|
|
|
|
for(marker= markers->first; marker; marker= nmarker) {
|
|
|
|
nmarker= marker->next;
|
|
|
|
if(marker->flag & SELECT) {
|
|
|
|
BLI_freelinkN(markers, marker);
|
|
|
|
changed= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-16 18:42:12 +00:00
|
|
|
if(changed) {
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2008-12-16 18:42:12 +00:00
|
|
|
}
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-26 11:33:41 +00:00
|
|
|
static void MARKER_OT_delete(wmOperatorType *ot)
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Delete Markers";
|
2008-12-26 11:33:41 +00:00
|
|
|
ot->idname= "MARKER_OT_delete";
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2008-12-17 15:38:40 +00:00
|
|
|
ot->invoke= WM_operator_confirm;
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
ot->exec= ed_marker_delete_exec;
|
|
|
|
ot->poll= ED_operator_areaactive;
|
|
|
|
|
|
|
|
}
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
/* ************************** registration **********************************/
|
|
|
|
|
2008-12-17 15:38:40 +00:00
|
|
|
/* called in screen_ops.c:ED_operatortypes_screen() */
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
void ED_marker_operatortypes(void)
|
2008-11-24 18:59:59 +00:00
|
|
|
{
|
2008-12-26 11:33:41 +00:00
|
|
|
WM_operatortype_append(MARKER_OT_add);
|
|
|
|
WM_operatortype_append(MARKER_OT_move);
|
|
|
|
WM_operatortype_append(MARKER_OT_duplicate);
|
|
|
|
WM_operatortype_append(MARKER_OT_mouseselect);
|
|
|
|
WM_operatortype_append(MARKER_OT_mouseselect_extend);
|
|
|
|
WM_operatortype_append(MARKER_OT_border_select);
|
|
|
|
WM_operatortype_append(MARKER_OT_select_all);
|
|
|
|
WM_operatortype_append(MARKER_OT_delete);
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
|
|
|
|
2008-12-17 15:38:40 +00:00
|
|
|
/* called in screen_ops.c:ED_keymap_screen() */
|
|
|
|
void ED_marker_keymap(wmWindowManager *wm)
|
|
|
|
{
|
|
|
|
ListBase *keymap= WM_keymap_listbase(wm, "Markers", 0, 0);
|
|
|
|
|
2008-12-26 11:33:41 +00:00
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_add", MKEY, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_move", EVT_TWEAK_R, KM_ANY, 0, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_mouseselect", RIGHTMOUSE, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_mouseselect_extend", RIGHTMOUSE, KM_PRESS, KM_SHIFT, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_border_select", BKEY, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_select_all", AKEY, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_delete", XKEY, KM_PRESS, 0, 0);
|
2008-11-24 18:59:59 +00:00
|
|
|
|
2008-12-26 11:33:41 +00:00
|
|
|
WM_keymap_add_item(keymap, "MARKER_OT_move", GKEY, KM_PRESS, 0, 0);
|
2008-12-17 15:38:40 +00:00
|
|
|
|
|
|
|
/* generates event, in end to make select work */
|
|
|
|
WM_keymap_verify_item(keymap, "WM_OT_tweak_gesture", RIGHTMOUSE, KM_PRESS, 0, 0);
|
|
|
|
|
|
|
|
}
|