X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fvaluenode.h;h=4f9187394e34052d1151b5fa80d25355ada196fa;hb=515a8fd01a0b1229899edaf13ca2c2de1d1d81cf;hp=145a3ddf63ef50b46b46db602fde72d83f2e1dd4;hpb=cc54c38609ee9745ad678e5e9b9d7d2912be9c95;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/valuenode.h b/synfig-core/trunk/src/synfig/valuenode.h index 145a3dd..4f91873 100644 --- a/synfig-core/trunk/src/synfig/valuenode.h +++ b/synfig-core/trunk/src/synfig/valuenode.h @@ -1,6 +1,6 @@ /* === S Y N F I G ========================================================= */ /*! \file valuenode.h -** \brief Template Header +** \brief Header file for implementation of the "Placeholder" valuenode conversion. ** ** $Id$ ** @@ -59,6 +59,28 @@ # define DCAST_HACK_ENABLE() #endif +#define CHECK_TYPE_AND_SET_VALUE(variable, type) \ + /* I don't think this ever happens - maybe remove this code? */ \ + if (get_type() == ValueBase::TYPE_NIL) { \ + warning("%s:%d get_type() IS nil sometimes!", \ + __FILE__, __LINE__); \ + return false; \ + } \ + if (get_type() != ValueBase::TYPE_NIL && \ + !(ValueBase::same_type_as(value->get_type(), type)) && \ + !PlaceholderValueNode::Handle::cast_dynamic(value)) { \ + error("%s:%d wrong type for %s: need %s but got %s", \ + __FILE__, __LINE__, \ + link_local_name(i).c_str(), \ + ValueBase::type_name(type).c_str(), \ + ValueBase::type_name(value->get_type()).c_str()); \ + return false; \ + } \ + variable = value; \ + signal_child_changed()(i); \ + signal_value_changed()(); \ + return true + /* === T Y P E D E F S ===================================================== */ /* === C L A S S E S & S T R U C T S ======================================= */ @@ -173,7 +195,7 @@ public: public: //! Returns the value of the ValueNode at time \a t - virtual ValueBase operator()(Time t)const + virtual ValueBase operator()(Time /*t*/)const { return ValueBase(); } //! \internal Sets the id of the ValueNode @@ -256,7 +278,7 @@ public: static Handle create(ValueBase::Type type=ValueBase::TYPE_NIL); protected: - virtual void get_times_vfunc(Node::time_set &set) const {} + virtual void get_times_vfunc(Node::time_set &/*set*/) const {} }; // END of class PlaceholderValueNode