[Synfig-devl] Carlos Lopez : Add code for multiple onion skins.
Module: synfig Branch: genete_master Commit: 96db5bbae7db6545fbf2a10e903132dbd87bd9a3 URL: http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig;a=commit;h=96db5bbae7db6545fbf2a10e903132dbd87bd9a3 Author: Carlos Lopez Date: Wed Jul 8 15:09:50 2009 +0200 Add code for multiple onion skins. --- synfig-studio/trunk/src/gtkmm/workarea.cpp | 61 synfig-studio/trunk/src/gtkmm/workarea.h |2 + 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/workarea.cpp b/synfig-studio/trunk/src/gtkmm/workarea.cpp index 0ebd729..0d1ce1a 100644 --- a/synfig-studio/trunk/src/gtkmm/workarea.cpp +++ b/synfig-studio/trunk/src/gtkmm/workarea.cpp @@ -117,7 +117,7 @@ public: synfig::Mutex mutex; - void set_onion_skin(bool x) + void set_onion_skin(bool x, int *onions) { onionskin=x; @@ -126,26 +126,29 @@ public: if(!onionskin) return; onion_skin_queue.push_back(time); - //onion_skin_queue.push_back(time-1); - //onion_skin_queue.push_back(time+1); + try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_prev( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_prev(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_next( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_next(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } @@ -414,7 +417,7 @@ public: std::list onion_skin_queue; - void set_onion_skin(bool x) + void set_onion_skin(bool x, int *onions) { onionskin=x; @@ -427,22 +430,26 @@ public: //onion_skin_queue.push_back(time+1); try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_prev( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_prev(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_next( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_next(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } @@ -672,6 +679,8 @@ WorkArea::WorkArea(etl::loose_handle canvas_interfac ph=0.001; last_focus_point=Point(0,0); onion_skin=false; + onion_skins[0]=0; + onion_skins[1]=2; queued=false; dirty_trap_enabled=false; solid_lines=true; @@ -2289,7 +2298,7 @@ studio::WorkArea::async_update_preview() handle trgt(new class WorkAreaTarget(this,w,h)); trgt->set_rend_desc(&desc); - trgt->set_onion_skin(get_onion_skin()); + trgt->set_onion_skin(get_onion_skin(), onion_skins); target=trgt; } else @@ -2298,7 +2307,7 @@ studio::WorkArea::async_update_preview() handle trgt(new class WorkAreaTarget_Full(this,w,h)); trgt->set_rend_desc(&desc); - trgt->set_onion_skin(get_onion_skin()); + trgt->set_onion_skin(get_onion_skin(), onion_skins); target=trgt; } diff --git a/synfig-studio/trunk/src/gtkmm/workarea.h b/synfig-studio/trunk/src/gtkmm/workarea.h index 6e5ab7f..c2ec70e 100644 --- a/synf
[Synfig-devl] Carlos Lopez : Add code for multiple onion skins.
Module: synfig Branch: zelgadis_master Commit: 96db5bbae7db6545fbf2a10e903132dbd87bd9a3 URL: http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig;a=commit;h=96db5bbae7db6545fbf2a10e903132dbd87bd9a3 Author: Carlos Lopez Date: Wed Jul 8 15:09:50 2009 +0200 Add code for multiple onion skins. --- synfig-studio/trunk/src/gtkmm/workarea.cpp | 61 synfig-studio/trunk/src/gtkmm/workarea.h |2 + 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/workarea.cpp b/synfig-studio/trunk/src/gtkmm/workarea.cpp index 0ebd729..0d1ce1a 100644 --- a/synfig-studio/trunk/src/gtkmm/workarea.cpp +++ b/synfig-studio/trunk/src/gtkmm/workarea.cpp @@ -117,7 +117,7 @@ public: synfig::Mutex mutex; - void set_onion_skin(bool x) + void set_onion_skin(bool x, int *onions) { onionskin=x; @@ -126,26 +126,29 @@ public: if(!onionskin) return; onion_skin_queue.push_back(time); - //onion_skin_queue.push_back(time-1); - //onion_skin_queue.push_back(time+1); + try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_prev( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_prev(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_next( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_next(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } @@ -414,7 +417,7 @@ public: std::list onion_skin_queue; - void set_onion_skin(bool x) + void set_onion_skin(bool x, int *onions) { onionskin=x; @@ -427,22 +430,26 @@ public: //onion_skin_queue.push_back(time+1); try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_prev( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_prev(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_next( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_next(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } @@ -672,6 +679,8 @@ WorkArea::WorkArea(etl::loose_handle canvas_interfac ph=0.001; last_focus_point=Point(0,0); onion_skin=false; + onion_skins[0]=0; + onion_skins[1]=2; queued=false; dirty_trap_enabled=false; solid_lines=true; @@ -2289,7 +2298,7 @@ studio::WorkArea::async_update_preview() handle trgt(new class WorkAreaTarget(this,w,h)); trgt->set_rend_desc(&desc); - trgt->set_onion_skin(get_onion_skin()); + trgt->set_onion_skin(get_onion_skin(), onion_skins); target=trgt; } else @@ -2298,7 +2307,7 @@ studio::WorkArea::async_update_preview() handle trgt(new class WorkAreaTarget_Full(this,w,h)); trgt->set_rend_desc(&desc); - trgt->set_onion_skin(get_onion_skin()); + trgt->set_onion_skin(get_onion_skin(), onion_skins); target=trgt; } diff --git a/synfig-studio/trunk/src/gtkmm/workarea.h b/synfig-studio/trunk/src/gtkmm/workarea.h index 6e5ab7f..c2ec70e 100644 --- a/sy
[Synfig-devl] Carlos Lopez : Add code for multiple onion skins.
Module: synfig Branch: master Commit: 96db5bbae7db6545fbf2a10e903132dbd87bd9a3 URL: http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig;a=commit;h=96db5bbae7db6545fbf2a10e903132dbd87bd9a3 Author: Carlos Lopez Date: Wed Jul 8 15:09:50 2009 +0200 Add code for multiple onion skins. --- synfig-studio/trunk/src/gtkmm/workarea.cpp | 61 synfig-studio/trunk/src/gtkmm/workarea.h |2 + 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/workarea.cpp b/synfig-studio/trunk/src/gtkmm/workarea.cpp index 0ebd729..0d1ce1a 100644 --- a/synfig-studio/trunk/src/gtkmm/workarea.cpp +++ b/synfig-studio/trunk/src/gtkmm/workarea.cpp @@ -117,7 +117,7 @@ public: synfig::Mutex mutex; - void set_onion_skin(bool x) + void set_onion_skin(bool x, int *onions) { onionskin=x; @@ -126,26 +126,29 @@ public: if(!onionskin) return; onion_skin_queue.push_back(time); - //onion_skin_queue.push_back(time-1); - //onion_skin_queue.push_back(time+1); + try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_prev( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_prev(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_next( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_next(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } @@ -414,7 +417,7 @@ public: std::list onion_skin_queue; - void set_onion_skin(bool x) + void set_onion_skin(bool x, int *onions) { onionskin=x; @@ -427,22 +430,26 @@ public: //onion_skin_queue.push_back(time+1); try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_prev( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_prev(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_next( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_next(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } @@ -672,6 +679,8 @@ WorkArea::WorkArea(etl::loose_handle canvas_interfac ph=0.001; last_focus_point=Point(0,0); onion_skin=false; + onion_skins[0]=0; + onion_skins[1]=2; queued=false; dirty_trap_enabled=false; solid_lines=true; @@ -2289,7 +2298,7 @@ studio::WorkArea::async_update_preview() handle trgt(new class WorkAreaTarget(this,w,h)); trgt->set_rend_desc(&desc); - trgt->set_onion_skin(get_onion_skin()); + trgt->set_onion_skin(get_onion_skin(), onion_skins); target=trgt; } else @@ -2298,7 +2307,7 @@ studio::WorkArea::async_update_preview() handle trgt(new class WorkAreaTarget_Full(this,w,h)); trgt->set_rend_desc(&desc); - trgt->set_onion_skin(get_onion_skin()); + trgt->set_onion_skin(get_onion_skin(), onion_skins); target=trgt; } diff --git a/synfig-studio/trunk/src/gtkmm/workarea.h b/synfig-studio/trunk/src/gtkmm/workarea.h index 6e5ab7f..c2ec70e 100644 --- a/synfig-stud
Re: [Synfig-devl] Carlos Lopez : Add code for multiple onion skins.
Thanks for the advice. I see what you mention. In fact the +1 second and -1 second onion skins are not set at the moment because the code is commented. I don't know what's more useful for the user though. I've tested the code with inserting +3/-3 onion skins plus the current (7 in total) and yes, it works oddly. The code I wrote only allows 5 in total: now and two past keyframes and two future keyframes so I think it is inside the current limits. Thanks. --- El mié, 8/7/09, Gerco Ballintijn escribió: > De: Gerco Ballintijn > Asunto: Re: [Synfig-devl] Carlos Lopez : Add code for multiple onion skins. > Para: synfig-devl@lists.sourceforge.net > Fecha: miércoles, 8 julio, 2009 6:28 > Hi Genete, > > Genete wrote: > > Module: synfig > > Branch: genete_canvasview > > Commit: 82ecc8c458140ac91907a15a7d2cda8d2164c567 > > URL: > > http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig;a=commit;h=82ecc8c458140ac91907a15a7d2cda8d2164c567 > > > > Author: Carlos Lopez > > Date: Wed Jul 8 15:09:50 2009 > +0200 > > > > Add code for multiple onion skins. > > > > You have to be careful with adding extra onionskins to the > onion_skin_queue. I think the current code expects a max > queue > size of 5 (previous keyframe, now - 1, now, now + 1, next > keyframe), > and that this is related to the rather dubious > "refreshes+=5;" > statements you can find in the WorkArea class. They seem to > be > related via the refresh_id fields of the WorkAreaTarget > and > WorkAreaTarget_Full classes. > > Otherwise, good luck, I found that code rather hairy... > ;-) > Gerco. > > > --- > > > > synfig-studio/trunk/src/gtkmm/workarea.cpp > | 61 > > > synfig-studio/trunk/src/gtkmm/workarea.h | > 2 + > > 2 files changed, 37 insertions(+), 26 > deletions(-) > > > > diff --git > a/synfig-studio/trunk/src/gtkmm/workarea.cpp > b/synfig-studio/trunk/src/gtkmm/workarea.cpp > > index 0ebd729..0d1ce1a 100644 > > --- a/synfig-studio/trunk/src/gtkmm/workarea.cpp > > +++ b/synfig-studio/trunk/src/gtkmm/workarea.cpp > > @@ -117,7 +117,7 @@ public: > > > > synfig::Mutex mutex; > > > > - void set_onion_skin(bool x) > > + void set_onion_skin(bool x, int > *onions) > > { > > > onionskin=x; > > > > @@ -126,26 +126,29 @@ public: > > > if(!onionskin) > > > return; > > > onion_skin_queue.push_back(time); > > - > //onion_skin_queue.push_back(time-1); > > - > //onion_skin_queue.push_back(time+1); > > + > > try > > { > > - > onion_skin_queue.push_back( > > - > > get_canvas()->keyframe_list().find_prev( > > - > > time > > - > )->get_time() > > - > ); > > + Time > thistime=time; > > + for(int i=0; > i > + > { > > + > Time > keytime=get_canvas()->keyframe_list().find_prev(thistime)->get_time(); > > + > > onion_skin_queue.push_back(keytime); > > + > thistime=keytime; > > + > } > > } > > > catch(...) > > { } > > > > try > > { > > - > onion_skin_queue.push_back( > > - > > get_canvas()->keyframe_list().find_next( > > - > > time > > - > )->get_time() > > - > ); > > + Time > thistime=time; > > + for(int i=0; > i > + > { > > + > Time > keytime=get_canvas()->keyframe_list().find_next(thistime)->get_time(); > > + > > onion_skin_queue.push_back(keytime); > > + > thistime=keytime; > > + > } > > } > > > catch(...) > > { } > > @@ -414,7 +417,7 @@ public: > > > > std::list > onion_skin_queue; > > > > - void set_onion_skin(bool x) > > + void set_onion_skin(bool x, int > *onions) > > { > > > onionskin=x; > > > > @@ -427,22 +430,26 @@ public: > > > //onion_skin_queue.push_back(time+1); > > try > > { > > - > onion_skin_queue.push_back( > > - > > get_c
Re: [Synfig-devl] Carlos Lopez : Add code for multiple onion skins.
Hi Genete, Genete wrote: > Module: synfig > Branch: genete_canvasview > Commit: 82ecc8c458140ac91907a15a7d2cda8d2164c567 > URL: > http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig;a=commit;h=82ecc8c458140ac91907a15a7d2cda8d2164c567 > > Author: Carlos Lopez > Date: Wed Jul 8 15:09:50 2009 +0200 > > Add code for multiple onion skins. > You have to be careful with adding extra onionskins to the onion_skin_queue. I think the current code expects a max queue size of 5 (previous keyframe, now - 1, now, now + 1, next keyframe), and that this is related to the rather dubious "refreshes+=5;" statements you can find in the WorkArea class. They seem to be related via the refresh_id fields of the WorkAreaTarget and WorkAreaTarget_Full classes. Otherwise, good luck, I found that code rather hairy... ;-) Gerco. > --- > > synfig-studio/trunk/src/gtkmm/workarea.cpp | 61 > > synfig-studio/trunk/src/gtkmm/workarea.h |2 + > 2 files changed, 37 insertions(+), 26 deletions(-) > > diff --git a/synfig-studio/trunk/src/gtkmm/workarea.cpp > b/synfig-studio/trunk/src/gtkmm/workarea.cpp > index 0ebd729..0d1ce1a 100644 > --- a/synfig-studio/trunk/src/gtkmm/workarea.cpp > +++ b/synfig-studio/trunk/src/gtkmm/workarea.cpp > @@ -117,7 +117,7 @@ public: > > synfig::Mutex mutex; > > - void set_onion_skin(bool x) > + void set_onion_skin(bool x, int *onions) > { > onionskin=x; > > @@ -126,26 +126,29 @@ public: > if(!onionskin) > return; > onion_skin_queue.push_back(time); > - //onion_skin_queue.push_back(time-1); > - //onion_skin_queue.push_back(time+1); > + > try > { > - onion_skin_queue.push_back( > - get_canvas()->keyframe_list().find_prev( > - time > - )->get_time() > - ); > + Time thistime=time; > + for(int i=0; i + { > + Time > keytime=get_canvas()->keyframe_list().find_prev(thistime)->get_time(); > + onion_skin_queue.push_back(keytime); > + thistime=keytime; > + } > } > catch(...) > { } > > try > { > - onion_skin_queue.push_back( > - get_canvas()->keyframe_list().find_next( > - time > - )->get_time() > - ); > + Time thistime=time; > + for(int i=0; i + { > + Time > keytime=get_canvas()->keyframe_list().find_next(thistime)->get_time(); > + onion_skin_queue.push_back(keytime); > + thistime=keytime; > + } > } > catch(...) > { } > @@ -414,7 +417,7 @@ public: > > std::list onion_skin_queue; > > - void set_onion_skin(bool x) > + void set_onion_skin(bool x, int *onions) > { > onionskin=x; > > @@ -427,22 +430,26 @@ public: > //onion_skin_queue.push_back(time+1); > try > { > - onion_skin_queue.push_back( > - get_canvas()->keyframe_list().find_prev( > - time > - )->get_time() > - ); > + Time thistime=time; > + for(int i=0; i + { > + Time > keytime=get_canvas()->keyframe_list().find_prev(thistime)->get_time(); > + onion_skin_queue.push_back(keytime); > + thistime=keytime; > + } > } > catch(...) > { } > > try > { > - onion_skin_queue.push_back( > - get_canvas()->keyframe_list().find_next( > - time > - )->get_time() > - ); > + Time thistime=time; > + for(int i=0; i + { > + Time > keytime=get_canvas()->keyframe_list().find_next(thistime)->get_time(); > + onion_skin_queue.push_back(keytime); > + thistime=keytime; > + } > } > catch(...) > { } > @@ -672,6 +679,8 @@ > WorkArea::WorkArea(etl::loose_handle > canvas_interfac > ph=0.001; > last_focus_point=Point(0,0); > onion_skin=false; > + onion_skins[0]=0; > + o
[Synfig-devl] Carlos Lopez : Add code for multiple onion skins.
Module: synfig Branch: genete_canvasview Commit: 82ecc8c458140ac91907a15a7d2cda8d2164c567 URL: http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig;a=commit;h=82ecc8c458140ac91907a15a7d2cda8d2164c567 Author: Carlos Lopez Date: Wed Jul 8 15:09:50 2009 +0200 Add code for multiple onion skins. --- synfig-studio/trunk/src/gtkmm/workarea.cpp | 61 synfig-studio/trunk/src/gtkmm/workarea.h |2 + 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/workarea.cpp b/synfig-studio/trunk/src/gtkmm/workarea.cpp index 0ebd729..0d1ce1a 100644 --- a/synfig-studio/trunk/src/gtkmm/workarea.cpp +++ b/synfig-studio/trunk/src/gtkmm/workarea.cpp @@ -117,7 +117,7 @@ public: synfig::Mutex mutex; - void set_onion_skin(bool x) + void set_onion_skin(bool x, int *onions) { onionskin=x; @@ -126,26 +126,29 @@ public: if(!onionskin) return; onion_skin_queue.push_back(time); - //onion_skin_queue.push_back(time-1); - //onion_skin_queue.push_back(time+1); + try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_prev( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_prev(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_next( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_next(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } @@ -414,7 +417,7 @@ public: std::list onion_skin_queue; - void set_onion_skin(bool x) + void set_onion_skin(bool x, int *onions) { onionskin=x; @@ -427,22 +430,26 @@ public: //onion_skin_queue.push_back(time+1); try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_prev( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_prev(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } try { - onion_skin_queue.push_back( - get_canvas()->keyframe_list().find_next( - time - )->get_time() - ); + Time thistime=time; + for(int i=0; ikeyframe_list().find_next(thistime)->get_time(); + onion_skin_queue.push_back(keytime); + thistime=keytime; + } } catch(...) { } @@ -672,6 +679,8 @@ WorkArea::WorkArea(etl::loose_handle canvas_interfac ph=0.001; last_focus_point=Point(0,0); onion_skin=false; + onion_skins[0]=0; + onion_skins[1]=2; queued=false; dirty_trap_enabled=false; solid_lines=true; @@ -2289,7 +2298,7 @@ studio::WorkArea::async_update_preview() handle trgt(new class WorkAreaTarget(this,w,h)); trgt->set_rend_desc(&desc); - trgt->set_onion_skin(get_onion_skin()); + trgt->set_onion_skin(get_onion_skin(), onion_skins); target=trgt; } else @@ -2298,7 +2307,7 @@ studio::WorkArea::async_update_preview() handle trgt(new class WorkAreaTarget_Full(this,w,h)); trgt->set_rend_desc(&desc); - trgt->set_onion_skin(get_onion_skin()); + trgt->set_onion_skin(get_onion_skin(), onion_skins); target=trgt; } diff --git a/synfig-studio/trunk/src/gtkmm/workarea.h b/synfig-studio/trunk/src/gtkmm/workarea.h index 6e5ab7f..c2ec70e 100644 --- a/