2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-05-30 00:28:33 +00:00
|
|
|
* 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
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-05-30 00:28:33 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-05-30 00:28:33 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spnla
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2009-05-30 00:28:33 +00:00
|
|
|
#include <stdio.h>
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <string.h>
|
2009-05-30 00:28:33 +00:00
|
|
|
|
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
|
|
|
|
|
#include "BKE_context.h"
|
|
|
|
|
#include "BKE_screen.h"
|
|
|
|
|
|
|
|
|
|
#include "ED_anim_api.h"
|
2011-06-01 06:26:54 +00:00
|
|
|
#include "ED_markers.h"
|
2009-05-30 00:28:33 +00:00
|
|
|
#include "ED_screen.h"
|
2018-08-14 10:28:41 +10:00
|
|
|
#include "ED_select_utils.h"
|
2009-07-10 02:04:50 +00:00
|
|
|
#include "ED_transform.h"
|
2009-06-09 11:26:45 +00:00
|
|
|
|
2009-05-30 00:28:33 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
2009-05-30 10:41:41 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
|
2012-05-08 18:05:57 +00:00
|
|
|
#include "nla_intern.h" /* own include */
|
2009-05-30 00:28:33 +00:00
|
|
|
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
/* ************************** poll callbacks for operators **********************************/
|
|
|
|
|
|
|
|
|
|
/* tweakmode is NOT enabled */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool nlaop_poll_tweakmode_off(bContext *C)
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
{
|
|
|
|
|
Scene *scene;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* for now, we check 2 things:
|
2018-11-14 12:53:15 +11:00
|
|
|
* 1) active editor must be NLA
|
|
|
|
|
* 2) tweakmode is currently set as a 'per-scene' flag
|
|
|
|
|
* so that it will affect entire NLA data-sets,
|
|
|
|
|
* but not all AnimData blocks will be in tweakmode for
|
|
|
|
|
* various reasons
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
*/
|
2019-04-22 09:19:45 +10:00
|
|
|
if (ED_operator_nla_active(C) == 0) {
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
return 0;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-08 18:05:57 +00:00
|
|
|
scene = CTX_data_scene(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((scene == NULL) || (scene->flag & SCE_NLA_EDIT_ON)) {
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
return 0;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* tweakmode IS enabled */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool nlaop_poll_tweakmode_on(bContext *C)
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
{
|
|
|
|
|
Scene *scene;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* for now, we check 2 things:
|
2018-11-14 12:53:15 +11:00
|
|
|
* 1) active editor must be NLA
|
|
|
|
|
* 2) tweakmode is currently set as a 'per-scene' flag
|
|
|
|
|
* so that it will affect entire NLA data-sets,
|
|
|
|
|
* but not all AnimData blocks will be in tweakmode for
|
|
|
|
|
* various reasons
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
*/
|
2019-04-22 09:19:45 +10:00
|
|
|
if (ED_operator_nla_active(C) == 0) {
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
return 0;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-08 18:05:57 +00:00
|
|
|
scene = CTX_data_scene(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((scene == NULL) || !(scene->flag & SCE_NLA_EDIT_ON)) {
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
return 0;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
2009-05-30 00:28:33 +00:00
|
|
|
|
2009-06-21 03:02:40 +00:00
|
|
|
/* is tweakmode enabled - for use in NLA operator code */
|
2014-02-03 18:55:59 +11:00
|
|
|
bool nlaedit_is_tweakmode_on(bAnimContext *ac)
|
2009-06-21 03:02:40 +00:00
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (ac && ac->scene) {
|
2014-02-03 18:55:59 +11:00
|
|
|
return (ac->scene->flag & SCE_NLA_EDIT_ON) != 0;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2009-06-21 03:02:40 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-30 00:28:33 +00:00
|
|
|
/* ************************** registration - operator types **********************************/
|
|
|
|
|
|
|
|
|
|
void nla_operatortypes(void)
|
|
|
|
|
{
|
2009-05-30 10:41:41 +00:00
|
|
|
/* channels */
|
|
|
|
|
WM_operatortype_append(NLA_OT_channels_click);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-05-05 13:59:36 +12:00
|
|
|
WM_operatortype_append(NLA_OT_action_pushdown);
|
2015-04-04 11:36:46 +13:00
|
|
|
WM_operatortype_append(NLA_OT_action_unlink);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-11-28 14:37:21 +00:00
|
|
|
WM_operatortype_append(NLA_OT_tracks_add);
|
2013-03-14 06:34:02 +00:00
|
|
|
WM_operatortype_append(NLA_OT_tracks_delete);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-03-14 06:34:02 +00:00
|
|
|
WM_operatortype_append(NLA_OT_selected_objects_add);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-05-30 10:41:41 +00:00
|
|
|
/* select */
|
2009-06-28 03:13:01 +00:00
|
|
|
WM_operatortype_append(NLA_OT_click_select);
|
2018-10-05 10:27:04 +10:00
|
|
|
WM_operatortype_append(NLA_OT_select_box);
|
2018-07-03 15:44:56 +02:00
|
|
|
WM_operatortype_append(NLA_OT_select_all);
|
2011-02-14 03:04:59 +00:00
|
|
|
WM_operatortype_append(NLA_OT_select_leftright);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-20 00:36:28 +00:00
|
|
|
/* view */
|
|
|
|
|
WM_operatortype_append(NLA_OT_view_all);
|
|
|
|
|
WM_operatortype_append(NLA_OT_view_selected);
|
2016-04-17 03:44:10 +12:00
|
|
|
WM_operatortype_append(NLA_OT_view_frame);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-04-28 19:33:28 +12:00
|
|
|
WM_operatortype_append(NLA_OT_previewrange_set);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
/* edit */
|
2009-06-28 03:13:01 +00:00
|
|
|
WM_operatortype_append(NLA_OT_tweakmode_enter);
|
|
|
|
|
WM_operatortype_append(NLA_OT_tweakmode_exit);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-11-28 14:37:21 +00:00
|
|
|
WM_operatortype_append(NLA_OT_actionclip_add);
|
|
|
|
|
WM_operatortype_append(NLA_OT_transition_add);
|
2011-08-07 12:27:20 +00:00
|
|
|
WM_operatortype_append(NLA_OT_soundclip_add);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-11-28 14:37:21 +00:00
|
|
|
WM_operatortype_append(NLA_OT_meta_add);
|
|
|
|
|
WM_operatortype_append(NLA_OT_meta_remove);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-06-28 03:13:01 +00:00
|
|
|
WM_operatortype_append(NLA_OT_duplicate);
|
|
|
|
|
WM_operatortype_append(NLA_OT_delete);
|
|
|
|
|
WM_operatortype_append(NLA_OT_split);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-09 01:32:13 +00:00
|
|
|
WM_operatortype_append(NLA_OT_mute_toggle);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-01-18 23:38:36 +00:00
|
|
|
WM_operatortype_append(NLA_OT_swap);
|
2009-06-28 03:13:01 +00:00
|
|
|
WM_operatortype_append(NLA_OT_move_up);
|
|
|
|
|
WM_operatortype_append(NLA_OT_move_down);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-01-24 06:28:53 +00:00
|
|
|
WM_operatortype_append(NLA_OT_action_sync_length);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-04-29 01:59:15 +12:00
|
|
|
WM_operatortype_append(NLA_OT_make_single_user);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-06-28 03:13:01 +00:00
|
|
|
WM_operatortype_append(NLA_OT_apply_scale);
|
|
|
|
|
WM_operatortype_append(NLA_OT_clear_scale);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-06 11:06:34 +00:00
|
|
|
WM_operatortype_append(NLA_OT_snap);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-02 06:41:10 +00:00
|
|
|
WM_operatortype_append(NLA_OT_fmodifier_add);
|
2010-03-18 13:04:46 +00:00
|
|
|
WM_operatortype_append(NLA_OT_fmodifier_copy);
|
|
|
|
|
WM_operatortype_append(NLA_OT_fmodifier_paste);
|
2009-05-30 00:28:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ************************** registration - keymaps **********************************/
|
|
|
|
|
|
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 nla_keymap(wmKeyConfig *keyconf)
|
2009-05-30 00:28:33 +00:00
|
|
|
{
|
2013-07-01 14:58:59 +00:00
|
|
|
/* keymap for all regions ------------------------------------------- */
|
2018-11-08 15:59:51 +11:00
|
|
|
WM_keymap_ensure(keyconf, "NLA Generic", SPACE_NLA, 0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-07-01 14:58:59 +00:00
|
|
|
/* channels ---------------------------------------------------------- */
|
2019-04-22 00:18:34 +10:00
|
|
|
/* Channels are not directly handled by the NLA Editor module, but are inherited from the
|
|
|
|
|
* animation module. Most of the relevant operations, keymaps, drawing, etc. can therefore all
|
|
|
|
|
* be found in that module instead, as there are many similarities with the other
|
|
|
|
|
* animation editors.
|
2009-05-30 00:28:33 +00:00
|
|
|
*
|
2018-11-14 12:53:15 +11:00
|
|
|
* However, those operations which involve clicking on channels and/or
|
|
|
|
|
* the placement of them in the view are implemented here instead
|
2009-05-30 00:28:33 +00:00
|
|
|
*/
|
2018-11-08 15:59:51 +11:00
|
|
|
WM_keymap_ensure(keyconf, "NLA Channels", SPACE_NLA, 0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-07-01 14:58:59 +00:00
|
|
|
/* data ------------------------------------------------------------- */
|
2018-11-08 15:59:51 +11:00
|
|
|
WM_keymap_ensure(keyconf, "NLA Editor", SPACE_NLA, 0);
|
2009-05-30 00:28:33 +00:00
|
|
|
}
|