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:
authorJulian Eisel <eiseljulian@gmail.com>2015-09-21 01:55:37 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-09-23 17:02:23 +0300
commit869736b5d6b741d0261d832d400d424517ce0174 (patch)
treed6d2b5d91fb2d53edbacc7936cb76f4d707ad9a6
parentcec28ebf5efe75ead30080275e2a0e0118bbbdf4 (diff)
Fix node auto-offset failing during heavy compositing (sometimes)
Compositing might make main thread so busy that animation is considered done due to duration before final position is reached. Also added check to avoid unnecessary redraws.
-rw-r--r--source/blender/editors/space_node/node_relationships.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 7286b6fbc0c..a9f126a75e2 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -1634,12 +1634,31 @@ static int node_insert_offset_modal(bContext *C, wmOperator *UNUSED(op), const w
NodeInsertOfsData *iofsd = snode->iofsd;
bNode *node;
float duration;
+ bool redraw = false;
if (!snode || event->type != TIMER || iofsd->anim_timer != event->customdata)
return OPERATOR_PASS_THROUGH;
- /* end timer + free insert offset data */
duration = (float)iofsd->anim_timer->duration;
+
+ /* handle animation - do this before possibly aborting due to duration, since
+ * main thread might be so busy that node hasn't reached final position yet */
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
+ if (UNLIKELY(node->anim_ofsx)) {
+ const float endval = node->anim_init_locx + node->anim_ofsx;
+ if (node->locx < endval) {
+ node->locx = BLI_easing_cubic_ease_in_out(duration, node->anim_init_locx, node->anim_ofsx,
+ NODE_INSOFS_ANIM_DURATION);
+ CLAMP_MAX(node->locx, endval);
+ redraw = true;
+ }
+ }
+ }
+ if (redraw) {
+ ED_region_tag_redraw(CTX_wm_region(C));
+ }
+
+ /* end timer + free insert offset data */
if (duration > NODE_INSOFS_ANIM_DURATION) {
WM_event_remove_timer(CTX_wm_manager(C), NULL, iofsd->anim_timer);
@@ -1653,15 +1672,6 @@ static int node_insert_offset_modal(bContext *C, wmOperator *UNUSED(op), const w
return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
}
- /* handle animation */
- for (node = snode->edittree->nodes.first; node; node = node->next) {
- if (node->anim_ofsx) {
- node->locx = BLI_easing_cubic_ease_in_out(duration, node->anim_init_locx, node->anim_ofsx,
- NODE_INSOFS_ANIM_DURATION);
- }
- }
- ED_region_tag_redraw(CTX_wm_region(C));
-
return OPERATOR_RUNNING_MODAL;
}