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.
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 
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("");
115  m_MoldeoLabelName = moText("");
116  m_MoldeoId = -1;
117  m_Type = MO_OBJECT_UNDEFINED;
118  m_MoldeoFatherId = -1;
119  m_MoldeoFatherLabelName = "";
120  m_KeyName = "";
121 
122 }
123 
125  (*this) = mb;
126 }
127 
130 
131 }
132 
136  m_Name = mb.m_Name;
137  m_ConfigName = mb.m_ConfigName;
138  m_Type = mb.m_Type;
139  m_MoldeoLabelName = mb.m_MoldeoLabelName;
140  m_MoldeoId = mb.m_MoldeoId;
141  m_MobIndex = mb.m_MobIndex;
142  m_MoldeoFatherId = mb.m_MoldeoFatherId;
143  m_MoldeoFatherLabelName = mb.m_MoldeoFatherLabelName;
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
183  return moMobDefinition::GetTypeToClass( m_Type );
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);
389  SetType(MO_OBJECT_UNDEFINED);
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;
402  InletScreenWidth = InletScreenHeight = InletTimeabs = InletPreconfig = NULL;
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) {
514  if (m_pResourceManager->GetDataMan()) {
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");
541  if(__iscript==MO_PARAM_NOT_FOUND)
542  MODebug2->Error(moText("moMoldeoObject::Init > config: "+GetConfigName()+ " config: " + GetConfigName() + " label: "+GetLabelName()+" script parameter missing"));
543 
544 
545  InitScript();
546  RegisterFunctions();
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");
556  RunSelectedFunction();
557  }
558  }
559 }
560 
562  if (moScript::IsInitialized()) {
563  if (ScriptHasFunction("Finish")) {
564  SelectScriptFunction("Finish");
565  RunSelectedFunction();
566  }
567  }
568 }
569 
571  if (moScript::IsInitialized()) {
572  if (ScriptHasFunction("Update")) {
573  SelectScriptFunction("Update");
574  RunSelectedFunction();
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" );
614  RunSelectedFunction();
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");
625  RunSelectedFunction();
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)
651  if (m_pResourceManager->GetMathMan())
652  idx = m_pResourceManager->GetMathMan()->AddFunction( VB.Text(), (MOboolean)true, this );
653 
654  if (m_pResourceManager->GetMathMan())
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 
689  moTextureBuffer* pTextureBuffer = m_pResourceManager->GetTextureMan()->GetTextureBuffer(idx);
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) {
716  moTexture* pTexture = m_pResourceManager->GetTextureMan()->GetTexture(idx);
717  valuebase0.SetTexture( pTexture );
718 
719  if (pTexture->GetType()!=MO_TYPE_TEXTURE_MULTIPLE && value.GetSubValueCount()>1) {
720  idx = m_pResourceManager->GetShaderMan()->GetTextureFilterIndex()->LoadFilter( &value );
721  moTextureFilter* pTextureFilter = m_pResourceManager->GetShaderMan()->GetTextureFilterIndex()->Get(idx-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
992  m_MobDefinition.SetMoldeoId( p_id );
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( const 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) {
1137  if (InletScreenWidth->GetData()) InletScreenWidth->GetData()->SetDouble( m_pResourceManager->GetRenderMan()->ScreenWidth() );
1138  }
1139  if (InletScreenHeight) {
1140  if (InletScreenHeight->GetData()) InletScreenHeight->GetData()->SetDouble( m_pResourceManager->GetRenderMan()->ScreenHeight() );
1141  }
1142  if (InletTimeabs) {
1143  if (InletTimeabs->GetData()) InletTimeabs->GetData()->SetDouble( moGetDuration() );
1144  }
1145  if (InletPreconfig) {
1146  if (InletPreconfig->GetData()) InletPreconfig->GetData()->SetInt( m_Config.GetCurrentPreConf() );
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  // + " inlet_data_copied: " + 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  if (poutlet->GetData()) {
1235  moData pdata = (*(poutlet->GetData()));
1236  //MODebug2->Message("copying pdata for sending message! :" + poutlet->GetData()->ToText());
1237  //MODebug2->Message("copying pdata for sending message! :" + pdata.ToText());
1238  moConnections* pconnections = poutlet->GetConnections();
1239  for(MOuint j=0; j<pconnections->Count(); j++) {
1240  moConnection* pconnection = pconnections->Get(j);
1241  pmessage = new moMessage( pconnection->GetDestinationMoldeoId(),
1242  pconnection->GetDestinationConnectorId(),
1243  GetId(),
1244  pdata );
1245  p_EventList->Add( (moEvent*) pmessage );
1246  //if (pmessage) delete pmessage;
1247  //MODebug2->Message(moText("added outlet message for:") + IntToStr(pconnection->GetDestinationMoldeoId())
1248  //+" label:" + pconnection->GetDestinationMoldeoLabelName()
1249  //+" connector:" + pconnection->GetDestinationConnectorLabelName() );
1250  }
1252  poutlet->Update(false);
1253  }
1254  }
1255  }
1256  }
1258 
1259 }
1260 
1261 
1264 {
1265  RegisterBaseFunction("PushDebugString"); //0
1266  RegisterFunction("GetResourceManager"); //1
1267 
1269  RegisterFunction("SetPreconf");//2
1270  RegisterFunction("GetPreconf");//3
1271 
1272  RegisterFunction("GetParamIndex");//4
1273  RegisterFunction("GetCurrentValue");//5
1274  RegisterFunction("SetCurrentValue");//6
1275  RegisterFunction("GetValuesCount");//7
1276 
1277  RegisterFunction("GetInletIndex");//8
1278  RegisterFunction("GetInletData");//9
1279  RegisterFunction("SetInletData");//10
1280 
1282  RegisterFunction("GetTuioSystem");//11
1283  RegisterFunction("GetTuioCursorCount");//12
1284  RegisterFunction("GetTuioCursor");//13
1285  RegisterFunction("GetTuioObjectCount");//14
1286  RegisterFunction("GetTuioObject");//15
1287 
1289 
1291  RegisterFunction("GetTrackerSystemData"); //16
1292  RegisterFunction("GetTrackerFeaturesCount"); //17
1293  RegisterFunction("GetTrackerValidFeatures"); //18
1294  RegisterFunction("GetTrackerFeature"); //19
1295  RegisterFunction("GetTrackerVariance"); //20
1296  RegisterFunction("GetTrackerBarycenter"); //21
1297  RegisterFunction("GetTrackerAcceleration"); //22
1298  RegisterFunction("GetTrackerVelocity"); //23
1299  RegisterFunction("GetTrackerZone"); //24
1300 
1301  RegisterFunction("GetTrackerHistory"); //25
1302  RegisterFunction("StartTrackerHistory"); //26
1303  RegisterFunction("PauseTrackerHistory"); //27
1304  RegisterFunction("ContinueTrackerHistory"); //28
1305  RegisterFunction("StopTrackerHistory"); //29
1306  RegisterFunction("GetHistoryRecord"); //30
1307  RegisterFunction("GetHistoryBarycenter"); //31
1308  RegisterFunction("GetHistoryVariance"); //32
1309  RegisterFunction("GetHistoryBounding"); //33
1310  RegisterFunction("GetHistoryAverage"); //34
1311  RegisterFunction("GetHistoryMinMax"); //35
1312 
1313 }
1314 
1316 /*
1317  for(int i=0; i<m_iMethodBaseAncestors; i++ ) {
1318  MODebug2->Message( moText("moMoldeoObject::ScriptCalling > baseancestor: ")+IntToStr(i)+moText(" base: ") + IntToStr(m_MethodBases[i]));
1319  //m_iMethodBaseIterator
1320  }
1321 
1322  m_iMethodBase = m_MethodBases[m_iMethodBaseIterator];
1323 
1324  MODebug2->Message( moText("Called moMoldeoObject::ScriptCalling, iFunctionNumber") + IntToStr(iFunctionNumber)
1325  +moText(" m_iMethodBase: ") + IntToStr(m_iMethodBase) );
1326  MODebug2->Message( moText("m_iMethodBaseAncestors: ") + IntToStr( m_iMethodBaseAncestors ) );
1327  MODebug2->Message( moText("m_iMethodBaseIterator: ") + IntToStr( m_iMethodBaseIterator ) );
1328  MODebug2->Message( moText("m_iMethodBase: ") + IntToStr( m_iMethodBase ) );
1329  */
1330  m_iMethodBase = 1;
1331  switch ( iFunctionNumber - m_iMethodBase )
1332  {
1333  case 0:
1334  ResetScriptCalling();
1335  return luaPushDebugString(vm);//0
1336 
1337  case 1:
1338  ResetScriptCalling();
1339  return luaGetResourceManager(vm);//1
1340 
1342  case 2:
1343  ResetScriptCalling();
1344  return luaSetPreconf(vm);//2
1345  case 3:
1346  ResetScriptCalling();
1347  return luaGetPreconf(vm);//3
1348 
1349 
1350  case 4:
1351  ResetScriptCalling();
1352  return luaGetParamIndex(vm);//4
1353  case 5:
1354  ResetScriptCalling();
1355  return luaGetCurrentValue(vm);//5
1356  case 6:
1357  ResetScriptCalling();
1358  return luaSetCurrentValue(vm);//6
1359  case 7:
1360  ResetScriptCalling();
1361  return luaGetValuesCount(vm);//7
1362 
1363 
1364 
1365  case 8:
1366  ResetScriptCalling();
1367  return luaGetInletIndex(vm);//8
1368  case 9:
1369  ResetScriptCalling();
1370  return luaGetInletData(vm);//9
1371  case 10:
1372  ResetScriptCalling();
1373  return luaSetInletData(vm);//10
1374 
1375 #ifdef USE_TUIO
1376  case 11:
1380  ResetScriptCalling();
1381  return luaGetTuioSystem(vm);//10
1382  case 12:
1383  ResetScriptCalling();
1384  return luaGetTuioCursorCount(vm);//11
1385  case 13:
1386  ResetScriptCalling();
1387  return luaGetTuioCursor(vm);//12
1388  case 14:
1389  ResetScriptCalling();
1390  return luaGetTuioObjectCount(vm);//13
1391  case 15:
1392  ResetScriptCalling();
1393  return luaGetTuioObject(vm);//14
1394 #else
1395  case 11:
1396  case 12:
1397  case 13:
1398  case 14:
1399  case 15:
1400  ResetScriptCalling();
1401  return 0;
1402 #endif
1403 
1404  case 16:
1405  ResetScriptCalling();
1406  return luaGetTrackerSystemData(vm);//15
1407  case 17:
1408  ResetScriptCalling();
1409  return luaGetTrackerFeaturesCount(vm);//16
1410  case 18:
1411  ResetScriptCalling();
1412  return luaGetTrackerValidFeatures(vm);//17
1413  case 19:
1414  ResetScriptCalling();
1415  return luaGetTrackerFeature(vm);//18
1416  case 20:
1417  ResetScriptCalling();
1418  return luaGetTrackerVariance(vm);//19
1419  case 21:
1420  ResetScriptCalling();
1421  return luaGetTrackerBarycenter(vm);//20
1422  case 22:
1423  ResetScriptCalling();
1424  return luaGetTrackerAcceleration(vm);//21
1425  case 23:
1426  ResetScriptCalling();
1427  return luaGetTrackerVelocity(vm);//22
1428  case 24:
1429  ResetScriptCalling();
1430  return luaGetTrackerZone(vm);//23
1431 
1432  case 25:
1433  ResetScriptCalling();
1434  return luaGetTrackerHistory(vm);//24
1435  case 26:
1436  ResetScriptCalling();
1437  return luaStartTrackerHistory(vm);//25
1438  case 27:
1439  ResetScriptCalling();
1440  return luaPauseTrackerHistory(vm);//26
1441  case 28:
1442  ResetScriptCalling();
1443  return luaContinueTrackerHistory(vm);//27
1444  case 29:
1445  ResetScriptCalling();
1446  return luaStopTrackerHistory(vm);//28
1447 
1448  case 30:
1449  ResetScriptCalling();
1450  return luaGetHistoryRecord(vm);//29
1451  case 31:
1452  ResetScriptCalling();
1453  return luaGetHistoryBarycenter(vm);//30
1454  case 32:
1455  ResetScriptCalling();
1456  return luaGetHistoryVariance(vm);//31
1457  case 33:
1458  ResetScriptCalling();
1459  return luaGetHistoryBounding(vm);//32
1460  case 34:
1461  ResetScriptCalling();
1462  return luaGetHistoryAverage(vm);//33
1463  case 35:
1464  ResetScriptCalling();
1465  return luaGetHistoryMinMax(vm);//34
1466  default:
1467  MODebug2->Error("moMoldeoObject::ScriptCalling > not a valid index (iFunctionNumber - m_iMethodBase) " + IntToStr(iFunctionNumber - m_iMethodBase));
1468  break;
1469 
1470  }
1471  return 0;
1472 }
1473 //#include "lua.h"
1475 {
1476  lua_State *state = (lua_State *) vm;
1477 
1478  if ( strcmp( "Run", strFunc) == 0 ||
1479  strcmp( "Draw", strFunc) == 0 ||
1480  strcmp( "Init", strFunc) == 0 ||
1481  strcmp( "Finish", strFunc) == 0 ||
1482  strcmp( "RunSystem", strFunc) == 0 ||
1483  strcmp( "Update", strFunc) == 0 ||
1484  strcmp( "RunParticle", strFunc) == 0
1485  ) {
1486  MOint script_result = (MOint) lua_tonumber (state, 1);
1487 
1488  if (script_result != 0) {
1489 
1490  char *text = (char *) lua_tostring (state, -1);
1491 
1492  MODebug2->Error(
1493  moText(GetLabelName())
1494  + moText(" function:")
1495  + moText(strFunc)
1496  + moText(" >> lua script returned error code: ")
1497  + (moText)IntToStr(script_result)
1498  + moText(" >> ")
1499  + moText(text)
1500  );
1501 
1502  }
1503  }
1504 }
1505 
1506 
1508  lua_State *state = (lua_State *) vm;
1509  if (lua_isboolean(state,1)) {
1510  bool vb = lua_toboolean(state,1);
1511  vb ? MODebug2->Message(moText("true")) : MODebug2->Message(moText("false"));
1512  } else {
1513  char *text = (char *) lua_tostring (state, 1);
1514  MODebug2->Message(moText(text));
1515  }
1516 
1517  return 0;
1518 }
1519 
1521 
1522  lua_State *state = (lua_State *) vm;
1523  state = NULL; //unused
1524  if (GetResourceManager()) {
1525  if (GetResourceManager()->GetScriptMan()) {
1526  GetResourceManager()->GetScriptMan()->PushLuaResourceManager();
1527  }
1528  }
1529 
1530  return 1;
1531 }
1532 
1535  lua_State *state = (lua_State *) vm;
1536 
1537  MOint preconfid = (MOint) lua_tonumber (state, 1);
1538 
1539  if (this->GetConfig()) {
1540  this->GetConfig()->SetCurrentPreConf( preconfid );
1541  } else MODebug2->Push("no debug");
1542 
1543  return 0;
1544 }
1545 
1547  lua_State *state = (lua_State *) vm;
1548 
1549  if (this->GetConfig()) {
1550  lua_pushnumber(state, (lua_Number) this->GetConfig()->GetCurrentPreConf() );
1551  }
1552 
1553  return 1;
1554 }
1555 
1557 
1558  lua_State *state = (lua_State *) vm;
1559 
1560  char *text = (char *) lua_tostring (state, 1);
1561 
1562  if (GetConfig()) {
1563  lua_pushnumber(state, (lua_Number) GetConfig()->GetParamIndex(text) );
1564  }
1565 
1566  return 1;
1567 
1568 }
1569 
1571 
1572  lua_State *state = (lua_State *) vm;
1573 
1574  MOint paramid = (MOint) lua_tonumber (state, 1);
1575  MOint valueid = (MOint) lua_tonumber (state, 2);
1576 
1577  if (GetConfig()) {
1578  GetConfig()->SetCurrentValueIndex( paramid, valueid );
1579  } else {
1580  MODebug2->Error( moText(" in MoldeoObject script: SetCurrentValue : config not founded : id:")+(moText)GetLabelName() );
1581  }
1582 
1583  return 0;
1584 }
1585 
1586 
1588 
1589  lua_State *state = (lua_State *) vm;
1590 
1591  MOint paramid = (MOint) lua_tonumber (state, 1);
1592 
1593  if (GetConfig()) {
1594  int valueid = GetConfig()->GetParam( paramid ).GetIndexValue();
1595  lua_pushnumber(state, (lua_Number) valueid );
1596  return 1;
1597  } else {
1598  MODebug2->Error( moText(" in MoldeoObject script: GetCurrentValue : config not founded : id:")+(moText)GetLabelName() );
1599  }
1600 
1601  return 0;
1602 }
1603 
1604 
1606 
1607  lua_State *state = (lua_State *) vm;
1608 
1609  MOint paramid = (MOint) lua_tonumber (state, 1);
1610 
1611  if (GetConfig()) {
1612  int valuecount = GetConfig()->GetParam( paramid ).GetValuesCount();
1613  lua_pushnumber(state, (lua_Number) valuecount );
1614  return 1;
1615  } else {
1616  MODebug2->Error( moText(" in MoldeoObject script: GetValuesCount : config not founded : id:")+(moText)GetLabelName() );
1617  }
1618 
1619  return 0;
1620 }
1621 
1622 
1623 
1625  lua_State *state = (lua_State *) vm;
1626 
1627  char *inletlabelname = (char *) lua_tostring (state, 1);
1628 
1629  for( MOuint i=0; i<m_Inlets.Count(); i++ ) {
1630  moInlet* pInlet = m_Inlets[i];
1631  if (pInlet) {
1632  moText lname = pInlet->GetConnectorLabelName();
1633  moText lmname( inletlabelname );
1634  if ( lname == lmname ) {
1635  lua_pushnumber(state, (lua_Number) i );
1636  return 1;
1637  }
1638  }
1639  }
1640 
1641  lua_pushnumber(state, (lua_Number) -1 );
1642  return 1;
1643 }
1644 
1646  lua_State *state = (lua_State *) vm;
1647 
1648  moVector2d* pv2d;
1649  moVector3d* pv3d;
1650  moVector4d* pv4d;
1651  moVector2i* pv2i;
1652  moVector3i* pv3i;
1653  moVector4i* pv4i;
1654 
1655  unsigned int i;
1656  moData MData;
1657  moDataMessage MDataMessage;
1658  moDataMessage* pDataMessage;
1659  moDataMessages* pDataMessages;
1660 
1662 
1663 
1664  int inletindex = (int) lua_tonumber (state, 1);
1665 
1666  if ( inletindex>=0 && inletindex<(int)m_Inlets.Count()) {
1667  moInlet* pInlet = m_Inlets[inletindex];
1668  if ( pInlet ) {
1669  moData* pData = pInlet->GetData();
1670  //lua_pushnumber( state, (lua_Number) (int)pType );
1671  if (pData) {
1672  moDataType pType = pData->Type();
1673  switch((int)pType) {
1674  case MO_DATA_NUMBER:
1675  lua_pushnumber( state, (lua_Number) pData->Long() );
1676  return 1;
1677  break;
1678  case MO_DATA_NUMBER_CHAR:
1679  lua_pushnumber( state, (lua_Number) pData->Long() );
1680  return 1;
1681  break;
1682  case MO_DATA_NUMBER_INT:
1683  lua_pushnumber( state, (lua_Number) pData->Long() );
1684  return 1;
1685  break;
1686  case MO_DATA_NUMBER_LONG:
1687  lua_pushnumber( state, (lua_Number) pData->Long() );
1688  return 1;
1689  break;
1690  case MO_DATA_NUMBER_DOUBLE:
1691  lua_pushnumber( state, (lua_Number) pData->Double() );
1692  return 1;
1693  case MO_DATA_NUMBER_FLOAT:
1694  lua_pushnumber( state, (lua_Number) pData->Float() );
1695  return 1;
1696  case MO_DATA_TEXT:
1697  lua_pushstring( state, (char*) pData->Text() );
1698  return 1;
1699  case MO_DATA_MESSAGE:
1700  pDataMessage = (moDataMessage*)pData->Pointer();
1701  MODebug2->Message("moMoldeoObject::luaGetInletData() > MO_DATA_MESSAGE");
1702  /*if (pDataMessage) {
1703  //MODebug2->Message("moMoldeoObject::luaGetInletData() > MO_DATA_MESSAGE > count: " + IntToStr(pDataMessage->Count()) );
1704  for(i=0;i<pDataMessage->Count();i++) {
1705  MData = pDataMessage->Get(i);
1706  MODebug2->Message("moMoldeoObject::luaGetInletData() > MO_DATA_MESSAGE > data: " + MData.ToText() );
1707  lua_pushstring( state, (char*) MData.ToText() );
1708  }
1709  return i;
1710  }*/
1711  lua_pushstring( state, (char*) "NO MESSAGE" );
1712  return 1;
1713  case MO_DATA_MESSAGES:
1714  pDataMessages = (moDataMessages*)pData->Pointer();
1715  //MODebug2->Message("moMoldeoObject::luaGetInletData() > MO_DATA_MESSAGES");
1716  if (pDataMessages) {
1717  //MODebug2->Message("moMoldeoObject::luaGetInletData() > MO_DATA_MESSAGES > count: " + IntToStr(pDataMessages->Count()) );
1718 
1719  if (pDataMessages->Count()==0) {
1720  lua_pushstring( state, (char*) "NO MESSAGES" );
1721  return 1;
1722  }
1723 
1724  int m = 0;
1725  int mi = 0;
1726  lua_createtable(state, pDataMessages->Count(), 0);
1727  for(i=0;i<pDataMessages->Count();i++) {
1728  //MDataMessage = pDataMessages->Get(i);
1729  lua_pushnumber( state, (lua_Number)(i+1));
1730  //lua_pushstring( state,(char*) pDataMessages->Get(i).Get(i).ToText() );
1731  lua_createtable(state, pDataMessages->Get(i).Count(), 0);
1732  for( m=0; m<pDataMessages->Get(i).Count(); m++ ) {
1733  lua_pushnumber( state, (lua_Number) (m+1) );
1734  //MODebug2->Message("moMoldeoObject::luaGetInletData() > MO_DATA_MESSAGE > data: " + MData.ToText() );
1735  switch(pDataMessages->Get(i).Get(m).Type()) {
1736  case MO_DATA_NUMBER_FLOAT:
1737  lua_pushnumber( state,(lua_Number) pDataMessages->Get(i).Get(m).Float());
1738  break;
1739  default:
1740  lua_pushstring( state,(char*) pDataMessages->Get(i).Get(m).ToText() );
1741  break;
1742  }
1743  lua_settable(state,-3);
1744  }
1745  lua_settable(state, -3);
1746  }
1747  //lua_pushstring( state, (char*) pData->ToText() );
1748  return 1;
1749  } else {
1750  lua_pushstring( state, (char*) "NO MESSAGES" );
1751  return 1;
1752  }
1753  return 1;
1754  case MO_DATA_VECTOR2F:
1755  pv2d = (moVector2d*)pData->Pointer();
1756  if (pv2d) {
1757  lua_pushnumber( state, (lua_Number) pv2d->X() );
1758  lua_pushnumber( state, (lua_Number) pv2d->Y() );
1759  return 2;
1760  }
1761  break;
1762  case MO_DATA_VECTOR3F:
1763  pv3d = (moVector3d*)pData->Pointer();
1764  if (pv3d) {
1765  lua_pushnumber( state, (lua_Number) pv3d->X() );
1766  lua_pushnumber( state, (lua_Number) pv3d->Y() );
1767  lua_pushnumber( state, (lua_Number) pv3d->Z() );
1768  return 3;
1769  }
1770  break;
1771  case MO_DATA_VECTOR4F:
1772  pv4d = (moVector4d*)pData->Pointer();
1773  if (pv4d) {
1774  lua_pushnumber( state, (lua_Number) pv4d->X() );
1775  lua_pushnumber( state, (lua_Number) pv4d->Y() );
1776  lua_pushnumber( state, (lua_Number) pv4d->Z() );
1777  lua_pushnumber( state, (lua_Number) pv4d->W() );
1778  return 4;
1779  }
1780  break;
1781  case MO_DATA_VECTOR2I:
1782  pv2i = (moVector2i*)pData->Pointer();
1783  if (pv2i) {
1784  lua_pushnumber( state, (lua_Number) pv2i->X() );
1785  lua_pushnumber( state, (lua_Number) pv2i->Y() );
1786  return 2;
1787  }
1788  break;
1789  case MO_DATA_VECTOR3I:
1790  pv3i = (moVector3i*)pData->Pointer();
1791  if (pv3i) {
1792  lua_pushnumber( state, (lua_Number) pv3i->X() );
1793  lua_pushnumber( state, (lua_Number) pv3i->Y() );
1794  lua_pushnumber( state, (lua_Number) pv3i->Z() );
1795  return 3;
1796  }
1797  break;
1798  case MO_DATA_VECTOR4I:
1799  pv4i = (moVector4i*)pData->Pointer();
1800  if (pv4i) {
1801  lua_pushnumber( state, (lua_Number) pv4i->X() );
1802  lua_pushnumber( state, (lua_Number) pv4i->Y() );
1803  lua_pushnumber( state, (lua_Number) pv4i->Z() );
1804  lua_pushnumber( state, (lua_Number) pv4i->W() );
1805  return 4;
1806  }
1807  break;
1808 
1809  case MO_DATA_FUNCTION:
1810  lua_pushnumber( state, (lua_Number) pData->Eval() );
1811  return 1;
1812  default:
1813  moText ttype = pData->TypeToText();
1814  lua_pushstring( state, ttype );
1815  if (pData->Type()==MO_DATA_NUMBER_LONG) {
1816  lua_pushnumber( state, (lua_Number) pData->Long() );
1817  return 2;
1818  }
1819  return 1;
1820  }
1821  } else {
1822  moText tres("bad data pointer");
1823  lua_pushstring( state, tres );
1824  return 1;
1825  }
1826  }
1827  moText tres("inlet data not updated");
1828  lua_pushstring( state, tres );
1829  return 1;
1830 
1831  }
1832  moText tres("invalid");
1833  lua_pushstring( state, tres );
1834  return 1;
1835 }
1836 
1837 
1839 
1840  lua_State *state = (lua_State *) vm;
1841 
1842  int inletindex = (int) lua_tonumber (state, 1);
1843 
1844  if ( inletindex>=0 && inletindex<(int)m_Inlets.Count()) {
1845 
1846  moInlet* pInlet = m_Inlets[inletindex];
1847 
1848  if ( pInlet ) {
1849  moData* pData = pInlet->GetInternalData();
1850  if (pData) {
1851  moDataType pType = pData->Type();
1852  switch( pType ) {
1853  case MO_DATA_NUMBER:
1854  case MO_DATA_NUMBER_CHAR:
1855  case MO_DATA_NUMBER_INT:
1856  case MO_DATA_NUMBER_LONG:
1857  case MO_DATA_NUMBER_MIDI:
1858  pData->SetLong( (MOlong) lua_tonumber ( state, 2 ) );
1859  pInlet->Update();
1860 
1861  return 0;
1862 
1864  case MO_DATA_FONTPOINTER:
1865  case MO_DATA_IMAGESAMPLE:
1868  //pData->SetLong( (MOlong) lua_tonumber ( state, 3 ) );
1869  pInlet->Update();
1870  return 0;
1871 
1872  case MO_DATA_VECTOR2I:
1873  if (pData->Vector2i())
1874  (*pData->Vector2i()) = moVector2i( (MOlong) lua_tonumber ( state, 2 ),
1875  (MOlong) lua_tonumber ( state, 3 ) );
1876  pInlet->Update();
1877 
1878  return 0;
1879 
1880  case MO_DATA_VECTOR3I:
1881  if (pData->Vector3i())
1882  (*pData->Vector3i()) = moVector3i( (MOlong) lua_tonumber ( state, 2 ),
1883  (MOlong) lua_tonumber ( state, 3 ),
1884  (MOlong) lua_tonumber ( state, 4 ) );
1885  pInlet->Update();
1886  return 0;
1887 
1888  case MO_DATA_VECTOR4I:
1889  if (pData->Vector4i())
1890  (*pData->Vector4i()) = moVector4i( (MOlong) lua_tonumber ( state, 2 ),
1891  (MOlong) lua_tonumber ( state, 3 ),
1892  (MOlong) lua_tonumber ( state, 4 ),
1893  (MOlong) lua_tonumber ( state, 5 ) );
1894  pInlet->Update();
1895  return 0;
1896 
1897  case MO_DATA_VECTOR2F:
1898  if (pData->Vector2d())
1899  (*pData->Vector2d()) = moVector2d( (MOdouble) lua_tonumber ( state, 2 ),
1900  (MOdouble) lua_tonumber ( state, 3 ));
1901  pInlet->Update();
1902  return 0;
1903 
1904  case MO_DATA_VECTOR3F:
1905  if (pData->Vector3d())
1906  (*pData->Vector3d()) = moVector3d( (MOdouble) lua_tonumber ( state, 2 ),
1907  (MOdouble) lua_tonumber ( state, 3 ),
1908  (MOdouble) lua_tonumber ( state, 4 ));
1909  pInlet->Update();
1910  return 0;
1911 
1912  case MO_DATA_VECTOR4F:
1913  if (pData->Vector4d())
1914  (*pData->Vector4d()) = moVector4d( (MOdouble) lua_tonumber ( state, 2 ),
1915  (MOdouble) lua_tonumber ( state, 3 ),
1916  (MOdouble) lua_tonumber ( state, 4 ),
1917  (MOdouble) lua_tonumber ( state, 5 ) );
1918  pInlet->Update();
1919  return 0;
1920 
1921  case MO_DATA_MESSAGE:
1922  case MO_DATA_MESSAGES:
1923  pInlet->Update();
1924  return 0;
1925 
1926  case MO_DATA_NUMBER_DOUBLE:
1927  case MO_DATA_NUMBER_FLOAT:
1928  pData->SetDouble( (MOdouble) lua_tonumber ( state, 2 ) );
1929  pInlet->Update();
1930  return 0;
1931 
1932  case MO_DATA_TEXT:
1933  //lua_pushstring(state, pData->Text() );
1934  pData->SetText( lua_tostring ( state, 2 ) );
1935  pInlet->Update();
1936  return 0;
1937 
1938  default:
1939  moText tres("data type invalid");
1940  tres = tres + pData->TypeToText();
1941  lua_pushstring( state, tres );
1942  pInlet->Update();
1943  return 1;
1944 
1945  }
1946  } else {
1947  moText tres("data si null");
1948  lua_pushstring( state, tres );
1949  return 1;
1950  }
1951  }
1952  }
1953 
1954  moText tres("invalid");
1955  lua_pushstring( state, tres );
1956  return 1;
1957 }
1958 
1959 
1960 
1961 
1973 #ifdef USE_TUIO
1974 
1975 using namespace TUIO;
1979 int moMoldeoObject::luaGetTuioSystem(moLuaVirtualMachine& vm) {
1980 
1981  lua_State *state = (lua_State *) vm;
1982 
1983  int tuioindex = GetInletIndex("TUIOSYSTEM");
1984 
1985  lua_pushnumber( state, (lua_Number) tuioindex );
1986 
1987  return 1;
1988 }
1989 
1990 int moMoldeoObject::luaGetTuioCursorCount(moLuaVirtualMachine& vm) {
1991 
1992  lua_State *state = (lua_State *) vm;
1993 
1994  moTUIOSystemData* pTuio = NULL;
1995 
1996  int tuioindex = (int)lua_tonumber( state, 1);
1997 
1998  moInlet* pInlet = NULL;
1999 
2000  pInlet = m_Inlets[tuioindex];
2001 
2002  if (pInlet && pInlet->Updated()) {
2003  pTuio = (moTUIOSystemData*)pInlet->GetData()->Pointer();
2004  if (pTuio) {
2005  std::list<TuioCursor*> pCursors = pTuio->getTuioCursors();
2006  int nc = pCursors.size();
2007  lua_pushnumber( state, (lua_Number) nc );
2008  return 1;
2009  }
2010 
2011  }
2012  lua_pushnumber( state, (lua_Number) -1 );
2013  return 1;
2014 }
2015 
2016 
2017 int moMoldeoObject::luaGetTuioCursor(moLuaVirtualMachine& vm) {
2018 
2019  lua_State *state = (lua_State *) vm;
2020 
2021  moTUIOSystemData* pTuio = NULL;
2022 
2023  int tuioindex = (int)lua_tonumber( state, 1);
2024  int cursorindex = (int)lua_tonumber( state, 2);
2025 
2026  moInlet* pInlet = NULL;
2027 
2028  pInlet = m_Inlets[tuioindex];
2029 
2030  if (pInlet && pInlet->Updated()) {
2031  pTuio = (moTUIOSystemData*)pInlet->GetData()->Pointer();
2032  if (pTuio) {
2033 
2034  std::list<TuioCursor*> cursors = pTuio->getTuioCursors();
2035 
2036  int cn = 0;
2037  TuioCursor* pCursor = NULL;
2038 
2039  for (std::list<TuioCursor*>::iterator tuioCursor = cursors.begin(); tuioCursor!=cursors.end(); tuioCursor++,cn++) {
2040  if (cn == cursorindex) {
2041  pCursor = (*tuioCursor);
2042  }
2043  }
2044 
2045  if (pCursor) {
2046  lua_pushnumber( state, (lua_Number) pCursor->getCursorID() );
2047  lua_pushnumber( state, (lua_Number) pCursor->getSessionID() );
2048  lua_pushnumber( state, (lua_Number) pCursor->getStartTime().getTotalMilliseconds() );
2049  lua_pushnumber( state, (lua_Number) pCursor->getPosition().getX() );
2050  lua_pushnumber( state, (lua_Number) pCursor->getPosition().getY() );
2051  lua_pushnumber( state, (lua_Number) pCursor->getXSpeed() );
2052  lua_pushnumber( state, (lua_Number) pCursor->getYSpeed() );
2053  return 7;
2054  }
2055  }
2056 
2057  }
2058  lua_pushnumber( state, (lua_Number) -1 );
2059  return 1;
2060 }
2061 
2062 int moMoldeoObject::luaGetTuioObjectCount(moLuaVirtualMachine& vm) {
2063 
2064  lua_State *state = (lua_State *) vm;
2065 
2066  moTUIOSystemData* pTuio = NULL;
2067 
2068  int tuioindex = (int)lua_tonumber( state, 1);
2069 
2070  moInlet* pInlet = NULL;
2071 
2072  pInlet = m_Inlets[tuioindex];
2073 
2074  if (pInlet && pInlet->Updated()) {
2075  pTuio = (moTUIOSystemData*)pInlet->GetData()->Pointer();
2076  if (pTuio) {
2077  std::list<TuioObject*> pObjects = pTuio->getTuioObjects();
2078  int nc = pObjects.size();
2079  lua_pushnumber( state, (lua_Number) nc );
2080  return 1;
2081  }
2082 
2083  }
2085  lua_pushnumber( state, (lua_Number) -1 );
2086  return 1;
2087 }
2088 
2089 int moMoldeoObject::luaGetTuioObject(moLuaVirtualMachine& vm) {
2090 
2091  lua_State *state = (lua_State *) vm;
2092 
2093  moTUIOSystemData* pTuio = NULL;
2094 
2095  int tuioindex = (int)lua_tonumber( state, 1);
2096  int objectindex = (int)lua_tonumber( state, 2);
2097 
2098  moInlet* pInlet = NULL;
2099 
2100  pInlet = m_Inlets[tuioindex];
2101 
2102  if (pInlet && pInlet->Updated()) {
2103  pTuio = (moTUIOSystemData*)pInlet->GetData()->Pointer();
2104  if (pTuio) {
2105 
2106  std::list<TuioObject*> objects = pTuio->getTuioObjects();
2107 
2108  int cn = 0;
2109  TuioObject* pObject = NULL;
2110 
2111  for (std::list<TuioObject*>::iterator tuioObject = objects.begin(); tuioObject!=objects.end(); tuioObject++,cn++) {
2112  if (cn == objectindex) {
2113  pObject = (*tuioObject);
2114  }
2115  }
2116 
2117  if (pObject) {
2118  lua_pushnumber( state, (lua_Number) pObject->getSymbolID() );
2119  lua_pushnumber( state, (lua_Number) pObject->getSessionID() );
2120  lua_pushnumber( state, (lua_Number) pObject->getStartTime().getTotalMilliseconds() );
2121  lua_pushnumber( state, (lua_Number) pObject->getPosition().getX() );
2122  lua_pushnumber( state, (lua_Number) pObject->getPosition().getY() );
2123  lua_pushnumber( state, (lua_Number) pObject->getXSpeed() );
2124  lua_pushnumber( state, (lua_Number) pObject->getYSpeed() );
2125  lua_pushnumber( state, (lua_Number) pObject->getAngle() );
2126  return 8;
2127  }
2128  }
2129 
2130  }
2131  lua_pushnumber( state, (lua_Number) -1 );
2132  return 1;
2133 
2134 }
2135 #endif
2136 
2149 
2152  lua_State *state = (lua_State *) vm;
2153 
2154  int trackerindex = GetInletIndex("TRACKERKLT");
2155 
2156  lua_pushnumber( state, (lua_Number) trackerindex );
2157 
2158  return 1;
2159 }
2160 
2162 
2164  lua_State *state = (lua_State *) vm;
2165  int ft_count = -1;
2166 
2167  moTrackerSystemData* pTracker = NULL;
2168 
2169  int trackerindex = (int)lua_tonumber( state, 1);
2170 
2171  moInlet* pInlet = NULL;
2172 
2173  pInlet = m_Inlets[trackerindex];
2174 
2175  if (pInlet && pInlet->Updated()) {
2176  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2177  if (pTracker) {
2178  ft_count = pTracker->GetFeaturesCount();
2179  }
2180  }
2181 
2182  lua_pushnumber( state, (lua_Number) ft_count );
2183 
2184  return 1;
2185 }
2186 
2188 
2190  lua_State *state = (lua_State *) vm;
2191  int ft_validcount = 0;
2192 
2193  moTrackerSystemData* pTracker = NULL;
2194 
2195  int trackerindex = (int)lua_tonumber( state, 1);
2196 
2197  moInlet* pInlet = NULL;
2198 
2199  pInlet = m_Inlets[trackerindex];
2200 
2201  if (pInlet && pInlet->Updated()) {
2202  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2203  if (pTracker) {
2204  ft_validcount = pTracker->GetValidFeatures();
2205  }
2206  }
2207 
2208  lua_pushnumber( state, (lua_Number) ft_validcount );
2209 
2210  return 1;
2211 }
2212 
2214 
2215  lua_State *state = (lua_State *) vm;
2216 
2217  moTrackerSystemData* pTracker = NULL;
2218 
2219  int trackerindex = (int)lua_tonumber( state, 1);
2220  int featureindex = (MOint) lua_tonumber (state, 2);
2221 
2222  moInlet* pInlet = NULL;
2223 
2224  pInlet = m_Inlets[trackerindex];
2225 
2226  float x, y, vx, vy, tr_x, tr_y;
2227  int v;
2228  x = y = 0.0;
2229  v = 0;
2230 
2231  if (pInlet && pInlet->Updated()) {
2232  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2233  if (pTracker) {
2234  moTrackerFeature* TF = pTracker->GetFeature(featureindex);
2235  if (TF) {
2236  x = TF->x;
2237  y = TF->y;
2238  v = TF->val;
2239  vx = TF->v_x;
2240  vy = TF->v_y;
2241  tr_x = TF->tr_x;
2242  tr_y = TF->tr_y;
2243  }
2244  }
2245  }
2246 
2247  lua_pushnumber(state, (lua_Number)x);
2248  lua_pushnumber(state, (lua_Number)y);
2249  lua_pushnumber(state, (lua_Number)v);
2250  lua_pushnumber(state, (lua_Number)vx);
2251  lua_pushnumber(state, (lua_Number)vy);
2252  lua_pushnumber(state, (lua_Number)tr_x);
2253  lua_pushnumber(state, (lua_Number)tr_y);
2254 
2255  return 7;
2256 
2257 }
2258 
2260 
2261  lua_State *state = (lua_State *) vm;
2262 
2263  moTrackerSystemData* pTracker = NULL;
2264 
2265  int trackerindex = (int)lua_tonumber( state, 1);
2266 
2267  moInlet* pInlet = NULL;
2268 
2269  pInlet = m_Inlets[trackerindex];
2270 
2271  float x, y, L;
2272  x = y = L = 0.0;
2273 
2274  if (pInlet && pInlet->Updated()) {
2275  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2276  if (pTracker) {
2277  L = pTracker->GetVariance().Length();
2278  x = pTracker->GetVariance().X();
2279  y = pTracker->GetVariance().Y();
2280  }
2281  }
2282 
2283  lua_pushnumber(state, (lua_Number)L);
2284  lua_pushnumber(state, (lua_Number)x);
2285  lua_pushnumber(state, (lua_Number)y);
2286 
2287  return 3;
2288 }
2289 
2291 
2292  lua_State *state = (lua_State *) vm;
2293 
2294  moTrackerSystemData* pTracker = NULL;
2295 
2296  int trackerindex = (int)lua_tonumber( state, 1);
2297 
2298  moInlet* pInlet = NULL;
2299 
2300  pInlet = m_Inlets[trackerindex];
2301 
2302  float x, y;
2303  x = y = 0.0;
2304 
2305  if (pInlet && pInlet->Updated()) {
2306  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2307  if (pTracker) {
2308  x = pTracker->GetBarycenter().X();
2309  y = pTracker->GetBarycenter().Y();
2310  }
2311  }
2312 
2313  lua_pushnumber(state, (lua_Number)x);
2314  lua_pushnumber(state, (lua_Number)y);
2315 
2316  return 2;
2317 
2318 }
2319 
2320 
2322 
2323 
2324  lua_State *state = (lua_State *) vm;
2325 
2326  moTrackerSystemData* pTracker = NULL;
2327 
2328  int trackerindex = (int)lua_tonumber( state, 1);
2329 
2330  moInlet* pInlet = NULL;
2331 
2332  pInlet = m_Inlets[trackerindex];
2333 
2334  float x, y, L;
2335  x = y = L = 0.0;
2336 
2337  if (pInlet && pInlet->Updated()) {
2338  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2339  if (pTracker) {
2340  L = pTracker->GetBarycenterAcceleration().Length();
2341  x = pTracker->GetBarycenterAcceleration().X();
2342  y = pTracker->GetBarycenterAcceleration().Y();
2343  }
2344  }
2345 
2346  lua_pushnumber(state, (lua_Number)L);
2347  lua_pushnumber(state, (lua_Number)x);
2348  lua_pushnumber(state, (lua_Number)y);
2349 
2350  return 3;
2351 }
2352 
2354 
2355  lua_State *state = (lua_State *) vm;
2356 
2357  moTrackerSystemData* pTracker = NULL;
2358 
2359  int trackerindex = (int)lua_tonumber( state, 1);
2360 
2361  moInlet* pInlet = NULL;
2362 
2363  pInlet = m_Inlets[trackerindex];
2364 
2365  float x, y, L;
2366  x = y = L = 0.0;
2367 
2368  if (pInlet && pInlet->Updated()) {
2369  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2370  if (pTracker) {
2371  L = pTracker->GetBarycenterMotion().Length();
2372  x = pTracker->GetBarycenterMotion().X();
2373  y = pTracker->GetBarycenterMotion().Y();
2374  }
2375  }
2376 
2377  lua_pushnumber(state, (lua_Number)L);
2378  lua_pushnumber(state, (lua_Number)x);
2379  lua_pushnumber(state, (lua_Number)y);
2380  return 3;
2381 }
2382 
2383 
2385 
2386  lua_State *state = (lua_State *) vm;
2387 
2388  moTrackerSystemData* pTracker = NULL;
2389 
2390  int trackerindex = (int)lua_tonumber( state, 1);
2391  int izone = (int) lua_tonumber (state, 2);
2392 
2393  int nitems;
2394  nitems = 0;
2395 
2396  moInlet* pInlet = NULL;
2397 
2398  pInlet = m_Inlets[trackerindex];
2399 
2400  if (pInlet && pInlet->Updated()) {
2401  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2402  if (pTracker) {
2403  nitems = pTracker->GetPositionMatrix( pTracker->ZoneToPosition(izone) );
2404  }
2405  }
2406 
2407  lua_pushnumber( state, (lua_Number) nitems);
2408  return 1;
2409 }
2410 
2412 
2413  lua_State *state = (lua_State *) vm;
2414 
2415  moTrackerSystemData* pTracker = NULL;
2416 
2417  int trackerindex = (int)lua_tonumber( state, 1);
2418 
2419  int nitems;
2420  nitems = 0;
2421 
2422  moInlet* pInlet = NULL;
2423 
2424  pInlet = m_Inlets[trackerindex];
2425 
2426  if (pInlet && pInlet->Updated()) {
2427  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2428  if (pTracker) {
2429  nitems = pTracker->GetHistory().CountRecords();
2430  }
2431  }
2432 
2433  lua_pushnumber( state, (lua_Number) nitems);
2434  return 1;
2435 
2436 }
2437 
2439  lua_State *state = (lua_State *) vm;
2440 
2441  moTrackerSystemData* pTracker = NULL;
2442 
2443  int trackerindex = (int)lua_tonumber( state, 1);
2444  int maxtime_ms = (int)lua_tonumber( state, 2);
2445  int granularity_ms = (int)lua_tonumber( state, 3);
2446 
2447  moInlet* pInlet = NULL;
2448 
2449  pInlet = m_Inlets[trackerindex];
2450 
2451  if (pInlet && pInlet->Updated()) {
2452  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2453  if (pTracker) {
2454  pTracker->GetHistory().StartRecording(maxtime_ms,granularity_ms);
2455  }
2456  }
2457  return 0;
2458 }
2459 
2461 
2462  lua_State *state = (lua_State *) vm;
2463 
2464  moTrackerSystemData* pTracker = NULL;
2465 
2466  int trackerindex = (int)lua_tonumber( state, 1);
2467 
2468  moInlet* pInlet = NULL;
2469 
2470  pInlet = m_Inlets[trackerindex];
2471 
2472  if (pInlet && pInlet->Updated()) {
2473  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2474  if (pTracker) {
2475  pTracker->GetHistory().PauseRecording();
2476  }
2477  }
2478  return 0;
2479 }
2480 
2481 
2483 
2484  lua_State *state = (lua_State *) vm;
2485 
2486  moTrackerSystemData* pTracker = NULL;
2487 
2488  int trackerindex = (int)lua_tonumber( state, 1);
2489 
2490  moInlet* pInlet = NULL;
2491 
2492  pInlet = m_Inlets[trackerindex];
2493 
2494  if (pInlet && pInlet->Updated()) {
2495  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2496  if (pTracker) {
2497  pTracker->GetHistory().ContinueRecording();
2498  }
2499  }
2500 
2501  return 0;
2502 }
2504  lua_State *state = (lua_State *) vm;
2505 
2506  moTrackerSystemData* pTracker = NULL;
2507 
2508  int trackerindex = (int)lua_tonumber( state, 1);
2509 
2510  moInlet* pInlet = NULL;
2511 
2512  pInlet = m_Inlets[trackerindex];
2513 
2514  if (pInlet && pInlet->Updated()) {
2515  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2516  if (pTracker) {
2517  pTracker->GetHistory().StopRecording();
2518  }
2519  }
2520 
2521  return 0;
2522 
2523 }
2525  lua_State *state = (lua_State *) vm;
2526 
2527  moTrackerSystemData* pTracker = NULL;
2528 
2529  int trackerindex = (int)lua_tonumber( state, 1);
2530  int recordindex = (int)lua_tonumber( state, 2);
2531 
2532  moTrackerInstanceRecord IRecord;
2533 
2534  moInlet* pInlet = NULL;
2535 
2536  pInlet = m_Inlets[trackerindex];
2537 
2538  if (pInlet && pInlet->Updated()) {
2539  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2540  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2541  IRecord = pTracker->GetHistory().Get( recordindex );
2542  } else {
2543  MODebug2->Error("luaGetHistoryRecord::out of bound recordindex:"+IntToStr(recordindex)+" histories:"+IntToStr( pTracker->GetHistory().CountRecords()) );
2544  }
2545  } else {
2546  MODebug2->Error("luaGetHistoryRecord:: no tracker index or inlet not updated");
2547  }
2548 
2549  lua_pushnumber( state, (lua_Number) IRecord.m_ValidFeatures);
2550  lua_pushnumber( state, (lua_Number) IRecord.m_DeltaValidFeatures);
2551  lua_pushnumber( state, (lua_Number) IRecord.m_nFeatures);
2552  lua_pushnumber( state, (lua_Number) IRecord.m_SurfaceCovered);
2553  lua_pushnumber( state, (lua_Number) IRecord.m_Tick);
2554  return 5;
2555 }
2556 
2558  lua_State *state = (lua_State *) vm;
2559 
2560  moTrackerSystemData* pTracker = NULL;
2561 
2562  int trackerindex = (int)lua_tonumber( state, 1);
2563  int recordindex = (int)lua_tonumber( state, 2);
2564 
2565  moTrackerInstanceRecord IRecord;
2566 
2567  moInlet* pInlet = NULL;
2568 
2569  pInlet = m_Inlets[trackerindex];
2570 
2571  if (pInlet && pInlet->Updated()) {
2572  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2573  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2574  IRecord = pTracker->GetHistory().Get( recordindex );
2575  }
2576  }
2577 
2578  lua_pushnumber( state, (lua_Number) IRecord.m_Barycenter.X());
2579  lua_pushnumber( state, (lua_Number) IRecord.m_Barycenter.Y());
2580  lua_pushnumber( state, (lua_Number) IRecord.m_BarycenterMotion.X());
2581  lua_pushnumber( state, (lua_Number) IRecord.m_BarycenterMotion.Y());
2582  lua_pushnumber( state, (lua_Number) IRecord.m_BarycenterAcceleration.X());
2583  lua_pushnumber( state, (lua_Number) IRecord.m_BarycenterAcceleration.Y());
2584  return 6;
2585 }
2586 
2589  lua_State *state = (lua_State *) vm;
2590 
2591  moTrackerSystemData* pTracker = NULL;
2592 
2593  int trackerindex = (int)lua_tonumber( state, 1);
2594  int recordindex = (int)lua_tonumber( state, 2);
2595 
2596  moTrackerInstanceRecord IRecord;
2597 
2598  moInlet* pInlet = NULL;
2599 
2600  pInlet = m_Inlets[trackerindex];
2601 
2602  if (pInlet && pInlet->Updated()) {
2603  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2604  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2605  IRecord = pTracker->GetHistory().Get( recordindex );
2606  }
2607  }
2608 
2609  lua_pushnumber( state, (lua_Number) IRecord.m_Variance.X());
2610  lua_pushnumber( state, (lua_Number) IRecord.m_Variance.Y());
2611  lua_pushnumber( state, (lua_Number) IRecord.m_SpeedVariance.X());
2612  lua_pushnumber( state, (lua_Number) IRecord.m_SpeedVariance.Y());
2613  lua_pushnumber( state, (lua_Number) IRecord.m_AccelerationVariance.X());
2614  lua_pushnumber( state, (lua_Number) IRecord.m_AccelerationVariance.Y());
2615  return 6;
2616 
2617 }
2618 
2621  lua_State *state = (lua_State *) vm;
2622 
2623  moTrackerSystemData* pTracker = NULL;
2624 
2625  int trackerindex = (int)lua_tonumber( state, 1);
2626  int recordindex = (int)lua_tonumber( state, 2);
2627 
2628  moTrackerInstanceRecord IRecord;
2629 
2630  moInlet* pInlet = NULL;
2631 
2632  pInlet = m_Inlets[trackerindex];
2633 
2634  if (pInlet && pInlet->Updated()) {
2635  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2636  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2637  IRecord = pTracker->GetHistory().Get( recordindex );
2638  }
2639  }
2640 
2641  lua_pushnumber( state, (lua_Number) IRecord.m_BoundingRectangle.X());
2642  lua_pushnumber( state, (lua_Number) IRecord.m_BoundingRectangle.Y());
2643  lua_pushnumber( state, (lua_Number) IRecord.m_BoundingRectangle.Z());
2644  lua_pushnumber( state, (lua_Number) IRecord.m_BoundingRectangle.W());
2645  lua_pushnumber( state, (lua_Number) IRecord.m_BoundingRectangleAngle );
2646  lua_pushnumber( state, (lua_Number) IRecord.m_BlobCandidates );
2647  return 6;
2648 
2649 }
2650 
2653  lua_State *state = (lua_State *) vm;
2654 
2655  moTrackerSystemData* pTracker = NULL;
2656 
2657  int trackerindex = (int)lua_tonumber( state, 1);
2658  int recordindex = (int)lua_tonumber( state, 2);
2659 
2660  moTrackerInstanceRecord IRecord;
2661 
2662  moInlet* pInlet = NULL;
2663 
2664  pInlet = m_Inlets[trackerindex];
2665 
2666  if (pInlet && pInlet->Updated()) {
2667  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2668  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2669  IRecord = pTracker->GetHistory().Get( recordindex );
2670  }
2671  }
2672 
2673  lua_pushnumber( state, (lua_Number) IRecord.m_AbsoluteSpeedAverage);
2674  lua_pushnumber( state, (lua_Number) IRecord.m_AbsoluteAccelerationAverage);
2675  lua_pushnumber( state, (lua_Number) IRecord.m_AbsoluteTorqueAverage);
2676  return 3;
2677 
2678 }
2679 
2682 
2683  lua_State *state = (lua_State *) vm;
2684 
2685  moTrackerSystemData* pTracker = NULL;
2686 
2687  int trackerindex = (int)lua_tonumber( state, 1);
2688  int recordindex = (int)lua_tonumber( state, 2);
2689 
2690  moTrackerInstanceRecord IRecord;
2691 
2692  moInlet* pInlet = NULL;
2693 
2694  pInlet = m_Inlets[trackerindex];
2695 
2696  if (pInlet && pInlet->Updated()) {
2697  pTracker = (moTrackerSystemData*)pInlet->GetData()->Pointer();
2698  if (pTracker && recordindex>=0 && recordindex<pTracker->GetHistory().CountRecords()) {
2699  IRecord = pTracker->GetHistory().Get( recordindex );
2700  }
2701  }
2702 
2703  lua_pushnumber( state, (lua_Number) IRecord.m_Min.X());
2704  lua_pushnumber( state, (lua_Number) IRecord.m_Min.Y());
2705  lua_pushnumber( state, (lua_Number) IRecord.m_Max.X());
2706  lua_pushnumber( state, (lua_Number) IRecord.m_Max.Y());
2707  return 4;
2708 
2709 }
2710 
2711 const moText&
2713  moText fieldSeparation = ",";
2714  moMobDefinition Definition = GetMobDefinition();
2715  moMobState State = GetState();
2716 
2717  m_FullJSON = "{";
2718  m_FullJSON+= "'objectstate': " + State.ToJSON();
2719  m_FullJSON+= fieldSeparation + "'objecttypeid': '" + IntToStr( moGetStrType( Definition.GetName() ) )+"'";
2720  m_FullJSON+= fieldSeparation + "'objectdefinition': " + Definition.ToJSON();
2721  //m_FullJSON+= fieldSeparation + "'objectconfig': " + m_Config.ToJSON();
2722  m_FullJSON+= "}";
2723 
2724  return m_FullJSON;
2725 }
2726 
2728 
2729  if (p_Str == moText("effect") || p_Str == moText("moEffect")) {
2730  return MO_OBJECT_EFFECT;
2731  } else if (p_Str == moText("mastereffect") || p_Str == moText("moMasterEffect")) {
2732  return MO_OBJECT_MASTEREFFECT;
2733  } else if (p_Str == moText("posteffect") || p_Str == moText("moPostEffect")) {
2734  return MO_OBJECT_POSTEFFECT;
2735  } else if (p_Str == moText("preeffect") || p_Str == moText("moPreEffect")) {
2736  return MO_OBJECT_PREEFFECT;
2737  } else if (p_Str == moText("iodevice") || p_Str == moText("moIODevice")) {
2738  return MO_OBJECT_IODEVICE;
2739  } else if (p_Str == moText("resource") || p_Str == moText("moResource")) {
2740  return MO_OBJECT_RESOURCE;
2741  } else if (p_Str == moText("console") || p_Str == moText("moConsole")) {
2742  return MO_OBJECT_CONSOLE;
2743  }
2744 
2745  return MO_OBJECT_UNDEFINED;
2746 
2747 }
value type: TXT or LNK
Definition: moParam.h:69
void StartRecording(long maxtime=60000, long granularity=30)
Empieza a grabar.
virtual void Deactivate()
MOswitch m_Activated
int luaGetHistoryVariance(moLuaVirtualMachine &vm)
Devuelve las varianzas.
const moText & GetLabelName() const
Devuelve la etiqueta de este objeto.
int luaSetCurrentValue(moLuaVirtualMachine &vm)
Fija el índice del valor actual de un parámetro.
Valor de un Parámetro.
Definition: moValue.h:501
virtual bool SetState(const moMobState &p_MobState)
moMoldeoObjectType
Tipos de objetos en Moldeo.
Definition: moTypes.h:525
moText m_MoldeoLabelName
Identificador de objeto Moldeo.
moVector4i * Vector4i()
Definition: moValue.cpp:400
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
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
moEvent * First
Definition: moEventList.h:145
MOint m_MoldeoIdSrc
Definition: moEventList.h:119
moVector4< MOlong > moVector4i
Clase Evento.
Definition: moEventList.h:56
const moText & GetName() const
Definition: moParam.h:266
void Error(moText p_text)
Anuncia y registra un error.
Definition: moAbstract.cpp:79
void Update(bool force=true)
const moMobIndex & GetMobIndex() const
Devuelve la dupla de índices para el archivo de configuración.
void SetType(moMoldeoObjectType p_type)
Fija el tipo de moMoldeoObject o moMoldeoObjectType.
moDataType
Definition: moValue.h:98
int luaGetTrackerFeaturesCount(moLuaVirtualMachine &vm)
moDataType Type() const
Definition: moValue.cpp:940
int luaGetHistoryAverage(moLuaVirtualMachine &vm)
Devuelve los promedios.
double m_AbsoluteAccelerationAverage
cantidad de movimiento
MOdouble Double() const
Definition: moValue.cpp:859
clase base para una fuente 3d o 2d
Definition: moFontManager.h:63
moParamType
Definition: moParam.h:40
const moText & GetConfigName() const
Nombre del archivo de configuración.
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
moData * GetInternalData()
virtual void LoadDefinition()
Carga las definiciones de parámetros del archivo de configuración.
void SetScript(const moText &p_script)
void Set(moText p_objectname, moText p_objectclass)
Fija el nombre y la clase del objeto a configurar.
Definition: moConfig.h:106
MOint GetOutletIndex(const moText &p_connector_name) const
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
value type: TXT or LNK
Definition: moParam.h:56
const moText & GetName() const
Nombre del objeto.
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
MOint GetDestinationConnectorId()
#define MOboolean
Definition: moTypes.h:385
#define MO_OFF
Definition: moTypes.h:366
virtual void Activate()
Real W() const
Definition: moMathVector4.h:81
value type: NUM or FUNCTION
Definition: moParam.h:68
virtual int ScriptCalling(moLuaVirtualMachine &vm, int iFunctionNumber)
virtual int GetValidFeatures()
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
int m_ValidFeatures
0 nada, 1 todo...
virtual moVector2f GetBarycenterAcceleration()
void SetLabelName(const moText &p_labelname)
Fija la etiqueta de este objeto.
Conector Outlet, conector que envía datos.
Definition: moConnectors.h:410
MOulong moGetDuration()
Devuelve el valor del reloj del temporizador global.
Definition: moTimer.cpp:134
bool IsParameterDependent()
Definition: moConnectors.h:232
moInlets * GetInlets()
moParamType GetType() const
Definition: moParam.h:277
Clase Mensaje.
Definition: moEventList.h:97
static moText GetTypeToName(moMoldeoObjectType p_Type=MO_OBJECT_UNDEFINED)
Transforma un moMoldeoObjectType en el nombre de su correspondiente.
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)
int luaGetTrackerVariance(moLuaVirtualMachine &vm)
Objeto indefinido.
Definition: moTypes.h:527
void SetFun(const moText &p_functionExpression)
Definition: moValue.cpp:228
virtual int GetFeaturesCount()
void SetLong(MOlonglong plong)
Definition: moValue.cpp:188
virtual ~moMobDefinition()
Destructor.
virtual const moText & GetConnectorLabelName() const
int luaGetTrackerBarycenter(moLuaVirtualMachine &vm)
Real Y() const
Definition: moMathVector4.h:77
float tr_y
Feature position in the previous frame.
#define MO_INLET_TYPE
definici�n de todos los par�metros a encontrar o a crear dentro del moConfig
Definition: moConfig.h:57
#define MO_MESSAGE
Definition: moEventList.h:84
MOint GetInletIndex(moText p_connector_name) const
MOpointer Pointer()
Definition: moValue.cpp:919
moDefineDynamicArray(moMoldeoObjects) moMobState
moMobDefinition()
Constructor.
value type: TXT or LNK, or XML
Definition: moParam.h:55
MOuint GetValuesCount() const
Definition: moParam.cpp:1065
Lista de eventos.
Definition: moEventList.h:139
clase de para manejar textos
Definition: moText.h:75
float y
Location.
virtual void ScriptExeFinish()
bool Selected() const
MOlonglong Long() const
Definition: moValue.cpp:804
void SetConsoleValueIndex(MOint p_valueindex)
#define MOlong
Definition: moTypes.h:391
MOfloat moFontSize
Definition: moFontManager.h:43
Clase Base Descriptiva de un Objeto Moldeo.
virtual ~moMobState()
virtual bool Activated() const
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
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.
int luaGetTrackerZone(moLuaVirtualMachine &vm)
moText0 moText
Definition: moText.h:291
Real Length() const
Definition: moMathVector.h:170
int luaSetInletData(moLuaVirtualMachine &vm)
Fija el dato de un inlet (o parametro) dado el índice del inlet.
moTextureType GetType() const
Definition: moTexture.h:219
bool Activated() const
int luaGetTrackerFeature(moLuaVirtualMachine &vm)
#define MO_OUTLET_TYPE
int luaGetTrackerHistory(moLuaVirtualMachine &vm)
#define MOint
Definition: moTypes.h:388
virtual ~moMoldeoObject()
Sistema de características.
int luaSetPreconf(moLuaVirtualMachine &vm)
Fija la preconfiguración de este objeto.
Real Z() const
Definition: moMathVector3.h:77
MOswitch m_Selected
virtual void Unselect()
void SetMoldeoId(MOint p_moldeoid)
Fija el identificador de este objeto.
MOint GetId() const
virtual void Select()
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()
moFontType
Definition: moFontManager.h:45
MOint reservedvalue3
Definition: moEventList.h:67
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
#define MO_PARAM_NOT_FOUND
Definition: moConfig.h:41
Administrador de recursos.
virtual void ScriptExeUpdate()
virtual void Update(moEventList *p_EventList)
int luaStopTrackerHistory(moLuaVirtualMachine &vm)
const moText & ToJSON()
moVector3d * Vector3d()
Definition: moValue.cpp:385
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.
Clase base de sonido.
void Copy(const moData &data)
Definition: moValue.cpp:146
MOint GetMoldeoId() const
Devuelve el identificador de este objeto.
Objeto dibujable, efecto ( efectos en el orden de dibujado )
Definition: moTypes.h:528
moVector3< MOdouble > moVector3d
void SetDescription(const moText &p_Description)
Fija la descripción de este objeto.
Real Y() const
Definition: moMathVector3.h:75
const moText & ToJSON()
virtual MOboolean RefreshValue(moParam &param, int value_index)
value type: TXT or LNK
Definition: moParam.h:50
virtual MOboolean UpdateConnectors()
TEXTURA BASE.
Definition: moTexture.h:54
virtual void RegisterFunctions()
beware ! call only once or die!!!
MOint GetDestinationMoldeoId()
static moDebug * MODebug2
Clase de impresión de errores para depuración.
Definition: moAbstract.h:225
Real X() const
Definition: moMathVector4.h:75
Real X() const
Definition: moMathVector.h:77
moVector3i * Vector3i()
Definition: moValue.cpp:390
void SetConsoleParamIndex(MOint p_paramindex)
moVector2< MOlong > moVector2i
Definition: moMathVector.h:422
#define MO_OUTLET_INLETS_OFFSET
int luaGetHistoryMinMax(moLuaVirtualMachine &vm)
Devuelve el rectangulo max, min.
moMoldeoObjectType GetType() const
Nombre del archivo de configuración.
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.
double m_SurfaceCovered
separa formas de fondo
MOfloat Float() const
Definition: moValue.cpp:835
Real Z() const
Definition: moMathVector4.h:79
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
moVector2i * Vector2i()
Definition: moValue.cpp:380
moTrackerInstanceRecord & Get(int index)
moVector2< MOdouble > moVector2d
Definition: moMathVector.h:424
moValue & GetValue(MOint i=-1)
Definition: moParam.cpp:1204
double m_BoundingRectangleAngle
cantidad de fuerzas
MOboolean Updated() const
Real X() const
Definition: moMathVector3.h:73
void SetFatherLabelName(const moText &p_labelname)
Fija la etiqueta del padre de este objeto.
#define MOdouble
Definition: moTypes.h:404
void PauseRecording()
Util cuando no hay señales interesantes...
#define DataMan()
#define MO_ON
Definition: moTypes.h:365
Real Y() const
Definition: moMathVector.h:79
value type: TXT or LNK
Definition: moParam.h:51
virtual moVector2f GetVariance()
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.
moVector4d * Vector4d()
Definition: moValue.cpp:395
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").
moMoldeoObjectType GetType() const
int luaGetTrackerSystemData(moLuaVirtualMachine &vm)
virtual MOboolean ResolveValue(moParam &param, int value_index, bool p_refresh=false)
#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.
Objeto dibujable, post-efecto ( últímos efectos en el orden de dibujado )
Definition: moTypes.h:530
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
void SetActivate(bool p_activate)
Fija el modo de activación al inicio del proyecto.
value type: TXT or LNK
Definition: moParam.h:73
moMoldeoObjectType GetStrToType(const moText &p_Str=moText("default")) const
Transforma una cadena de caracteres en su correspondiente moMoldeoObjectType.
moText GetTypeStr() const
Transforma un moMoldeoObjectType en el nombre de su correspondiente clase base.
virtual MOboolean Finish()
int luaGetValuesCount(moLuaVirtualMachine &vm)
Devuelve la cantidad de valores de un parámetro.
Conector para vincular objetos con datos.
Definition: moConnectors.h:57
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
#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)
value type: TXT or LNK
Definition: moParam.h:48
moVector2f m_BarycenterAcceleration
void SetResourceManager(moResourceManager *p_pResourceManager)
virtual bool Selected() const
moVector2d * Vector2d()
Definition: moValue.cpp:375
virtual const moMobState & GetState() const
moTrackerSystemHistory & GetHistory()
Indice referente a la descripción del objeto en un archivo de configuración.
moText GetTypeStr() const
Definition: moParam.cpp:386
virtual MOboolean Init()
Conección, vínculo entre dos objetos.
Definition: moConnectors.h:280