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 <ge...@ballintijn.com> escribió:

> De: Gerco Ballintijn <ge...@ballintijn.com>
> 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 <car...@pcnuevo.(none)>
> > 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<onions[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<onions[1]; 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<synfig::Time>
> 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<onions[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<onions[1]; 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<synfigapp::CanvasInterface>
> 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<WorkAreaTarget> 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<WorkAreaTarget_Full> 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-studio/trunk/src/gtkmm/workarea.h
> > +++ b/synfig-studio/trunk/src/gtkmm/workarea.h
> > @@ -235,6 +235,8 @@ private:
> >  
> >  
> >      bool onion_skin;
> > +    //! stores the future [1] and past
> [0] onion skins based on keyframes
> > +    int onion_skins[2];
> >  
> >     
> etl::loose_handle<synfig::ValueNode>
> selected_value_node_;
> >  
> > 
> > 
> >
> ------------------------------------------------------------------------------
> > Enter the BlackBerry Developer Challenge  
> > This is your chance to win up to $100,000 in prizes!
> For a limited time, 
> > vendors submitting new applications to BlackBerry App
> World(TM) will have
> > the opportunity to enter the BlackBerry Developer
> Challenge. See full prize  
> > details at: http://p.sf.net/sfu/Challenge
> > _______________________________________________
> > Synfig-devl mailing list
> > Synfig-devl@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/synfig-devl
> 
> 
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a
> limited time, 
> vendors submitting new applications to BlackBerry App
> World(TM) will have
> the opportunity to enter the BlackBerry Developer
> Challenge. See full prize  
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Synfig-devl mailing list
> Synfig-devl@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/synfig-devl
> 


      

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to