From: Carlos Lopez Date: Wed, 1 Sep 2010 15:32:44 +0000 (+0200) Subject: Merge branch 'genete_static_values' X-Git-Url: https://git.pterodactylus.net/?p=synfig.git;a=commitdiff_plain;h=d43ed398fd84b93b96eb91d91dafdf65c80537e6;hp=26f78d052cedf01a267206f31f20bac8eaaa2c89 Merge branch 'genete_static_values' --- diff --git a/synfig-core/po/POTFILES.in b/synfig-core/po/POTFILES.in index 65c7398..342fec3 100644 --- a/synfig-core/po/POTFILES.in +++ b/synfig-core/po/POTFILES.in @@ -32,6 +32,8 @@ src/modules/lyr_std/sphere_distort.cpp src/modules/lyr_std/sphere_distort.h src/modules/lyr_std/stretch.cpp src/modules/lyr_std/stretch.h +src/modules/lyr_std/stroboscope.cpp +src/modules/lyr_std/stroboscope.h src/modules/lyr_std/supersample.cpp src/modules/lyr_std/supersample.h src/modules/lyr_std/timeloop.cpp diff --git a/synfig-core/src/modules/lyr_std/Makefile.am b/synfig-core/src/modules/lyr_std/Makefile.am index 786d76d..8dc51b1 100644 --- a/synfig-core/src/modules/lyr_std/Makefile.am +++ b/synfig-core/src/modules/lyr_std/Makefile.am @@ -51,7 +51,9 @@ liblyr_std_la_SOURCES = \ sphere_distort.h \ sphere_distort.cpp \ curvewarp.cpp \ - curvewarp.h + curvewarp.h \ + stroboscope.cpp \ + stroboscope.h liblyr_std_la_CXXFLAGS = \ @SYNFIG_CFLAGS@ diff --git a/synfig-core/src/modules/lyr_std/import.cpp b/synfig-core/src/modules/lyr_std/import.cpp index d393f59..d37eecf 100644 --- a/synfig-core/src/modules/lyr_std/import.cpp +++ b/synfig-core/src/modules/lyr_std/import.cpp @@ -165,7 +165,7 @@ Import::set_param(const String & param, const ValueBase &value) } surface.clear(); - if(!newimporter->get_frame(surface,Time(0),trimmed,width,height,top,left)) + if(!newimporter->get_frame(surface,get_canvas()->rend_desc(),Time(0),trimmed,width,height,top,left)) { synfig::warning(strprintf("Unable to get frame from \"%s\"",filename_with_path.c_str())); } @@ -228,7 +228,7 @@ Import::set_time(Context context, Time time)const { if(get_amount() && importer && importer->is_animated()) - importer->get_frame(surface,time+time_offset,trimmed,width,height,top,left); + importer->get_frame(surface,get_canvas()->rend_desc(),time+time_offset,trimmed,width,height,top,left); context.set_time(time); } @@ -238,7 +238,7 @@ Import::set_time(Context context, Time time, const Point &pos)const { if(get_amount() && importer && importer->is_animated()) - importer->get_frame(surface,time+time_offset,trimmed,width,height,top,left); + importer->get_frame(surface,get_canvas()->rend_desc(),time+time_offset,trimmed,width,height,top,left); context.set_time(time,pos); } diff --git a/synfig-core/src/modules/lyr_std/main.cpp b/synfig-core/src/modules/lyr_std/main.cpp index faa0d7a..27c7000 100644 --- a/synfig-core/src/modules/lyr_std/main.cpp +++ b/synfig-core/src/modules/lyr_std/main.cpp @@ -67,6 +67,7 @@ #include "warp.h" #include "timeloop.h" #include "curvewarp.h" +#include "stroboscope.h" #endif @@ -98,6 +99,7 @@ MODULE_INVENTORY_BEGIN(liblyr_std) LAYER(Layer_Shade) LAYER(Layer_Bevel) LAYER(Layer_TimeLoop) + LAYER(Layer_Stroboscope) LAYER(Layer_SphereDistort) LAYER(CurveWarp) END_LAYERS diff --git a/synfig-core/src/modules/lyr_std/stroboscope.cpp b/synfig-core/src/modules/lyr_std/stroboscope.cpp new file mode 100644 index 0000000..9156d1b --- /dev/null +++ b/synfig-core/src/modules/lyr_std/stroboscope.cpp @@ -0,0 +1,128 @@ +/* === S Y N F I G ========================================================= */ +/*! \file stroboscope.cpp +** \brief Implementation of the "Stroboscope" layer +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007, 2008 Chris Moore +** Copyright (c) 2009 Ray Frederikson +** +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +** +** === N O T E S =========================================================== +** +** ========================================================================= */ + +/* === H E A D E R S ======================================================= */ + +#ifdef USING_PCH +# include "pch.h" +#else +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "stroboscope.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif + +using namespace synfig; +using namespace std; +using namespace etl; + +/* === M A C R O S ========================================================= */ + +/* === G L O B A L S ======================================================= */ + +SYNFIG_LAYER_INIT(Layer_Stroboscope); +SYNFIG_LAYER_SET_NAME(Layer_Stroboscope,"stroboscope"); +SYNFIG_LAYER_SET_LOCAL_NAME(Layer_Stroboscope,N_("Stroboscope")); +SYNFIG_LAYER_SET_CATEGORY(Layer_Stroboscope,N_("Other")); +SYNFIG_LAYER_SET_VERSION(Layer_Stroboscope,"0.1"); +SYNFIG_LAYER_SET_CVS_ID(Layer_Stroboscope,"$Id$"); + +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +Layer_Stroboscope::Layer_Stroboscope() +{ + frequency=2.0; +} + +Layer_Stroboscope::~Layer_Stroboscope() +{ +} + +bool +Layer_Stroboscope::set_param(const String & param, const ValueBase &value) +{ + IMPORT(frequency); + + return Layer::set_param(param,value); +} + +ValueBase +Layer_Stroboscope::get_param(const String & param)const +{ + EXPORT(frequency); + EXPORT_NAME(); + EXPORT_VERSION(); + + return Layer::get_param(param); +} + +Layer::Vocab +Layer_Stroboscope::get_param_vocab()const +{ + Layer::Vocab ret(Layer::get_param_vocab()); + + ret.push_back(ParamDesc("frequency") + .set_local_name(_("Frequency")) + .set_description(_("Frequency of the Strobe in times per second")) + ); + + return ret; +} + +void +Layer_Stroboscope::set_time(Context context, Time t)const +{ + Time ret_time=Time::begin(); + if(frequency > 0.0) + ret_time = Time(1.0)/frequency*floor(t*frequency); + + context.set_time(ret_time); +} + +Color +Layer_Stroboscope::get_color(Context context, const Point &pos)const +{ + return context.get_color(pos); +} + +bool +Layer_Stroboscope::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const +{ + return context.accelerated_render(surface,quality,renddesc,cb); +} diff --git a/synfig-core/src/modules/lyr_std/stroboscope.h b/synfig-core/src/modules/lyr_std/stroboscope.h new file mode 100644 index 0000000..029f2dd --- /dev/null +++ b/synfig-core/src/modules/lyr_std/stroboscope.h @@ -0,0 +1,69 @@ +/* === S Y N F I G ========================================================= */ +/*! \file stroboscope.h +** \brief Header file for implementation of the "Stroboscope" layer +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2008 Chris Moore +** Copyright (c) 2009 Ray Frederikson +** +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === S T A R T =========================================================== */ + +#ifndef __SYNFIG_STROBOSCOPE_H +#define __SYNFIG_STROBOSCOPE_H + +/* === H E A D E R S ======================================================= */ + +#include +#include +#include +#include + +/* === M A C R O S ========================================================= */ + +/* === T Y P E D E F S ===================================================== */ + +/* === C L A S S E S & S T R U C T S ======================================= */ + +class Layer_Stroboscope : public synfig::Layer +{ + SYNFIG_LAYER_MODULE_EXT + +private: + float frequency; + +protected: + Layer_Stroboscope(); + +public: + ~Layer_Stroboscope(); + + virtual bool set_param(const synfig::String & param, const synfig::ValueBase &value); + + virtual synfig::ValueBase get_param(const synfig::String & param)const; + + virtual Vocab get_param_vocab()const; + virtual synfig::Color get_color(synfig::Context context, const synfig::Point &pos)const; + + virtual void set_time(synfig::Context context, synfig::Time time)const; + virtual bool accelerated_render(synfig::Context context,synfig::Surface *surface,int quality, const synfig::RendDesc &renddesc, synfig::ProgressCallback *cb)const; +}; + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-core/src/modules/mod_bmp/mptr_bmp.cpp b/synfig-core/src/modules/mod_bmp/mptr_bmp.cpp index d8c07b7..26b950c 100644 --- a/synfig-core/src/modules/mod_bmp/mptr_bmp.cpp +++ b/synfig-core/src/modules/mod_bmp/mptr_bmp.cpp @@ -123,7 +123,7 @@ bmp_mptr::~bmp_mptr() } bool -bmp_mptr::get_frame(synfig::Surface &surface,Time /*time*/, synfig::ProgressCallback *cb) +bmp_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time /*time*/, synfig::ProgressCallback *cb) { FILE *file=fopen(filename.c_str(),"rb"); if(!file) diff --git a/synfig-core/src/modules/mod_bmp/mptr_bmp.h b/synfig-core/src/modules/mod_bmp/mptr_bmp.h index e7257bb..3833ef0 100644 --- a/synfig-core/src/modules/mod_bmp/mptr_bmp.h +++ b/synfig-core/src/modules/mod_bmp/mptr_bmp.h @@ -51,7 +51,7 @@ public: bmp_mptr(const char *filename); ~bmp_mptr(); - virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback); + virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback); }; /* === E N D =============================================================== */ diff --git a/synfig-core/src/modules/mod_ffmpeg/mptr_ffmpeg.cpp b/synfig-core/src/modules/mod_ffmpeg/mptr_ffmpeg.cpp index f837c7b..1d7b3bb 100644 --- a/synfig-core/src/modules/mod_ffmpeg/mptr_ffmpeg.cpp +++ b/synfig-core/src/modules/mod_ffmpeg/mptr_ffmpeg.cpp @@ -258,7 +258,7 @@ ffmpeg_mptr::~ffmpeg_mptr() } bool -ffmpeg_mptr::get_frame(synfig::Surface &surface,Time time, synfig::ProgressCallback *) +ffmpeg_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time time, synfig::ProgressCallback *) { int i=(int)(time*fps); if(i!=cur_frame) diff --git a/synfig-core/src/modules/mod_ffmpeg/mptr_ffmpeg.h b/synfig-core/src/modules/mod_ffmpeg/mptr_ffmpeg.h index 3e53931..ccf09e8 100644 --- a/synfig-core/src/modules/mod_ffmpeg/mptr_ffmpeg.h +++ b/synfig-core/src/modules/mod_ffmpeg/mptr_ffmpeg.h @@ -69,7 +69,7 @@ public: virtual bool is_animated(); - virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback); + virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback); }; /* === E N D =============================================================== */ diff --git a/synfig-core/src/modules/mod_imagemagick/mptr_imagemagick.cpp b/synfig-core/src/modules/mod_imagemagick/mptr_imagemagick.cpp index 2860c1f..d1c6428 100644 --- a/synfig-core/src/modules/mod_imagemagick/mptr_imagemagick.cpp +++ b/synfig-core/src/modules/mod_imagemagick/mptr_imagemagick.cpp @@ -93,7 +93,7 @@ imagemagick_mptr::~imagemagick_mptr() } bool -imagemagick_mptr::get_frame(synfig::Surface &surface,Time /*time*/, synfig::ProgressCallback *cb) +imagemagick_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time /*time*/, synfig::ProgressCallback *cb) { //#define HAS_LIBPNG 1 @@ -159,7 +159,7 @@ imagemagick_mptr::get_frame(synfig::Surface &surface,Time /*time*/, synfig::Prog return false; } - if(!importer->get_frame(surface,0,cb)) + if(!importer->get_frame(surface,renddesc,0,cb)) { if(cb)cb->error(_("Unable to get frame from ")+temp_file); else synfig::error(_("Unable to get frame from ")+temp_file); diff --git a/synfig-core/src/modules/mod_imagemagick/mptr_imagemagick.h b/synfig-core/src/modules/mod_imagemagick/mptr_imagemagick.h index fcd8bdb..8eabdbe 100644 --- a/synfig-core/src/modules/mod_imagemagick/mptr_imagemagick.h +++ b/synfig-core/src/modules/mod_imagemagick/mptr_imagemagick.h @@ -54,7 +54,7 @@ public: ~imagemagick_mptr(); - virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback); + virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback); }; /* === E N D =============================================================== */ diff --git a/synfig-core/src/modules/mod_jpeg/mptr_jpeg.cpp b/synfig-core/src/modules/mod_jpeg/mptr_jpeg.cpp index 84f5403..a7dd47f 100644 --- a/synfig-core/src/modules/mod_jpeg/mptr_jpeg.cpp +++ b/synfig-core/src/modules/mod_jpeg/mptr_jpeg.cpp @@ -249,7 +249,7 @@ jpeg_mptr::~jpeg_mptr() } bool -jpeg_mptr::get_frame(synfig::Surface &surface,Time, synfig::ProgressCallback */*cb*/) +jpeg_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time, synfig::ProgressCallback */*cb*/) { surface=surface_buffer; return true; diff --git a/synfig-core/src/modules/mod_jpeg/mptr_jpeg.h b/synfig-core/src/modules/mod_jpeg/mptr_jpeg.h index 416d827..282353b 100644 --- a/synfig-core/src/modules/mod_jpeg/mptr_jpeg.h +++ b/synfig-core/src/modules/mod_jpeg/mptr_jpeg.h @@ -59,7 +59,7 @@ public: jpeg_mptr(const char *filename); ~jpeg_mptr(); - virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback); + virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback); }; /* === E N D =============================================================== */ diff --git a/synfig-core/src/modules/mod_libavcodec/mptr.cpp b/synfig-core/src/modules/mod_libavcodec/mptr.cpp index 4c9bfb8..6b59cda 100644 --- a/synfig-core/src/modules/mod_libavcodec/mptr.cpp +++ b/synfig-core/src/modules/mod_libavcodec/mptr.cpp @@ -64,7 +64,7 @@ Importer_LibAVCodec::~Importer_LibAVCodec() } bool -Importer_LibAVCodec::get_frame(synfig::Surface &/*surface*/,Time, synfig::ProgressCallback */*cb*/) +Importer_LibAVCodec::get_frame(synfig::Surface &/*surface*/, const synfig::RendDesc &renddesc, Time, synfig::ProgressCallback */*cb*/) { return false; } diff --git a/synfig-core/src/modules/mod_libavcodec/mptr.h b/synfig-core/src/modules/mod_libavcodec/mptr.h index f7cb41f..e2ffbc1 100644 --- a/synfig-core/src/modules/mod_libavcodec/mptr.h +++ b/synfig-core/src/modules/mod_libavcodec/mptr.h @@ -49,7 +49,7 @@ public: Importer_LibAVCodec(const char *filename); ~Importer_LibAVCodec(); - virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback); + virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback); }; /* === E N D =============================================================== */ diff --git a/synfig-core/src/modules/mod_openexr/mptr_openexr.cpp b/synfig-core/src/modules/mod_openexr/mptr_openexr.cpp index d29719e..27a667c 100644 --- a/synfig-core/src/modules/mod_openexr/mptr_openexr.cpp +++ b/synfig-core/src/modules/mod_openexr/mptr_openexr.cpp @@ -72,7 +72,7 @@ exr_mptr::~exr_mptr() } bool -exr_mptr::get_frame(synfig::Surface &out_surface,Time, synfig::ProgressCallback *cb) +exr_mptr::get_frame(synfig::Surface &out_surface, const synfig::RendDesc &renddesc, Time, synfig::ProgressCallback *cb) { try { diff --git a/synfig-core/src/modules/mod_openexr/mptr_openexr.h b/synfig-core/src/modules/mod_openexr/mptr_openexr.h index 2ab295f..2b88847 100644 --- a/synfig-core/src/modules/mod_openexr/mptr_openexr.h +++ b/synfig-core/src/modules/mod_openexr/mptr_openexr.h @@ -51,7 +51,7 @@ public: - virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback); + virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback); }; diff --git a/synfig-core/src/modules/mod_png/mptr_png.cpp b/synfig-core/src/modules/mod_png/mptr_png.cpp index 748801d..ec601b5 100644 --- a/synfig-core/src/modules/mod_png/mptr_png.cpp +++ b/synfig-core/src/modules/mod_png/mptr_png.cpp @@ -407,7 +407,7 @@ png_mptr::~png_mptr() } bool -png_mptr::get_frame(synfig::Surface &surface,Time, synfig::ProgressCallback */*cb*/) +png_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time, synfig::ProgressCallback */*cb*/) { //assert(0); // shouldn't be called? surface=surface_buffer; @@ -415,7 +415,7 @@ png_mptr::get_frame(synfig::Surface &surface,Time, synfig::ProgressCallback */*c } bool -png_mptr::get_frame(synfig::Surface &surface,Time, +png_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time, bool &trimmed, unsigned int &width, unsigned int &height, unsigned int &top, unsigned int &left, synfig::ProgressCallback */*cb*/) { diff --git a/synfig-core/src/modules/mod_png/mptr_png.h b/synfig-core/src/modules/mod_png/mptr_png.h index b348964..689326f 100644 --- a/synfig-core/src/modules/mod_png/mptr_png.h +++ b/synfig-core/src/modules/mod_png/mptr_png.h @@ -62,8 +62,8 @@ public: png_mptr(const char *filename); ~png_mptr(); - virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback); - virtual bool get_frame(synfig::Surface &surface,synfig::Time time, + virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback); + virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, bool &trimmed, unsigned int &width, unsigned int &height, unsigned int &top, unsigned int &left, synfig::ProgressCallback *callback); }; diff --git a/synfig-core/src/modules/mod_ppm/mptr_ppm.cpp b/synfig-core/src/modules/mod_ppm/mptr_ppm.cpp index 6900c93..9db3c0b 100644 --- a/synfig-core/src/modules/mod_ppm/mptr_ppm.cpp +++ b/synfig-core/src/modules/mod_ppm/mptr_ppm.cpp @@ -70,7 +70,7 @@ ppm_mptr::~ppm_mptr() } bool -ppm_mptr::get_frame(synfig::Surface &surface,Time, synfig::ProgressCallback *cb) +ppm_mptr::get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, Time, synfig::ProgressCallback *cb) { SmartFILE file(fopen(filename.c_str(),"rb")); if(!file) diff --git a/synfig-core/src/modules/mod_ppm/mptr_ppm.h b/synfig-core/src/modules/mod_ppm/mptr_ppm.h index 64095b5..0c6f119 100644 --- a/synfig-core/src/modules/mod_ppm/mptr_ppm.h +++ b/synfig-core/src/modules/mod_ppm/mptr_ppm.h @@ -47,7 +47,7 @@ public: ppm_mptr(const char *filename); ~ppm_mptr(); - virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback); + virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback); }; // END of class ppm_mptr /* === E N D =============================================================== */ diff --git a/synfig-core/src/synfig/context.cpp b/synfig-core/src/synfig/context.cpp index 28d8e41..4da071e 100644 --- a/synfig-core/src/synfig/context.cpp +++ b/synfig-core/src/synfig/context.cpp @@ -321,11 +321,13 @@ Context::set_time(Time time)const while(!(context)->empty()) { // If this layer is active, and - // it either isn't already set to the given time or - // it's a time loop layer, + // it either isn't already set to the given time + // or it's a stroboscope layer, + // or it's a time loop layer, // then break out of the loop and set its time if((*context)->active() && (!(*context)->dirty_time_.is_equal(time) || + (*context)->get_name() == "stroboscope" || (*context)->get_name() == "timeloop")) break; diff --git a/synfig-core/src/synfig/importer.h b/synfig-core/src/synfig/importer.h index 6185ab5..7244f2c 100644 --- a/synfig-core/src/synfig/importer.h +++ b/synfig-core/src/synfig/importer.h @@ -33,6 +33,7 @@ #include "string.h" #include "time.h" #include "gamma.h" +#include "renddesc.h" /* === M A C R O S ========================================================= */ @@ -124,8 +125,8 @@ public: ** \return \c true on success, \c false on error ** \see ProgressCallback, Surface */ - virtual bool get_frame(Surface &surface,Time time, ProgressCallback *callback=NULL)=0; - virtual bool get_frame(Surface &surface,Time time, + virtual bool get_frame(Surface &surface, const RendDesc &renddesc, Time time, ProgressCallback *callback=NULL)=0; + virtual bool get_frame(Surface &surface, const RendDesc &renddesc,Time time, bool &trimmed __attribute__ ((unused)), unsigned int &width __attribute__ ((unused)), unsigned int &height __attribute__ ((unused)), @@ -133,7 +134,7 @@ public: unsigned int &left __attribute__ ((unused)), ProgressCallback *callback=NULL) { - return get_frame(surface,time,callback); + return get_frame(surface,renddesc,time,callback); } //! Returns \c true if the importer pays attention to the \a time parameter of get_frame() diff --git a/synfig-core/src/synfig/listimporter.cpp b/synfig-core/src/synfig/listimporter.cpp index 02680f0..b5d5f44 100644 --- a/synfig-core/src/synfig/listimporter.cpp +++ b/synfig-core/src/synfig/listimporter.cpp @@ -150,9 +150,11 @@ ListImporter::~ListImporter() } bool -ListImporter::get_frame(Surface &surface,Time time, ProgressCallback *cb) +ListImporter::get_frame(Surface &surface, const RendDesc &renddesc, Time time, ProgressCallback *cb) { - int frame=round_to_int(time*fps); + float document_fps=renddesc.get_frame_rate(); + int document_frame=round_to_int(time*document_fps); + int frame=floor_to_int(document_frame*fps/document_fps); if(!filename_list.size()) { @@ -184,7 +186,7 @@ ListImporter::get_frame(Surface &surface,Time time, ProgressCallback *cb) return false; } - if(!importer->get_frame(surface,0,cb)) + if(!importer->get_frame(surface,renddesc,0,cb)) { if(cb)cb->error(_("Unable to get frame from ")+filename_list[frame]); else synfig::error(_("Unable to get frame from ")+filename_list[frame]); diff --git a/synfig-core/src/synfig/listimporter.h b/synfig-core/src/synfig/listimporter.h index 090570f..2a40fc5 100644 --- a/synfig-core/src/synfig/listimporter.h +++ b/synfig-core/src/synfig/listimporter.h @@ -59,7 +59,7 @@ public: virtual ~ListImporter(); - virtual bool get_frame(Surface &surface,Time time, ProgressCallback *callback=NULL); + virtual bool get_frame(Surface &surface, const RendDesc &renddesc, Time time, ProgressCallback *callback=NULL); virtual bool is_animated(); diff --git a/synfig-studio/src/synfigapp/actions/valuedescexport.cpp b/synfig-studio/src/synfigapp/actions/valuedescexport.cpp index 65252cf..b9fedcb 100644 --- a/synfig-studio/src/synfigapp/actions/valuedescexport.cpp +++ b/synfig-studio/src/synfigapp/actions/valuedescexport.cpp @@ -104,20 +104,19 @@ Action::ValueDescExport::is_candidate(const ParamList &x) if(candidate_check(get_param_vocab(),x)) { ValueDesc value_desc=x.find("value_desc")->second.get_value_desc(); - if(!value_desc || - value_desc.parent_is_canvas() || - (value_desc.is_value_node() && value_desc.get_value_node()->is_exported()) || - (value_desc.get_value_type()==ValueBase::TYPE_CANVAS && !value_desc.get_value().get(Canvas::Handle())->is_inline())) + if(!value_desc) + return false; + if(value_desc.get_value_type()==ValueBase::TYPE_CANVAS) + if(!value_desc.get_value().get(Canvas::Handle())) + return false; + if( + value_desc.parent_is_canvas() + || + (value_desc.is_value_node() && value_desc.get_value_node()->is_exported()) + || + (value_desc.get_value_type()==ValueBase::TYPE_CANVAS && !value_desc.get_value().get(Canvas::Handle())->is_inline()) + ) { -// if (!value_desc) -// synfig::info("%s:%d no export because no value_desc", __FILE__, __LINE__); -// else if (value_desc.parent_is_canvas()) -// synfig::info("%s:%d no export because parent is canvas", __FILE__, __LINE__); -// else if (value_desc.is_value_node() && value_desc.get_value_node()->is_exported()) -// synfig::info("%s:%d no export because exported value node", __FILE__, __LINE__); -// else if (value_desc.get_value_type()==ValueBase::TYPE_CANVAS && !value_desc.get_value().get(Canvas::Handle())->is_inline()) -// synfig::info("%s:%d no export because canvas isn't inline", __FILE__, __LINE__); - return false; } return true;