libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo es el conjunto de objetos y funciones, que permiten ejecutar las operaciones básicas de la plataforma Moldeo, y que compone su núcleo.
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Amigas 'defines' Grupos Páginas
moMoldeoObject.cpp
Ir a la documentación de este archivo.
1 /*******************************************************************************
2 
3  moMoldeoObject.cpp
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28  Andrés Colubri
29 
30 *******************************************************************************/
31 
32 #include <moMoldeoObject.h>
33 #include <moTextureFilterIndex.h>
34 #include <moScriptManager.h>
35 #include <moMathManager.h>
36 #include <moFontManager.h>
37 #include <mo3dModelManager.h>
38 #include <moFilterManager.h>
39 
40 #include "moArray.h"
41 moDefineDynamicArray(moMoldeoObjects)
42 
43 
44 
48  m_Activated = MO_OFF;
49  m_Selected = MO_OFF;
50 }
51 
53 }
54 
55 moMobState::moMobState( const moMobState& p_MobState ) {
56  (*this) = p_MobState;
57 }
58 
62  m_Selected = src.m_Selected;
63  return (*this);
64 }
65 
68 
69 }
70 
73 }
74 
75 bool moMobState::Activated() const {
76  return (m_Activated==MO_ON);
77 }
78 
79 
81  m_Selected = MO_ON;
82 }
83 
86 }
87 
88 bool moMobState::Selected() const {
89  return (m_Selected==MO_ON);
90 }
91 
92 const moText&
94  moText fieldSeparation = ",";
95 
96  m_FullJSON = "{";
97  m_FullJSON+= "'activated': " + IntToStr(m_Activated);
98  m_FullJSON+= fieldSeparation + "'selected': " + IntToStr(m_Selected);
99  m_FullJSON+= "}";
100 
101  return m_FullJSON;
102 }
103 
104 
112 
113  m_Name = moText("");
114  m_ConfigName = moText("");
116  m_MoldeoId = -1;
118  m_MoldeoFatherId = -1;
120  m_KeyName = "";
121 
122 }
123 
125  (*this) = mb;
126 }
127 
130 
131 }
132 
136  m_Name = mb.m_Name;
138  m_Type = mb.m_Type;
140  m_MoldeoId = mb.m_MoldeoId;
141  m_MobIndex = mb.m_MobIndex;
144  m_KeyName = mb.m_KeyName;
145  m_Activate = mb.m_Activate;
146  return(*this);
147 }
148 
149 
151 const moText&
153  return m_Name;
154 }
155 
157 
158 void
160  m_Name = p_name;
161 }
162 
164 const moText&
166  return m_ConfigName;
167 }
168 
170 void
171 moMobDefinition::SetConfigName( const moText& p_configname ) {
172  m_ConfigName = p_configname;
173 }
174 
178  return m_Type;
179 }
180 
181 moText
184 }
185 
188 moMobDefinition::GetStrToType( const moText& p_Str ) const {
189 
190  if (p_Str == moText("effect") || p_Str == moText("moEffect")) {
191  return MO_OBJECT_EFFECT;
192  } else if (p_Str == moText("mastereffect") || p_Str == moText("moMasterEffect")) {
193  return MO_OBJECT_MASTEREFFECT;
194  } else if (p_Str == moText("posteffect") || p_Str == moText("moPostEffect")) {
195  return MO_OBJECT_POSTEFFECT;
196  } else if (p_Str == moText("preeffect") || p_Str == moText("moPreEffect")) {
197  return MO_OBJECT_PREEFFECT;
198  } else if (p_Str == moText("iodevice") || p_Str == moText("moIODevice")) {
199  return MO_OBJECT_IODEVICE;
200  } else if (p_Str == moText("resource") || p_Str == moText("moResource")) {
201  return MO_OBJECT_RESOURCE;
202  } else if (p_Str == moText("console") || p_Str == moText("moConsole")) {
203  return MO_OBJECT_CONSOLE;
204  }
205 
206  return MO_OBJECT_UNDEFINED;
207 
208 }
209 
211 moText
213 
214  switch(p_Type) {
215  case MO_OBJECT_EFFECT:
216  return moText("moEffect");
217  break;
219  return moText("moMasterEffect");
220  break;
222  return moText("moPostEffect");
223  break;
224  case MO_OBJECT_PREEFFECT:
225  return moText("moPreEffect");
226  break;
227  case MO_OBJECT_IODEVICE:
228  return moText("moIODevice");
229  break;
230  case MO_OBJECT_RESOURCE:
231  return moText("moResource");
232  break;
233  case MO_OBJECT_CONSOLE:
234  return moText("moConsole");
235  break;
236  case MO_OBJECT_UNDEFINED:
237  return moText("MOB class undefined");
238  break;
239  default:
240  return moText("MOB class undefined");
241  break;
242  }
243 }
244 
246 moText
248  if ( ! ( p_Type == MO_OBJECT_UNDEFINED ) ) {
249  return moText("undefined");
250  }
251  switch(p_Type) {
252  case MO_OBJECT_EFFECT:
253  return moText("effect");
254  break;
256  return moText("mastereffect");
257  break;
259  return moText("posteffect");
260  break;
261  case MO_OBJECT_PREEFFECT:
262  return moText("preeffect");
263  break;
264  case MO_OBJECT_IODEVICE:
265  return moText("devices");
266  break;
267  case MO_OBJECT_RESOURCE:
268  return moText("resources");
269  break;
270  case MO_OBJECT_CONSOLE:
271  return moText("console");
272  break;
273  case MO_OBJECT_UNDEFINED:
274  return moText("undefined");
275  break;
276  default:
277  return moText("undefined");
278  break;
279  }
280 }
281 
283 void
285  m_Type = p_type;
286 }
287 
289 const moMobIndex&
291  return m_MobIndex;
292 }
293 
294 
296 void
297 moMobDefinition::SetLabelName( const moText& p_labelname ) {
298  m_MoldeoLabelName = p_labelname;
299 }
300 
302 
303 const moText&
305  return m_MoldeoLabelName;
306 }
307 
309 
312 void
314  m_MoldeoId = p_moldeoid;
315 }
316 
318 
321 MOint
323  return m_MoldeoId;
324 }
325 
326 
327 
329 void
331  m_MoldeoFatherLabelName = p_labelname;
332 }
333 
334 
336 void
337 moMobDefinition::SetDescription( const moText& p_Description ) {
338  m_Description = p_Description;
339 }
340 
341 void
342 moMobDefinition::SetActivate( bool p_activate ) {
343  m_Activate = p_activate;
344 }
345 
346 void
347 moMobDefinition::SetKeyName( const moText& p_keyname ) {
348  m_KeyName = p_keyname;
349 }
350 
351 
352 void
354  m_MobIndex.SetParamIndex(p_paramindex);
355 
356 }
357 
358 void
360  m_MobIndex.SetValueIndex(p_valueindex);
361 }
362 
363 const moText&
365  moText fieldSeparation = ",";
366  m_FullJSON = "{";
367  m_FullJSON+= "'moldeoid': '" + IntToStr( GetMoldeoId() ) +"'";
368  m_FullJSON+= fieldSeparation + "'name': '" + GetName() + "'";
369  m_FullJSON+= fieldSeparation + "'labelname': '" + GetLabelName() + "'";
370  m_FullJSON+= fieldSeparation + "'configname': '" + GetConfigName() + "'";
371  m_FullJSON+= fieldSeparation + "'type': '" + this->GetTypeStr() + "'";
372  m_FullJSON+= fieldSeparation + "'console_param_index': '" + IntToStr(this->GetMobIndex().GetParamIndex()) + "'";
373  m_FullJSON+= fieldSeparation + "'console_value_index': '" + IntToStr(this->GetMobIndex().GetValueIndex()) + "'";
374  m_FullJSON+= fieldSeparation + "'description': '" + GetDescription() + "'";
375  m_FullJSON+= fieldSeparation + "'moldeofatherid': '" + IntToStr( GetMoldeoFatherId() ) +"'";
376  m_FullJSON+= fieldSeparation + "'fatherlabelname': '" + GetFatherLabelName() + "'";
377  m_FullJSON+= "}";
378  return m_FullJSON;
379 }
380 
381 //===========================================
382 //
383 // moMoldeoObject
384 //
385 //===========================================
386 
388  SetId(-1);
390  SetLabelName("");
391  SetName("");
392  SetConfigName("");
393  SetDescription("");
394  SetKeyName("");
395  SetScript("");
396 
397  m_pResourceManager = NULL;
398  m_Inlets.Init( 0 , NULL );
399  m_Outlets.Init( 0 , NULL );
400  m_bConnectorsLoaded = false;
401  __iscript = -1;
403 }
404 
407 }
408 
409 void
410 moMoldeoObject::SetScript( const moText& p_script ) {
411  m_Script = p_script;
412 }
413 
414 const
416  return m_MobState;
417 }
418 
419 bool
420 moMoldeoObject::SetState( const moMobState& p_MobState ) {
421 
422  //TODO: check things before commit changes
423  m_MobState = p_MobState;
424  return true;
425 }
426 
427 
429 
430  moMobState mobstate = GetState();
431 
432  mobstate.Activate();
433  SetState( mobstate );
434 }
435 
437 
438  moMobState mobstate = GetState();
439 
440  mobstate.Deactivate();
441  SetState( mobstate );
442 }
443 
445  return GetState().Activated();
446 }
447 
449 
450  moMobState mobstate = GetState();
451 
452  mobstate.Select();
453  SetState( mobstate );
454 }
455 
457  moMobState mobstate = GetState();
458  mobstate.Unselect();
459  SetState( mobstate );
460 }
461 
463  return GetState().Selected();
464 }
465 
466 
467 
468 
469 
470 
471 MOboolean
473 
474  InletScreenWidth = new moInlet();
475  if (InletScreenWidth) {
476  //Inlet->Init( "tempo", m_Inlets.Count(), param.GetPtr() );
477  //param.SetExternData( Inlet->GetData() );
478  ((moConnector*)InletScreenWidth)->Init( moText("screen_width"), m_Inlets.Count(), MO_DATA_NUMBER_DOUBLE );
479  m_Inlets.Add(InletScreenWidth);
480  }
481 
482  InletScreenHeight = new moInlet();
483  if (InletScreenHeight) {
484  //Inlet->Init( "tempo", m_Inlets.Count(), param.GetPtr() );
485  //param.SetExternData( Inlet->GetData() );
486  ((moConnector*)InletScreenHeight)->Init( moText("screen_height"), m_Inlets.Count(), MO_DATA_NUMBER_DOUBLE );
487  m_Inlets.Add(InletScreenHeight);
488  }
489 
490  InletTimeabs = new moInlet();
491  if (InletTimeabs) {
492  //Inlet->Init( "tempo", m_Inlets.Count(), param.GetPtr() );
493  //param.SetExternData( Inlet->GetData() );
494  ((moConnector*)InletTimeabs)->Init( moText("timeabs"), m_Inlets.Count(), MO_DATA_NUMBER_DOUBLE );
495  m_Inlets.Add(InletTimeabs);
496  }
497 
498  InletPreconfig = new moInlet();
499  if (InletPreconfig) {
500  //Inlet->Init( "tempo", m_Inlets.Count(), param.GetPtr() );
501  //param.SetExternData( Inlet->GetData() );
502  ((moConnector*)InletPreconfig)->Init( moText("preconfig"), m_Inlets.Count(), MO_DATA_NUMBER_INT );
503  m_Inlets.Add(InletPreconfig);
504  }
505 
506  moText confignamecompleto="";
507 
508  GetDefinition();
509 
510  if ( GetType()==MO_OBJECT_CONSOLE ) {
511  confignamecompleto = GetConfigName();
512  } else {
513  if (m_pResourceManager) {
515  confignamecompleto = m_pResourceManager->GetDataMan()->GetDataPath();
516  confignamecompleto += moSlash + GetConfigName();
517  confignamecompleto += moText(".cfg");
518  } else {
519  MODebug2->Error("moMoldeoObject::Init > DataManager undefined > object: "+GetName()+ " config: " + GetConfigName() + " label:"+GetLabelName() );
520  return false;
521  }
522  } else {
523  MODebug2->Error("moMoldeoObject::Init > ResourceManager undefined > object: "+GetName()+ " config: " + GetConfigName() + " label:"+GetLabelName() );
524  return false;
525  }
526  }
527 
528  MODebug2->Message("*****Initializing " + GetName() + " *****");
529 
530  if(m_Config.LoadConfig(confignamecompleto) != MO_CONFIG_OK ) {
531  MODebug2->Error("moMoldeoObject::Init > Config file invalid or not found > object: " + GetName() + " config:" + confignamecompleto + " label: " + GetLabelName());
532  return false;//bad
533  }
534 
538  //m_Config.Indexation();
539 
540  __iscript = m_Config.GetParamIndex("script");
542  MODebug2->Error(moText("moMoldeoObject::Init > config: "+GetConfigName()+ " config: " + GetConfigName() + " label: "+GetLabelName()+" script parameter missing"));
543 
544 
545  InitScript();
547 
548  MODebug2->Message("*****moMoldeoObject::Init > for plugin: " + GetName() + " config: " + GetConfigName() + " label: " + GetLabelName() +" is OK!");
549  return true;
550 }
551 
553  if (moScript::IsInitialized()) {
554  if (ScriptHasFunction("Init")) {
555  SelectScriptFunction("Init");
557  }
558  }
559 }
560 
562  if (moScript::IsInitialized()) {
563  if (ScriptHasFunction("Finish")) {
564  SelectScriptFunction("Finish");
566  }
567  }
568 }
569 
571  if (moScript::IsInitialized()) {
572  if (ScriptHasFunction("Update")) {
573  SelectScriptFunction("Update");
575  }
576  }
577 }
578 
579 
581 
582 
583  moText cs;
584  cs = m_Config.Text( __iscript );
585 
587  if ((moText)m_Script!=cs && IsInitialized()) {
588 
589  m_Script = cs;
590  moText fullscript = DataMan()->GetDataPath()+ moSlash + (moText)m_Script;
591 
592  if (moFileManager::FileExists(fullscript)) {
593 
594  MODebug2->Message( GetLabelName() + moText(" script loading : ") + (moText)fullscript );
595 
596  if ( CompileFile(fullscript) ) {
597 
598  MODebug2->Message( GetLabelName() + moText(" script loaded : ") + (moText)fullscript );
599 
601 
602  SelectScriptFunction( "Init" );
615 
616  } else MODebug2->Error( moText("Couldn't compile lua script ") + (moText)fullscript + " config:"+GetConfigName()+" label: "+GetLabelName() );
617  } else MODebug2->Message("Script file not present. " + (moText)fullscript + " config: "+GetConfigName()+" label:"+GetLabelName() );
618  }
619 
620 
622  if (moScript::IsInitialized()) {
623  if (ScriptHasFunction("Run")) {
624  SelectScriptFunction("Run");
626  }
627  }
628 }
629 
630 MOboolean
631 moMoldeoObject::RefreshValue( moParam& param, int value_index ) {
632  return ResolveValue( param, value_index, true );
633 }
634 
635 MOboolean
636 moMoldeoObject::ResolveValue( moParam& param, int value_index, bool p_refresh ) {
637 
638  int idx = -1;
639  moValue& value( param.GetValue(value_index) );
640  moParamType param_type = param.GetParamDefinition().GetType();
641  //MODebug2->Message( moText("+Init value #") + IntToStr(v) );
642 
645 
646  for( MOuint ivb=0; ivb<value.GetSubValueCount(); ivb++) {
647  moValueBase& VB( value.GetSubValue( ivb ) );
648  if (VB.GetType() == MO_VALUE_FUNCTION ) {
649  idx = -1;
650  if (p_refresh)
652  idx = m_pResourceManager->GetMathMan()->AddFunction( VB.Text(), (MOboolean)true, this );
653 
655  idx = m_pResourceManager->GetMathMan()->AddFunction( VB.Text(), (MOboolean)true, this );
656  if (idx>-1) {
657  VB.SetFun( m_pResourceManager->GetMathMan()->GetFunction(idx) );
658  //MODebug2->Message( moText("function defined: ") + VB.Text() );
659  } else {
660  MODebug2->Error(moText("moMoldeoObject::CreateConnectors > function couldn't be defined: ") + VB.Text()
661  + " object: "+GetName()
662  + " config: " + GetConfigName()
663  + " label:" + GetLabelName() );
664  }
665  }
666  }
667 
668 
669  //
670 
671  if (value.GetSubValueCount()<=0) return false;
672 
673  moValueBase& valuebase0(value.GetSubValue(0));
674 
675  switch( param_type ) {
676 
680  if ( ! (valuebase0.Text().Trim() == moText("")) ) {
681 
683  if (p_refresh) {
684 
685  }
686  idx = m_pResourceManager->GetTextureMan()->GetTextureBuffer( valuebase0.Text(), true, "PNG" );
687  if (idx>-1) {
688 
690  valuebase0.SetTextureBuffer( pTextureBuffer );
691  return true;
692  }
693  return false;
694 
695  }
696 
697 
698  break;
699 
700  case MO_PARAM_VIDEO:
703 
704  break;
705 
706  case MO_PARAM_TEXTURE:
707  case MO_PARAM_FILTER:
708  if ( ! (valuebase0.Text().Trim() == moText("")) ) {
709 
710  if (p_refresh) {
711  idx = m_pResourceManager->GetTextureMan()->GetTextureMOId( valuebase0.Text(), true, true );
712  }
713 
714  idx = m_pResourceManager->GetTextureMan()->GetTextureMOId( valuebase0.Text(), true );
715  if (idx>-1) {
717  valuebase0.SetTexture( pTexture );
718 
719  if (pTexture->GetType()!=MO_TYPE_TEXTURE_MULTIPLE && value.GetSubValueCount()>1) {
722  valuebase0.SetTextureFilter( pTextureFilter );
723  }
724 
725  if (value.GetSubValueCount()==4) {
726  valuebase0.SetTextureFilterAlpha( value.GetSubValue(3).GetData() );
727  }
728 
729  if (value.GetSubValueCount()>=5) {
730  //valuebase.SetTextureFilterParam( value.GetSubValue(4).GetData() );
731  }
732 
733  //MODebug2->Message( moText("moMoldeoObject::CreateConnectors > ") + valuebase0.Text());
734 
735  }
736  } else {
737  MODebug2->Error( moText("moMoldeoObject::UpdateValue > VALUE BASE EMPTY: ") + valuebase0.Text()
738  /*+ moText(" Param name:") +param.GetParamDefinition().GetName()*/ );
739  return false;
740  }
741  break;
742 
743  case MO_PARAM_FONT:
744 
745  moFont* pFont;
746  moFontType fonttype;
747  moFontSize fontsize;
748 
749  if ( value.GetSubValueCount()==3 ) {
750  if ( valuebase0.Text().Trim() == moText("Default") ) {
751  pFont = m_pResourceManager->GetFontMan()->GetFont(0);
752  } else if ( ! (valuebase0.Text().Trim() == moText("")) ) {
753 
754  if ( value.GetSubValue(1).GetType()==MO_VALUE_TXT) {
755  moText fonttypeT = value.GetSubValue(1).Text();
756  fonttype = m_pResourceManager->GetFontMan()->GetFontType(fonttypeT);
757  } else {
758  fonttype = (moFontType)value.GetSubValue(1).Int();
759  }
760 
761  if ( value.GetSubValue(2).GetType()==MO_VALUE_NUM ) {
762  fontsize = value.GetSubValue(2).Int();
763  } else if ( value.GetSubValue(2).GetType()==MO_VALUE_FUNCTION ) {
764  fontsize = 12;
765  }
766 
767  pFont = m_pResourceManager->GetFontMan()->AddFont( valuebase0.Text(), fonttype, fontsize);
768  if (pFont==NULL) {
769  MODebug2->Error( moText("moMoldeoObject::CreateConnectors > FONT NOT FOUND: Using Default")+ valuebase0.Text() + moText(" Param name:") +param.GetParamDefinition().GetName() );
770  pFont = m_pResourceManager->GetFontMan()->GetFont(0);
771  }
772  } else {
773  MODebug2->Error( moText("moMoldeoObject::CreateConnectors > VALUE BASE EMPTY: Using Default")+ valuebase0.Text() + moText(" Param name:") +param.GetParamDefinition().GetName() );
774  pFont = m_pResourceManager->GetFontMan()->GetFont(0);
775  }
776 
777  if (pFont) {
778  valuebase0.SetFont( pFont );
779  return true;
780  }
781  return false;
782  } else {
783  MODebug2->Error( moText("moMoldeoObject::UpdateValue > MISSING VALUES: ")+ valuebase0.Text() + moText(" Param name:") +param.GetParamDefinition().GetName() );
784  return false;
785  }
786  break;
787 
788  case MO_PARAM_3DMODEL:
789  case MO_PARAM_OBJECT:
790  if (value.GetSubValueCount()>0) {
792  moSceneNode* pModel = m_pResourceManager->GetModelMan()->Get3dModel( valuebase0.Text(), true /*force load !!*/ );
793  valuebase0.SetModel( pModel );
794  return false;
795  }
796  break;
797 
798  case MO_PARAM_SOUND:
799  if (value.GetSubValueCount()>0) {
800  if (valuebase0.Text()!="") {
801  moSound* pSound = m_pResourceManager->GetSoundMan()->GetSound( valuebase0.Text() );
802  if (pSound) {
803  valuebase0.SetSound( pSound );
804  return true;
805  }
806  return false;
807  }
808  }
809  break;
810  default:
811  break;
812 
813  }//fin siwtch
814  return false;
815 }
816 
817 MOboolean
819 
820  if (m_pResourceManager == NULL) {
821  MODebug2->Error("moMoldeoObject::CreateConnectors > ResourceManager is NULL!!! Can't continue. Sorry for object: "+GetName()+ " config: " + GetConfigName() + " label:"+GetLabelName() );
822  return false;
823  }
824 
825  if (m_bConnectorsLoaded) {
826  MODebug2->Error("moMoldeoObject::CreateConnectors > Calling twice. Can't continue. Sorry for object: "+GetName()+ " config: " + GetConfigName() + " label:"+GetLabelName() );
827  return false;
828  }
829 
830  MODebug2->Message("moMoldeoObject::CreateConnectors > Calling once. object: "+GetName()+ " config: " + GetConfigName() + " label:" + GetLabelName() );
831 
832 
834 
835  moParam& pinlets = m_Config[moText("inlet")];
836 
837  for( MOuint i=0; i<pinlets.GetValuesCount(); i++ ) {
838  if ( GetInletIndex(pinlets[i][MO_INLET_NAME].Text())==-1 ) {
839  moInlet* Inlet = new moInlet();
840  if (Inlet) {
841  Inlet->SetMoldeoLabelName( GetLabelName() );
842  moText InletName = pinlets[i][MO_INLET_NAME].Text();
844  if ( m_Config.GetParamIndex(InletName)==-1 ) {
845  ((moConnector*)Inlet)->Init( InletName, m_Inlets.Count(), pinlets[i][MO_INLET_TYPE].Text() );
846  m_Inlets.Add( Inlet );
847  }
848  }
849  }
850  }
851 
855  for( MOint p=0;p<m_Config.GetParamsCount();p++) {
856 
857  moParam &param( m_Config[p] );
858 
859  MODebug2->Log( moText("moMoldeoObject::CreateConnectors > Init param type ") + param.GetParamDefinition().GetTypeStr() + moText(" name: ") + param.GetParamDefinition().GetName() );
860 
861 
863  int inletidx = GetInletIndex(param.GetParamDefinition().GetName());
864  if (inletidx==-1) {
865  moInlet* Inlet = new moInlet();
866  if (Inlet) {
867  Inlet->Init( param.GetParamDefinition().GetName(), m_Inlets.Count(), param.GetPtr() );
868  m_Inlets.Add(Inlet);
869  }
870  }
871 
872  for( MOuint v=0;v<param.GetValuesCount();v++) {
873  ResolveValue( param, v );
874 
875  }
876  }
877 
878  MODebug2->Message("moMoldeoObject::CreateConnectors > loaded params & values for Object: " + GetName() + " config:" + GetConfigName() + " label:" + GetLabelName() );
879 
885  moParam& poutlets = m_Config[moText("outlet")];
888 
889  for( MOuint i=0; i<poutlets.GetValuesCount(); i++ ) {
890  if ( GetOutletIndex(poutlets[i][MO_OUTLET_NAME].Text())==-1 ) {
891  moOutlet* Outlet = new moOutlet();
892  if (Outlet) {
893  Outlet->SetMoldeoLabelName( GetLabelName() );
896  moText OutletName = poutlets[i][MO_OUTLET_NAME].Text();
897 
898  if ( m_Config.GetParamIndex(OutletName) > -1 ) {
900  MODebug2->Log( moText("moMoldeoObject::CreateConnectors > ") + this->GetLabelName() + moText(" creating Outlet as parameter \"") + OutletName + "\"" );
901  Outlet->Init( OutletName, i, m_Config.GetParam(OutletName).GetPtr());
902  } else {
904  MODebug2->Log( moText("moMoldeoObject::CreateConnectors > ") + this->GetLabelName() + moText(" Init > creating outlet not as param.") + OutletName );
905  Outlet->Init( OutletName, i, poutlets[i][MO_OUTLET_TYPE].Text() );
906  }
907  m_Outlets.Add( Outlet );
908 
911  for( MOuint j=MO_OUTLET_INLETS_OFFSET; j<poutlets[i].GetSubValueCount(); j+=2 ) {
912  moText objectname = poutlets[i][j].Text();
913  moText inletname = poutlets[i][j+1].Text();
914  moConnection* Connection = new moConnection( objectname, inletname );
915  if (Connection)
916  Outlet->GetConnections()->Add(Connection);
917  }
918  }
919  }
920  }
921 
922  m_bConnectorsLoaded = true;
923 
925  //moMoldeoObject::ScriptExeInit();
926  ScriptExeInit();
927 
928  MODebug2->Message("moMoldeoObject::CreateConnectors > OK! Object: " + GetName() + " config:" + GetConfigName() + " label: " + GetLabelName() );
929 
930  return m_bConnectorsLoaded;
931 }
932 
933 MOboolean
935  m_bConnectorsLoaded = false;
937 
938 }
939 
940 MOboolean
942  m_pResourceManager = p_pResources;
943 
944  return moMoldeoObject::Init();
945 }
946 
947 
948 MOboolean
950 
951  ScriptExeFinish();
952 
953  for(MOuint i=0; i<m_Inlets.Count(); i++ ) {
954  moInlet *pInlet = dynamic_cast<moInlet*>(m_Inlets[i]);
955  if (pInlet) {
956  delete pInlet;
957  }
958  }
959  m_Inlets.Empty();
960 
961  for(MOuint i=0; i<m_Outlets.Count(); i++ ) {
962  moOutlet *pOutlet = dynamic_cast<moOutlet*>(m_Outlets[i]);
963  if (pOutlet) {
964  delete pOutlet;
965  }
966  }
967  m_Outlets.Empty();
968 
969  return true;
970 
971 }
972 
973 
974 
977  return m_MobDefinition.GetType();
978 }
979 
980 void
982  m_MobDefinition.SetType(p_type);
983 }
984 
985 MOint
987  return m_MobDefinition.GetMoldeoId();
988 }
989 
990 void
993 }
994 
995 
996 void
998 
999  m_pResourceManager = p_pResourceManager;
1000 
1001 }
1002 
1005 
1006  return m_pResourceManager;
1007 
1008 }
1009 
1010 void
1013 }
1014 
1015 int
1016 moMoldeoObject::Save( const moText& p_save_filename ) {
1017 
1019  SyncConnections();
1020 
1032  if (p_save_filename == moText("")) {
1033  return GetConfig()->SaveConfig();
1034  } else {
1035  return GetConfig()->SaveConfig( p_save_filename );
1036  }
1037 }
1038 
1039 void
1040 moMoldeoObject::SetConfigName( const moText& p_configname ) {
1041  m_MobDefinition.SetConfigName( p_configname );
1042 }
1043 
1044 
1047 
1048  if ( p_configdefinition==NULL ) {
1049  p_configdefinition = m_Config.GetConfigDefinition();
1050  }
1051 
1052  p_configdefinition->GetParamDefinitions()->Empty();
1053  p_configdefinition->ParamIndexes().Empty();
1054 
1055  p_configdefinition->Set( GetName(), m_MobDefinition.GetTypeStr() );
1056 
1057  p_configdefinition->Add( moText("inlet"), MO_PARAM_INLET );
1058  p_configdefinition->Add( moText("outlet"), MO_PARAM_OUTLET );
1059  p_configdefinition->Add( moText("script"), MO_PARAM_SCRIPT );
1060  //TODO: add ""
1061 
1062  return p_configdefinition;
1063 }
1064 
1065 void
1067 
1068  GetDefinition();
1069 
1070  //m_Config.Check();
1071 
1072  moParamDefinitions *pdefinitions = m_Config.GetConfigDefinition()->GetParamDefinitions();
1073  moParamDefinitions& PD(*pdefinitions);
1074 
1075  for( MOuint i=0; i < pdefinitions->Count(); i++ ) {
1076  moText name = pdefinitions->Get(i).GetName();
1077  PD[i].SetIndex( m_Config.GetParamIndex( name ));
1078  }
1079 
1080 }
1081 
1082 moOutlets*
1084  return &m_Outlets;
1085 }
1086 
1087 
1088 moInlets*
1090  return &m_Inlets;
1091 }
1092 
1093 MOint
1094 moMoldeoObject::GetInletIndex( moText p_connector_name ) const {
1095 
1096  for( MOuint i=0; i< m_Inlets.Count(); i++ ) {
1097  moInlet* pInlet = m_Inlets.Get(i);
1098  if ( pInlet->GetConnectorLabelName() == p_connector_name )
1099  return i;
1100  }
1101  return (-1);
1102 
1103 }
1104 
1105 MOint
1106 moMoldeoObject::GetOutletIndex( moText p_connector_name ) const {
1107 
1108  for( MOuint i=0; i< m_Outlets.Count(); i++ ) {
1109  moOutlet* pOutlet = m_Outlets.Get(i);
1110  if ( pOutlet )
1111  if ( pOutlet->GetConnectorLabelName() == p_connector_name )
1112  return i;
1113  }
1114  return (-1);
1115 
1116 }
1117 
1132 void
1134 
1135 
1136  if (InletScreenWidth) {
1138  }
1139  if (InletScreenHeight) {
1141  }
1142  if (InletTimeabs) {
1144  }
1145  if (InletPreconfig) {
1147  }
1148 
1149  moEvent *actual,*tmp;
1150  moMessage *pmessage;
1151 
1152  actual = p_EventList->First;
1153 
1156  while(actual!=NULL) {
1157  tmp = actual->next;
1159 
1160  if (actual->deviceid == GetId() && actual->reservedvalue3 == MO_MESSAGE) {
1161 
1163  pmessage = (moMessage*)actual;
1164 
1166  MOint inletid = pmessage->m_InletIdDest;
1167  moData pdata = pmessage->m_Data;
1168  //MODebug2->Message("Receiving outlet message to inlet: ");
1170  if (inletid>=0 && inletid<(int)m_Inlets.Count() ) {
1171  moInlet* pinlet = m_Inlets[inletid];
1172  //MODebug2->Message("Updating inlet: object: " + GetLabelName() + " inlet: " + pinlet->GetConnectorLabelName()
1173  // + " outlet_data: " + pdata.ToText() );
1174 
1176  if (pinlet->GetData()==NULL)
1177  pinlet->NewData();
1178 
1182  if (pinlet->GetConnectorLabelName()=="control_roll_angle") pinlet->GetInternalData()->Copy(pdata);
1183  else if (pinlet->IsParameterDependent()) pinlet->GetInternalData()->Copy(pdata);
1184  else pinlet->GetData()->Copy(pdata);
1185 
1186 
1187  pinlet->Update();
1188 
1189  //MODebug2->Message("Updating inlet: object: " + GetLabelName() + " inlet: " + pinlet->GetConnectorLabelName()
1190  // + " outlet_data: " + pinlet->GetData()->ToText() );
1191 
1192  }
1193 
1194  } else if (actual->reservedvalue3 == MO_MESSAGE) {
1196 
1197  pmessage = (moMessage*)actual;
1198 
1200  if (pmessage->m_MoldeoIdSrc == GetId() ) {
1201  p_EventList->Delete(pmessage);
1202  }
1203 
1204  }
1206  actual = tmp;
1207  }
1208 
1209 
1211  for( MOuint i=0; i<m_Outlets.Count() ; i++) {
1212  moOutlet* poutlet = m_Outlets[i];
1213 
1214  if (poutlet) {
1215 
1216 
1217  bool forcingParameterEmition = false;
1218  if ( poutlet->IsParameterDependent()
1219  &&
1220  poutlet->GetConnections()->Count()>0) {
1224  forcingParameterEmition = true;
1225  }
1226 
1228  if ( poutlet->Updated() || forcingParameterEmition ) {
1232 
1233  //MODebug2->Message( poutlet->GetConnectorLabelName() + moText(" outlet updated. MOB : ") + this->GetLabelName() );
1234 
1235  moData pdata = (*(poutlet->GetData()));
1236  moConnections* pconnections = poutlet->GetConnections();
1237  for(MOuint j=0; j<pconnections->Count(); j++) {
1238  moConnection* pconnection = pconnections->Get(j);
1239  pmessage = new moMessage( pconnection->GetDestinationMoldeoId(),
1240  pconnection->GetDestinationConnectorId(),
1241  GetId(),
1242  pdata );
1243  p_EventList->Add( (moEvent*) pmessage );
1244  //if (pmessage) delete pmessage;
1245  //MODebug2->Message(moText("added outlet message for:") + IntToStr(pconnection->GetDestinationMoldeoId()) );
1246  }
1248  poutlet->Update(false);
1249  }
1250  }
1251  }
1253 
1254 }
1255 
1256 
1259 {
1260  RegisterBaseFunction("PushDebugString"); //0
1261  RegisterFunction("GetResourceManager"); //1
1262 
1264  RegisterFunction("SetPreconf");//2
1265  RegisterFunction("GetPreconf");//3
1266 
1267  RegisterFunction("GetParamIndex");//4
1268  RegisterFunction("GetCurrentValue");//5
1269  RegisterFunction("SetCurrentValue");//6
1270  RegisterFunction("GetValuesCount");//7
1271 
1272  RegisterFunction("GetInletIndex");//8
1273  RegisterFunction("GetInletData");//9
1274  RegisterFunction("SetInletData");//10
1275 
1277  RegisterFunction("GetTuioSystem");//11
1278  RegisterFunction("GetTuioCursorCount");//12
1279  RegisterFunction("GetTuioCursor");//13
1280  RegisterFunction("GetTuioObjectCount");//14
1281  RegisterFunction("GetTuioObject");//15
1282 
1284 
1286  RegisterFunction("GetTrackerSystemData"); //16
1287  RegisterFunction("GetTrackerFeaturesCount"); //17
1288  RegisterFunction("GetTrackerValidFeatures"); //18
1289  RegisterFunction("GetTrackerFeature"); //19
1290  RegisterFunction("GetTrackerVariance"); //20
1291  RegisterFunction("GetTrackerBarycenter"); //21
1292  RegisterFunction("GetTrackerAcceleration"); //22
1293  RegisterFunction("GetTrackerVelocity"); //23
1294  RegisterFunction("GetTrackerZone"); //24
1295 
1296  RegisterFunction("GetTrackerHistory"); //25
1297  RegisterFunction("StartTrackerHistory"); //26
1298  RegisterFunction("PauseTrackerHistory"); //27
1299  RegisterFunction("ContinueTrackerHistory"); //28
1300  RegisterFunction("StopTrackerHistory"); //29
1301  RegisterFunction("GetHistoryRecord"); //30
1302  RegisterFunction("GetHistoryBarycenter"); //31
1303  RegisterFunction("GetHistoryVariance"); //32
1304  RegisterFunction("GetHistoryBounding"); //33
1305  RegisterFunction("GetHistoryAverage"); //34
1306  RegisterFunction("GetHistoryMinMax"); //35
1307 
1308 }
1309 
1311 /*
1312  for(int i=0; i<m_iMethodBaseAncestors; i++ ) {
1313  MODebug2->Message( moText("moMoldeoObject::ScriptCalling > baseancestor: ")+IntToStr(i)+moText(" base: ") + IntToStr(m_MethodBases[i]));
1314  //m_iMethodBaseIterator
1315  }
1316 
1317  m_iMethodBase = m_MethodBases[m_iMethodBaseIterator];
1318 
1319  MODebug2->Message( moText("Called moMoldeoObject::ScriptCalling, iFunctionNumber") + IntToStr(iFunctionNumber)
1320  +moText(" m_iMethodBase: ") + IntToStr(m_iMethodBase) );
1321  MODebug2->Message( moText("m_iMethodBaseAncestors: ") + IntToStr( m_iMethodBaseAncestors ) );
1322  MODebug2->Message( moText("m_iMethodBaseIterator: ") + IntToStr( m_iMethodBaseIterator ) );
1323  MODebug2->Message( moText("m_iMethodBase: ") + IntToStr( m_iMethodBase ) );
1324  */
1325  m_iMethodBase = 1;
1326  switch ( iFunctionNumber - m_iMethodBase )
1327  {
1328  case 0:
1330  return luaPushDebugString(vm);//0
1331 
1332  case 1:
1334  return luaGetResourceManager(vm);//1
1335 
1337  case 2:
1339  return luaSetPreconf(vm);//2
1340  case 3:
1342  return luaGetPreconf(vm);//3
1343 
1344 
1345  case 4:
1347  return luaGetParamIndex(vm);//4
1348  case 5:
1350  return luaGetCurrentValue(vm);//5
1351  case 6:
1353  return luaSetCurrentValue(vm);//6
1354  case 7:
1356  return luaGetValuesCount(vm);//7
1357 
1358 
1359 
1360  case 8:
1362  return luaGetInletIndex(vm);//8
1363  case 9:
1365  return luaGetInletData(vm);//9
1366  case 10:
1368  return luaSetInletData(vm);//10
1369 
1370 #ifdef USE_TUIO
1371  case 11:
1376  return luaGetTuioSystem(vm);//10
1377  case 12:
1379  return luaGetTuioCursorCount(vm);//11
1380  case 13:
1382  return luaGetTuioCursor(vm);//12
1383  case 14:
1385  return luaGetTuioObjectCount(vm);//13
1386  case 15:
1388  return luaGetTuioObject(vm);//14
1389 #else
1390  case 11:
1391  case 12:
1392  case 13:
1393  case 14:
1394  case 15:
1396  return 0;
1397 #endif
1398 
1399  case 16:
1401  return luaGetTrackerSystemData(vm);//15
1402  case 17:
1404  return luaGetTrackerFeaturesCount(vm);//16
1405  case 18:
1407  return luaGetTrackerValidFeatures(vm);//17
1408  case 19:
1410  return luaGetTrackerFeature(vm);//18
1411  case 20:
1413  return luaGetTrackerVariance(vm);//19
1414  case 21:
1416  return luaGetTrackerBarycenter(vm);//20
1417  case 22:
1419  return luaGetTrackerAcceleration(vm);//21
1420  case 23:
1422  return luaGetTrackerVelocity(vm);//22
1423  case 24:
1425  return luaGetTrackerZone(vm);//23
1426 
1427  case 25:
1429  return luaGetTrackerHistory(vm);//24
1430  case 26:
1432  return luaStartTrackerHistory(vm);//25
1433  case 27:
1435  return luaPauseTrackerHistory(vm);//26
1436  case 28:
1438  return luaContinueTrackerHistory(vm);//27
1439  case 29:
1441  return luaStopTrackerHistory(vm);//28
1442 
1443  case 30:
1445  return luaGetHistoryRecord(vm);//29
1446  case 31:
1448  return luaGetHistoryBarycenter(vm);//30
1449  case 32:
1451  return luaGetHistoryVariance(vm);//31
1452  case 33:
1454  return luaGetHistoryBounding(vm);//32
1455  case 34:
1457  return luaGetHistoryAverage(vm);//33
1458  case 35:
1460  return luaGetHistoryMinMax(vm);//34
1461  default:
1462  MODebug2->Error("moMoldeoObject::ScriptCalling > not a valid index (iFunctionNumber - m_iMethodBase) " + IntToStr(iFunctionNumber - m_iMethodBase));
1463  break;
1464 
1465  }
1466  return 0;
1467 }
1468 //#include "lua.h"
1470 {
1471  lua_State *state = (lua_State *) vm;
1472 
1473  if ( strcmp( "Run", strFunc) == 0 ||
1474  strcmp( "Draw", strFunc) == 0 ||
1475  strcmp( "Init", strFunc) == 0 ||
1476  strcmp( "Finish", strFunc) == 0 ||
1477  strcmp( "RunSystem", strFunc) == 0 ||
1478  strcmp( "Update", strFunc) == 0 ||
1479  strcmp( "RunParticle", strFunc) == 0
1480  ) {
1481  MOint script_result = (MOint) lua_tonumber (state, 1);
1482 
1483  if (script_result != 0) {
1484 
1485  char *text = (char *) lua_tostring (state, -1);
1486 
1487  MODebug2->Error(
1488  moText(GetLabelName())
1489  + moText(" function:")
1490  + moText(strFunc)
1491  + moText(" >> lua script returned error code: ")
1492  + (moText)IntToStr(script_result)
1493  + moText(" >> ")
1494  + moText(text)
1495  );
1496 
1497  }
1498  }
1499 }
1500 
1501 
1503  lua_State *state = (lua_State *) vm;
1504  if (lua_isboolean(state,1)) {
1505  bool vb = lua_toboolean(state,1);
1506  vb ? MODebug2->Message(moText("true")) : MODebug2->Message(moText("false"));
1507  } else {
1508  char *text = (char *) lua_tostring (state, 1);
1509  MODebug2->Message(moText(text));
1510  }
1511 
1512  return 0;
1513 }
1514 
1516 
1517  lua_State *state = (lua_State *) vm;
1518  state = NULL; //unused
1519  if (GetResourceManager()) {
1520  if (GetResourceManager()->GetScriptMan()) {
1522  }
1523  }
1524 
1525  return 1;
1526 }
1527 
1530  lua_State *state = (lua_State *) vm;
1531 
1532  MOint preconfid = (MOint) lua_tonumber (state, 1);
1533 
1534  if (this->GetConfig()) {
1535  this->GetConfig()->SetCurrentPreConf( preconfid );
1536  } else MODebug2->Push("no debug");
1537 
1538  return 0;
1539 }
1540 
1542  lua_State *state = (lua_State *) vm;
1543 
1544  if (this->GetConfig()) {
1545  lua_pushnumber(state, (lua_Number) this->GetConfig()->GetCurrentPreConf() );
1546  }
1547 
1548  return 1;
1549 }
1550 
1552 
1553  lua_State *state = (lua_State *) vm;
1554 
1555  char *text = (char *) lua_tostring (state, 1);
1556 
1557  if (GetConfig()) {
1558  lua_pushnumber(state, (lua_Number) GetConfig()->GetParamIndex(text) );
1559  }
1560 
1561  return 1;
1562 
1563 }
1564 
1566 
1567  lua_State *state = (lua_State *) vm;
1568 
1569  MOint paramid = (MOint) lua_tonumber (state, 1);
1570  MOint valueid = (MOint) lua_tonumber (state, 2);
1571 
1572  if (GetConfig()) {
1573  GetConfig()->SetCurrentValueIndex( paramid, valueid );
1574  } else {
1575  MODebug2->Error( moText(" in MoldeoObject script: SetCurrentValue : config not founded : id:")+(moText)GetLabelName() );
1576  }
1577 
1578  return 0;
1579 }
1580 
1581 
1583 
1584  lua_State *state = (lua_State *) vm;
1585 
1586  MOint paramid = (MOint) lua_tonumber (state, 1);
1587 
1588  if (GetConfig()) {
1589  int valueid = GetConfig()->GetParam( paramid ).GetIndexValue();
1590  lua_pushnumber(state, (lua_Number) valueid );
1591  return 1;
1592  } else {
1593  MODebug2->Error( moText(" in MoldeoObject script: GetCurrentValue : config not founded : id:")+(moText)GetLabelName() );
1594  }
1595 
1596  return 0;
1597 }
1598 
1599 
1601 
1602  lua_State *state = (lua_State *) vm;
1603 
1604  MOint paramid = (MOint) lua_tonumber (state, 1);
1605 
1606  if (GetConfig()) {
1607  int valuecount = GetConfig()->GetParam( paramid ).GetValuesCount();
1608  lua_pushnumber(state, (lua_Number) valuecount );
1609  return 1;
1610  } else {
1611  MODebug2->Error( moText(" in MoldeoObject script: GetValuesCount : config not founded : id:")+(moText)GetLabelName() );
1612  }
1613 
1614  return 0;
1615 }
1616 
1617 
1618 
1620  lua_State *state = (lua_State *) vm;
1621 
1622  char *inletlabelname = (char *) lua_tostring (state, 1);
1623 
1624  for( MOuint i=0; i<m_Inlets.Count(); i++ ) {
1625  moInlet* pInlet = m_Inlets[i];
1626  if (pInlet) {
1627  moText lname = pInlet->GetConnectorLabelName();
1628  moText lmname( inletlabelname );
1629  if ( lname == lmname ) {
1630  lua_pushnumber(state, (lua_Number) i );
1631  return 1;
1632  }
1633  }
1634  }
1635 
1636  lua_pushnumber(state, (lua_Number) -1 );
1637  return 1;
1638 }
1639 
1641  lua_State *state = (lua_State *) vm;
1642 
1643  moVector2d* pv2d;
1644  moVector3d* pv3d;
1645  moVector4d* pv4d;
1646  moVector2i* pv2i;
1647  moVector3i* pv3i;
1648  moVector4i* pv4i;
1649 
1650  unsigned int i;
1651  moData MData;
1652  moDataMessage* pDataMessage;
1654 
1656 
1657 
1658  int inletindex = (int) lua_tonumber (state, 1);
1659 
1660  if ( inletindex>=0 && inletindex<(int)m_Inlets.Count()) {
1661  moInlet* pInlet = m_Inlets[inletindex];
1662  if ( pInlet ) {
1663  moData* pData = pInlet->GetData();
1664  //lua_pushnumber( state, (lua_Number) (int)pType );
1665  if (pData) {
1666  moDataType pType = pData->Type();
1667  switch((int)pType) {
1668  case MO_DATA_NUMBER:
1669  lua_pushnumber( state, (lua_Number) pData->Long() );
1670  return 1;
1671  break;
1672  case MO_DATA_NUMBER_CHAR:
1673  lua_pushnumber( state, (lua_Number) pData->Long() );
1674  return 1;
1675  break;
1676  case MO_DATA_NUMBER_INT:
1677  lua_pushnumber( state, (lua_Number) pData->Long() );
1678  return 1;
1679  break;
1680  case MO_DATA_NUMBER_LONG:
1681  lua_pushnumber( state, (lua_Number) pData->Long() );
1682  return 1;
1683  break;
1684  case MO_DATA_NUMBER_DOUBLE:
1685  lua_pushnumber( state, (lua_Number) pData->Double() );
1686  return 1;
1687  case MO_DATA_NUMBER_FLOAT:
1688  lua_pushnumber( state, (lua_Number) pData->Float() );
1689  return 1;
1690  case MO_DATA_TEXT:
1691  lua_pushstring( state, (char*) pData->Text() );
1692  return 1;
1693  case MO_DATA_MESSAGE:
1694  pDataMessage = (moDataMessage*)pData->Pointer();
1695  //MODebug2->Message("moMoldeoObject::luaGetInletData() > MO_DATA_MESSAGE");
1696  if (pDataMessage) {
1697  //MODebug2->Message("moMoldeoObject::luaGetInletData() > MO_DATA_MESSAGE > count: " + IntToStr(pDataMessage->Count()) );
1698  for(i=0;i<pDataMessage->Count();i++) {
1699  MData = pDataMessage->Get(i);
1700  //MODebug2->Message("moMoldeoObject::luaGetInletData() > MO_DATA_MESSAGE > data: " + MData.ToText() );
1701  lua_pushstring( state, (char*) MData.ToText() );
1702  }
1703  return i;
1704  }
1705  return 1;
1706  case MO_DATA_VECTOR2F:
1707  pv2d = (moVector2d*)pData->Pointer();
1708  if (pv2d) {
1709  lua_pushnumber( state, (lua_Number) pv2d->X() );
1710  lua_pushnumber( state, (lua_Number) pv2d->Y() );
1711  return 2;
1712  }
1713  break;
1714  case MO_DATA_VECTOR3F:
1715  pv3d = (moVector3d*)pData->Pointer();
1716  if (pv3d) {
1717  lua_pushnumber( state, (lua_Number) pv3d->X() );
1718  lua_pushnumber( state, (lua_Number) pv3d->Y() );
1719  lua_pushnumber( state, (lua_Number) pv3d->Z() );
1720  return 3;
1721  }
1722  break;
1723  case MO_DATA_VECTOR4F:
1724  pv4d = (moVector4d*)pData->Pointer();
1725  if (pv4d) {
1726  lua_pushnumber( state, (lua_Number) pv4d->X() );
1727  lua_pushnumber( state, (lua_Number) pv4d->Y() );
1728  lua_pushnumber( state, (lua_Number) pv4d->Z() );
1729  lua_pushnumber( state, (lua_Number) pv4d->W() );
1730  return 4;
1731  }
1732  break;
1733  case MO_DATA_VECTOR2I:
1734  pv2i = (moVector2i*)pData->Pointer();
1735  if (pv2i) {
1736  lua_pushnumber( state, (lua_Number) pv2i->X() );
1737  lua_pushnumber( state, (lua_Number) pv2i->Y() );
1738  return 2;
1739  }
1740  break;
1741  case MO_DATA_VECTOR3I:
1742  pv3i = (moVector3i*)pData->Pointer();
1743  if (pv3i) {
1744  lua_pushnumber( state, (lua_Number) pv3i->X() );
1745  lua_pushnumber( state, (lua_Number) pv3i->Y() );
1746  lua_pushnumber( state, (lua_Number) pv3i->Z() );
1747  return 3;
1748  }
1749  break;
1750  case MO_DATA_VECTOR4I:
1751  pv4i = (moVector4i*)pData->Pointer();
1752  if (pv4i) {
1753  lua_pushnumber( state, (lua_Number) pv4i->X() );
1754  lua_pushnumber( state, (lua_Number) pv4i->Y() );
1755  lua_pushnumber( state, (lua_Number) pv4i->Z() );
1756  lua_pushnumber( state, (lua_Number) pv4i->W() );
1757  return 4;
1758  }
1759  break;
1760 
1761  case MO_DATA_FUNCTION:
1762  lua_pushnumber( state, (lua_Number) pData->Eval() );
1763  return 1;
1764  default:
1765  moText ttype = pData->TypeToText();
1766  lua_pushstring( state, ttype );
1767  if (pData->Type()==MO_DATA_NUMBER_LONG) {
1768  lua_pushnumber( state, (lua_Number) pData->Long() );
1769  return 2;
1770  }
1771  return 1;
1772  }
1773  } else {
1774  moText tres("bad data pointer");
1775  lua_pushstring( state, tres );
1776  return 1;
1777  }
1778  }
1779  moText tres("inlet data not updated");
1780  lua_pushstring( state, tres );
1781  return 1;
1782 
1783  }
1784  moText tres("invalid");
1785  lua_pushstring( state, tres );
1786  return 1;
1787 }
1788 
1789 
1791 
1792  lua_State *state = (lua_State *) vm;
1793 
1794  int inletindex = (int) lua_tonumber (state, 1);
1795 
1796  if ( inletindex>=0 && inletindex<(int)m_Inlets.Count()) {
1797 
1798  moInlet* pInlet = m_Inlets[inletindex];
1799 
1800  if ( pInlet ) {
1801  moData* pData = pInlet->GetInternalData();
1802  if (pData) {
1803  moDataType pType = pData->Type();
1804  switch( pType ) {
1805  case MO_DATA_NUMBER:
1806  case MO_DATA_NUMBER_CHAR:
1807  case MO_DATA_NUMBER_INT:
1808  case MO_DATA_NUMBER_LONG:
1809  case MO_DATA_NUMBER_MIDI:
1810  pData->SetLong( (MOlong) lua_tonumber ( state, 2 ) );
1811  pInlet->Update();
1812 
1813  return 0;
1814 
1816  case MO_DATA_FONTPOINTER:
1817  case MO_DATA_IMAGESAMPLE:
1820  //pData->SetLong( (MOlong) lua_tonumber ( state, 3 ) );
1821  pInlet->Update();
1822  return 0;
1823 
1824  case MO_DATA_VECTOR2I:
1825  if (pData->Vector2i())
1826  (*pData->Vector2i()) = moVector2i( (MOlong) lua_tonumber ( state, 2 ),
1827  (MOlong) lua_tonumber ( state, 3 ) );
1828  pInlet->Update();
1829 
1830  return 0;
1831 
1832  case MO_DATA_VECTOR3I:
1833  if (pData->Vector3i())
1834  (*pData->Vector3i()) = moVector3i( (MOlong) lua_tonumber ( state, 2 ),
1835  (MOlong) lua_tonumber ( state, 3 ),
1836  (MOlong) lua_tonumber ( state, 4 ) );
1837  pInlet->Update();
1838  return 0;
1839 
1840  case MO_DATA_VECTOR4I:
1841  if (pData->Vector4i())
1842  (*pData->Vector4i()) = moVector4i( (MOlong) lua_tonumber ( state, 2 ),
1843  (MOlong) lua_tonumber ( state, 3 ),
1844  (MOlong) lua_tonumber ( state, 4 ),
1845  (MOlong) lua_tonumber ( state, 5 ) );
1846  pInlet->Update();
1847  return 0;
1848 
1849  case MO_DATA_VECTOR2F:
1850  if (pData->Vector2d())
1851  (*pData->Vector2d()) = moVector2d( (MOdouble) lua_tonumber ( state, 2 ),
1852  (MOdouble) lua_tonumber ( state, 3 ));
1853  pInlet->Update();
1854  return 0;
1855 
1856  case MO_DATA_VECTOR3F:
1857  if (pData->Vector3d())
1858  (*pData->Vector3d()) = moVector3d( (MOdouble) lua_tonumber ( state, 2 ),
1859  (MOdouble) lua_tonumber ( state, 3 ),
1860  (MOdouble) lua_tonumber ( state, 4 ));
1861  pInlet->Update();
1862  return 0;
1863 
1864  case MO_DATA_VECTOR4F:
1865  if (pData->Vector4d())
1866  (*pData->Vector4d()) = moVector4d( (MOdouble) lua_tonumber ( state, 2 ),
1867  (MOdouble) lua_tonumber ( state, 3 ),
1868  (MOdouble) lua_tonumber ( state, 4 ),
1869  (MOdouble) lua_tonumber ( state, 5 ) );
1870  pInlet->Update();
1871  return 0;
1872 
1873  case MO_DATA_MESSAGE:
1874  case MO_DATA_MESSAGES:
1875  pInlet->Update();
1876  return 0;
1877 
1878  case MO_DATA_NUMBER_DOUBLE:
1879  case MO_DATA_NUMBER_FLOAT:
1880  pData->SetDouble( (MOdouble) lua_tonumber ( state, 2 ) );
1881  pInlet->Update();
1882  return 0;
1883 
1884  case MO_DATA_TEXT:
1885  //lua_pushstring(state, pData->Text() );
1886  pData->SetText( lua_tostring ( state, 2 ) );
1887  pInlet->Update();
1888  return 0;
1889 
1890  default:
1891  moText tres("data type invalid");
1892  tres = tres + pData->TypeToText();
1893  lua_pushstring( state, tres );
1894  pInlet->Update();
1895  return 1;
1896 
1897  }
1898  } else {
1899  moText tres("data si null");
1900  lua_pushstring( state, tres );
1901  return 1;
1902  }
1903  }
1904  }
1905 
1906  moText tres("invalid");
1907  lua_pushstring( state, tres );
1908  return 1;
1909 }
1910 
1911 
1912 
1913 
1925 #ifdef USE_TUIO
1926 
1927 using namespace TUIO;
1931 int moMoldeoObject::luaGetTuioSystem(moLuaVirtualMachine& vm) {
1932 
1933  lua_State *state = (lua_State *) vm;
1934 
1935  int tuioindex = GetInletIndex("TUIOSYSTEM");
1936 
1937  lua_pushnumber( state, (lua_Number) tuioindex );
1938 
1939  return 1;
1940 }
1941 
1942 int moMoldeoObject::luaGetTuioCursorCount(moLuaVirtualMachine& vm) {
1943 
1944  lua_State *state = (lua_State *) vm;
1945 
1946  moTUIOSystemData* pTuio = NULL;
1947 
1948  int tuioindex = (int)lua_tonumber( state, 1);
1949 
1950  moInlet* pInlet = NULL;
1951 
1952  pInlet = m_Inlets[tuioindex];
1953 
1954  if (pInlet && pInlet->Updated()) {
1955  pTuio = (moTUIOSystemData*)pInlet->GetData()->Pointer();
1956  if (pTuio) {
1957  std::list<TuioCursor*> pCursors = pTuio->getTuioCursors();
1958  int nc = pCursors.size();
1959  lua_pushnumber( state, (lua_Number) nc );
1960  return 1;
1961  }
1962 
1963  }
1964  lua_pushnumber( state, (lua_Number) -1 );
1965  return 1;
1966 }
1967 
1968 
1969 int moMoldeoObject::luaGetTuioCursor(moLuaVirtualMachine& vm) {
1970 
1971  lua_State *state = (lua_State *) vm;
1972 
1973  moTUIOSystemData* pTuio = NULL;
1974 
1975  int tuioindex = (int)lua_tonumber( state, 1);
1976  int cursorindex = (int)lua_tonumber( state, 2);
1977 
1978  moInlet* pInlet = NULL;
1979 
1980  pInlet = m_Inlets[tuioindex];
1981 
1982  if (pInlet && pInlet->Updated()) {
1983  pTuio = (moTUIOSystemData*)pInlet->GetData()->Pointer();
1984  if (pTuio) {
1985 
1986  std::list<TuioCursor*> cursors = pTuio->getTuioCursors();
1987 
1988  int cn = 0;
1989  TuioCursor* pCursor = NULL;
1990 
1991  for (std::list<TuioCursor*>::iterator tuioCursor = cursors.begin(); tuioCursor!=cursors.end(); tuioCursor++,cn++) {
1992  if (cn == cursorindex) {
1993  pCursor = (*tuioCursor);
1994  }
1995  }
1996 
1997  if (pCursor) {
1998  lua_pushnumber( state, (lua_Number) pCursor->getCursorID() );
1999  lua_pushnumber( state, (lua_Number) pCursor->getSessionID() );
2000  lua_pushnumber( state, (lua_Number) pCursor->getStartTime().getTotalMilliseconds() );
2001  lua_pushnumber( state, (lua_Number) pCursor->getPosition().getX() );
2002  lua_pushnumber( state, (lua_Number) pCursor->getPosition().getY() );
2003  lua_pushnumber( state, (lua_Number) pCursor->getXSpeed() );
2004  lua_pushnumber( state, (lua_Number) pCursor->getYSpeed() );
2005  return 7;
2006  }
2007  }
2008 
2009  }
2010  lua_pushnumber( state, (lua_Number) -1 );
2011  return 1;
2012 }
2013 
2014 int moMoldeoObject::luaGetTuioObjectCount(moLuaVirtualMachine& vm) {
2015 
2016  lua_State *state = (lua_State *) vm;
2017 
2018  moTUIOSystemData* pTuio = NULL;
2019 
2020  int tuioindex = (int)lua_tonumber( state, 1);
2021 
2022  moInlet* pInlet = NULL;
2023 
2024  pInlet = m_Inlets[tuioindex];
2025 
2026  if (pInlet && pInlet->Updated()) {
2027  pTuio = (moTUIOSystemData*)pInlet->GetData()->Pointer();
2028  if (pTuio) {
2029  std::list<TuioObject*> pObjects = pTuio->getTuioObjects();
2030  int nc = pObjects.size();
2031  lua_pushnumber( state, (lua_Number) nc );
2032  return 1;
2033  }
2034 
2035  }
2037  lua_pushnumber( state, (lua_Number) -1 );
2038  return 1;
2039 }
2040 
2041 int moMoldeoObject::luaGetTuioObject(moLuaVirtualMachine& vm) {
2042 
2043  lua_State *state = (lua_State *) vm;
2044 
2045  moTUIOSystemData* pTuio = NULL;
2046 
2047  int tuioindex = (int)lua_tonumber( state, 1);
2048  int objectindex = (int)lua_tonumber( state, 2);
2049 
2050  moInlet* pInlet = NULL;
2051 
2052  pInlet = m_Inlets[tuioindex];
2053 
2054  if (pInlet && pInlet->Updated()) {
2055  pTuio = (moTUIOSystemData*)pInlet->GetData()->Pointer();
2056  if (pTuio) {
2057 
2058  std::list<TuioObject*> objects = pTuio->getTuioObjects();
2059 
2060  int cn = 0;
2061  TuioObject* pObject = NULL;
2062 
2063  for (std::list<TuioObject*>::iterator tuioObject = objects.begin(); tuioObject!=objects.end(); tuioObject++,cn++) {
2064  if (cn == objectindex) {
2065  pObject = (*tuioObject);
2066  }
2067  }
2068 
2069  if (pObject) {
2070  lua_pushnumber( state, (lua_Number) pObject->getSymbolID() );
2071  lua_pushnumber( state, (lua_Number) pObject->getSessionID() );
2072  lua_pushnumber( state, (lua_Number) pObject->getStartTime().getTotalMilliseconds() );
2073  lua_pushnumber( state, (lua_Number) pObject->getPosition().getX() );
2074  lua_pushnumber( state, (lua_Number) pObject->getPosition().getY() );
2075  lua_pushnumber( state, (lua_Number) pObject->getXSpeed() );
2076  lua_pushnumber( state, (lua_Number) pObject->getYSpeed() );
2077  lua_pushnumber( state, (lua_Number) pObject->getAngle() );
2078  return 8;
2079  }
2080  }
2081 
2082  }
2083  lua_pushnumber( state, (lua_Number) -1 );
2084  return 1;
2085 
2086 }
2087 #endif
2088 
2101 
2104  lua_State *state = (lua_State *) vm;
2105 
2106  int trackerindex = GetInletIndex("TRACKERKLT");
2107 
2108  lua_pushnumber( state, (lua_Number) trackerindex );
2109 
2110  return 1;
2111 }
2112 
2114 
2116  lua_State *state = (lua_State *) vm;
2117  int ft_count = -1;
2118 
2119  moTrackerSystemData* pTracker = NULL;
2120 
2121  int trackerindex = (int)lua_tonumber( state, 1);
2122 
2123  moInlet* pInlet = NULL;
2124 
2125  pInlet = m_Inlets[trackerindex];
2126 
2127  if (pInlet && pInlet->Updated()) {
2128  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2129  if (pTracker) {
2130  ft_count = pTracker->GetFeaturesCount();
2131  }
2132  }
2133 
2134  lua_pushnumber( state, (lua_Number) ft_count );
2135 
2136  return 1;
2137 }
2138 
2140 
2142  lua_State *state = (lua_State *) vm;
2143  int ft_validcount = 0;
2144 
2145  moTrackerSystemData* pTracker = NULL;
2146 
2147  int trackerindex = (int)lua_tonumber( state, 1);
2148 
2149  moInlet* pInlet = NULL;
2150 
2151  pInlet = m_Inlets[trackerindex];
2152 
2153  if (pInlet && pInlet->Updated()) {
2154  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2155  if (pTracker) {
2156  ft_validcount = pTracker->GetValidFeatures();
2157  }
2158  }
2159 
2160  lua_pushnumber( state, (lua_Number) ft_validcount );
2161 
2162  return 1;
2163 }
2164 
2166 
2167  lua_State *state = (lua_State *) vm;
2168 
2169  moTrackerSystemData* pTracker = NULL;
2170 
2171  int trackerindex = (int)lua_tonumber( state, 1);
2172  int featureindex = (MOint) lua_tonumber (state, 2);
2173 
2174  moInlet* pInlet = NULL;
2175 
2176  pInlet = m_Inlets[trackerindex];
2177 
2178  float x, y, vx, vy, tr_x, tr_y;
2179  int v;
2180  x = y = 0.0;
2181  v = 0;
2182 
2183  if (pInlet && pInlet->Updated()) {
2184  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2185  if (pTracker) {
2186  moTrackerFeature* TF = pTracker->GetFeature(featureindex);
2187  if (TF) {
2188  x = TF->x;
2189  y = TF->y;
2190  v = TF->val;
2191  vx = TF->v_x;
2192  vy = TF->v_y;
2193  tr_x = TF->tr_x;
2194  tr_y = TF->tr_y;
2195  }
2196  }
2197  }
2198 
2199  lua_pushnumber(state, (lua_Number)x);
2200  lua_pushnumber(state, (lua_Number)y);
2201  lua_pushnumber(state, (lua_Number)v);
2202  lua_pushnumber(state, (lua_Number)vx);
2203  lua_pushnumber(state, (lua_Number)vy);
2204  lua_pushnumber(state, (lua_Number)tr_x);
2205  lua_pushnumber(state, (lua_Number)tr_y);
2206 
2207  return 7;
2208 
2209 }
2210 
2212 
2213  lua_State *state = (lua_State *) vm;
2214 
2215  moTrackerSystemData* pTracker = NULL;
2216 
2217  int trackerindex = (int)lua_tonumber( state, 1);
2218 
2219  moInlet* pInlet = NULL;
2220 
2221  pInlet = m_Inlets[trackerindex];
2222 
2223  float x, y, L;
2224  x = y = L = 0.0;
2225 
2226  if (pInlet && pInlet->Updated()) {
2227  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2228  if (pTracker) {
2229  L = pTracker->GetVariance().Length();
2230  x = pTracker->GetVariance().X();
2231  y = pTracker->GetVariance().Y();
2232  }
2233  }
2234 
2235  lua_pushnumber(state, (lua_Number)L);
2236  lua_pushnumber(state, (lua_Number)x);
2237  lua_pushnumber(state, (lua_Number)y);
2238 
2239  return 3;
2240 }
2241 
2243 
2244  lua_State *state = (lua_State *) vm;
2245 
2246  moTrackerSystemData* pTracker = NULL;
2247 
2248  int trackerindex = (int)lua_tonumber( state, 1);
2249 
2250  moInlet* pInlet = NULL;
2251 
2252  pInlet = m_Inlets[trackerindex];
2253 
2254  float x, y;
2255  x = y = 0.0;
2256 
2257  if (pInlet && pInlet->Updated()) {
2258  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2259  if (pTracker) {
2260  x = pTracker->GetBarycenter().X();
2261  y = pTracker->GetBarycenter().Y();
2262  }
2263  }
2264 
2265  lua_pushnumber(state, (lua_Number)x);
2266  lua_pushnumber(state, (lua_Number)y);
2267 
2268  return 2;
2269 
2270 }
2271 
2272 
2274 
2275 
2276  lua_State *state = (lua_State *) vm;
2277 
2278  moTrackerSystemData* pTracker = NULL;
2279 
2280  int trackerindex = (int)lua_tonumber( state, 1);
2281 
2282  moInlet* pInlet = NULL;
2283 
2284  pInlet = m_Inlets[trackerindex];
2285 
2286  float x, y, L;
2287  x = y = L = 0.0;
2288 
2289  if (pInlet && pInlet->Updated()) {
2290  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2291  if (pTracker) {
2292  L = pTracker->GetBarycenterAcceleration().Length();
2293  x = pTracker->GetBarycenterAcceleration().X();
2294  y = pTracker->GetBarycenterAcceleration().Y();
2295  }
2296  }
2297 
2298  lua_pushnumber(state, (lua_Number)L);
2299  lua_pushnumber(state, (lua_Number)x);
2300  lua_pushnumber(state, (lua_Number)y);
2301 
2302  return 3;
2303 }
2304 
2306 
2307  lua_State *state = (lua_State *) vm;
2308 
2309  moTrackerSystemData* pTracker = NULL;
2310 
2311  int trackerindex = (int)lua_tonumber( state, 1);
2312 
2313  moInlet* pInlet = NULL;
2314 
2315  pInlet = m_Inlets[trackerindex];
2316 
2317  float x, y, L;
2318  x = y = L = 0.0;
2319 
2320  if (pInlet && pInlet->Updated()) {
2321  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2322  if (pTracker) {
2323  L = pTracker->GetBarycenterMotion().Length();
2324  x = pTracker->GetBarycenterMotion().X();
2325  y = pTracker->GetBarycenterMotion().Y();
2326  }
2327  }
2328 
2329  lua_pushnumber(state, (lua_Number)L);
2330  lua_pushnumber(state, (lua_Number)x);
2331  lua_pushnumber(state, (lua_Number)y);
2332  return 3;
2333 }
2334 
2335 
2337 
2338  lua_State *state = (lua_State *) vm;
2339 
2340  moTrackerSystemData* pTracker = NULL;
2341 
2342  int trackerindex = (int)lua_tonumber( state, 1);
2343  int izone = (int) lua_tonumber (state, 2);
2344 
2345  int nitems;
2346  nitems = 0;
2347 
2348  moInlet* pInlet = NULL;
2349 
2350  pInlet = m_Inlets[trackerindex];
2351 
2352  if (pInlet && pInlet->Updated()) {
2353  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2354  if (pTracker) {
2355  nitems = pTracker->GetPositionMatrix( pTracker->ZoneToPosition(izone) );
2356  }
2357  }
2358 
2359  lua_pushnumber( state, (lua_Number) nitems);
2360  return 1;
2361 }
2362 
2364 
2365  lua_State *state = (lua_State *) vm;
2366 
2367  moTrackerSystemData* pTracker = NULL;
2368 
2369  int trackerindex = (int)lua_tonumber( state, 1);
2370 
2371  int nitems;
2372  nitems = 0;
2373 
2374  moInlet* pInlet = NULL;
2375 
2376  pInlet = m_Inlets[trackerindex];
2377 
2378  if (pInlet && pInlet->Updated()) {
2379  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2380  if (pTracker) {
2381  nitems = pTracker->GetHistory().CountRecords();
2382  }
2383  }
2384 
2385  lua_pushnumber( state, (lua_Number) nitems);
2386  return 1;
2387 
2388 }
2389 
2391  lua_State *state = (lua_State *) vm;
2392 
2393  moTrackerSystemData* pTracker = NULL;
2394 
2395  int trackerindex = (int)lua_tonumber( state, 1);
2396  int maxtime_ms = (int)lua_tonumber( state, 2);
2397  int granularity_ms = (int)lua_tonumber( state, 3);
2398 
2399  moInlet* pInlet = NULL;
2400 
2401  pInlet = m_Inlets[trackerindex];
2402 
2403  if (pInlet && pInlet->Updated()) {
2404  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2405  if (pTracker) {
2406  pTracker->GetHistory().StartRecording(maxtime_ms,granularity_ms);
2407  }
2408  }
2409  return 0;
2410 }
2411 
2413 
2414  lua_State *state = (lua_State *) vm;
2415 
2416  moTrackerSystemData* pTracker = NULL;
2417 
2418  int trackerindex = (int)lua_tonumber( state, 1);
2419 
2420  moInlet* pInlet = NULL;
2421 
2422  pInlet = m_Inlets[trackerindex];
2423 
2424  if (pInlet && pInlet->Updated()) {
2425  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2426  if (pTracker) {
2427  pTracker->GetHistory().PauseRecording();
2428  }
2429  }
2430  return 0;
2431 }
2432 
2433 
2435 
2436  lua_State *state = (lua_State *) vm;
2437 
2438  moTrackerSystemData* pTracker = NULL;
2439 
2440  int trackerindex = (int)lua_tonumber( state, 1);
2441 
2442  moInlet* pInlet = NULL;
2443 
2444  pInlet = m_Inlets[trackerindex];
2445 
2446  if (pInlet && pInlet->Updated()) {
2447  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2448  if (pTracker) {
2449  pTracker->GetHistory().ContinueRecording();
2450  }
2451  }
2452 
2453  return 0;
2454 }
2456  lua_State *state = (lua_State *) vm;
2457 
2458  moTrackerSystemData* pTracker = NULL;
2459 
2460  int trackerindex = (int)lua_tonumber( state, 1);
2461 
2462  moInlet* pInlet = NULL;
2463 
2464  pInlet = m_Inlets[trackerindex];
2465 
2466  if (pInlet && pInlet->Updated()) {
2467  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2468  if (pTracker) {
2469  pTracker->GetHistory().StopRecording();
2470  }
2471  }
2472 
2473  return 0;
2474 
2475 }
2477  lua_State *state = (lua_State *) vm;
2478 
2479  moTrackerSystemData* pTracker = NULL;
2480 
2481  int trackerindex = (int)lua_tonumber( state, 1);
2482  int recordindex = (int)lua_tonumber( state, 2);
2483 
2484  moTrackerInstanceRecord IRecord;
2485 
2486  moInlet* pInlet = NULL;
2487 
2488  pInlet = m_Inlets[trackerindex];
2489 
2490  if (pInlet && pInlet->Updated()) {
2491  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2492  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2493  IRecord = pTracker->GetHistory().Get( recordindex );
2494  } else {
2495  MODebug2->Error("luaGetHistoryRecord::out of bound recordindex:"+IntToStr(recordindex)+" histories:"+IntToStr( pTracker->GetHistory().CountRecords()) );
2496  }
2497  } else {
2498  MODebug2->Error("luaGetHistoryRecord:: no tracker index or inlet not updated");
2499  }
2500 
2501  lua_pushnumber( state, (lua_Number) IRecord.m_ValidFeatures);
2502  lua_pushnumber( state, (lua_Number) IRecord.m_DeltaValidFeatures);
2503  lua_pushnumber( state, (lua_Number) IRecord.m_nFeatures);
2504  lua_pushnumber( state, (lua_Number) IRecord.m_SurfaceCovered);
2505  lua_pushnumber( state, (lua_Number) IRecord.m_Tick);
2506  return 5;
2507 }
2508 
2510  lua_State *state = (lua_State *) vm;
2511 
2512  moTrackerSystemData* pTracker = NULL;
2513 
2514  int trackerindex = (int)lua_tonumber( state, 1);
2515  int recordindex = (int)lua_tonumber( state, 2);
2516 
2517  moTrackerInstanceRecord IRecord;
2518 
2519  moInlet* pInlet = NULL;
2520 
2521  pInlet = m_Inlets[trackerindex];
2522 
2523  if (pInlet && pInlet->Updated()) {
2524  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2525  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2526  IRecord = pTracker->GetHistory().Get( recordindex );
2527  }
2528  }
2529 
2530  lua_pushnumber( state, (lua_Number) IRecord.m_Barycenter.X());
2531  lua_pushnumber( state, (lua_Number) IRecord.m_Barycenter.Y());
2532  lua_pushnumber( state, (lua_Number) IRecord.m_BarycenterMotion.X());
2533  lua_pushnumber( state, (lua_Number) IRecord.m_BarycenterMotion.Y());
2534  lua_pushnumber( state, (lua_Number) IRecord.m_BarycenterAcceleration.X());
2535  lua_pushnumber( state, (lua_Number) IRecord.m_BarycenterAcceleration.Y());
2536  return 6;
2537 }
2538 
2541  lua_State *state = (lua_State *) vm;
2542 
2543  moTrackerSystemData* pTracker = NULL;
2544 
2545  int trackerindex = (int)lua_tonumber( state, 1);
2546  int recordindex = (int)lua_tonumber( state, 2);
2547 
2548  moTrackerInstanceRecord IRecord;
2549 
2550  moInlet* pInlet = NULL;
2551 
2552  pInlet = m_Inlets[trackerindex];
2553 
2554  if (pInlet && pInlet->Updated()) {
2555  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2556  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2557  IRecord = pTracker->GetHistory().Get( recordindex );
2558  }
2559  }
2560 
2561  lua_pushnumber( state, (lua_Number) IRecord.m_Variance.X());
2562  lua_pushnumber( state, (lua_Number) IRecord.m_Variance.Y());
2563  lua_pushnumber( state, (lua_Number) IRecord.m_SpeedVariance.X());
2564  lua_pushnumber( state, (lua_Number) IRecord.m_SpeedVariance.Y());
2565  lua_pushnumber( state, (lua_Number) IRecord.m_AccelerationVariance.X());
2566  lua_pushnumber( state, (lua_Number) IRecord.m_AccelerationVariance.Y());
2567  return 6;
2568 
2569 }
2570 
2573  lua_State *state = (lua_State *) vm;
2574 
2575  moTrackerSystemData* pTracker = NULL;
2576 
2577  int trackerindex = (int)lua_tonumber( state, 1);
2578  int recordindex = (int)lua_tonumber( state, 2);
2579 
2580  moTrackerInstanceRecord IRecord;
2581 
2582  moInlet* pInlet = NULL;
2583 
2584  pInlet = m_Inlets[trackerindex];
2585 
2586  if (pInlet && pInlet->Updated()) {
2587  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2588  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2589  IRecord = pTracker->GetHistory().Get( recordindex );
2590  }
2591  }
2592 
2593  lua_pushnumber( state, (lua_Number) IRecord.m_BoundingRectangle.X());
2594  lua_pushnumber( state, (lua_Number) IRecord.m_BoundingRectangle.Y());
2595  lua_pushnumber( state, (lua_Number) IRecord.m_BoundingRectangle.Z());
2596  lua_pushnumber( state, (lua_Number) IRecord.m_BoundingRectangle.W());
2597  lua_pushnumber( state, (lua_Number) IRecord.m_BoundingRectangleAngle );
2598  lua_pushnumber( state, (lua_Number) IRecord.m_BlobCandidates );
2599  return 6;
2600 
2601 }
2602 
2605  lua_State *state = (lua_State *) vm;
2606 
2607  moTrackerSystemData* pTracker = NULL;
2608 
2609  int trackerindex = (int)lua_tonumber( state, 1);
2610  int recordindex = (int)lua_tonumber( state, 2);
2611 
2612  moTrackerInstanceRecord IRecord;
2613 
2614  moInlet* pInlet = NULL;
2615 
2616  pInlet = m_Inlets[trackerindex];
2617 
2618  if (pInlet && pInlet->Updated()) {
2619  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2620  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2621  IRecord = pTracker->GetHistory().Get( recordindex );
2622  }
2623  }
2624 
2625  lua_pushnumber( state, (lua_Number) IRecord.m_AbsoluteSpeedAverage);
2626  lua_pushnumber( state, (lua_Number) IRecord.m_AbsoluteAccelerationAverage);
2627  lua_pushnumber( state, (lua_Number) IRecord.m_AbsoluteTorqueAverage);
2628  return 3;
2629 
2630 }
2631 
2634 
2635  lua_State *state = (lua_State *) vm;
2636 
2637  moTrackerSystemData* pTracker = NULL;
2638 
2639  int trackerindex = (int)lua_tonumber( state, 1);
2640  int recordindex = (int)lua_tonumber( state, 2);
2641 
2642  moTrackerInstanceRecord IRecord;
2643 
2644  moInlet* pInlet = NULL;
2645 
2646  pInlet = m_Inlets[trackerindex];
2647 
2648  if (pInlet && pInlet->Updated()) {
2649  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2650  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2651  IRecord = pTracker->GetHistory().Get( recordindex );
2652  }
2653  }
2654 
2655  lua_pushnumber( state, (lua_Number) IRecord.m_Min.X());
2656  lua_pushnumber( state, (lua_Number) IRecord.m_Min.Y());
2657  lua_pushnumber( state, (lua_Number) IRecord.m_Max.X());
2658  lua_pushnumber( state, (lua_Number) IRecord.m_Max.Y());
2659  return 4;
2660 
2661 }
2662 
2663 const moText&
2665  moText fieldSeparation = ",";
2666  moMobDefinition Definition = GetMobDefinition();
2667  moMobState State = GetState();
2668 
2669  m_FullJSON = "{";
2670  m_FullJSON+= "'objectstate': " + State.ToJSON();
2671  m_FullJSON+= fieldSeparation + "'objecttypeid': '" + IntToStr( moGetStrType( Definition.GetName() ) )+"'";
2672  m_FullJSON+= fieldSeparation + "'objectdefinition': " + Definition.ToJSON();
2673  //m_FullJSON+= fieldSeparation + "'objectconfig': " + m_Config.ToJSON();
2674  m_FullJSON+= "}";
2675 
2676  return m_FullJSON;
2677 }
2678 
2680 
2681  if (p_Str == moText("effect") || p_Str == moText("moEffect")) {
2682  return MO_OBJECT_EFFECT;
2683  } else if (p_Str == moText("mastereffect") || p_Str == moText("moMasterEffect")) {
2684  return MO_OBJECT_MASTEREFFECT;
2685  } else if (p_Str == moText("posteffect") || p_Str == moText("moPostEffect")) {
2686  return MO_OBJECT_POSTEFFECT;
2687  } else if (p_Str == moText("preeffect") || p_Str == moText("moPreEffect")) {
2688  return MO_OBJECT_PREEFFECT;
2689  } else if (p_Str == moText("iodevice") || p_Str == moText("moIODevice")) {
2690  return MO_OBJECT_IODEVICE;
2691  } else if (p_Str == moText("resource") || p_Str == moText("moResource")) {
2692  return MO_OBJECT_RESOURCE;
2693  } else if (p_Str == moText("console") || p_Str == moText("moConsole")) {
2694  return MO_OBJECT_CONSOLE;
2695  }
2696 
2697  return MO_OBJECT_UNDEFINED;
2698 
2699 }
value type: TXT or LNK
Definition: moParam.h:69
void StartRecording(long maxtime=60000, long granularity=30)
Empieza a grabar.
virtual void Deactivate()
MOint GetTextureBuffer(moText p_foldername, MOboolean p_create_tex=true, moText p_bufferformat="JPGAVERAGE")
MOswitch m_Activated
int luaGetHistoryVariance(moLuaVirtualMachine &vm)
Devuelve las varianzas.
moText m_FullJSON
activo al iniciar el proyecto
int luaSetCurrentValue(moLuaVirtualMachine &vm)
Fija el índice del valor actual de un parámetro.
moTypes MOint p_paramindex
Definition: all_f.js:18
Valor de un Parámetro.
Definition: moValue.h:501
virtual bool SetState(const moMobState &p_MobState)
int RegisterBaseFunction(const char *strFuncName)
Definition: moScript.cpp:340
moMoldeoObjectType
Tipos de objetos en Moldeo.
Definition: moTypes.h:525
moText m_MoldeoLabelName
Identificador de objeto Moldeo.
moVector4i * Vector4i()
Definition: moValue.cpp:400
moOutlets m_Outlets
Conectores de salida, Arreglo de moOutlet's.
moMoldeoObjectType m_Type
Etiqueta o Identificador de texto de este objeto.
virtual int Save(const moText &p_save_filename=moText(""))
moEvent * next
Definition: moEventList.h:60
MOint m_InletIdDest
Definition: moEventList.h:115
bool IsInitialized()
Definition: moScript.h:74
const moText & GetLabelName() const
long m_Tick
operador de copia, y seteo de timers
moResourceManager * GetResourceManager()
void SetText(moText ptext)
Definition: moValue.cpp:158
MOdouble Eval()
Definition: moValue.cpp:424
MOint GetId() const
moEvent * First
Definition: moEventList.h:145
MOint m_MoldeoIdSrc
Definition: moEventList.h:119
moVector4< MOlong > moVector4i
Clase Evento.
Definition: moEventList.h:56
void Error(moText p_text)
Anuncia y registra un error.
Definition: moAbstract.cpp:79
void Update(bool force=true)
void SetType(moMoldeoObjectType p_type)
Fija el tipo de moMoldeoObject o moMoldeoObjectType.
moDataType
Definition: moValue.h:98
void SetName(const moText &p_name)
bool CompileFile(const char *strFilename)
Definition: moScript.cpp:261
int luaGetTrackerFeaturesCount(moLuaVirtualMachine &vm)
int luaGetHistoryAverage(moLuaVirtualMachine &vm)
Devuelve los promedios.
double m_AbsoluteAccelerationAverage
cantidad de movimiento
clase base para una fuente 3d o 2d
Definition: moFontManager.h:63
moParamType
Definition: moParam.h:40
static bool FileExists(moText filename)
Conector Inlet, conector que recibe datos.
Definition: moConnectors.h:374
int luaContinueTrackerHistory(moLuaVirtualMachine &vm)
void SetConfigName(const moText &p_configname)
int luaGetTrackerAcceleration(moLuaVirtualMachine &vm)
MOint deviceid
Definition: moEventList.h:62
function p(by, bw, bv)
Definition: jquery.js:28
moData * GetInternalData()
virtual bool Activated() const
virtual void LoadDefinition()
Carga las definiciones de parámetros del archivo de configuración.
void SetScript(const moText &p_script)
mo3dModelManager * GetModelMan()
MOint GetCurrentPreConf()
Devuelve el índice de la preconfiguración seleccionada.
Definition: moConfig.cpp:1586
void Set(moText p_objectname, moText p_objectclass)
Fija el nombre y la clase del objeto a configurar.
Definition: moConfig.h:106
MOboolean Delete(moEvent *ev)
virtual MOboolean CreateConnectors()
static moText TypeToText(moDataType p_data_type)
Definition: moValue.cpp:549
int val
Other states for valid feature point.
float v_y
Speed in the actual frame.
void SetDouble(MOdouble pdouble)
Definition: moValue.cpp:172
moTextureFilter * Get(MOuint p_idx)
value type: TXT or LNK
Definition: moParam.h:56
moConnections * GetConnections()
Devuelve las conecciones de un outlet.
moDatas moDataMessage
Definition: moValue.h:149
#define MO_OUTLET_NAME
moMobDefinition & operator=(const moMobDefinition &mb)
Operador de asignación.
Recursos de datos, objetos, imágenes, videos y funcionalidades múltiples.
Definition: moTypes.h:533
moText ToText() const
Definition: moValue.cpp:707
moRenderManager * GetRenderMan()
MOint GetDestinationConnectorId()
#define MOboolean
Definition: moTypes.h:385
#define MO_OFF
Definition: moTypes.h:366
virtual void Activate()
moFontManager * GetFontMan()
value type: NUM or FUNCTION
Definition: moParam.h:68
virtual int ScriptCalling(moLuaVirtualMachine &vm, int iFunctionNumber)
virtual int GetValidFeatures()
int GetParamIndex(moText p_paramname)
Devuelve el índice correspondiente al parámetro por nombre.
Definition: moConfig.cpp:1008
Objeto dibujable, efecto-maestro ( puede controlar otros efectos )
Definition: moTypes.h:531
virtual moTrackerFeature * GetFeature(int i)
virtual moVector2f GetBarycenter()
bool m_Activate
nombre de la tecla que activa el objeto
bool RunSelectedFunction(int nReturns=0)
Definition: moScript.cpp:529
int m_ValidFeatures
0 nada, 1 todo...
Real Y() const
Definition: moMathVector4.h:77
function x(bx)
Definition: jquery.js:30
virtual moVector2f GetBarycenterAcceleration()
const moText & GetName() const
Nombre del objeto.
bool Activated() const
void SetLabelName(const moText &p_labelname)
Fija la etiqueta de este objeto.
Conector Outlet, conector que envía datos.
Definition: moConnectors.h:410
const moText & GetDescription() const
Devuelve al descripción del objeto.
Real Z() const
Definition: moMathVector3.h:77
MOulong moGetDuration()
Devuelve el valor del reloj del temporizador global.
Definition: moTimer.cpp:134
bool IsParameterDependent()
Definition: moConnectors.h:232
moInlets * GetInlets()
const moText & GetName() const
moText m_Description
Nombre del archivo de configuración.
Clase Mensaje.
Definition: moEventList.h:97
static moText GetTypeToName(moMoldeoObjectType p_Type=MO_OBJECT_UNDEFINED)
Transforma un moMoldeoObjectType en el nombre de su correspondiente.
moTextureFilterIndex * GetTextureFilterIndex()
virtual void ScriptExeInit()
Corre la funcion de script Run o Compila el nuevo script.
moParam * GetPtr()
Definition: moParam.cpp:1275
value type: TXT or LNK, or XML
Definition: moParam.h:54
static moText GetTypeToClass(moMoldeoObjectType p_Type=MO_OBJECT_UNDEFINED)
Transforma un moMoldeoObjectType en el nombre de su correspondiente clase base.
int luaGetTrackerVelocity(moLuaVirtualMachine &vm)
moDataType Type() const
Definition: moValue.cpp:940
int luaGetTrackerVariance(moLuaVirtualMachine &vm)
Objeto indefinido.
Definition: moTypes.h:527
virtual const moMobState & GetState() const
virtual int GetFeaturesCount()
void SetLong(MOlonglong plong)
Definition: moValue.cpp:188
virtual ~moMobDefinition()
Destructor.
int luaGetTrackerBarycenter(moLuaVirtualMachine &vm)
Real X() const
Definition: moMathVector3.h:73
moFont * GetFont(moText p_fontname, bool create=false, moFontType p_fonttype=MO_FONT_OUTLINE, MOfloat p_fontsize=12)
moInlets m_Inlets
Conectores de entrada, Arreglo de moInlet's.
float tr_y
Feature position in the previous frame.
moSoundManager * GetSoundMan()
#define MO_INLET_TYPE
definición de todos los parámetros a encontrar o a crear dentro del moConfig
Definition: moConfig.h:57
virtual bool Selected() const
#define MO_MESSAGE
Definition: moEventList.h:84
const moText & GetName() const
Definition: moParam.h:266
moShaderManager * GetShaderMan()
moMathManager * GetMathMan()
MOpointer Pointer()
Definition: moValue.cpp:919
moDefineDynamicArray(moMoldeoObjects) moMobState
moMobDefinition()
Constructor.
value type: TXT or LNK, or XML
Definition: moParam.h:55
moInlet * InletScreenHeight
const moMobIndex & GetMobIndex() const
Devuelve la dupla de índices para el archivo de configuración.
Lista de eventos.
Definition: moEventList.h:139
clase de para manejar textos
Definition: moText.h:75
moTexture * GetTexture(MOuint p_moid)
float y
Location.
virtual void ScriptExeFinish()
moInlet * InletPreconfig
bool Selected() const
moResourceManager * m_pResourceManager
Puntero al administrador de recursos.
void SetConsoleValueIndex(MOint p_valueindex)
#define MOlong
Definition: moTypes.h:391
MOfloat moFontSize
Definition: moFontManager.h:43
void SetParamIndex(MOint p_paramindex)
int GetIndexValue() const
Definition: moParam.cpp:1227
Clase Base Descriptiva de un Objeto Moldeo.
virtual ~moMobState()
Dispositivo de entrada/salida, típicamente, interfaces humanas de IO y datos ( teclado, mouse, tableta, tcp, udp, serial )
Definition: moTypes.h:532
int luaStartTrackerHistory(moLuaVirtualMachine &vm)
devuelve la cantidad de records registrados?!
moText m_ConfigName
Nombre del objeto (relativo a la clase)
moParamIndexes & ParamIndexes()
Devuelve el puntero al arreglo de índices de los parámetros.
Definition: moConfig.h:97
vector of one type
Definition: moParam.h:72
moTypes MOint moText moParamIndex moParamReference int iRow int int i int i
Definition: all_f.js:18
virtual moVector2f ZoneToPosition(int zone)
Transforma el indice de zona al vector posicion.
virtual moConfigDefinition * GetDefinition(moConfigDefinition *p_configdefinition=NULL)
void Add(moMessage *p_Message)
void Log(moText p_text)
Escribe un mensaje en el archivo de registro (log)
Definition: moAbstract.cpp:123
void SetConfigName(const moText &p_configname)
Fijar el nombre del archivo de configuración.
void SetCurrentValueIndex(int p_paramindex, int p_valueindex)
Posiciona el puntero de selección del valor del parámetro a la posición indicada. ...
Definition: moConfig.cpp:1470
moMoldeoObjectType GetType() const
Nombre del archivo de configuración.
MOboolean Updated() const
MOfloat Float() const
Definition: moValue.cpp:835
int luaGetTrackerZone(moLuaVirtualMachine &vm)
moText0 moText
Definition: moText.h:291
moConfig m_Config
Configuración de parámetros del objeto.
int luaSetInletData(moLuaVirtualMachine &vm)
Fija el dato de un inlet (o parametro) dado el índice del inlet.
moLuaResourceManager * PushLuaResourceManager(moResourceManager *p_pResourceManager=NULL)
Real Z() const
Definition: moMathVector4.h:79
int LoadConfig(moText p_filename)
Lee la configuracion de un archivo.
Definition: moConfig.cpp:402
int luaGetTrackerFeature(moLuaVirtualMachine &vm)
#define MO_OUTLET_TYPE
int luaGetTrackerHistory(moLuaVirtualMachine &vm)
moMobState m_MobState
Moldeo Object State.
#define MOint
Definition: moTypes.h:388
virtual ~moMoldeoObject()
moSceneNode * Get3dModel(const moText &p_object_name, bool force_load=false)
Sistema de características.
int luaSetPreconf(moLuaVirtualMachine &vm)
Fija la preconfiguración de este objeto.
MOint GetMoldeoFatherId() const
Devuelve el identificador del padre de este objeto.
MOswitch m_Selected
virtual void Unselect()
virtual int ResetScriptCalling()
Definition: moScript.h:172
moInlet * InletTimeabs
void SetDescription(const moText &p_Description)
Fija la descripción de este objeto.
MOint GetOutletIndex(moText p_connector_name) const
bool ScriptHasFunction(const char *strScriptName)
Definition: moScript.cpp:417
void SetMoldeoId(MOint p_moldeoid)
Fija el identificador de este objeto.
virtual void Select()
void SetInt(MOint pint)
Definition: moValue.cpp:180
value type: TXT or LNK
Definition: moParam.h:49
int luaGetHistoryBarycenter(moLuaVirtualMachine &vm)
va de parametro el id del tracker, el id de la instancia
moOutlets * GetOutlets()
Real X() const
Definition: moMathVector.h:77
moFontType
Definition: moFontManager.h:45
Real Y() const
Definition: moMathVector.h:79
MOboolean m_bConnectorsLoaded
MOint reservedvalue3
Definition: moEventList.h:67
MOint GetTextureMOId(moParam *param, MOboolean p_create_tex)
Objeto dibujable, pre-efecto ( primeros efectos en el orden de dibujado )
Definition: moTypes.h:529
clase base para el manejo de una textura
Definition: moTexture.h:78
int GetParamsCount()
Devuelve la cantidad de parámetros de la configuracíón.
Definition: moConfig.cpp:1003
#define MO_PARAM_NOT_FOUND
Definition: moConfig.h:41
Administrador de recursos.
void SetKeyName(const moText &p_keyname)
virtual void ScriptExeUpdate()
moScriptManager * GetScriptMan()
virtual void Update(moEventList *p_EventList)
int luaStopTrackerHistory(moLuaVirtualMachine &vm)
const moText & ToJSON()
moVector3d * Vector3d()
Definition: moValue.cpp:385
moConfigDefinition * GetConfigDefinition()
Devuelve el puntero al objeto de definición de la configuración.
Definition: moConfig.cpp:1572
int luaGetPreconf(moLuaVirtualMachine &vm)
Devuelve la preconfiguración de este objeto.
void SetKeyName(const moText &p_keyname)
Fija la etiqueta del padre de este objeto.
void SetLabelName(const moText &p_labelname)
Clase base de sonido.
function L
Definition: jquery.js:16
void Copy(const moData &data)
Definition: moValue.cpp:146
Objeto dibujable, efecto ( efectos en el orden de dibujado )
Definition: moTypes.h:528
MOint ScreenHeight() const
moVector3< MOdouble > moVector3d
MOdouble Double() const
Definition: moValue.cpp:859
void SetDescription(const moText &p_Description)
Fija la descripción de este objeto.
moMathFunction * GetFunction(MOuint p_idx)
const moText & ToJSON()
virtual MOboolean RefreshValue(moParam &param, int value_index)
moParamType GetType() const
Definition: moParam.h:277
value type: TXT or LNK
Definition: moParam.h:50
MOuint LoadFilter(moValue *p_value)
virtual MOboolean UpdateConnectors()
TEXTURA BASE.
Definition: moTexture.h:54
virtual void RegisterFunctions()
beware ! call only once or die!!!
MOint GetDestinationMoldeoId()
moConfig * GetConfig()
static moDebug * MODebug2
Clase de impresión de errores para depuración.
Definition: moAbstract.h:225
moFont * AddFont(moText p_fontname, moText p_fonttype="OUTLINE", MOfloat p_fontsize=12)
moVector3i * Vector3i()
Definition: moValue.cpp:390
void SetConsoleParamIndex(MOint p_paramindex)
moVector2< MOlong > moVector2i
Definition: moMathVector.h:422
moMoldeoObjectType GetType() const
moDataManager * GetDataMan()
#define MO_OUTLET_INLETS_OFFSET
void InitScript()
Definition: moScript.cpp:183
int luaGetHistoryMinMax(moLuaVirtualMachine &vm)
Devuelve el rectangulo max, min.
virtual const moText & GetConnectorLabelName() const
moText Text()
Definition: moValue.cpp:539
#define MO_INLET_NAME
int luaPushDebugString(moLuaVirtualMachine &vm)
Función de impresión de cadena de carácteres cómoda para la depuración.
moInlet * InletScreenWidth
double m_SurfaceCovered
separa formas de fondo
void SetCurrentPreConf(MOint p_actual)
Posiciona la preconfiguración actual en el índice indicado.
Definition: moConfig.cpp:1591
MOint AddFunction(const moText &p_expr, MOboolean p_force_new=false, moMoldeoObject *p_pMOB=NULL)
moText m_MoldeoFatherLabelName
int luaGetResourceManager(moLuaVirtualMachine &vm)
Devuelve el objeto de moResourceManager para el manejo de recursos: texturas, videos, archivos, etc..
virtual MOboolean Init()
void Deactivate()
virtual moVector2f GetBarycenterMotion()
void Push(moText p_text)
Apila el mensaje dentro de la pila de mensajes.
Definition: moAbstract.h:115
Real Y() const
Definition: moMathVector3.h:75
moVector2i * Vector2i()
Definition: moValue.cpp:380
moTrackerInstanceRecord & Get(int index)
moText GetTypeStr() const
Transforma un moMoldeoObjectType en el nombre de su correspondiente clase base.
moVector2< MOdouble > moVector2d
Definition: moMathVector.h:424
moValue & GetValue(MOint i=-1)
Definition: moParam.cpp:1204
double m_BoundingRectangleAngle
cantidad de fuerzas
MOlonglong Long() const
Definition: moValue.cpp:804
Real W() const
Definition: moMathVector4.h:81
const moText & GetLabelName() const
Devuelve la etiqueta de este objeto.
moParam & GetParam(MOint p_paramindex=-1)
Devuelve el parámetro por índice.
Definition: moConfig.cpp:984
void SetFatherLabelName(const moText &p_labelname)
Fija la etiqueta del padre de este objeto.
void SetValueIndex(MOint p_valueindex)
#define MOdouble
Definition: moTypes.h:404
void PauseRecording()
Util cuando no hay señales interesantes...
#define DataMan()
#define MO_ON
Definition: moTypes.h:365
moMobDefinition m_MobDefinition
Definición del objeto.
value type: TXT or LNK
Definition: moParam.h:51
virtual moVector2f GetVariance()
MOint GetMoldeoId() const
Devuelve el identificador de este objeto.
moText GetTypeStr() const
Definition: moParam.cpp:386
void SetId(MOint p_id)
moParamDefinition & GetParamDefinition()
Definition: moParam.cpp:1268
virtual int GetPositionMatrix(float x, float y)
void SetName(const moText &p_name)
Fijar el nombre del objeto.
const moText & GetConfigName() const
moVector4d * Vector4d()
Definition: moValue.cpp:395
Real X() const
Definition: moMathVector4.h:75
void Add(const moText &p_name, moParamType p_type, int p_index=-1, const moValue &p_defaultvalue=moValue("INVALID", MO_VALUE_UNDEFINED), const moText &p_OptionsStr=moText(""))
Agrega la definición de un parámetro con un valor predeterminado a tomar.
Definition: moConfig.cpp:139
int luaGetHistoryRecord(moLuaVirtualMachine &vm)
Devuelve...el baricentro.
moVector3< MOlong > moVector3i
int luaGetInletIndex(moLuaVirtualMachine &vm)
Devuelve el índice del inlet (o parámetro). Por ejemplo: this:luaGetInletIndex("alpha").
int SaveConfig(moText p_filename=moText(""))
Guarda la configuracion en un archivo físico.
Definition: moConfig.cpp:652
int luaGetTrackerSystemData(moLuaVirtualMachine &vm)
moTextureType GetType() const
Definition: moTexture.h:219
virtual MOboolean ResolveValue(moParam &param, int value_index, bool p_refresh=false)
MOint GetInletIndex(moText p_connector_name) const
moText GetDataPath()
#define MOuint
Definition: moTypes.h:387
void SetMoldeoLabelName(moText p_MoldeoLabelName)
LIBMOLDEO_API moText0 IntToStr(int a)
Definition: moText.cpp:1070
MOboolean Init(moText p_ConnectorLabelName, MOint ConnectorId, moParam *p_param)
int luaPauseTrackerHistory(moLuaVirtualMachine &vm)
arranca la grabacion
moVector4< MOdouble > moVector4d
moMobIndex m_MobIndex
Descripción del objeto.
int luaGetInletData(moLuaVirtualMachine &vm)
Devuelve el dato según el índice del inlet.
const moText & GetFatherLabelName() const
Devuelve la etiqueta del padre de este objeto.
const moText & GetConfigName() const
Nombre del archivo de configuración.
Objeto dibujable, post-efecto ( últímos efectos en el orden de dibujado )
Definition: moTypes.h:530
moFontType GetFontType(moText fonttype)
moText m_Name
Tipo de Objeto.
virtual const moText & ToJSON()
double m_AbsoluteTorqueAverage
cantidad de cambios de velocidad
int luaGetCurrentValue(moLuaVirtualMachine &vm)
Devuelve el índice del valor actual de un parámetro.
int luaGetHistoryBounding(moLuaVirtualMachine &vm)
Devuelve los rectangulos.
moParamDefinitions * GetParamDefinitions()
Devuelve el puntero al arreglo de definciones de parámetros.
Definition: moConfig.h:88
moData m_Data
Definition: moEventList.h:112
MOuint GetValuesCount() const
Definition: moParam.cpp:1065
moMoldeoObjectType GetStrToType(const moText &p_Str=moText("default")) const
Transforma una cadena de caracteres en su correspondiente moMoldeoObjectType.
Real Length() const
Definition: moMathVector.h:170
void SetActivate(bool p_activate)
Fija el modo de activación al inicio del proyecto.
value type: TXT or LNK
Definition: moParam.h:73
virtual MOboolean Finish()
bool SelectScriptFunction(const char *strFuncName)
Definition: moScript.cpp:370
int luaGetValuesCount(moLuaVirtualMachine &vm)
Devuelve la cantidad de valores de un parámetro.
Conector para vincular objetos con datos.
Definition: moConnectors.h:57
moSound * GetSound(moText p_name, bool create=true)
moMoldeoObjectType moGetStrType(const moText &p_Str)
int luaGetTrackerValidFeatures(moLuaVirtualMachine &vm)
moData * GetData()
Característica de seguimiento ( sensado )
moText m_KeyName
Índice referente al archivo de configuración que describe a este objeto.
void Message(moText p_text)
Anuncia un mensaje al usuario además de guardarlo en el log de texto.
Definition: moAbstract.cpp:114
MOint ScreenWidth() const
#define MO_CONFIG_OK
Definition: moConfig.h:43
int luaGetParamIndex(moLuaVirtualMachine &vm)
Devuelve el índice del parámetro.
void SetType(moMoldeoObjectType p_type)
virtual void ScriptExeRun()
virtual void HandleReturns(moLuaVirtualMachine &vm, const char *strFunc)
Matrix de características.
moText m_FullJSON
moMobState & operator=(const moMobState &src)
int RegisterFunction(const char *strFuncName, moScript::Function &fun)
Definition: moScript.cpp:286
value type: TXT or LNK
Definition: moParam.h:48
moVector2f m_BarycenterAcceleration
void SetResourceManager(moResourceManager *p_pResourceManager)
moVector2d * Vector2d()
Definition: moValue.cpp:375
int m_iMethodBase
Definition: moScript.h:206
moTextureManager * GetTextureMan()
moText Text(moParamReference p_paramreference)
Acceso rápido a un valor de texto.
Definition: moConfig.cpp:1070
moTrackerSystemHistory & GetHistory()
Indice referente a la descripción del objeto en un archivo de configuración.
virtual MOboolean Init()
Conección, vínculo entre dos objetos.
Definition: moConnectors.h:280