X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Fsrc%2Fsynfig%2Flayer.h;h=46657f0fada96a8308251ad2e8bad5151c43e07c;hb=b56b3e2d45cf281bb0c537f40ab43c908048df01;hp=1e321b0d6003213ca1b8d9a9d942e3631d49593e;hpb=dca591b6877a1bbe0639fbf206d6dd1ff9644c60;p=synfig.git diff --git a/synfig-core/src/synfig/layer.h b/synfig-core/src/synfig/layer.h index 1e321b0..46657f0 100644 --- a/synfig-core/src/synfig/layer.h +++ b/synfig-core/src/synfig/layer.h @@ -41,7 +41,8 @@ /* === M A C R O S ========================================================= */ -//! \writeme +//! Defines various variables and the create method, common for all importers. +//! To be used in the private part of the importer class definition. #define SYNFIG_LAYER_MODULE_EXT \ public: \ static const char name__[], version__[], cvs_id__[], local_name__[], category__[]; \ @@ -67,53 +68,60 @@ #define SYNFIG_LAYER_SET_CVS_ID(class,x) \ const char class::cvs_id__[]=x -//! \writeme +//! Defines de implementation of the create method for the importer #define SYNFIG_LAYER_INIT(class) \ synfig::Layer* class::create() \ { \ return new class(); \ } -//! \writeme +//! Imports a parameter 'x' and perform an action based usually based on +//! some condition 'y' #define IMPORT_PLUS(x,y) \ if (param==#x && value.same_type_as(x)) \ { \ value.put(&x); \ + set_param_static(#x,value.get_static()); \ { \ y; \ } \ return true; \ } -//! \writeme +//! Imports a parameter 'y' if it has the same type than 'x' #define IMPORT_AS(x,y) \ if (param==y && value.same_type_as(x)) \ { \ value.put(&x); \ + set_param_static(#x,value.get_static()); \ return true; \ } -//! \writeme +//! Imports a parameter if it is of the same type as param #define IMPORT(x) \ IMPORT_AS(x,#x) -//! \writeme +//! Exports a parameter 'x' if param is same type as given 'y' #define EXPORT_AS(x,y) \ if (param==y) \ - return ValueBase(x); + { \ + synfig::ValueBase ret(x); \ + ret.set_static(get_param_static(y)); \ + return ret; \ + } -//! \writeme +//! Exports a parameter if it is the same type as value #define EXPORT(x) \ EXPORT_AS(x,#x) -//! \writeme +//! Exports the name or the local name of the layer #define EXPORT_NAME() \ if (param=="Name" || param=="name" || param=="name__") \ return name__; \ else if (param=="local_name__") \ return dgettext("synfig",local_name__); -//! \writeme +//! Exports the version of the layer #define EXPORT_VERSION() \ if (param=="Version" || param=="version" || param=="version__") \ return version__; @@ -122,6 +130,19 @@ //! It prevents these layers showing up in the menu. #define CATEGORY_DO_NOT_USE "Do Not Use" +//! x=variable name, y=static bool value +#define SET_STATIC(x,y) \ + if(param==#x && x ## _static != y) \ + { \ + x ## _static = y; \ + return true; \ + } + +#define GET_STATIC(x) \ + if(param==#x) \ + return x ## _static; \ + + /* === T Y P E D E F S ===================================================== */ /* === C L A S S E S & S T R U C T S ======================================= */ @@ -192,7 +213,7 @@ public: //! Book of types of layers indexed by layer type name. /*! While the sifz file is read, each time a new layer entry is found, - ** the factory constructor that the "factory" pointer member of the + ** the factory constructor that the "factory" pointer member of the ** "BookEntry" struct points to, is called, and a new layer of that type ** is created. ** \sa Layer::Factory @@ -203,10 +224,16 @@ public: static Book& book(); + //! Inits the book of layers and inserts in it the basic layers that + //! doesn't depend on modules + /*! \todo motionblur should be in the mod_filter module + */ static bool subsys_init(); + //! Stops the layer system by deleting the book of registered layers static bool subsys_stop(); + //! Map of Value Base parameters indexed by name typedef std::map ParamList; typedef etl::handle Handle; @@ -215,6 +242,7 @@ public: typedef etl::handle ConstHandle; + //! Map of parameters that are animated Value Nodes indexed by the param name typedef std::map > DynamicParamList; //! A list type which describes all the parameters that a layer has. @@ -235,13 +263,18 @@ private: //! Handle to the canvas to which this layer belongs etl::loose_handle canvas_; + //! Map of parameter with animated value nodes DynamicParamList dynamic_param_list_; //! A description of what this layer does String description_; - //! \writeme - float z_depth_; + //! The depth parameter of the layer in the layer stack + float z_depth; + + //! True if zdepth is not affected when in animation mode + typedef std::map Sparams; + Sparams static_params; //! \writeme mutable Time dirty_time_; @@ -249,7 +282,10 @@ private: //! Contains the name of the group that this layer belongs to String group_; - //! \writeme + //! Signal to connect to the signal_deleted canvas's member + //! Used to do let a layer with a canvas parent that doesn't exists + //! Instead of that it connects to a zero canvas + //! \see Layer::set_canvas() sigc::connection parent_death_connect_; /* @@ -327,13 +363,14 @@ public: //! Gets the name of the group that this layer belongs to String get_group()const; - //! writeme - //DynamicParamList &dynamic_param_list() { return dynamic_param_list_; } - - //! \todo writeme + //! Retrieves the dynamic param list member + //! \see DynamicParamList const DynamicParamList &dynamic_param_list()const { return dynamic_param_list_; } + //! Connects the parameter to another Value Node bool connect_dynamic_param(const String& param, etl::loose_handle); + + //! Disconnects the parameter from any Value Node bool disconnect_dynamic_param(const String& param); //! Enables the layer for rendering (Making it \em active) @@ -356,14 +393,14 @@ public: /*! Returns negative on error */ int get_depth()const; - //! \writeme - float get_z_depth()const { return z_depth_; } + //! Gets the non animated z depth of the layer + float get_z_depth()const { return z_depth; } - //! \writeme + //! Gets the z depth of the layer at a time t float get_z_depth(const synfig::Time& t)const; - //! \writeme - void set_z_depth(float x) { z_depth_=x; } + //! Sets the z depth of the layer (non animated) + void set_z_depth(float x) { z_depth=x; } //! Sets the Canvas that this Layer is a part of void set_canvas(etl::loose_handle canvas); @@ -371,10 +408,10 @@ public: //! Returns a handle to the Canvas to which this Layer belongs etl::loose_handle get_canvas()const; - //! \writeme + //! Returns the description of the layer const String& get_description()const { return description_; } - //! \writeme + //! Sets the description of the layer void set_description(const String& x); //! Returns the layer's description if it's not empty, else its local name @@ -388,8 +425,12 @@ public: */ public: + //! Returns the rectangle that includes the layer + //! \see synfig::Rect virtual Rect get_bounding_rect()const; + //!Returns the rectangle that includes the context of the layer + //!\see synfig::Rect synfig::Context virtual Rect get_full_bounding_rect(Context context)const; //! Returns a string containing the name of the Layer @@ -404,7 +445,8 @@ public: //! Gets the version string for this layer virtual String get_version()const; - //! \writeme + //! Returns a handle to the Transform class of the layer + //! \see synfig::Transform virtual etl::handle get_transform()const; //! Sets the virtual version to use for backwards-compatibility @@ -427,6 +469,10 @@ public: */ virtual bool set_param(const String ¶m, const ValueBase &value); + virtual bool set_param_static(const String ¶m, const bool x); + virtual bool get_param_static(const String ¶m) const; + virtual void fill_static(Vocab vocab); + //! Sets a list of parameters virtual bool set_param_list(const ParamList &); @@ -440,10 +486,10 @@ public: //! Get a list of all of the parameters and their values virtual ParamList get_param_list()const; - //! Sets the \a time for the selected Layer and those under it + //! Sets the \a time for the Layer and those under it /*! \param context Context iterator referring to next Layer. ** \param time writeme - ** \see Handle::set_time() + ** \see Context::set_time() */ virtual void set_time(Context context, Time time)const; @@ -451,14 +497,14 @@ public: /*! \param context Context iterator referring to next Layer. ** \param time writeme ** \param point writeme - ** \see Handle::set_time() + ** \see Context::set_time() ** \todo \a point should be of the type const Point \& */ virtual void set_time(Context context, Time time, const Point &point)const; - //! Gets the color of the Canvas at \a pos + //! Gets the blend color of the Layer in the context at \a pos /*! \param context Context iterator referring to next Layer. ** \param pos Point which indicates where the Color should come from - ** \see Handle::get_color() + ** \see Context::get_color() */ virtual Color get_color(Context context, const Point &pos)const; @@ -469,7 +515,7 @@ public: ** \param renddesc The associated RendDesc. ** \param cb Pointer to callback object. May be NULL if there is no callback. ** \return \c true on success, \c false on failure - ** \see Handle::accelerated_render() + ** \see Context::accelerated_render() */ virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const; @@ -477,7 +523,9 @@ public: /*! \param context Context iterator referring to next Layer. ** \param point The point to check ** \return The handle of the layer under \a point. If there is not - ** a layer under \a point, then returns an empty handle. */ + ** a layer under \a point, then returns an empty handle. + ** \see Context::hit_check + */ virtual Handle hit_check(Context context, const Point &point)const; //! Duplicates the Layer