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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-08-13 22:59:42 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-08-15 15:46:33 +0300
commit5d15e68743fc92b41a85ef4180628427ab3b86da (patch)
tree54e363980253f46ee300f23f6bd585c9d4b840fc
parent7907dfc400182b408e558d9fef1240d9929f8661 (diff)
Fix viewport selection of markers not updating in all editors
This includes selections both in the clip editor as the viewport. The selection is implemented as a synchronization function called from the eval selection update node in depsgraph.
-rw-r--r--source/blender/blenkernel/BKE_movieclip.h3
-rw-r--r--source/blender/blenkernel/intern/movieclip.c43
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc7
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc4
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type_defines.cc1
-rw-r--r--source/blender/depsgraph/intern/depsgraph_types.h3
-rw-r--r--source/blender/editors/space_clip/tracking_select.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c1
8 files changed, 68 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index 014ea2b9159..ee8e22048a1 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -84,8 +84,9 @@ struct ImBuf *BKE_movieclip_anim_ibuf_for_frame(struct MovieClip *clip, struct M
bool BKE_movieclip_has_cached_frame(struct MovieClip *clip, struct MovieClipUser *user);
bool BKE_movieclip_put_frame_if_possible(struct MovieClip *clip, struct MovieClipUser *user, struct ImBuf *ibuf);
-/* Evaluaiton. */
+/* Evaluation. */
void BKE_movieclip_eval_update(struct Depsgraph *depsgraph, struct MovieClip *clip);
+void BKE_movieclip_eval_selection_update(struct Depsgraph *depsgraph, struct MovieClip *clip);
/* cacheing flags */
#define MOVIECLIP_CACHE_SKIP (1 << 0)
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 98586a5c2f5..69d237e1296 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -1609,8 +1609,51 @@ bool BKE_movieclip_put_frame_if_possible(MovieClip *clip,
return result;
}
+static void movieclip_selection_synchronize(MovieClip *clip_dst, MovieClip *clip_src)
+{
+ BLI_assert(clip_dst != clip_src);
+ MovieTracking *tracking_dst = &clip_dst->tracking, *tracking_src = &clip_src->tracking;
+ /* Syncs the active object, track and plane track. */
+ tracking_dst->objectnr = tracking_src->objectnr;
+ const int active_track_index = BLI_findindex(&tracking_src->tracks, tracking_src->act_track);
+ const int active_plane_track_index = BLI_findindex(&tracking_src->plane_tracks, tracking_src->act_plane_track);
+ tracking_dst->act_track = BLI_findlink(&tracking_dst->tracks, active_track_index);
+ tracking_dst->act_plane_track = BLI_findlink(&tracking_dst->plane_tracks, active_plane_track_index);
+
+ /* Syncs the tracking selection flag. */
+ MovieTrackingObject *tracking_object_dst, *tracking_object_src;
+ tracking_object_src = tracking_src->objects.first;
+
+ for (tracking_object_dst = tracking_dst->objects.first;
+ tracking_object_dst != NULL;
+ tracking_object_dst = tracking_object_dst->next,
+ tracking_object_src = tracking_object_src->next)
+ {
+ ListBase *tracksbase_dst, *tracksbase_src;
+ tracksbase_dst = BKE_tracking_object_get_tracks(tracking_dst, tracking_object_dst);
+ tracksbase_src = BKE_tracking_object_get_tracks(tracking_src, tracking_object_src);
+
+ MovieTrackingTrack *track_dst, *track_src;
+ track_src = tracksbase_src->first;
+ for (track_dst = tracksbase_dst->first;
+ track_dst != NULL;
+ track_dst = track_dst->next, track_src = track_src->next)
+ {
+ track_dst->flag = track_src->flag;
+ track_dst->pat_flag = track_src->pat_flag;
+ track_dst->search_flag = track_src->search_flag;
+ }
+ }
+}
+
void BKE_movieclip_eval_update(struct Depsgraph *depsgraph, MovieClip *clip)
{
DEG_debug_print_eval(depsgraph, __func__, clip->id.name, clip);
BKE_tracking_dopesheet_tag_update(&clip->tracking);
}
+
+void BKE_movieclip_eval_selection_update(struct Depsgraph *depsgraph, MovieClip *clip)
+{
+ DEG_debug_print_eval(depsgraph, __func__, clip->id.name, clip);
+ movieclip_selection_synchronize(clip, (MovieClip *)clip->id.orig_id);
+}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 53612a66e5d..8d2960d1587 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -1502,7 +1502,7 @@ void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip)
return;
}
ID *clip_id = &clip->id;
- MovieClip *clip_cow = get_cow_datablock(clip);
+ MovieClip *clip_cow = (MovieClip *)ensure_cow_id(clip_id);
/* Animation. */
build_animdata(clip_id);
/* Movie clip evaluation. */
@@ -1510,6 +1510,11 @@ void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip)
DEG_NODE_TYPE_PARAMETERS,
function_bind(BKE_movieclip_eval_update, _1, clip_cow),
DEG_OPCODE_MOVIECLIP_EVAL);
+
+ add_operation_node(clip_id,
+ DEG_NODE_TYPE_BATCH_CACHE,
+ function_bind(BKE_movieclip_eval_selection_update, _1, clip_cow),
+ DEG_OPCODE_MOVIECLIP_SELECT_UPDATE);
}
void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe)
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index e4659a7a94d..e2c28f0d1e1 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -152,6 +152,10 @@ void depsgraph_select_tag_to_component_opcode(
*component_type = DEG_NODE_TYPE_OBJECT_FROM_LAYER;
*operation_code = DEG_OPCODE_OBJECT_BASE_FLAGS;
}
+ else if (id_type == ID_MC) {
+ *component_type = DEG_NODE_TYPE_BATCH_CACHE;
+ *operation_code = DEG_OPCODE_MOVIECLIP_SELECT_UPDATE;
+ }
else {
*component_type = DEG_NODE_TYPE_BATCH_CACHE;
*operation_code = DEG_OPCODE_GEOMETRY_SELECT_UPDATE;
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
index 6d7f86581d9..7abde2e865c 100644
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc
+++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
@@ -175,6 +175,7 @@ const char *operationCodeAsString(eDepsOperation_Code opcode)
STRINGIFY_OPCODE(WORLD_UPDATE);
/* Movie clip. */
STRINGIFY_OPCODE(MOVIECLIP_EVAL);
+ STRINGIFY_OPCODE(MOVIECLIP_SELECT_UPDATE);
case DEG_NUM_OPCODES: return "SpecialCase";
#undef STRINGIFY_OPCODE
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index 6577e742266..b19eb619fac 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -152,7 +152,7 @@ typedef enum eDepsNode_Type {
DEG_NODE_TYPE_SHADING_PARAMETERS,
/* Cache Component */
DEG_NODE_TYPE_CACHE,
- /* Batch Cache Component */
+ /* Batch Cache Component - TODO (dfelinto/sergey) rename to make it more generic. */
DEG_NODE_TYPE_BATCH_CACHE,
/* Total number of meaningful node types. */
@@ -274,6 +274,7 @@ typedef enum eDepsOperation_Code {
/* Movie clips. ------------------------------------ */
DEG_OPCODE_MOVIECLIP_EVAL,
+ DEG_OPCODE_MOVIECLIP_SELECT_UPDATE,
DEG_NUM_OPCODES,
} eDepsOperation_Code;
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index 58bf8a50416..7fb2e32770d 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -54,6 +54,8 @@
#include "UI_view2d.h"
+#include "DEG_depsgraph.h"
+
#include "tracking_ops_intern.h" /* own include */
#include "clip_intern.h" /* own include */
@@ -347,6 +349,7 @@ static int mouse_select(bContext *C, float co[2], int extend)
BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
+ DEG_id_tag_update(&clip->id, DEG_TAG_SELECT_UPDATE);
return OPERATOR_FINISHED;
}
@@ -390,6 +393,7 @@ static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
clip->tracking.act_track = track;
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
+ DEG_id_tag_update(&clip->id, DEG_TAG_SELECT_UPDATE);
return OPERATOR_PASS_THROUGH;
}
@@ -507,6 +511,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
+ DEG_id_tag_update(&clip->id, DEG_TAG_SELECT_UPDATE);
return OPERATOR_FINISHED;
}
@@ -617,6 +622,7 @@ static int do_lasso_select_marker(bContext *C, const int mcords[][2], const shor
BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
+ DEG_id_tag_update(&clip->id, DEG_TAG_SELECT_UPDATE);
}
return changed;
@@ -759,6 +765,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
+ DEG_id_tag_update(&clip->id, DEG_TAG_SELECT_UPDATE);
return OPERATOR_FINISHED;
}
@@ -884,6 +891,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
+ DEG_id_tag_update(&clip->id, DEG_TAG_SELECT_UPDATE);
return OPERATOR_FINISHED;
}
@@ -967,6 +975,7 @@ static int select_grouped_exec(bContext *C, wmOperator *op)
BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip);
+ DEG_id_tag_update(&clip->id, DEG_TAG_SELECT_UPDATE);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 3181b72ac51..3ed98362467 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -1639,6 +1639,7 @@ static bool ed_object_select_pick(
retval = true;
DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
+ DEG_id_tag_update(&clip->id, DEG_TAG_SELECT_UPDATE);
WM_event_add_notifier(C, NC_MOVIECLIP | ND_SELECT, track);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);