70 if ( p_type ==
moText(
"ALPHA") ) {
73 if ( p_type ==
moText(
"COLOR") ) {
76 if ( p_type ==
moText(
"BLENDING") ) {
79 if ( p_type ==
moText(
"POLYGONMODE") ) {
82 if ( p_type ==
moText(
"SYNC") ) {
85 if ( p_type ==
moText(
"PHASE") ) {
88 if ( p_type ==
moText(
"TEXT") ) {
91 if ( p_type ==
moText(
"TEXTURE") ) {
94 if ( p_type ==
moText(
"TEXTUREFOLDER") ) {
97 if ( p_type ==
moText(
"FONT") ) {
100 if ( p_type ==
moText(
"3DMODEL") ) {
103 if ( p_type ==
moText(
"MOLDEOOBJECT") ) {
106 if ( p_type ==
moText(
"OBJECT") ) {
109 if ( p_type ==
moText(
"VIDEO") ) {
112 if ( p_type ==
moText(
"FILTER") ) {
115 if ( p_type ==
moText(
"SOUND") ) {
118 if ( p_type ==
moText(
"NUM") ) {
121 if ( p_type ==
moText(
"FUNCTION") ) {
124 if ( p_type ==
moText(
"TRANSLATEX") ) {
127 if ( p_type ==
moText(
"TRANSLATEY") ) {
130 if ( p_type ==
moText(
"TRANSLATEZ") ) {
133 if ( p_type ==
moText(
"SCALEX") ) {
136 if ( p_type ==
moText(
"SCALEY") ) {
139 if ( p_type ==
moText(
"SCALEZ") ) {
142 if ( p_type ==
moText(
"ROTATEX") ) {
145 if ( p_type ==
moText(
"ROTATEY") ) {
148 if ( p_type ==
moText(
"ROTATEZ") ) {
151 if ( p_type ==
moText(
"SCRIPT") ) {
154 if ( p_type ==
moText(
"COMPOSE") ) {
157 if ( p_type ==
moText(
"VECTOR") ) {
160 if ( p_type ==
moText(
"INLET") ) {
163 if ( p_type ==
moText(
"OUTLET") ) {
166 if ( p_type ==
moText(
"UNDEFINED") ) {
199 const moText& p_interpolation,
201 const moText& p_optionsstr ) {
208 bool valid_interpolation =
false;
209 if ( p_type ==
moText(
"ALPHA") ) {
211 valid_interpolation =
true;
213 if ( p_type ==
moText(
"COLOR") ) {
215 valid_interpolation =
false;
217 if ( p_type ==
moText(
"BLENDING") ) {
220 if ( p_type ==
moText(
"POLYGONMODE") ) {
223 if ( p_type ==
moText(
"SYNC") ) {
225 valid_interpolation =
true;
227 if ( p_type ==
moText(
"PHASE") ) {
229 valid_interpolation =
true;
231 if ( p_type ==
moText(
"TEXT") ) {
234 if ( p_type ==
moText(
"TEXTURE") ) {
237 if ( p_type ==
moText(
"TEXTUREFOLDER") ) {
240 if ( p_type ==
moText(
"FONT") ) {
243 if ( p_type ==
moText(
"3DMODEL") ) {
246 if ( p_type ==
moText(
"MOLDEOOBJECT") ) {
249 if ( p_type ==
moText(
"OBJECT") ) {
252 if ( p_type ==
moText(
"VIDEO") ) {
255 if ( p_type ==
moText(
"FILTER") ) {
258 if ( p_type ==
moText(
"SOUND") ) {
261 if ( p_type ==
moText(
"NUM") ) {
263 valid_interpolation =
true;
265 if ( p_type ==
moText(
"FUNCTION") ) {
267 valid_interpolation =
true;
269 if ( p_type ==
moText(
"TRANSLATEX") ) {
271 valid_interpolation =
true;
273 if ( p_type ==
moText(
"TRANSLATEY") ) {
275 valid_interpolation =
true;
277 if ( p_type ==
moText(
"TRANSLATEZ") ) {
279 valid_interpolation =
true;
281 if ( p_type ==
moText(
"SCALEX") ) {
283 valid_interpolation =
true;
285 if ( p_type ==
moText(
"SCALEY") ) {
287 valid_interpolation =
true;
289 if ( p_type ==
moText(
"SCALEZ") ) {
291 valid_interpolation =
true;
293 if ( p_type ==
moText(
"ROTATEX") ) {
295 valid_interpolation =
true;
297 if ( p_type ==
moText(
"ROTATEY") ) {
299 valid_interpolation =
true;
301 if ( p_type ==
moText(
"ROTATEZ") ) {
303 valid_interpolation =
true;
305 if ( p_type ==
moText(
"SCRIPT") ) {
308 if ( p_type ==
moText(
"COMPOSE") ) {
311 if ( p_type ==
moText(
"VECTOR") ) {
314 if ( p_type ==
moText(
"INLET") ) {
317 if ( p_type ==
moText(
"OUTLET") ) {
320 if ( p_type ==
moText(
"UNDEFINED") ) {
327 if (valid_interpolation) {
329 if ( p_interpolation ==
"linear" ) {
334 }
else if (p_interpolation==
moText(
"easeinoutquad") ) {
337 }
else if (p_interpolation==
moText(
"easeinoutsin") ) {
348 if ( p_optionsstr.
Length() > 0 ) {
359 const moText& p_interpolation,
361 const moTextArray& p_Options ) {
362 (*this) =
moParamDefinition(p_name,p_type,p_property,p_group,p_interpolation,p_duration);
389 return moText(
"UNDEFINED");
398 return moText(
"BLENDING");
401 return moText(
"POLYGONMODE");
416 return moText(
"TEXTUREFOLDER");
425 return moText(
"MOLDEOOBJECT");
437 return moText(
"FUNCTION");
440 return moText(
"TRANSLATEX");
443 return moText(
"TRANSLATEY");
446 return moText(
"TRANSLATEZ");
493 return moText(
"UNDEFINED");
507 moValue Default = p_defaultvalue;
566 m_DefaultValue =
moValue(
"composed by",
"TXT",
"1.0",
"FUNCTION",
"<nada></nada>",
"XML",
"12345",
"INT" );
590 for(
int i=0; i<(int)
m_Options.Count(); i++ ) {
606 moText fieldseparation =
",";
616 fieldseparation =
"";
617 for(
int i=0; i<(int)
m_Options.Count(); i++ ) {
625 fieldseparation =
",";
636 moText fieldseparation =
" ";
654 TiXmlDocument m_XMLDoc;
656 TiXmlEncoding xencoding = TIXML_ENCODING_LEGACY;
658 m_XMLDoc.Parse((
const char*) p_XmlText, 0, xencoding );
661 TiXmlElement* definitionNode = m_XMLDoc.FirstChildElement(
"moParamDefinition");
666 if (definitionNode) {
669 m_Index = atoi(
moText( definitionNode->Attribute(
"index") ));
756 const moText& p_fun_duration,
757 const moText& p_fun_expression) {
758 if ( p_interpol_fun ==
"linear" ) {
761 }
else if (p_interpol_fun==
moText(
"ease") ) {
764 }
else if (p_interpol_fun==
moText(
"easein") ) {
767 }
else if (p_interpol_fun==
moText(
"easeout") ) {
770 }
else if (p_interpol_fun==
moText(
"easeinout") ) {
773 }
else if (p_interpol_fun==
moText(
"stepstart") ) {
776 }
else if (p_interpol_fun==
moText(
"stepend") ) {
779 }
else if (p_interpol_fun==
moText(
"expression") ) {
782 }
else if (p_interpol_fun==
moText(
"easeinoutquad") ) {
785 }
else if (p_interpol_fun==
moText(
"easeinoutsin") ) {
788 }
else if (p_interpol_fun==
moText(
"easeinoutcubic") ) {
817 return moText(
"easeinout");
820 return moText(
"cubicbezer");
823 return moText(
"easeinoutcubic");
826 return moText(
"stepstart");
832 return moText(
"easeinoutquad");
835 return moText(
"expression");
838 return moText(
"easeinoutsin");
850 const moText& p_fun_duration,
851 const moText& p_fun_expression) {
853 if (p_fun_expression!=
moText(
"")) {
854 cout <<
"p_fun_expression: " << p_fun_expression << endl;
857 if (p_fun_duration!=
"") {
859 mp_dur.
Init( p_fun_duration );
900 return t * (Cx + t * (Bx + t * Ax));
904 return t * (Cy + t * (By + t * Ay));
908 return Cx + t * (2*Bx + 3*Ax * t);
918 if ( fabs(z) < 0.001)
break;
930 double Bx = 3 * (p3 - p1) - Cx;
931 double Ax = 1 - Cx - Bx;
934 double By = 3 * (p4 - p2) - Cy;
935 double Ay = 1 - Cy - By;
979 if (d>=0.0f && t<=d && t>=0.0f) {
985 RDouble = c * t/d + b;
989 RDouble = c*
cubic_bezier( t/d, 0.42, 0.0, 0.58, 1.0 ) + b;
998 cout <<
"moParamInterpolation::InterpolateData > nterpolation function doesn't exists for " <<
m_Function << endl;
1029 m_CurrentIndexValue = 0;
1030 m_bExternDataUpdated =
false;
1031 m_pExternData = NULL;
1039 m_CurrentIndexValue = 0;
1040 m_bExternDataUpdated =
false;
1041 m_pExternData = NULL;
1042 m_ParamDefinition = p_paramdefinition;
1066 return m_Values.Count();
1072 m_Values.Add( value );
1084 if (this->GetValuesCount()==0) {
1088 switch( (
int)m_ParamDefinition.GetType() ) {
1128 valuebase.
SetText(
"default" );
1139 if ( GetParamDefinition().GetName()==
"effect" 1141 GetParamDefinition().GetName()==
"preeffect" 1143 GetParamDefinition().GetName()==
"posteffect" 1145 GetParamDefinition().GetName()==
"mastereffect" 1147 GetParamDefinition().GetName()==
"devices" 1149 GetParamDefinition().GetName()==
"resources" ) {
1160 valuebase.
SetText(
"fonts/Tuffy.ttf" );
1207 i = m_CurrentIndexValue;
1209 if (0<=i && i<(
MOint)m_Values.Count() )
1212 return m_Values[m_CurrentIndexValue];
1218 if (0<=indexvalue && indexvalue<(
MOint)m_Values.Count() ) {
1219 m_CurrentIndexValue = indexvalue;
1220 m_bExternDataUpdated =
false;
1229 return m_CurrentIndexValue;
1235 if ( m_Values.Count() > 0 ) {
1236 m_bExternDataUpdated =
false;
1237 if ( m_CurrentIndexValue < ((
MOint)m_Values.Count()-1) ) {
1238 m_CurrentIndexValue++;
1240 }
else m_CurrentIndexValue = -1;
1245 if ( m_Values.Count() > 0 ) {
1246 m_bExternDataUpdated =
false;
1247 if ( m_CurrentIndexValue > 0 ) {
1248 m_CurrentIndexValue--;
1250 }
else m_CurrentIndexValue = -1;
1255 if (m_Values.Count() > 0) {
1256 m_bExternDataUpdated =
false;
1257 m_CurrentIndexValue = 0;
1258 }
else m_CurrentIndexValue = -1;
1263 m_ParamDefinition = p_paramdefinition;
1270 return m_ParamDefinition;
1282 m_bExternDataUpdated =
true;
1288 moData* pReturnData = NULL;
1291 if (m_pExternData && m_bExternDataUpdated) {
1292 pReturnData = m_pExternData;
1294 if (GetParamDefinition().GetName()==
"control_roll_angle" ) {
1299 pReturnData = GetValue().GetSubValue().
GetData();
1303 if ( m_ParamDefinition.GetInterpolation().IsOn() && pReturnData ) {
1306 pReturnData->
Eval();
1308 pReturnData = m_ParamDefinition.GetInterpolation().InterpolateData( *pReturnData );
1316 m_pExternData = p_pExternData;
1321 unsigned int v = 0, s = 0;
1333 switch( m_ParamDefinition.GetType() ) {
1336 m_ParamDefinition.SetType(p_NewType);
1338 for( v = 0; v<this->m_Values.Count() ; v++ ) {
1340 moValue& pValue( this->m_Values.GetRef( v ) );
1341 for( s = 0; s< pValue.GetSubValueCount(); s++ ) {
1362 m_ParamDefinition.SetOptions( p_NewOptions );
1363 return m_ParamDefinition.GetOptions().Count()==p_NewOptions.Count();
1370 moText fieldSeparation =
",";
1372 m_fullJSON+=
"'pdef': " + GetParamDefinition().ToJSON();
1373 m_fullJSON+= fieldSeparation +
"'pid': " +
IntToStr(this->GetIndexValue());
1374 m_fullJSON+= fieldSeparation +
"'pvals': [";
1376 fieldSeparation =
"";
1377 for(
int vi = 0; vi < (int)m_Values.Count(); vi++ ) {
1378 m_fullJSON+= fieldSeparation + m_Values[vi].ToJSON();
1379 fieldSeparation =
",";
double bezier_y(double t, double Ay, double By, double Cy)
MOboolean m_bExternDataUpdated
bool FixType(moParamType m_NewType=MO_PARAM_UNDEFINED)
moParamInterpolationFunction
void SetText(moText ptext)
moParamInterpolationFunction m_Function
void SetOptions(const moTextArray &p_options)
const moText & GetName() const
value type: NUM or FUNCTION
double cubic_bezier(double t, double p1, double p2, double p3, double p4)
virtual void Start()
Inicia el temporizador.
void SetIndexValue(int indexvalue)
moValueBase & GetSubValue(MOint p_indexsubvalue=0)
virtual long Duration()
Devuelve el valor del reloj del temporizador.
value type: NUM or FUNCTION
value type: NUM or FUNCTION
void SetDouble(MOdouble pdouble)
value type: NUM or FUNCTION
value type: NUM or FUNCTION
void SetParamDefinition(moParamDefinition &p_paramdefinition)
value type: NUM or FUNCTION
value type: NUM or FUNCTION
void StartInterpolation(const moData &p_data_in, const moData &p_data_out)
void SetInterpolation(const moText &p_interpol_fun, const moText &p_fun_duration=moText(1000), const moText &p_fun_expression=moText())
int GetIndexValue() const
void Replace(const moText0 &target, const moText0 &replacement)
value type: NUM or FUNCTION
moParamType GetType() const
void SetType(moParamType p_paramType)
value type: TXT or LNK, or XML
virtual ~moParamDefinition()
void AddSubValue(const moText &strvalue, moValueType p_valuetype)
const moText & GetGroup() const
virtual ~moParamInterpolation()
int Set(const moText &p_XmlText)
void SetExternData(moData *p_pExternData)
void SetDuration(MOlong p_fun_duration)
value type: TXT or LNK, or XML
MOuint GetValuesCount() const
clase de para manejar textos
moValue * InterpolateValue(moValue &pParamValue)
bool FixType(moValueType p_ValueType)
void Stop()
Detiene el temporizador.
void SetInterpolationFunction(const moText &p_interpol_fun)
virtual MOboolean Init(const moText &p_Expression, moMoldeoObject *p_pMOB=NULL)
double find_x_for(double t, double Ax, double Bx, double Cx)
moParamDefinition m_ParamDefinition
static void Log(moText p_text)
Escribe un mensaje en el archivo de registro (log)
const moText & GetProperty() const
void SetType(moValueType p_type)
Fija el tipo de valor, esta función se implementa sólo como atajo a ciertos datos de la definición...
moValue m_ValueInterpolated
value type: NUM[4] or FUNCTION[4] or
double bezier_x_der(double t, double Ax, double Bx, double Cx)
static moParamType ParamTypeFromStr(const moText &p_type)
void DeleteValue(MOint i)
void RemoveSubValues(bool leavefirstone=true)
moParam & operator=(const moParam &src)
moParamInterpolation & operator=(const moParamInterpolation &src)
moParamInterpolation & GetInterpolation()
bool FixOptions(moTextArray &m_NewOptions)
moData * InterpolateData(moData &pParamData)
MOdouble LastEval() const
value type: NUM or FUNCTION
static double Cos(double fValue)
value type: NUM or FUNCTION
value type: NUM or FUNCTION
void AddValue(moValue &value)
moValue & GetValue(MOint i=-1)
value type: NUM or FUNCTION
moDefineDynamicArray(moParamDefinitions) moDefineDynamicArray(moParams) moDefineDynamicArray(moParamIndexes) moParamDefinition
value type: NUM or TEXT ( 0:FILL 1:LINE 2:POINT)
Clase para el control de un temporizador (relativo) con identificación.
moText GetFunctionToText()
moParamDefinition & GetParamDefinition()
const moTimer & GetTimer() const
void SetDefault(const moValue &p_defaultvalue)
LIBMOLDEO_API moText0 IntToStr(int a)
moTextArray Explode(char *separator) const
double bezier_x(double t, double Ax, double Bx, double Cx)
const moText & GetOptionsStr()
moData m_DataInterpolated
value type: NUM or FUNCTION
moParamInterpolation m_Interpolation
value type: NUM or TEXT (to script or shader for chroma???)
moValueType GetType() const
Devuelve el tipo de valor ,esta función se implementa sólo como atajo a ciertos datos de la definició...
moParamDefinition & operator=(const moParamDefinition &src)
moText GetTypeStr() const