2008-11-24 18:59:59 +00:00
|
|
|
/**
|
2010-03-21 01:14:04 +00:00
|
|
|
* $Id$
|
2008-11-24 18:59:59 +00:00
|
|
|
*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-11-24 18:59:59 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
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"
|
2010-03-02 17:17:34 +00:00
|
|
|
#include "DNA_object_types.h"
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
2010-01-13 14:39:08 +00:00
|
|
|
#include "RNA_enum_types.h"
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2009-05-08 12:51:36 +00:00
|
|
|
#include "BKE_fcurve.h"
|
2010-01-13 14:39:08 +00:00
|
|
|
#include "BKE_main.h"
|
|
|
|
#include "BKE_report.h"
|
2010-03-02 16:57:39 +00:00
|
|
|
#include "BKE_scene.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"
|
|
|
|
|
|
|
|
#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"
|
|
|
|
#include "ED_util.h"
|
2010-02-20 20:29:09 +00:00
|
|
|
#include "ED_numinput.h"
|
2010-03-02 16:57:39 +00:00
|
|
|
#include "ED_object.h"
|
2010-03-30 11:38:06 +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
|
|
|
|
|
|
|
/* ************* 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
|
|
|
}
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
/* --------------------------------- */
|
|
|
|
|
2009-05-08 12:51:36 +00:00
|
|
|
/* Get the marker that is closest to this point */
|
2009-07-26 12:52:39 +00:00
|
|
|
/* XXX for select, the min_dist should be small */
|
2009-05-08 12:51:36 +00:00
|
|
|
TimeMarker *ED_markers_find_nearest_marker (ListBase *markers, float x)
|
|
|
|
{
|
|
|
|
TimeMarker *marker, *nearest=NULL;
|
|
|
|
float dist, min_dist= 1000000;
|
|
|
|
|
|
|
|
if (markers) {
|
|
|
|
for (marker= markers->first; marker; marker= marker->next) {
|
|
|
|
dist = ABS((float)marker->frame - x);
|
|
|
|
|
|
|
|
if (dist < min_dist) {
|
|
|
|
min_dist= dist;
|
|
|
|
nearest= marker;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nearest;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the time of the marker that occurs on a frame closest to the given time */
|
|
|
|
int ED_markers_find_nearest_marker_time (ListBase *markers, float x)
|
|
|
|
{
|
|
|
|
TimeMarker *nearest= ED_markers_find_nearest_marker(markers, x);
|
|
|
|
return (nearest) ? (nearest->frame) : (int)floor(x + 0.5f);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *last)
|
|
|
|
{
|
|
|
|
TimeMarker *marker;
|
|
|
|
float min, max;
|
|
|
|
int selcount = 0;
|
|
|
|
|
|
|
|
/* sanity check */
|
2009-12-30 10:21:45 +00:00
|
|
|
//printf("markers = %p - %p, %p \n", markers, markers->first, markers->last);
|
2009-05-08 12:51:36 +00:00
|
|
|
if (markers == NULL) {
|
|
|
|
*first = 0.0f;
|
|
|
|
*last = 0.0f;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (markers->first && markers->last) {
|
2009-05-09 02:37:12 +00:00
|
|
|
TimeMarker *fm= markers->first;
|
|
|
|
TimeMarker *lm= markers->last;
|
2009-05-08 12:51:36 +00:00
|
|
|
|
2009-05-09 02:37:12 +00:00
|
|
|
min= (float)fm->frame;
|
|
|
|
max= (float)lm->frame;
|
2009-05-08 12:51:36 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
*first = 0.0f;
|
|
|
|
*last = 0.0f;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* count how many markers are usable - see later */
|
|
|
|
if (sel) {
|
|
|
|
for (marker= markers->first; marker; marker= marker->next) {
|
|
|
|
if (marker->flag & SELECT)
|
|
|
|
selcount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
selcount= BLI_countlist(markers);
|
|
|
|
|
|
|
|
/* if only selected are to be considered, only consider the selected ones
|
|
|
|
* (optimisation for not searching list)
|
|
|
|
*/
|
|
|
|
if (selcount > 1) {
|
|
|
|
for (marker= markers->first; marker; marker= marker->next) {
|
|
|
|
if (sel) {
|
|
|
|
if (marker->flag & SELECT) {
|
|
|
|
if (marker->frame < min)
|
|
|
|
min= (float)marker->frame;
|
2009-05-09 02:37:12 +00:00
|
|
|
if (marker->frame > max)
|
2009-05-08 12:51:36 +00:00
|
|
|
max= (float)marker->frame;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (marker->frame < min)
|
2009-05-09 02:37:12 +00:00
|
|
|
min= (float)marker->frame;
|
|
|
|
if (marker->frame > max)
|
|
|
|
max= (float)marker->frame;
|
2009-05-08 12:51:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the min/max values */
|
|
|
|
*first= min;
|
|
|
|
*last= max;
|
|
|
|
}
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
/* --------------------------------- */
|
|
|
|
|
2009-05-08 12:51:36 +00:00
|
|
|
/* Adds a marker to list of cfra elems */
|
|
|
|
void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only_sel)
|
|
|
|
{
|
|
|
|
CfraElem *ce, *cen;
|
|
|
|
|
|
|
|
/* should this one only be considered if it is selected? */
|
|
|
|
if ((only_sel) && ((marker->flag & SELECT)==0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* insertion sort - try to find a previous cfra elem */
|
|
|
|
for (ce= lb->first; ce; ce= ce->next) {
|
|
|
|
if (ce->cfra == marker->frame) {
|
|
|
|
/* do because of double keys */
|
|
|
|
if (marker->flag & SELECT)
|
|
|
|
ce->sel= marker->flag;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (ce->cfra > marker->frame) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
cen= MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem");
|
|
|
|
if (ce) BLI_insertlinkbefore(lb, ce, cen);
|
|
|
|
else BLI_addtail(lb, cen);
|
|
|
|
|
|
|
|
cen->cfra= marker->frame;
|
|
|
|
cen->sel= marker->flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function makes a list of all the markers. The only_sel
|
|
|
|
* argument is used to specify whether only the selected markers
|
|
|
|
* are added.
|
|
|
|
*/
|
|
|
|
void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short only_sel)
|
|
|
|
{
|
|
|
|
TimeMarker *marker;
|
|
|
|
|
|
|
|
if (markers == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (marker= markers->first; marker; marker= marker->next)
|
|
|
|
add_marker_to_cfra_elem(lb, marker, only_sel);
|
|
|
|
}
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
/* --------------------------------- */
|
|
|
|
|
|
|
|
/* This function checks if there are any markers selected at all */
|
|
|
|
short ED_markers_has_selected(ListBase *markers)
|
|
|
|
{
|
|
|
|
TimeMarker *marker;
|
|
|
|
|
|
|
|
if (markers) {
|
|
|
|
for (marker = markers->first; marker; marker = marker->next) {
|
|
|
|
if (marker->flag & SELECT)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-11-24 18:59:59 +00:00
|
|
|
/* ************* Marker Drawing ************ */
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2009-05-08 10:50:32 +00:00
|
|
|
glScalef(1.0f/xscale, 1.0f, 1.0f);
|
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 */
|
2009-12-16 19:49:33 +00:00
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if ((marker->camera) || (flag & DRAW_MARKERS_LINES))
|
2009-12-16 19:49:33 +00:00
|
|
|
#else
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (flag & DRAW_MARKERS_LINES)
|
2009-12-16 19:49:33 +00:00
|
|
|
#endif
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
{
|
2008-11-24 18:59:59 +00:00
|
|
|
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);
|
2009-12-30 10:21:45 +00:00
|
|
|
|
2008-11-24 18:59:59 +00:00
|
|
|
glBegin(GL_LINES);
|
2009-05-08 10:50:32 +00:00
|
|
|
glVertex2f((xpos*xscale)+0.5f, 12.0f);
|
2009-12-30 10:21:45 +00:00
|
|
|
glVertex2f((xpos*xscale)+0.5f, (v2d->cur.ymax+12.0f)*yscale);
|
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;
|
|
|
|
}
|
|
|
|
|
2009-05-08 10:50:32 +00:00
|
|
|
UI_icon_draw(xpos*xscale-5.0f, 16.0f, 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]) {
|
2009-04-10 16:30:28 +00:00
|
|
|
float x, y;
|
|
|
|
|
2009-05-08 10:50:32 +00:00
|
|
|
if (marker->flag & SELECT) {
|
2008-12-02 09:43:23 +00:00
|
|
|
UI_ThemeColor(TH_TEXT_HI);
|
2009-05-08 10:50:32 +00:00
|
|
|
x= xpos*xscale + 4.0f;
|
|
|
|
y= (ypixels <= 39.0f)? (ypixels-10.0f) : 29.0f;
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
|
|
|
else {
|
2008-12-02 09:43:23 +00:00
|
|
|
UI_ThemeColor(TH_TEXT);
|
2009-04-10 16:30:28 +00:00
|
|
|
if((marker->frame <= cfra) && (marker->frame+5 > cfra)) {
|
2009-05-08 10:50:32 +00:00
|
|
|
x= xpos*xscale + 4.0f;
|
|
|
|
y= (ypixels <= 39.0f)? (ypixels - 10.0f) : 29.0f;
|
2009-04-10 16:30:28 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-05-08 10:50:32 +00:00
|
|
|
x= xpos*xscale + 4.0f;
|
|
|
|
y= 17.0f;
|
2009-04-10 16:30:28 +00:00
|
|
|
}
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
2010-03-02 17:17:34 +00:00
|
|
|
|
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
|
|
|
if(marker->camera && marker->camera->restrictflag & OB_RESTRICT_RENDER) {
|
|
|
|
float col[4];
|
|
|
|
glGetFloatv(GL_CURRENT_COLOR, col);
|
|
|
|
col[3]= 0.4;
|
|
|
|
glColor4fv(col);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-04-10 16:30:28 +00:00
|
|
|
UI_DrawString(x, y, marker->name);
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
2009-05-08 10:50:32 +00:00
|
|
|
|
|
|
|
glScalef(xscale, 1.0f, 1.0f);
|
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;
|
|
|
|
|
2009-05-08 10:50:32 +00:00
|
|
|
if (markers == NULL)
|
2009-01-26 08:34:40 +00:00
|
|
|
return;
|
|
|
|
|
2008-11-24 18:59:59 +00:00
|
|
|
/* 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) {
|
2009-05-08 10:50:32 +00:00
|
|
|
if ((marker->flag & SELECT) == 0)
|
|
|
|
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) {
|
2009-05-08 10:50:32 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
/* ************************ Marker Wrappers API ********************* */
|
|
|
|
/* These wrappers allow marker operators to function within the confines
|
|
|
|
* of standard animation editors, such that they can coexist with the
|
|
|
|
* primary operations of those editors.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* maximum y-axis value (in region screen-space) that marker events should still be accepted for */
|
|
|
|
#define ANIMEDIT_MARKER_YAXIS_MAX 30
|
|
|
|
|
|
|
|
/* ------------------------ */
|
|
|
|
|
|
|
|
/* special poll() which checks if there are selected markers first */
|
|
|
|
static int ed_markers_poll_selected_markers(bContext *C)
|
|
|
|
{
|
|
|
|
ListBase *markers = context_get_markers(C);
|
|
|
|
|
|
|
|
/* first things first: markers can only exist in timeline views */
|
|
|
|
if (ED_operator_animview_active(C) == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* check if some marker is selected */
|
|
|
|
return ED_markers_has_selected(markers);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------ */
|
|
|
|
|
|
|
|
/* Second-tier invoke() callback that performs context validation before running the
|
|
|
|
* "custom"/third-tier invoke() callback supplied as the last arg (which would normally
|
|
|
|
* be the operator's invoke() callback elsewhere)
|
|
|
|
*
|
|
|
|
* < invoke_func: (fn(bContext*, wmOperator*, wmEvent*)=int) "standard" invoke function
|
|
|
|
* that operator would otherwise have used. If NULL, the operator's standard
|
|
|
|
* exec() callback will be called instead in the appropriate places.
|
|
|
|
*/
|
|
|
|
static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent *evt,
|
|
|
|
int (*invoke_func)(bContext*,wmOperator*,wmEvent*))
|
|
|
|
{
|
|
|
|
ScrArea *sa = CTX_wm_area(C);
|
|
|
|
int retval = OPERATOR_PASS_THROUGH;
|
|
|
|
|
|
|
|
/* only timeline view doesn't need calling-location validation as it's the only dedicated view */
|
|
|
|
if (sa->spacetype != SPACE_TIME) {
|
|
|
|
/* restrict y-values to within ANIMEDIT_MARKER_YAXIS_MAX of the view's vertical extents, including scrollbars */
|
|
|
|
if (evt->mval[1] > ANIMEDIT_MARKER_YAXIS_MAX) {
|
|
|
|
/* not ok... "pass-through" to let normal editor's operators have a chance at tackling this event... */
|
|
|
|
//printf("MARKER-WRAPPER-DEBUG: event mval[1] = %d, so over accepted tolerance\n", evt->mval[1]);
|
|
|
|
return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* allow operator to run now */
|
|
|
|
if (invoke_func)
|
|
|
|
retval = invoke_func(C, op, evt);
|
|
|
|
else if (op->type->exec)
|
|
|
|
retval = op->type->exec(C, op);
|
|
|
|
else
|
|
|
|
BKE_report(op->reports, RPT_ERROR, "Programming error: operator doesn't actually have code to do anything!");
|
|
|
|
|
|
|
|
/* return status modifications - for now, make this spacetype dependent as above */
|
|
|
|
if (sa->spacetype != SPACE_TIME) {
|
|
|
|
/* unless successful, must add "pass-through" to let normal operator's have a chance at tackling this event */
|
|
|
|
if (retval != OPERATOR_FINISHED)
|
|
|
|
retval |= OPERATOR_PASS_THROUGH;
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* standard wrapper - first-tier invoke() callback to be directly assigned to operator typedata
|
|
|
|
* for operators which don't need any special invoke calls. Any operators with special invoke calls
|
|
|
|
* though will need to implement their own wrapper which calls the second-tier callback themselves
|
|
|
|
* (passing through the custom invoke function they use)
|
|
|
|
*/
|
|
|
|
static int ed_markers_opwrap_invoke(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
|
|
|
return ed_markers_opwrap_invoke_custom(C, op, evt, 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
|
|
|
/* ************************** add markers *************************** */
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
/* add TimeMarker at curent frame */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int ed_marker_add(bContext *C, wmOperator *UNUSED(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;
|
2008-12-18 02:56:48 +00:00
|
|
|
int frame= CTX_data_scene(C)->r.cfra;
|
2008-11-24 18:59:59 +00:00
|
|
|
|
2009-05-08 10:50:32 +00:00
|
|
|
if (markers == NULL)
|
2009-01-26 08:34:40 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
2008-11-24 18:59:59 +00:00
|
|
|
/* two markers can't be at the same place */
|
2009-05-08 10:50:32 +00:00
|
|
|
for (marker= markers->first; marker; marker= marker->next) {
|
|
|
|
if (marker->frame == frame)
|
2008-11-24 18:59:59 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2009-05-08 10:50:32 +00:00
|
|
|
}
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
/* 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;
|
2009-12-30 10:21:45 +00:00
|
|
|
sprintf(marker->name, "F_%02d", 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);
|
2010-09-18 08:49:03 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
2008-11-24 18:59:59 +00:00
|
|
|
|
|
|
|
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";
|
2010-02-10 21:15:44 +00:00
|
|
|
ot->description= "Add a new 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;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->invoke = ed_markers_opwrap_invoke;
|
2010-11-04 15:59:09 +00:00
|
|
|
ot->poll= ED_operator_animview_active;
|
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-31 19:40:40 +00:00
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
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
|
|
|
|
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
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
cancel() to escape from modal
|
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
|
|
|
|
|
|
|
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;
|
2010-02-20 20:29:09 +00:00
|
|
|
NumInput num;
|
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;
|
|
|
|
|
|
|
|
/* 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;
|
2009-01-26 08:34:40 +00:00
|
|
|
|
|
|
|
if(markers == NULL) return 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
|
|
|
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");
|
2010-02-20 20:29:09 +00:00
|
|
|
|
|
|
|
initNumInput(&mm->num);
|
|
|
|
mm->num.idx_max = 0; /* one axis */
|
|
|
|
mm->num.flag |= NUM_NO_FRACTION;
|
2010-02-22 23:25:34 +00:00
|
|
|
mm->num.increment = 1.0f;
|
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 (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;
|
|
|
|
|
2009-05-08 10:50:32 +00:00
|
|
|
/* free data */
|
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
|
|
|
MEM_freeN(mm->oldframe);
|
|
|
|
MEM_freeN(op->customdata);
|
|
|
|
op->customdata= NULL;
|
2009-05-08 10:50:32 +00:00
|
|
|
|
|
|
|
/* clear custom header prints */
|
|
|
|
ED_area_headerprint(CTX_wm_area(C), 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
|
|
|
}
|
|
|
|
|
|
|
|
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 */
|
2009-09-18 12:43:36 +00:00
|
|
|
WM_event_add_modal_handler(C, 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 */
|
2009-01-16 23:53:11 +00:00
|
|
|
RNA_int_set(op->ptr, "frames", 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
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
|
|
|
return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_move_invoke);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* note, init has to be called succesfully */
|
2010-10-16 14:32:17 +00:00
|
|
|
static void ed_marker_move_apply(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
|
|
|
{
|
|
|
|
MarkerMove *mm= op->customdata;
|
|
|
|
TimeMarker *marker;
|
|
|
|
int a, offs;
|
|
|
|
|
2009-01-16 23:53:11 +00:00
|
|
|
offs= RNA_int_get(op->ptr, "frames");
|
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 (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)
|
|
|
|
{
|
2009-01-16 23:53:11 +00:00
|
|
|
RNA_int_set(op->ptr, "frames", 0);
|
2010-10-16 14:32:17 +00:00
|
|
|
ed_marker_move_apply(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
|
|
|
ed_marker_move_exit(C, op);
|
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2010-09-18 08:49:03 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|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;
|
2009-05-08 10:50:32 +00:00
|
|
|
|
2010-02-20 20:29:09 +00:00
|
|
|
case RETKEY:
|
|
|
|
case PADENTER:
|
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
|
|
|
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);
|
2010-09-18 08:49:03 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|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:
|
2010-02-20 20:29:09 +00:00
|
|
|
if(hasNumInput(&mm->num))
|
|
|
|
break;
|
|
|
|
|
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
|
|
|
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;
|
2009-01-16 23:53:11 +00:00
|
|
|
RNA_int_set(op->ptr, "frames", offs);
|
2010-10-16 14:32:17 +00:00
|
|
|
ed_marker_move_apply(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
|
|
|
|
|
|
|
/* 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) {
|
2009-05-08 10:50:32 +00:00
|
|
|
SpaceAction *saction= (SpaceAction *)mm->slink;
|
|
|
|
if (saction->flag & SACTION_DRAWTIME)
|
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
|
|
|
sprintf(str, "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
|
|
|
|
else
|
|
|
|
sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs));
|
|
|
|
}
|
|
|
|
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));
|
|
|
|
}
|
2009-05-08 10:50:32 +00:00
|
|
|
else if (mm->slink->spacetype == SPACE_ACTION) {
|
|
|
|
SpaceAction *saction= (SpaceAction *)mm->slink;
|
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 (saction->flag & SACTION_DRAWTIME)
|
|
|
|
sprintf(str, "Marker offset %.2f ", FRA2TIME(offs));
|
|
|
|
else
|
|
|
|
sprintf(str, "Marker offset %.2f ", (double)(offs));
|
|
|
|
}
|
|
|
|
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);
|
2010-09-18 08:49:03 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
2009-05-08 10:50:32 +00:00
|
|
|
ED_area_headerprint(CTX_wm_area(C), str);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-20 20:29:09 +00:00
|
|
|
if(evt->val==KM_PRESS) {
|
|
|
|
float vec[3];
|
|
|
|
char str_tx[256];
|
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
if (handleNumInput(&mm->num, evt))
|
2010-02-20 20:29:09 +00:00
|
|
|
{
|
|
|
|
applyNumInput(&mm->num, vec);
|
|
|
|
outputNumInput(&mm->num, str_tx);
|
|
|
|
|
|
|
|
RNA_int_set(op->ptr, "frames", vec[0]);
|
2010-10-16 14:32:17 +00:00
|
|
|
ed_marker_move_apply(op);
|
2010-02-20 20:29:09 +00:00
|
|
|
// ed_marker_header_update(C, op, str, (int)vec[0]);
|
|
|
|
// strcat(str, str_tx);
|
|
|
|
sprintf(str, "Marker offset %s", str_tx);
|
|
|
|
ED_area_headerprint(CTX_wm_area(C), str);
|
|
|
|
|
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2010-09-18 08:49:03 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
2010-02-20 20:29:09 +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_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ed_marker_move_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
if(ed_marker_move_init(C, op)) {
|
2010-10-16 14:32:17 +00:00
|
|
|
ed_marker_move_apply(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
|
|
|
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";
|
2010-02-10 21:15:44 +00:00
|
|
|
ot->description= "Move selected time marker(s)";
|
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;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->invoke= ed_marker_move_invoke_wrapper;
|
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->modal= ed_marker_move_modal;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->poll= ed_markers_poll_selected_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
|
|
|
|
2009-01-31 19:40:40 +00:00
|
|
|
/* flags */
|
2010-02-08 15:28:28 +00:00
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
|
2009-01-31 19:40:40 +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 */
|
2009-01-16 23:53:11 +00:00
|
|
|
RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** 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 */
|
2010-10-16 14:32:17 +00:00
|
|
|
static void ed_marker_duplicate_apply(bContext *C)
|
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;
|
|
|
|
|
2009-05-08 10:50:32 +00:00
|
|
|
if (markers == NULL)
|
|
|
|
return;
|
2009-01-26 08:34:40 +00:00
|
|
|
|
2008-11-24 18:59:59 +00:00
|
|
|
/* go through the list of markers, duplicate selected markers and add duplicated copies
|
2009-05-08 10:50:32 +00:00
|
|
|
* to the begining of the list (unselect original markers)
|
|
|
|
*/
|
|
|
|
for (marker= markers->first; marker; marker= marker->next) {
|
|
|
|
if (marker->flag & SELECT) {
|
2008-11-24 18:59:59 +00:00
|
|
|
/* unselect selected marker */
|
|
|
|
marker->flag &= ~SELECT;
|
2009-05-08 10:50:32 +00:00
|
|
|
|
2008-11-24 18:59:59 +00:00
|
|
|
/* 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));
|
2009-05-08 10:50:32 +00:00
|
|
|
|
2009-12-16 19:49:33 +00:00
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
|
|
|
newmarker->camera= marker->camera;
|
|
|
|
#endif
|
|
|
|
|
2008-11-24 18:59:59 +00:00
|
|
|
/* 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)
|
|
|
|
{
|
2010-10-16 14:32:17 +00:00
|
|
|
ed_marker_duplicate_apply(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
|
|
|
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)
|
|
|
|
{
|
2010-10-16 14:32:17 +00:00
|
|
|
ed_marker_duplicate_apply(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
|
|
|
return ed_marker_move_invoke(C, op, evt);
|
|
|
|
}
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
static int ed_marker_duplicate_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
|
|
|
return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_duplicate_invoke);
|
|
|
|
}
|
|
|
|
|
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";
|
2010-02-10 21:15:44 +00:00
|
|
|
ot->description= "Duplicate selected time marker(s)";
|
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;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->invoke= ed_marker_duplicate_invoke_wrapper;
|
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->modal= ed_marker_move_modal;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->poll= ed_markers_poll_selected_markers;
|
2008-11-24 18:59:59 +00:00
|
|
|
|
2009-01-31 19:40:40 +00:00
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
|
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 */
|
2009-01-16 23:53:11 +00:00
|
|
|
RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
|
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;
|
|
|
|
|
2009-05-08 10:50:32 +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 */
|
2009-05-08 10:50:32 +00:00
|
|
|
if (!shift) marker->flag &= ~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
|
|
|
/* this way a not-shift select will allways give 1 selected marker */
|
2009-05-08 10:50:32 +00:00
|
|
|
if ((marker->frame == frame) && (!select)) {
|
|
|
|
if (marker->flag & 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
|
|
|
marker->flag &= ~SELECT;
|
|
|
|
else
|
|
|
|
marker->flag |= SELECT;
|
|
|
|
select = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-02 16:57:39 +00:00
|
|
|
static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
|
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);
|
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;
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (markers == NULL)
|
2009-01-26 08:34:40 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
|
|
|
|
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);
|
|
|
|
|
2009-05-08 12:51:36 +00:00
|
|
|
cfra= ED_markers_find_nearest_marker_time(markers, viewx);
|
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 (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
|
|
|
|
2010-03-02 16:57:39 +00:00
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (camera) {
|
2010-03-02 16:57:39 +00:00
|
|
|
Scene *scene= CTX_data_scene(C);
|
2010-03-03 11:48:03 +00:00
|
|
|
Base *base;
|
2010-03-02 16:57:39 +00:00
|
|
|
TimeMarker *marker;
|
2010-03-03 18:49:26 +00:00
|
|
|
int sel= 0;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
|
2010-03-02 16:57:39 +00:00
|
|
|
if (!extend)
|
|
|
|
scene_deselect_all(scene);
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
|
2010-03-02 16:57:39 +00:00
|
|
|
for (marker= markers->first; marker; marker= marker->next) {
|
|
|
|
if(marker->frame==cfra) {
|
|
|
|
sel= (marker->flag & SELECT);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
|
2010-03-02 16:57:39 +00:00
|
|
|
for (marker= markers->first; marker; marker= marker->next) {
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (marker->camera) {
|
|
|
|
if (marker->frame==cfra) {
|
2010-03-03 11:48:03 +00:00
|
|
|
base= object_in_scene(marker->camera, scene);
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (base) {
|
2010-03-03 11:48:03 +00:00
|
|
|
ED_base_object_select(base, sel);
|
|
|
|
if(sel)
|
|
|
|
ED_base_object_activate(C, base);
|
|
|
|
}
|
2010-03-02 16:57:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
|
2010-03-02 16:57:39 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2010-09-18 08:49:03 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|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_invoke(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
2009-03-29 02:15:13 +00:00
|
|
|
short extend= RNA_boolean_get(op->ptr, "extend");
|
2010-03-02 16:57:39 +00:00
|
|
|
short camera= 0;
|
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
|
|
|
camera= RNA_boolean_get(op->ptr, "camera");
|
|
|
|
#endif
|
|
|
|
return ed_marker_select(C, evt, extend, camera);
|
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
|
|
|
}
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
static int ed_marker_select_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
|
|
|
return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_select_invoke);
|
|
|
|
}
|
|
|
|
|
2009-03-29 02:15:13 +00:00
|
|
|
static void MARKER_OT_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= "Select Time Marker";
|
2010-02-10 21:15:44 +00:00
|
|
|
ot->description= "Select time marker(s)";
|
2009-03-29 02:15:13 +00:00
|
|
|
ot->idname= "MARKER_OT_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 */
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->invoke= ed_marker_select_invoke_wrapper;
|
2010-11-04 15:59:09 +00:00
|
|
|
ot->poll= ED_operator_animview_active;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
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-03-29 02:15:13 +00:00
|
|
|
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "extend the selection");
|
2010-03-02 16:57:39 +00:00
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
|
|
|
RNA_def_boolean(ot->srna, "camera", 0, "Camera", "Select the camera");
|
|
|
|
#endif
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/* *************************** 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;
|
2009-11-06 22:51:08 +00:00
|
|
|
int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
|
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
|
|
|
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);
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (markers == NULL)
|
2009-01-26 08:34:40 +00:00
|
|
|
return 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
|
|
|
/* XXX marker context */
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +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 ((marker->frame > xminf) && (marker->frame <= xmaxf)) {
|
2009-11-06 22:51:08 +00:00
|
|
|
switch (gesture_mode) {
|
|
|
|
case GESTURE_MODAL_SELECT:
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
marker->flag |= 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
|
|
|
break;
|
2009-11-06 22:51:08 +00:00
|
|
|
case GESTURE_MODAL_DESELECT:
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
marker->flag &= ~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
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2010-09-18 08:49:03 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|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;
|
|
|
|
}
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
|
|
|
return ed_markers_opwrap_invoke_custom(C, op, evt, WM_border_select_invoke);
|
|
|
|
}
|
|
|
|
|
2009-03-29 02:15:13 +00:00
|
|
|
static void MARKER_OT_select_border(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";
|
2010-02-10 21:15:44 +00:00
|
|
|
ot->description= "Select all time markers using border selection";
|
2009-03-29 02:15:13 +00:00
|
|
|
ot->idname= "MARKER_OT_select_border";
|
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;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->invoke= ed_marker_select_border_invoke_wrapper;
|
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->modal= WM_border_select_modal;
|
|
|
|
|
2010-11-04 15:59:09 +00:00
|
|
|
ot->poll= ED_operator_animview_active;
|
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-31 19:40:40 +00:00
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
|
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 */
|
2009-11-06 22:51:08 +00:00
|
|
|
WM_operator_properties_gesture_border(ot, FALSE);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/* *********************** (de)select all ***************** */
|
|
|
|
|
|
|
|
static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
ListBase *markers= context_get_markers(C);
|
|
|
|
TimeMarker *marker;
|
2009-11-29 22:16:29 +00:00
|
|
|
int action = RNA_enum_get(op->ptr, "action");
|
2009-01-26 08:34:40 +00:00
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (markers == NULL)
|
2009-01-26 08:34:40 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2009-11-29 22:16:29 +00:00
|
|
|
|
|
|
|
if (action == SEL_TOGGLE) {
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
action = (ED_markers_has_selected(markers)) ? SEL_DESELECT : SEL_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
|
|
|
}
|
|
|
|
|
|
|
|
for(marker= markers->first; marker; marker= marker->next) {
|
2009-11-29 22:16:29 +00:00
|
|
|
switch (action) {
|
|
|
|
case SEL_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
|
|
|
marker->flag |= SELECT;
|
2009-11-29 22:16:29 +00:00
|
|
|
break;
|
|
|
|
case SEL_DESELECT:
|
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
|
|
|
marker->flag &= ~SELECT;
|
2009-11-29 22:16:29 +00:00
|
|
|
break;
|
|
|
|
case SEL_INVERT:
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
marker->flag ^= SELECT;
|
2009-11-29 22:16:29 +00:00
|
|
|
break;
|
|
|
|
}
|
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);
|
2010-09-18 08:49:03 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|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;
|
|
|
|
}
|
|
|
|
|
2009-11-29 22:16:29 +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";
|
2010-02-10 21:15:44 +00:00
|
|
|
ot->description= "Change selection of all time markers";
|
2009-11-29 22:16:29 +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;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->invoke = ed_markers_opwrap_invoke;
|
2010-11-04 15:59:09 +00:00
|
|
|
ot->poll= ED_operator_animview_active;
|
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-31 19:40:40 +00:00
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
|
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 */
|
2009-11-29 22:16:29 +00:00
|
|
|
WM_operator_properties_select_all(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
|
|
|
}
|
|
|
|
|
|
|
|
/* ******************************* remove marker ***************** */
|
|
|
|
|
|
|
|
/* remove selected TimeMarkers */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(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);
|
|
|
|
TimeMarker *marker, *nmarker;
|
|
|
|
short changed= 0;
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (markers == NULL)
|
2009-01-26 08:34:40 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
for (marker= markers->first; marker; marker= nmarker) {
|
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
|
|
|
nmarker= marker->next;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (marker->flag & 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
|
|
|
BLI_freelinkN(markers, marker);
|
|
|
|
changed= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-18 08:49:03 +00:00
|
|
|
if (changed) {
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2010-09-18 08:49:03 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
|
|
|
}
|
2009-05-08 12:51:36 +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;
|
|
|
|
}
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
static int ed_marker_delete_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
|
|
|
|
{
|
|
|
|
// XXX: must we keep these confirmations?
|
|
|
|
return ed_markers_opwrap_invoke_custom(C, op, evt, 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
|
|
|
|
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";
|
2010-02-10 21:15:44 +00:00
|
|
|
ot->description= "Delete selected time marker(s)";
|
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 */
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->invoke= ed_marker_delete_invoke_wrapper;
|
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;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->poll= ed_markers_poll_selected_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
|
|
|
|
2009-01-31 19:40:40 +00:00
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
|
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
|
|
|
|
2011-01-05 11:15:57 +00:00
|
|
|
/* **************** make links to scene ***************** */
|
|
|
|
|
2010-01-13 14:39:08 +00:00
|
|
|
static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
ListBase *markers= context_get_markers(C);
|
2010-05-05 15:41:38 +00:00
|
|
|
Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
|
2010-01-13 14:39:08 +00:00
|
|
|
TimeMarker *marker, *marker_new;
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (scene_to==NULL) {
|
2010-01-13 14:39:08 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Scene not found");
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (scene_to == CTX_data_scene(C)) {
|
2011-01-05 11:15:57 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Can't re-link markers into the same scene");
|
2010-01-13 14:39:08 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy markers */
|
|
|
|
for (marker= markers->first; marker; marker= marker->next) {
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
if (marker->flag & SELECT) {
|
2010-01-13 14:39:08 +00:00
|
|
|
marker_new= MEM_dupallocN(marker);
|
2011-01-05 11:15:57 +00:00
|
|
|
marker_new->prev= marker_new->next = NULL;
|
|
|
|
|
2010-01-13 14:39:08 +00:00
|
|
|
BLI_addtail(&scene_to->markers, marker_new);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void MARKER_OT_make_links_scene(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Make Links to Scene";
|
2011-01-05 11:15:57 +00:00
|
|
|
ot->description= "Copy selected markers to another scene";
|
2010-01-13 14:39:08 +00:00
|
|
|
ot->idname= "MARKER_OT_make_links_scene";
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= ed_marker_make_links_scene_exec;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->invoke = ed_markers_opwrap_invoke;
|
|
|
|
ot->poll= ed_markers_poll_selected_markers;
|
2010-01-13 14:39:08 +00:00
|
|
|
|
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
|
|
|
|
/* properties */
|
2010-05-05 15:41:38 +00:00
|
|
|
prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
|
2010-01-13 14:39:08 +00:00
|
|
|
RNA_def_enum_funcs(prop, RNA_scene_itemf);
|
2010-05-06 11:47:10 +00:00
|
|
|
ot->prop= prop;
|
2010-01-13 14:39:08 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-12-16 19:49:33 +00:00
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
|
|
|
/* ******************************* camera bind marker ***************** */
|
|
|
|
|
|
|
|
/* remove selected TimeMarkers */
|
2010-10-15 01:36:14 +00:00
|
|
|
static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-12-16 19:49:33 +00:00
|
|
|
{
|
|
|
|
Scene *scene= CTX_data_scene(C);
|
|
|
|
ListBase *markers= context_get_markers(C);
|
|
|
|
TimeMarker *marker;
|
|
|
|
short changed= 0;
|
|
|
|
|
|
|
|
if(markers == NULL)
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
for(marker= markers->first; marker; marker= marker->next) {
|
|
|
|
if(marker->flag & SELECT) {
|
|
|
|
marker->camera= scene->camera;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-18 08:49:03 +00:00
|
|
|
if (changed) {
|
2009-12-16 19:49:33 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
2010-09-18 08:49:03 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
|
|
|
|
}
|
2009-12-16 19:49:33 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void MARKER_OT_camera_bind(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Bind Camera to Markers";
|
2010-02-10 21:15:44 +00:00
|
|
|
ot->description= "Bind the active camera to selected markers(s)";
|
2009-12-16 19:49:33 +00:00
|
|
|
ot->idname= "MARKER_OT_camera_bind";
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= ed_marker_camera_bind_exec;
|
== Long-Standing 2.5 Todo - Markers fully working again in all
animation editors (DopeSheet, Graph Editor, NLA, Sequencer) ==
=== Usage Notes ===
In animation editors, marker operators will only be considered while
the mouse is hovering near/over the horizontal scrollbar (i.e. where
the markers usually appear). That means, in order to do something to
the markers, just position your cursor in line with the row of
markers, and then use the same hotkeys you'd use in the TimeLine (so,
unlike in 2.4x, no more need to hold down extra modifier keys for this
case). In the TimeLine, nothing changes, so you don't need to worry
about mouse placement there :)
=== Technical Details ===
Since early 2.5 versions, this functionality has been disabled, as the
markers were always getting evaluated first, and hence "swallowing"
all the events before the editor's own keymaps could access them.
In order to get this working again, I've had to give every marker
operator a "wrapper" invoke callback which performs some checking to
ensure that the mouse is close to the markers (vertically) before the
operator will try to be run. This wrapper also makes sure that once
the operator has finished running, that if it didn't manage to do
anything, then the editor's own keymaps get to have a go.
The vertical tolerance used is currently 30 pixels (as was used for
the borderselect operator).
=== Other Assorted Changes ===
* Gave marker operators dependent on having selected markers to
operate on suitable poll() callbacks. These new poll callbacks ensure
that there are selected markers for the operator to operate on,
further cutting down the number of places where markers may override
standard hotkeys (and avoiding calls to the wrappers too)
* Simplified some of the selection code
* Made some formatting tweaks for consistency, and in one case so that
my text editor's function-list display doesn't get confused
2011-01-06 02:35:12 +00:00
|
|
|
ot->invoke = ed_markers_opwrap_invoke;
|
|
|
|
ot->poll= ed_markers_poll_selected_markers;
|
2009-12-16 19:49:33 +00:00
|
|
|
|
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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() */
|
2009-07-02 19:41:31 +00:00
|
|
|
void ED_operatortypes_marker(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);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(MARKER_OT_select);
|
|
|
|
WM_operatortype_append(MARKER_OT_select_border);
|
2009-11-29 22:16:29 +00:00
|
|
|
WM_operatortype_append(MARKER_OT_select_all);
|
2008-12-26 11:33:41 +00:00
|
|
|
WM_operatortype_append(MARKER_OT_delete);
|
2010-01-13 14:39:08 +00:00
|
|
|
WM_operatortype_append(MARKER_OT_make_links_scene);
|
2009-12-16 19:49:33 +00:00
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
|
|
|
WM_operatortype_append(MARKER_OT_camera_bind);
|
|
|
|
#endif
|
2008-11-24 18:59:59 +00:00
|
|
|
}
|
|
|
|
|
2008-12-17 15:38:40 +00:00
|
|
|
/* called in screen_ops.c:ED_keymap_screen() */
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
void ED_marker_keymap(wmKeyConfig *keyconf)
|
2008-12-17 15:38:40 +00:00
|
|
|
{
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
wmKeyMap *keymap= WM_keymap_find(keyconf, "Markers", 0, 0);
|
2010-03-02 16:57:39 +00:00
|
|
|
wmKeyMapItem *kmi;
|
2008-12-17 15:38:40 +00:00
|
|
|
|
2008-12-26 11:33:41 +00:00
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_add", MKEY, KM_PRESS, 0, 0);
|
2.5
- Edit mesh: Add ctrl+click add vertex or extrude.
I've made it not move the 3d cursor in that case.
Also found out tweak events conflicted with existing
keymap definitions; on tweak failure (= no mousemove)
it now passes on the mouse event as 'mouse down' for
the remaining keymaps to check.
These then actually respond to mouse-up instead of down...
The location in the keymaps where tweaks get generated
remains important. Examples:
1 - 'select' mouse-handler, operator return pass-through
2 - tweak handler checks, and makes tweak event
3 - grabber responds to tweak event
1 - ctrl+mouse tweak handler checks, makes tweak event,
or passes event on
2 - if tweak event, it runs lasso
3 - else when passed on, ctrl+click extrude happens
In the first case, select works on mouse-down, immediate.
In the second case, extrude happens on mouse-release, even
though the keymap defined mouse-press.
This will make designing nice balanced keymaps still not
simple; especially because you can't tell operators to
pass on the key... although we can add the convention that
select-mouse operators always pass on to enable tweaks.
Still a good reason to wait with custom keymaps
when this is fully settled!
2009-01-30 18:18:41 +00:00
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_move", EVT_TWEAK_S, KM_ANY, 0, 0);
|
2008-12-26 11:33:41 +00:00
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
|
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1);
|
2010-03-02 16:57:39 +00:00
|
|
|
|
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
|
|
|
kmi= WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "camera", 1);
|
|
|
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
|
|
|
|
RNA_boolean_set(kmi->ptr, "extend", 1);
|
|
|
|
RNA_boolean_set(kmi->ptr, "camera", 1);
|
|
|
|
#endif
|
|
|
|
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_select_border", BKEY, KM_PRESS, 0, 0);
|
2009-11-29 22:16:29 +00:00
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_select_all", AKEY, KM_PRESS, 0, 0);
|
2008-12-26 11:33:41 +00:00
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_delete", XKEY, KM_PRESS, 0, 0);
|
2009-09-28 12:33:52 +00:00
|
|
|
WM_keymap_verify_item(keymap, "MARKER_OT_delete", DELKEY, 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);
|
2009-12-16 19:49:33 +00:00
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
2009-12-18 13:28:03 +00:00
|
|
|
WM_keymap_add_item(keymap, "MARKER_OT_camera_bind", BKEY, KM_PRESS, KM_CTRL, 0);
|
2009-12-16 19:49:33 +00:00
|
|
|
#endif
|
2008-12-17 15:38:40 +00:00
|
|
|
}
|