<div dir="ltr">Thanks for the clear respond :)<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 19, 2016 at 1:00 PM,  <span dir="ltr"><<a href="mailto:bf-animsys-request@blender.org" target="_blank">bf-animsys-request@blender.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send Bf-animsys mailing list submissions to<br>
        <a href="mailto:bf-animsys@blender.org">bf-animsys@blender.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://lists.blender.org/mailman/listinfo/bf-animsys" rel="noreferrer" target="_blank">https://lists.blender.org/mailman/listinfo/bf-animsys</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:bf-animsys-request@blender.org">bf-animsys-request@blender.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:bf-animsys-owner@blender.org">bf-animsys-owner@blender.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Bf-animsys digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Animation logic (Erick Blender)<br>
   2. Re: Animation logic (Joshua Leung)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 19 Apr 2016 10:19:08 +0300<br>
From: Erick Blender <<a href="mailto:erickblender@gmail.com">erickblender@gmail.com</a>><br>
Subject: [Bf-animsys] Animation logic<br>
To: <a href="mailto:bf-animsys@blender.org">bf-animsys@blender.org</a>, <a href="mailto:bf-committers@blender.org">bf-committers@blender.org</a><br>
Message-ID:<br>
        <CAFgX_-yvMV=<a href="mailto:NyggShinbU9Y3gJF1bapZAe4gtinUFAnbXUBeGA@mail.gmail.com">NyggShinbU9Y3gJF1bapZAe4gtinUFAnbXUBeGA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi there!<br>
<br>
Wanted to ask about Blender animation logic, how graph editor, timeline,<br>
dopesheet and NLA work together?<br>
Reading code files in blender/editor/animation i find many useful code and<br>
i found as well  that in blender/editor/transform/transform_conversion.c<br>
there is basic keyframes move, ...<br>
<br>
My question is how graph editor, timeline, dopesheet and NLA talk to each<br>
other for example when moving a keyframe in graph it get updated in the<br>
dopesheet or vise versa. Is there some where in the code that Blender<br>
update dopesheet when action happening in the graph editor?<br>
<br>
Thanks in advance :)<br>
<br>
<<a href="https://www.avast.com/en-us/lp-esg-fav?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=oa-2109-v2-b" rel="noreferrer" target="_blank">https://www.avast.com/en-us/lp-esg-fav?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=oa-2109-v2-b</a>><br>
Virus-free.<br>
<a href="http://www.avast.com" rel="noreferrer" target="_blank">www.avast.com</a><br>
<<a href="https://www.avast.com/en-us/lp-esg-fav?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=oa-2109-v2-b" rel="noreferrer" target="_blank">https://www.avast.com/en-us/lp-esg-fav?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=oa-2109-v2-b</a>><br>
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.blender.org/pipermail/bf-animsys/attachments/20160419/c2e07cde/attachment-0001.htm" rel="noreferrer" target="_blank">http://lists.blender.org/pipermail/bf-animsys/attachments/20160419/c2e07cde/attachment-0001.htm</a><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Tue, 19 Apr 2016 19:47:17 +1200<br>
From: Joshua Leung <<a href="mailto:aligorith@gmail.com">aligorith@gmail.com</a>><br>
Subject: Re: [Bf-animsys] Animation logic<br>
To: Discussion list to assist animation developers<br>
        <<a href="mailto:bf-animsys@blender.org">bf-animsys@blender.org</a>><br>
Message-ID:<br>
        <CA+KxdBA58Q6txjMcSxTfDdweSDMTrnPkETct=<a href="mailto:y%2Bs8mMyrG7UZQ@mail.gmail.com">y+s8mMyrG7UZQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi Erick,<br>
<br>
For a useful (though overly broad/general) introduction to the key concepts<br>
of how updates in Blender happen in general, see this:<br>
<a href="https://wiki.blender.org/index.php/Dev:2.5/Source/Architecture/Window_Manager" rel="noreferrer" target="_blank">https://wiki.blender.org/index.php/Dev:2.5/Source/Architecture/Window_Manager</a><br>
<br>
<br>
Here you go  (this was originally go to be "in short", but then it turned<br>
out to be a lot longer reply ;):<br>
* The code in your "operator" modifies the keyframes/etc. data (i.e. stuff<br>
stored in the SDNA structs that form that Main database)<br>
* When your operator is done, it sends a "notifier"  -<br>
WM_event_add_notifier(C, ....notifier flags..., NULL);<br>
  For keyframe editing, this is usually something like NC_ANIMATION |<br>
ND_KEYFRAME | NA_EDITED (i.e. notifier for "animation context", "keyframe<br>
data", "editing performed/action").<br>
* Notifiers are added to a global queue to be processed the next time we go<br>
through flushing updates (more about this below), instead of being handled<br>
immediately (i.e. the "callback" style of updates that other toolkits -<br>
notably Qt, GTK, and all of the Java ones - Swing, etc. use. However, the<br>
"callback style" has some serious disadvantages - i.e. some updates<br>
happening multiple times, bad performance if you inadvertently chain up a<br>
bunch of these by relying on delegating to other callbacks, and "callback<br>
hell" if that chaining accidentally forms a loop.)<br>
* As in any GUI program, Blender has what's known as an "event loop".<br>
Basically, it's like you've got a piece of code in your main function that<br>
does:<br>
  while (true) {<br>
        get_event();<br>
        handle_event();    // run operators, and/or exit the program<br>
        flush_updates();   // handle notifiers<br>
        refresh_and_redraw();<br>
   }<br>
<br>
  In Blender, notifiers are handled in the "flush_updates()" step, after<br>
the operator runs (i.e. handle_event() == an operator gets run, or some<br>
event gets sent to the UI handler, or something like that). What that means<br>
is that it goes through each window -> editor -> region, and for each of<br>
the queued up notifiers, it asks those if it would like to do anything<br>
about that notifier. (You could say it's sort of Observer Pattern stuff I<br>
guess, except it's deferred updates, and we're still really only asking if<br>
they'd like to do any updates). So, each of the animation editors will<br>
listen for NC_ANIMATION | ND_KEYFRAME events, and when they hear them, will<br>
tag themselves to be redrawn.<br>
<br>
  Finally, when it's time to redraw the UI, only the editors/regions that<br>
are tagged to get redrawn will be redrawn (since redrawing everything all<br>
the time, even if nothing has changed is slow, and would make everything<br>
laggy). So, at this point, all the visible animation editors would get<br>
redrawn, because they tagged themselves to get redrawn, in response to the<br>
notifier that got sent out.<br>
<br>
<br>
<br>
Now, all of the above is only just updating the UI (which is what your<br>
question was about). If you were to talk about how you get those animation<br>
changes flushed to the actual models and rigs, then you'll need to be<br>
talking about the dependency graph stuff then. But, there it's really a<br>
similar idea again :)<br>
<br>
<br>
(Also, if you're just concerned with the transform code, have a look in<br>
transform_generics.c -> recalcData() for how things get tagged for updates<br>
there :)<br>
<br>
<br>
<br>
Regards,<br>
Joshua<br>
<br>
<br>
On Tue, Apr 19, 2016 at 7:19 PM, Erick Blender <<a href="mailto:erickblender@gmail.com">erickblender@gmail.com</a>><br>
wrote:<br>
<br>
> Hi there!<br>
><br>
> Wanted to ask about Blender animation logic, how graph editor, timeline,<br>
> dopesheet and NLA work together?<br>
> Reading code files in blender/editor/animation i find many useful code and<br>
> i found as well  that in blender/editor/transform/transform_conversion.c<br>
> there is basic keyframes move, ...<br>
><br>
> My question is how graph editor, timeline, dopesheet and NLA talk to each<br>
> other for example when moving a keyframe in graph it get updated in the<br>
> dopesheet or vise versa. Is there some where in the code that Blender<br>
> update dopesheet when action happening in the graph editor?<br>
><br>
> Thanks in advance :)<br>
><br>
><br>
> <<a href="https://www.avast.com/en-us/lp-esg-fav?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=oa-2109-v2-b" rel="noreferrer" target="_blank">https://www.avast.com/en-us/lp-esg-fav?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=oa-2109-v2-b</a>> Virus-free.<br>
> <a href="http://www.avast.com" rel="noreferrer" target="_blank">www.avast.com</a><br>
> <<a href="https://www.avast.com/en-us/lp-esg-fav?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=oa-2109-v2-b" rel="noreferrer" target="_blank">https://www.avast.com/en-us/lp-esg-fav?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=oa-2109-v2-b</a>><br>
> <#m_8821382711635120639_DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2><br>
><br>
> _______________________________________________<br>
> Bf-animsys mailing list<br>
> <a href="mailto:Bf-animsys@blender.org">Bf-animsys@blender.org</a><br>
> <a href="https://lists.blender.org/mailman/listinfo/bf-animsys" rel="noreferrer" target="_blank">https://lists.blender.org/mailman/listinfo/bf-animsys</a><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.blender.org/pipermail/bf-animsys/attachments/20160419/b43c6636/attachment-0001.htm" rel="noreferrer" target="_blank">http://lists.blender.org/pipermail/bf-animsys/attachments/20160419/b43c6636/attachment-0001.htm</a><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Bf-animsys mailing list<br>
<a href="mailto:Bf-animsys@blender.org">Bf-animsys@blender.org</a><br>
<a href="https://lists.blender.org/mailman/listinfo/bf-animsys" rel="noreferrer" target="_blank">https://lists.blender.org/mailman/listinfo/bf-animsys</a><br>
<br>
<br>
End of Bf-animsys Digest, Vol 30, Issue 1<br>
*****************************************<br>
</blockquote></div><br></div>