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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMatt Ebb <matt@mke3.net>2009-12-17 07:55:15 +0300
committerMatt Ebb <matt@mke3.net>2009-12-17 07:55:15 +0300
commitfac65a3f4d1645fb59ed0b023247535b4b1d6d77 (patch)
treee51a5957876cd1a8fcc7fddf9037b481c764af75 /source
parentfd18f555103efe8ac148ab763965d5595632da3d (diff)
Durian request:
Extend the 'only selected' property in the graph editor to only show curves from selected sequence strips and nodes as well.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_node.h1
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h2
-rw-r--r--source/blender/blenkernel/intern/node.c11
-rw-r--r--source/blender/blenkernel/intern/sequencer.c15
-rw-r--r--source/blender/editors/animation/anim_filter.c86
-rw-r--r--source/blender/editors/space_graph/space_graph.c6
-rw-r--r--source/blender/makesrna/intern/rna_action.c2
7 files changed, 102 insertions, 21 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index f9130e24a08..3ed9ab8778e 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -175,6 +175,7 @@ struct bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node, int inte
struct bNodeLink *nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock);
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
+struct bNode *nodeFindNodebyName(struct bNodeTree *ntree, const char *name);
int nodeFindNode(struct bNodeTree *ntree, struct bNodeSocket *sock, struct bNode **nodep, int *sockindex);
struct bNodeLink *nodeFindLink(struct bNodeTree *ntree, struct bNodeSocket *from, struct bNodeSocket *to);
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index a50b03861d7..e6b468e0dc0 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -192,6 +192,8 @@ void seq_update_muting(struct Editing *ed);
void clear_scene_in_allseqs(struct Scene *sce);
+struct Sequence *get_seq_by_name(struct Scene *scene, const char *name);
+
struct Sequence *active_seq_get(struct Scene *scene);
void active_seq_set(struct Scene *scene, struct Sequence *seq);
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index a27c3b6494b..84ef4fb6d1c 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -767,6 +767,17 @@ void nodeGroupSocketUseFlags(bNodeTree *ngroup)
}
}
+/* finds a node based on its name */
+bNode *nodeFindNodebyName(bNodeTree *ntree, const char *name)
+{
+ bNode *node=NULL;
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if (strcmp(name, node->name) == 0)
+ break;
+ }
+ return node;
+}
/* finds a node based on given socket */
int nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockindex)
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index a7b9cf7f74c..e36e8dc49c4 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3575,6 +3575,21 @@ void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
}
+Sequence *get_seq_by_name(Scene *scene, const char *name)
+{
+ Sequence *seq=NULL;
+ Editing *ed= seq_give_editing(scene, FALSE);
+
+ if(ed==NULL) return NULL;
+
+ for (seq=ed->seqbase.first; seq; seq=seq->next) {
+ if (strcmp(name, seq->name+2) == 0)
+ break;
+ }
+ return seq;
+}
+
+
Sequence *active_seq_get(Scene *scene)
{
Editing *ed= seq_give_editing(scene, FALSE);
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 544157c4030..fc5e7e1898b 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -68,6 +68,7 @@
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_space_types.h"
+#include "DNA_sequence_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
@@ -85,6 +86,8 @@
#include "BKE_key.h"
#include "BKE_object.h"
#include "BKE_material.h"
+#include "BKE_node.h"
+#include "BKE_sequencer.h"
#include "BKE_screen.h"
#include "BKE_utildefines.h"
@@ -754,6 +757,65 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
/* ----------------------------------------- */
+static int skip_fcurve_selected_data(FCurve *fcu, ID *owner_id)
+{
+ if (GS(owner_id->name) == ID_OB) {
+ Object *ob= (Object *)owner_id;
+
+ /* only consider if F-Curve involves pose.bones */
+ if ((fcu->rna_path) && strstr(fcu->rna_path, "bones")) {
+ bPoseChannel *pchan;
+ char *bone_name;
+
+ /* get bone-name, and check if this bone is selected */
+ bone_name= BLI_getQuotedStr(fcu->rna_path, "bones[");
+ pchan= get_pose_channel(ob->pose, bone_name);
+ if (bone_name) MEM_freeN(bone_name);
+
+ /* can only add this F-Curve if it is selected */
+ if ((pchan) && (pchan->bone) && (pchan->bone->flag & BONE_SELECTED)==0)
+ return 1;
+ }
+ }
+ else if (GS(owner_id->name) == ID_SCE) {
+ Scene *sce = (Scene *)owner_id;
+
+ /* only consider if F-Curve involves sequence_editor.sequences */
+ if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
+ Sequence *seq;
+ char *seq_name;
+
+ /* get strip name, and check if this strip is selected */
+ seq_name= BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
+ seq = get_seq_by_name(sce, seq_name);
+ if (seq_name) MEM_freeN(seq_name);
+
+ /* can only add this F-Curve if it is selected */
+ if ((seq) && (seq->flag & SELECT)==0)
+ return 1;
+ }
+ }
+ else if (GS(owner_id->name) == ID_NT) {
+ bNodeTree *ntree = (bNodeTree *)owner_id;
+
+ /* check for selected nodes */
+ if ((fcu->rna_path) && strstr(fcu->rna_path, "nodes")) {
+ bNode *node;
+ char *node_name;
+
+ /* get strip name, and check if this strip is selected */
+ node_name= BLI_getQuotedStr(fcu->rna_path, "nodes[");
+ node = nodeFindNodebyName(ntree, node_name);
+ if (node_name) MEM_freeN(node_name);
+
+ /* can only add this F-Curve if it is selected */
+ if ((node) && (node->flag & NODE_SELECT)==0)
+ return 1;
+ }
+ }
+ return 0;
+}
+
/* find the next F-Curve that is usable for inclusion */
static FCurve *animdata_filter_fcurve_next (bDopeSheet *ads, FCurve *first, bActionGroup *grp, int filter_mode, ID *owner_id)
{
@@ -771,27 +833,11 @@ static FCurve *animdata_filter_fcurve_next (bDopeSheet *ads, FCurve *first, bAct
* carefully checking the entire path
* - this will also affect things like Drivers, and also works for Bone Constraints
*/
- if ( ((ads) && (ads->filterflag & ADS_FILTER_ONLYSEL)) &&
- ((owner_id) && (GS(owner_id->name) == ID_OB)) )
- {
- Object *ob= (Object *)owner_id;
-
- /* only consider if F-Curve involves pose.bones */
- if ((fcu->rna_path) && strstr(fcu->rna_path, "bones")) {
- bPoseChannel *pchan;
- char *bone_name;
-
- /* get bone-name, and check if this bone is selected */
- bone_name= BLI_getQuotedStr(fcu->rna_path, "bones[");
- pchan= get_pose_channel(ob->pose, bone_name);
- if (bone_name) MEM_freeN(bone_name);
-
- /* can only add this F-Curve if it is selected */
- if ((pchan) && (pchan->bone) && (pchan->bone->flag & BONE_SELECTED)==0)
- continue;
- }
+ if ( ((ads) && (ads->filterflag & ADS_FILTER_ONLYSEL)) && (owner_id) ) {
+ if (skip_fcurve_selected_data(fcu, owner_id))
+ continue;
}
-
+
/* only include if visible (Graph Editor check, not channels check) */
if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || (fcu->flag & FCURVE_VISIBLE)) {
/* only work with this channel and its subchannels if it is editable */
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 3023ec89258..f00215e7313 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -387,6 +387,7 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
case ND_OB_ACTIVE:
case ND_FRAME:
case ND_MARKERS:
+ case ND_SEQUENCER_SELECT:
ED_region_tag_redraw(ar);
break;
}
@@ -405,6 +406,11 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_NODE:
+ switch(wmn->data) {
+ case ND_NODE_SELECT:
+ ED_region_tag_redraw(ar);
+ break;
+ }
switch(wmn->action) {
case NA_EDITED:
ED_region_tag_redraw(ar);
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 0568652488d..4cb7080f05e 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -56,7 +56,7 @@ static void rna_def_dopesheet(BlenderRNA *brna)
prop= RNA_def_property(srna, "only_selected", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYSEL);
- RNA_def_property_ui_text(prop, "Only Selected", "Only include channels relating to selected Objects.");
+ RNA_def_property_ui_text(prop, "Only Selected", "Only include channels relating to selected objects and data.");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0);
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);