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.
moConsole.cpp
Ir a la documentación de este archivo.
1 /*******************************************************************************
2 
3  moConsole.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 
29 *******************************************************************************/
30 
31 #include <moConsole.h>
32 #include "moSceneEffect.h"
33 
34 #define NOSDL 1
35 
36 #ifndef NOSDL
37 
38  #ifdef MO_WIN32
39  #include <SDL.h>
40  #endif
41 
42  #ifdef MO_LINUX
43  #include <SDL/SDL.h>
44  #endif
45 
46  #ifdef MO_MACOSX
47  #include <SDL/SDL.h>
48  #endif
49 
50 #else
51  #define SDL_KEYDOWN 2
52  #define SDL_KEYDOWN_SDL2 0x300
53  #define SDLK_ESCAPE 27
54  #define SDLK_SCANCODE_MASK (1<<30)
55  #define SDLK_F12 ( 69 | SDLK_SCANCODE_MASK )
56 #endif
57 
58 
59 
60 #undef main
61 #include <moDataManager.h>
62 #include <moFileManager.h>
63 
64 #include "moArray.h"
65 moDefineDynamicArray( moPresetParams );
66 
67 
69 
70 }
71 
73  (*this) = src;
74 }
75 
77 
78 }
79 
81  m_ObjectId = src.m_ObjectId;
84  m_State = src.m_State;
85  return (*this);
86 }
87 
88 
89 
91 
93  m_pIODeviceManager = NULL;
94  m_pResourceManager = NULL;
95 
96  m_bExternalResources = false;
97 
99  this->SetName("__console__");
100  this->SetLabelName("__console__");
101  this->SetType( MO_OBJECT_CONSOLE );
102 
103  ticks = 0;
104  fps_current = 0;
105  fps_mean = 0;
106  fps_count = 0;
107 }
108 
110 {
111  Finish();
112 }
113 
114 bool moConsole::LabelNameExists( const moText& labelname ) {
115 
116  int mobid = -1;
117 
118  mobid = GetObjectId(labelname);
119  if (mobid>-1) {
120  moMoldeoObject* pObj = GetObjectByIdx(mobid);
121  if (pObj) {
122  moText obj_labelname = pObj->GetLabelName();
123  if ( obj_labelname!=labelname ) {
124  return false;
125  }
126  }
127  else
128  return false;
129  }
130 
131  return ( mobid > -1 );
132 }
133 
134 int
136 
137  int mindex = -1;
138 
139  switch(p_type) {
140  case MO_OBJECT_EFFECT:
141  mindex = m_pResourceManager->Resources().Count();
142  mindex+= m_pIODeviceManager->IODevices().Count();
143  mindex+= m_EffectManager.PreEffects().Count();
144  mindex+= m_EffectManager.PostEffects().Count();
145  mindex+= relativeindex;
146  break;
147  case MO_OBJECT_PREEFFECT:
148  mindex = m_pResourceManager->Resources().Count();
149  mindex+= m_pIODeviceManager->IODevices().Count();
150  mindex+= relativeindex;
151  break;
153  mindex = m_pResourceManager->Resources().Count();
154  mindex+= m_pIODeviceManager->IODevices().Count();
155  mindex+= m_EffectManager.PreEffects().Count();
156  mindex+= relativeindex;
157  break;
159  mindex = m_pResourceManager->Resources().Count();
160  mindex+= m_pIODeviceManager->IODevices().Count();
161  mindex+= m_EffectManager.PreEffects().Count();
162  mindex+= m_EffectManager.PostEffects().Count();
163  mindex+= m_EffectManager.Effects().Count();
164  mindex+= relativeindex;
165  break;
166  case MO_OBJECT_IODEVICE:
167  mindex = m_pResourceManager->Resources().Count();
168  mindex+= relativeindex;
169  break;
170  case MO_OBJECT_RESOURCE:
171  mindex = 0;
172  mindex+= relativeindex;
173  break;
174  case MO_OBJECT_CONSOLE:
175  mindex = m_pResourceManager->Resources().Count();
176  mindex+= m_pIODeviceManager->IODevices().Count();
177  mindex+= m_EffectManager.PreEffects().Count();
178  mindex+= m_EffectManager.PostEffects().Count();
179  mindex+= m_EffectManager.Effects().Count();
180  mindex+= m_EffectManager.MasterEffects().Count();
181  break;
182 
183  default:
184  break;
185 
186  }
187  if (mindex==-1) MODebug2->Error("moConsole::RelativeToGeneralIndex > type not found");
188  return mindex;
189 
190 }
191 
192 moMoldeoObjects& moConsole::GetMoldeoObjects() {
193  return m_MoldeoObjects;
194 }
195 
197 
198  return m_EffectManager;
199 
200 }
201 
203 
204  if (p_IODeviceManager!=NULL)
205  m_pIODeviceManager = p_IODeviceManager;
206 
207 }
208 
210  moText p_apppath,
211  moText p_datapath,
212  moConfig& p_consoleconfig,
213  MOint p_render_to_texture_mode,
214  MOint p_screen_width, MOint p_screen_height,
215  MOint p_render_width, MOint p_render_height,
216  MO_HANDLE p_OpWindowHandle,
217  MO_DISPLAY p_Display) {
218 
219 
220  if (pResourceManager==NULL) {
222  } else {
223  m_bExternalResources = true;
224  SetResourceManager( pResourceManager );
225  }
226 
227  if (m_pResourceManager) {
229  p_apppath,
230  p_datapath,
231  p_consoleconfig,
232  p_render_to_texture_mode,
233  p_screen_width, p_screen_height,
234  p_render_width, p_render_height,
235  p_OpWindowHandle,
236  p_Display);
237  }
238 }
239 
240 
242 {
243  return Init( moText(""), moText("data"), moText("data/console.mol"), NULL, NULL, RENDERMANAGER_MODE_NORMAL,
248 
249 }
250 
251 
253  moText p_apppath,
254  moText p_datapath,
255  moText p_consoleconfig,
256  moIODeviceManager* p_pIODeviceManager,
257  moResourceManager* p_pResourceManager,
258  moRenderManagerMode p_render_to_texture_mode,
259  MOint p_screen_width, MOint p_screen_height,
260  MOint p_render_width, MOint p_render_height,
261  MO_HANDLE p_OpWindowHandle,
262  MO_DISPLAY p_Display)
263 {
264 
265  moText text;
266  //int verif;
267  //int a,b;
268 
269  idebug = -1;
270  iligia = -1;
271  iborrado = -1;
272  m_ConsoleScript = moText("");
273  //moMoldeoObjectType consoletype = moGetStrType( moText("console") );
274 
275  srand( time(NULL) );
276 
277  //if no IODeviceManager defined by the user, use default
278  if (MODebug2) MODebug2->Message(moText("moConsole:: Initializing IODevice's Manager."));
279 
280  if( p_pIODeviceManager == NULL ) {
283  if (m_pIODeviceManager)
285  } else {
287  m_pIODeviceManager = p_pIODeviceManager;
288  }
289 
290  if (MODebug2) MODebug2->Message(moText("moConsole::Init > Initializing Effects Manager."));
293 
294  //Inicializando Estado de la Consola
296 
297  //==========================================================================
298  // CARGAMOS EL ARCHIVO DE CONFIGURACION
299  //==========================================================================
300 
301  SetConfigName( p_consoleconfig );
302 
305  if (!moMoldeoObject::Init()) {
306  Finish();
307  return false;
308  }
309 
313 
314  if (MODebug2) MODebug2->Message(moText("moConsole::Init > mol project opening....success "));
315 
316 
317  //if () {
318  moText mode = m_Config.Text("outputmode");
319 
320  moText rendermode = m_Config.Text("rendermode");
321 
322  if ( rendermode != moText("") ) {
323  if (rendermode==moText("RENDERMANAGER_MODE_NORMAL")) {
324  MODebug2->Message("moConsole :: Render Mode forced to RENDERMANAGER_MODE_NORMAL");
325  p_render_to_texture_mode = RENDERMANAGER_MODE_NORMAL;
326  } else if (rendermode==moText("RENDERMANAGER_MODE_FRAMEBUFFER")) {
327  MODebug2->Message("moConsole :: Render Mode forced to RENDERMANAGER_MODE_FRAMEBUFFER");
328  p_render_to_texture_mode = RENDERMANAGER_MODE_FRAMEBUFFER;
329  } else if (rendermode==moText("RENDERMANAGER_MODE_VDPAU")) {
330  MODebug2->Message("moConsole :: Render Mode forced to RENDERMANAGER_MODE_VDPAU");
331  p_render_to_texture_mode = RENDERMANAGER_MODE_VDPAU;
332  }
333  }
334 
335  moText renderwidth = m_Config.GetParam("renderresolution").GetValue().GetSubValue(0).Text();
336  moText renderheight = m_Config.GetParam("renderresolution").GetValue().GetSubValue(1).Text();
337 
338  moText screenwidth = m_Config.GetParam("outputresolution").GetValue().GetSubValue(0).Text();
339  moText screenheight = m_Config.GetParam("outputresolution").GetValue().GetSubValue(1).Text();
340 
341 
342  if (renderwidth!=moText("") && renderheight!=moText("")) {
343  int i_render_width = atoi(renderwidth);
344  int i_render_height = atoi(renderheight);
345 
346  if ( 0<i_render_width && i_render_width<6144 ) {
347  p_render_width = i_render_width;
348  }
349 
350  if ( 0<i_render_height && i_render_height<6144 ) {
351  p_render_height = i_render_height;
352  }
353  }
354 
355  if (screenwidth!=moText("") && screenheight!=moText("")) {
356  int i_screenwidth = atoi(screenwidth);
357  int i_screenheight = atoi(screenheight);
358 
359  if ( 0<i_screenwidth && i_screenwidth<6144 ) {
360  p_screen_width = i_screenwidth;
361  }
362 
363  if ( 0<i_screenheight && i_screenheight<6144 ) {
364  p_screen_height = i_screenheight;
365  }
366  }
367 
368 
369  //}
370 
371  // Verificar que el nro de version sea correcto //
372  //...
376 
377  if (MODebug2) MODebug2->Message(moText("moConsole::Init > Initializing Resource Manager. ")
378  + moText( " app path: ") + p_apppath
379  + moText( " data path: ") + p_datapath
380  + moText( " config: ") + m_Config.GetName()
381  + moText( " render mode: ") + IntToStr(p_render_to_texture_mode)
382  + moText( " screen size: ") + IntToStr(p_screen_width) + moText("x") + IntToStr(p_screen_height)
383  + moText( " render size: ") + IntToStr(p_render_width) + moText("x") + IntToStr(p_render_height) );
384 
385  InitResources( p_pResourceManager,
386  p_apppath,
387  p_datapath,
388  m_Config,
389  p_render_to_texture_mode,
390  p_screen_width, p_screen_height,
391  p_render_width, p_render_height,
392  p_OpWindowHandle,
393  p_Display);
394 
396 
397 
400 
405  moDefineParamIndex( CONSOLE_POSTEFFECT, moText("posteffect") );
406  moDefineParamIndex( CONSOLE_MASTEREFFECT, moText("mastereffect") );
408  moDefineParamIndex( CONSOLE_ON, moText("mastereffects_on") );
410  //moDefineParamIndex( CONSOLE_SCRIPT, moText("consolescript") );
411  moDefineParamIndex( CONSOLE_OUTPUTMODE, moText("outputmode") );
412  moDefineParamIndex( CONSOLE_OUTPUTRESOLUTION, moText("outputresolution") );
413  moDefineParamIndex( CONSOLE_RENDERMODE, moText("rendermode") );
414  moDefineParamIndex( CONSOLE_RENDERRESOLUTION, moText("renderresolution") );
418  moDefineParamIndex( CONSOLE_SCREENSHOTS, moText("screenshots") );
419  moDefineParamIndex( CONSOLE_VIDEOSHOTS, moText("videoshots") );
420 
421 
447  //LoadResources();
449  LoadIODevices();
450  LoadResources();
451 
452  LoadPreEffects();
453  LoadPostEffects();
454  LoadEffects();
456 
457  MOboolean m_bMasterEffects_On = m_Config.GetParam( moText("mastereffects_on") ).GetValue().GetSubValue(0).Int();
458  if (m_bMasterEffects_On) {
459  //
460  }
461 
462  m_MoldeoObjects.Add( (moMoldeoObject*)this );
463 
465 
466  UpdateMoldeoIds();
467 
468 
471 
472  if (MODebug2) MODebug2->Message(moText("moConsole::Init > calling VideoManager update function."));
473  //m_pResourceManager->GetRenderMan()->BeginUpdateObject();
474  //m_pResourceManager->GetVideoMan()->Update( m_pIODeviceManager->GetEvents() );
475  //m_pResourceManager->GetRenderMan()->EndUpdateObject();
476  }
477 
480  if (MODebug2) MODebug2->Message(moText("moConsole::Init > InitializeAllEffects."));
481  this->InitializeAllEffects();
482 
483  if (MODebug2) MODebug2->Message(moText("moConsole::Init > StartMasterEffects."));
484  this->StartMasterEffects();
485 
487  if (MODebug2) MODebug2->Message(moText("moConsole::Init > LoadConnections."));
488  LoadConnections();
489 
491  if (MODebug2) MODebug2->Message(moText("moConsole::Init > ScriptExeInit."));
492  ScriptExeInit();
493 
494  m_bInitialized = true;
495 
496 
497  moDataMessage* pMessageStayingAlive = new moDataMessage();
498  pMessageStayingAlive->Add( moData( "consoleget" ) );
499  ProcessMoldeoAPIMessage(pMessageStayingAlive);
500 
501 
502  return Initialized();
503 }
504 
505 void
507 
509 
518  int max = RelativeToGeneralIndex( 0, MO_OBJECT_CONSOLE ) + 1;
519  m_MoldeoObjects.Empty();
520  m_MoldeoObjects.Init( max, NULL);
521 
522  m_MoldeoSceneObjects.Empty();
523 
524  for( MOuint i=0; i<m_pResourceManager->Resources().Count(); i++ ) {
525  moResource* pResource = m_pResourceManager->Resources().GetRef(i);
527  }
528 
529  for( MOuint i=0; i<m_pIODeviceManager->IODevices().Count(); i++ ) {
530  moIODevice* pIODevice = m_pIODeviceManager->IODevices().GetRef(i);
532  }
533 
534  for( MOuint i=0; i<m_EffectManager.PreEffects().Count(); i++ ) {
535  moPreEffect* pFx = m_EffectManager.PreEffects().GetRef(i);
537  }
538 
539  for( MOuint i=0; i<m_EffectManager.PostEffects().Count(); i++ ) {
540  moPostEffect* pFx = m_EffectManager.PostEffects().GetRef(i);
542  }
543 
544  for( MOuint i=0; i<m_EffectManager.Effects().Count(); i++ ) {
545  moEffect* pFx = m_EffectManager.Effects().GetRef(i);
547  }
548 
549  for( MOuint i=0; i<m_EffectManager.MasterEffects().Count(); i++ ) {
550  moMasterEffect* pFx = m_EffectManager.MasterEffects().GetRef(i);
552  }
553 
555 
557  for( MOuint i=0; i<m_MoldeoObjects.Count(); i++) {
558  moMoldeoObject* mobject = m_MoldeoObjects.GetRef(i);
559  if (mobject) mobject->SetId(MO_MOLDEOOBJECTS_OFFSET_ID + i);
560  }
561 
563 
564  for( MOuint i=0; i<m_EffectManager.Effects().Count(); i++ ) {
565  moEffect* pFx = m_EffectManager.Effects().GetRef(i);
566  if (pFx)
567  if (pFx->GetName()=="scene") {
568  moSceneEffect* pScene = (moSceneEffect*) pFx;
570  }
571  }
572 
574  /*
575  for( MOuint i=0; i<m_MoldeoSceneObjects.Count(); i++) {
576  moMoldeoObject* mobject = m_MoldeoSceneObjects.GetRef(i);
577  if (mobject) mobject->SetId(MO_MOLDEOSCENEOBJECTS_OFFSET_ID + i);
578  }
579  */
580 
581 }
582 
583 void
586  MOuint i,j,k,l,m;
587 
588  UpdateMoldeoIds();
589 
591  for( i=0; i<(m_MoldeoObjects.Count()+m_MoldeoSceneObjects.Count()); i++) {
592 
593  moMoldeoObject* psrcobject = NULL;
594  if ( i<m_MoldeoObjects.Count())
595  psrcobject = m_MoldeoObjects[i];
596  else
597  psrcobject = m_MoldeoSceneObjects[i-m_MoldeoObjects.Count()];
598 
599  if (psrcobject) {
600 
601  moOutlets* poutlets = psrcobject->GetOutlets();
602 
604  for( j=0; j<poutlets->Count(); j++) {
605 
606  moOutlet* p_outlet = poutlets->Get(j);
607 
608  moConnections* p_connections = p_outlet->GetConnections();
609 
610  for( k = 0; k < p_connections->Count(); k++ ) {
611 
612  moConnection *p_connection = p_connections->GetRef(k);//get the connection to update
613 
614  moText DestinationMoldeoLabelName = p_connection->GetDestinationMoldeoLabelName();
615  moText DestinationConnectorLabelName = p_connection->GetDestinationConnectorLabelName();
616  bool connector_found;
617  bool object_found;
618 
619  connector_found = false;
620  object_found = false;
621 
624  for( l=0; l<(m_MoldeoObjects.Count()+m_MoldeoSceneObjects.Count()); l++) {
625 
626  moMoldeoObject* pdstobject = NULL;
627 
628  if ( l<m_MoldeoObjects.Count())
629  pdstobject = m_MoldeoObjects[l];
630  else
631  pdstobject = m_MoldeoSceneObjects[l-m_MoldeoObjects.Count()];
632 
633  if (pdstobject) {
634  if ( pdstobject->GetLabelName()==DestinationMoldeoLabelName ) {
635  object_found = true;
637  p_connection->SetDestinationMoldeoId(pdstobject->GetId());
638  for( m = 0; m < pdstobject->GetInlets()->Count() ; m++) {
639  moInlet* pinlet = pdstobject->GetInlets()->Get(m);
640  if (pinlet->GetConnectorLabelName()==DestinationConnectorLabelName) {
641  connector_found = true;
642  //update destination connector id
643  p_connection->SetDestinationConnectorId( pinlet->GetConnectorId() );
644  MODebug2->Log(
645  moText("moConsole::LoadConnections > Object <") +
646  psrcobject->GetLabelName() +
647  moText("> Outlet <") +
648  p_outlet->GetConnectorLabelName() +
649  moText("> connected succesfully to") +
650 
651  moText(" Object <") +
652  pdstobject->GetLabelName() +
653  moText("> Inlet <") +
654  pinlet->GetConnectorLabelName() +
655  moText(">")
656  );
657  }
658  }
659  }
660  }
661  } //end search
662 
663  if (!object_found) {
664  MODebug2->Error(
665  moText("moConsole::LoadConnections > From Object <") +
666  psrcobject->GetLabelName() +
667  moText("> to Object <") +
668  DestinationMoldeoLabelName +
669  moText("> object label not found")
670  );
671  } else if (!connector_found) {
672  MODebug2->Error(
673  moText("moConsole::LoadConnections > From Object <") +
674  psrcobject->GetLabelName() +
675  moText("> to Object <") +
676  DestinationMoldeoLabelName +
677  moText("> Inlet <") +
678  DestinationConnectorLabelName +
679  moText("> connector label not found")
680  );
681  }
682 
683  }
684  }
685  }
686  }
687 
688 }
689 
690 
691 void
693 
694  if (fx_type==MO_OBJECT_UNDEFINED) {
695 
696  for(int i=0;i<MO_OBJECT_TYPES;i++ ) {
697  this->LoadObjects( (moMoldeoObjectType)i );
698  }
699  return;
700  }
701 
702  moText text,fxname,cfname,lblname,keyname;
703  MOint efx,i,N;
704  bool activate = true;
705  moEffect* peffect = NULL;
706 
707  moText fx_string = moMobDefinition::GetTypeToName(fx_type);
708 
709  efx = m_Config.GetParamIndex(fx_string);
711  N = m_Config.GetValuesCount(efx);
712 
713  if (MODebug2) {
714  MODebug2->Message( moText("moConsole::LoadObjects > Loading Object configs...") );
715  MODebug2->Message( moText("moConsole::LoadObjects > Objects number: ") + IntToStr(N) );
716  }
717 
718  if(N>0) {
720  for( i=0; i < N; i++) {
721  Draw();
725 
728 
731 
732 
733  moText completecfname = m_pResourceManager->GetDataMan()->GetDataPath() + moSlash + (moText)cfname+ moText(".cfg");
734  moFile FullCF( completecfname );
735 
736  if ( FullCF.Exists() ) {
737  if ((moText)fxname!=moText("nil")) {
738 
739  peffect = (moEffect*)m_EffectManager.NewEffect( fxname, cfname, lblname, keyname, MO_OBJECT_EFFECT, efx, i, activate );
740 
741  if (peffect) {
742  m_MoldeoObjects.Add( (moMoldeoObject*) peffect );
743  }
744 
745  if (MODebug2) {
746  MODebug2->Message( moText("moConsole::LoadObjects > ") + completecfname );
747  }
748 
749 
750  } else {
751  peffect = NULL;
752  m_EffectManager.Effects().Add(peffect);
753  m_EffectManager.AllEffects().Add(peffect);
754  m_MoldeoObjects.Add( (moMoldeoObject*) peffect );
755  }
756  } else {
757  MODebug2->Error(moText("moConsole::LoadObjects > Error: Config File doesn't exist : ") + (moText)completecfname);
758  }
760  }
761  }
762 
763  if (MODebug2) MODebug2->Message(moText("moConsole::LoadObjects > Effects loaded !"));
764 
765 }
766 
767 
768 
769 //==========================================================================
770 // CARGAMOS LOS DISPOSITIVOS
771 //==========================================================================
772 void
774 
775  moText text, fxname, cfname, lblname, keyname;
776  MOint devices, i, ndevices;
777  bool activate = true;
778  moIODevice* pdevice = NULL;
779 
780  devices = m_Config.GetParamIndex("devices");
781  ndevices = m_Config.GetParam(devices).GetValuesCount();
782 
786 
787  for( i=0; i<ndevices; i++) {
791 
792 
795 
798 
799  moText completecfname = m_pResourceManager->GetDataMan()->GetDataPath() + moSlash + (moText)cfname+ moText(".cfg");
800  moFile FullCF( completecfname );
801 
802  if ( FullCF.Exists() ) {
803  pdevice = m_pIODeviceManager->NewIODevice( fxname, cfname, lblname, keyname, MO_OBJECT_IODEVICE, devices, i, activate );
804  if (pdevice) {
805  m_MoldeoObjects.Add( (moMoldeoObject*) pdevice );
807  pdevice->Init();
808  if (activate) pdevice->Activate();
809  } else MODebug2->Error( moText("moConsole::LoadIODevices > Couldn't create the device:") + moText(fxname));
810  } else {
811  MODebug2->Error(moText("moConsole::LoadIODevices > Error: Config File doesn't exist : ") + (moText)completecfname);
812  }
814 
815  }
816  if (MODebug2) MODebug2->Message( moText("moConsole::LoadIODevices > IODevices loaded.") );
817 
821 
822 }
823 
825  if (m_pIODeviceManager)
826  while(m_pIODeviceManager->IODevices().Count()>0) {
827  if( m_pIODeviceManager->IODevices().GetRef(0) != NULL ) {
829  }
830  }
831 }
832 
833 void
835 
836  bool MoldeoAPISender = false;//in port 3335
837  bool MoldeoAPIListener = false;//in port 3334
839  if (m_pIODeviceManager)
840  for( MOuint i=0; i<(m_pIODeviceManager->IODevices().Count()); i++ ) {
841  moIODevice* pDevice = m_pIODeviceManager->IODevices().GetRef(i);
842  if (pDevice) {
843  if ( pDevice->GetName()=="netoscin" ) {
844  if (
845  (pDevice->GetConfig()->Text( "hosts" ) == "127.0.0.1"
846  && pDevice->GetConfig()->Int( "port" ) == 3334)
847  || ( pDevice->GetLabelName()=="moldeoapioscin")
848  ) {
849  MoldeoAPIListener = true;
850  if (MoldeoAPISender) break;
851  }
852  }
853 
854  if ( pDevice->GetName()=="netoscout" ) {
855  if (
856  ( pDevice->GetConfig()->Text( "hosts" ) == "127.0.0.1"
857  && pDevice->GetConfig()->GetValue( "hosts" ).GetSubValue(1).Int() == 3335)
858  ||
859  (pDevice->GetLabelName()=="moldeoapioscout")
860  ) {
861  MoldeoAPISender = true;
862  if (MoldeoAPIListener) break;
863  }
864  }
865  }
866  }
867 
868  moIODevice* pdevice =NULL;
869  moMobDefinition MD;
870  if (!MoldeoAPIListener) {
871  MD.SetConfigName("moldeoapioscin");
872  MD.SetLabelName("moldeoapioscin");
873  MD.SetName("netoscin");
877  if (pdevice) {
878  m_MoldeoObjects.Add( (moMoldeoObject*) pdevice );
879  moFile pFile( DataMan()->GetDataPath() + moSlash + MD.GetConfigName() + moText(".cfg") );
880  if (!pFile.Exists()) pdevice->GetConfig()->CreateDefault( pFile.GetCompletePath() );
882  pdevice->Init();
883  pdevice->Activate();
884  } else MODebug2->Error( moText("moConsole::LoadIODevices > Couldn't create the device:") + moText("moldeoapioscin"));
885 
886  }
887  if (!MoldeoAPISender) {
888  MD.SetConfigName("moldeoapioscout");
889  MD.SetLabelName("moldeoapioscout");
890  MD.SetName("netoscout");
894  if (pdevice) {
895  m_MoldeoObjects.Add( (moMoldeoObject*) pdevice );
896  moFile pFile( DataMan()->GetDataPath() + moSlash + MD.GetConfigName() + moText(".cfg") );
897  if (!pFile.Exists()) pdevice->GetConfig()->CreateDefault( pFile.GetCompletePath() );
899  pdevice->Init();
900  pdevice->Activate();
901  } else MODebug2->Error( moText("moConsole::LoadIODevices > Couldn't create the device:") + moText("moldeoapioscout"));
902 
903  }
904 
905 }
906 
907 //==========================================================================
908 // CARGAMOS LOS EFFECTS MAESTROS
909 //==========================================================================
910 void
912  moText text, fxname, cfname, lblname, keyname;
913  MOint N,i,mtfx;
914  bool activate = true;
915  moMasterEffect* pmastereffect = NULL;
916 
917  mtfx = m_Config.GetParamIndex("mastereffect");
919  N = m_Config.GetValuesCount(mtfx);
920 
921  if (MODebug2) {
922  MODebug2->Message( moText("moConsole::LoadMasterEffects > Loading MasterEffects configs...") );
923  MODebug2->Message( moText("moConsole::LoadMasterEffects > Master Effects number: ") + IntToStr(N) );
924  }
925 
926  if(N>0) {
928  for( i=0; i<N; i++) {
936 
937  moText completecfname = m_pResourceManager->GetDataMan()->GetDataPath() + moSlash + (moText)cfname+ moText(".cfg");
938  moFile FullCF( completecfname );
939 
940  if ( FullCF.Exists() ) {
941  pmastereffect = (moMasterEffect*)m_EffectManager.NewEffect( fxname, cfname, lblname, keyname, MO_OBJECT_MASTEREFFECT, mtfx, i, activate);
942  if (pmastereffect) {
943  m_MoldeoObjects.Add( (moMoldeoObject*) pmastereffect );
944  pmastereffect->SetResourceManager( m_pResourceManager );
945  pmastereffect->Set( &m_EffectManager, &m_ConsoleState );
946  if( pmastereffect->GetName() == moText("ligia") ) {
947  iligia=i;
948  pmastereffect->Init();
949  pmastereffect->Activate();
950  }
951  } else MODebug2->Error( moText("moConsole::LoadMasterEffects > Couldn't load specific Master-Effect:") + moText(fxname));
952  } else {
953  MODebug2->Error(moText("moConsole::LoadMasterEffects > Error: Config File doesn't exist : ") + (moText)completecfname);
954  }
956  }
957  }
958 
959  if (MODebug2) MODebug2->Message( moText("moConsole::LoadMasterEffects > Master-Effects loaded.") );
960 
961 }
962 
964 
965  while(m_EffectManager.MasterEffects().Count()>0) {
966  if( m_EffectManager.MasterEffects().GetRef(0) != NULL ) {
968  }
969  }
970 
971 }
972 
973 //==========================================================================
974 // CARGAMOS LOS PRE-EFFECTS
975 //==========================================================================
976 void
978 
979  moText text,fxname,cfname,lblname,keyname;
980  MOint prfx,i,N;
981  bool activate = true;
982  moPreEffect* ppreeffect;
983 
984  prfx = m_Config.GetParamIndex("preeffect");
986  N = m_Config.GetValuesCount(prfx);
987 
988  if (MODebug2) {
989  MODebug2->Message( moText("moConsole::LoadPreEffects > Loading PreEffects configs...") );
990  MODebug2->Message( moText("moConsole::LoadPreEffects > Pre-Effects number: ") + IntToStr(N) );
991  }
992 
993  if(N>0) {
995  for( i=0; i<N; i++) {
996 
997  if(iborrado!=-1) Draw();
998 
999  //creando nuevo efecto
1006  activate = (m_Config.GetParam().GetValue().GetSubValue(MO_CFG_EFFECT_ON).Int()>0);
1007 
1008  moText completecfname = m_pResourceManager->GetDataMan()->GetDataPath() + moSlash + (moText)cfname + moText(".cfg");
1009  moFile FullCF( completecfname );
1010 
1011  if ( FullCF.Exists() ) {
1012 
1013  ppreeffect = (moPreEffect*)m_EffectManager.NewEffect( fxname, cfname, lblname, keyname, MO_OBJECT_PREEFFECT, prfx, i, activate);
1014 
1015  if (ppreeffect) {
1016  m_MoldeoObjects.Add( (moMoldeoObject*) ppreeffect );
1017  //ppreeffect->SetResourceManager( m_pResourceManager );
1018  if ( ppreeffect->GetName() == moText("erase") ) {
1019  iborrado = i;
1020  if (ppreeffect->Init()) {
1021 
1022  MODebug2->Message("moConsole::LoadPreEffects > Erase initialized");
1023 
1024  MOint pre,on;
1025  MOint paramindex, valueindex;
1026 
1027  paramindex = ppreeffect->GetMobDefinition().GetMobIndex().GetParamIndex();
1028  valueindex = ppreeffect->GetMobDefinition().GetMobIndex().GetValueIndex();
1029 
1030  pre = m_Config.GetParam(paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_PRE).Int();
1031  on = m_Config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_ON).Int();
1032  if (pre>=0) ppreeffect->GetConfig()->SetCurrentPreConf(pre);
1033  if (on>0) ppreeffect->Activate();
1034 
1035  //MODebug2->Message("moConsole::LoadPreEffects > Init passed for object: " + ppreeffect->GetName() + " config: " + ppreeffect->GetConfigName() + " label: " + ppreeffect->GetLabelName() );
1036 
1037  }
1038  }
1039  } else MODebug2->Error( moText("moConsole::LoadPreEffects > Couldn't load specific Pre-Effect:") + moText(fxname));
1040  m_Config.NextValue();
1041  } else {
1042  MODebug2->Error(moText("moConsole::LoadPreEffects > Error: Config File doesn't exist : ") + (moText)completecfname);
1043  }
1044  }
1045  }
1046 
1047  if (MODebug2) MODebug2->Message(moText("moConsole::LoadPreEffects > Pre-Effects loaded !"));
1048 }
1049 
1051 
1052  while(m_EffectManager.PreEffects().Count()>0) {
1053  if( m_EffectManager.PreEffects().GetRef(0) != NULL ) {
1055  }
1056  }
1057 }
1058 
1059 //==========================================================================
1060 // CARGAMOS LOS EFFECTS
1061 //==========================================================================
1062 void
1064 
1065  moText text,fxname,cfname,lblname,keyname;
1066  MOint efx,i,N;
1067  bool activate = true;
1068  moEffect* peffect = NULL;
1069 
1070  efx = m_Config.GetParamIndex("effect");
1072  N = m_Config.GetValuesCount(efx);
1073 
1074  if (MODebug2) {
1075  MODebug2->Message( moText("moConsole::LoadEffects > Loading Effects configs...") );
1076  MODebug2->Message( moText("moConsole::LoadEffects > Effects number: ") + IntToStr(N) );
1077  }
1078 
1079  if(N>0) {
1080  m_Config.FirstValue();
1081  for( i=0; i < N; i++) {
1082  Draw();
1089  activate = (m_Config.GetParam().GetValue().GetSubValue(MO_CFG_EFFECT_ON).Int()>0);
1090 
1091  moText completecfname = m_pResourceManager->GetDataMan()->GetDataPath() + moSlash + (moText)cfname+ moText(".cfg");
1092  moFile FullCF( completecfname );
1093 
1094  if ( FullCF.Exists() ) {
1095  if ((moText)fxname!=moText("nil")) {
1096 
1097  peffect = (moEffect*)m_EffectManager.NewEffect( fxname, cfname, lblname, keyname, MO_OBJECT_EFFECT, efx, i, activate );
1098 
1099  if (peffect) {
1100  m_MoldeoObjects.Add( (moMoldeoObject*) peffect );
1101  }
1102 
1103  if (MODebug2) {
1104  MODebug2->Message( moText("moConsole::LoadingEffect > ") + completecfname );
1105  }
1106 
1107 
1108  } else {
1110  peffect = NULL;
1111  m_EffectManager.Effects().Add(peffect);
1112  m_EffectManager.AllEffects().Add(peffect);
1113  m_MoldeoObjects.Add( (moMoldeoObject*) peffect );
1114  }
1115  } else {
1116  MODebug2->Error(moText("moConsole::LoadEffects > Error: Config File doesn't exist : ") + (moText)completecfname);
1117  }
1118  m_Config.NextValue();
1119  }
1120  }
1121 
1122  if (MODebug2) MODebug2->Message(moText("moConsole::LoadEffects > Effects loaded !"));
1123 }
1124 
1126 
1127  while(m_EffectManager.Effects().Count()>0) {
1128  if( m_EffectManager.Effects().GetRef(0) != NULL ) {
1130  }
1131  }
1132 
1133 }
1134 
1135 //==========================================================================
1136 // CARGAMOS LOS POST-EFFECTS
1137 //==========================================================================
1138 
1139 void
1141 
1142  moText text, fxname, cfname, lblname, keyname;
1143  MOint ptfx,i,N;
1144  bool activate = true;
1145  moPostEffect* posteffect = NULL;
1146 
1147  ptfx = m_Config.GetParamIndex("posteffect");
1149  N = m_Config.GetValuesCount(ptfx);
1150 
1151  if (MODebug2) {
1152  MODebug2->Message( moText("moConsole::LoadPostEffects > Loading PostEffects configs...") );
1153  MODebug2->Message( moText("moConsole::LoadPostEffects > Post Effects number: ") + IntToStr(N) );
1154  }
1155 
1156  if(N>0) {
1157  m_Config.FirstValue();
1158  for( i=0; i<N; i++) {
1159  if(idebug!=-1) { Draw(); }
1166  activate = (m_Config.GetParam().GetValue().GetSubValue(MO_CFG_EFFECT_ON).Int()>0);
1167 
1168  moText completecfname = m_pResourceManager->GetDataMan()->GetDataPath() + moSlash + (moText)cfname+ moText(".cfg");
1169  moFile FullCF( completecfname );
1170 
1171  if ( FullCF.Exists() ) {
1172 
1173  posteffect = (moPostEffect*)m_EffectManager.NewEffect( fxname, cfname, lblname, keyname, MO_OBJECT_POSTEFFECT, ptfx , i, activate );
1174  if (posteffect) {
1175  m_MoldeoObjects.Add( (moMoldeoObject*) posteffect );
1176  //posteffect->SetResourceManager( m_pResourceManager );
1177  if(posteffect->GetName() == moText("debug")) {
1178  idebug = i;
1179  posteffect->Init();
1180  posteffect->Activate();
1181  }
1182  } else MODebug2->Error( moText("moConsole::LoadPostEffects > Couldn't load specific Post Effect:") + moText(fxname));
1183  } else {
1184  MODebug2->Error(moText("moConsole::LoadPostEffects > Error: Config File doesn't exist : ") + (moText)completecfname);
1185  }
1186  m_Config.NextValue();
1187  }
1188  }
1189  if (MODebug2) MODebug2->Message(moText("moConsole::LoadPostEffects > Post Effects loaded !"));
1190 }
1191 
1193 
1194  while(m_EffectManager.PostEffects().Count()>0) {
1195  if( m_EffectManager.PostEffects().GetRef(0) != NULL ) {
1197  }
1198  }
1199 }
1200 
1201 //==========================================================================
1202 // CARGAMOS LOS RECURSOS
1203 //==========================================================================
1204 
1205 
1206 
1207 //LOAD RESOURCE PLUGINS
1208 void
1210 
1211  moText resname, cfname, lblname, keyname;
1212  bool activate = true;
1213 
1214  int paramindex = m_Config.GetParamIndex(moText("resources"));
1216  int resource_valueindex = -1;
1217 
1218  moParam& presources(m_Config.GetParam(moText("resources")));
1219  presources.FirstValue();
1220  for(MOuint r=0; r<presources.GetValuesCount(); r++) {
1221  moResource* presource = NULL;
1222 
1223  resname = presources[MO_SELECTED][MO_CFG_RESOURCE].Text();
1224  cfname = presources[MO_SELECTED][MO_CFG_RESOURCE_CONFIG].Text();
1225  lblname = presources[MO_SELECTED][MO_CFG_RESOURCE_LABEL].Text();
1226  if (presources[MO_SELECTED].GetSubValueCount()>=4)
1227  activate = (presources[MO_SELECTED].GetSubValue(MO_CFG_EFFECT_ON).Int()>0);
1228  if (presources[MO_SELECTED].GetSubValueCount()>=6)
1229  keyname = presources[MO_SELECTED].GetSubValue(MO_CFG_EFFECT_KEY).Text();
1230 
1231  MOint rid = m_pResourceManager->GetResourceIndex( lblname );
1232 
1233  if(rid>-1) presource = m_pResourceManager->GetResource(rid);
1234 
1235  if (presource) {
1236  MODebug2->Message( moText("moConsole::LoadResources > Already loaded plugin resource: ") + (moText)resname );
1237  } else {
1238  //maybe a plugin
1239  resource_valueindex = r;
1240  presource = m_pResourceManager->NewResource(resname, cfname, lblname, keyname, paramindex, resource_valueindex, activate);
1241  if (presource) {
1242  presource->SetConfigName(cfname);
1243  presource->SetLabelName(lblname);
1244  presource->SetResourceManager( m_pResourceManager );
1245  if (presource->Init()) {
1246  if (activate) presource->Activate();
1247  else presource->Deactivate();
1248  MODebug2->Message( moText("moConsole::LoadResources > Loaded plugin resource: ") + (moText)resname );
1249  } else MODebug2->Error( moText("moConsole::LoadResources > Error: Loading plugin resource: ") + (moText)resname );
1250  }
1251  }
1252  presources.NextValue();
1253  }
1254 
1255  //Agrega los Resources a MoldeoObjects
1256  if(m_pResourceManager!=NULL) {
1257 
1258  for(MOuint i = 0; i<m_pResourceManager->Resources().Count(); i++) {
1260  if (mobject) {
1261  m_MoldeoObjects.Add( mobject );
1262  }
1263  }
1264 
1265  }
1266 
1267  if (MODebug2) MODebug2->Message(moText("moConsole::LoadResources > Resources Plugin loaded !"));
1268 
1269 }
1270 
1272  if (m_pResourceManager)
1273  for(int i=m_pResourceManager->Resources().Count()-1; i>=0; i--) {
1274  if (m_pResourceManager->Resources().GetRef(i)!=NULL) {
1276  }
1277  }
1278 }
1279 
1280 //==========================================================================
1281 //INICIALIZACION DE CADA EFFECT Y ASIGNACION DE CODIGOS DE DISPOSITIVO(cargados del config de cada efecto)
1282 //==========================================================================
1283 
1284 void
1286 
1287  int dg;
1288  moEffect* p_effect = NULL;
1289 
1290  dg = m_Config.GetParamIndex("fulldebug");
1291 
1292 
1293  for(MOuint i=0; i<m_EffectManager.AllEffects().Count(); i++ ) {
1294  p_effect = m_EffectManager.AllEffects().GetRef(i);
1295  if( p_effect !=NULL) {
1296 
1297  moMobDefinition MD = p_effect->GetMobDefinition();
1298 
1299  Draw();
1300 
1301  MOint pre,on;
1302  MOint paramindex = MD.GetMobIndex().GetParamIndex();
1303  MOint valueindex = MD.GetMobIndex().GetValueIndex();
1304  moEffectState fxstate = p_effect->GetEffectState();
1305 
1306  if(m_Config.GetParam(dg).GetValue().GetSubValue(0).Text()==moText("yes")) {
1307  fxstate.fulldebug = MO_ACTIVATED;
1308  } else {
1309  fxstate.fulldebug = MO_DEACTIVATED;
1310  }
1311 
1312  if( p_effect->GetName()!=moText("debug") && p_effect->GetName()!=moText("erase")
1313  && p_effect->GetName()!=moText("ligia")) {
1314 
1315  bool res = p_effect->Init();
1316 
1317 
1318  if (res) {
1319 
1320  pre = m_Config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_PRE).Int();
1321  on = m_Config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_ON).Int();
1322 
1323  if (pre>=0) p_effect->GetConfig()->SetCurrentPreConf(pre);
1324  if (on>0) p_effect->Activate();
1325  else p_effect->Deactivate();
1326 
1327  // Sucio codigo agregado rapidamente para poder asignar los efectos a teclas arbitrarias de las 4 filas
1328  // del teclado:
1329  /*
1330  MOint idx;
1331  moText key;
1332  key = m_Config.GetParam( pEIx->GetParamIndex() ).GetValue( pEIx->GetValueIndex() ).GetSubValue(MO_CFG_EFFECT_KEY).Text();
1333  idx = ConvertKeyNameToIdx(key);
1334  p_effect->keyidx = idx;
1335  */
1336  } else {
1337  MODebug2->Error("Error Initializing Effect: " + p_effect->GetName() + " Label: " + p_effect->GetLabelName() + " Cfg: " + p_effect->GetConfigName() );
1338  }
1339  } else {
1340 
1341  pre = m_Config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_PRE).Int();
1342  on = m_Config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_ON).Int();
1343 
1344  if (pre>=0) p_effect->GetConfig()->SetCurrentPreConf(pre);
1345  if (on>0) p_effect->Activate();
1346  else p_effect->Deactivate();
1347 
1348  // TODO: para poder asignar los efectos a teclas arbitrarias de las 4 filas
1349  // del teclado:
1350  /*
1351  MOint idx;
1352  moText key;
1353  key = m_Config.GetParam( pEIx->GetParamIndex() ).GetValue( pEIx->GetValueIndex() ).GetSubValue(MO_CFG_EFFECT_KEY).Text();
1354  idx = ConvertKeyNameToIdx(key);
1355  p_effect->keyidx = idx;
1356  */
1357  }
1358  //carga códigos...
1359  p_effect->LoadCodes( m_pIODeviceManager );
1360  }
1361  }
1362 
1363 }
1364 
1366 
1367  moEffect* p_effect = NULL;
1368 
1369  for( MOuint i=0; i< m_EffectManager.AllEffects().Count(); i++ ) {
1370  p_effect = m_EffectManager.AllEffects().GetRef(i);
1371  if( p_effect!=NULL ) {
1372  p_effect->Finish();
1373  }
1374  }
1375 }
1376 
1377 void
1379 
1380  moText text;
1381  moEffect* p_effect = NULL;
1382  MOuint i;
1383 
1384  text = moText("Turning on MasterEffects...");
1385  if (MODebug2) MODebug2->Push(text);
1386 
1387  //==========================================================================
1388  //PRENDEMOS LOS EFFECTS MAESTROS y ...LARGAMOS
1389  //==========================================================================
1390  for( i=0; i<m_EffectManager.MasterEffects().Count(); i++ ) {
1391  p_effect = m_EffectManager.MasterEffects().GetRef(i);
1392  if( p_effect!=NULL ) {
1393  Draw();
1394  p_effect->Activate();
1395  }
1396  }
1397  if( m_EffectManager.MasterEffects().Count()>0 ) {
1398  p_effect = m_EffectManager.MasterEffects().GetRef(0);
1399  if(p_effect!=NULL)
1400  p_effect->Activate();
1401  }
1402  if( m_EffectManager.MasterEffects().Count()>1 ) {
1403  p_effect = m_EffectManager.MasterEffects().GetRef(1);
1404  if(p_effect!=NULL)
1405  p_effect->Activate();
1406  }
1407  if (MODebug2) MODebug2->Push( moText("moConsole::StartMasterEffects > Master effects on.") );
1408 
1409 }
1410 
1412 
1413  moEffect* pEffect = NULL;
1414 
1415  if (MODebug2) MODebug2->Push( moText("moConsole::StartMasterEffects > turning off MasterEffects.") );
1416 
1417  if(m_EffectManager.MasterEffects().Count()>0) {
1418  pEffect = m_EffectManager.MasterEffects().GetRef(0);
1419  if( pEffect!=NULL )
1420  pEffect->Deactivate();
1421  }
1422  if( m_EffectManager.MasterEffects().Count()>1 ) {
1423  pEffect = m_EffectManager.MasterEffects().GetRef(1);
1424  if(pEffect!=NULL)
1425  pEffect->Deactivate();
1426  }
1427  for(MOuint i=0;i<m_EffectManager.MasterEffects().Count();i++) {
1428  pEffect = m_EffectManager.MasterEffects().GetRef(i);
1429  if( pEffect!=NULL ) {
1430  Draw();
1431  pEffect->Deactivate();
1432  }
1433  }
1434 
1435  if (MODebug2) MODebug2->Push( moText("moConsole::StartMasterEffects > MasterEffects turned OFF.") );
1436 
1437 }
1438 
1439 MOulong
1441 
1442  return moGetTicks();
1443 
1444 }
1445 
1446 void
1448 
1449  //SDL_GL_SwapBuffers();
1450 }
1451 
1452 void
1454  //no hace nada
1455  return;
1456 }
1457 
1459  if (moScript::IsInitialized()) {
1460  if (ScriptHasFunction("Draw")) {
1461 
1463 #ifndef OPENGLESV2
1464  glMatrixMode(GL_MODELVIEW);
1465  glLoadIdentity();
1466 #endif
1469 
1470 #ifndef OPENGLESV2
1471  glEnable(GL_BLEND);
1472  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1473 #endif
1474  SelectScriptFunction("Draw");
1477  }
1478  }
1479 }
1480 
1481 void
1483  MOuint i;
1484  moEffect* pEffect = NULL;
1485  moText savename, framesavename;
1486 
1487  if (m_pResourceManager==NULL) return;
1489 
1490  //GUIYield();
1491 
1492  //MODebug2->Message("out 2");
1493  //exit(1);
1494 
1495  if (RenderMan==NULL) return;
1496 
1498 
1499  MOswitch borrar = MO_ACTIVATED;
1500  MOboolean pre_effect_on = false;
1501 
1503 
1504  //m_ConsoleState.tempo.ticks = GetTicks();
1506 /*
1507  MODebug2->Push( "Console: tempo.on: " + IntToStr( (int)m_ConsoleState.tempo.Started() )
1508  + " tempo.pause_on: " + IntToStr( (int)m_ConsoleState.tempo.Paused())
1509  + " tempo.ticks: " + IntToStr( m_ConsoleState.tempo.ticks )
1510  + " tempo.ang: " + FloatToStr( m_ConsoleState.tempo.ang ) );
1511 */
1512  RenderMan = m_pResourceManager->GetRenderMan();
1513  if (RenderMan) RenderMan->BeginDraw();
1514 
1515  //Se dibujan los m_PreEffects
1516  for(i=1; i<m_EffectManager.PreEffects().Count(); i++ ) {
1517  pEffect = m_EffectManager.PreEffects().GetRef(i);
1518  if( pEffect ) {
1519  if( pEffect->Activated() ) {
1520  pre_effect_on = true;
1521  RenderMan->BeginDrawEffect();
1522  pEffect->Draw(&m_ConsoleState.tempo);
1523  RenderMan->EndDrawEffect();
1524  borrar = MO_DEACTIVATED;
1525  }
1526  }
1527  }
1528 
1529  if(borrar==MO_ACTIVATED)
1530  {
1531  if( m_EffectManager.PreEffects().Count()>0 ) {
1532  pEffect = m_EffectManager.PreEffects().GetRef(0);
1533  if( pEffect ) {
1534  if( pEffect->Activated() )
1535  {
1536  if (RenderMan) RenderMan->BeginDrawEffect();
1537  pEffect->Draw(&m_ConsoleState.tempo);
1538  if (RenderMan) RenderMan->EndDrawEffect();
1539  }
1540  else
1541  if (!pre_effect_on && !RenderMan->IsRenderToFBOEnabled() && !RenderMan->RenderResEqualScreenRes())
1542  // All the preeffects are disabled, including erase. And the screen resolution is different from
1543  // the render resolution. So the last screen image has to be redrawn at render resolution.
1545 
1546  }
1547  }
1548  }
1549 
1553 
1555  for( i=0; i<m_EffectManager.Effects().Count(); i++ ) {
1556 
1557  pEffect = m_EffectManager.Effects().GetRef(i);
1558 
1559  if(pEffect) {
1560  moEffectState fxstate = pEffect->GetEffectState();
1561  if (fxstate.stereo==MO_ACTIVATED) {
1562 
1563  fxstate.stereoside = MO_STEREO_LEFT;
1564  pEffect->SetEffectState( fxstate );
1565 
1566  if(pEffect->Activated()) {
1567  RenderMan->BeginDrawEffect();
1568  pEffect->Draw(&m_ConsoleState.tempo);
1569  RenderMan->EndDrawEffect();
1570  }
1571 
1572  }
1573  }
1574  }
1575 
1576  RenderMan->CopyRenderToTexture(MO_LEFT_TEX);
1577 
1579  for( i=0; i<m_EffectManager.Effects().Count(); i++ ) {
1580 
1581  pEffect = m_EffectManager.Effects().GetRef(i);
1582 
1583  if(pEffect) {
1584  moEffectState fxstate = pEffect->GetEffectState();
1585  if (fxstate.stereo==MO_ACTIVATED) {
1586 
1587  fxstate.stereoside = MO_STEREO_RIGHT;
1588  pEffect->SetEffectState( fxstate );
1589 
1590  if(pEffect->Activated()) {
1591  RenderMan->BeginDrawEffect();
1592  pEffect->Draw(&m_ConsoleState.tempo);
1593  RenderMan->EndDrawEffect();
1594  }
1595 
1596  }
1597  }
1598  }
1599 
1600  RenderMan->CopyRenderToTexture(MO_RIGHT_TEX);
1601 
1602  } else {
1604 
1605  //Se dibujan los Effects
1606  for( i=0; i<m_EffectManager.Effects().Count(); i++ ) {
1607 
1608  pEffect = m_EffectManager.Effects().GetRef(i);
1609  if(pEffect) {
1610  if(pEffect->Activated()) {
1611  RenderMan->BeginDrawEffect();
1612  pEffect->Draw(&m_ConsoleState.tempo);
1613  RenderMan->EndDrawEffect();
1614  //RenderMan->CopyRenderToTexture(MO_EFFECTS_TEX);
1615  }
1616  }
1617  }
1618 
1619  RenderMan->CopyRenderToTexture(MO_EFFECTS_TEX);
1620  }
1621 
1622  //sedibujan los post Effects
1623  for(i=0;i<m_EffectManager.PostEffects().Count();i++) {
1624 
1625  pEffect = m_EffectManager.PostEffects().GetRef(i);
1626 
1627  if(pEffect) {
1628  if(pEffect->Activated()) {
1629  RenderMan->BeginDrawEffect();
1630  pEffect->Draw(&m_ConsoleState.tempo);
1631  RenderMan->EndDrawEffect();
1632  }
1633  }
1634  }
1635 
1636 
1637  if (RenderMan) RenderMan->CopyRenderToTexture(MO_FINAL_TEX);
1638 
1639 //se dibujan los Effects masters (en funcion del modo...) si tiene una sola pantalla... o dos pantallas...
1640 // 1 sola pantalla:
1641 // si esta extendida puede usar un canvas que cubra todo, y solo dibuja la interface en la primera y el resultado en la segunda...
1642 // aqui ganamos velocidad!!!! que perdemos
1643  if (1==1) {
1644  DrawMasterEffects( RenderMan->RenderWidth(), RenderMan->RenderHeight() );
1645  }
1646 
1648 
1649 
1650  //aca controlamos los fps
1653  while(( m_ConsoleState.fps1 - m_ConsoleState.fps0 ) <(1000 / m_ConsoleState.fps) ) {
1655  }
1656  }
1657 
1658 
1659  if (RenderMan) RenderMan->EndDraw();
1660 
1661  if (RenderMan && ( RenderMan->IsRenderToFBOEnabled() || !RenderMan->RenderResEqualScreenRes()) )
1663 
1664  this->GLSwapBuffers();
1665 
1666  RenderMan->PreviewShot(false);
1667  }
1668 
1670 }
1671 
1672 
1673 void
1674 moConsole::DrawMasterEffects(int interface_width, int interface_height) {
1675 
1676  MOuint i;
1677  moEffect* pEffect = NULL;
1678  moText savename, framesavename;
1680 
1681  GUIYield();
1682 
1683 
1684  if (RenderMan==NULL) return;
1685 
1686  if (interface_width!=0 && interface_height!=0) RenderMan->SetInterfaceView( interface_width, interface_height);
1687 
1688  for(i=0;i<m_EffectManager.MasterEffects().Count();i++) {
1689 
1690  pEffect = m_EffectManager.MasterEffects().GetRef(i);
1691  if(pEffect) {
1692  if(pEffect->Activated()) {
1693  RenderMan->BeginDrawEffect();
1694  pEffect->Draw( &m_ConsoleState.tempo );
1695  RenderMan->EndDrawEffect();
1696  }
1697  }
1698  }
1699 
1700 }
1701 
1702 
1703 MOboolean
1705 
1706  m_MoldeoObjects.Finish();
1707 
1709 
1711 
1712  UnloadResources();
1713  UnloadIODevices();
1714  UnloadEffects();
1715  UnloadPreEffects();
1718 
1720 
1721  if (m_pResourceManager) {
1723  if (!m_bExternalResources) {
1724  delete m_pResourceManager;
1725  m_pResourceManager = NULL;
1726  }
1727  m_pResourceManager = NULL;
1728  }
1729 
1731  if (m_pIODeviceManager) {
1733  delete m_pIODeviceManager;
1734  m_pIODeviceManager = NULL;
1735  }
1736  }
1737 
1738  //FINALIZAMOS LOS RECURSOS (liberando memoria)
1740  m_Config.DeleteConfig();//finally we unload the console configuration
1741 
1742  m_bInitialized = false;
1743  m_bConnectorsLoaded = false;
1744 
1745  return true;
1746 }
1747 
1748 
1749 int
1751 
1752  MOuint i;
1753  moEffect* pEffect = NULL;
1754  moEffect* pPanel = NULL;
1755  moEffect* pChannel = NULL;
1756  if (!m_pResourceManager) return -1;
1758 
1759  if (!RenderMan) {
1760  cout << "no renderman!" << endl;
1761  return -1;
1762  }
1763 /*
1764  timecodeticks = moGetTicks();
1765  minutes = timecodeticks / (1000*60);
1766  seconds = (timecodeticks - minutes*1000*60) / 1000;
1767  frames = (timecodeticks - minutes*1000*60 - seconds*1000 ) * 25 / 1000;
1768 
1769  Texto+= moText(" ticks: ") + (moText)IntToStr(timecodeticks,10) +
1770  moText(" ang: ") + (moText)FloatToStr((float)tempogral->ang) +
1771  moText(" timecode: ") + (moText)IntToStr(minutes, 2) + moText(":") + (moText)IntToStr(seconds,2) + moText(":") + (moText)IntToStr(frames,2);
1772 */
1773 
1774 
1775  ticksprevious = ticks;
1778 
1779  fps_current = 1000.0 / tickselapsed;
1780  fps_mean += fps_current;
1781 
1782  fps_count++;
1783  if (fps_count % 10 == 0)
1784  {
1785  fps_mean /= 10;
1786  fps_text = moText("FPS = ") + (moText)FloatToStr(fps_mean);
1787  fps_mean = 0;
1788  fps_count = 0;
1789  }
1790 
1791 
1792  //_IODEVICE ACTUALIZA
1793  RenderMan->BeginUpdate();
1794  if(m_pIODeviceManager!=NULL) {
1795  RenderMan->BeginUpdateDevice();
1796 
1799 
1800  while(event!=NULL) {
1801  //MODebug2->Message("moConsole::Interaction > event present.");
1802  if ( event->deviceid == MO_IODEVICE_KEYBOARD ) {
1803  //MODebug2->Message("moConsole::Interaction > KEYBOARD activity (devicecode:" + IntToStr(event->devicecode) + " SDL_KEYDOWN:" + IntToStr(SDL_KEYDOWN));
1804  if (event->devicecode == SDL_KEYDOWN || event->devicecode == SDL_KEYDOWN_SDL2 ) {
1805  MODebug2->Message("moConsole::Interaction > KEY DOWN (SDL_KEYDOWN)");
1806  if ( event->reservedvalue0 == SDLK_ESCAPE ) {
1807  MODebug2->Message("moConsole::Interaction > ESCAPE pressed");
1808  //m_ConsoleState.finish = MO_TRUE;
1809  }
1810 
1811  if ( event->reservedvalue0 == SDLK_F12 ) {
1812  //recreate window...
1813  MODebug2->Message("moConsole::Interaction > F12 pressed");
1815  }
1816  }
1817  }
1818  if ( event->deviceid == MO_IODEVICE_MOUSE ) {
1819  //MODebug2->Message("moConsole::Interaction > Mouse device working");
1820  }
1821  event = event->next;
1822  }
1823 
1824 
1825  RenderMan->EndUpdateDevice();
1826  }
1827  RenderMan->EndUpdate();
1828 
1829  //INTERACCION EFFECTS MAESTROS
1830 
1831  for( i=0; i<m_EffectManager.MasterEffects().Count(); i++) {
1832  pEffect = m_EffectManager.MasterEffects().GetRef(i);
1833  moEffectState fxstate = pEffect->GetEffectState();
1834  if(pEffect!=NULL) {
1835  if(pEffect->Activated()) {
1836  pEffect->Interaction( m_pIODeviceManager );
1837  }
1838  }
1839  }
1840 
1841 
1844 
1846  //se pasa el control de events al CanalMaestro array[0], el sabra a quien pasar el control
1847  if ( m_EffectManager.MasterEffects().Count() > 2 ) {
1848 
1849  pChannel = m_EffectManager.MasterEffects().GetRef(0);
1850  //pChannel = m_EffectManager.GetEffectByLabel( "channel0" );
1851  pPanel = m_EffectManager.MasterEffects().GetRef(2);
1852  //pPanel = m_EffectManager.GetEffectByLabel( "panel" );
1853 
1854  if (pPanel && pChannel)
1855  if( !pChannel->Activated() && !pPanel->Activated() ) {
1858  pChannel->Interaction( m_pIODeviceManager );
1859  }
1860  } else {
1862  for( MOuint all=0;all<m_EffectManager.AllEffects().Count(); all++) {
1863  pEffect = m_EffectManager.AllEffects().GetRef(all);
1864  if ( pEffect && pEffect->Activated() ) {
1865  pEffect->Interaction( m_pIODeviceManager );
1866  }
1867  }
1868  }
1869 
1870 
1871  //TAREAS ESPECIALES
1872  //reinicializa
1873  if(m_ConsoleState.reinit) {
1874  Finish();
1875  Init();
1877  }
1878 
1879 
1880  return (m_ConsoleState.finish==MO_FALSE);
1881 }
1882 
1884 
1887  /*
1888  if (ApiMessage) {
1889  ApiMessage->Text();
1890  }
1891  */
1892  //MODebug2->Message( "moConsole::SendMoldeoAPIMessage > " );
1893 
1896  -1, 0, 0, MO_DATAMESSAGE, p_pDataMessage );
1897 
1898 
1899  return 0;
1900 }
1901 
1902 
1903 #include <sstream>
1904 #include <iostream>
1905 
1907 
1908  if (p_pDataMessage==NULL) {
1909  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > DataMessage is NULL");
1910  return 1;
1911  }
1912 
1913  if (p_pDataMessage->Count()==0) {
1914  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > DataMessage is empty");
1915  return 2;
1916  }
1917  moData MoldeoApiCommandData = p_pDataMessage->Get(0);
1918  moText MoldeoAPICommand = p_pDataMessage->Get(0).ToText();
1919  std::string skey = (char*)MoldeoAPICommand;
1920 
1922 
1923 
1924 /*
1925  moText fullMessageText = "";
1926  for( int k=0;k<(int)p_pDataMessage->Count();k++) {
1927  fullMessageText+= " k:" + IntToStr(k);
1928  fullMessageText+="[" + p_pDataMessage->Get(k).ToText()+"]";
1929  }
1930  */
1931 /*
1932  MODebug2->Message( moText("moConsole::ProcessMoldeoAPIMessage > Processing Moldeo API Message: ")
1933  + MoldeoAPICommand
1934  + moText(" count:") + IntToStr(p_pDataMessage->Count())
1935  + moText(" mapped type:") +IntToStr(MappedType)
1936  + moText(" fullmessage:") + fullMessageText );
1937 */
1938 
1939 
1940  moEffect* fxObject;
1941  moMoldeoObject* MObject;
1942  moText arg0;
1943  int arg1Int;
1944  moText arg1Text;
1945  int arg2Int;
1946  moText arg2Text;
1947  moText arg3Text;
1948 
1949  moText argRed,argGreen,argBlue,argAlpha;
1950  unsigned int r,g,b;
1951 
1952  moText EffectStateJSON = "";
1953  moText FullObjectJSON = "";
1954  moText fieldSeparation = ",";
1955 
1956  moMobState MobState;
1957  moEffectState EffectState;
1958  moDataMessage* pMessageToSend;
1959  moData pData("PRESENTATION");
1960  moMessage* newMessage = NULL;
1961 
1962  switch( MappedType ) {
1963 
1964 
1965  // VALUES
1966 
1967  case MO_ACTION_VALUE_ADD:
1969  case MO_ACTION_VALUE_SET:
1971  case MO_ACTION_VALUE_GET:
1972  case MO_ACTION_VALUE_SAVE:
1973 {
1974  //MODebug2->Message("MO_ACTION_VALUE_SET");
1975  arg0 = p_pDataMessage->Get(1).ToText();//MOBLABEL
1976  MODebug2->Message(arg0);
1977  //fxObject = m_EffectManager.GetEffectByLabel( arg0 );
1978  MObject = GetObjectByIdx( GetObjectId( arg0 ) );
1979  moConfig* pConfig = NULL;
1980  if (MObject) {
1981  pConfig = MObject->GetConfig();
1982  //MODebug2->Message("MO_ACTION_VALUE_SET fxObject ok");
1983  arg1Text = p_pDataMessage->Get(2).ToText();//PARAMNAME or ID
1984  }
1985  else {
1986  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > fxObject not found for " + arg0 );
1987  return -1;
1988  }
1989  if (MappedType==MO_ACTION_VALUE_SAVE) {
1990  //guardar ese valor en el config!!!
1991  // guardamos el config completo mejor...
1992  MObject->GetConfig()->SaveConfig();
1993  return -1;
1994  }
1995 
1996  if (MappedType==MO_ACTION_VALUE_SET
1997  ||
1998  MappedType==MO_ACTION_VALUE_ADD
1999  ||
2000  MappedType==MO_ACTION_VALUE_DELETE
2001  ||
2002  MappedType==MO_ACTION_VALUE_REFRESH
2003  )
2004  arg2Text = p_pDataMessage->Get(3).ToText();//PARAMVALUEINDEX ///si es 0:1 > indice 0, subindice 1...
2005 
2006  int subvalue = -1;
2007  bool issubvalue = false;
2008  if (arg1Text=="color_0") { arg1Text = "color"; subvalue=0;issubvalue=true; }
2009  if (arg1Text=="color_1") { arg1Text = "color"; subvalue=1;issubvalue=true; }
2010  if (arg1Text=="color_2") { arg1Text = "color"; subvalue=2;issubvalue=true; }
2011  if (arg1Text=="color_3") { arg1Text = "color"; subvalue=3;issubvalue=true; }
2012  if (arg1Text=="particlecolor_0") { arg1Text = "particlecolor"; subvalue=0;issubvalue=true; }
2013  if (arg1Text=="particlecolor_1") { arg1Text = "particlecolor"; subvalue=1;issubvalue=true; }
2014  if (arg1Text=="particlecolor_2") { arg1Text = "particlecolor"; subvalue=2;issubvalue=true; }
2015  if (arg1Text=="particlecolor_3") { arg1Text = "particlecolor"; subvalue=3;issubvalue=true; }
2016 
2017 
2018  moParam& rParam( pConfig->GetParam(arg1Text));
2019 
2020  arg2Int = atoi( arg2Text );
2021 
2023  if ( MappedType==MO_ACTION_VALUE_ADD && (int)rParam.GetValuesCount()<=arg2Int && pConfig ) {
2024 
2025  MODebug2->Message("moConsole::ProcessMoldeoAPIMessage Adding > value for "+MObject->GetLabelName()+" preconfig: "+arg2Text);
2026  moText pName = rParam.GetParamDefinition().GetName();
2027  moParamDefinition pParamDef = pConfig->GetConfigDefinition()->GetParamDefinition( pName );
2028  //moValue newValue = pParamDef.GetDefaultValue();
2029  moValue newValue = rParam.GetValue( rParam.GetValuesCount()-1 );
2030 
2036  int valcount = arg2Int - rParam.GetValuesCount() + 1;
2037  for( int sum=0; sum < valcount ; sum++ ) {
2038  MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > Adding Value at index:" + IntToStr( rParam.GetValuesCount() )
2039  + " newvalue: " + newValue.ToJSON() );
2040  rParam.AddValue( newValue );
2041  SetValue( MObject->GetId(), rParam.GetParamDefinition().GetIndex(), rParam.GetValuesCount()-1, newValue );
2042  }
2043  arg3Text = newValue.GetSubValue(0).ToText();
2044 
2062  if (pConfig==NULL) return -1;
2063  moPreConfig preCfg;
2064  bool param_exist = false;
2065  int ip=0;
2066 
2067 
2069  if ( arg2Int < pConfig->GetPreConfCount() ) {
2071 
2072  for(int k=0; k < pConfig->GetPreConfCount(); k++ ) {
2073  preCfg = pConfig->GetPreconfig( k );
2074 
2077  for( int pi=0; pi < pConfig->GetParamsCount(); pi++) {
2078  moParam& rParamx( pConfig->GetParam(pi) );
2079 
2080  if ( rParamx.GetValuesCount()>1 ) {
2081  moPreconfigParamIndex preIndexA;
2082  for( ip=0, param_exist = false; ip< (int)preCfg.m_PreconfIndexes.Count(); ip++ ) {
2083  preIndexA = preCfg.m_PreconfIndexes.Get(ip);
2084  if (preIndexA.m_ParamName == rParamx.GetParamDefinition().GetName() ) {
2085  param_exist = true;
2086  break;
2087  }
2088  }
2089 
2091  if (param_exist) {
2093  preIndexA.m_ValueIndex = k;
2094  preCfg.m_PreconfIndexes.Set( ip, preIndexA );
2095  } else {
2096  preIndexA.m_ParamName = rParamx.GetParamDefinition().GetName();
2097  preIndexA.m_ParamIndex = rParamx.GetParamDefinition().GetIndex();
2098  preIndexA.m_ValueIndex = momin( rParamx.GetValuesCount()-1, k );
2099  preCfg.m_PreconfIndexes.Add( preIndexA );
2100  }
2101 
2102  }
2103  }
2104 
2105  pConfig->SetPreconfig( k, preCfg.m_PreconfIndexes );
2106 
2107  }
2108 
2109  } else {
2110 
2112 
2114  MODebug2->Message("moConsole::ProcessMoldeoAPIMessage > Adding Value > a new value");
2115 
2116  pConfig->AddPreconfig( arg2Int );
2117 
2118  }
2123  MappedType = MO_ACTION_VALUE_SET;
2125 
2126  }
2127 
2128  moValue& rValue( rParam.GetValue(arg2Int) );
2129 
2130  if (MappedType==MO_ACTION_VALUE_DELETE) {
2131  rParam.DeleteValue( arg2Int );
2132  return 0;
2133  }
2134  if (subvalue==-1) subvalue = 0;
2135  moValueBase& VB( rValue.GetSubValue(subvalue) );
2136 
2137  if (MappedType==MO_ACTION_VALUE_SET && p_pDataMessage->Count()>=5) {
2138  arg3Text = p_pDataMessage->Get(4).ToText();//VALUE
2139  } else {
2140  arg3Text = VB.ToText();
2141  }
2142 
2143  MODebug2->Message("MO_ACTION_VALUE_SET settings: arg1Text (param):" + arg1Text
2144  + " arg2Text (preconf): ["+arg2Text+"] arg2Int: "+ IntToStr(arg2Int)
2145  + " arg3Text (val): " + arg3Text
2146  + " VB( subvalue: "+IntToStr(subvalue)+" ): " + VB.TypeToText() + ")"
2147  );
2148 
2149  if (rParam.GetParamDefinition().GetType()==MO_PARAM_COLOR && issubvalue==false ) {
2150 
2151  argRed = arg3Text;
2152  argGreen = arg3Text;
2153  argBlue = arg3Text;
2154  MODebug2->Message("color");
2155 
2156  if (arg3Text.Left(0)=="#") {
2157  argRed.Mid(1,2);
2158  argGreen.Mid(3,2);
2159  argBlue.Mid(5,2);
2160 
2161  r = HexToInt( argRed );
2162  g = HexToInt( argGreen );
2163  b = HexToInt( argBlue );
2164  //MODebug2->Message("color: red: " + argRed + " green:" + argGreen + " blue:" + argBlue);
2165  rValue.GetSubValue(0).SetFun( FloatToStr((float)r*1.0/255.0) );
2166  rValue.GetSubValue(1).SetFun( FloatToStr((float)g*1.0/255.0) );
2167  rValue.GetSubValue(2).SetFun( FloatToStr((float)b*1.0/255.0) );
2168  //MODebug2->Message("color: red: " + IntToStr(r) + " green:" + IntToStr(g) + " blue:" + IntToStr(b));
2169  }
2170  }
2171  else { switch(VB.Type()) {
2172  case MO_DATA_FUNCTION:
2173  VB.SetFun( arg3Text );
2174  break;
2175  case MO_DATA_TEXT:
2176  case MO_DATA_SOUNDSAMPLE:
2177  case MO_DATA_IMAGESAMPLE:
2180 
2181  switch(rParam.GetParamDefinition().GetType()) {
2182  case MO_PARAM_TEXT:
2183  case MO_PARAM_SCRIPT:
2184  case MO_PARAM_FILE:
2186  VB.SetText(arg3Text);
2187  break;
2188  case MO_PARAM_TEXTURE:
2189  if (m_pResourceManager->GetDataMan()->InData(arg3Text)) {
2190  //make relative to datapath
2191  moText relpath = m_pResourceManager->GetDataMan()->MakeRelativeToData(arg3Text);
2192  if (relpath!="") {
2193  arg3Text = relpath;
2194  }
2195  } else {
2196  //try to import file
2197  moFile importFile( arg3Text );
2199  arg3Text = importFile.GetFullName();
2200  }
2201  VB.SetText(arg3Text);
2202  break;
2203  case MO_PARAM_SOUND:
2204  {
2205  if (m_pResourceManager->GetDataMan()->InData(arg3Text)) {
2206  //make relative to datapath
2207  arg3Text = m_pResourceManager->GetDataMan()->MakeRelativeToData(arg3Text);
2208  } else {
2209  //try to import file
2210  moFile importFile( arg3Text );
2212  arg3Text = importFile.GetFullName();
2213  }
2214  VB.SetText(arg3Text);
2215  }
2216  break;
2217  default:
2218  MODebug2->Warning("no param type implemented:"+rParam.GetParamDefinition().GetTypeStr() );
2219  break;
2220  }
2221  break;
2222  case MO_DATA_NUMBER:
2223  VB.SetInt( (int)atoi(arg3Text) );
2224  break;
2225  case MO_DATA_NUMBER_INT:
2226  VB.SetInt( (int)atoi(arg3Text) );
2227  break;
2228  case MO_DATA_NUMBER_FLOAT:
2229  VB.SetFloat( (float)atof(arg3Text) );
2230  break;
2231  case MO_DATA_NUMBER_DOUBLE:
2232  VB.SetDouble( (double)atof(arg3Text) );
2233  break;
2234  case MO_DATA_NUMBER_CHAR:
2235  VB.SetInt( (char)atoi(arg3Text) );
2236  break;
2237  case MO_DATA_NUMBER_LONG:
2238  VB.SetLong( (long)atoi(arg3Text) );
2239  break;
2240  default:
2241  break;
2242  }
2243  }
2244 
2245  moValue fullValueToCopy = rValue;
2246 
2247  if (MappedType==MO_ACTION_VALUE_REFRESH) {
2248  RefreshValue( MObject->GetId(), rParam.GetParamDefinition().GetIndex(), arg2Int, true );
2249  MappedType = MO_ACTION_VALUE_GET;
2250  } else {
2251  SetValue( MObject->GetId(), rParam.GetParamDefinition().GetIndex(), arg2Int, fullValueToCopy );
2252  }
2253 
2254  MappedType = MO_ACTION_VALUE_GET;
2255 
2256  if (MappedType==MO_ACTION_VALUE_GET) {
2257 
2258  moText fullValueJSON = rValue.ToJSON();
2259  MODebug2->Message("valueget " + fullValueJSON );
2260  pMessageToSend = new moDataMessage();
2261  if (pMessageToSend) {
2262  pMessageToSend->Add( moData("valueget") );
2263  pMessageToSend->Add( moData( arg0 ) );//mob
2264  pMessageToSend->Add( moData( arg1Text ) );//param
2265  pMessageToSend->Add( moData( arg2Text ) );//preconf
2266  pMessageToSend->Add( moData( fullValueJSON ) );
2267  SendMoldeoAPIMessage( pMessageToSend );
2268  }
2269 
2270  }
2271 
2272  return 0;
2273 }
2274  break;
2275 
2276  // OBJECTS
2277 
2279  {
2280  arg0 = p_pDataMessage->Get(1).ToText();
2281 
2282  //buscar este efecto y prenderlo...
2283  MObject = GetObjectByIdx(GetObjectId( arg0 ));
2284  if (MObject) {
2285  ObjectEnable( MObject->GetId() );
2286 
2288  MoldeoApiCommandData.SetText( "objectgetstate" );
2289  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2290  p_pDataMessage->Set( 2, moData("") );
2291  ProcessMoldeoAPIMessage( p_pDataMessage );
2292  return 0;
2293  }
2294  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_ENABLE > [" + arg0+"] not found!" );
2295  }
2296  break;
2297 
2299  {
2300  arg0 = p_pDataMessage->Get(1).ToText();
2301 
2302  //buscar este efecto y prenderlo...
2303  MObject = GetObjectByIdx(GetObjectId( arg0 ));
2304  if (MObject) {
2305  ObjectDisable( MObject->GetId() );
2306 
2308  MoldeoApiCommandData.SetText( "objectgetstate" );
2309  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2310  p_pDataMessage->Set( 2, moData("") );
2311  ProcessMoldeoAPIMessage( p_pDataMessage );
2312  return 0;
2313  }
2314  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_ENABLE > [" + arg0+"] not found!" );
2315  }
2316  break;
2317 
2319  {
2320  arg0 = p_pDataMessage->Get(1).ToText();
2321  MObject = GetObjectByIdx( GetObjectId( arg0 ) );
2322  if (MObject) {
2323  moMobState ObjectState = MObject->GetState();
2324  moText ObjectStateJSON = ObjectState.ToJSON();
2325 
2326  pMessageToSend = new moDataMessage();
2327  if (pMessageToSend) {
2328  pMessageToSend->Add( moData("objectgetstate") );
2329  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2330  pMessageToSend->Add( moData( arg0 ) );
2331  pMessageToSend->Add( moData( ObjectStateJSON ) );
2332  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + ObjectStateJSON );
2334  SendMoldeoAPIMessage( pMessageToSend );
2335  }
2336 
2337  return 0;
2338  }
2339  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_GETSTATE > [" + arg0+"] not found!" );
2340  }
2341  break;
2342 
2343  // EFFECTS
2344 
2346  {
2347  arg0 = p_pDataMessage->Get(1).ToText();
2348 
2349  //buscar este efecto y prenderlo...
2350  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2351  if (fxObject) {
2352  ObjectEnable( fxObject->GetId() );
2353 
2355  MoldeoApiCommandData.SetText( "effectgetstate" );
2356  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2357  p_pDataMessage->Set( 2, moData("") );
2358  ProcessMoldeoAPIMessage( p_pDataMessage );
2359  return 0;
2360  }
2361  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_ENABLE > [" + arg0+"] not found!" );
2362  }
2363  break;
2364 
2366  {
2367  arg0 = p_pDataMessage->Get(1).ToText();
2368 
2369  //buscar este efecto y prenderlo...
2370  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2371  if (fxObject) {
2372  ObjectDisable( fxObject->GetId() );
2373 
2375  MoldeoApiCommandData.SetText( "effectgetstate" );
2376  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2377  p_pDataMessage->Set( 2, moData("") );
2378  ProcessMoldeoAPIMessage( p_pDataMessage );
2379  return 0;
2380  }
2381  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_DISABLE > [" + arg0+"] not found!" );
2382  }
2383  break;
2384 
2386  {
2387  arg0 = p_pDataMessage->Get(1).ToText();
2388  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2389  if (fxObject) {
2390  EffectState = fxObject->GetEffectState();
2391  EffectStateJSON = EffectState.ToJSON();
2392 
2393  pMessageToSend = new moDataMessage();
2394  if (pMessageToSend) {
2395  pMessageToSend->Add( moData("effectgetstate") );
2396  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2397  pMessageToSend->Add( moData( arg0 ) );
2398  pMessageToSend->Add( moData( EffectStateJSON ) );
2399  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2401  SendMoldeoAPIMessage( pMessageToSend );
2402  }
2403 
2404  return 0;
2405  }
2406  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_GETSTATE > [" + arg0+"] not found!" );
2407  }
2408  break;
2409 
2411  {
2412  if (p_pDataMessage->Count()<4) {
2413  return -1;
2414  }
2415  arg0 = p_pDataMessage->Get(1).ToText();
2416  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2417  if (fxObject) {
2418  arg1Text = p_pDataMessage->Get(2).ToText();
2419  arg2Text = p_pDataMessage->Get(3).ToText();
2420 
2421  if ( arg1Text == moText("alpha") ) {
2422  if ( arg2Text == moText("increment") ) {
2423 
2424  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > alpha increment" );
2425  fxObject->Alpha( 0.01 );
2426 
2427  } else if ( arg2Text == moText("decrement") ) {
2428 
2429  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > alpha decrement" );
2430  fxObject->Alpha( -0.01 );
2431 
2432  } else if( p_pDataMessage->Get(3).Type() != MO_DATA_TEXT ) {
2433  EffectState = fxObject->GetEffectState();
2434  EffectState.alpha = p_pDataMessage->Get(3).Float();
2435  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > EffectState updating to: " + FloatToStr(EffectState.alpha) );
2436  fxObject->SetEffectState( EffectState );
2437  EffectState = fxObject->GetEffectState();
2438  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > EffectState updated: " + FloatToStr(EffectState.alpha) );
2439  }
2440  }
2441 
2442  if ( arg1Text == moText("tempo") ) {
2443  if ( arg2Text == moText("increment") ) {
2444  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > tempo increment" );
2445  fxObject->TempoDelta( 0.01 );
2446  } else if ( arg2Text == moText("decrement") ) {
2447  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > tempo decrement" );
2448  fxObject->TempoDelta( -0.01 );
2449  } else if ( arg2Text == moText("beatpulse") ) {
2450  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > tempo beatpulse" );
2451  fxObject->BeatPulse();
2452  } else if( p_pDataMessage->Get(3).Type() != MO_DATA_TEXT ) {
2453  fxObject->SetTempoDelta( p_pDataMessage->Get(3).Float() );
2454  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > EffectState updating tempo.delta to: " + FloatToStr(fxObject->GetEffectState().tempo.delta) );
2455  }
2456  }
2457  EffectState = fxObject->GetEffectState();
2458  SetEffectState( fxObject->GetId(), EffectState );
2459 
2461  MoldeoApiCommandData.SetText( "effectgetstate" );
2462  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2463  p_pDataMessage->Set( 2, moData("") );
2464  ProcessMoldeoAPIMessage( p_pDataMessage );
2465  return 0;
2466  }
2467  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_SETSTATE > [" + arg0+"] not found!" );
2468  }
2469  break;
2470 
2471  case MO_ACTION_EFFECT_PLAY:
2472  {
2473  arg0 = p_pDataMessage->Get(1).ToText();
2474  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2475  if (fxObject) {
2476  EffectPlay(fxObject->GetId());
2477  return 0;
2478  }
2479  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_PLAY > [" + arg0+"] not found!" );
2480  }
2481  break;
2482 
2484  {
2485  arg0 = p_pDataMessage->Get(1).ToText();
2486  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2487  if (fxObject) {
2488  EffectPause(fxObject->GetId());
2489  return 0;
2490  }
2491  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_PAUSE > [" + arg0+"] not found!" );
2492  }
2493  break;
2494 
2495  case MO_ACTION_EFFECT_STOP:
2496  {
2497  arg0 = p_pDataMessage->Get(1).ToText();
2498  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2499  if (fxObject) {
2500  EffectStop(fxObject->GetId());
2501  return 0;
2502  }
2503  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_STOP > [" + arg0+"] not found!" );
2504  }
2505  break;
2506 
2513  case MO_ACTION_PARAM_SET:
2514  // code, mob, param, info
2515  {
2516  if (p_pDataMessage->Count()<4) {
2517  return -1;
2518  }
2519  arg0 = p_pDataMessage->Get(1).ToText();
2520  MObject = GetObjectByIdx(GetObjectId(arg0) );
2521  if (MObject) {
2522  arg1Text = p_pDataMessage->Get(2).ToText();//param
2523  arg2Text = p_pDataMessage->Get(3).ToText();//attribute
2524  } else return -1;
2525 
2526  moParam& pparam( MObject->GetConfig()->GetParam( arg1Text ));
2527  if (arg2Text=="property") {
2528  arg3Text = p_pDataMessage->Get(4).ToText();//property value "empty" or "published"
2529  pparam.GetParamDefinition().SetProperty( arg3Text );
2530  } else if(arg2Text=="interpolation") {
2531  moParamInterpolation ParamInter = pparam.GetParamDefinition().GetInterpolation();
2532  arg3Text = p_pDataMessage->Get(4).ToText();//linear|easein|easeinout|easout
2533  pparam.GetParamDefinition().GetInterpolation().SetInterpolationFunction( arg3Text );
2534  } else if(arg2Text=="duration") {
2535  arg3Text = p_pDataMessage->Get(4).ToText();//linear|easein|easeinout|easout
2536  moParamInterpolation ParamInter = pparam.GetParamDefinition().GetInterpolation();
2537  pparam.GetParamDefinition().GetInterpolation().SetDuration( atoi(arg3Text) );
2538  }
2539 
2540  SetParam( MObject->GetId(), pparam.GetParamDefinition().GetIndex(), pparam.GetParamDefinition() );
2541 
2542 
2544  MoldeoApiCommandData.SetText( "paramget" );
2545  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2546  p_pDataMessage->Set( 1, moData(arg0) );
2547  p_pDataMessage->Set( 2, moData(arg1Text) );
2548  p_pDataMessage->Set( 3, moData("") );
2549  p_pDataMessage->Set( 4, moData("") );
2550  ProcessMoldeoAPIMessage( p_pDataMessage );
2551  }
2552  break;
2553 
2554  case MO_ACTION_PARAM_GET:
2555  {
2556  //MODebug2->Message("MO_ACTION_VALUE_SET");
2557  arg0 = p_pDataMessage->Get(1).ToText();//MOBLABEL
2558  MODebug2->Message(arg0);
2559  MObject = GetObjectByIdx(GetObjectId(arg0) );
2560 
2561  if (MObject) {
2562  //MODebug2->Message("MO_ACTION_VALUE_SET fxObject ok");
2563  arg1Text = p_pDataMessage->Get(2).ToText();//PARAMNAME or ID
2564  }
2565  else
2566  return -1;
2567 
2568  moParam mParam = MObject->GetConfig()->GetParam(arg1Text);
2569 
2570  //
2571  moText FullParamJSON = mParam.ToJSON();
2572  MODebug2->Message( FullParamJSON );
2573 
2574  pMessageToSend = new moDataMessage();
2575  if (pMessageToSend) {
2576  pMessageToSend->Add( moData("paramget") );
2577  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2578  pMessageToSend->Add( moData( arg0 ) );
2579  pMessageToSend->Add( moData( FullParamJSON ) );
2580  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2581  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2582  // send it: but we need an id
2583  SendMoldeoAPIMessage( pMessageToSend );
2584  }
2585  }
2586  break;
2587 
2588 
2596  {
2597  arg0 = p_pDataMessage->Get(1).ToText();
2598  arg1Int = p_pDataMessage->Get(2).Int();
2599 
2600  MObject = GetObjectByIdx(GetObjectId(arg0) );
2601  if (MObject) {
2602  //fxObject->GetConfig()->SetCurrentPreConf( arg1Int );
2603  if ( 0 <= arg1Int && arg1Int<MObject->GetConfig()->GetPreConfCount()) {
2604  this->SetPreconf( MObject->GetId(), arg1Int );
2605  } else {
2606  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > MO_ACTION_PRECONFIG_SET > preconfig index [" + IntToStr(arg1Int)+"] not found!" );
2607  }
2608  return 0;
2609  }
2610  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > MO_ACTION_PRECONFIG_SET > Moldeo Object [" + arg0+"] not found!" );
2611  }
2612  break;
2613 
2615  {
2616  arg0 = p_pDataMessage->Get(1).ToText();//label object
2617  arg1Int = p_pDataMessage->Get(2).Int();//preconfig index
2618 
2619  MObject = GetObjectByIdx(GetObjectId(arg0) );
2620  if (MObject) {
2621  //fxObject->GetConfig()->SetCurrentPreConf( arg1Int );
2622  if ( 0 <= arg1Int && arg1Int<MObject->GetConfig()->GetPreConfCount()) {
2623  //this->SetPreconf( fxObject->GetId(), arg1Int );
2624  //do nothing
2625  } else {
2626  MObject->GetConfig()->AddPreconfig( arg1Int );
2627  FullObjectJSON = MObject->ToJSON();
2628  MODebug2->Message(FullObjectJSON);
2629 
2630  pMessageToSend = new moDataMessage();
2631  if (pMessageToSend) {
2632  pMessageToSend->Add( moData("objectget") );
2633  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2634  pMessageToSend->Add( moData( arg0 ) );
2635  pMessageToSend->Add( moData( FullObjectJSON ) );
2636  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2637  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2638  // send it: but we need an id
2639  SendMoldeoAPIMessage( pMessageToSend );
2640  }
2641  }
2642  return 0;
2643  }
2644  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > MO_ACTION_PRECONFIG_SET > Moldeo Object [" + arg0+"] not found!" );
2645  }
2646  break;
2647 
2652  case MO_ACTION_OBJECT_ADD:
2653  {
2655 
2656  }
2657  break;
2658 
2659  case MO_ACTION_OBJECT_MOVE:
2660  {
2662 
2663  }
2664  break;
2665 
2667  {
2669  }
2670  break;
2671 
2673  {
2675  }
2676  break;
2677 
2678 
2679  case MO_ACTION_OBJECT_GET:
2680  {
2681  arg0 = p_pDataMessage->Get(1).ToText();
2682  MObject = NULL;
2683  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2684  if (fxObject) {
2685  FullObjectJSON = fxObject->ToJSON();
2686  MODebug2->Message(FullObjectJSON);
2687  } else {
2688  int idobj = GetObjectId( arg0 );
2689  MObject = GetObjectByIdx( idobj );
2690  if (MObject) {
2691  FullObjectJSON = "{ 'object': " + MObject->ToJSON();
2692  FullObjectJSON+= "}";
2693  MODebug2->Message( FullObjectJSON );
2694  }
2695  }
2696 
2697  if (fxObject || MObject) {
2698  pMessageToSend = new moDataMessage();
2699  if (pMessageToSend) {
2700  pMessageToSend->Add( moData("objectget") );
2701  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2702  pMessageToSend->Add( moData( arg0 ) );
2703  pMessageToSend->Add( moData( FullObjectJSON ) );
2704  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2705  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2706  // send it: but we need an id
2707  SendMoldeoAPIMessage( pMessageToSend );
2708  }
2709 
2710  return 0;
2711  }
2712  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_GET > [" + arg0+"] not found!" );
2713  }
2714  break;
2715 
2717  {
2718  arg0 = p_pDataMessage->Get(1).ToText();
2719  int idobj = GetObjectId( arg0 );
2720  MObject = GetObjectByIdx( idobj );
2721  if (MObject) {
2722  FullObjectJSON = "{ 'objectconfig': " + MObject->GetConfig()->ToJSON();
2723  FullObjectJSON+= "}";
2724  MODebug2->Message( FullObjectJSON );
2725 
2726  pMessageToSend = new moDataMessage();
2727  if (pMessageToSend) {
2728  pMessageToSend->Add( moData("objectgetconfig") );
2729  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2730  pMessageToSend->Add( moData( arg0 ) );
2731  pMessageToSend->Add( moData( FullObjectJSON ) );
2732  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2733  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2734  // send it: but we need an id
2735  SendMoldeoAPIMessage( pMessageToSend );
2736  }
2737 
2738  return 0;
2739  }
2740  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_GETCONFIG > [" + arg0+"] not found!" );
2741  }
2742  break;
2743 
2745  {
2746  arg0 = p_pDataMessage->Get(1).ToText();
2747  arg1Int = p_pDataMessage->Get(2).Int();
2748  int idobj = GetObjectId( arg0 );
2749  MObject = GetObjectByIdx( idobj );
2750  if (MObject) {
2751  moPreConfig pC = MObject->GetConfig()->GetPreconfig(arg1Int);
2752  FullObjectJSON = "{ 'preconfig': " + pC.ToJSON();
2753  FullObjectJSON+= ", 'position': "+IntToStr(arg1Int)+" }";
2754  MODebug2->Message( FullObjectJSON );
2755 
2756  pMessageToSend = new moDataMessage();
2757  if (pMessageToSend) {
2758  pMessageToSend->Add( moData("objectgetpreconfig") );
2759  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2760  pMessageToSend->Add( moData( arg0 ) );
2761  pMessageToSend->Add( moData( FullObjectJSON ) );
2762  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2763  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2764  // send it: but we need an id
2765  SendMoldeoAPIMessage( pMessageToSend );
2766  }
2767 
2768  return 0;
2769  }
2770  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_GETPRECONFIG > [" + arg0+"] not found!" );
2771  }
2772  break;
2773 
2774 
2776  {
2777  arg0 = p_pDataMessage->Get(1).ToText();
2778  arg1Int = p_pDataMessage->Get(2).Int();// [0,2] = 3 preconfigs [0,-1]
2779  arg2Int = p_pDataMessage->Get(3).Int();// -1 > final
2780  MObject = NULL;
2781  moPreConfig pC = fxObject->GetConfig()->GetPreconfig(arg1Int);
2782  if (MObject) {
2783  FullObjectJSON = "{ 'preconfig': " + pC.ToJSON();
2784  FullObjectJSON+= ", 'position': "+IntToStr(arg1Int)+" }";
2785  MODebug2->Message(FullObjectJSON);
2786 
2787  pMessageToSend = new moDataMessage();
2788  if (pMessageToSend) {
2789  pMessageToSend->Add( moData("objectgetpreconfigs") );
2790  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2791  pMessageToSend->Add( moData( arg0 ) );
2792  pMessageToSend->Add( moData( FullObjectJSON ) );
2793  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2794  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2795  // send it: but we need an id
2796  SendMoldeoAPIMessage( pMessageToSend );
2797  }
2798 
2799  return 0;
2800  }
2801  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_GETPRECONFIGS > [" + arg0+"] not found!" );
2802  }
2803  break;
2804 
2810  {
2811  //m_pIODeviceManager->GetEvents()->Add( 7878, SDL_KEYDOWN, SDLK_F12 );
2812 
2813  newMessage = new moMessage( 999 ,
2814  999 ,
2815  -1,
2816  pData );
2817  m_pIODeviceManager->GetEvents()->Add( (moEvent*) newMessage );
2818  MODebug2->Message("MO_ACTION_CONSOLE_PRESENTATION");
2819  return 0;
2820  }
2821  break;
2822 
2824  {
2825  //ScreenShot();
2827  pMessageToSend = new moDataMessage();
2828  if (pMessageToSend) {
2829  pMessageToSend->Add( moData("consolescreenshot") );
2830  pMessageToSend->Add( moData("success") );
2832  pMessageToSend->Add( moData("{\"lastscreenshot\" : \""+m_LastScreenshot + "\"}" ) );
2833  SendMoldeoAPIMessage( pMessageToSend );
2834  }
2835  }
2836  return 0;
2837  }
2838  break;
2839 
2841  {
2842  //ScreenShot();
2843  if (m_pResourceManager->GetRenderMan()->PreviewShot( true ) ) {
2844  pMessageToSend = new moDataMessage();
2845  if (pMessageToSend) {
2846  pMessageToSend->Add( moData("consolepreviewshot") );
2847  pMessageToSend->Add( moData("success") );
2849  //pMessageToSend->Add( moData("{\"lastscreenshot\" : \""+m_LastScreenshot + "\"}" ) );
2850  SendMoldeoAPIMessage( pMessageToSend );
2851  }
2852  }
2853 
2854  return 0;
2855  }
2856  break;
2857 
2859  {
2860  //ScreenShot();
2862  MODebug2->Message("moConsole::Processing > Saving ALL");
2863  //Save("");
2864  for( int fx=0; fx<(int)m_MoldeoObjects.Count(); fx++ ) {
2865  m_MoldeoObjects[fx]->GetConfig()->SaveConfig();
2866  }
2867 
2868  pMessageToSend = new moDataMessage();
2869  if (pMessageToSend) {
2870  pMessageToSend->Add( moData("consolesave") );
2871  pMessageToSend->Add( moData("success") );
2872  SendMoldeoAPIMessage( pMessageToSend );
2873  }
2874  return 0;
2875  }
2876  break;
2877 
2879  {
2880  MODebug2->Message("moConsole::Processing > Save As");
2881  arg0 = p_pDataMessage->Get(1).ToText();//DIRECTORY
2883  MODebug2->Message("moConsole::Processing > Save As: FROM: " + m_pResourceManager->GetDataMan()->GetDataPath()
2884  + " TO: "+ arg0);
2886 
2888 
2889  MODebug2->Message("moConsole::Processing > Save As OK!!!");
2891  arg0,
2892  molFile.GetFullName() );
2893  MODebug2->Message(" changing path: " + m_pResourceManager->GetDataMan()->GetDataPath()
2894  + " mol file:" + molFile.GetFullName() );
2895 
2896  for( int fx=0; fx<(int)m_MoldeoObjects.Count(); fx++ ) {
2897  moFile cfgName( m_MoldeoObjects[fx]->GetConfig()->GetName() );
2898  m_MoldeoObjects[fx]->GetConfig()->SaveConfig( arg0+moSlash+cfgName.GetFullName() );
2899  }
2900  pMessageToSend = new moDataMessage();
2901  if (pMessageToSend) {
2902  pMessageToSend->Add( moData("consolesaveas") );
2903  pMessageToSend->Add( moData("success") );
2905  pMessageToSend->Add( moData("{\"projectfullpath\":\""+arg0 + "\"}" ) );
2906  SendMoldeoAPIMessage( pMessageToSend );
2907  }
2908 
2909  } else {
2910  pMessageToSend = new moDataMessage();
2911  if (pMessageToSend) {
2912  pMessageToSend->Add( moData("consolesaveas") );
2913  pMessageToSend->Add( moData("failed") );
2914  SendMoldeoAPIMessage( pMessageToSend );
2915  }
2916  }
2917  }
2918  break;
2919 
2921  {
2922  ConsolePlay();
2923 
2924  EffectStateJSON = m_ConsoleState.ToJSON();
2925 
2926  pMessageToSend = new moDataMessage();
2927 
2928  if (pMessageToSend) {
2929  pMessageToSend->Add( moData("consolegetstate") );
2930  pMessageToSend->Add( moData("__console__") );
2931  pMessageToSend->Add( moData( EffectStateJSON ) );
2933  SendMoldeoAPIMessage( pMessageToSend );
2934  }
2935 
2936  return 0;
2937  }
2938  break;
2939 
2941  {
2942  ConsoleStop();
2943 
2944  EffectStateJSON = m_ConsoleState.ToJSON();
2945 
2946  pMessageToSend = new moDataMessage();
2947 
2948  if (pMessageToSend) {
2949  pMessageToSend->Add( moData("consolegetstate") );
2950  pMessageToSend->Add( moData("__console__" ) );
2951  pMessageToSend->Add( moData( EffectStateJSON ) );
2953  SendMoldeoAPIMessage( pMessageToSend );
2954  }
2955  return 0;
2956  }
2957  break;
2958 
2960  {
2961  ConsolePause();
2962 
2963  EffectStateJSON = m_ConsoleState.ToJSON();
2964 
2965  pMessageToSend = new moDataMessage();
2966 
2967  if (pMessageToSend) {
2968  pMessageToSend->Add( moData("consolegetstate") );
2969  pMessageToSend->Add( moData("__console__" ) );
2970  pMessageToSend->Add( moData( EffectStateJSON ) );
2972  SendMoldeoAPIMessage( pMessageToSend );
2973  }
2974  return 0;
2975  }
2976  break;
2977 
2979  {
2980  MODebug2->Message("moConsole::Processing > Console Record Session");
2982 
2983  EffectStateJSON = m_ConsoleState.ToJSON();
2984 
2985  pMessageToSend = new moDataMessage();
2986 
2987  if (pMessageToSend) {
2988  pMessageToSend->Add( moData("consolerecordsession") );
2989  pMessageToSend->Add( moData("__console__" ) );
2990  pMessageToSend->Add( moData( EffectStateJSON ) );
2992  SendMoldeoAPIMessage( pMessageToSend );
2993  }
2994  return 0;
2995  }
2996  break;
2997 
2999  {
3000  arg0 = p_pDataMessage->Get(1).ToText();//QUALITY! JPG,JPGGOOD...
3001  ConsoleRenderSession( arg0 );
3002 
3003 
3004  moText rendered_folder = DataMan()->GetSession()->GetRenderedFolder();
3005 
3006  MODebug2->Message("moConsole::Processing > Console Render Session (quality): " + arg0);
3007  MODebug2->Message("moConsole::Processing > Console Render Session (rendered_folder): " + rendered_folder);
3008 
3009  moText RenderSessionInfo = "{";
3010  moText data_session = DataMan()->GetSession()->ToJSON();
3011  EffectStateJSON = m_ConsoleState.ToJSON();
3012 
3013  RenderSessionInfo+= moText("'consolestate': ") + EffectStateJSON;
3014  RenderSessionInfo+= moText(",") + moText("'session': ") + DataMan()->GetSession()->ToJSON();
3015  RenderSessionInfo+= "}";
3016 
3017  pMessageToSend = new moDataMessage();
3018 
3019  MODebug2->Message("moConsole::Processing > Console Render Session: " + RenderSessionInfo);
3020 
3021  if (pMessageToSend) {
3022  pMessageToSend->Add( moData("consolerendersession") );
3023  pMessageToSend->Add( moData("__console__" ) );
3024  pMessageToSend->Add( moData( RenderSessionInfo ) );
3026  SendMoldeoAPIMessage( pMessageToSend );
3027  }
3028  return 0;
3029  }
3030  break;
3031 
3032  case MO_ACTION_CONSOLE_GET:
3033  {
3034  FullObjectJSON = "{";
3035  FullObjectJSON+= moText("'datapath': '")+m_pResourceManager->GetDataMan()->GetDataPath()+"'";
3036  FullObjectJSON+= fieldSeparation+"'apppath': '"+m_pResourceManager->GetDataMan()->GetAppPath()+"'";
3037  FullObjectJSON+= fieldSeparation+"'appdatapath': '"+m_pResourceManager->GetDataMan()->GetAppDataPath()+"'";
3038  FullObjectJSON+= fieldSeparation+"'configname': '"+m_pResourceManager->GetDataMan()->GetConsoleConfigName()+"'";
3039  //FullObjectJSON+= fieldSeparation+"'config': "+this->m_Config.ToJSON();
3040  //FullObjectJSON+= fieldSeparation+"'MapEffects': {";
3041  FullObjectJSON+= fieldSeparation+"'MapObjects': {";
3042  fieldSeparation = "";
3043  /*
3044  for(int i=0;i<(int)this->m_EffectManager.AllEffects().Count(); i++ ) {
3045  moEffect* Fx = m_EffectManager.AllEffects().Get(i);
3046  FullObjectJSON+= fieldSeparation+"'"+Fx->GetLabelName()+"': '" + Fx->GetKeyName() +"'";
3047  fieldSeparation = ",";
3048  }
3049  */
3050 
3051  for(int i=0;i<(int)this->m_MoldeoObjects.Count(); i++ ) {
3052  moMoldeoObject* Mobj = m_MoldeoObjects.Get(i);
3053  FullObjectJSON+= fieldSeparation+"'"+Mobj->GetLabelName()+"': {";
3054  FullObjectJSON+= "'name': '" + Mobj->GetName() +"',";
3055  FullObjectJSON+= "'cfg': '" + Mobj->GetConfigName() +"',";
3056  FullObjectJSON+= "'key': '" + Mobj->GetKeyName() +"',";
3057  FullObjectJSON+= "'cla': '" + Mobj->GetMobDefinition().GetTypeToClass( Mobj->GetMobDefinition().GetType() ) +"'";
3058  FullObjectJSON+= "}";
3059  fieldSeparation = ",";
3060  }
3061 
3062  FullObjectJSON+= "}";
3063 
3064  FullObjectJSON+= "}";
3065 
3066  pMessageToSend = new moDataMessage();
3067  if (pMessageToSend) {
3068  pMessageToSend->Add( moData("consoleget") );
3069  pMessageToSend->Add( moData("__console__") );
3070  pMessageToSend->Add( moData( FullObjectJSON ) );
3071  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
3072  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
3073  // send it: but we need an id
3074  SendMoldeoAPIMessage( pMessageToSend );
3075  }
3076 
3077  return 0;
3078  }
3079  break;
3080 
3082  {
3084  EffectStateJSON = m_ConsoleState.ToJSON();
3085 
3086  pMessageToSend = new moDataMessage();
3087 
3088  if (pMessageToSend) {
3089  pMessageToSend->Add( moData("consolegetstate") );
3090  pMessageToSend->Add( moData("__console__" ) );
3091  pMessageToSend->Add( moData( EffectStateJSON ) );
3093  SendMoldeoAPIMessage( pMessageToSend );
3094  }
3095 
3096  return 0;
3097  }
3098  break;
3099 
3101  {
3103  return 0;
3104  }
3105  break;
3106 
3107  default:
3108 
3109  break;
3110 
3111  }
3112 
3113  return -1; /*PROCESS NOT OK*/
3114 }
3115 
3116 void moConsole::Error( const moText &p_message ) {
3117  MODebug2->Error( p_message );
3118 }
3119 
3120 int moConsole::NewMob( const moMobDefinition &p_MobDef ) {
3121 
3122  moText confignamecomplete = "";
3123  bool res = false;
3124 
3125  //p_MobDesc.SetProjectDescriptor( GetProject() );
3126 
3127  moMobDefinition pMobDef = p_MobDef;//p_MobDesc.GetMobDefinition();
3128 
3129  moEffect* pEffect = NULL;
3130  moResource* pResource = NULL;
3131  MOint rid = -1;
3132  moMoldeoObject* pMOB = NULL;
3133  moMoldeoObject* pFatherMOB = NULL;
3134  moEffectManager* pFxManager = NULL;
3135 
3136  moConfig* pConfig = NULL;
3137 
3138  if (pMobDef.GetMoldeoFatherId()==-1) {
3139  pConfig = &m_Config;
3140  pFxManager = &m_EffectManager;
3141  }
3142  else if (pMobDef.GetMoldeoFatherId()>=0) {
3143  pFatherMOB = GetObjectByIdx( pMobDef.GetMoldeoFatherId() );
3144  if (pFatherMOB && pFatherMOB->GetName()=="scene") {
3145  moSceneEffect* pScene = (moSceneEffect*) pFatherMOB;
3146  pConfig = pScene->GetConfig();
3147  pFxManager = &pScene->GetEffectManager();
3148  }
3149  }
3150 
3151  switch( (int) pMobDef.GetType()) {
3152  case MO_OBJECT_PREEFFECT:
3153  pMobDef.SetConsoleParamIndex( pConfig->GetParamIndex("preeffect") );
3154  pMobDef.SetConsoleValueIndex( pFxManager->PreEffects().Count() );
3155  pMOB = (moMoldeoObject*)pFxManager->New( pMobDef );
3156  pEffect = (moEffect*) pMOB;
3157  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "preeffect" );
3158  break;
3159  case MO_OBJECT_EFFECT:
3160  pMobDef.SetConsoleParamIndex( pConfig->GetParamIndex("effect") );
3161  pMobDef.SetConsoleValueIndex( pFxManager->Effects().Count() );
3162  pMOB = (moMoldeoObject*)pFxManager->New( pMobDef );
3163  pEffect = (moEffect*) pMOB;
3164  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "effect" );
3165  break;
3166  case MO_OBJECT_POSTEFFECT:
3167  pMobDef.SetConsoleParamIndex( pConfig->GetParamIndex("posteffect") );
3168  pMobDef.SetConsoleValueIndex( pFxManager->PostEffects().Count() );
3169  pMOB = (moMoldeoObject*)pFxManager->New( pMobDef );
3170  pEffect = (moEffect*) pMOB;
3171  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "posteffect" );
3172  break;
3174  pMobDef.SetConsoleParamIndex( pConfig->GetParamIndex("mastereffect") );
3175  pMobDef.SetConsoleValueIndex( pFxManager->MasterEffects().Count() );
3176  pMOB = (moMoldeoObject*) pFxManager->New( pMobDef );
3177  pEffect = (moEffect*) pMOB;
3178  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "mastereffect" );
3179  break;
3180  case MO_OBJECT_IODEVICE:
3181  pMobDef.SetConsoleParamIndex( pConfig->GetParamIndex("devices") );
3182  pMobDef.SetConsoleValueIndex( m_pIODeviceManager->IODevices().Count() );
3183  pMOB = (moMoldeoObject*) m_pIODeviceManager->NewIODevice( pMobDef.GetName(), pMobDef.GetConfigName(), pMobDef.GetLabelName(), pMobDef.GetKeyName(), MO_OBJECT_IODEVICE, pMobDef.GetMobIndex().GetParamIndex(), pMobDef.GetMobIndex().GetValueIndex() );
3184  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "iodevice" );
3185  break;
3186  case MO_OBJECT_RESOURCE:
3187  pMobDef.SetConsoleParamIndex( m_Config.GetParamIndex("resources") );
3188  pMobDef.SetConsoleValueIndex( m_Config.GetParam("resources").GetValuesCount() );
3189  rid = m_pResourceManager->GetResourceIndex( pMobDef.GetLabelName() );
3190  if(rid>-1) pResource = m_pResourceManager->GetResource(rid);
3191 
3192  if (pResource ) {
3193  //do nothing
3194  if (pResource->GetLabelName()!=pMobDef.GetLabelName()) {
3195  pResource->SetConfigName( pMobDef.GetConfigName() );
3196  pResource->SetLabelName( pMobDef.GetLabelName() );
3197  } else Error( moText("Resource already loaded: ") + (moText)pResource->GetLabelName() );
3198  } else
3199  if (m_pResourceManager->NewResource( pMobDef.GetName(), pMobDef.GetConfigName(), pMobDef.GetLabelName(), pMobDef.GetKeyName() )) {
3200  rid = m_pResourceManager->GetResourceIndex( pMobDef.GetLabelName() );
3201  if (rid>=0) {
3202  pResource = m_pResourceManager->GetResource(rid);
3203  if (pResource) {
3204  pResource->SetConfigName( pMobDef.GetConfigName() );
3205  pResource->SetLabelName( pMobDef.GetLabelName() );
3206  }
3207  }
3208  }
3209  pMOB = (moMoldeoObject*) pResource;
3210 
3211  pMOB->SetMobDefinition( pMobDef );
3212 
3213  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "resource" );
3214  break;
3215  default:
3216  Error(moText("moConsole::NewMob: No mob type defined."));
3217  return -1;
3218  break;
3219  }
3220 
3221  if (pMOB) {
3222 
3223  if (pMOB->GetConfigName().Length()>0) {
3224 
3225  confignamecomplete = m_pResourceManager->GetDataMan()->GetDataPath();
3226  confignamecomplete += moSlash + moText(pMOB->GetConfigName());
3227  confignamecomplete += moText(".cfg");
3228 
3229  pMOB->GetDefinition();
3230 
3232  moFile pFile(confignamecomplete);
3233 
3235  if (!pFile.Exists()) {
3237  res = pMOB->GetConfig()->CreateDefault( confignamecomplete );
3238 
3239  } else {
3241  res = true;
3242 
3243  }
3244 
3245  if (res) {
3246  pMOB->GetConfig()->UnloadConfig();
3247 
3249 
3250  res = pMOB->Init();
3251  if (res) {
3252  if (pEffect) {
3253  pEffect->LoadCodes( m_pIODeviceManager );
3254  pEffect->Activate();
3255  }
3256  } else {
3257  Error( moText("moConsole::NewMob Couldn't initialized effect" ) );
3258  }
3259 
3260  //pEffect->Draw( &m_EffectState.tempo );
3262  moValue effectvalue( pMOB->GetName(), "TXT" );
3263  effectvalue.AddSubValue( pMOB->GetConfigName() , "TXT" );
3264  effectvalue.AddSubValue( pMOB->GetLabelName() , "TXT" );
3265  effectvalue.AddSubValue( "0" , "NUM" );
3266  if (pMOB->GetMobDefinition().GetActivate())
3267  effectvalue.AddSubValue( "1" , "NUM" );
3268  else
3269  effectvalue.AddSubValue( "0" , "NUM" );
3270 
3271  if (pMOB->GetMobDefinition().GetKeyName()!="")
3272  effectvalue.AddSubValue( pMOB->GetMobDefinition().GetKeyName() , "TXT" );
3273  else
3274  effectvalue.AddSubValue( "" , "TXT" );
3275 
3276  if (pConfig) pConfig->GetParam( pMOB->GetMobDefinition().GetMobIndex().GetParamIndex() ).AddValue( effectvalue );
3277 
3278  LoadConnections();
3279  moMobDefinition MDef = pMOB->GetMobDefinition();
3280  bool validity = MDef.IsValid();
3281  if (validity==false) {
3282  Error( moText("moConsole::NewMob:: Source > MobDefinition Invalid") );
3283  } else {
3284  //ProjectUpdated( m_ProjectDescriptor );
3285  return 1;
3286  }
3287 
3288  } else {
3289  Error( moText("moConsole::NewMob Couldn't create default configuration") );
3290  }
3291 
3292  } else {
3293  Error( moText("moConsole::NewMob Config filename undefined" ) );
3294  }
3295  } else {
3296  Error( moText("moConsole::NewMob Couldn't create effect: " ) + pMobDef.GetName() );
3297  }
3298 
3299  return -1;
3300 
3301 }
3302 
3303 int moConsole::AddChildMob( const moMobDefinition &p_MobDef, const moMobDefinition &p_MobDefFather ) {
3304 
3305  moMobDefinition pMobDef = p_MobDef;
3306  /*moMoldeoObject* pMOB = GetObject( p_MobDesc );*/
3307  /*really must be check by NewMob... it shouldnt let create MOBs with same label and configname...*/
3308 
3309  pMobDef.SetMoldeoFatherId( p_MobDefFather.GetMoldeoId() );
3310 
3311  return NewMob( pMobDef );
3312 }
3313 
3314 
3315 int moConsole::MoveMob( const moMobDefinition& p_MobDef, int position ) {
3316 
3318 
3319  moMoldeoObject* pObj = NULL;
3320  moMoldeoObject* pObjAux = NULL;
3321  int array_count = 0;
3322  moMobDefinition pMobDef = p_MobDef;
3323  moMoldeoObjectType MobType = pMobDef.GetType();
3324  int index_object = pMobDef.GetMobIndex().GetValueIndex();
3325 
3326  pObj = m_MoldeoObjects.GetRef(
3327  RelativeToGeneralIndex( index_object, MobType )
3328  );
3329 
3331  switch( pMobDef.GetType() ) {
3332 
3333  case MO_OBJECT_EFFECT:
3334  array_count = m_EffectManager.Effects().Count();
3335  break;
3336  case MO_OBJECT_PREEFFECT:
3337  array_count = m_EffectManager.PreEffects().Count();
3338  break;
3339  case MO_OBJECT_POSTEFFECT:
3340  array_count = m_EffectManager.PostEffects().Count();
3341  break;
3343  array_count = m_EffectManager.MasterEffects().Count();
3344  break;
3345 
3346  case MO_OBJECT_IODEVICE:
3347  array_count = m_pIODeviceManager->IODevices().Count();
3348  break;
3349  case MO_OBJECT_RESOURCE:
3350  //array_count = m_pResourceManager->Resources().Count();
3351  array_count = 0;
3352  Error( "Sorry. Changing order of resources is not allowed yet." );
3353  return -1;
3354  break;
3355  default:
3356  array_count = 0;
3357  break;
3358 
3359  }
3360 
3361 
3362  if ( position >= 0 && position < array_count ) {
3363 
3365  //p_MobDesc.GetMobDefinition().GetMobIndex().GetValueIndex()
3366  //moEffect* pObjFx = m_EffectManager.Effects().GetRef(index_object);
3367  int paramindex = pMobDef.GetMobIndex().GetParamIndex();
3368  int valueindex = pMobDef.GetMobIndex().GetValueIndex();
3369 
3370  int preconf1 = m_Config.GetValue( paramindex, valueindex ).GetSubValue(3).Int();
3371  int active1 = m_Config.GetValue( paramindex, valueindex ).GetSubValue(4).Int();
3372 
3374 
3375 
3376  int diff = position - index_object;
3377  if (diff==0) {
3379  } else if (diff>0) {
3381 
3384  for( int o = index_object; o < (position); o++ ) {
3385 
3387  pObjAux = m_MoldeoObjects.GetRef( RelativeToGeneralIndex( o+1, MobType ) );
3388 
3389  if ( MO_OBJECT_EFFECT<=MobType && MobType<=MO_OBJECT_PREEFFECT) m_EffectManager.Set( o, pObjAux );
3390  else if (MobType==MO_OBJECT_IODEVICE) m_pIODeviceManager->IODevices().Set( o, (moIODevice*)pObjAux );
3391 
3392  m_MoldeoObjects.Set( RelativeToGeneralIndex( o, MobType ) , pObjAux );
3393 
3395  //moMobIndex mindex2 = pObjFxAux->GetMobDefinition().GetMobIndex();
3396  moMobIndex mindex2 = pObjAux->GetMobDefinition().GetMobIndex();
3397  int preconf2 = m_Config.GetValue( paramindex, mindex2.GetValueIndex() ).GetSubValue(3).Int();
3398  int active2 = m_Config.GetValue( paramindex, mindex2.GetValueIndex() ).GetSubValue(4).Int();
3399 
3400  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(0).SetText( pObjAux->GetName() );
3401  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(1).SetText( pObjAux->GetConfigName() );
3402  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(2).SetText( pObjAux->GetLabelName() );
3403  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(3).SetInt( preconf2 );
3404  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(4).SetInt( active2 );
3405  pObjAux->SetConsoleValueIndex( o );
3406 
3407  }
3409  if ( MO_OBJECT_EFFECT<=MobType && MobType<=MO_OBJECT_PREEFFECT) m_EffectManager.Set( position, pObj );
3410  else if (MobType==MO_OBJECT_IODEVICE) m_pIODeviceManager->IODevices().Set( position, (moIODevice*)pObj );
3411 
3412  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(0).SetText( pObj->GetName() );
3413  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(1).SetText( pObj->GetConfigName() );
3414  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(2).SetText( pObj->GetLabelName() );
3415  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(3).SetInt( preconf1 );
3416  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(4).SetInt( active1 );
3417  pObj->SetConsoleValueIndex( position );
3418  int mobsindx = RelativeToGeneralIndex( position, MobType );
3419  m_MoldeoObjects.Set( mobsindx, pObj );
3420 
3421  } else if (diff<0) {
3423 
3426  for( int o = index_object ; o >= (position+1) ; o-- ) {
3427 
3428  pObjAux = m_MoldeoObjects.GetRef( RelativeToGeneralIndex( o-1, MobType ) );
3429 
3430  if ( MO_OBJECT_EFFECT<=MobType && MobType<=MO_OBJECT_PREEFFECT) m_EffectManager.Set( o, pObjAux );
3431  else if (MobType==MO_OBJECT_IODEVICE) m_pIODeviceManager->IODevices().Set( o, (moIODevice*)pObjAux );
3432 
3433  m_MoldeoObjects.Set( RelativeToGeneralIndex( o, MobType ), pObjAux );
3434 
3435  moMobIndex mindex2 = pObjAux->GetMobDefinition().GetMobIndex();
3436  int preconf2 = m_Config.GetValue( paramindex, mindex2.GetValueIndex() ).GetSubValue(3).Int();
3437  int active2 = m_Config.GetValue( paramindex, mindex2.GetValueIndex() ).GetSubValue(4).Int();
3438 
3439  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(0).SetText( pObjAux->GetName() );
3440  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(1).SetText( pObjAux->GetConfigName() );
3441  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(2).SetText( pObjAux->GetLabelName() );
3442  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(3).SetInt( preconf2 );
3443  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(4).SetInt( active2 );
3444 
3445  pObjAux->SetConsoleValueIndex( o );
3446 
3447  }
3449  if ( MO_OBJECT_EFFECT<=MobType && MobType<=MO_OBJECT_PREEFFECT) m_EffectManager.Set( position, pObj );
3450  else if (MobType==MO_OBJECT_IODEVICE) m_pIODeviceManager->IODevices().Set( position, (moIODevice*)pObj );
3451 
3452  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(0).SetText( pObj->GetName() );
3453  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(1).SetText( pObj->GetConfigName() );
3454  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(2).SetText( pObj->GetLabelName() );
3455  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(3).SetInt( preconf1 );
3456  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(4).SetInt( active1 );
3457  pObj->SetConsoleValueIndex( position );
3458  int mobsindx = RelativeToGeneralIndex( position, MobType );
3459  m_MoldeoObjects.Set( mobsindx, pObj );
3460  }
3461 
3462  }
3463 
3464  LoadConnections();
3465 
3466  return 1;
3467 
3468 }
3469 
3470 
3472 
3474  moText datapath;
3475  moText filenameduplicate;
3476  moFile newfile;
3477  moText filename = p_MobDef.GetConfigName();
3478  moText labelname = p_MobDef.GetLabelName();
3479  moText labelnameduplicate;
3480  int mStatus = -1;
3481  moMobDefinition pMobDef = p_MobDef;
3482 
3483  if (m_pResourceManager) {
3484 
3486 
3487  filename = filename;
3488  labelname = labelname;
3489 
3490  filenameduplicate = filename + moText(".cfg");
3491 
3492  newfile.SetCompletePath( datapath + filenameduplicate );
3493 
3494  int count = 1;
3495  while( newfile.Exists() ) {
3496  filenameduplicate = filename + IntToStr( count );
3497  newfile.SetCompletePath( datapath + filenameduplicate + moText(".cfg") );
3498  count++;
3499  }
3500 
3501  m_pResourceManager->GetFileMan()->CopyFile( datapath + filename + moText(".cfg"), datapath + filenameduplicate + moText(".cfg") );
3502 
3503 
3504  labelnameduplicate = labelname;
3505 
3507  count = 1;
3508  while(LabelNameExists(labelnameduplicate)) {
3509  labelnameduplicate = labelname + IntToStr( count );
3510  count++;
3511  }
3512 
3514  pMobDef.SetConfigName( filenameduplicate );
3515  pMobDef.SetLabelName( labelnameduplicate );
3516 
3517  mStatus = NewMob( pMobDef );
3518 
3519  }
3520 
3521  return mStatus;
3522 }
3523 
3524 int moConsole::DeleteMob( const moMobDefinition& p_MobDef ) {
3525 
3526  moMoldeoObject* pMOB;
3527 
3528  pMOB = GetObjectByIdx(p_MobDef.GetMoldeoId());
3529 
3530  bool consoleinit = m_bInitialized;
3531 
3532  moMobDefinition pMobDef = p_MobDef;
3533 
3534  moMoldeoObject* pFatherMOB = NULL;
3535  moEffectManager* pFxManager = NULL;
3536 
3537  moConfig* pConfig = NULL;
3538  moMobIndex mobindex = pMobDef.GetMobIndex();
3539  int removeid = pMOB->GetMobDefinition().GetMobIndex().GetValueIndex();
3540 
3541  if (pMobDef.GetMoldeoFatherId()==-1) {
3542  pConfig = &m_Config;
3543  pFxManager = &m_EffectManager;
3544  }
3545  else if (pMobDef.GetMoldeoFatherId()>=0) {
3546  pFatherMOB = GetObjectByIdx( pMobDef.GetMoldeoFatherId() );
3547  if (pFatherMOB && pFatherMOB->GetName()=="scene") {
3548  moSceneEffect* pScene = (moSceneEffect*) pFatherMOB;
3549  pConfig = pScene->GetConfig();
3550  pFxManager = &pScene->GetEffectManager();
3551  //removeid = pFxManager->GetEffectId( pMobDef.GetLabelName() );
3552  }
3553  }
3554 
3555 
3556 
3557  if (pMOB && pFxManager) {
3558 
3559  if ( pMOB->GetId() >= MO_MOLDEOOBJECTS_OFFSET_ID ) {
3560 
3561  //just wait until we delete the object
3562  //important to avoid conflicts on loop...
3563  //maybe MUST BE A LOCK
3564  m_bInitialized = false;
3565 
3566 
3567 
3568 
3569  if (removeid>-1) {
3570  switch( (int)pMOB->GetType() ) {
3571  case MO_OBJECT_PREEFFECT:
3572  case MO_OBJECT_EFFECT:
3573  case MO_OBJECT_POSTEFFECT:
3575 
3576  if (pFxManager->RemoveEffect( removeid, pMOB->GetType())) {
3578  pConfig->GetParam( mobindex.GetParamIndex() ).DeleteValue( removeid );
3579  }
3580  break;
3581  case MO_OBJECT_IODEVICE:
3582  if ( m_pIODeviceManager ) {
3583  m_pIODeviceManager->IODevices().Remove( removeid );
3585  m_Config.GetParam( mobindex.GetParamIndex() ).DeleteValue( removeid );
3586  }
3587  break;
3588  case MO_OBJECT_RESOURCE:
3589  if (m_pResourceManager && m_pResourceManager->RemoveResource( removeid ) ) {
3591  m_Config.GetParam( mobindex.GetParamIndex() ).DeleteValue( removeid );
3592  }
3593  break;
3594  }
3595  }
3596 
3597  LoadConnections();
3598 
3600  //m_bInitialized = consoleinit;
3601 
3603  //ProjectUpdated( GetProject() );
3604 
3605  }
3606  }
3607 
3608 
3609  return 1;
3610 }
3611 
3612 void
3614 
3615  moText action;
3616  moText object_label;
3617  moText position;
3618  moText param_label;
3619  moText value_index;
3620  //int valueidx = -1;
3621 
3622  //int objectid = 0;
3623  //int paramid = 0;
3624  //moMoldeoObject* Object = NULL;
3625  //moEffect* pEffect = NULL;
3626  moParam pParam;
3627 
3628  if (p_pMessage) {
3629 
3630  moText actions = p_pMessage->m_Data.ToText();
3631 
3632  //cout << "Console receiving message: " << actions << endl;
3633  //moTextArray exploded = actions.Explode( moText(",") );
3634 
3635  MODebug2->Message( moText("moConsole::ProcessConsoleMessage > Actions: ")
3636  + actions );
3637 
3638 
3639 
3640 /*
3641 
3642 
3643  switch(exploded.Count()) {
3644  case 2:
3645  action = exploded[0];
3646  object_label = exploded[1];
3647 
3648  if (action=="show") {
3649  objectid = GetObjectId(object_label) - MO_MOLDEOOBJECTS_OFFSET_ID;
3650 
3651  Object = m_MoldeoObjects[objectid];
3652 
3653  if (Object && Object->GetConfig()) {
3654  pEffect = (moEffect*)Object;
3655  pEffect->Enable();
3656  pEffect->TurnOn();
3657  MODebug2->Message( moText("moConsole::ProcessConsoleMessage > show ")
3658  +Object->GetLabelName() );
3659  } else {
3660  MODebug2->Error( moText("moConsole::ProcessConsoleMessage > show : object not founded : id:")
3661  +(moText)IntToStr(objectid) + " label:" + object_label );
3662  }
3663  }
3664 
3665  break;
3666  case 3:
3667  action = exploded[0];
3668  object_label = exploded[1];
3669  position = exploded[2];
3670  break;
3671  case 4:
3672  action = exploded[0];
3673  object_label = exploded[1];
3674  param_label = exploded[2];
3675  value_index = exploded[3];
3676  valueidx = atoi(value_index);
3677 
3678  if (action=="setcurrentvalue") {
3679  objectid = GetObjectId(object_label) - MO_MOLDEOOBJECTS_OFFSET_ID;
3680  Object = m_MoldeoObjects[objectid];
3681 
3682  if (Object && Object->GetConfig()) {
3683 
3684  paramid = Object->GetConfig()->GetParamIndex(param_label);
3685  Object->GetConfig()->SetCurrentValueIndex( paramid, valueidx );
3686 
3687  pParam = Object->GetConfig()->GetParam(paramid);
3688 
3689  MODebug2->Message( moText("moConsole::ProcessConsoleMessage: SetObjectCurrentValue")+Object->GetLabelName() + " Param:" + pParam.GetParamDefinition().GetName() );
3690  } else {
3691  MODebug2->Error( moText("imoConsole::ProcessConsoleMessage: SetObjectCurrentValue : object not founded : id:")+(moText)IntToStr(objectid) );
3692  }
3693  }
3694 
3695 
3696  break;
3697  }
3698 
3699  if (exploded.Count()>=2) {
3700  cout << "Console received message: action: " << action << " object: " << object_label << " position:" << position << " param:" << param_label << " value:" << value_index << " valueidx:" << valueidx << endl;
3701  }
3702 
3703 */
3704  }
3705 
3706 }
3707 
3708 
3709 void
3711  if (!m_pResourceManager) return;
3713 
3715 
3716  if (m_ScreenshotInterval>30) {
3717  if (!m_ScreenshotTimer.Started()) {
3719  } else {
3720 
3725  }
3726 
3727  }
3728  }
3729 
3733  RenderMan->BeginUpdate();
3734  if (m_pIODeviceManager) {
3735  for(MOuint i = 0; i<(m_MoldeoObjects.Count()+m_MoldeoSceneObjects.Count()); i++) {
3736  RenderMan->BeginUpdateObject();
3737  moMoldeoObject* pMOB = NULL;
3738  if (i<m_MoldeoObjects.Count())
3739  pMOB = m_MoldeoObjects[i];
3740  else
3741  pMOB = m_MoldeoSceneObjects[i-m_MoldeoObjects.Count()];
3742  if (pMOB) {
3743  if (pMOB->GetType()!=MO_OBJECT_IODEVICE)
3744  if (pMOB->Activated())
3746  }
3747  RenderMan->EndUpdateObject();
3748  }
3749 
3751  }
3752  RenderMan->EndUpdate();
3753 
3755  int nevents = 0;
3756  if (pEvents) {
3757  moEvent *actual=NULL,*tmp;
3758  // moMessage *pmessage;
3759 
3760  if (pEvents) actual = pEvents->First;
3761 
3763  while(actual!=NULL) {
3764  nevents++;
3765  tmp = actual->next;
3767  //moText debugstr = actual->ToJSON();
3768 
3769  if ( actual->deviceid==MO_IODEVICE_CONSOLE
3771  && actual->reservedvalue3 == MO_DATAMESSAGE) {
3772  moDataMessage* mpDataMessage = (moDataMessage*) actual->pointer;
3773  if (mpDataMessage) {
3774  //tmpstr = "MOLDEOAPI MO_DATAMESSAGE > count:" + mpDataMessage->Count();
3775  delete mpDataMessage;
3776  }
3777  actual->pointer = NULL;
3778  pEvents->Delete(actual);
3779  }
3780 
3781  if (actual->deviceid>=MO_MOLDEOOBJECTS_OFFSET_ID) {
3782  moMoldeoObject* pobj = GetObjectByIdx( actual->deviceid );
3783  //debugstr = pobj->GetLabelName()+"("+IntToStr(actual->deviceid)+") >> "+actual->ToJSON();
3784  }
3785  actual = tmp;
3786 
3787  //MODebug2->Message( debugstr );
3788  }
3789 
3790  //if ()
3791  //MODebug2->Message("fps:"+fps_text+" nevents:"+IntToStr(nevents));
3792 
3793  }
3794 
3795  //Procesamos aquellos Mensajes enviados con acciones
3796  moEvent* actual = m_pIODeviceManager->GetEvents()->First;
3797  moEvent* tmp = NULL;
3798  while(actual!=NULL) {
3799 
3800  if ( actual->deviceid==MO_IODEVICE_CONSOLE
3801  &&
3802  actual->reservedvalue3 == MO_MESSAGE ) {
3803 
3804  moMessage* ConsoleMessage = (moMessage*)actual;
3805  this->ProcessConsoleMessage(ConsoleMessage);
3806  }
3807 
3808  if ( ( actual->deviceid == MO_IODEVICE_CONSOLE )
3810  && ( actual->reservedvalue3 == MO_DATAMESSAGE ) ) {
3811 
3812  moDataMessage* MoldeoAPIMessage = (moDataMessage*)actual->pointer;
3813  this->ProcessMoldeoAPIMessage( MoldeoAPIMessage );
3814  }
3815 
3816  tmp = actual;
3817  actual = tmp->next;
3818  }
3819 
3821 }
3822 
3825 
3826  //default: alpha, color, syncro
3827  p_configdefinition = moMoldeoObject::GetDefinition( p_configdefinition );
3828  p_configdefinition->Add( moText("devices"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_DEVICES );
3829  p_configdefinition->Add( moText("preeffect"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_PREEFFECT );
3830  p_configdefinition->Add( moText("effect"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_EFFECT );
3831  p_configdefinition->Add( moText("posteffect"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_POSTEFFECT );
3832  p_configdefinition->Add( moText("mastereffect"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_MASTEREFFECT );
3833  p_configdefinition->Add( moText("resources"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_RESOURCES );
3834 
3835  p_configdefinition->Add( moText("mastereffects_on"), MO_PARAM_NUMERIC, (MOint)CONSOLE_ON, moValue("0","NUM").Ref(), moText("off,on") );
3836  p_configdefinition->Add( moText("fulldebug"), MO_PARAM_NUMERIC, CONSOLE_FULLDEBUG, moValue("0","NUM").Ref() );
3837 
3838  //obsoleto
3839  //p_configdefinition->Add( moText("consolescript"), MO_PARAM_SCRIPT, CONSOLE_SCRIPT );
3840 
3841  p_configdefinition->Add( moText("outputmode"), MO_PARAM_TEXT, CONSOLE_OUTPUTMODE );
3842  p_configdefinition->Add( moText("outputresolution"), MO_PARAM_TEXT, CONSOLE_OUTPUTRESOLUTION );
3843 
3844  p_configdefinition->Add( moText("rendermode"), MO_PARAM_TEXT, CONSOLE_RENDERMODE );
3845  p_configdefinition->Add( moText("renderresolution"), MO_PARAM_TEXT, CONSOLE_RENDERRESOLUTION );
3846 
3847  p_configdefinition->Add( moText("clip1"), MO_PARAM_TEXT, CONSOLE_CLIP1 );
3848  p_configdefinition->Add( moText("clip2"), MO_PARAM_TEXT, CONSOLE_CLIP2 );
3849  p_configdefinition->Add( moText("clip3"), MO_PARAM_TEXT, CONSOLE_CLIP3 );
3850 
3851  p_configdefinition->Add( moText("screenshots"), MO_PARAM_NUMERIC, CONSOLE_SCREENSHOTS, moValue("0","NUM").Ref() );
3852  p_configdefinition->Add( moText("videoshots"), MO_PARAM_NUMERIC, CONSOLE_VIDEOSHOTS, moValue("0","NUM").Ref() );
3853 
3854  return p_configdefinition;
3855 }
3856 
3857 // Ugly, ugly and dirty...
3858 MOint
3860  if(!stricmp( name, "SDLK_1" ) ) return 0;
3861  else if(!stricmp( name, "SDLK_2" ) ) return 1;
3862  else if(!stricmp( name, "SDLK_3" ) ) return 2;
3863  else if(!stricmp( name, "SDLK_4" ) ) return 3;
3864  else if(!stricmp( name, "SDLK_5" ) ) return 4;
3865  else if(!stricmp( name, "SDLK_6" ) ) return 5;
3866  else if(!stricmp( name, "SDLK_7" ) ) return 6;
3867  else if(!stricmp( name, "SDLK_8" ) ) return 7;
3868  else if(!stricmp( name, "SDLK_9" ) ) return 8;
3869  else if(!stricmp( name, "SDLK_10" ) ) return 9;
3870  else if(!stricmp( name, "SDLK_q" ) ) return 10;
3871  else if(!stricmp( name, "SDLK_w" ) ) return 11;
3872  else if(!stricmp( name, "SDLK_e" ) ) return 12;
3873  else if(!stricmp( name, "SDLK_r" ) ) return 13;
3874  else if(!stricmp( name, "SDLK_t" ) ) return 14;
3875  else if(!stricmp( name, "SDLK_y" ) ) return 15;
3876  else if(!stricmp( name, "SDLK_u" ) ) return 16;
3877  else if(!stricmp( name, "SDLK_i" ) ) return 17;
3878  else if(!stricmp( name, "SDLK_o" ) ) return 18;
3879  else if(!stricmp( name, "SDLK_p" ) ) return 19;
3880  else if(!stricmp( name, "SDLK_a" ) ) return 20;
3881  else if(!stricmp( name, "SDLK_s" ) ) return 21;
3882  else if(!stricmp( name, "SDLK_d" ) ) return 22;
3883  else if(!stricmp( name, "SDLK_f" ) ) return 23;
3884  else if(!stricmp( name, "SDLK_g" ) ) return 24;
3885  else if(!stricmp( name, "SDLK_h" ) ) return 25;
3886  else if(!stricmp( name, "SDLK_j" ) ) return 26;
3887  else if(!stricmp( name, "SDLK_k" ) ) return 27;
3888  else if(!stricmp( name, "SDLK_l" ) ) return 28;
3889  else if(!stricmp( name, "SDLK_SEMICOLON" ) ) return 29;
3890  else if(!stricmp( name, "SDLK_z" ) ) return 30;
3891  else if(!stricmp( name, "SDLK_x" ) ) return 31;
3892  else if(!stricmp( name, "SDLK_c" ) ) return 32;
3893  else if(!stricmp( name, "SDLK_v" ) ) return 33;
3894  else if(!stricmp( name, "SDLK_b" ) ) return 34;
3895  else if(!stricmp( name, "SDLK_n" ) ) return 35;
3896  else if(!stricmp( name, "SDLK_m" ) ) return 36;
3897  else if(!stricmp( name, "SDLK_COMMA" ) ) return 37;
3898  else if(!stricmp( name, "SDLK_PERIOD" ) ) return 38;
3899  else if(!stricmp( name, "SDLK_SLASH" ) ) return 39;
3900  return -1;
3901 }
3902 
3903 int moConsole::ProcessSessionKey( const moDataSessionKey & p_session_key ) {
3904  moMoldeoActionType action = p_session_key.GetActionType();
3905  //APPLY!!!!
3906  switch( action ) {
3908  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_CONSOLE_PLAY" );
3909  ConsolePlay();
3910  break;
3912  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_CONSOLE_PAUSE" );
3913  ConsolePause();
3914  break;
3916  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_CONSOLE_STOP" );
3917  ConsoleStop();
3918  break;
3919 
3921  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_PRECONFIG_SET" );
3922  SetPreconf( p_session_key.m_ObjectId, p_session_key.m_PreconfId );
3923  break;
3924 
3925  case MO_ACTION_VALUE_SET:
3926  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_VALUE_SET" );
3927  SetValue( p_session_key.m_ObjectId, p_session_key.m_ParamId, p_session_key.m_ValueId, p_session_key.m_Value );
3928  break;
3929 
3930  case MO_ACTION_PARAM_SET:
3931  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_PARAM_SET" );
3932  SetParam( p_session_key.m_ObjectId, p_session_key.m_ParamId, p_session_key.m_ParamDefinition );
3933  break;
3934 
3936  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_EFFECT_ENABLE" );
3937  ObjectEnable( p_session_key.m_ObjectId );
3938  break;
3939 
3941  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_EFFECT_DISABLE" );
3942  ObjectDisable( p_session_key.m_ObjectId );
3943  break;
3944 
3945  case MO_ACTION_EFFECT_PLAY:
3946  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_EFFECT_PLAY" );
3947  EffectPlay( p_session_key.m_ObjectId );
3948  break;
3949 
3951  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_EFFECT_PAUSE" );
3952  EffectPause( p_session_key.m_ObjectId );
3953  break;
3954 
3955  case MO_ACTION_EFFECT_STOP:
3956  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_EFFECT_STOP" );
3957  EffectStop( p_session_key.m_ObjectId );
3958  break;
3959 
3960  case MO_ACTION_UNDEFINED:
3961  break;
3962  case MO_ACTION_VALUE_ADD:
3964  case MO_ACTION_VALUE_SAVE:
3965  case MO_ACTION_VALUE_GET:
3966  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_VALUE_###" );
3967  break;
3972  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_CONSOLE_PRESET_###" );
3973  break;
3974  default:
3975  {
3976  moDataSessionKey sk = p_session_key;
3977  moText json = sk.ToJSON();
3978  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type not processed: " + json );
3979  }
3980  break;
3981  };
3982 
3983  return 0;
3984 }
3985 
3986 int moConsole::ProcessSessionEventKey( const moDataSessionEventKey & p_session_event_key ) {
3987 
3988  moDataSessionEventKey sek = p_session_event_key;
3989 
3990  //int mtimecode = sek.GetTimecode();
3991 
3992  return 0;
3993 
3994 }
3995 
3996 int
3997 moConsole::Save( const moText& p_save_filename ) {
3998  bool save_success = true;
3999  int fx=0;
4000  for( fx=0; fx<(int)m_MoldeoObjects.Count(); fx++ ) {
4001  moMoldeoObject* MObj = m_MoldeoObjects[fx];
4002  if (MObj) {
4003  moMobDefinition MobDef = MObj->GetMobDefinition();
4004  int valueindex = MobDef.GetMobIndex().GetValueIndex();
4005  int paramindex = MobDef.GetMobIndex().GetParamIndex();
4006 
4007  moValueBase& vCFG_Effect_Config( GetConfig()->GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_CONFIG) );
4008  vCFG_Effect_Config.SetText( MobDef.GetConfigName() );
4009 
4010  moValueBase& vCFG_Effect_Label( GetConfig()->GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_LABEL) );
4011  vCFG_Effect_Label.SetText( MobDef.GetLabelName() );
4012 
4013  moValueBase& vCFG_Effect_Name( GetConfig()->GetParam( paramindex ).GetValue( valueindex ).GetSubValue(0) );
4014  vCFG_Effect_Name.SetText( MobDef.GetName() );
4015 
4016  moValueBase& vCFG_Effect_Activate( GetConfig()->GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_ON) );
4017  vCFG_Effect_Activate.SetInt( (int)(MobDef.GetActivate()) );
4018 
4019  moValueBase& vCFG_Effect_KeyName( GetConfig()->GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_KEY) );
4020  vCFG_Effect_KeyName.SetText( MobDef.GetKeyName() );
4021 
4022  save_success = save_success && (MObj->Save( "" )>0);
4023  }
4024  }
4025  int res = moMoldeoObject::Save( p_save_filename );
4026  save_success = save_success && (res>0);
4027  return res;
4028 }
4029 
4030 
4032 
4036  moDataSession* loadedSession = GetResourceManager()->GetDataMan()->GetSession();
4040  //session object
4041  if (loadedSession==NULL) { MODebug2->Error("moConsole::ConsoleModeUpdate > no session"); return; }
4042 
4043 
4044  switch( m_ConsoleState.m_Mode ) {
4045 
4046  case MO_CONSOLE_MODE_LIVE:
4047  {
4048  //normal mode: do nothing
4051  }
4052  break;
4053 
4055  {
4056  //playing back last session loaded
4057  //
4058  //loaded/loading session
4059  if (!loadedSession->Loaded())
4060  if (!loadedSession->LoadSession()) { MODebug2->Error("moConsole::ConsoleModeUpdate > no loaded session"); return; }
4061 
4062  //session ended?
4063  if (loadedSession->SessionEnded()) { MODebug2->Message("moConsole::ConsoleModeUpdate > session playback ended."); return; }
4064 
4065  // 1000 / 20fps = 50 ms
4066  // 1000 / 24fps = 41 ms = 24 frames + 16/24
4067  // 1000 / 25fps = 40 ms = 25 frames
4068  // 1000 / 30fps = 50 ms
4070 
4072 
4073  //process next keys
4074  ProcessSessionKey( loadedSession->NextKey( m_ConsoleState ) );
4075 
4076  }
4077  break;
4078 
4080  {
4083 
4084  }
4085  break;
4086 
4088  {
4091  MODebug2->Message("moConsole::ConsoleModeUpdate > render session: " + IntToStr(tickis) );
4092  int console_timecode = m_ConsoleState.tempo.Duration();
4093 
4094  if (console_timecode==0) {
4098  }
4099 
4101 
4102  MODebug2->Message("moConsole::ConsoleModeUpdate > render session: m_ConsoleState.tempo.Duration: " + IntToStr(console_timecode) );
4103 
4104  ProcessSessionKey( loadedSession->NextKey( m_ConsoleState ) );
4105  loadedSession->StepRender( m_ConsoleState );
4106 
4107  }
4108  break;
4109 
4110  default:
4112  break;
4113  };
4114 }
4115 
4117  MODebug2->Message("moConsole::ConsolePlaySession");
4118  if (m_pResourceManager==NULL) return;
4120 }
4121 
4123  MODebug2->Message("moConsole::ConsoleRecordSession ");
4124  if (m_pResourceManager==NULL) return;
4126 
4127 }
4128 
4129 void moConsole::ConsoleRenderSession( const moText& p_frame_quality ) {
4130  MODebug2->Message("moConsole::ConsoleRenderSession");
4131  if (m_pResourceManager==NULL) return;
4132  m_ConsoleState.m_RenderFrameQuality = p_frame_quality;
4134 }
4135 
4137  MODebug2->Message("moConsole::ConsoleSaveSessionAs");
4138  if (m_pResourceManager==NULL) return;
4139 }
4140 
4142 
4145  }
4146 
4147  if (moIsTimerPaused()) {
4148  moContinueTimer();
4149  } else {
4150  moStartTimer();
4151  }
4152 
4154  if (m_pResourceManager==NULL) return;
4157  }
4158 }
4159 
4161  moPauseTimer();
4163  if (m_pResourceManager==NULL) return;
4166  }
4167 }
4168 
4170  moStopTimer();
4172  if (m_pResourceManager==NULL) return;
4175  }
4176 
4177 }
4178 
4180 
4181  return m_ConsoleState.m_Mode;
4182 }
4183 
4185 
4186  return moGetTimerState();
4187 }
4188 
4189 int
4190 moConsole::SetEffectState( int m_MoldeoObjectId, const moEffectState& p_effect_state ) {
4191  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4192  if (Object && Object->GetConfig()) {
4193 
4194  moEffect* Effect = ((moEffect*)Object);
4195  Effect->SetEffectState( p_effect_state );
4196 
4198  moDataSessionKey key( moGetTicksAbsolute(), MO_ACTION_EFFECT_SETSTATE, Object->GetId(), p_effect_state );
4200  }
4201 
4202  return 1;
4203  } else return -1;
4204  return 0;
4205 }
4206 
4207 int
4208 moConsole::SetParam( int m_MoldeoObjectId, int m_ParamId, const moParamDefinition &p_param_definition ) {
4209 
4210  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4211  if (Object && Object->GetConfig()) {
4212  moParam& Param( Object->GetConfig()->GetParam(m_ParamId));
4213  moParamDefinition mpdef = p_param_definition;
4214  Param.SetParamDefinition( mpdef );
4215 
4217  moDataSessionKey key( moGetTicksAbsolute(), MO_ACTION_PARAM_SET, Object->GetId(), m_ParamId, Param.GetParamDefinition() );
4219  }
4220 
4221  return 1;
4222  }
4223  return 0;
4224 }
4225 
4226 int moConsole::SetValue( int m_MoldeoObjectId, int m_ParamId, int m_ValueId, const moValue &p_value ) {
4227 
4228  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4229  if (Object && Object->GetConfig()) {
4230  moParam& Param( Object->GetConfig()->GetParam(m_ParamId));
4231  moValue& Value( Param.GetValue(m_ValueId) );
4232  Value = p_value;
4233  Object->ResolveValue( Param, m_ValueId );
4234 
4236  moDataSessionKey key( moGetTicksAbsolute(), MO_ACTION_VALUE_SET, Object->GetId(), m_ParamId, m_ValueId, p_value );
4238  }
4239 
4240  return 1;
4241  }
4242 
4243  return 0;
4244 }
4245 
4246 int moConsole::RefreshValue( int m_MoldeoObjectId, int m_ParamId, int m_ValueId, bool p_Refresh ) {
4247 
4248  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4249 
4250  if (Object && Object->GetConfig()) {
4251  moParam& Param( Object->GetConfig()->GetParam(m_ParamId));
4252  //moValue& Value( Param.GetValue(m_ValueId) );
4253  if (p_Refresh) Object->RefreshValue( Param, m_ValueId );
4254 
4256  moDataSessionKey key( moGetTicksAbsolute(), MO_ACTION_VALUE_REFRESH, Object->GetId(), m_ParamId, m_ValueId, -1 );
4258  }
4259 
4260  return 1;
4261  }
4262 
4263  return 0;
4264 }
4265 
4266 int
4267 moConsole::EffectPlay( int m_MoldeoObjectId ) {
4268  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4269  if (Object) {
4270  moEffect* fxEffect = (moEffect*)Object;
4271  fxEffect->Play();
4275  }
4276  return 1;
4277  }
4278  return 0;
4279 }
4280 
4281 int
4282 moConsole::EffectPause( int m_MoldeoObjectId ) {
4283  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4284  if (Object) {
4285  moEffect* fxEffect = (moEffect*)Object;
4286  fxEffect->Pause();
4290  }
4291  return 1;
4292  }
4293  return 0;
4294 }
4295 
4296 
4297 int
4298 moConsole::EffectStop( int m_MoldeoObjectId ) {
4299  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4300  if (Object) {
4301  moEffect* fxEffect = (moEffect*)Object;
4302  fxEffect->Stop();
4306  }
4307  return 1;
4308  }
4309  return 0;
4310 }
4311 
4312 int
4313 moConsole::ObjectEnable( int m_MoldeoObjectId ) {
4314 
4315  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4316  if (Object) {
4317 
4321  }
4322 
4323  switch ( Object->GetType() ) {
4324  case MO_OBJECT_EFFECT:
4325  case MO_OBJECT_PREEFFECT:
4326  case MO_OBJECT_POSTEFFECT:
4328  {
4329  moEffect* pEffect = (moEffect*) Object;
4330  //pEffect->Enable();
4331  pEffect->TurnOn();
4332  }
4333  return 1;
4334  break;
4335  case MO_OBJECT_IODEVICE:
4336  case MO_OBJECT_RESOURCE:
4337  {
4338  Object->Activate();
4339  return 1;
4340  }
4341  break;
4342  default:
4343  break;
4344  };
4345 
4346  } else return -1;
4347 
4348  return 0;
4349 }
4350 
4351 int
4352 moConsole::ObjectDisable( int m_MoldeoObjectId ) {
4353 
4354  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4355  if (Object) {
4356 
4360  }
4361 
4362  switch ( Object->GetType() ) {
4363  case MO_OBJECT_EFFECT:
4364  case MO_OBJECT_PREEFFECT:
4365  case MO_OBJECT_POSTEFFECT:
4367  {
4368  moEffect* pEffect = (moEffect*) Object;
4369  //pEffect->Enable();
4370  pEffect->TurnOff();
4371  }
4372  return 1;
4373  break;
4374  case MO_OBJECT_IODEVICE:
4375  case MO_OBJECT_RESOURCE:
4376  {
4377  Object->Deactivate();
4378  return 1;
4379  }
4380  break;
4381  default:
4382  break;
4383  };
4384 
4385  } else return -1;
4386 
4387  return 0;
4388 }
4389 
4390 
4392 
4393  return 0;
4394 }
4395 
4396 void moConsole::SetPreset( int presetid ) {
4397  //
4398  m_PresetParams.Get( presetid );
4399 }
4400 
4401 int moConsole::GetPreconf( int objectid ) {
4402  moMoldeoObject* MOB;
4403  MOB = m_MoldeoObjects.Get(objectid);
4404  return MOB->GetConfig()->GetCurrentPreConf();
4405 }
4406 
4407 void moConsole::SetPreconf( int objectid, int preconfid ) {
4408  moMoldeoObject* Object = GetObjectByIdx(objectid);
4409  if (Object && Object->GetConfig()) {
4410  Object->GetConfig()->SetCurrentPreConf( preconfid );
4411  }
4412 
4414  moDataSessionKey key( moGetTicksAbsolute(), MO_ACTION_PRECONFIG_SET, objectid, preconfid );
4416  }
4417 }
4418 
4419 
4420 void moConsole::SetTicks( int ticksid ) {
4421  moSetDuration( ticksid );
4422 }
4423 
4424 int moConsole::GetObjectId( const moText& p_objectlabelname ) {
4425 
4426  for( MOuint i=0; i<m_MoldeoObjects.Count(); i++) {
4427 
4428  if (p_objectlabelname == m_MoldeoObjects[i]->GetLabelName()) {
4429  return m_MoldeoObjects[i]->GetId();
4430  }
4431 
4432  }
4433 
4434  for( MOuint i=0; i<m_MoldeoSceneObjects.Count(); i++) {
4435 
4436  if (p_objectlabelname == m_MoldeoSceneObjects[i]->GetLabelName()) {
4437  return m_MoldeoSceneObjects[i]->GetId();
4438  }
4439 
4440  }
4441 
4442  return -1;
4443 }
4444 
4446 
4447  moMoldeoObject* returnMOB = NULL;
4448  //if ( p_object_id )
4449  int object_id_to_index = p_object_id - MO_MOLDEOOBJECTS_OFFSET_ID;
4450 
4451  if (0<=object_id_to_index && object_id_to_index<(int)m_MoldeoObjects.Count()) {
4452  returnMOB = m_MoldeoObjects[object_id_to_index];
4453  return returnMOB;
4454  }
4455 
4456  int object_id_to_subscene_index = p_object_id - MO_MOLDEOSCENEOBJECTS_OFFSET_ID;
4457 
4458  if (0<=object_id_to_subscene_index && object_id_to_subscene_index<(int)m_MoldeoSceneObjects.Count()) {
4459  returnMOB = m_MoldeoSceneObjects[object_id_to_subscene_index];
4460  return returnMOB;
4461  }
4462 
4463  return returnMOB;
4464 }
4465 
4466 
4468 
4469  moDirectory* pDir;
4470  pDir = NULL;
4471  moText completepath;
4472  completepath = m_pResourceManager->GetDataMan()->GetDataPath() + (moText)p_path;
4473  pDir = m_pResourceManager->GetFileMan()->GetDirectory(completepath);
4474  if (pDir) {
4475  pDir->Update();
4476  return pDir->GetFiles().Count();
4477  }
4478 
4479  return -1;
4480 }
4481 
4483 {
4486 
4488  RegisterBaseFunction("Play");//0
4489  RegisterFunction("Pause");//1
4490  RegisterFunction("Stop");//2
4491  RegisterFunction("State");//3
4492  RegisterFunction("GetObjectId");//4
4493 
4494  RegisterFunction("GetPreset");//5
4495  RegisterFunction("SetPreset");//6
4496  RegisterFunction("SetTicks");//7
4497  RegisterFunction("GetTicks");//8
4498 
4499  RegisterFunction("GetObjectPreconf");//9
4500  RegisterFunction("SetObjectPreconf");//10
4501  RegisterFunction("ObjectEnable");//11
4502  RegisterFunction("ObjectDisable");//12
4503 
4504  RegisterFunction("GetObjectParamIndex");//13
4505  RegisterFunction("GetObjectParamValues");//14
4506  RegisterFunction("GetObjectCurrentValue");//15
4507  RegisterFunction("SetObjectCurrentValue");//16
4508 
4509 
4510  RegisterFunction("GetObjectDataIndex");//17
4511  RegisterFunction("GetObjectData");//18
4512  RegisterFunction("SetObjectData");//19
4513 
4515 
4516  RegisterFunction("GetEffectState");//20
4517  RegisterFunction("SetEffectState");//21
4518 
4519 
4521 
4522  RegisterFunction("GetDeviceCode");//22
4523  RegisterFunction("GetDeviceCodeId");//23
4524  RegisterFunction("AddEvent");//24
4525 
4527  RegisterFunction("GetDirectoryFileCount");//25
4528  RegisterFunction("Screenshot");//26
4529 
4530  RegisterFunction("EffectPlay");//27
4531  RegisterFunction("EffectStop");//28
4532  RegisterFunction("EffectPause");//29
4533  RegisterFunction("EffectTimerState");//30
4534 
4536 
4537 }
4538 
4539 int moConsole::ScriptCalling(moLuaVirtualMachine& vm, int iFunctionNumber)
4540 {
4541 
4542  switch ( iFunctionNumber - m_iMethodBase )
4543  {
4544  case 0:
4546  return luaPlay(vm);
4547  case 1:
4549  return luaPause(vm);
4550  case 2:
4552  return luaStop(vm);
4553  case 3:
4555  return luaState(vm);
4556  case 4:
4558  return luaGetObjectId(vm);
4559  case 5:
4561  return luaGetPreset(vm);
4562  case 6:
4564  return luaSetPreset(vm);
4565  case 7:
4567  return luaSetTicks(vm);
4568  case 8:
4570  return luaGetTicks(vm);
4571 
4572 
4573 
4574  case 9:
4576  return luaGetObjectPreconf(vm);
4577  case 10:
4579  return luaSetObjectPreconf(vm);
4580  case 11:
4582  return luaObjectEnable(vm);
4583  case 12:
4585  return luaObjectDisable(vm);
4586 
4587 
4588 
4589  case 13:
4591  return luaGetObjectParamIndex(vm);
4592  case 14:
4594  return luaGetObjectParamValues(vm);
4595  case 15:
4597  return luaGetObjectCurrentValue(vm);
4598  case 16:
4600  return luaSetObjectCurrentValue(vm);
4601 
4602  case 17:
4604  return luaGetObjectDataIndex(vm);
4605  case 18:
4607  return luaGetObjectData(vm);
4608  case 19:
4610  return luaSetObjectData(vm);
4611 
4612 
4614  case 20:
4616  return luaGetEffectState(vm);
4617  case 21:
4619  return luaSetEffectState(vm);
4620 
4621 
4623  case 22:
4625  return luaGetDeviceCode(vm);
4626  case 23:
4628  return luaGetDeviceCodeId(vm);
4629 
4630  case 24:
4632  return luaAddEvent(vm);
4633 
4635  case 25:
4637  return luaGetDirectoryFileCount(vm);
4638 
4639  case 26:
4641  return luaScreenshot(vm);
4642 
4643  case 27:
4645  return luaEffectPlay(vm);
4646  case 28:
4648  return luaEffectStop(vm);
4649  case 29:
4651  return luaEffectPause(vm);
4652  case 30:
4654  return luaEffectTimerState(vm);
4655 
4656 
4657  default:
4659  return moMoldeoObject::ScriptCalling( vm, iFunctionNumber );
4660  }
4661 }
4662 
4664 
4665  lua_State *state = (lua_State *) vm;
4666  if (state)
4667  ConsolePlay();
4668 
4669  return 0;
4670 }
4671 
4673 
4674  lua_State *state = (lua_State *) vm;
4675  if (state)
4676  ConsolePause();
4677 
4678  return 0;
4679 }
4680 
4682 
4683  lua_State *state = (lua_State *) vm;
4684 
4685  if (state)
4686  ConsoleStop();
4687 
4688  return 0;
4689 }
4690 
4692 
4693  lua_State *state = (lua_State *) vm;
4694 
4695  moTimerState elstate = GetConsoleState();
4696  int retstate = (int) elstate;
4697  lua_pushnumber( state, (lua_Number) retstate);
4698 
4699  return 1;
4700 }
4701 
4703 {
4704  lua_State *state = (lua_State *) vm;
4705 
4706  char *objectlabelname = (char *) lua_tostring (state, 1);
4707 
4708  int objectid = -1;
4709 
4710  objectid = this->GetObjectId( objectlabelname );
4711 
4712  lua_pushnumber(state, (lua_Number) objectid );
4713 
4714  if (objectid==-1) {
4715  MODebug2->Error( moText("Object doesnt exists: ")+(moText)objectlabelname );
4716  }
4717 
4718  return 1;
4719 }
4720 
4722 {
4723  lua_State *state = (lua_State *) vm;
4724 
4725  lua_pushnumber(state, (lua_Number) this->GetPreset() );
4726 
4727  return 1;
4728 }
4729 
4731 {
4732  lua_State *state = (lua_State *) vm;
4733 
4734  MOint presetid = (MOint) lua_tonumber (state, 1);
4735 
4736  this->SetPreset( presetid );
4737 
4738  return 0;
4739 }
4740 
4742 {
4743  lua_State *state = (lua_State *) vm;
4744 
4745  MOint objectid = (MOint) lua_tonumber (state, 1);
4746 
4747  moMoldeoObject* Object = GetObjectByIdx(objectid);
4748 
4749  if (Object && Object->GetConfig()) {
4750  lua_pushnumber(state, (lua_Number) Object->GetConfig()->GetCurrentPreConf() );
4751  } else {
4752  lua_pushnumber(state, (lua_Number) -1 );
4753  MODebug2->Error( moText("in moConsole script: GetObjectPreconf : object not founded : id:")+(moText)IntToStr(objectid));
4754  }
4755 
4756  return 1;
4757 }
4758 
4760 {
4761  lua_State *state = (lua_State *) vm;
4762 
4763  MOint objectid = (MOint) lua_tonumber (state, 1);
4764  MOint preconfid = (MOint) lua_tonumber (state, 2);
4765 
4766  moMoldeoObject* Object = NULL;
4767 
4768  Object = GetObjectByIdx(objectid);
4769 
4770  if (Object && Object->GetConfig()) {
4771  SetPreconf( objectid, preconfid );
4772  } else {
4773  MODebug2->Error( moText("in console script: SetObjectPreconf : object not founded : id:")+(moText)IntToStr(objectid)+moText(" preconfid:")+(moText)IntToStr(preconfid) );
4774  }
4775 
4776  return 0;
4777 }
4778 
4780 {
4781  lua_State *state = (lua_State *) vm;
4782 
4783  MOint ticksint = (MOint) lua_tonumber (state, 1);
4784 
4785  this->SetTicks(ticksint);
4786 
4787  return 0;
4788 }
4789 
4791 {
4792  lua_State *state = (lua_State *) vm;
4793 
4794  lua_pushnumber(state, (lua_Number) moGetTicks() );
4795 
4796  return 1;
4797 }
4798 
4800 {
4801  lua_State *state = (lua_State *) vm;
4802 
4803  MOint objectid = (MOint) lua_tonumber (state, 1);
4804 
4805  moMoldeoObject* Object = NULL;
4806 
4807  Object = GetObjectByIdx(objectid);
4808 
4809  if (Object && Object->GetConfig()) {
4810  ObjectEnable( objectid );
4811  } else {
4812  MODebug2->Error( moText("in console script: ObjectEnable : object not founded : id:")+(moText)IntToStr(objectid));
4813  }
4814 
4815  return 0;
4816 }
4817 
4819 {
4820  lua_State *state = (lua_State *) vm;
4821 
4822  MOint objectid = (MOint) lua_tonumber (state, 1);
4823 
4824  moMoldeoObject* Object = NULL;
4825 
4826  Object = GetObjectByIdx(objectid);
4827 
4828  if (Object && Object->GetConfig()) {
4829  ObjectDisable( objectid );
4830  } else {
4831  MODebug2->Error( moText("in console script: ObjectDisable : object not founded : id:")+(moText)IntToStr(objectid));
4832  }
4833 
4834  return 0;
4835 }
4836 
4838 {
4839  lua_State *state = (lua_State *) vm;
4840 
4841  MOint objectid = (MOint) lua_tonumber (state, 1);
4842 
4843  moMoldeoObject* Object = NULL;
4844 
4845  Object = GetObjectByIdx(objectid);
4846 
4847  if (Object && Object->GetConfig() && (
4848  (Object->GetMobDefinition().GetType()>=MO_OBJECT_EFFECT &&
4851  )) {
4852  EffectPlay(Object->GetId());
4853  } else {
4854  MODebug2->Error( moText("in console script: EffectPlay : object not founded : id:")+(moText)IntToStr(objectid));
4855  }
4856 
4857  return 0;
4858 }
4859 
4861 {
4862  lua_State *state = (lua_State *) vm;
4863 
4864  MOint objectid = (MOint) lua_tonumber (state, 1);
4865 
4866  moMoldeoObject* Object = NULL;
4867 
4868  Object = GetObjectByIdx(objectid);
4869 
4870  if (Object && Object->GetConfig() && (
4871  (Object->GetMobDefinition().GetType()>=MO_OBJECT_EFFECT &&
4874  )) {
4875  EffectStop(Object->GetId());
4876  } else {
4877  MODebug2->Error( moText("in console script: EffectStop : object not founded : id:")+(moText)IntToStr(objectid));
4878  }
4879 
4880  return 0;
4881 }
4882 
4884 {
4885  lua_State *state = (lua_State *) vm;
4886 
4887  MOint objectid = (MOint) lua_tonumber (state, 1);
4888 
4889  moMoldeoObject* Object = NULL;
4890 
4891  Object = GetObjectByIdx(objectid);
4892 
4893  if (Object && Object->GetConfig() && (
4894  (Object->GetMobDefinition().GetType()>=MO_OBJECT_EFFECT &&
4897  )) {
4898  EffectPause(Object->GetId());
4899  } else {
4900  MODebug2->Error( moText("in console script: EffectPause : object not founded : id:")+(moText)IntToStr(objectid));
4901  }
4902 
4903  return 0;
4904 }
4905 
4906 
4908 {
4909  lua_State *state = (lua_State *) vm;
4910 
4911  MOint objectid = (MOint) lua_tonumber (state, 1);
4912 
4913  moMoldeoObject* Object = NULL;
4914 
4915  Object = GetObjectByIdx(objectid);
4916 
4917  moText playstr = "none";
4918 
4919  if (Object && Object->GetConfig() && (
4920  (Object->GetMobDefinition().GetType()>=MO_OBJECT_EFFECT &&
4923  )) {
4924  moEffect* fxEffect = (moEffect*)Object;
4925  if (fxEffect) {
4926  moTimer ptimer = fxEffect->GetEffectState().tempo;
4927  playstr = ptimer.StateToStr();
4928  }
4929  }
4930 
4931  lua_pushstring( state, playstr );
4932 
4933  return 1;
4934 }
4935 
4936 
4938 
4939  lua_State *state = (lua_State *) vm;
4940 
4941  MOint objectid = (MOint) lua_tonumber (state, 1);
4942  char *text = (char *) lua_tostring (state, 2);
4943 
4944  moMoldeoObject* Object = GetObjectByIdx(objectid);
4945 
4946  if (Object && Object->GetConfig()) {
4947  if (Object->GetConfig()->GetParamIndex(text)<0) {
4948  MODebug2->Error( moText("moConsole::luaGetObjectParamIndex > param not found: ") + text );
4949  }
4950  lua_pushnumber(state, (lua_Number) Object->GetConfig()->GetParamIndex(text) );
4951  }
4952 
4953  return 1;
4954 
4955 }
4956 
4957 
4959 
4960  lua_State *state = (lua_State *) vm;
4961 
4962  MOint objectid = (MOint) lua_tonumber (state, 1);
4963  char *text = (char *) lua_tostring (state, 2);
4964 
4965  moMoldeoObject* Object = GetObjectByIdx(objectid);
4966 
4967  if ( Object && Object->GetConfig() ) {
4968 
4969  if (Object->GetConfig()->GetParamIndex(text)<0) {
4970  MODebug2->Error( moText("moConsole::luaGetObjectParamValues > param not found: ") + text );
4971  lua_pushnumber(state, (lua_Number) 0 );
4972  return 1;
4973  }
4974  lua_pushnumber(state, (lua_Number) Object->GetConfig()->GetParam(text).GetValuesCount() );
4975 
4976  }
4977 
4978  return 1;
4979 }
4980 
4981 
4983 
4984  lua_State *state = (lua_State *) vm;
4985 
4986  MOint objectid = (MOint) lua_tonumber (state, 1);
4987  MOint paramid = (MOint) lua_tonumber (state, 2);
4988  MOint valueid = (MOint) lua_tonumber (state, 3);
4989 
4990  moMoldeoObject* Object = GetObjectByIdx(objectid);
4991 
4992  if (Object && Object->GetConfig()) {
4993  Object->GetConfig()->SetCurrentValueIndex( paramid, valueid );
4994 
4995  moParam pParam = Object->GetConfig()->GetParam(paramid);
4996 
4997  //MODebug2->Message( moText("in lua console script: SetObjectCurrentValue")+Object->GetLabelName() + " Param:" + pParam.GetParamDefinition().GetName() );
4998  } else {
4999  MODebug2->Error( moText("in console script: SetObjectCurrentValue : object not founded : id:")+(moText)IntToStr(objectid) );
5000  }
5001 
5002  return 0;
5003 }
5004 
5005 
5007 
5008  lua_State *state = (lua_State *) vm;
5009 
5010  MOint objectid = (MOint) lua_tonumber (state, 1);
5011  MOint paramid = (MOint) lua_tonumber (state, 2);
5012 
5013  moMoldeoObject* Object = GetObjectByIdx(objectid);
5014 
5015  if (Object && Object->GetConfig()) {
5016  int valueid = Object->GetConfig()->GetParam( paramid ).GetIndexValue();
5017  lua_pushnumber(state, (lua_Number) valueid );
5018  MODebug2->Message( moText("in lua console script: GetObjectCurrentValue")+Object->GetLabelName() );
5019  return 1;
5020  } else {
5021  MODebug2->Error( moText("in lua console script: GetObjectCurrentValue : object not founded : id:")+(moText)IntToStr(objectid) );
5022  }
5023 
5024  return 0;
5025 }
5026 
5027 
5029 
5030  lua_State *state = (lua_State *) vm;
5031 
5032  MOint objectid = (MOint) lua_tonumber (state, 1);
5033  char *text = (char *) lua_tostring (state, 2);
5034  int inletid = -1;
5035 
5036  moMoldeoObject* Object = GetObjectByIdx(objectid);
5037 
5038  if (Object) {
5039  inletid = Object->GetInletIndex( text );
5040  } else {
5041  MODebug2->Error( moText("in console script: GetObjectDataIndex : object not founded : id:")+(moText)IntToStr(objectid)+moText(" for param:")+moText(text) );
5042  }
5043 
5044  lua_pushnumber(state, (lua_Number) inletid );
5045 
5046  return 1;
5047 }
5048 
5050 
5051  lua_State *state = (lua_State *) vm;
5052 
5053  MOint objectid = (MOint) lua_tonumber (state, 1);
5054  MOint inletid = (MOint) lua_tonumber (state, 2);
5055 
5056  //MODebug2->Message( "in console script: GetObjectData : moldeo objectid: " + moText((long)objectid) );
5057 
5058  moMoldeoObject* Object = GetObjectByIdx(objectid);
5059 
5060  if (Object) {
5061  //MODebug2->Message( "in console script: GetObjectData : moldeo Object: " + moText((long)Object) );
5062  //MODebug2->Message( "in console script: GetObjectData : moldeo Object: " + Object->GetLabelName() );
5063  moInlet* pInlet = Object->GetInlets()->Get(inletid);
5064  if (pInlet) {
5065  //MODebug2->Message( "in console script: GetObjectData : moldeo Inlet: " + moText((long)pInlet) );
5066  //MODebug2->Message( "in console script: GetObjectData : moldeo Inlet: " + pInlet->GetConnectorLabelName() );
5067  moData* pData = pInlet->GetData();
5068  if (pData) {
5069  //MODebug2->Message( "in console script: GetObjectData : moldeo object: " + Object->GetLabelName()
5070  // + " inlet: " + pInlet->GetConnectorLabelName() + " Data:" + moText((long)pData)
5071  // + " Type:" + moText( (int)pData->Type() ) );
5072 
5073  switch(pData->Type()) {
5074 
5075  case MO_DATA_FUNCTION:
5076  lua_pushnumber(state, (lua_Number) pData->Eval() );
5077  return 1;
5078 
5079  case MO_DATA_NUMBER:
5080  case MO_DATA_NUMBER_CHAR:
5081  case MO_DATA_NUMBER_INT:
5082  case MO_DATA_NUMBER_LONG:
5083  case MO_DATA_NUMBER_MIDI:
5084  //MODebug2->Message( "Inlet Number:" + IntToStr(pData->Long() ) );
5085  lua_pushnumber(state, (lua_Number) pData->Long() );
5086  return 1;
5087 
5089  case MO_DATA_FONTPOINTER:
5090  case MO_DATA_IMAGESAMPLE:
5093  lua_pushnumber(state, (lua_Number) (long)pData->Pointer() );
5094  return 1;
5095 
5096  case MO_DATA_VECTOR2I:
5097  lua_pushnumber(state, (lua_Number) pData->Vector2i()->X() );
5098  lua_pushnumber(state, (lua_Number) pData->Vector2i()->Y() );
5099  return 2;
5100 
5101  case MO_DATA_VECTOR3I:
5102  lua_pushnumber(state, (lua_Number) pData->Vector3i()->X() );
5103  lua_pushnumber(state, (lua_Number) pData->Vector3i()->Y() );
5104  lua_pushnumber(state, (lua_Number) pData->Vector3i()->Z() );
5105  return 3;
5106 
5107  case MO_DATA_VECTOR4I:
5108  lua_pushnumber(state, (lua_Number) pData->Vector4i()->X() );
5109  lua_pushnumber(state, (lua_Number) pData->Vector4i()->Y() );
5110  lua_pushnumber(state, (lua_Number) pData->Vector4i()->Z() );
5111  lua_pushnumber(state, (lua_Number) pData->Vector4i()->W() );
5112  return 4;
5113 
5114  case MO_DATA_VECTOR2F:
5115  lua_pushnumber(state, (lua_Number) pData->Vector2d()->X() );
5116  lua_pushnumber(state, (lua_Number) pData->Vector2d()->Y() );
5117  return 2;
5118 
5119  case MO_DATA_VECTOR3F:
5120  lua_pushnumber(state, (lua_Number) pData->Vector3d()->X() );
5121  lua_pushnumber(state, (lua_Number) pData->Vector3d()->Y() );
5122  lua_pushnumber(state, (lua_Number) pData->Vector3d()->Z() );
5123  return 3;
5124 
5125  case MO_DATA_VECTOR4F:
5126  lua_pushnumber(state, (lua_Number) pData->Vector4d()->X() );
5127  lua_pushnumber(state, (lua_Number) pData->Vector4d()->Y() );
5128  lua_pushnumber(state, (lua_Number) pData->Vector4d()->Z() );
5129  lua_pushnumber(state, (lua_Number) pData->Vector4d()->W() );
5130  return 4;
5131 
5132  case MO_DATA_MESSAGE:
5133  case MO_DATA_MESSAGES:
5134  lua_pushstring(state, pData->ToText() );
5135  return 1;
5136 
5137  case MO_DATA_NUMBER_DOUBLE:
5138  case MO_DATA_NUMBER_FLOAT:
5139  lua_pushnumber(state, (lua_Number) pData->Double() );
5140  return 1;
5141 
5142  case MO_DATA_TEXT:
5143  lua_pushstring(state, pData->Text() );
5144  return 1;
5145 
5146  default:
5147  //MODebug2->Error( moText("in console script: GetObjectData : inlet found but type not available ")+(moText)pData->TypeToText() );
5148  MODebug2->Error( moText("in console script: GetObjectData : inlet found but type not available "));
5149  break;
5150  }
5151  } else {
5152  MODebug2->Error( moText("in console script: GetObjectData : inlet found but data is null!!!") );
5153  }
5154  } else {
5155  MODebug2->Error( moText("in console script: GetObjectData : inlet not found : id:")+(moText)IntToStr(inletid) );
5156  }
5157  } else {
5158  MODebug2->Error( moText("in console script: GetObjectData : object not found : id:")+(moText)IntToStr(objectid) );
5159  }
5160 
5161  moText tres("invalid");
5162  lua_pushstring( state, tres );
5163  return 1;
5164 }
5165 
5167  double deluavalor = -1.0f;
5168  lua_State *state = (lua_State *) vm;
5169 
5170  MOint objectid = (MOint) lua_tonumber (state, 1);
5171  MOint inletid = (MOint) lua_tonumber (state, 2);
5172 
5173  moMoldeoObject* Object = GetObjectByIdx(objectid);
5174 
5175  if (Object) {
5176  moInlet* pInlet = Object->GetInlets()->Get(inletid);
5177  if (pInlet) {
5178  moData* pData = pInlet->GetInternalData();
5179  if (pData) {
5180  switch(pData->Type()) {
5181  case MO_DATA_NUMBER:
5182  case MO_DATA_NUMBER_CHAR:
5183  case MO_DATA_NUMBER_INT:
5184  case MO_DATA_NUMBER_LONG:
5185  case MO_DATA_NUMBER_MIDI:
5186  pData->SetLong( (MOlong) lua_tonumber ( state, 3 ) );
5187  pInlet->Update(true);
5188  return 0;break;
5189 
5191  case MO_DATA_FONTPOINTER:
5192  case MO_DATA_IMAGESAMPLE:
5195  //pData->SetLong( (MOlong) lua_tonumber ( state, 3 ) );
5196  return 0;break;
5197 
5198  case MO_DATA_VECTOR2I:
5199  (*pData->Vector2i()) = moVector2i( (MOlong) lua_tonumber ( state, 3 ),
5200  (MOlong) lua_tonumber ( state, 4 ) );
5201  pInlet->Update(true);
5202  return 0;break;
5203 
5204  case MO_DATA_VECTOR3I:
5205  (*pData->Vector3i()) = moVector3i( (MOlong) lua_tonumber ( state, 3 ),
5206  (MOlong) lua_tonumber ( state, 4 ),
5207  (MOlong) lua_tonumber ( state, 5 ) );
5208  pInlet->Update(true);
5209  return 0;break;
5210 
5211  case MO_DATA_VECTOR4I:
5212  (*pData->Vector4i()) = moVector4i( (MOlong) lua_tonumber ( state, 3 ),
5213  (MOlong) lua_tonumber ( state, 4 ),
5214  (MOlong) lua_tonumber ( state, 5 ),
5215  (MOlong) lua_tonumber ( state, 6 ) );
5216  pInlet->Update(true);
5217  return 0;break;
5218 
5219  case MO_DATA_VECTOR2F:
5220  (*pData->Vector2d()) = moVector2d( (MOdouble) lua_tonumber ( state, 3 ),
5221  (MOdouble) lua_tonumber ( state, 4 ));
5222  pInlet->Update(true);
5223  return 0;break;
5224 
5225  case MO_DATA_VECTOR3F:
5226  (*pData->Vector3d()) = moVector3d( (MOdouble) lua_tonumber ( state, 3 ),
5227  (MOdouble) lua_tonumber ( state, 4 ),
5228  (MOdouble) lua_tonumber ( state, 5 ));
5229  pInlet->Update(true);
5230  return 0;break;
5231 
5232  case MO_DATA_VECTOR4F:
5233  (*pData->Vector4d()) = moVector4d( (MOdouble) lua_tonumber ( state, 3 ),
5234  (MOdouble) lua_tonumber ( state, 4 ),
5235  (MOdouble) lua_tonumber ( state, 5 ),
5236  (MOdouble) lua_tonumber ( state, 6 ) );
5237  pInlet->Update(true);
5238  return 0;break;
5239 
5240  case MO_DATA_MESSAGE:
5241  case MO_DATA_MESSAGES:
5242  return 0;break;
5243 
5244  case MO_DATA_NUMBER_DOUBLE:
5245  case MO_DATA_NUMBER_FLOAT:
5246  deluavalor = (MOdouble) lua_tonumber ( state, 3 );
5247  pData->SetDouble( deluavalor );
5248  pInlet->Update(true);
5249  return 0;break;
5250 
5251  case MO_DATA_TEXT:
5252  //lua_pushstring(state, pData->Text() );
5253  pData->SetText( lua_tostring ( state, 3 ) );
5254  pInlet->Update(true);
5255  return 0;
5256  break;
5257  default:
5258  break;
5259  }
5260  }
5261  } else {
5262  MODebug2->Error( moText("in console script: SetObjectData : inlet id not found : id:")+(moText)IntToStr(inletid) );
5263  }
5264  } else {
5265  MODebug2->Error( moText("in console script: SetObjectData : object not found : id:")+(moText)IntToStr(objectid) );
5266  }
5267 
5268  return 0;
5269 }
5270 
5271 
5273 
5274  lua_State *state = (lua_State *) vm;
5275 
5276  MOint objectid = (MOint) lua_tonumber (state, 1);
5277 
5278  moMoldeoObject* Object = GetObjectByIdx(objectid);
5279  moEffect* pEffect = NULL;
5280 
5281  moEffectState fxstate;
5282 
5283 
5284  if (Object && Object->GetConfig()) {
5285 
5286  switch (Object->GetType()) {
5287  case MO_OBJECT_EFFECT:
5288  case MO_OBJECT_PREEFFECT:
5289  case MO_OBJECT_POSTEFFECT:
5291  pEffect = (moEffect*) Object;
5292  fxstate = pEffect->GetEffectState();
5293  fxstate.alpha = (MOfloat) lua_tonumber (state, 2);
5294  fxstate.tint = (MOfloat) lua_tonumber (state, 3);
5295  fxstate.tintr = (MOfloat) lua_tonumber (state, 4);
5296  fxstate.tintg = (MOfloat) lua_tonumber (state, 5);
5297  fxstate.tintb = (MOfloat) lua_tonumber (state, 6);
5298  fxstate.tempo.ang = (MOfloat) lua_tonumber (state, 7);
5299 
5300  SetEffectState( Object->GetId(), fxstate);
5301  break;
5302  default:
5303  break;
5304  }
5305 
5306  } else {
5307  MODebug2->Error( moText("in console script: SetEffectState : object not founded : id:")+(moText)IntToStr(objectid) );
5308  }
5309 
5310  return 0;
5311 
5312 }
5313 
5315  lua_State *luastate = (lua_State *) vm;
5316 
5317  MOint objectid = (MOint) lua_tonumber (luastate, 1);
5318 
5319  moMoldeoObject* Object = GetObjectByIdx(objectid);
5320  moEffect* pEffect = NULL;
5321 
5322 
5323  if (Object && Object->GetConfig()) {
5324  switch (Object->GetType()) {
5325  case MO_OBJECT_EFFECT:
5326  case MO_OBJECT_PREEFFECT:
5327  case MO_OBJECT_POSTEFFECT:
5329  pEffect = (moEffect*) Object;
5330  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().alpha );
5331  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().tint );
5332  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().tintr );
5333  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().tintg );
5334  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().tintb );
5335  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().tempo.ang );
5336  return 6;
5337 
5338  default:
5339  MODebug2->Error( moText("in console script: GetEffectState : not an Effect! ") + (moText)Object->GetLabelName() );
5340  break;
5341  }
5342  } else {
5343  MODebug2->Error( moText("in console script: GetEffectState : object or config not founded > id: ")
5344  +(moText)IntToStr(objectid)
5345  + moText(" label name: ")
5346  + (moText)Object->GetLabelName() );
5347  }
5348 
5349  return 0;
5350 }
5351 
5353 {
5354  lua_State *state = (lua_State *) vm;
5355 
5356  MOint objectid = (MOint) lua_tonumber (state, 1);
5357  MOint devicecode = (MOint) lua_tonumber (state, 2);
5358  MOint codevalue = -1;
5359 
5360  moMoldeoObject* Object = GetObjectByIdx(objectid);
5361 
5362  if (Object && Object->GetConfig()) {
5363  if (Object->GetType()==MO_OBJECT_IODEVICE) {
5364  moIODevice* pDevice = (moIODevice*) Object;
5365  if (pDevice->GetStatus(devicecode)) {
5366  codevalue = pDevice->GetValue( devicecode );
5367  }
5368  }
5369  lua_pushnumber(state, (lua_Number) codevalue );
5370  } else {
5371  MODebug2->Error( moText("in console script: GetDeviceCode : object not founded : id:")+(moText)IntToStr(objectid));
5372  }
5373 
5374  return 1;
5375 }
5376 
5378 {
5379  lua_State *state = (lua_State *) vm;
5380 
5381  MOint objectid = (MOint) lua_tonumber (state, 1);
5382  char *devicecodestr = (char *) lua_tostring (state, 2);
5383  MOint devicecode = -1;
5384 
5385  moMoldeoObject* Object = GetObjectByIdx(objectid);
5386 
5387  if (Object && Object->GetConfig()) {
5388  if (Object->GetType()==MO_OBJECT_IODEVICE) {
5389  moIODevice* pDevice = (moIODevice*) Object;
5390  devicecode = pDevice->GetCode(devicecodestr);
5391  }
5392  lua_pushnumber(state, (lua_Number) devicecode );
5393  } else {
5394  MODebug2->Error( moText("in console script: GetDeviceCodeId : object not founded : id:")+(moText)IntToStr(objectid));
5395  }
5396 
5397  return 1;
5398 }
5399 
5400 int
5402 
5403  lua_State *state = (lua_State *) vm;
5404 
5405  MOint deviceid = (MOint) lua_tonumber (state, 1);
5406  MOint devicecode = (MOint) lua_tonumber (state, 2);
5407  MOint val0 = (MOint) lua_tonumber (state, 3);
5408  MOint val1 = (MOint) lua_tonumber (state, 4);
5409  MOint val2 = (MOint) lua_tonumber (state, 5);
5410  MOint val3 = (MOint) lua_tonumber (state, 6);
5411 
5412  moEventList* pEvents;
5413 
5414  pEvents = m_pIODeviceManager->GetEvents();
5415 
5416  if (pEvents) {
5417  pEvents->Add( deviceid, devicecode, val0, val1,val2,val3 );
5418  }
5419 
5420  return 0;
5421 
5422 }
5423 
5424 
5426  lua_State *state = (lua_State *) vm;
5427 
5428  char *pathname = (char *) lua_tostring (state, 1);
5429 
5430  int filecount = -1;
5431 
5432  filecount = this->GetDirectoryFileCount( pathname );
5433 
5434  lua_pushnumber(state, (lua_Number) filecount );
5435 
5436  if (filecount==-1) {
5437  MODebug2->Error( moText("console lua script: GetDirectoryFileCount > Directory doesn't exist") );
5438  }
5439 
5440  return 1;
5441 
5442 }
5443 
5445  lua_State *state = (lua_State *) vm;
5446 
5447  char *pathname = (char *) lua_tostring (state, 1);
5448 
5449  int res = -1;
5450 
5451  //filecount = this->GetDirectoryFileCount( pathname );
5452 
5453  //lua_pushnumber(state, (lua_Number) filecount );
5454 /*
5455  if (filecount==-1) {
5456  MODebug2->Error( moText("console lua script: GetDirectoryFileCount > Directory doesn't exist") );
5457  }
5458 */
5459  res = this->m_pResourceManager->GetRenderMan()->Screenshot( moText(pathname), m_LastScreenshot );
5460 
5461  lua_pushnumber(state, (lua_Number) res );
5462 
5463  return 1;
5464 
5465 }
5466 
5468  return moMoldeoObject::ToJSON();
5469 }
5470 
5471 int
5472 moConsole::TestScreen( const moDisplay& p_display_info ) {
5473 
5474 
5475  moShaderManager* pSMan;
5476  moGLManager* pGLMan;
5477  moRenderManager* pRMan;
5478  moTextureManager* pTMan;
5479 
5480  if (m_pResourceManager==NULL) {
5482  m_pResourceManager->Init( "", "", m_Config, 0, p_display_info.Resolution().Width(), p_display_info.Resolution().Height() );
5483  //m_pResourceManager->Init( "", "", m_Config, 0, 1280, 720);
5484  }
5485 
5486  //int tick = moGetTicksAbsolute( true );
5488  float stepi = m_ConsoleState.step_interval;
5490  float progress = (steps/stepi)/120.0;
5491 
5492  glClearColor( 1.0f - progress, 1.0f - progress, 1.0f - progress, 1.0 );
5493  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
5494 
5495  if (m_pResourceManager) {
5496  pSMan = m_pResourceManager->GetShaderMan();
5497  if (!pSMan) return 0;
5498 
5499  pGLMan = m_pResourceManager->GetGLMan();
5500  if (!pGLMan) return 0;
5501 
5502  pRMan = m_pResourceManager->GetRenderMan();
5503  if (!pRMan) return 0;
5504 
5505  pTMan = m_pResourceManager->GetTextureMan();
5506  if (!pTMan) return 0;
5507 
5508  } else return 0;
5509 
5510 
5511 
5512 
5513 
5521  glEnable(GL_DEPTH_TEST);
5522  glDisable(GL_BLEND);
5523  //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
5524  //moPlaneGeometry Plane2( 1.0, 1.0, 1, 1 );
5525 
5527  moMaterial Mat;
5528  Mat.m_Map = pTMan->GetTexture(pTMan->GetTextureMOId( "default", false ));
5529  Mat.m_MapGLId = Mat.m_Map->GetGLId();
5530  Mat.m_Color = moColor( 1.0, 1.0, 1.0 );
5531  Mat.m_fTextWSegments = 13.0f;
5532  Mat.m_fTextHSegments = 13.0f;
5533  Mat.m_vLight = moVector3f( -1.0, -1.0, -1.0 );
5534  Mat.m_vLight.Normalize();
5535  //Mat.m_PolygonMode = MO_POLYGONMODE_LINE;
5537  Mat.m_fWireframeWidth = 0.0005f;
5538 
5540  moSphereGeometry Sphere( 0.5, 13, 13 );
5541 
5543  moGLMatrixf Model;
5544  Model.MakeIdentity()
5545  .Rotate( 360.0*progress*moMathf::DEG_TO_RAD, 0.0, 1.0, 0.0 )
5546  .Translate( 0.0, 0.0, -2.618 + 0.618*progress );
5547  moMesh Mesh( Sphere, Mat );
5548  Mesh.SetModelMatrix(Model);
5549 
5551  moCamera3D Camera3D;
5552  pGLMan->SetDefaultPerspectiveView( p_display_info.Resolution().Width(), p_display_info.Resolution().Height() );
5553  // Camera3D.MakePerspective(60.0f, p_display_info.Proportion(), 0.01f, 1000.0f );
5554  Camera3D = pGLMan->GetProjectionMatrix();
5555 
5557  pRMan->Render( &Mesh, &Camera3D );
5558 
5565  glClear( GL_DEPTH_BUFFER_BIT);
5566 
5567  glDisable(GL_DEPTH_TEST);
5568  glEnable(GL_BLEND);
5569  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
5570 
5572  moMaterial Mat2;
5573  Mat2.m_Map = pTMan->GetTexture(pTMan->GetTextureMOId( "moldeotrans", false ));
5574  Mat2.m_MapGLId = Mat2.m_Map->GetGLId();
5575  Mat2.m_Color = moColor( 1.0, 1.0, 1.0 );
5576  Mat2.m_vLight = moVector3f( -1.0, -1.0, -1.0 );
5577  Mat2.m_vLight.Normalize();
5578 
5580  moPlaneGeometry Plane3( 1.0, 0.33, 1, 1 );
5581 
5583  moGLMatrixf Model2;
5584  Model2.MakeIdentity();
5585  Model2.Scale( 1.0, 1.0, 1.0 );
5586  Model2.Translate( 0.0, 0.0, 0.0 );
5587  moMesh Mesh2( Plane3, Mat2 );
5588  Mesh2.SetModelMatrix(Model2);
5589 
5591  moCamera3D Camera3D2;
5592  pGLMan->SetDefaultOrthographicView( p_display_info.Resolution().Width(), p_display_info.Resolution().Height() );
5593  Camera3D2 = pGLMan->GetProjectionMatrix();
5594 
5596  pRMan->Render( &Mesh2, &Camera3D2 );
5597 
5598 
5599 
5600  return 1;
5601 }
int EffectPlay(int m_MoldeoObjectId)
Definition: moConsole.cpp:4267
void UnloadIODevices()
Definition: moConsole.cpp:824
int iligia
Definition: moConsole.h:572
int luaSetEffectState(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5272
moVector3f m_vLight
Definition: moGUIManager.h:250
virtual void Deactivate()
int GetPreset()
devuelve el preset actualmente seleccionado
Definition: moConsole.cpp:4391
void UpdateMoldeoIds()
Definition: moConsole.cpp:506
moGLMatrixf & Scale(float sx, float sy, float sz)
static TMapStrToActionType m_MapStrToActionType
Definition: moActions.h:811
virtual int NextScriptCalling()
Definition: moScript.h:178
const moText & GetLabelName() const
Devuelve la etiqueta de este objeto.
moTimerState GetConsoleState()
devuelve el estado del reloj de la consola
Definition: moConsole.cpp:4184
Valor de un Parámetro.
Definition: moValue.h:501
static bool CopyFile(moText FileSrc, moText FileDst)
moEffectManager m_EffectManager
Definition: moConsole.h:566
MOboolean Initialized()
Pregunta si está inicializado.
Definition: moAbstract.cpp:153
int RegisterBaseFunction(const char *strFuncName)
Definition: moScript.cpp:340
moText GetFullName()
Retreive full file name: return "myFileName" for "myFileName.txt".
moResource * GetResource(MOint p_index)
moMoldeoObjectType
Tipos de objetos en Moldeo.
Definition: moTypes.h:525
void ConsoleRecordSession()
inicia la grabación de la sesión actual
Definition: moConsole.cpp:4122
int luaGetEffectState(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5314
moVector4i * Vector4i()
Definition: moValue.cpp:400
virtual int Save(const moText &p_save_filename=moText(""))
moEvent * next
Definition: moEventList.h:60
moEffect * New(moMobDefinition &p_MobDefinition)
Genera un nuevo efecto a partir de la definición.
#define MO_CFG_EFFECT_PRE
Definition: moConsole.h:65
moConsoleMode
bool IsInitialized()
Definition: moScript.h:74
moIODevice * NewIODevice(const moText &p_devname, const moText &p_configname, const moText &p_labelname, const moText &p_keyname, moMoldeoObjectType p_type, int paramindex=-1, int valueindex=-1, bool p_activate=true)
moResourceManager * GetResourceManager()
void SetText(moText ptext)
Definition: moValue.cpp:158
MOdouble Eval()
Definition: moValue.cpp:424
moVideoManager * GetVideoMan()
const moText & GetName()
Devuelve el nombre del archivo de configuraci�n.
Definition: moConfig.h:234
moEvent * First
Definition: moEventList.h:145
"valueset" > MO_ACTION_VALUE_SET
Definition: moActions.h:132
#define SDL_KEYDOWN
Definition: moConsole.cpp:51
#define MOulong
Definition: moTypes.h:392
virtual void DrawMasterEffects(int interface_width=0, int interface_height=0)
Definition: moConsole.cpp:1674
moVector4< MOlong > moVector4i
void SetDefaultOrthographicView(MOint p_width=0, MOint p_height=0)
Clase Evento.
Definition: moEventList.h:56
1: config full file path
Definition: moActions.h:290
float m_fTextHSegments
Definition: moGUIManager.h:249
moEffectManager * m_pEffectManager
#define MO_MOLDEOSCENEOBJECTS_OFFSET_ID
scene objects are recursive sub-scene-fx&#39;s
#define SDL_KEYDOWN_SDL2
Definition: moConsole.cpp:52
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.
moEffectsArray & Effects()
int EffectPause(int m_MoldeoObjectId)
Definition: moConsole.cpp:4282
void SetName(const moText &p_name)
moDataType Type() const
Definition: moValue.cpp:940
int luaGetDirectoryFileCount(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5425
MOboolean RemoveIODevice(MOint p_ID)
Recurso ( objeto para cargar y manipular objetos físicos de datos de imágenes, audio, video, 3d, 2d, fuentes, shaders y de cualquier otro tipo extendible por un plugin )
void LoadResources()
Definition: moConsole.cpp:1209
int luaGetTicks(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4790
void Update()
Definition: moFile.cpp:374
int Height() const
virtual moMoldeoObject * GetObjectByIdx(int p_object_id)
Definition: moConsole.cpp:4445
MOdouble Double() const
Definition: moValue.cpp:859
#define moDefineParamIndex(X, Y)
Definition: moConfig.h:176
"objectgetstate" : OBJECT_GETSTATE
Definition: moActions.h:299
"effectplay" : MO_ACTION_EFFECT_PLAY
Definition: moActions.h:446
float m_fTextWSegments
Definition: moGUIManager.h:248
virtual void Start()
Inicia el temporizador.
Definition: moTimer.cpp:196
const moText & GetConfigName() const
Nombre del archivo de configuración.
Conector Inlet, conector que recibe datos.
Definition: moConnectors.h:374
moParamReference moR
Definition: moParam.h:127
void SetConfigName(const moText &p_configname)
MOint deviceid
Definition: moEventList.h:62
MOpointer pointer
Definition: moEventList.h:68
MOswitch stereo
moData * GetInternalData()
moValueBase & GetSubValue(MOint p_indexsubvalue=0)
Definition: moValue.h:539
"consolescreenshot" : MO_ACTION_CONSOLE_SCREENSHOT
Definition: moActions.h:576
"consolepresentation" : MO_ACTION_CONSOLE_PRESENTATION
Definition: moActions.h:595
virtual long Duration()
Devuelve el valor del reloj del temporizador.
Definition: moTimer.cpp:211
"consolesetstate" : MO_ACTION_CONSOLE_SETSTATE
Definition: moActions.h:649
int SetEffectState(int m_MoldeoObjectId, const moEffectState &p_effect_state)
Definition: moConsole.cpp:4190
#define MO_ACTION_MOLDEOAPI_EVENT_SEND
Definition: moActions.h:46
"objetenable" : MO_ACTION_OBJECT_ENABLE
Definition: moActions.h:371
MOint GetCurrentPreConf()
Devuelve el �ndice de la preconfiguraci�n seleccionada.
Definition: moConfig.cpp:1617
param 1: event info
Definition: moActions.h:508
MOboolean Delete(moEvent *ev)
virtual MOboolean CreateConnectors()
virtual MOint GetValue(MOdevcode)=0
virtual void Play()
Definition: moEffect.cpp:959
virtual int Save(const moText &p_save_filename=moText(""))
Definition: moConsole.cpp:3997
moText m_LastScreenshot
Definition: moConsole.h:579
moRenderManagerMode
value type: NUM or FUNCTION
Definition: moParam.h:47
const moText & ToJSON()
Definition: moConsole.cpp:5467
moPresetParamDefinition & operator=(const moPresetParamDefinition &src)
Definition: moConsole.cpp:80
int luaPause(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4672
void SetDouble(MOdouble pdouble)
Definition: moValue.cpp:172
moPresetParams m_PresetParams
Definition: moConsole.h:622
int luaEffectTimerState(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4907
value type: TXT or LNK
Definition: moParam.h:56
const moText & GetName() const
Nombre del objeto.
void LoadEffects()
Definition: moConsole.cpp:1063
int EffectStop(int m_MoldeoObjectId)
Definition: moConsole.cpp:4298
bool NextValue()
Selecciona el pr�ximo valor del par�metro actual.
Definition: moConfig.cpp:1576
moEffectManager & GetEffectManager()
virtual MOulong GetTicks()
Definition: moConsole.cpp:1440
moConnections * GetConnections()
Devuelve las conecciones de un outlet.
param 1: object name | object id
Definition: moActions.h:363
int DuplicateMob(const moMobDefinition &p_MobDef)
Definition: moConsole.cpp:3471
virtual void LoadCodes(moIODeviceManager *)
Definition: moEffect.cpp:460
moDatas moDataMessage
Definition: moValue.h:149
LIBMOLDEO_API moText0 FloatToStr(double a)
Definition: moText.cpp:1134
Recursos de datos, objetos, imágenes, videos y funcionalidades múltiples.
Definition: moTypes.h:533
bool Started() const
Devuelve el estado del temporizador.
Definition: moTimer.h:248
moRenderManager * GetRenderMan()
void SetPreconfig(int valueindex, moPreconfigIndexes &p_preconfindexes)
Setea una pre-configuraci�n.
Definition: moConfig.cpp:1740
#define MOboolean
Definition: moTypes.h:385
int RelativeToGeneralIndex(int relativeindex, moMoldeoObjectType p_type)
Definition: moConsole.cpp:135
void ConsoleRenderSession(const moText &p_frame_quality=moText("JPGGOOD"))
inicia el renderizado de una sesión pregrabada
Definition: moConsole.cpp:4129
Matrices para transformaciones en Open GL.
Definition: moGLManager.h:71
bool Render(moConsoleState &p_console_state)
stop record
virtual void Activate()
int Render(moObject3D *p_pObj, moCamera3D *p_pCamera)
MOboolean m_bIODeviceManagerDefault
Definition: moConsole.h:562
Real W() const
Definition: moMathVector4.h:81
moEffectsArray & AllEffects()
value type: NUM or FUNCTION
Definition: moParam.h:68
moMasterEffectsArray & MasterEffects()
virtual int ScriptCalling(moLuaVirtualMachine &vm, int iFunctionNumber)
int luaGetObjectParamIndex(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4937
MOuint tickselapsed
Definition: moConsole.h:577
const moText & GetKeyName() const
int GetParamIndex(moText p_paramname)
Devuelve el �ndice correspondiente al par�metro por nombre.
Definition: moConfig.cpp:1008
virtual MOdevcode GetCode(moText)=0
Objeto dibujable, efecto-maestro ( puede controlar otros efectos )
Definition: moTypes.h:531
"consolerendersession" : MO_ACTION_CONSOLE_RECORD_SESSION
Definition: moActions.h:529
int luaScreenshot(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5444
param 1: effect label name | effect id
Definition: moActions.h:416
int iborrado
Definition: moConsole.h:572
MOint Int() const
Definition: moValue.cpp:773
void StartMasterEffects()
Definition: moConsole.cpp:1378
moMoldeoActionType GetActionType() const
MOint Int(moParamReference p_paramreference)
Acceso r�pido a un valor entero.
Definition: moConfig.cpp:1042
bool RunSelectedFunction(int nReturns=0)
Definition: moScript.cpp:529
void InitializeAllEffects()
Definition: moConsole.cpp:1285
moStereoSides stereoside
1: father object name | id, 2: object info
Definition: moActions.h:274
virtual void Pause()
Definition: moEffect.cpp:969
void moContinueTimer()
Continua luego de una pausa el temporizador global.
Definition: moTimer.cpp:120
void UnloadMasterEffects()
Definition: moConsole.cpp:963
#define MO_DEF_SCREEN_HEIGHT
Definition: moConsole.h:77
"preconfigadd" > MO_ACTION_PRECONFIG_ADD
Definition: moActions.h:206
int luaAddEvent(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5401
MOboolean Finish()
Finaliza el objeto, libera recursos.
"consolepresetdelete" : MO_ACTION_CONSOLE_PRESET_DELETE
Definition: moActions.h:681
void ConsoleSaveSessionAs()
salva la sesión a un archivo
Definition: moConsole.cpp:4136
int GetIndexValue() const
Definition: moParam.cpp:1227
bool IsValid() const
Objeto válido.
#define MO_EFFECTS_TEX
Definition: moTypes.h:422
virtual MOboolean Init()
MOboolean RenderResEqualScreenRes()
#define SDLK_F12
Definition: moConsole.cpp:55
void SetLabelName(const moText &p_labelname)
Fija la etiqueta de este objeto.
Conector Outlet, conector que envía datos.
Definition: moConnectors.h:410
moInlets * GetInlets()
"consolepresetset" : MO_ACTION_CONSOLE_PRESET_SET
Definition: moActions.h:701
int TestScreen(const moDisplay &p_display_info)
Definition: moConsole.cpp:5472
int luaSetPreset(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4730
Clase Mensaje.
Definition: moEventList.h:97
virtual void SetConsoleValueIndex(MOint p_valueindex)
void StopMasterEffects()
Definition: moConsole.cpp:1411
static moText GetTypeToName(moMoldeoObjectType p_Type=MO_OBJECT_UNDEFINED)
Transforma un moMoldeoObjectType en el nombre de su correspondiente.
int SetParam(int m_MoldeoObjectId, int m_ParamId, const moParamDefinition &p_param_definition)
Definition: moConsole.cpp:4208
virtual void ScriptExeInit()
Corre la funcion de script Run o Compila el nuevo script.
#define MO_RENDER_RESOLUTION
static moText GetTypeToClass(moMoldeoObjectType p_Type=MO_OBJECT_UNDEFINED)
Transforma un moMoldeoObjectType en el nombre de su correspondiente clase base.
virtual MOboolean Finish()
Finaliza el objeto, libera recursos.
void SetTicks(int ticksid)
Definition: moConsole.cpp:4420
moGLMatrixf & Rotate(float angle, float vx, float vy, float vz)
int luaState(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4691
bool Record(moConsoleState &p_console_state)
stop playback
#define MO_CFG_EFFECT
Definition: moConsole.h:62
Objeto indefinido.
Definition: moTypes.h:527
MOulong moGetTicksAbsolute(bool force_real_absolute)
Devuelve en milisegundos el valor del reloj de Moldeo.
Definition: moTimer.cpp:15
void Warning(moText p_text)
Anuncia y registra un llamado de atencion.
Definition: moAbstract.cpp:97
int RefreshValue(int m_MoldeoObjectId, int m_ParamId, int m_ValueId, bool p_Refresh=true)
Definition: moConsole.cpp:4246
void AddSubValue(const moText &strvalue, moValueType p_valuetype)
Definition: moValue.cpp:1707
void UnloadPreEffects()
Definition: moConsole.cpp:1050
void SetLong(MOlonglong plong)
Definition: moValue.cpp:188
Definition: moPostEffect.h:53
long m_ParamId
Opcional para identificación del índice único de objeto.
virtual const moText & GetConnectorLabelName() const
MOuint Length() const
Definition: moText.cpp:347
"consolepause" : MO_ACTION_CONSOLE_PAUSE
Definition: moActions.h:543
const moResolution & Resolution() const
int luaEffectStop(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4860
#define MOswitch
Definition: moTypes.h:386
const moText & GetLabelName() const
Real Y() const
Definition: moMathVector4.h:77
moGLManager * GetGLMan()
clase base para definir Pre-Efectos.
Definition: moPreEffect.h:59
void SetCompletePath(moText p_completepath)
Definition: moFile.cpp:482
static bool CopyDirectory(const moText &DirSrc, const moText &DirDst)
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
#define MO_LEFT_TEX
Definition: moTypes.h:426
MOboolean Exists()
Definition: moFile.cpp:436
moText m_ConsoleScript
Definition: moConsole.h:570
moParamDefinition m_ParamDefinition
Valor del dato agregado o modificado.
MOint GetInletIndex(moText p_connector_name) const
moShaderManager * GetShaderMan()
void DrawTexture(MOint p_resolution, MOint p_tex_num)
MOint GetParamIndex() const
#define MOfloat
Definition: moTypes.h:403
MOboolean IsRenderToFBOEnabled()
void SetDuration(MOlong p_fun_duration)
Definition: moParam.cpp:734
const moText & ToJSON()
int luaPlay(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4663
MOpointer Pointer()
Definition: moValue.cpp:919
#define MO_SCREEN_RESOLUTION
virtual MOboolean Init()
int luaObjectDisable(moLuaVirtualMachine &vm)
habilita deshabilita
Definition: moConsole.cpp:4818
bool Set(int fx_index, moMoldeoObject *p_pMOB)
MOuint GetValuesCount() const
Definition: moParam.cpp:1065
value type: TXT or LNK
Definition: moParam.h:57
#define MO_CFG_RESOURCE_LABEL
virtual double Alpha(double alpha)
Definition: moEffect.cpp:879
virtual void InitResources(moResourceManager *pResourceManager, moText p_apppath, moText p_datapath, moConfig &p_consoleconfig, MOint p_render_to_texture_mode=MO_RENDER_TO_TEXTURE_FBSCREEN, MOint p_screen_width=MO_DEF_SCREEN_WIDTH, MOint p_screen_height=MO_DEF_SCREEN_HEIGHT, MOint p_render_width=MO_DEF_RENDER_WIDTH, MOint p_render_height=MO_DEF_RENDER_HEIGHT, MO_HANDLE p_OpWindowHandle=0, MO_DISPLAY p_Display=NULL)
inicializa el administrador de recursos
Definition: moConsole.cpp:209
"objectgetpreconfig" : MO_ACTION_OBJECT_GETPRECONFIG
Definition: moActions.h:316
MOboolean m_bExternalResources
Definition: moConsole.h:560
"valueget" > MO_ACTION_VALUE_GET
Definition: moActions.h:142
moPolygonModes m_PolygonMode
Definition: moGUIManager.h:276
int SendMoldeoAPIMessage(moDataMessage *p_pDataMessage)
Definition: moConsole.cpp:1883
Lista de eventos.
Definition: moEventList.h:139
clase de para manejar textos
Definition: moText.h:75
moTexture * GetTexture(MOuint p_moid)
#define MO_FINAL_TEX
Definition: moTypes.h:423
virtual void TurnOff()
Definition: moEffect.cpp:785
moIODeviceManager * m_pIODeviceManager
Definition: moConsole.h:563
"consolesaves" : MO_ACTION_CONSOLE_SAVEAS
Definition: moActions.h:566
void UnloadResources()
Definition: moConsole.cpp:1271
const moText & ToJSON()
Definition: moParam.cpp:1368
MOlonglong Long() const
Definition: moValue.cpp:804
MOuint GetValuesCount(int p_paramindex)
Devuelve la cantidad de valores que contiene el par�metro indexado.
Definition: moConfig.cpp:1019
bool LabelNameExists(const moText &labelname)
existe ya esta etiqueta dentro de los MOBs de esta consola
Definition: moConsole.cpp:114
virtual void Stop()
Definition: moEffect.cpp:964
moResourceManager * m_pResourceManager
Puntero al administrador de recursos.
bool GetActivate() const
Devuelve el modo de activación al inicio del proyecto.
void SetConsoleValueIndex(MOint p_valueindex)
#define MOlong
Definition: moTypes.h:391
void SetInterfaceView(int p_width, int p_height)
const moText & ToJSON()
Definition: moValue.cpp:1858
virtual const moEffectState & GetEffectState()
Definition: moEffect.cpp:88
void Stop()
Detiene el temporizador.
Definition: moTimer.h:219
Clase Base Descriptiva de un Objeto Moldeo.
int HexToInt(const moText &hex)
Definition: moText.cpp:1184
void SetInterpolationFunction(const moText &p_interpol_fun)
Definition: moParam.cpp:749
virtual MOboolean Init()
moMoldeoObjects & GetMoldeoObjects()
Definition: moConsole.cpp:192
int luaGetDeviceCodeId(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5377
virtual MOboolean Init()
Inicializa el objeto.
virtual const moText & StateToStr()
Definition: moTimer.h:277
int luaGetObjectDataIndex(moLuaVirtualMachine &vm)
especificos de datos
Definition: moConsole.cpp:5028
moText GetDestinationMoldeoLabelName()
"consolerecordsession" : MO_ACTION_CONSOLE_RECORD_SESSION
Definition: moActions.h:522
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
moGLMatrixf & MakeIdentity()
Definition: moGLManager.cpp:79
virtual void GLSwapBuffers()
Definition: moConsole.cpp:1447
void LoadMasterEffects()
Definition: moConsole.cpp:911
MOboolean RemoveResource(MOint p_index)
virtual moConfigDefinition * GetDefinition(moConfigDefinition *p_configdefinition=NULL)
moText GetDestinationConnectorLabelName()
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:1501
void Fix()
Corrige el reloj.
Definition: moTimer.cpp:262
int luaStop(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4681
void SetProperty(const moText &p_Property)
Definition: moParam.h:295
bool AddKey(const moDataSessionKey &p_key)
void SetMoldeoFatherId(MOint p_moldeoid)
Fija el identificador del padre de este objeto.
moGLMatrixf & Translate(float x, float y, float z)
void SetPreset(int presetid)
fija el preset seleccionado
Definition: moConsole.cpp:4396
#define MO_RIGHT_TEX
Definition: moTypes.h:427
moText0 moText
Definition: moText.h:291
moConfig m_Config
Configuración de parámetros del objeto.
void RegisterFunctions()
beware ! call only once or die!!!
Definition: moConsole.cpp:4482
Parado, Detenido.
Definition: moTimer.h:77
moColorRGB moColor
Definition: moGUIManager.h:49
moPostEffectsArray & PostEffects()
void LoadObjects(moMoldeoObjectType fx_type=MO_OBJECT_UNDEFINED)
Definition: moConsole.cpp:692
void SetDestinationMoldeoId(MOint p_DestinationMoldeoId)
void moStopTimer()
Detiene el temporizador global.
Definition: moTimer.cpp:124
#define MO_CFG_EFFECT_LABEL
Definition: moConsole.h:64
const moMobDefinition & GetMobDefinition() const
"consolepreviewshot" : MO_ACTION_CONSOLE_PREVIEW_SHOT
Definition: moActions.h:588
void moSetDuration(MOulong p_timecode)
Fija el valor del reloj del temporizador global.
Definition: moTimer.cpp:128
moText fps_text
Definition: moConsole.h:578
MOdouble getTempo()
Definition: moTempo.cpp:153
#define MOint
Definition: moTypes.h:388
int luaSetObjectPreconf(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4759
moResource * NewResource(const moText &p_resname, const moText &p_configname, const moText &p_labelname, const moText &p_keyname, int paramindex=-1, int valueindex=-1, bool p_activate=true)
virtual MOboolean Init()=0
#define MO_CFG_EFFECT_ON
Definition: moConsole.h:66
moTimerState
Estado del temporizador.
Definition: moTimer.h:75
void moStartTimer()
Inicia el temporizador global.
Definition: moTimer.cpp:112
"effectpause" : MO_ACTION_EFFECT_PAUSE
Definition: moActions.h:464
Real Z() const
Definition: moMathVector3.h:77
int Width() const
moFileArray & GetFiles()
Definition: moFile.cpp:381
int idebug
Definition: moConsole.h:572
int luaSetObjectData(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5166
moFileManager * GetFileMan()
MOuint ticksprevious
Definition: moConsole.h:577
virtual int ResetScriptCalling()
Definition: moScript.h:172
"preconfigset" > MO_ACTION_PRECONFIG_SET
Definition: moActions.h:237
const moDataSessionKey & NextKey(moConsoleState &m_ConsoleState)
virtual void Draw()
Dibuja.
Definition: moConsole.cpp:1482
int MoveMob(const moMobDefinition &p_MobDef, int position)
Definition: moConsole.cpp:3315
"objectgetpreconfig" : MO_ACTION_OBJECT_GETPRECONFIG
Definition: moActions.h:324
bool ScriptHasFunction(const char *strScriptName)
Definition: moScript.cpp:417
void SaveGLState()
MOint GetId() const
moConsoleState m_ConsoleState
Definition: moConsole.h:558
void SetInt(MOint pint)
Definition: moValue.cpp:180
value type: TXT or LNK
Definition: moParam.h:49
moTexture * m_Map
Definition: moGUIManager.h:274
virtual void Error(const moText &p_message)
Definition: moConsole.cpp:3116
virtual void GUIYield()
Definition: moConsole.cpp:1453
long m_ValueId
Opcional para identificación del índice único de parámetro.
long m_PreconfId
Opcional para identificación del índice único de valor.
#define MO_MOLDEOOBJECTS_OFFSET_ID
"objetdisable" : MO_ACTION_OBJECT_DISABLE
Definition: moActions.h:379
moColor m_Color
Definition: moGUIManager.h:273
void SetDefaultPerspectiveView(MOint p_width, MOint p_height)
moEffectState m_State
Definition: moConsole.h:100
Clase Base para Objetos Moldeo ( moEffect, moIODevice, moResource, moConsole )
moOutlets * GetOutlets()
moText ToText() const
Definition: moValue.cpp:707
bool InData(const moText &p_file_full_path)
#define MO_DEACTIVATED
Definition: moTypes.h:368
MOboolean m_bConnectorsLoaded
moTimerState moGetTimerState()
Devuelve el estado del temporizador global.
Definition: moTimer.cpp:143
MOint reservedvalue3
Definition: moEventList.h:67
virtual const moText & ToJSON()
Definition: moEffect.cpp:1198
moMoldeoActionType
moMoldeoActionType
Definition: moActions.h:64
MOulong moGetTicksAbsoluteStep(long step_interval)
Devuelve en milisegundos el valor del reloj de Moldeo.
Definition: moTimer.cpp:33
MOint GetTextureMOId(moParam *param, MOboolean p_create_tex)
#define MO_IODEVICE_MOUSE
moGLMatrixf & GetProjectionMatrix()
Objeto dibujable, pre-efecto ( primeros efectos en el orden de dibujado )
Definition: moTypes.h:529
virtual moTimerState State() const
Definition: moTimer.cpp:101
int DeleteMob(const moMobDefinition &p_MobDef)
Definition: moConsole.cpp:3524
moConsoleMode GetConsoleMode()
devuelve el modo de la consola
Definition: moConsole.cpp:4179
#define MO_DATAMESSAGE
Definition: moEventList.h:85
MOdouble fps_current
Definition: moConsole.h:574
moDirectory * GetDirectory(moText p_Path)
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.
MOboolean CreateDefault(const moText &p_fullconfigfilename)
Devuelve true si pudo crear el archivo de configuraci�n junto con su archivo correspondiente.
Definition: moConfig.cpp:848
virtual void Update(moEventList *p_EventList)
void SetModelMatrix(const moGLMatrixf &p_model_matrix)
void RestoreGLState()
const moText & ToJSON()
MOint GetValueIndex() const
moMoldeoObjects m_MoldeoSceneObjects
Definition: moConsole.h:565
"valuedelete" > MO_ACTION_VALUE_DELETE
Definition: moActions.h:99
void CopyRenderToTexture(MOint p_tex_num)
#define MO_IODEVICE_CONSOLE
bool StepRender(moConsoleState &p_console_state)
moResourceManager * m_pResourceManager
moVector3d * Vector3d()
Definition: moValue.cpp:385
void ConsolePause()
pausa el reloj de la consola
Definition: moConsole.cpp:4160
moConfigDefinition * GetConfigDefinition()
Devuelve el puntero al objeto de definici�n de la configuraci�n.
Definition: moConfig.cpp:1603
#define MO_DEF_SCREEN_WIDTH
Definition: moConsole.h:76
#define MO_DEF_RENDER_HEIGHT
Definition: moConsole.h:79
const moText & ToJSON()
moConsoleMode m_Mode
void Set(moText p_objectname, moText p_objectclass)
Fija el nombre y la clase del objeto a configurar.
Definition: moConfig.h:210
moText GetConsoleConfigName()
Real Normalize()
void AddMoldeoAPIDevices()
Definition: moConsole.cpp:834
void SetLabelName(const moText &p_labelname)
virtual ~moPresetParamDefinition()
Definition: moConsole.cpp:76
param 1: effect label name | effect id
Definition: moActions.h:426
virtual MOswitch GetStatus(MOdevcode)=0
moText m_RenderFrameQuality
MOint GetMoldeoId() const
Devuelve el identificador de este objeto.
int luaGetObjectId(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4702
Objeto dibujable, efecto ( efectos en el orden de dibujado )
Definition: moTypes.h:528
moReactionListenerManager m_ReactionListenerManager
Definition: moConsole.h:567
"valueadd" > MO_ACTION_VALUE_ADD
Definition: moActions.h:88
virtual bool SetEffectState(const moEffectState &p_state)
Definition: moEffect.cpp:92
MOuint ticks
Definition: moConsole.h:577
void DeleteConfig()
Borra la configuracion de par�metros con sus respectivos valores.
Definition: moConfig.cpp:906
moVector3< MOdouble > moVector3d
moValue & GetValue(moText nameparam, int indexvalue=-1)
Devuelve el valor indicado por el nombre del par�metro y el �ndice del valor. ...
Definition: moConfig.cpp:1024
Real Y() const
Definition: moMathVector3.h:75
virtual MOboolean RefreshValue(moParam &param, int value_index)
bool moIsTimerPaused()
Devuelve verdadero si el temporizador global está en pausa.
Definition: moTimer.cpp:152
moEffect * NewEffect(const moText &p_resname, const moText &p_configname, const moText &p_labelname, const moText &p_keyname, moMoldeoObjectType p_type, MOint p_paramindex, MOint p_valueindex, bool p_activate=true)
Genera un nuevo efecto a partir de los parámetros correspondientes.
MOint ConvertKeyNameToIdx(moText &name)
Definition: moConsole.cpp:3859
void UnloadEffects()
Definition: moConsole.cpp:1125
float m_fWireframeWidth
Definition: moGUIManager.h:247
#define MO_CFG_EFFECT_KEY
Definition: moConsole.h:67
virtual void RegisterFunctions()
beware ! call only once or die!!!
Clase que implementa un administrador de shaders.
"paramset" > MO_ACTION_PARAM_SET
Definition: moActions.h:173
#define MO_IODEVICE_KEYBOARD
manejador de operaciones comunes de Open GL
Definition: moGLManager.h:154
param 1: object name | object id
Definition: moActions.h:408
moConfig * GetConfig()
static moDebug * MODebug2
Clase de impresión de errores para depuración.
Definition: moAbstract.h:225
Real X() const
Definition: moMathVector4.h:75
"paramget" > MO_ACTION_PARAM_GET
Definition: moActions.h:163
Real X() const
Definition: moMathVector.h:77
moVector3i * Vector3i()
Definition: moValue.cpp:390
void SetConsoleParamIndex(MOint p_paramindex)
int GetObjectId(const moText &p_objectlabelname)
Definition: moConsole.cpp:4424
value type: NUM or FUNCTION
Definition: moParam.h:42
moVector2< MOlong > moVector2i
Definition: moMathVector.h:422
MOint devicecode
Definition: moEventList.h:63
int luaSetObjectCurrentValue(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4982
void SetMoldeoGLState()
moDataManager * GetDataMan()
moMoldeoObjectType GetType() const
Nombre del archivo de configuración.
#define MO_CFG_RESOURCE
moText Text()
Definition: moValue.cpp:539
virtual MOboolean Init(const moText &p_apppath, const moText &p_datapath, moConfig &p_consoleconfig, MOint p_render_to_texture_mode=0, MOint p_screen_width=320, MOint p_screen_height=240, MOint p_render_width=320, MOint p_render_height=240, MO_HANDLE p_OpWindowHandle=0, MO_DISPLAY p_Display=NULL)
moEffectManager & GetEffectManager()
Definition: moConsole.cpp:196
void ConsolePlaySession()
inicia la reproducción de una sesión pregrabada
Definition: moConsole.cpp:4116
long m_ObjectId
accion
void ConsoleStop()
para el reloj de la consola
Definition: moConsole.cpp:4169
void SetCurrentPreConf(MOint p_actual)
Posiciona la preconfiguraci�n actual en el �ndice indicado.
Definition: moConfig.cpp:1622
int ObjectEnable(int m_MoldeoObjectId)
Definition: moConsole.cpp:4313
int luaObjectEnable(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4799
MOdouble fps_mean
Definition: moConsole.h:575
Real Z() const
Definition: moMathVector4.h:79
void SetPreconf(int objectid, int preconfid)
fija la configuración actualmente seleccionada de un objeto de la consola
Definition: moConsole.cpp:4407
virtual void Update()
Actualiza el estado de los recursos.
Definition: moConsole.cpp:3710
const moPreConfig & GetPreconfig(int valueindex)
Agrega una pre-configuraci�n.
Definition: moConfig.cpp:1680
void Push(moText p_text)
Apila el mensaje dentro de la pila de mensajes.
Definition: moAbstract.h:115
void moPauseTimer()
Pausa el temporizador global.
Definition: moTimer.cpp:116
int luaGetObjectParamValues(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4958
moVector2i * Vector2i()
Definition: moValue.cpp:380
MOswitch fulldebug
saturación
moVector2< MOdouble > moVector2d
Definition: moMathVector.h:424
#define MO_SELECTED
Definition: moConfig.h:44
moValue & GetValue(MOint i=-1)
Definition: moParam.cpp:1204
void ProcessConsoleMessage(moMessage *p_pMessage)
Definition: moConsole.cpp:3613
Real X() const
Definition: moMathVector3.h:73
moParam & GetParam(MOint p_paramindex=-1)
Devuelve el par�metro por �ndice.
Definition: moConfig.cpp:984
"consolepresetsave" : MO_ACTION_CONSOLE_PRESET_SAVE
Definition: moActions.h:691
int AddChildMob(const moMobDefinition &p_MobDef, const moMobDefinition &p_MobDefFather)
Definition: moConsole.cpp:3303
virtual int Interaction()
Procesa los eventos de los dispositivos de entrada/salida.
Definition: moConsole.cpp:1750
void ScriptExeDraw()
Definition: moConsole.cpp:1458
void SetDestinationConnectorId(MOint p_DestinationConnectorId)
#define MOdouble
Definition: moTypes.h:404
MOboolean Init()
Inicializa el objeto.
Clase para el control de un temporizador (relativo) con identificación.
Definition: moTimer.h:321
void LoadPreEffects()
Definition: moConsole.cpp:977
#define DataMan()
MOint RenderWidth() const
void ConsoleModeUpdate()
Definition: moConsole.cpp:4031
bool PreviewShot(bool shot_start=false)
int luaEffectPause(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4883
const moText & ToJSON()
"objectget" : MO_ACTION_OBJECT_GETCONFIG
Definition: moActions.h:307
Real Y() const
Definition: moMathVector.h:79
#define RenderMan()
int luaSetTicks(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4779
#define MO_DEF_RENDER_WIDTH
Definition: moConsole.h:78
"effectgetstate" : MO_ACTION_EFFECT_SETSTATE
Definition: moActions.h:437
void SetId(MOint p_id)
MOuint GetGLId() const
Definition: moTexture.h:224
moDefineDynamicArray(moPresetParams)
virtual long Duration()
Devuelve el valor del reloj del temporizador.
Definition: moTempo.cpp:146
void SetIODeviceManager(moIODeviceManager *p_IODeviceManager)
asignación del administrador de dispositivos
Definition: moConsole.cpp:202
moParamDefinition & GetParamDefinition()
Definition: moParam.cpp:1268
void SetName(const moText &p_name)
Fijar el nombre del objeto.
Objeto principal de administración y dibujado de objetos de Moldeo.
Definition: moTypes.h:534
void FinalizeAllEffects()
Definition: moConsole.cpp:1365
moVector4d * Vector4d()
Definition: moValue.cpp:395
virtual MOboolean Finish()
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
moVector3< MOlong > moVector3i
"consolestop" : MO_ACTION_CONSOLE_STOP
Definition: moActions.h:550
moResources & Resources()
moPreEffectsArray & PreEffects()
moMoldeoObjectType GetType() const
"objects add" > MO_ACTION_OBJECTS_ADD
Definition: moActions.h:266
int UpdateMoldeoIds(moMoldeoObjects &p_MoldeoSceneObjects)
virtual MOboolean Init()
Inicializador predeterminado.
Definition: moConsole.cpp:241
bool ImportFile(const moText &p_import_file_full_path)
virtual MOboolean ResolveValue(moParam &param, int value_index, bool p_refresh=false)
moText GetAppDataPath()
virtual MOboolean Finish()
Finalizador.
Definition: moConsole.cpp:1704
virtual void Interaction(moIODeviceManager *)
Definition: moEffect.cpp:542
moText GetDataPath()
void LoadPostEffects()
Definition: moConsole.cpp:1140
void ConsolePlay()
enciende el reloj de la consola
Definition: moConsole.cpp:4141
virtual MOboolean Finish()
moPreconfigIndexes m_PreconfIndexes
Definition: moPreConfig.h:92
#define MOuint
Definition: moTypes.h:387
#define MO_FALSE
Definition: moTypes.h:369
moVector3< MOfloat > moVector3f
LIBMOLDEO_API moText0 IntToStr(int a)
Definition: moText.cpp:1070
void SetMobDefinition(const moMobDefinition &p_MobDef)
const moText & GetKeyName() const
Devuelve la etiqueta del padre de este objeto.
value type: TXT or LNK
Definition: moParam.h:52
clase base para objetos dibujables
Definition: moEffect.h:82
"consolegetstate" : MO_ACTION_CONSOLE_GETSTATE
Definition: moActions.h:640
"consolepresetadd" : MO_ACTION_CONSOLE_PRESET_ADD
Definition: moActions.h:672
int luaGetPreset(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4721
void AddPreconfig(moPreconfigIndexes &p_preconfindexes)
Agrega una pre-configuraci�n.
Definition: moConfig.cpp:1688
long m_ScreenshotInterval
Definition: moConsole.h:584
virtual ~moConsole()
Definition: moConsole.cpp:109
MOuint fps_count
Definition: moConsole.h:576
moVector4< MOdouble > moVector4d
MOswitch stereooutput
void FirstValue()
Definition: moParam.cpp:1254
bool SetCurrentParamIndex(int)
Selecciona el par�metro por el �ndice.
Definition: moConfig.cpp:1528
Objeto dibujable, post-efecto ( últímos efectos en el orden de dibujado )
Definition: moTypes.h:530
virtual void Draw(moTempo *, moEffectState *parentstate=NULL)=0
int luaGetObjectCurrentValue(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5006
virtual const moText & ToJSON()
MOuint GetSubValueCount()
Definition: moValue.h:545
virtual MOboolean Finish()=0
moIODevicesArray & IODevices()
bool Playback(moConsoleState &p_console_state)
const moParamDefinition & GetParamDefinition(const moText &p_param_name)
Definition: moConfig.cpp:99
moEventList * GetEvents()
#define SDLK_ESCAPE
Definition: moConsole.cpp:53
moDataSession * GetSession()
moData m_Data
Definition: moEventList.h:112
#define MO_ACTIVATED
Definition: moTypes.h:367
MOboolean m_bInitialized
Valor de inicialización.
Definition: moAbstract.h:223
int SetValue(int m_MoldeoObjectId, int m_ParamId, int m_ValueId, const moValue &p_value)
Definition: moConsole.cpp:4226
int ObjectDisable(int m_MoldeoObjectId)
Definition: moConsole.cpp:4352
moText GetAbsolutePath()
Get relative path and filename "PP/myFileName.txt".
moMoldeoObjects m_MoldeoObjects
Definition: moConsole.h:564
"consoleget" : MO_ACTION_CONSOLE_GET
Definition: moActions.h:632
moTimer m_ScreenshotTimer
Definition: moConsole.h:583
MOint RenderHeight() const
int GetPreconf(int objectid)
devuelve la configuración actualmente seleccionada de un objeto de la consola
Definition: moConsole.cpp:4401
bool SelectScriptFunction(const char *strFuncName)
Definition: moScript.cpp:370
MOint GetPreConfCount()
Devuelve la cantidad de preconfiguraciones definidas.
Definition: moConfig.cpp:1612
int luaGetObjectData(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5049
MOboolean RemoveEffect(MOint p_ID, moMoldeoObjectType p_type)
int NewMob(const moMobDefinition &p_MobDef)
Definition: moConsole.cpp:3120
Administrador de efectos.
"valuerefresh" > MO_ACTION_VALUE_REFRESH
Definition: moActions.h:121
MOdouble ang
Definition: moTempo.h:81
int ProcessSessionKey(const moDataSessionKey &p_session_key)
Definition: moConsole.cpp:3903
const MOlong DEG_TO_RAD
Definition: moMath.cpp:49
moData * GetData()
void UnloadConfig()
Elimina todos los par�metros anteriormente cargados.
Definition: moConfig.cpp:898
MOint GetResourceIndex(moText p_labelname)
moConfigDefinition * GetDefinition(moConfigDefinition *p_configdefinition=NULL)
asignación de la definición del archivo de configuración de la consola
Definition: moConsole.cpp:3824
void Message(moText p_text)
Anuncia un mensaje al usuario además de guardarlo en el log de texto.
Definition: moAbstract.cpp:114
void SetOrthographicView(MOint p_width=0, MOint p_height=0, float left=0.0, float right=1.0, float bottom=0.0, float top=1.0, float znear=-1.0, float zfar=1.0)
int luaEffectPlay(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4837
value type: TXT or LNK
Definition: moParam.h:53
bool FirstValue()
Selecciona el primer valor del par�metro actual.
Definition: moConfig.cpp:1563
int ScriptCalling(moLuaVirtualMachine &vm, int iFunctionNumber)
Definition: moConsole.cpp:4539
bool Loaded()
fast live record
void LoadIODevices()
Definition: moConsole.cpp:773
"effectstop" : MO_ACTION_EFFECT_STOP
Definition: moActions.h:455
int luaGetObjectPreconf(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4741
void SetType(moMoldeoObjectType p_type)
#define MO_CFG_RESOURCE_CONFIG
void LoadConnections()
Definition: moConsole.cpp:584
void UnloadPostEffects()
Definition: moConsole.cpp:1192
int ProcessMoldeoAPIMessage(moDataMessage *p_pDataMessage)
Procesa los mensajes de la Moldeo API 1.0.
Definition: moConsole.cpp:1906
moEffect * GetEffectByLabel(const moText &p_label_name, moMoldeoObjectType p_mob_type=MO_OBJECT_UNDEFINED)
virtual void ScriptExeRun()
MOint m_MapGLId
Definition: moGUIManager.h:275
#define MO_CFG_EFFECT_CONFIG
Definition: moConsole.h:63
"consolesave" : MO_ACTION_CONSOLE_SAVE
Definition: moActions.h:557
#define MO_ACTION_MOLDEOAPI_EVENT_RECEIVE
Definition: moActions.h:47
const moText & GetConfigName() const
int GetDirectoryFileCount(const moText &p_path)
Definition: moConsole.cpp:4467
int RegisterFunction(const char *strFuncName, moScript::Function &fun)
Definition: moScript.cpp:286
moText MakeRelativeToData(const moText &p_file_full_path)
value type: TXT or LNK
Definition: moParam.h:48
bool Screenshot(moText pathname, moText &screenshot_result, const moText &image_format="PNG", const moText &file_pattern="image_{DATETIME}_{####}.png")
int ProcessSessionEventKey(const moDataSessionEventKey &p_session_event_key)
Definition: moConsole.cpp:3986
virtual void TurnOn()
Definition: moEffect.cpp:780
void SetResourceManager(moResourceManager *p_pResourceManager)
MOint GetMoldeoFatherId() const
Devuelve el identificador del padre de este objeto.
const moText & GetName() const
moVector2d * Vector2d()
Definition: moValue.cpp:375
int m_iMethodBase
Definition: moScript.h:206
"valuesave" > MO_ACTION_VALUE_SAVE
Definition: moActions.h:109
moTextureManager * GetTextureMan()
MOint GetConnectorId() const
moText Text(moParamReference p_paramreference)
Acceso r�pido a un valor de texto.
Definition: moConfig.cpp:1070
almacena la configuraci�n de los par�metros de un objeto en un archivo XML
Definition: moConfig.h:193
virtual const moText & ToJSON()
MOulong moGetTicks()
Devuelve en milisegundos el valor del reloj de Moldeo.
Definition: moTimer.cpp:138
Indice referente a la descripción del objeto en un archivo de configuración.
int luaGetDeviceCode(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5352
virtual MOboolean Init()
Conección, vínculo entre dos objetos.
Definition: moConnectors.h:280