libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo es el conjunto de objetos y funciones, que permiten ejecutar las operaciones básicas de la plataforma Moldeo, y que compone su núcleo.
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Amigas 'defines' Grupos Páginas
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 
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++ ) {
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 (pDevice->GetConfig()->Text( "hosts" ) == "127.0.0.1" ) {
845  if (pDevice->GetConfig()->Int( "port" ) == 3334 ) {
846  MoldeoAPIListener = true;
847  if (MoldeoAPISender) break;
848  }
849  }
850 
851  }
852 
853  if ( pDevice->GetName()=="netoscout" ) {
854  if ( pDevice->GetConfig()->Text( "hosts" ) == "127.0.0.1" ) {
855  if ( pDevice->GetConfig()->GetValue( "hosts" ).GetSubValue(1).Int() == 3335 ) {
856  MoldeoAPISender = true;
857  if (MoldeoAPIListener) break;
858  }
859  }
860 
861  }
862  }
863  }
864 
865  moIODevice* pdevice =NULL;
866  moMobDefinition MD;
867  if (!MoldeoAPIListener) {
868  MD.SetConfigName("moldeoapioscin");
869  MD.SetLabelName("moldeoapioscin");
870  MD.SetName("netoscin");
874  if (pdevice) {
875  m_MoldeoObjects.Add( (moMoldeoObject*) pdevice );
876  moFile pFile( DataMan()->GetDataPath() + moSlash + MD.GetConfigName() + moText(".cfg") );
877  if (!pFile.Exists()) pdevice->GetConfig()->CreateDefault( pFile.GetCompletePath() );
879  pdevice->Init();
880  pdevice->Activate();
881  } else MODebug2->Error( moText("moConsole::LoadIODevices > Couldn't create the device:") + moText("moldeoapioscin"));
882 
883  }
884  if (!MoldeoAPISender) {
885  MD.SetConfigName("moldeoapioscout");
886  MD.SetLabelName("moldeoapioscout");
887  MD.SetName("netoscout");
891  if (pdevice) {
892  m_MoldeoObjects.Add( (moMoldeoObject*) pdevice );
893  moFile pFile( DataMan()->GetDataPath() + moSlash + MD.GetConfigName() + moText(".cfg") );
894  if (!pFile.Exists()) pdevice->GetConfig()->CreateDefault( pFile.GetCompletePath() );
896  pdevice->Init();
897  pdevice->Activate();
898  } else MODebug2->Error( moText("moConsole::LoadIODevices > Couldn't create the device:") + moText("moldeoapioscout"));
899 
900  }
901 
902 }
903 
904 //==========================================================================
905 // CARGAMOS LOS EFFECTS MAESTROS
906 //==========================================================================
907 void
909  moText text, fxname, cfname, lblname, keyname;
910  MOint N,i,mtfx;
911  bool activate = true;
912  moMasterEffect* pmastereffect = NULL;
913 
914  mtfx = m_Config.GetParamIndex("mastereffect");
916  N = m_Config.GetValuesCount(mtfx);
917 
918  if (MODebug2) {
919  MODebug2->Message( moText("moConsole::LoadMasterEffects > Loading MasterEffects configs...") );
920  MODebug2->Message( moText("moConsole::LoadMasterEffects > Master Effects number: ") + IntToStr(N) );
921  }
922 
923  if(N>0) {
925  for( i=0; i<N; i++) {
933 
934  moText completecfname = m_pResourceManager->GetDataMan()->GetDataPath() + moSlash + (moText)cfname+ moText(".cfg");
935  moFile FullCF( completecfname );
936 
937  if ( FullCF.Exists() ) {
938  pmastereffect = (moMasterEffect*)m_EffectManager.NewEffect( fxname, cfname, lblname, keyname, MO_OBJECT_MASTEREFFECT, mtfx, i, activate);
939  if (pmastereffect) {
940  m_MoldeoObjects.Add( (moMoldeoObject*) pmastereffect );
941  pmastereffect->SetResourceManager( m_pResourceManager );
942  pmastereffect->Set( &m_EffectManager, &m_ConsoleState );
943  if( pmastereffect->GetName() == moText("ligia") ) {
944  iligia=i;
945  pmastereffect->Init();
946  pmastereffect->Activate();
947  }
948  } else MODebug2->Error( moText("moConsole::LoadMasterEffects > Couldn't load specific Master-Effect:") + moText(fxname));
949  } else {
950  MODebug2->Error(moText("moConsole::LoadMasterEffects > Error: Config File doesn't exist : ") + (moText)completecfname);
951  }
953  }
954  }
955 
956  if (MODebug2) MODebug2->Message( moText("moConsole::LoadMasterEffects > Master-Effects loaded.") );
957 
958 }
959 
961 
962  while(m_EffectManager.MasterEffects().Count()>0) {
963  if( m_EffectManager.MasterEffects().GetRef(0) != NULL ) {
965  }
966  }
967 
968 }
969 
970 //==========================================================================
971 // CARGAMOS LOS PRE-EFFECTS
972 //==========================================================================
973 void
975 
976  moText text,fxname,cfname,lblname,keyname;
977  MOint prfx,i,N;
978  bool activate = true;
979  moPreEffect* ppreeffect;
980 
981  prfx = m_Config.GetParamIndex("preeffect");
983  N = m_Config.GetValuesCount(prfx);
984 
985  if (MODebug2) {
986  MODebug2->Message( moText("moConsole::LoadPreEffects > Loading PreEffects configs...") );
987  MODebug2->Message( moText("moConsole::LoadPreEffects > Pre-Effects number: ") + IntToStr(N) );
988  }
989 
990  if(N>0) {
992  for( i=0; i<N; i++) {
993 
994  if(iborrado!=-1) Draw();
995 
996  //creando nuevo efecto
1003  activate = (m_Config.GetParam().GetValue().GetSubValue(MO_CFG_EFFECT_ON).Int()>0);
1004 
1005  moText completecfname = m_pResourceManager->GetDataMan()->GetDataPath() + moSlash + (moText)cfname + moText(".cfg");
1006  moFile FullCF( completecfname );
1007 
1008  if ( FullCF.Exists() ) {
1009 
1010  ppreeffect = (moPreEffect*)m_EffectManager.NewEffect( fxname, cfname, lblname, keyname, MO_OBJECT_PREEFFECT, prfx, i, activate);
1011 
1012  if (ppreeffect) {
1013  m_MoldeoObjects.Add( (moMoldeoObject*) ppreeffect );
1014  //ppreeffect->SetResourceManager( m_pResourceManager );
1015  if ( ppreeffect->GetName() == moText("erase") ) {
1016  iborrado = i;
1017  if (ppreeffect->Init()) {
1018 
1019  MODebug2->Message("moConsole::LoadPreEffects > Erase initialized");
1020 
1021  MOint pre,on;
1022  MOint paramindex, valueindex;
1023 
1024  paramindex = ppreeffect->GetMobDefinition().GetMobIndex().GetParamIndex();
1025  valueindex = ppreeffect->GetMobDefinition().GetMobIndex().GetValueIndex();
1026 
1027  pre = m_Config.GetParam(paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_PRE).Int();
1028  on = m_Config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_ON).Int();
1029  if (pre>=0) ppreeffect->GetConfig()->SetCurrentPreConf(pre);
1030  if (on>0) ppreeffect->Activate();
1031 
1032  //MODebug2->Message("moConsole::LoadPreEffects > Init passed for object: " + ppreeffect->GetName() + " config: " + ppreeffect->GetConfigName() + " label: " + ppreeffect->GetLabelName() );
1033 
1034  }
1035  }
1036  } else MODebug2->Error( moText("moConsole::LoadPreEffects > Couldn't load specific Pre-Effect:") + moText(fxname));
1037  m_Config.NextValue();
1038  } else {
1039  MODebug2->Error(moText("moConsole::LoadPreEffects > Error: Config File doesn't exist : ") + (moText)completecfname);
1040  }
1041  }
1042  }
1043 
1044  if (MODebug2) MODebug2->Message(moText("moConsole::LoadPreEffects > Pre-Effects loaded !"));
1045 }
1046 
1048 
1049  while(m_EffectManager.PreEffects().Count()>0) {
1050  if( m_EffectManager.PreEffects().GetRef(0) != NULL ) {
1052  }
1053  }
1054 }
1055 
1056 //==========================================================================
1057 // CARGAMOS LOS EFFECTS
1058 //==========================================================================
1059 void
1061 
1062  moText text,fxname,cfname,lblname,keyname;
1063  MOint efx,i,N;
1064  bool activate = true;
1065  moEffect* peffect = NULL;
1066 
1067  efx = m_Config.GetParamIndex("effect");
1069  N = m_Config.GetValuesCount(efx);
1070 
1071  if (MODebug2) {
1072  MODebug2->Message( moText("moConsole::LoadEffects > Loading Effects configs...") );
1073  MODebug2->Message( moText("moConsole::LoadEffects > Effects number: ") + IntToStr(N) );
1074  }
1075 
1076  if(N>0) {
1077  m_Config.FirstValue();
1078  for( i=0; i < N; i++) {
1079  Draw();
1086  activate = (m_Config.GetParam().GetValue().GetSubValue(MO_CFG_EFFECT_ON).Int()>0);
1087 
1088  moText completecfname = m_pResourceManager->GetDataMan()->GetDataPath() + moSlash + (moText)cfname+ moText(".cfg");
1089  moFile FullCF( completecfname );
1090 
1091  if ( FullCF.Exists() ) {
1092  if ((moText)fxname!=moText("nil")) {
1093 
1094  peffect = (moEffect*)m_EffectManager.NewEffect( fxname, cfname, lblname, keyname, MO_OBJECT_EFFECT, efx, i, activate );
1095 
1096  if (peffect) {
1097  m_MoldeoObjects.Add( (moMoldeoObject*) peffect );
1098  }
1099 
1100  if (MODebug2) {
1101  MODebug2->Message( moText("moConsole::LoadingEffect > ") + completecfname );
1102  }
1103 
1104 
1105  } else {
1107  peffect = NULL;
1108  m_EffectManager.Effects().Add(peffect);
1109  m_EffectManager.AllEffects().Add(peffect);
1110  m_MoldeoObjects.Add( (moMoldeoObject*) peffect );
1111  }
1112  } else {
1113  MODebug2->Error(moText("moConsole::LoadEffects > Error: Config File doesn't exist : ") + (moText)completecfname);
1114  }
1115  m_Config.NextValue();
1116  }
1117  }
1118 
1119  if (MODebug2) MODebug2->Message(moText("moConsole::LoadEffects > Effects loaded !"));
1120 }
1121 
1123 
1124  while(m_EffectManager.Effects().Count()>0) {
1125  if( m_EffectManager.Effects().GetRef(0) != NULL ) {
1127  }
1128  }
1129 
1130 }
1131 
1132 //==========================================================================
1133 // CARGAMOS LOS POST-EFFECTS
1134 //==========================================================================
1135 
1136 void
1138 
1139  moText text, fxname, cfname, lblname, keyname;
1140  MOint ptfx,i,N;
1141  bool activate = true;
1142  moPostEffect* posteffect = NULL;
1143 
1144  ptfx = m_Config.GetParamIndex("posteffect");
1146  N = m_Config.GetValuesCount(ptfx);
1147 
1148  if (MODebug2) {
1149  MODebug2->Message( moText("moConsole::LoadPostEffects > Loading PostEffects configs...") );
1150  MODebug2->Message( moText("moConsole::LoadPostEffects > Post Effects number: ") + IntToStr(N) );
1151  }
1152 
1153  if(N>0) {
1154  m_Config.FirstValue();
1155  for( i=0; i<N; i++) {
1156  if(idebug!=-1) { Draw(); }
1163  activate = (m_Config.GetParam().GetValue().GetSubValue(MO_CFG_EFFECT_ON).Int()>0);
1164 
1165  moText completecfname = m_pResourceManager->GetDataMan()->GetDataPath() + moSlash + (moText)cfname+ moText(".cfg");
1166  moFile FullCF( completecfname );
1167 
1168  if ( FullCF.Exists() ) {
1169 
1170  posteffect = (moPostEffect*)m_EffectManager.NewEffect( fxname, cfname, lblname, keyname, MO_OBJECT_POSTEFFECT, ptfx , i, activate );
1171  if (posteffect) {
1172  m_MoldeoObjects.Add( (moMoldeoObject*) posteffect );
1173  //posteffect->SetResourceManager( m_pResourceManager );
1174  if(posteffect->GetName() == moText("debug")) {
1175  idebug = i;
1176  posteffect->Init();
1177  posteffect->Activate();
1178  }
1179  } else MODebug2->Error( moText("moConsole::LoadPostEffects > Couldn't load specific Post Effect:") + moText(fxname));
1180  } else {
1181  MODebug2->Error(moText("moConsole::LoadPostEffects > Error: Config File doesn't exist : ") + (moText)completecfname);
1182  }
1183  m_Config.NextValue();
1184  }
1185  }
1186  if (MODebug2) MODebug2->Message(moText("moConsole::LoadPostEffects > Post Effects loaded !"));
1187 }
1188 
1190 
1191  while(m_EffectManager.PostEffects().Count()>0) {
1192  if( m_EffectManager.PostEffects().GetRef(0) != NULL ) {
1194  }
1195  }
1196 }
1197 
1198 //==========================================================================
1199 // CARGAMOS LOS RECURSOS
1200 //==========================================================================
1201 
1202 
1203 
1204 //LOAD RESOURCE PLUGINS
1205 void
1207 
1208  moText resname, cfname, lblname, keyname;
1209  bool activate = true;
1210 
1211  int paramindex = m_Config.GetParamIndex(moText("resources"));
1213  int resource_valueindex = -1;
1214 
1215  moParam& presources(m_Config.GetParam(moText("resources")));
1216  presources.FirstValue();
1217  for(MOuint r=0; r<presources.GetValuesCount(); r++) {
1218  moResource* presource = NULL;
1219 
1220  resname = presources[MO_SELECTED][MO_CFG_RESOURCE].Text();
1221  cfname = presources[MO_SELECTED][MO_CFG_RESOURCE_CONFIG].Text();
1222  lblname = presources[MO_SELECTED][MO_CFG_RESOURCE_LABEL].Text();
1223  if (presources[MO_SELECTED].GetSubValueCount()>=4)
1224  activate = (presources[MO_SELECTED].GetSubValue(MO_CFG_EFFECT_ON).Int()>0);
1225  if (presources[MO_SELECTED].GetSubValueCount()>=6)
1226  keyname = presources[MO_SELECTED].GetSubValue(MO_CFG_EFFECT_KEY).Text();
1227 
1228  MOint rid = m_pResourceManager->GetResourceIndex( lblname );
1229 
1230  if(rid>-1) presource = m_pResourceManager->GetResource(rid);
1231 
1232  if (presource) {
1233  MODebug2->Message( moText("moConsole::LoadResources > Already loaded plugin resource: ") + (moText)resname );
1234  } else {
1235  //maybe a plugin
1236  resource_valueindex = r;
1237  presource = m_pResourceManager->NewResource(resname, cfname, lblname, keyname, paramindex, resource_valueindex, activate);
1238  if (presource) {
1239  presource->SetConfigName(cfname);
1240  presource->SetLabelName(lblname);
1241  presource->SetResourceManager( m_pResourceManager );
1242  if (presource->Init()) {
1243  if (activate) presource->Activate();
1244  else presource->Deactivate();
1245  MODebug2->Message( moText("moConsole::LoadResources > Loaded plugin resource: ") + (moText)resname );
1246  } else MODebug2->Error( moText("moConsole::LoadResources > Error: Loading plugin resource: ") + (moText)resname );
1247  }
1248  }
1249  presources.NextValue();
1250  }
1251 
1252  //Agrega los Resources a MoldeoObjects
1253  if(m_pResourceManager!=NULL) {
1254 
1255  for(MOuint i = 0; i<m_pResourceManager->Resources().Count(); i++) {
1257  if (mobject) {
1258  m_MoldeoObjects.Add( mobject );
1259  }
1260  }
1261 
1262  }
1263 
1264  if (MODebug2) MODebug2->Message(moText("moConsole::LoadResources > Resources Plugin loaded !"));
1265 
1266 }
1267 
1269  if (m_pResourceManager)
1270  for(int i=m_pResourceManager->Resources().Count()-1; i>=0; i--) {
1271  if (m_pResourceManager->Resources().GetRef(i)!=NULL) {
1273  }
1274  }
1275 }
1276 
1277 //==========================================================================
1278 //INICIALIZACION DE CADA EFFECT Y ASIGNACION DE CODIGOS DE DISPOSITIVO(cargados del config de cada efecto)
1279 //==========================================================================
1280 
1281 void
1283 
1284  int dg;
1285  moEffect* p_effect = NULL;
1286 
1287  dg = m_Config.GetParamIndex("fulldebug");
1288 
1289 
1290  for(MOuint i=0; i<m_EffectManager.AllEffects().Count(); i++ ) {
1291  p_effect = m_EffectManager.AllEffects().GetRef(i);
1292  if( p_effect !=NULL) {
1293 
1294  moMobDefinition MD = p_effect->GetMobDefinition();
1295 
1296  Draw();
1297 
1298  MOint pre,on;
1299  MOint paramindex = MD.GetMobIndex().GetParamIndex();
1300  MOint valueindex = MD.GetMobIndex().GetValueIndex();
1301  moEffectState fxstate = p_effect->GetEffectState();
1302 
1303  if(m_Config.GetParam(dg).GetValue().GetSubValue(0).Text()==moText("yes")) {
1304  fxstate.fulldebug = MO_ACTIVATED;
1305  } else {
1306  fxstate.fulldebug = MO_DEACTIVATED;
1307  }
1308 
1309  if( p_effect->GetName()!=moText("debug") && p_effect->GetName()!=moText("erase")
1310  && p_effect->GetName()!=moText("ligia")) {
1311 
1312  bool res = p_effect->Init();
1313 
1314 
1315  if (res) {
1316 
1317  pre = m_Config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_PRE).Int();
1318  on = m_Config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_ON).Int();
1319 
1320  if (pre>=0) p_effect->GetConfig()->SetCurrentPreConf(pre);
1321  if (on>0) p_effect->Activate();
1322  else p_effect->Deactivate();
1323 
1324  // Sucio codigo agregado rapidamente para poder asignar los efectos a teclas arbitrarias de las 4 filas
1325  // del teclado:
1326  /*
1327  MOint idx;
1328  moText key;
1329  key = m_Config.GetParam( pEIx->GetParamIndex() ).GetValue( pEIx->GetValueIndex() ).GetSubValue(MO_CFG_EFFECT_KEY).Text();
1330  idx = ConvertKeyNameToIdx(key);
1331  p_effect->keyidx = idx;
1332  */
1333  } else {
1334  MODebug2->Error("Error Initializing Effect: " + p_effect->GetName() + " Label: " + p_effect->GetLabelName() + " Cfg: " + p_effect->GetConfigName() );
1335  }
1336  } else {
1337 
1338  pre = m_Config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_PRE).Int();
1339  on = m_Config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_ON).Int();
1340 
1341  if (pre>=0) p_effect->GetConfig()->SetCurrentPreConf(pre);
1342  if (on>0) p_effect->Activate();
1343  else p_effect->Deactivate();
1344 
1345  // TODO: para poder asignar los efectos a teclas arbitrarias de las 4 filas
1346  // del teclado:
1347  /*
1348  MOint idx;
1349  moText key;
1350  key = m_Config.GetParam( pEIx->GetParamIndex() ).GetValue( pEIx->GetValueIndex() ).GetSubValue(MO_CFG_EFFECT_KEY).Text();
1351  idx = ConvertKeyNameToIdx(key);
1352  p_effect->keyidx = idx;
1353  */
1354  }
1355  //carga códigos...
1356  p_effect->LoadCodes( m_pIODeviceManager );
1357  }
1358  }
1359 
1360 }
1361 
1363 
1364  moEffect* p_effect = NULL;
1365 
1366  for( MOuint i=0; i< m_EffectManager.AllEffects().Count(); i++ ) {
1367  p_effect = m_EffectManager.AllEffects().GetRef(i);
1368  if( p_effect!=NULL ) {
1369  p_effect->Finish();
1370  }
1371  }
1372 }
1373 
1374 void
1376 
1377  moText text;
1378  moEffect* p_effect = NULL;
1379  MOuint i;
1380 
1381  text = moText("Turning on MasterEffects...");
1382  if (MODebug2) MODebug2->Push(text);
1383 
1384  //==========================================================================
1385  //PRENDEMOS LOS EFFECTS MAESTROS y ...LARGAMOS
1386  //==========================================================================
1387  for( i=0; i<m_EffectManager.MasterEffects().Count(); i++ ) {
1388  p_effect = m_EffectManager.MasterEffects().GetRef(i);
1389  if( p_effect!=NULL ) {
1390  Draw();
1391  p_effect->Activate();
1392  }
1393  }
1394  if( m_EffectManager.MasterEffects().Count()>0 ) {
1395  p_effect = m_EffectManager.MasterEffects().GetRef(0);
1396  if(p_effect!=NULL)
1397  p_effect->Activate();
1398  }
1399  if( m_EffectManager.MasterEffects().Count()>1 ) {
1400  p_effect = m_EffectManager.MasterEffects().GetRef(1);
1401  if(p_effect!=NULL)
1402  p_effect->Activate();
1403  }
1404  if (MODebug2) MODebug2->Push( moText("moConsole::StartMasterEffects > Master effects on.") );
1405 
1406 }
1407 
1409 
1410  moEffect* pEffect = NULL;
1411 
1412  if (MODebug2) MODebug2->Push( moText("moConsole::StartMasterEffects > turning off MasterEffects.") );
1413 
1414  if(m_EffectManager.MasterEffects().Count()>0) {
1415  pEffect = m_EffectManager.MasterEffects().GetRef(0);
1416  if( pEffect!=NULL )
1417  pEffect->Deactivate();
1418  }
1419  if( m_EffectManager.MasterEffects().Count()>1 ) {
1420  pEffect = m_EffectManager.MasterEffects().GetRef(1);
1421  if(pEffect!=NULL)
1422  pEffect->Deactivate();
1423  }
1424  for(MOuint i=0;i<m_EffectManager.MasterEffects().Count();i++) {
1425  pEffect = m_EffectManager.MasterEffects().GetRef(i);
1426  if( pEffect!=NULL ) {
1427  Draw();
1428  pEffect->Deactivate();
1429  }
1430  }
1431 
1432  if (MODebug2) MODebug2->Push( moText("moConsole::StartMasterEffects > MasterEffects turned OFF.") );
1433 
1434 }
1435 
1436 MOulong
1438 
1439  return moGetTicks();
1440 
1441 }
1442 
1443 void
1445 
1446  //SDL_GL_SwapBuffers();
1447 }
1448 
1449 void
1451  //no hace nada
1452  return;
1453 }
1454 
1456  if (moScript::IsInitialized()) {
1457  if (ScriptHasFunction("Draw")) {
1458 
1460 #ifndef OPENGLESV2
1461  glMatrixMode(GL_MODELVIEW);
1462  glLoadIdentity();
1463 #endif
1466 
1467 #ifndef OPENGLESV2
1468  glEnable(GL_BLEND);
1469  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1470 #endif
1471  SelectScriptFunction("Draw");
1474  }
1475  }
1476 }
1477 
1478 void
1480  MOuint i;
1481  moEffect* pEffect = NULL;
1482  moText savename, framesavename;
1483 
1484  if (m_pResourceManager==NULL) return;
1486 
1487  //GUIYield();
1488 
1489  //MODebug2->Message("out 2");
1490  //exit(1);
1491 
1492  if (RenderMan==NULL) return;
1493 
1495 
1496  MOswitch borrar = MO_ACTIVATED;
1497  MOboolean pre_effect_on = false;
1498 
1500 
1501  //m_ConsoleState.tempo.ticks = GetTicks();
1503 /*
1504  MODebug2->Push( "Console: tempo.on: " + IntToStr( (int)m_ConsoleState.tempo.Started() )
1505  + " tempo.pause_on: " + IntToStr( (int)m_ConsoleState.tempo.Paused())
1506  + " tempo.ticks: " + IntToStr( m_ConsoleState.tempo.ticks )
1507  + " tempo.ang: " + FloatToStr( m_ConsoleState.tempo.ang ) );
1508 */
1509  RenderMan = m_pResourceManager->GetRenderMan();
1510  if (RenderMan) RenderMan->BeginDraw();
1511 
1512  //Se dibujan los m_PreEffects
1513  for(i=1; i<m_EffectManager.PreEffects().Count(); i++ ) {
1514  pEffect = m_EffectManager.PreEffects().GetRef(i);
1515  if( pEffect ) {
1516  if( pEffect->Activated() ) {
1517  pre_effect_on = true;
1518  RenderMan->BeginDrawEffect();
1519  pEffect->Draw(&m_ConsoleState.tempo);
1520  RenderMan->EndDrawEffect();
1521  borrar = MO_DEACTIVATED;
1522  }
1523  }
1524  }
1525 
1526  if(borrar==MO_ACTIVATED)
1527  {
1528  if( m_EffectManager.PreEffects().Count()>0 ) {
1529  pEffect = m_EffectManager.PreEffects().GetRef(0);
1530  if( pEffect ) {
1531  if( pEffect->Activated() )
1532  {
1533  if (RenderMan) RenderMan->BeginDrawEffect();
1534  pEffect->Draw(&m_ConsoleState.tempo);
1535  if (RenderMan) RenderMan->EndDrawEffect();
1536  }
1537  else
1538  if (!pre_effect_on && !RenderMan->IsRenderToFBOEnabled() && !RenderMan->RenderResEqualScreenRes())
1539  // All the preeffects are disabled, including erase. And the screen resolution is different from
1540  // the render resolution. So the last screen image has to be redrawn at render resolution.
1542 
1543  }
1544  }
1545  }
1546 
1550 
1552  for( i=0; i<m_EffectManager.Effects().Count(); i++ ) {
1553 
1554  pEffect = m_EffectManager.Effects().GetRef(i);
1555 
1556  if(pEffect) {
1557  moEffectState fxstate = pEffect->GetEffectState();
1558  if (fxstate.stereo==MO_ACTIVATED) {
1559 
1560  fxstate.stereoside = MO_STEREO_LEFT;
1561  pEffect->SetEffectState( fxstate );
1562 
1563  if(pEffect->Activated()) {
1564  RenderMan->BeginDrawEffect();
1565  pEffect->Draw(&m_ConsoleState.tempo);
1566  RenderMan->EndDrawEffect();
1567  }
1568 
1569  }
1570  }
1571  }
1572 
1573  RenderMan->CopyRenderToTexture(MO_LEFT_TEX);
1574 
1576  for( i=0; i<m_EffectManager.Effects().Count(); i++ ) {
1577 
1578  pEffect = m_EffectManager.Effects().GetRef(i);
1579 
1580  if(pEffect) {
1581  moEffectState fxstate = pEffect->GetEffectState();
1582  if (fxstate.stereo==MO_ACTIVATED) {
1583 
1584  fxstate.stereoside = MO_STEREO_RIGHT;
1585  pEffect->SetEffectState( fxstate );
1586 
1587  if(pEffect->Activated()) {
1588  RenderMan->BeginDrawEffect();
1589  pEffect->Draw(&m_ConsoleState.tempo);
1590  RenderMan->EndDrawEffect();
1591  }
1592 
1593  }
1594  }
1595  }
1596 
1597  RenderMan->CopyRenderToTexture(MO_RIGHT_TEX);
1598 
1599  } else {
1601 
1602  //Se dibujan los Effects
1603  for( i=0; i<m_EffectManager.Effects().Count(); i++ ) {
1604 
1605  pEffect = m_EffectManager.Effects().GetRef(i);
1606  if(pEffect) {
1607  if(pEffect->Activated()) {
1608  RenderMan->BeginDrawEffect();
1609  pEffect->Draw(&m_ConsoleState.tempo);
1610  RenderMan->EndDrawEffect();
1611  //RenderMan->CopyRenderToTexture(MO_EFFECTS_TEX);
1612  }
1613  }
1614  }
1615 
1616  RenderMan->CopyRenderToTexture(MO_EFFECTS_TEX);
1617  }
1618 
1619  //sedibujan los post Effects
1620  for(i=0;i<m_EffectManager.PostEffects().Count();i++) {
1621 
1622  pEffect = m_EffectManager.PostEffects().GetRef(i);
1623 
1624  if(pEffect) {
1625  if(pEffect->Activated()) {
1626  RenderMan->BeginDrawEffect();
1627  pEffect->Draw(&m_ConsoleState.tempo);
1628  RenderMan->EndDrawEffect();
1629  }
1630  }
1631  }
1632 
1633 
1634  if (RenderMan) RenderMan->CopyRenderToTexture(MO_FINAL_TEX);
1635 
1636 //se dibujan los Effects masters (en funcion del modo...) si tiene una sola pantalla... o dos pantallas...
1637 // 1 sola pantalla:
1638 // si esta extendida puede usar un canvas que cubra todo, y solo dibuja la interface en la primera y el resultado en la segunda...
1639 // aqui ganamos velocidad!!!! que perdemos
1640  if (1==1) {
1641  DrawMasterEffects( RenderMan->RenderWidth(), RenderMan->RenderHeight() );
1642  }
1643 
1645 
1646 
1647  //aca controlamos los fps
1650  while(( m_ConsoleState.fps1 - m_ConsoleState.fps0 ) <(1000 / m_ConsoleState.fps) ) {
1652  }
1653  }
1654 
1655 
1656  if (RenderMan) RenderMan->EndDraw();
1657 
1658  if (RenderMan && ( RenderMan->IsRenderToFBOEnabled() || !RenderMan->RenderResEqualScreenRes()) )
1660 
1661  this->GLSwapBuffers();
1662 
1663  RenderMan->PreviewShot(false);
1664  }
1665 
1667 }
1668 
1669 
1670 void
1671 moConsole::DrawMasterEffects(int interface_width, int interface_height) {
1672 
1673  MOuint i;
1674  moEffect* pEffect = NULL;
1675  moText savename, framesavename;
1677 
1678  GUIYield();
1679 
1680 
1681  if (RenderMan==NULL) return;
1682 
1683  if (interface_width!=0 && interface_height!=0) RenderMan->SetInterfaceView( interface_width, interface_height);
1684 
1685  for(i=0;i<m_EffectManager.MasterEffects().Count();i++) {
1686 
1687  pEffect = m_EffectManager.MasterEffects().GetRef(i);
1688  if(pEffect) {
1689  if(pEffect->Activated()) {
1690  RenderMan->BeginDrawEffect();
1691  pEffect->Draw( &m_ConsoleState.tempo );
1692  RenderMan->EndDrawEffect();
1693  }
1694  }
1695  }
1696 
1697 }
1698 
1699 
1700 MOboolean
1702 
1703  m_MoldeoObjects.Finish();
1704 
1706 
1708 
1709  UnloadResources();
1710  UnloadIODevices();
1711  UnloadEffects();
1712  UnloadPreEffects();
1715 
1717 
1718  if (m_pResourceManager) {
1720  if (!m_bExternalResources) {
1721  delete m_pResourceManager;
1722  m_pResourceManager = NULL;
1723  }
1724  m_pResourceManager = NULL;
1725  }
1726 
1728  if (m_pIODeviceManager) {
1730  delete m_pIODeviceManager;
1731  m_pIODeviceManager = NULL;
1732  }
1733  }
1734 
1735  //FINALIZAMOS LOS RECURSOS (liberando memoria)
1737  m_Config.DeleteConfig();//finally we unload the console configuration
1738 
1739  m_bInitialized = false;
1740  m_bConnectorsLoaded = false;
1741 
1742  return true;
1743 }
1744 
1745 
1746 int
1748 
1749  MOuint i;
1750  moEffect* pEffect = NULL;
1751  moEffect* pPanel = NULL;
1752  moEffect* pChannel = NULL;
1753  if (!m_pResourceManager) return -1;
1755 
1756  if (!RenderMan) {
1757  cout << "no renderman!" << endl;
1758  return -1;
1759  }
1760 /*
1761  timecodeticks = moGetTicks();
1762  minutes = timecodeticks / (1000*60);
1763  seconds = (timecodeticks - minutes*1000*60) / 1000;
1764  frames = (timecodeticks - minutes*1000*60 - seconds*1000 ) * 25 / 1000;
1765 
1766  Texto+= moText(" ticks: ") + (moText)IntToStr(timecodeticks,10) +
1767  moText(" ang: ") + (moText)FloatToStr((float)tempogral->ang) +
1768  moText(" timecode: ") + (moText)IntToStr(minutes, 2) + moText(":") + (moText)IntToStr(seconds,2) + moText(":") + (moText)IntToStr(frames,2);
1769 */
1770 
1771 
1772  ticksprevious = ticks;
1775 
1776  fps_current = 1000.0 / tickselapsed;
1777  fps_mean += fps_current;
1778 
1779  fps_count++;
1780  if (fps_count % 10 == 0)
1781  {
1782  fps_mean /= 10;
1783  fps_text = moText("FPS = ") + (moText)FloatToStr(fps_mean);
1784  fps_mean = 0;
1785  fps_count = 0;
1786  }
1787 
1788 
1789  //_IODEVICE ACTUALIZA
1790  RenderMan->BeginUpdate();
1791  if(m_pIODeviceManager!=NULL) {
1792  RenderMan->BeginUpdateDevice();
1793 
1796 
1797  while(event!=NULL) {
1798  //MODebug2->Message("moConsole::Interaction > event present.");
1799  if ( event->deviceid == MO_IODEVICE_KEYBOARD ) {
1800  //MODebug2->Message("moConsole::Interaction > KEYBOARD activity (devicecode:" + IntToStr(event->devicecode) + " SDL_KEYDOWN:" + IntToStr(SDL_KEYDOWN));
1801  if (event->devicecode == SDL_KEYDOWN || event->devicecode == SDL_KEYDOWN_SDL2 ) {
1802  MODebug2->Message("moConsole::Interaction > KEY DOWN (SDL_KEYDOWN)");
1803  if ( event->reservedvalue0 == SDLK_ESCAPE ) {
1804  MODebug2->Message("moConsole::Interaction > ESCAPE pressed");
1805  //m_ConsoleState.finish = MO_TRUE;
1806  }
1807 
1808  if ( event->reservedvalue0 == SDLK_F12 ) {
1809  //recreate window...
1810  MODebug2->Message("moConsole::Interaction > F12 pressed");
1812  }
1813  }
1814  }
1815  event = event->next;
1816  }
1817 
1818 
1819  RenderMan->EndUpdateDevice();
1820  }
1821  RenderMan->EndUpdate();
1822 
1823  //INTERACCION EFFECTS MAESTROS
1824 
1825  for( i=0; i<m_EffectManager.MasterEffects().Count(); i++) {
1826  pEffect = m_EffectManager.MasterEffects().GetRef(i);
1827  moEffectState fxstate = pEffect->GetEffectState();
1828  if(pEffect!=NULL) {
1829  if(pEffect->Activated()) {
1830  pEffect->Interaction( m_pIODeviceManager );
1831  }
1832  }
1833  }
1834 
1835 
1838 
1840  //se pasa el control de events al CanalMaestro array[0], el sabra a quien pasar el control
1841  if ( m_EffectManager.MasterEffects().Count() > 2 ) {
1842 
1843  pChannel = m_EffectManager.MasterEffects().GetRef(0);
1844  //pChannel = m_EffectManager.GetEffectByLabel( "channel0" );
1845  pPanel = m_EffectManager.MasterEffects().GetRef(2);
1846  //pPanel = m_EffectManager.GetEffectByLabel( "panel" );
1847 
1848  if (pPanel && pChannel)
1849  if( !pChannel->Activated() && !pPanel->Activated() ) {
1852  pChannel->Interaction( m_pIODeviceManager );
1853  }
1854  } else {
1856  for( MOuint all=0;all<m_EffectManager.AllEffects().Count(); all++) {
1857  pEffect = m_EffectManager.AllEffects().GetRef(all);
1858  if ( pEffect && pEffect->Activated() ) {
1859  pEffect->Interaction( m_pIODeviceManager );
1860  }
1861  }
1862  }
1863 
1864 
1865  //TAREAS ESPECIALES
1866  //reinicializa
1867  if(m_ConsoleState.reinit) {
1868  Finish();
1869  Init();
1871  }
1872 
1873 
1874  return (m_ConsoleState.finish==MO_FALSE);
1875 }
1876 
1878 
1881  /*
1882  if (ApiMessage) {
1883  ApiMessage->Text();
1884  }
1885  */
1886  //MODebug2->Message( "moConsole::SendMoldeoAPIMessage > " );
1887 
1890  -1, 0, 0, MO_DATAMESSAGE, p_pDataMessage );
1891 
1892 
1893  return 0;
1894 }
1895 
1896 
1897 #include <sstream>
1898 #include <iostream>
1899 
1901 
1902  if (p_pDataMessage==NULL) {
1903  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > DataMessage is NULL");
1904  return 1;
1905  }
1906 
1907  if (p_pDataMessage->Count()==0) {
1908  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > DataMessage is empty");
1909  return 2;
1910  }
1911  moData MoldeoApiCommandData = p_pDataMessage->Get(0);
1912  moText MoldeoAPICommand = p_pDataMessage->Get(0).ToText();
1913  std::string skey = (char*)MoldeoAPICommand;
1914 
1916 
1917 
1918 /*
1919  moText fullMessageText = "";
1920  for( int k=0;k<(int)p_pDataMessage->Count();k++) {
1921  fullMessageText+= " k:" + IntToStr(k);
1922  fullMessageText+="[" + p_pDataMessage->Get(k).ToText()+"]";
1923  }
1924  */
1925 /*
1926  MODebug2->Message( moText("moConsole::ProcessMoldeoAPIMessage > Processing Moldeo API Message: ")
1927  + MoldeoAPICommand
1928  + moText(" count:") + IntToStr(p_pDataMessage->Count())
1929  + moText(" mapped type:") +IntToStr(MappedType)
1930  + moText(" fullmessage:") + fullMessageText );
1931 */
1932 
1933 
1934  moEffect* fxObject;
1935  moMoldeoObject* MObject;
1936  moText arg0;
1937  int arg1Int;
1938  moText arg1Text;
1939  int arg2Int;
1940  moText arg2Text;
1941  moText arg3Text;
1942 
1943  moText argRed,argGreen,argBlue,argAlpha;
1944  unsigned int r,g,b;
1945 
1946  moText EffectStateJSON = "";
1947  moText FullObjectJSON = "";
1948  moText fieldSeparation = ",";
1949 
1950  moMobState MobState;
1951  moEffectState EffectState;
1952  moDataMessage* pMessageToSend;
1953  moData pData("PRESENTATION");
1954  moMessage* newMessage = NULL;
1955 
1956  switch( MappedType ) {
1957 
1958 
1959  // VALUES
1960 
1961  case MO_ACTION_VALUE_ADD:
1963  case MO_ACTION_VALUE_SET:
1965  case MO_ACTION_VALUE_GET:
1966  case MO_ACTION_VALUE_SAVE:
1967 {
1968  //MODebug2->Message("MO_ACTION_VALUE_SET");
1969  arg0 = p_pDataMessage->Get(1).ToText();//MOBLABEL
1970  MODebug2->Message(arg0);
1971  //fxObject = m_EffectManager.GetEffectByLabel( arg0 );
1972  MObject = GetObjectByIdx( GetObjectId( arg0 ) );
1973  moConfig* pConfig = NULL;
1974  if (MObject) {
1975  pConfig = MObject->GetConfig();
1976  //MODebug2->Message("MO_ACTION_VALUE_SET fxObject ok");
1977  arg1Text = p_pDataMessage->Get(2).ToText();//PARAMNAME or ID
1978  }
1979  else {
1980  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > fxObject not found for " + arg0 );
1981  return -1;
1982  }
1983  if (MappedType==MO_ACTION_VALUE_SAVE) {
1984  //guardar ese valor en el config!!!
1985  // guardamos el config completo mejor...
1986  MObject->GetConfig()->SaveConfig();
1987  return -1;
1988  }
1989 
1990  if (MappedType==MO_ACTION_VALUE_SET
1991  ||
1992  MappedType==MO_ACTION_VALUE_ADD
1993  ||
1994  MappedType==MO_ACTION_VALUE_DELETE
1995  ||
1996  MappedType==MO_ACTION_VALUE_REFRESH
1997  )
1998  arg2Text = p_pDataMessage->Get(3).ToText();//PARAMVALUEINDEX ///si es 0:1 > indice 0, subindice 1...
1999 
2000  int subvalue = -1;
2001  bool issubvalue = false;
2002  if (arg1Text=="color_0") { arg1Text = "color"; subvalue=0;issubvalue=true; }
2003  if (arg1Text=="color_1") { arg1Text = "color"; subvalue=1;issubvalue=true; }
2004  if (arg1Text=="color_2") { arg1Text = "color"; subvalue=2;issubvalue=true; }
2005  if (arg1Text=="color_3") { arg1Text = "color"; subvalue=3;issubvalue=true; }
2006  if (arg1Text=="particlecolor_0") { arg1Text = "particlecolor"; subvalue=0;issubvalue=true; }
2007  if (arg1Text=="particlecolor_1") { arg1Text = "particlecolor"; subvalue=1;issubvalue=true; }
2008  if (arg1Text=="particlecolor_2") { arg1Text = "particlecolor"; subvalue=2;issubvalue=true; }
2009  if (arg1Text=="particlecolor_3") { arg1Text = "particlecolor"; subvalue=3;issubvalue=true; }
2010 
2011 
2012  moParam& rParam( pConfig->GetParam(arg1Text));
2013 
2014  arg2Int = atoi( arg2Text );
2015 
2017  if ( MappedType==MO_ACTION_VALUE_ADD && (int)rParam.GetValuesCount()<=arg2Int && pConfig ) {
2018 
2019  MODebug2->Message("moConsole::ProcessMoldeoAPIMessage Adding > value for "+MObject->GetLabelName()+" preconfig: "+arg2Text);
2020  moText pName = rParam.GetParamDefinition().GetName();
2021  moParamDefinition pParamDef = pConfig->GetConfigDefinition()->GetParamDefinition( pName );
2022  //moValue newValue = pParamDef.GetDefaultValue();
2023  moValue newValue = rParam.GetValue( rParam.GetValuesCount()-1 );
2024 
2030  int valcount = arg2Int - rParam.GetValuesCount() + 1;
2031  for( int sum=0; sum < valcount ; sum++ ) {
2032  MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > Adding Value at index:" + IntToStr( rParam.GetValuesCount() )
2033  + " newvalue: " + newValue.ToJSON() );
2034  rParam.AddValue( newValue );
2035  SetValue( MObject->GetId(), rParam.GetParamDefinition().GetIndex(), rParam.GetValuesCount()-1, newValue );
2036  }
2037  arg3Text = newValue.GetSubValue(0).ToText();
2038 
2056  if (pConfig==NULL) return -1;
2057  moPreConfig preCfg;
2058  bool param_exist = false;
2059  int ip=0;
2060 
2061 
2063  if ( arg2Int < pConfig->GetPreConfCount() ) {
2065 
2066  for(int k=0; k < pConfig->GetPreConfCount(); k++ ) {
2067  preCfg = pConfig->GetPreconfig( k );
2068 
2071  for( int pi=0; pi < pConfig->GetParamsCount(); pi++) {
2072  moParam& rParamx( pConfig->GetParam(pi) );
2073 
2074  if ( rParamx.GetValuesCount()>1 ) {
2075  moPreconfigParamIndex preIndexA;
2076  for( ip=0, param_exist = false; ip< (int)preCfg.m_PreconfIndexes.Count(); ip++ ) {
2077  preIndexA = preCfg.m_PreconfIndexes.Get(ip);
2078  if (preIndexA.m_ParamName == rParamx.GetParamDefinition().GetName() ) {
2079  param_exist = true;
2080  break;
2081  }
2082  }
2083 
2085  if (param_exist) {
2087  preIndexA.m_ValueIndex = k;
2088  preCfg.m_PreconfIndexes.Set( ip, preIndexA );
2089  } else {
2090  preIndexA.m_ParamName = rParamx.GetParamDefinition().GetName();
2091  preIndexA.m_ParamIndex = rParamx.GetParamDefinition().GetIndex();
2092  preIndexA.m_ValueIndex = momin( rParamx.GetValuesCount()-1, k );
2093  preCfg.m_PreconfIndexes.Add( preIndexA );
2094  }
2095 
2096  }
2097  }
2098 
2099  pConfig->SetPreconfig( k, preCfg.m_PreconfIndexes );
2100 
2101  }
2102 
2103  } else {
2104 
2106 
2108  MODebug2->Message("moConsole::ProcessMoldeoAPIMessage > Adding Value > a new value");
2109 
2110  pConfig->AddPreconfig( arg2Int );
2111 
2112  }
2117  MappedType = MO_ACTION_VALUE_SET;
2119 
2120  }
2121 
2122  moValue& rValue( rParam.GetValue(arg2Int) );
2123 
2124  if (MappedType==MO_ACTION_VALUE_DELETE) {
2125  rParam.DeleteValue( arg2Int );
2126  return 0;
2127  }
2128  if (subvalue==-1) subvalue = 0;
2129  moValueBase& VB( rValue.GetSubValue(subvalue) );
2130 
2131  if (MappedType==MO_ACTION_VALUE_SET && p_pDataMessage->Count()>=5) {
2132  arg3Text = p_pDataMessage->Get(4).ToText();//VALUE
2133  } else {
2134  arg3Text = VB.ToText();
2135  }
2136 
2137  MODebug2->Message("MO_ACTION_VALUE_SET settings: arg1Text (param):" + arg1Text
2138  + " arg2Text (preconf): ["+arg2Text+"] arg2Int: "+ IntToStr(arg2Int)
2139  + " arg3Text (val): " + arg3Text
2140  + " VB( subvalue: "+IntToStr(subvalue)+" ): " + VB.TypeToText() + ")"
2141  );
2142 
2143  if (rParam.GetParamDefinition().GetType()==MO_PARAM_COLOR && issubvalue==false ) {
2144 
2145  argRed = arg3Text;
2146  argGreen = arg3Text;
2147  argBlue = arg3Text;
2148  MODebug2->Message("color");
2149 
2150  if (arg3Text.Left(0)=="#") {
2151  argRed.Mid(1,2);
2152  argGreen.Mid(3,2);
2153  argBlue.Mid(5,2);
2154 
2155  r = HexToInt( argRed );
2156  g = HexToInt( argGreen );
2157  b = HexToInt( argBlue );
2158  //MODebug2->Message("color: red: " + argRed + " green:" + argGreen + " blue:" + argBlue);
2159  rValue.GetSubValue(0).SetFun( FloatToStr((float)r*1.0/255.0) );
2160  rValue.GetSubValue(1).SetFun( FloatToStr((float)g*1.0/255.0) );
2161  rValue.GetSubValue(2).SetFun( FloatToStr((float)b*1.0/255.0) );
2162  //MODebug2->Message("color: red: " + IntToStr(r) + " green:" + IntToStr(g) + " blue:" + IntToStr(b));
2163  }
2164  }
2165  else { switch(VB.Type()) {
2166  case MO_DATA_FUNCTION:
2167  VB.SetFun( arg3Text );
2168  break;
2169  case MO_DATA_TEXT:
2170  case MO_DATA_SOUNDSAMPLE:
2171  case MO_DATA_IMAGESAMPLE:
2174 
2175  switch(rParam.GetParamDefinition().GetType()) {
2176  case MO_PARAM_TEXT:
2177  VB.SetText(arg3Text);
2178  break;
2179  case MO_PARAM_TEXTURE:
2180  if (m_pResourceManager->GetDataMan()->InData(arg3Text)) {
2181  //make relative to datapath
2182  moText relpath = m_pResourceManager->GetDataMan()->MakeRelativeToData(arg3Text);
2183  if (relpath!="") {
2184  arg3Text = relpath;
2185  }
2186  } else {
2187  //try to import file
2188  moFile importFile( arg3Text );
2190  arg3Text = importFile.GetFullName();
2191  }
2192  VB.SetText(arg3Text);
2193  break;
2194  case MO_PARAM_SOUND:
2195  {
2196  if (m_pResourceManager->GetDataMan()->InData(arg3Text)) {
2197  //make relative to datapath
2198  arg3Text = m_pResourceManager->GetDataMan()->MakeRelativeToData(arg3Text);
2199  } else {
2200  //try to import file
2201  moFile importFile( arg3Text );
2203  arg3Text = importFile.GetFullName();
2204  }
2205  VB.SetText(arg3Text);
2206  }
2207  break;
2208  default:
2209  break;
2210  }
2211  break;
2212  case MO_DATA_NUMBER:
2213  VB.SetInt( (int)atoi(arg3Text) );
2214  break;
2215  case MO_DATA_NUMBER_INT:
2216  VB.SetInt( (int)atoi(arg3Text) );
2217  break;
2218  case MO_DATA_NUMBER_FLOAT:
2219  VB.SetFloat( (float)atof(arg3Text) );
2220  break;
2221  case MO_DATA_NUMBER_DOUBLE:
2222  VB.SetDouble( (double)atof(arg3Text) );
2223  break;
2224  case MO_DATA_NUMBER_CHAR:
2225  VB.SetInt( (char)atoi(arg3Text) );
2226  break;
2227  case MO_DATA_NUMBER_LONG:
2228  VB.SetLong( (long)atoi(arg3Text) );
2229  break;
2230  default:
2231  break;
2232  }
2233  }
2234 
2235  moValue fullValueToCopy = rValue;
2236 
2237  if (MappedType==MO_ACTION_VALUE_REFRESH) {
2238  RefreshValue( MObject->GetId(), rParam.GetParamDefinition().GetIndex(), arg2Int, true );
2239  MappedType = MO_ACTION_VALUE_GET;
2240  } else {
2241  SetValue( MObject->GetId(), rParam.GetParamDefinition().GetIndex(), arg2Int, fullValueToCopy );
2242  }
2243 
2244  MappedType = MO_ACTION_VALUE_GET;
2245 
2246  if (MappedType==MO_ACTION_VALUE_GET) {
2247 
2248  moText fullValueJSON = rValue.ToJSON();
2249  MODebug2->Message("valueget " + fullValueJSON );
2250  pMessageToSend = new moDataMessage();
2251  if (pMessageToSend) {
2252  pMessageToSend->Add( moData("valueget") );
2253  pMessageToSend->Add( moData( arg0 ) );//mob
2254  pMessageToSend->Add( moData( arg1Text ) );//param
2255  pMessageToSend->Add( moData( arg2Text ) );//preconf
2256  pMessageToSend->Add( moData( fullValueJSON ) );
2257  SendMoldeoAPIMessage( pMessageToSend );
2258  }
2259 
2260  }
2261 
2262  return 0;
2263 }
2264  break;
2265 
2266  // OBJECTS
2267 
2269  {
2270  arg0 = p_pDataMessage->Get(1).ToText();
2271 
2272  //buscar este efecto y prenderlo...
2273  MObject = GetObjectByIdx(GetObjectId( arg0 ));
2274  if (MObject) {
2275  ObjectEnable( MObject->GetId() );
2276 
2278  MoldeoApiCommandData.SetText( "objectgetstate" );
2279  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2280  p_pDataMessage->Set( 2, moData("") );
2281  ProcessMoldeoAPIMessage( p_pDataMessage );
2282  return 0;
2283  }
2284  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_ENABLE > [" + arg0+"] not found!" );
2285  }
2286  break;
2287 
2289  {
2290  arg0 = p_pDataMessage->Get(1).ToText();
2291 
2292  //buscar este efecto y prenderlo...
2293  MObject = GetObjectByIdx(GetObjectId( arg0 ));
2294  if (MObject) {
2295  ObjectDisable( MObject->GetId() );
2296 
2298  MoldeoApiCommandData.SetText( "objectgetstate" );
2299  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2300  p_pDataMessage->Set( 2, moData("") );
2301  ProcessMoldeoAPIMessage( p_pDataMessage );
2302  return 0;
2303  }
2304  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_ENABLE > [" + arg0+"] not found!" );
2305  }
2306  break;
2307 
2309  {
2310  arg0 = p_pDataMessage->Get(1).ToText();
2311  MObject = GetObjectByIdx( GetObjectId( arg0 ) );
2312  if (MObject) {
2313  moMobState ObjectState = MObject->GetState();
2314  moText ObjectStateJSON = ObjectState.ToJSON();
2315 
2316  pMessageToSend = new moDataMessage();
2317  if (pMessageToSend) {
2318  pMessageToSend->Add( moData("objectgetstate") );
2319  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2320  pMessageToSend->Add( moData( arg0 ) );
2321  pMessageToSend->Add( moData( ObjectStateJSON ) );
2322  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + ObjectStateJSON );
2324  SendMoldeoAPIMessage( pMessageToSend );
2325  }
2326 
2327  return 0;
2328  }
2329  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_GETSTATE > [" + arg0+"] not found!" );
2330  }
2331  break;
2332 
2333  // EFFECTS
2334 
2336  {
2337  arg0 = p_pDataMessage->Get(1).ToText();
2338 
2339  //buscar este efecto y prenderlo...
2340  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2341  if (fxObject) {
2342  ObjectEnable( fxObject->GetId() );
2343 
2345  MoldeoApiCommandData.SetText( "effectgetstate" );
2346  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2347  p_pDataMessage->Set( 2, moData("") );
2348  ProcessMoldeoAPIMessage( p_pDataMessage );
2349  return 0;
2350  }
2351  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_ENABLE > [" + arg0+"] not found!" );
2352  }
2353  break;
2354 
2356  {
2357  arg0 = p_pDataMessage->Get(1).ToText();
2358 
2359  //buscar este efecto y prenderlo...
2360  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2361  if (fxObject) {
2362  ObjectDisable( fxObject->GetId() );
2363 
2365  MoldeoApiCommandData.SetText( "effectgetstate" );
2366  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2367  p_pDataMessage->Set( 2, moData("") );
2368  ProcessMoldeoAPIMessage( p_pDataMessage );
2369  return 0;
2370  }
2371  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_DISABLE > [" + arg0+"] not found!" );
2372  }
2373  break;
2374 
2376  {
2377  arg0 = p_pDataMessage->Get(1).ToText();
2378  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2379  if (fxObject) {
2380  EffectState = fxObject->GetEffectState();
2381  EffectStateJSON = EffectState.ToJSON();
2382 
2383  pMessageToSend = new moDataMessage();
2384  if (pMessageToSend) {
2385  pMessageToSend->Add( moData("effectgetstate") );
2386  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2387  pMessageToSend->Add( moData( arg0 ) );
2388  pMessageToSend->Add( moData( EffectStateJSON ) );
2389  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2391  SendMoldeoAPIMessage( pMessageToSend );
2392  }
2393 
2394  return 0;
2395  }
2396  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_GETSTATE > [" + arg0+"] not found!" );
2397  }
2398  break;
2399 
2401  {
2402  if (p_pDataMessage->Count()<4) {
2403  return -1;
2404  }
2405  arg0 = p_pDataMessage->Get(1).ToText();
2406  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2407  if (fxObject) {
2408  arg1Text = p_pDataMessage->Get(2).ToText();
2409  arg2Text = p_pDataMessage->Get(3).ToText();
2410 
2411  if ( arg1Text == moText("alpha") ) {
2412  if ( arg2Text == moText("increment") ) {
2413 
2414  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > alpha increment" );
2415  fxObject->Alpha( 0.01 );
2416 
2417  } else if ( arg2Text == moText("decrement") ) {
2418 
2419  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > alpha decrement" );
2420  fxObject->Alpha( -0.01 );
2421 
2422  } else if( p_pDataMessage->Get(3).Type() != MO_DATA_TEXT ) {
2423  EffectState = fxObject->GetEffectState();
2424  EffectState.alpha = p_pDataMessage->Get(3).Float();
2425  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > EffectState updating to: " + FloatToStr(EffectState.alpha) );
2426  fxObject->SetEffectState( EffectState );
2427  EffectState = fxObject->GetEffectState();
2428  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > EffectState updated: " + FloatToStr(EffectState.alpha) );
2429  }
2430  }
2431 
2432  if ( arg1Text == moText("tempo") ) {
2433  if ( arg2Text == moText("increment") ) {
2434  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > tempo increment" );
2435  fxObject->TempoDelta( 0.01 );
2436  } else if ( arg2Text == moText("decrement") ) {
2437  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > tempo decrement" );
2438  fxObject->TempoDelta( -0.01 );
2439  } else if ( arg2Text == moText("beatpulse") ) {
2440  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > tempo beatpulse" );
2441  fxObject->BeatPulse();
2442  } else if( p_pDataMessage->Get(3).Type() != MO_DATA_TEXT ) {
2443  fxObject->SetTempoDelta( p_pDataMessage->Get(3).Float() );
2444  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > EffectState updating tempo.delta to: " + FloatToStr(fxObject->GetEffectState().tempo.delta) );
2445  }
2446  }
2447  EffectState = fxObject->GetEffectState();
2448  SetEffectState( fxObject->GetId(), EffectState );
2449 
2451  MoldeoApiCommandData.SetText( "effectgetstate" );
2452  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2453  p_pDataMessage->Set( 2, moData("") );
2454  ProcessMoldeoAPIMessage( p_pDataMessage );
2455  return 0;
2456  }
2457  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_SETSTATE > [" + arg0+"] not found!" );
2458  }
2459  break;
2460 
2461  case MO_ACTION_EFFECT_PLAY:
2462  {
2463  arg0 = p_pDataMessage->Get(1).ToText();
2464  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2465  if (fxObject) {
2466  EffectPlay(fxObject->GetId());
2467  return 0;
2468  }
2469  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_PLAY > [" + arg0+"] not found!" );
2470  }
2471  break;
2472 
2474  {
2475  arg0 = p_pDataMessage->Get(1).ToText();
2476  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2477  if (fxObject) {
2478  EffectPause(fxObject->GetId());
2479  return 0;
2480  }
2481  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_PAUSE > [" + arg0+"] not found!" );
2482  }
2483  break;
2484 
2485  case MO_ACTION_EFFECT_STOP:
2486  {
2487  arg0 = p_pDataMessage->Get(1).ToText();
2488  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2489  if (fxObject) {
2490  EffectStop(fxObject->GetId());
2491  return 0;
2492  }
2493  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_EFFECT_STOP > [" + arg0+"] not found!" );
2494  }
2495  break;
2496 
2503  case MO_ACTION_PARAM_SET:
2504  // code, mob, param, info
2505  {
2506  if (p_pDataMessage->Count()<4) {
2507  return -1;
2508  }
2509  arg0 = p_pDataMessage->Get(1).ToText();
2510  MObject = GetObjectByIdx(GetObjectId(arg0) );
2511  if (MObject) {
2512  arg1Text = p_pDataMessage->Get(2).ToText();//param
2513  arg2Text = p_pDataMessage->Get(3).ToText();//attribute
2514  } else return -1;
2515 
2516  moParam& pparam( MObject->GetConfig()->GetParam( arg1Text ));
2517  if (arg2Text=="property") {
2518  arg3Text = p_pDataMessage->Get(4).ToText();//property value "empty" or "published"
2519  pparam.GetParamDefinition().SetProperty( arg3Text );
2520  } else if(arg2Text=="interpolation") {
2521  moParamInterpolation ParamInter = pparam.GetParamDefinition().GetInterpolation();
2522  arg3Text = p_pDataMessage->Get(4).ToText();//linear|easein|easeinout|easout
2523  pparam.GetParamDefinition().GetInterpolation().SetInterpolationFunction( arg3Text );
2524  } else if(arg2Text=="duration") {
2525  arg3Text = p_pDataMessage->Get(4).ToText();//linear|easein|easeinout|easout
2526  moParamInterpolation ParamInter = pparam.GetParamDefinition().GetInterpolation();
2527  pparam.GetParamDefinition().GetInterpolation().SetDuration( atoi(arg3Text) );
2528  }
2529 
2530  SetParam( MObject->GetId(), pparam.GetParamDefinition().GetIndex(), pparam.GetParamDefinition() );
2531 
2532 
2534  MoldeoApiCommandData.SetText( "paramget" );
2535  p_pDataMessage->Set( 0, MoldeoApiCommandData );
2536  p_pDataMessage->Set( 1, moData(arg0) );
2537  p_pDataMessage->Set( 2, moData(arg1Text) );
2538  p_pDataMessage->Set( 3, moData("") );
2539  p_pDataMessage->Set( 4, moData("") );
2540  ProcessMoldeoAPIMessage( p_pDataMessage );
2541  }
2542  break;
2543 
2544  case MO_ACTION_PARAM_GET:
2545  {
2546  //MODebug2->Message("MO_ACTION_VALUE_SET");
2547  arg0 = p_pDataMessage->Get(1).ToText();//MOBLABEL
2548  MODebug2->Message(arg0);
2549  MObject = GetObjectByIdx(GetObjectId(arg0) );
2550 
2551  if (MObject) {
2552  //MODebug2->Message("MO_ACTION_VALUE_SET fxObject ok");
2553  arg1Text = p_pDataMessage->Get(2).ToText();//PARAMNAME or ID
2554  }
2555  else
2556  return -1;
2557 
2558  moParam mParam = MObject->GetConfig()->GetParam(arg1Text);
2559 
2560  //
2561  moText FullParamJSON = mParam.ToJSON();
2562  MODebug2->Message( FullParamJSON );
2563 
2564  pMessageToSend = new moDataMessage();
2565  if (pMessageToSend) {
2566  pMessageToSend->Add( moData("paramget") );
2567  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2568  pMessageToSend->Add( moData( arg0 ) );
2569  pMessageToSend->Add( moData( FullParamJSON ) );
2570  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2571  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2572  // send it: but we need an id
2573  SendMoldeoAPIMessage( pMessageToSend );
2574  }
2575  }
2576  break;
2577 
2578 
2586  {
2587  arg0 = p_pDataMessage->Get(1).ToText();
2588  arg1Int = p_pDataMessage->Get(2).Int();
2589 
2590  MObject = GetObjectByIdx(GetObjectId(arg0) );
2591  if (MObject) {
2592  //fxObject->GetConfig()->SetCurrentPreConf( arg1Int );
2593  if ( 0 <= arg1Int && arg1Int<MObject->GetConfig()->GetPreConfCount()) {
2594  this->SetPreconf( MObject->GetId(), arg1Int );
2595  } else {
2596  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > MO_ACTION_PRECONFIG_SET > preconfig index [" + IntToStr(arg1Int)+"] not found!" );
2597  }
2598  return 0;
2599  }
2600  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > MO_ACTION_PRECONFIG_SET > Moldeo Object [" + arg0+"] not found!" );
2601  }
2602  break;
2603 
2605  {
2606  arg0 = p_pDataMessage->Get(1).ToText();//label object
2607  arg1Int = p_pDataMessage->Get(2).Int();//preconfig index
2608 
2609  MObject = GetObjectByIdx(GetObjectId(arg0) );
2610  if (MObject) {
2611  //fxObject->GetConfig()->SetCurrentPreConf( arg1Int );
2612  if ( 0 <= arg1Int && arg1Int<MObject->GetConfig()->GetPreConfCount()) {
2613  //this->SetPreconf( fxObject->GetId(), arg1Int );
2614  //do nothing
2615  } else {
2616  MObject->GetConfig()->AddPreconfig( arg1Int );
2617  FullObjectJSON = MObject->ToJSON();
2618  MODebug2->Message(FullObjectJSON);
2619 
2620  pMessageToSend = new moDataMessage();
2621  if (pMessageToSend) {
2622  pMessageToSend->Add( moData("objectget") );
2623  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2624  pMessageToSend->Add( moData( arg0 ) );
2625  pMessageToSend->Add( moData( FullObjectJSON ) );
2626  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2627  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2628  // send it: but we need an id
2629  SendMoldeoAPIMessage( pMessageToSend );
2630  }
2631  }
2632  return 0;
2633  }
2634  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > MO_ACTION_PRECONFIG_SET > Moldeo Object [" + arg0+"] not found!" );
2635  }
2636  break;
2637 
2642  case MO_ACTION_OBJECT_ADD:
2643  {
2645 
2646  }
2647  break;
2648 
2649  case MO_ACTION_OBJECT_MOVE:
2650  {
2652 
2653  }
2654  break;
2655 
2657  {
2659  }
2660  break;
2661 
2663  {
2665  }
2666  break;
2667 
2668 
2669  case MO_ACTION_OBJECT_GET:
2670  {
2671  arg0 = p_pDataMessage->Get(1).ToText();
2672  MObject = NULL;
2673  fxObject = m_EffectManager.GetEffectByLabel( arg0 );
2674  if (fxObject) {
2675  FullObjectJSON = fxObject->ToJSON();
2676  MODebug2->Message(FullObjectJSON);
2677  } else {
2678  int idobj = GetObjectId( arg0 );
2679  MObject = GetObjectByIdx( idobj );
2680  if (MObject) {
2681  FullObjectJSON = "{ 'object': " + MObject->ToJSON();
2682  FullObjectJSON+= "}";
2683  MODebug2->Message( FullObjectJSON );
2684  }
2685  }
2686 
2687  if (fxObject || MObject) {
2688  pMessageToSend = new moDataMessage();
2689  if (pMessageToSend) {
2690  pMessageToSend->Add( moData("objectget") );
2691  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2692  pMessageToSend->Add( moData( arg0 ) );
2693  pMessageToSend->Add( moData( FullObjectJSON ) );
2694  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2695  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2696  // send it: but we need an id
2697  SendMoldeoAPIMessage( pMessageToSend );
2698  }
2699 
2700  return 0;
2701  }
2702  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_GET > [" + arg0+"] not found!" );
2703  }
2704  break;
2705 
2707  {
2708  arg0 = p_pDataMessage->Get(1).ToText();
2709  int idobj = GetObjectId( arg0 );
2710  MObject = GetObjectByIdx( idobj );
2711  if (MObject) {
2712  FullObjectJSON = "{ 'objectconfig': " + MObject->GetConfig()->ToJSON();
2713  FullObjectJSON+= "}";
2714  MODebug2->Message( FullObjectJSON );
2715 
2716  pMessageToSend = new moDataMessage();
2717  if (pMessageToSend) {
2718  pMessageToSend->Add( moData("objectgetconfig") );
2719  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2720  pMessageToSend->Add( moData( arg0 ) );
2721  pMessageToSend->Add( moData( FullObjectJSON ) );
2722  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2723  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2724  // send it: but we need an id
2725  SendMoldeoAPIMessage( pMessageToSend );
2726  }
2727 
2728  return 0;
2729  }
2730  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_GETCONFIG > [" + arg0+"] not found!" );
2731  }
2732  break;
2733 
2735  {
2736  arg0 = p_pDataMessage->Get(1).ToText();
2737  arg1Int = p_pDataMessage->Get(2).Int();
2738  int idobj = GetObjectId( arg0 );
2739  MObject = GetObjectByIdx( idobj );
2740  if (MObject) {
2741  moPreConfig pC = MObject->GetConfig()->GetPreconfig(arg1Int);
2742  FullObjectJSON = "{ 'preconfig': " + pC.ToJSON();
2743  FullObjectJSON+= ", 'position': "+IntToStr(arg1Int)+" }";
2744  MODebug2->Message( FullObjectJSON );
2745 
2746  pMessageToSend = new moDataMessage();
2747  if (pMessageToSend) {
2748  pMessageToSend->Add( moData("objectgetpreconfig") );
2749  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2750  pMessageToSend->Add( moData( arg0 ) );
2751  pMessageToSend->Add( moData( FullObjectJSON ) );
2752  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2753  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2754  // send it: but we need an id
2755  SendMoldeoAPIMessage( pMessageToSend );
2756  }
2757 
2758  return 0;
2759  }
2760  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_GETPRECONFIG > [" + arg0+"] not found!" );
2761  }
2762  break;
2763 
2764 
2766  {
2767  arg0 = p_pDataMessage->Get(1).ToText();
2768  arg1Int = p_pDataMessage->Get(2).Int();// [0,2] = 3 preconfigs [0,-1]
2769  arg2Int = p_pDataMessage->Get(3).Int();// -1 > final
2770  MObject = NULL;
2771  moPreConfig pC = fxObject->GetConfig()->GetPreconfig(arg1Int);
2772  if (MObject) {
2773  FullObjectJSON = "{ 'preconfig': " + pC.ToJSON();
2774  FullObjectJSON+= ", 'position': "+IntToStr(arg1Int)+" }";
2775  MODebug2->Message(FullObjectJSON);
2776 
2777  pMessageToSend = new moDataMessage();
2778  if (pMessageToSend) {
2779  pMessageToSend->Add( moData("objectgetpreconfigs") );
2780  //pMessageToSend->Add( moData("ANY_LISTENER_ID") ); /// identifier for last message
2781  pMessageToSend->Add( moData( arg0 ) );
2782  pMessageToSend->Add( moData( FullObjectJSON ) );
2783  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
2784  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
2785  // send it: but we need an id
2786  SendMoldeoAPIMessage( pMessageToSend );
2787  }
2788 
2789  return 0;
2790  }
2791  MODebug2->Error("moConsole::ProcessMoldeoAPIMessage > "+MoldeoAPICommand+" > MO_ACTION_OBJECT_GETPRECONFIGS > [" + arg0+"] not found!" );
2792  }
2793  break;
2794 
2800  {
2801  //m_pIODeviceManager->GetEvents()->Add( 7878, SDL_KEYDOWN, SDLK_F12 );
2802 
2803  newMessage = new moMessage( 999 ,
2804  999 ,
2805  -1,
2806  pData );
2807  m_pIODeviceManager->GetEvents()->Add( (moEvent*) newMessage );
2808  MODebug2->Message("MO_ACTION_CONSOLE_PRESENTATION");
2809  return 0;
2810  }
2811  break;
2812 
2814  {
2815  //ScreenShot();
2817  pMessageToSend = new moDataMessage();
2818  if (pMessageToSend) {
2819  pMessageToSend->Add( moData("consolescreenshot") );
2820  pMessageToSend->Add( moData("success") );
2822  pMessageToSend->Add( moData("{\"lastscreenshot\" : \""+m_LastScreenshot + "\"}" ) );
2823  SendMoldeoAPIMessage( pMessageToSend );
2824  }
2825  }
2826  return 0;
2827  }
2828  break;
2829 
2831  {
2832  //ScreenShot();
2833  if (m_pResourceManager->GetRenderMan()->PreviewShot( true ) ) {
2834  pMessageToSend = new moDataMessage();
2835  if (pMessageToSend) {
2836  pMessageToSend->Add( moData("consolepreviewshot") );
2837  pMessageToSend->Add( moData("success") );
2839  //pMessageToSend->Add( moData("{\"lastscreenshot\" : \""+m_LastScreenshot + "\"}" ) );
2840  SendMoldeoAPIMessage( pMessageToSend );
2841  }
2842  }
2843 
2844  return 0;
2845  }
2846  break;
2847 
2849  {
2850  //ScreenShot();
2852  MODebug2->Message("moConsole::Processing > Saving ALL");
2853  //Save("");
2854  for( int fx=0; fx<(int)m_MoldeoObjects.Count(); fx++ ) {
2855  m_MoldeoObjects[fx]->GetConfig()->SaveConfig();
2856  }
2857 
2858  pMessageToSend = new moDataMessage();
2859  if (pMessageToSend) {
2860  pMessageToSend->Add( moData("consolesave") );
2861  pMessageToSend->Add( moData("success") );
2862  SendMoldeoAPIMessage( pMessageToSend );
2863  }
2864  return 0;
2865  }
2866  break;
2867 
2869  {
2870  MODebug2->Message("moConsole::Processing > Save As");
2871  arg0 = p_pDataMessage->Get(1).ToText();//DIRECTORY
2873  MODebug2->Message("moConsole::Processing > Save As: FROM: " + m_pResourceManager->GetDataMan()->GetDataPath()
2874  + " TO: "+ arg0);
2876 
2878 
2879  MODebug2->Message("moConsole::Processing > Save As OK!!!");
2881  arg0,
2882  molFile.GetFullName() );
2883  MODebug2->Message(" changing path: " + m_pResourceManager->GetDataMan()->GetDataPath()
2884  + " mol file:" + molFile.GetFullName() );
2885 
2886  for( int fx=0; fx<(int)m_MoldeoObjects.Count(); fx++ ) {
2887  moFile cfgName( m_MoldeoObjects[fx]->GetConfig()->GetName() );
2888  m_MoldeoObjects[fx]->GetConfig()->SaveConfig( arg0+moSlash+cfgName.GetFullName() );
2889  }
2890  pMessageToSend = new moDataMessage();
2891  if (pMessageToSend) {
2892  pMessageToSend->Add( moData("consolesaveas") );
2893  pMessageToSend->Add( moData("success") );
2895  pMessageToSend->Add( moData("{\"projectfullpath\":\""+arg0 + "\"}" ) );
2896  SendMoldeoAPIMessage( pMessageToSend );
2897  }
2898 
2899  } else {
2900  pMessageToSend = new moDataMessage();
2901  if (pMessageToSend) {
2902  pMessageToSend->Add( moData("consolesaveas") );
2903  pMessageToSend->Add( moData("failed") );
2904  SendMoldeoAPIMessage( pMessageToSend );
2905  }
2906  }
2907  }
2908  break;
2909 
2911  {
2912  ConsolePlay();
2913 
2914  EffectStateJSON = m_ConsoleState.ToJSON();
2915 
2916  pMessageToSend = new moDataMessage();
2917 
2918  if (pMessageToSend) {
2919  pMessageToSend->Add( moData("consolegetstate") );
2920  pMessageToSend->Add( moData("__console__") );
2921  pMessageToSend->Add( moData( EffectStateJSON ) );
2923  SendMoldeoAPIMessage( pMessageToSend );
2924  }
2925 
2926  return 0;
2927  }
2928  break;
2929 
2931  {
2932  ConsoleStop();
2933 
2934  EffectStateJSON = m_ConsoleState.ToJSON();
2935 
2936  pMessageToSend = new moDataMessage();
2937 
2938  if (pMessageToSend) {
2939  pMessageToSend->Add( moData("consolegetstate") );
2940  pMessageToSend->Add( moData("__console__" ) );
2941  pMessageToSend->Add( moData( EffectStateJSON ) );
2943  SendMoldeoAPIMessage( pMessageToSend );
2944  }
2945  return 0;
2946  }
2947  break;
2948 
2950  {
2951  ConsolePause();
2952 
2953  EffectStateJSON = m_ConsoleState.ToJSON();
2954 
2955  pMessageToSend = new moDataMessage();
2956 
2957  if (pMessageToSend) {
2958  pMessageToSend->Add( moData("consolegetstate") );
2959  pMessageToSend->Add( moData("__console__" ) );
2960  pMessageToSend->Add( moData( EffectStateJSON ) );
2962  SendMoldeoAPIMessage( pMessageToSend );
2963  }
2964  return 0;
2965  }
2966  break;
2967 
2969  {
2971 
2972  EffectStateJSON = m_ConsoleState.ToJSON();
2973 
2974  pMessageToSend = new moDataMessage();
2975 
2976  if (pMessageToSend) {
2977  pMessageToSend->Add( moData("consolerecordsession") );
2978  pMessageToSend->Add( moData("__console__" ) );
2979  pMessageToSend->Add( moData( EffectStateJSON ) );
2981  SendMoldeoAPIMessage( pMessageToSend );
2982  }
2983  return 0;
2984  }
2985  break;
2986 
2988  {
2989  arg0 = p_pDataMessage->Get(1).ToText();//QUALITY! JPG,JPGGOOD...
2990  ConsoleRenderSession( arg0 );
2991 
2992 
2993  moText rendered_folder = DataMan()->GetSession()->GetRenderedFolder();
2994  moText RenderSessionInfo = "{";
2995  moText data_session = DataMan()->GetSession()->ToJSON();
2996  EffectStateJSON = m_ConsoleState.ToJSON();
2997 
2998  RenderSessionInfo+= moText("'consolestate': ") + EffectStateJSON;
2999  RenderSessionInfo+= moText(",") + moText("'session': ") + DataMan()->GetSession()->ToJSON();
3000  RenderSessionInfo+= "}";
3001 
3002  pMessageToSend = new moDataMessage();
3003 
3004  if (pMessageToSend) {
3005  pMessageToSend->Add( moData("consolerendersession") );
3006  pMessageToSend->Add( moData("__console__" ) );
3007  pMessageToSend->Add( moData( RenderSessionInfo ) );
3009  SendMoldeoAPIMessage( pMessageToSend );
3010  }
3011  return 0;
3012  }
3013  break;
3014 
3015  case MO_ACTION_CONSOLE_GET:
3016  {
3017  FullObjectJSON = "{";
3018  FullObjectJSON+= moText("'datapath': '")+m_pResourceManager->GetDataMan()->GetDataPath()+"'";
3019  FullObjectJSON+= fieldSeparation+"'apppath': '"+m_pResourceManager->GetDataMan()->GetAppPath()+"'";
3020  FullObjectJSON+= fieldSeparation+"'appdatapath': '"+m_pResourceManager->GetDataMan()->GetAppDataPath()+"'";
3021  FullObjectJSON+= fieldSeparation+"'configname': '"+m_pResourceManager->GetDataMan()->GetConsoleConfigName()+"'";
3022  //FullObjectJSON+= fieldSeparation+"'config': "+this->m_Config.ToJSON();
3023  //FullObjectJSON+= fieldSeparation+"'MapEffects': {";
3024  FullObjectJSON+= fieldSeparation+"'MapObjects': {";
3025  fieldSeparation = "";
3026  /*
3027  for(int i=0;i<(int)this->m_EffectManager.AllEffects().Count(); i++ ) {
3028  moEffect* Fx = m_EffectManager.AllEffects().Get(i);
3029  FullObjectJSON+= fieldSeparation+"'"+Fx->GetLabelName()+"': '" + Fx->GetKeyName() +"'";
3030  fieldSeparation = ",";
3031  }
3032  */
3033 
3034  for(int i=0;i<(int)this->m_MoldeoObjects.Count(); i++ ) {
3035  moMoldeoObject* Mobj = m_MoldeoObjects.Get(i);
3036  FullObjectJSON+= fieldSeparation+"'"+Mobj->GetLabelName()+"': {";
3037  FullObjectJSON+= "'name': '" + Mobj->GetName() +"',";
3038  FullObjectJSON+= "'cfg': '" + Mobj->GetConfigName() +"',";
3039  FullObjectJSON+= "'key': '" + Mobj->GetKeyName() +"',";
3040  FullObjectJSON+= "'cla': '" + Mobj->GetMobDefinition().GetTypeToClass( Mobj->GetMobDefinition().GetType() ) +"'";
3041  FullObjectJSON+= "}";
3042  fieldSeparation = ",";
3043  }
3044 
3045  FullObjectJSON+= "}";
3046 
3047  FullObjectJSON+= "}";
3048 
3049  pMessageToSend = new moDataMessage();
3050  if (pMessageToSend) {
3051  pMessageToSend->Add( moData("consoleget") );
3052  pMessageToSend->Add( moData("__console__") );
3053  pMessageToSend->Add( moData( FullObjectJSON ) );
3054  //pMessageToSend->Add( moData( "{'testing': 0}" ) );
3055  //MODebug2->Message( "moConsole::ProcessMoldeoAPIMessage > replying: " + EffectStateJSON );
3056  // send it: but we need an id
3057  SendMoldeoAPIMessage( pMessageToSend );
3058  }
3059 
3060  return 0;
3061  }
3062  break;
3063 
3065  {
3067  EffectStateJSON = m_ConsoleState.ToJSON();
3068 
3069  pMessageToSend = new moDataMessage();
3070 
3071  if (pMessageToSend) {
3072  pMessageToSend->Add( moData("consolegetstate") );
3073  pMessageToSend->Add( moData("__console__" ) );
3074  pMessageToSend->Add( moData( EffectStateJSON ) );
3076  SendMoldeoAPIMessage( pMessageToSend );
3077  }
3078 
3079  return 0;
3080  }
3081  break;
3082 
3084  {
3086  return 0;
3087  }
3088  break;
3089 
3090  default:
3091 
3092  break;
3093 
3094  }
3095 
3096  return -1; /*PROCESS NOT OK*/
3097 }
3098 
3099 void moConsole::Error( const moText &p_message ) {
3100  MODebug2->Error( p_message );
3101 }
3102 
3103 int moConsole::NewMob( const moMobDefinition &p_MobDef ) {
3104 
3105  moText confignamecomplete = "";
3106  bool res = false;
3107 
3108  //p_MobDesc.SetProjectDescriptor( GetProject() );
3109 
3110  moMobDefinition pMobDef = p_MobDef;//p_MobDesc.GetMobDefinition();
3111 
3112  moEffect* pEffect = NULL;
3113  moResource* pResource = NULL;
3114  MOint rid = -1;
3115  moMoldeoObject* pMOB = NULL;
3116  moMoldeoObject* pFatherMOB = NULL;
3117  moEffectManager* pFxManager = NULL;
3118 
3119  moConfig* pConfig = NULL;
3120 
3121  if (pMobDef.GetMoldeoFatherId()==-1) {
3122  pConfig = &m_Config;
3123  pFxManager = &m_EffectManager;
3124  }
3125  else if (pMobDef.GetMoldeoFatherId()>=0) {
3126  pFatherMOB = GetObjectByIdx( pMobDef.GetMoldeoFatherId() );
3127  if (pFatherMOB && pFatherMOB->GetName()=="scene") {
3128  moSceneEffect* pScene = (moSceneEffect*) pFatherMOB;
3129  pConfig = pScene->GetConfig();
3130  pFxManager = &pScene->GetEffectManager();
3131  }
3132  }
3133 
3134  switch( (int) pMobDef.GetType()) {
3135  case MO_OBJECT_PREEFFECT:
3136  pMobDef.SetConsoleParamIndex( pConfig->GetParamIndex("preeffect") );
3137  pMobDef.SetConsoleValueIndex( pFxManager->PreEffects().Count() );
3138  pMOB = (moMoldeoObject*)pFxManager->New( pMobDef );
3139  pEffect = (moEffect*) pMOB;
3140  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "preeffect" );
3141  break;
3142  case MO_OBJECT_EFFECT:
3143  pMobDef.SetConsoleParamIndex( pConfig->GetParamIndex("effect") );
3144  pMobDef.SetConsoleValueIndex( pFxManager->Effects().Count() );
3145  pMOB = (moMoldeoObject*)pFxManager->New( pMobDef );
3146  pEffect = (moEffect*) pMOB;
3147  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "effect" );
3148  break;
3149  case MO_OBJECT_POSTEFFECT:
3150  pMobDef.SetConsoleParamIndex( pConfig->GetParamIndex("posteffect") );
3151  pMobDef.SetConsoleValueIndex( pFxManager->PostEffects().Count() );
3152  pMOB = (moMoldeoObject*)pFxManager->New( pMobDef );
3153  pEffect = (moEffect*) pMOB;
3154  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "posteffect" );
3155  break;
3157  pMobDef.SetConsoleParamIndex( pConfig->GetParamIndex("mastereffect") );
3158  pMobDef.SetConsoleValueIndex( pFxManager->MasterEffects().Count() );
3159  pMOB = (moMoldeoObject*) pFxManager->New( pMobDef );
3160  pEffect = (moEffect*) pMOB;
3161  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "mastereffect" );
3162  break;
3163  case MO_OBJECT_IODEVICE:
3164  pMobDef.SetConsoleParamIndex( pConfig->GetParamIndex("devices") );
3165  pMobDef.SetConsoleValueIndex( m_pIODeviceManager->IODevices().Count() );
3166  pMOB = (moMoldeoObject*) m_pIODeviceManager->NewIODevice( pMobDef.GetName(), pMobDef.GetConfigName(), pMobDef.GetLabelName(), pMobDef.GetKeyName(), MO_OBJECT_IODEVICE, pMobDef.GetMobIndex().GetParamIndex(), pMobDef.GetMobIndex().GetValueIndex() );
3167  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "iodevice" );
3168  break;
3169  case MO_OBJECT_RESOURCE:
3170  pMobDef.SetConsoleParamIndex( m_Config.GetParamIndex("resources") );
3171  pMobDef.SetConsoleValueIndex( m_Config.GetParam("resources").GetValuesCount() );
3172  rid = m_pResourceManager->GetResourceIndex( pMobDef.GetLabelName() );
3173  if(rid>-1) pResource = m_pResourceManager->GetResource(rid);
3174 
3175  if (pResource ) {
3176  //do nothing
3177  if (pResource->GetLabelName()!=pMobDef.GetLabelName()) {
3178  pResource->SetConfigName( pMobDef.GetConfigName() );
3179  pResource->SetLabelName( pMobDef.GetLabelName() );
3180  } else Error( moText("Resource already loaded: ") + (moText)pResource->GetLabelName() );
3181  } else
3182  if (m_pResourceManager->NewResource( pMobDef.GetName(), pMobDef.GetConfigName(), pMobDef.GetLabelName(), pMobDef.GetKeyName() )) {
3183  rid = m_pResourceManager->GetResourceIndex( pMobDef.GetLabelName() );
3184  if (rid>=0) {
3185  pResource = m_pResourceManager->GetResource(rid);
3186  if (pResource) {
3187  pResource->SetConfigName( pMobDef.GetConfigName() );
3188  pResource->SetLabelName( pMobDef.GetLabelName() );
3189  }
3190  }
3191  }
3192  pMOB = (moMoldeoObject*) pResource;
3193 
3194  pMOB->SetMobDefinition( pMobDef );
3195 
3196  if (pMOB) pMOB->GetConfig()->Set( pMOB->GetName(), "resource" );
3197  break;
3198  default:
3199  Error(moText("moConsole::NewMob: No mob type defined."));
3200  return -1;
3201  break;
3202  }
3203 
3204  if (pMOB) {
3205 
3206  if (pMOB->GetConfigName().Length()>0) {
3207 
3208  confignamecomplete = m_pResourceManager->GetDataMan()->GetDataPath();
3209  confignamecomplete += moSlash + moText(pMOB->GetConfigName());
3210  confignamecomplete += moText(".cfg");
3211 
3212  pMOB->GetDefinition();
3213 
3215  moFile pFile(confignamecomplete);
3216 
3218  if (!pFile.Exists()) {
3220  res = pMOB->GetConfig()->CreateDefault( confignamecomplete );
3221 
3222  } else {
3224  res = true;
3225 
3226  }
3227 
3228  if (res) {
3229  pMOB->GetConfig()->UnloadConfig();
3230 
3232 
3233  res = pMOB->Init();
3234  if (res) {
3235  if (pEffect) {
3236  pEffect->LoadCodes( m_pIODeviceManager );
3237  pEffect->Activate();
3238  }
3239  } else {
3240  Error( moText("moConsole::NewMob Couldn't initialized effect" ) );
3241  }
3242 
3243  //pEffect->Draw( &m_EffectState.tempo );
3245  moValue effectvalue( pMOB->GetName(), "TXT" );
3246  effectvalue.AddSubValue( pMOB->GetConfigName() , "TXT" );
3247  effectvalue.AddSubValue( pMOB->GetLabelName() , "TXT" );
3248  effectvalue.AddSubValue( "0" , "NUM" );
3249  if (pMOB->GetMobDefinition().GetActivate())
3250  effectvalue.AddSubValue( "1" , "NUM" );
3251  else
3252  effectvalue.AddSubValue( "0" , "NUM" );
3253 
3254  if (pMOB->GetMobDefinition().GetKeyName()!="")
3255  effectvalue.AddSubValue( pMOB->GetMobDefinition().GetKeyName() , "TXT" );
3256  else
3257  effectvalue.AddSubValue( "" , "TXT" );
3258 
3259  if (pConfig) pConfig->GetParam( pMOB->GetMobDefinition().GetMobIndex().GetParamIndex() ).AddValue( effectvalue );
3260 
3261  LoadConnections();
3262  moMobDefinition MDef = pMOB->GetMobDefinition();
3263  bool validity = MDef.IsValid();
3264  if (validity==false) {
3265  Error( moText("moConsole::NewMob:: Source > MobDefinition Invalid") );
3266  } else {
3267  //ProjectUpdated( m_ProjectDescriptor );
3268  return 1;
3269  }
3270 
3271  } else {
3272  Error( moText("moConsole::NewMob Couldn't create default configuration") );
3273  }
3274 
3275  } else {
3276  Error( moText("moConsole::NewMob Config filename undefined" ) );
3277  }
3278  } else {
3279  Error( moText("moConsole::NewMob Couldn't create effect: " ) + pMobDef.GetName() );
3280  }
3281 
3282  return -1;
3283 
3284 }
3285 
3286 int moConsole::AddChildMob( const moMobDefinition &p_MobDef, const moMobDefinition &p_MobDefFather ) {
3287 
3288  moMobDefinition pMobDef = p_MobDef;
3289  /*moMoldeoObject* pMOB = GetObject( p_MobDesc );*/
3290  /*really must be check by NewMob... it shouldnt let create MOBs with same label and configname...*/
3291 
3292  pMobDef.SetMoldeoFatherId( p_MobDefFather.GetMoldeoId() );
3293 
3294  return NewMob( pMobDef );
3295 }
3296 
3297 
3298 int moConsole::MoveMob( const moMobDefinition& p_MobDef, int position ) {
3299 
3301 
3302  moMoldeoObject* pObj = NULL;
3303  moMoldeoObject* pObjAux = NULL;
3304  int array_count = 0;
3305  moMobDefinition pMobDef = p_MobDef;
3306  moMoldeoObjectType MobType = pMobDef.GetType();
3307  int index_object = pMobDef.GetMobIndex().GetValueIndex();
3308 
3309  pObj = m_MoldeoObjects.GetRef(
3310  RelativeToGeneralIndex( index_object, MobType )
3311  );
3312 
3314  switch( pMobDef.GetType() ) {
3315 
3316  case MO_OBJECT_EFFECT:
3317  array_count = m_EffectManager.Effects().Count();
3318  break;
3319  case MO_OBJECT_PREEFFECT:
3320  array_count = m_EffectManager.PreEffects().Count();
3321  break;
3322  case MO_OBJECT_POSTEFFECT:
3323  array_count = m_EffectManager.PostEffects().Count();
3324  break;
3326  array_count = m_EffectManager.MasterEffects().Count();
3327  break;
3328 
3329  case MO_OBJECT_IODEVICE:
3330  array_count = m_pIODeviceManager->IODevices().Count();
3331  break;
3332  case MO_OBJECT_RESOURCE:
3333  //array_count = m_pResourceManager->Resources().Count();
3334  array_count = 0;
3335  Error( "Sorry. Changing order of resources is not allowed yet." );
3336  return -1;
3337  break;
3338  default:
3339  array_count = 0;
3340  break;
3341 
3342  }
3343 
3344 
3345  if ( position >= 0 && position < array_count ) {
3346 
3348  //p_MobDesc.GetMobDefinition().GetMobIndex().GetValueIndex()
3349  //moEffect* pObjFx = m_EffectManager.Effects().GetRef(index_object);
3350  int paramindex = pMobDef.GetMobIndex().GetParamIndex();
3351  int valueindex = pMobDef.GetMobIndex().GetValueIndex();
3352 
3353  int preconf1 = m_Config.GetValue( paramindex, valueindex ).GetSubValue(3).Int();
3354  int active1 = m_Config.GetValue( paramindex, valueindex ).GetSubValue(4).Int();
3355 
3357 
3358 
3359  int diff = position - index_object;
3360  if (diff==0) {
3362  } else if (diff>0) {
3364 
3367  for( int o = index_object; o < (position); o++ ) {
3368 
3370  pObjAux = m_MoldeoObjects.GetRef( RelativeToGeneralIndex( o+1, MobType ) );
3371 
3372  if ( MO_OBJECT_EFFECT<=MobType && MobType<=MO_OBJECT_PREEFFECT) m_EffectManager.Set( o, pObjAux );
3373  else if (MobType==MO_OBJECT_IODEVICE) m_pIODeviceManager->IODevices().Set( o, (moIODevice*)pObjAux );
3374 
3375  m_MoldeoObjects.Set( RelativeToGeneralIndex( o, MobType ) , pObjAux );
3376 
3378  //moMobIndex mindex2 = pObjFxAux->GetMobDefinition().GetMobIndex();
3379  moMobIndex mindex2 = pObjAux->GetMobDefinition().GetMobIndex();
3380  int preconf2 = m_Config.GetValue( paramindex, mindex2.GetValueIndex() ).GetSubValue(3).Int();
3381  int active2 = m_Config.GetValue( paramindex, mindex2.GetValueIndex() ).GetSubValue(4).Int();
3382 
3383  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(0).SetText( pObjAux->GetName() );
3384  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(1).SetText( pObjAux->GetConfigName() );
3385  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(2).SetText( pObjAux->GetLabelName() );
3386  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(3).SetInt( preconf2 );
3387  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(4).SetInt( active2 );
3388  pObjAux->SetConsoleValueIndex( o );
3389 
3390  }
3392  if ( MO_OBJECT_EFFECT<=MobType && MobType<=MO_OBJECT_PREEFFECT) m_EffectManager.Set( position, pObj );
3393  else if (MobType==MO_OBJECT_IODEVICE) m_pIODeviceManager->IODevices().Set( position, (moIODevice*)pObj );
3394 
3395  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(0).SetText( pObj->GetName() );
3396  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(1).SetText( pObj->GetConfigName() );
3397  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(2).SetText( pObj->GetLabelName() );
3398  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(3).SetInt( preconf1 );
3399  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(4).SetInt( active1 );
3400  pObj->SetConsoleValueIndex( position );
3401  int mobsindx = RelativeToGeneralIndex( position, MobType );
3402  m_MoldeoObjects.Set( mobsindx, pObj );
3403 
3404  } else if (diff<0) {
3406 
3409  for( int o = index_object ; o >= (position+1) ; o-- ) {
3410 
3411  pObjAux = m_MoldeoObjects.GetRef( RelativeToGeneralIndex( o-1, MobType ) );
3412 
3413  if ( MO_OBJECT_EFFECT<=MobType && MobType<=MO_OBJECT_PREEFFECT) m_EffectManager.Set( o, pObjAux );
3414  else if (MobType==MO_OBJECT_IODEVICE) m_pIODeviceManager->IODevices().Set( o, (moIODevice*)pObjAux );
3415 
3416  m_MoldeoObjects.Set( RelativeToGeneralIndex( o, MobType ), pObjAux );
3417 
3418  moMobIndex mindex2 = pObjAux->GetMobDefinition().GetMobIndex();
3419  int preconf2 = m_Config.GetValue( paramindex, mindex2.GetValueIndex() ).GetSubValue(3).Int();
3420  int active2 = m_Config.GetValue( paramindex, mindex2.GetValueIndex() ).GetSubValue(4).Int();
3421 
3422  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(0).SetText( pObjAux->GetName() );
3423  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(1).SetText( pObjAux->GetConfigName() );
3424  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(2).SetText( pObjAux->GetLabelName() );
3425  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(3).SetInt( preconf2 );
3426  m_Config.GetParam( paramindex ).GetValue( o ).GetSubValue(4).SetInt( active2 );
3427 
3428  pObjAux->SetConsoleValueIndex( o );
3429 
3430  }
3432  if ( MO_OBJECT_EFFECT<=MobType && MobType<=MO_OBJECT_PREEFFECT) m_EffectManager.Set( position, pObj );
3433  else if (MobType==MO_OBJECT_IODEVICE) m_pIODeviceManager->IODevices().Set( position, (moIODevice*)pObj );
3434 
3435  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(0).SetText( pObj->GetName() );
3436  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(1).SetText( pObj->GetConfigName() );
3437  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(2).SetText( pObj->GetLabelName() );
3438  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(3).SetInt( preconf1 );
3439  m_Config.GetParam( paramindex ).GetValue( position ).GetSubValue(4).SetInt( active1 );
3440  pObj->SetConsoleValueIndex( position );
3441  int mobsindx = RelativeToGeneralIndex( position, MobType );
3442  m_MoldeoObjects.Set( mobsindx, pObj );
3443  }
3444 
3445  }
3446 
3447  LoadConnections();
3448 
3449  return 1;
3450 
3451 }
3452 
3453 
3455 
3457  moText datapath;
3458  moText filenameduplicate;
3459  moFile newfile;
3460  moText filename = p_MobDef.GetConfigName();
3461  moText labelname = p_MobDef.GetLabelName();
3462  moText labelnameduplicate;
3463  int mStatus = -1;
3464  moMobDefinition pMobDef = p_MobDef;
3465 
3466  if (m_pResourceManager) {
3467 
3469 
3470  filename = filename;
3471  labelname = labelname;
3472 
3473  filenameduplicate = filename + moText(".cfg");
3474 
3475  newfile.SetCompletePath( datapath + filenameduplicate );
3476 
3477  int count = 1;
3478  while( newfile.Exists() ) {
3479  filenameduplicate = filename + IntToStr( count );
3480  newfile.SetCompletePath( datapath + filenameduplicate + moText(".cfg") );
3481  count++;
3482  }
3483 
3484  m_pResourceManager->GetFileMan()->CopyFile( datapath + filename + moText(".cfg"), datapath + filenameduplicate + moText(".cfg") );
3485 
3486 
3487  labelnameduplicate = labelname;
3488 
3490  count = 1;
3491  while(LabelNameExists(labelnameduplicate)) {
3492  labelnameduplicate = labelname + IntToStr( count );
3493  count++;
3494  }
3495 
3497  pMobDef.SetConfigName( filenameduplicate );
3498  pMobDef.SetLabelName( labelnameduplicate );
3499 
3500  mStatus = NewMob( pMobDef );
3501 
3502  }
3503 
3504  return mStatus;
3505 }
3506 
3507 int moConsole::DeleteMob( const moMobDefinition& p_MobDef ) {
3508 
3509  moMoldeoObject* pMOB;
3510 
3511  pMOB = GetObjectByIdx(p_MobDef.GetMoldeoId());
3512 
3513  bool consoleinit = m_bInitialized;
3514 
3515  moMobDefinition pMobDef = p_MobDef;
3516 
3517  moMoldeoObject* pFatherMOB = NULL;
3518  moEffectManager* pFxManager = NULL;
3519 
3520  moConfig* pConfig = NULL;
3521  moMobIndex mobindex = pMobDef.GetMobIndex();
3522  int removeid = pMOB->GetMobDefinition().GetMobIndex().GetValueIndex();
3523 
3524  if (pMobDef.GetMoldeoFatherId()==-1) {
3525  pConfig = &m_Config;
3526  pFxManager = &m_EffectManager;
3527  }
3528  else if (pMobDef.GetMoldeoFatherId()>=0) {
3529  pFatherMOB = GetObjectByIdx( pMobDef.GetMoldeoFatherId() );
3530  if (pFatherMOB && pFatherMOB->GetName()=="scene") {
3531  moSceneEffect* pScene = (moSceneEffect*) pFatherMOB;
3532  pConfig = pScene->GetConfig();
3533  pFxManager = &pScene->GetEffectManager();
3534  //removeid = pFxManager->GetEffectId( pMobDef.GetLabelName() );
3535  }
3536  }
3537 
3538 
3539 
3540  if (pMOB && pFxManager) {
3541 
3542  if ( pMOB->GetId() >= MO_MOLDEOOBJECTS_OFFSET_ID ) {
3543 
3544  //just wait until we delete the object
3545  //important to avoid conflicts on loop...
3546  //maybe MUST BE A LOCK
3547  m_bInitialized = false;
3548 
3549 
3550 
3551 
3552  if (removeid>-1) {
3553  switch( (int)pMOB->GetType() ) {
3554  case MO_OBJECT_PREEFFECT:
3555  case MO_OBJECT_EFFECT:
3556  case MO_OBJECT_POSTEFFECT:
3558 
3559  if (pFxManager->RemoveEffect( removeid, pMOB->GetType())) {
3561  pConfig->GetParam( mobindex.GetParamIndex() ).DeleteValue( removeid );
3562  }
3563  break;
3564  case MO_OBJECT_IODEVICE:
3565  if ( m_pIODeviceManager ) {
3566  m_pIODeviceManager->IODevices().Remove( removeid );
3568  m_Config.GetParam( mobindex.GetParamIndex() ).DeleteValue( removeid );
3569  }
3570  break;
3571  case MO_OBJECT_RESOURCE:
3572  if (m_pResourceManager && m_pResourceManager->RemoveResource( removeid ) ) {
3574  m_Config.GetParam( mobindex.GetParamIndex() ).DeleteValue( removeid );
3575  }
3576  break;
3577  }
3578  }
3579 
3580  LoadConnections();
3581 
3583  //m_bInitialized = consoleinit;
3584 
3586  //ProjectUpdated( GetProject() );
3587 
3588  }
3589  }
3590 
3591 
3592  return 1;
3593 }
3594 
3595 void
3597 
3598  moText action;
3599  moText object_label;
3600  moText position;
3601  moText param_label;
3602  moText value_index;
3603  //int valueidx = -1;
3604 
3605  //int objectid = 0;
3606  //int paramid = 0;
3607  //moMoldeoObject* Object = NULL;
3608  //moEffect* pEffect = NULL;
3609  moParam pParam;
3610 
3611  if (p_pMessage) {
3612 
3613  moText actions = p_pMessage->m_Data.ToText();
3614 
3615  //cout << "Console receiving message: " << actions << endl;
3616  //moTextArray exploded = actions.Explode( moText(",") );
3617 
3618  MODebug2->Message( moText("moConsole::ProcessConsoleMessage > Actions: ")
3619  + actions );
3620 
3621 
3622 
3623 /*
3624 
3625 
3626  switch(exploded.Count()) {
3627  case 2:
3628  action = exploded[0];
3629  object_label = exploded[1];
3630 
3631  if (action=="show") {
3632  objectid = GetObjectId(object_label) - MO_MOLDEOOBJECTS_OFFSET_ID;
3633 
3634  Object = m_MoldeoObjects[objectid];
3635 
3636  if (Object && Object->GetConfig()) {
3637  pEffect = (moEffect*)Object;
3638  pEffect->Enable();
3639  pEffect->TurnOn();
3640  MODebug2->Message( moText("moConsole::ProcessConsoleMessage > show ")
3641  +Object->GetLabelName() );
3642  } else {
3643  MODebug2->Error( moText("moConsole::ProcessConsoleMessage > show : object not founded : id:")
3644  +(moText)IntToStr(objectid) + " label:" + object_label );
3645  }
3646  }
3647 
3648  break;
3649  case 3:
3650  action = exploded[0];
3651  object_label = exploded[1];
3652  position = exploded[2];
3653  break;
3654  case 4:
3655  action = exploded[0];
3656  object_label = exploded[1];
3657  param_label = exploded[2];
3658  value_index = exploded[3];
3659  valueidx = atoi(value_index);
3660 
3661  if (action=="setcurrentvalue") {
3662  objectid = GetObjectId(object_label) - MO_MOLDEOOBJECTS_OFFSET_ID;
3663  Object = m_MoldeoObjects[objectid];
3664 
3665  if (Object && Object->GetConfig()) {
3666 
3667  paramid = Object->GetConfig()->GetParamIndex(param_label);
3668  Object->GetConfig()->SetCurrentValueIndex( paramid, valueidx );
3669 
3670  pParam = Object->GetConfig()->GetParam(paramid);
3671 
3672  MODebug2->Message( moText("moConsole::ProcessConsoleMessage: SetObjectCurrentValue")+Object->GetLabelName() + " Param:" + pParam.GetParamDefinition().GetName() );
3673  } else {
3674  MODebug2->Error( moText("imoConsole::ProcessConsoleMessage: SetObjectCurrentValue : object not founded : id:")+(moText)IntToStr(objectid) );
3675  }
3676  }
3677 
3678 
3679  break;
3680  }
3681 
3682  if (exploded.Count()>=2) {
3683  cout << "Console received message: action: " << action << " object: " << object_label << " position:" << position << " param:" << param_label << " value:" << value_index << " valueidx:" << valueidx << endl;
3684  }
3685 
3686 */
3687  }
3688 
3689 }
3690 
3691 
3692 void
3694  if (!m_pResourceManager) return;
3696 
3698 
3699  if (m_ScreenshotInterval>30) {
3700  if (!m_ScreenshotTimer.Started()) {
3702  } else {
3703 
3708  }
3709 
3710  }
3711  }
3712 
3716  RenderMan->BeginUpdate();
3717  if (m_pIODeviceManager) {
3718  for(MOuint i = 0; i<(m_MoldeoObjects.Count()+m_MoldeoSceneObjects.Count()); i++) {
3719  RenderMan->BeginUpdateObject();
3720  moMoldeoObject* pMOB = NULL;
3721  if (i<m_MoldeoObjects.Count())
3722  pMOB = m_MoldeoObjects[i];
3723  else
3724  pMOB = m_MoldeoSceneObjects[i-m_MoldeoObjects.Count()];
3725  if (pMOB) {
3726  if (pMOB->GetType()!=MO_OBJECT_IODEVICE)
3727  if (pMOB->Activated())
3729  }
3730  RenderMan->EndUpdateObject();
3731  }
3732 
3734  }
3735  RenderMan->EndUpdate();
3736 
3738  int nevents = 0;
3739  if (pEvents) {
3740  moEvent *actual=NULL,*tmp;
3741  // moMessage *pmessage;
3742 
3743  if (pEvents) actual = pEvents->First;
3744 
3746  while(actual!=NULL) {
3747  nevents++;
3748  tmp = actual->next;
3750  //moText debugstr = actual->ToJSON();
3751 
3752  if ( actual->deviceid==MO_IODEVICE_CONSOLE
3754  && actual->reservedvalue3 == MO_DATAMESSAGE) {
3755  moDataMessage* mpDataMessage = (moDataMessage*) actual->pointer;
3756  if (mpDataMessage) {
3757  //tmpstr = "MOLDEOAPI MO_DATAMESSAGE > count:" + mpDataMessage->Count();
3758  delete mpDataMessage;
3759  }
3760  actual->pointer = NULL;
3761  pEvents->Delete(actual);
3762  }
3763 
3764  if (actual->deviceid>=MO_MOLDEOOBJECTS_OFFSET_ID) {
3765  moMoldeoObject* pobj = GetObjectByIdx( actual->deviceid );
3766  //debugstr = pobj->GetLabelName()+"("+IntToStr(actual->deviceid)+") >> "+actual->ToJSON();
3767  }
3768  actual = tmp;
3769 
3770  //MODebug2->Message( debugstr );
3771  }
3772 
3773  //if ()
3774  //MODebug2->Message("fps:"+fps_text+" nevents:"+IntToStr(nevents));
3775 
3776  }
3777 
3778  //Procesamos aquellos Mensajes enviados con acciones
3779  moEvent* actual = m_pIODeviceManager->GetEvents()->First;
3780  moEvent* tmp = NULL;
3781  while(actual!=NULL) {
3782 
3783  if ( actual->deviceid==MO_IODEVICE_CONSOLE
3784  &&
3785  actual->reservedvalue3 == MO_MESSAGE ) {
3786 
3787  moMessage* ConsoleMessage = (moMessage*)actual;
3788  this->ProcessConsoleMessage(ConsoleMessage);
3789  }
3790 
3791  if ( ( actual->deviceid == MO_IODEVICE_CONSOLE )
3793  && ( actual->reservedvalue3 == MO_DATAMESSAGE ) ) {
3794 
3795  moDataMessage* MoldeoAPIMessage = (moDataMessage*)actual->pointer;
3796  this->ProcessMoldeoAPIMessage( MoldeoAPIMessage );
3797  }
3798 
3799  tmp = actual;
3800  actual = tmp->next;
3801  }
3802 
3804 }
3805 
3808 
3809  //default: alpha, color, syncro
3810  p_configdefinition = moMoldeoObject::GetDefinition( p_configdefinition );
3811  p_configdefinition->Add( moText("devices"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_DEVICES );
3812  p_configdefinition->Add( moText("preeffect"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_PREEFFECT );
3813  p_configdefinition->Add( moText("effect"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_EFFECT );
3814  p_configdefinition->Add( moText("posteffect"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_POSTEFFECT );
3815  p_configdefinition->Add( moText("mastereffect"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_MASTEREFFECT );
3816  p_configdefinition->Add( moText("resources"), MO_PARAM_MOLDEO_OBJECT, CONSOLE_RESOURCES );
3817 
3818  p_configdefinition->Add( moText("mastereffects_on"), MO_PARAM_NUMERIC, (MOint)CONSOLE_ON, moValue("0","NUM").Ref(), moText("off,on") );
3819  p_configdefinition->Add( moText("fulldebug"), MO_PARAM_NUMERIC, CONSOLE_FULLDEBUG, moValue("0","NUM").Ref() );
3820 
3821  //obsoleto
3822  //p_configdefinition->Add( moText("consolescript"), MO_PARAM_SCRIPT, CONSOLE_SCRIPT );
3823 
3824  p_configdefinition->Add( moText("outputmode"), MO_PARAM_TEXT, CONSOLE_OUTPUTMODE );
3825  p_configdefinition->Add( moText("outputresolution"), MO_PARAM_TEXT, CONSOLE_OUTPUTRESOLUTION );
3826 
3827  p_configdefinition->Add( moText("rendermode"), MO_PARAM_TEXT, CONSOLE_RENDERMODE );
3828  p_configdefinition->Add( moText("renderresolution"), MO_PARAM_TEXT, CONSOLE_RENDERRESOLUTION );
3829 
3830  p_configdefinition->Add( moText("clip1"), MO_PARAM_TEXT, CONSOLE_CLIP1 );
3831  p_configdefinition->Add( moText("clip2"), MO_PARAM_TEXT, CONSOLE_CLIP2 );
3832  p_configdefinition->Add( moText("clip3"), MO_PARAM_TEXT, CONSOLE_CLIP3 );
3833 
3834  p_configdefinition->Add( moText("screenshots"), MO_PARAM_NUMERIC, CONSOLE_SCREENSHOTS, moValue("0","NUM").Ref() );
3835  p_configdefinition->Add( moText("videoshots"), MO_PARAM_NUMERIC, CONSOLE_VIDEOSHOTS, moValue("0","NUM").Ref() );
3836 
3837  return p_configdefinition;
3838 }
3839 
3840 // Ugly, ugly and dirty...
3841 MOint
3843  if(!stricmp( name, "SDLK_1" ) ) return 0;
3844  else if(!stricmp( name, "SDLK_2" ) ) return 1;
3845  else if(!stricmp( name, "SDLK_3" ) ) return 2;
3846  else if(!stricmp( name, "SDLK_4" ) ) return 3;
3847  else if(!stricmp( name, "SDLK_5" ) ) return 4;
3848  else if(!stricmp( name, "SDLK_6" ) ) return 5;
3849  else if(!stricmp( name, "SDLK_7" ) ) return 6;
3850  else if(!stricmp( name, "SDLK_8" ) ) return 7;
3851  else if(!stricmp( name, "SDLK_9" ) ) return 8;
3852  else if(!stricmp( name, "SDLK_10" ) ) return 9;
3853  else if(!stricmp( name, "SDLK_q" ) ) return 10;
3854  else if(!stricmp( name, "SDLK_w" ) ) return 11;
3855  else if(!stricmp( name, "SDLK_e" ) ) return 12;
3856  else if(!stricmp( name, "SDLK_r" ) ) return 13;
3857  else if(!stricmp( name, "SDLK_t" ) ) return 14;
3858  else if(!stricmp( name, "SDLK_y" ) ) return 15;
3859  else if(!stricmp( name, "SDLK_u" ) ) return 16;
3860  else if(!stricmp( name, "SDLK_i" ) ) return 17;
3861  else if(!stricmp( name, "SDLK_o" ) ) return 18;
3862  else if(!stricmp( name, "SDLK_p" ) ) return 19;
3863  else if(!stricmp( name, "SDLK_a" ) ) return 20;
3864  else if(!stricmp( name, "SDLK_s" ) ) return 21;
3865  else if(!stricmp( name, "SDLK_d" ) ) return 22;
3866  else if(!stricmp( name, "SDLK_f" ) ) return 23;
3867  else if(!stricmp( name, "SDLK_g" ) ) return 24;
3868  else if(!stricmp( name, "SDLK_h" ) ) return 25;
3869  else if(!stricmp( name, "SDLK_j" ) ) return 26;
3870  else if(!stricmp( name, "SDLK_k" ) ) return 27;
3871  else if(!stricmp( name, "SDLK_l" ) ) return 28;
3872  else if(!stricmp( name, "SDLK_SEMICOLON" ) ) return 29;
3873  else if(!stricmp( name, "SDLK_z" ) ) return 30;
3874  else if(!stricmp( name, "SDLK_x" ) ) return 31;
3875  else if(!stricmp( name, "SDLK_c" ) ) return 32;
3876  else if(!stricmp( name, "SDLK_v" ) ) return 33;
3877  else if(!stricmp( name, "SDLK_b" ) ) return 34;
3878  else if(!stricmp( name, "SDLK_n" ) ) return 35;
3879  else if(!stricmp( name, "SDLK_m" ) ) return 36;
3880  else if(!stricmp( name, "SDLK_COMMA" ) ) return 37;
3881  else if(!stricmp( name, "SDLK_PERIOD" ) ) return 38;
3882  else if(!stricmp( name, "SDLK_SLASH" ) ) return 39;
3883  return -1;
3884 }
3885 
3886 int moConsole::ProcessSessionKey( const moDataSessionKey & p_session_key ) {
3887  moMoldeoActionType action = p_session_key.GetActionType();
3888  //APPLY!!!!
3889  switch( action ) {
3891  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_CONSOLE_PLAY" );
3892  ConsolePlay();
3893  break;
3895  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_CONSOLE_PAUSE" );
3896  ConsolePause();
3897  break;
3899  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_CONSOLE_STOP" );
3900  ConsoleStop();
3901  break;
3902 
3904  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_PRECONFIG_SET" );
3905  SetPreconf( p_session_key.m_ObjectId, p_session_key.m_PreconfId );
3906  break;
3907 
3908  case MO_ACTION_VALUE_SET:
3909  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_VALUE_SET" );
3910  SetValue( p_session_key.m_ObjectId, p_session_key.m_ParamId, p_session_key.m_ValueId, p_session_key.m_Value );
3911  break;
3912 
3913  case MO_ACTION_PARAM_SET:
3914  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_PARAM_SET" );
3915  SetParam( p_session_key.m_ObjectId, p_session_key.m_ParamId, p_session_key.m_ParamDefinition );
3916  break;
3917 
3919  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_EFFECT_ENABLE" );
3920  ObjectEnable( p_session_key.m_ObjectId );
3921  break;
3922 
3924  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_EFFECT_DISABLE" );
3925  ObjectDisable( p_session_key.m_ObjectId );
3926  break;
3927 
3928  case MO_ACTION_EFFECT_PLAY:
3929  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_EFFECT_PLAY" );
3930  EffectPlay( p_session_key.m_ObjectId );
3931  break;
3932 
3934  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_EFFECT_PAUSE" );
3935  EffectPause( p_session_key.m_ObjectId );
3936  break;
3937 
3938  case MO_ACTION_EFFECT_STOP:
3939  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_EFFECT_STOP" );
3940  EffectStop( p_session_key.m_ObjectId );
3941  break;
3942 
3943  case MO_ACTION_UNDEFINED:
3944  break;
3945  case MO_ACTION_VALUE_ADD:
3947  case MO_ACTION_VALUE_SAVE:
3948  case MO_ACTION_VALUE_GET:
3949  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_VALUE_###" );
3950  break;
3955  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type processed: MO_ACTION_CONSOLE_PRESET_###" );
3956  break;
3957  default:
3958  {
3959  moDataSessionKey sk = p_session_key;
3960  moText json = sk.ToJSON();
3961  MODebug2->Message( "moConsole::ProcessSessionKey > Action Type not processed: " + json );
3962  }
3963  break;
3964  };
3965 
3966  return 0;
3967 }
3968 
3969 int moConsole::ProcessSessionEventKey( const moDataSessionEventKey & p_session_event_key ) {
3970 
3971  moDataSessionEventKey sek = p_session_event_key;
3972 
3973  //int mtimecode = sek.GetTimecode();
3974 
3975  return 0;
3976 
3977 }
3978 
3979 int
3980 moConsole::Save( const moText& p_save_filename ) {
3981  bool save_success = true;
3982  int fx=0;
3983  for( fx=0; fx<(int)m_MoldeoObjects.Count(); fx++ ) {
3984  moMoldeoObject* MObj = m_MoldeoObjects[fx];
3985  if (MObj) {
3986  moMobDefinition MobDef = MObj->GetMobDefinition();
3987  int valueindex = MobDef.GetMobIndex().GetValueIndex();
3988  int paramindex = MobDef.GetMobIndex().GetParamIndex();
3989 
3990  moValueBase& vCFG_Effect_Config( GetConfig()->GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_CONFIG) );
3991  vCFG_Effect_Config.SetText( MobDef.GetConfigName() );
3992 
3993  moValueBase& vCFG_Effect_Label( GetConfig()->GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_LABEL) );
3994  vCFG_Effect_Label.SetText( MobDef.GetLabelName() );
3995 
3996  moValueBase& vCFG_Effect_Name( GetConfig()->GetParam( paramindex ).GetValue( valueindex ).GetSubValue(0) );
3997  vCFG_Effect_Name.SetText( MobDef.GetName() );
3998 
3999  moValueBase& vCFG_Effect_Activate( GetConfig()->GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_ON) );
4000  vCFG_Effect_Activate.SetInt( (int)(MobDef.GetActivate()) );
4001 
4002  moValueBase& vCFG_Effect_KeyName( GetConfig()->GetParam( paramindex ).GetValue( valueindex ).GetSubValue(MO_CFG_EFFECT_KEY) );
4003  vCFG_Effect_KeyName.SetText( MobDef.GetKeyName() );
4004 
4005  save_success = save_success && (MObj->Save( "" )>0);
4006  }
4007  }
4008  int res = moMoldeoObject::Save( p_save_filename );
4009  save_success = save_success && (res>0);
4010  return res;
4011 }
4012 
4013 
4015 
4019  moDataSession* loadedSession = GetResourceManager()->GetDataMan()->GetSession();
4023  //session object
4024  if (loadedSession==NULL) { MODebug2->Error("moConsole::ConsoleModeUpdate > no session"); return; }
4025 
4026 
4027  switch( m_ConsoleState.m_Mode ) {
4028 
4029  case MO_CONSOLE_MODE_LIVE:
4030  {
4031  //normal mode: do nothing
4034  }
4035  break;
4036 
4038  {
4039  //playing back last session loaded
4040  //
4041  //loaded/loading session
4042  if (!loadedSession->Loaded())
4043  if (!loadedSession->LoadSession()) { MODebug2->Error("moConsole::ConsoleModeUpdate > no loaded session"); return; }
4044 
4045  //session ended?
4046  if (loadedSession->SessionEnded()) { MODebug2->Message("moConsole::ConsoleModeUpdate > session playback ended."); return; }
4047 
4048  // 1000 / 20fps = 50 ms
4049  // 1000 / 24fps = 41 ms = 24 frames + 16/24
4050  // 1000 / 25fps = 40 ms = 25 frames
4051  // 1000 / 30fps = 50 ms
4053 
4055 
4056  //process next keys
4057  ProcessSessionKey( loadedSession->NextKey( m_ConsoleState ) );
4058 
4059  }
4060  break;
4061 
4063  {
4066 
4067  }
4068  break;
4069 
4071  {
4074  MODebug2->Message("moConsole::ConsoleModeUpdate > render session: " + IntToStr(tickis) );
4075  int console_timecode = m_ConsoleState.tempo.Duration();
4076 
4077  if (console_timecode==0) {
4081  }
4082 
4084 
4085  MODebug2->Message("moConsole::ConsoleModeUpdate > render session: m_ConsoleState.tempo.Duration: " + IntToStr(console_timecode) );
4086 
4087  ProcessSessionKey( loadedSession->NextKey( m_ConsoleState ) );
4088  loadedSession->StepRender( m_ConsoleState );
4089 
4090  }
4091  break;
4092 
4093  default:
4095  break;
4096  };
4097 }
4098 
4100  MODebug2->Message("moConsole::ConsolePlaySession");
4101  if (m_pResourceManager==NULL) return;
4103 }
4104 
4106  MODebug2->Message("moConsole::ConsoleRecordSession ");
4107  if (m_pResourceManager==NULL) return;
4109 
4110 }
4111 
4112 void moConsole::ConsoleRenderSession( const moText& p_frame_quality ) {
4113  MODebug2->Message("moConsole::ConsoleRenderSession");
4114  if (m_pResourceManager==NULL) return;
4115  m_ConsoleState.m_RenderFrameQuality = p_frame_quality;
4117 }
4118 
4120  MODebug2->Message("moConsole::ConsoleSaveSessionAs");
4121  if (m_pResourceManager==NULL) return;
4122 }
4123 
4125 
4128  }
4129 
4130  if (moIsTimerPaused()) {
4131  moContinueTimer();
4132  } else {
4133  moStartTimer();
4134  }
4135 
4137  if (m_pResourceManager==NULL) return;
4140  }
4141 }
4142 
4144  moPauseTimer();
4146  if (m_pResourceManager==NULL) return;
4149  }
4150 }
4151 
4153  moStopTimer();
4155  if (m_pResourceManager==NULL) return;
4158  }
4159 
4160 }
4161 
4163 
4164  return m_ConsoleState.m_Mode;
4165 }
4166 
4168 
4169  return moGetTimerState();
4170 }
4171 
4172 int
4173 moConsole::SetEffectState( int m_MoldeoObjectId, const moEffectState& p_effect_state ) {
4174  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4175  if (Object && Object->GetConfig()) {
4176 
4177  moEffect* Effect = ((moEffect*)Object);
4178  Effect->SetEffectState( p_effect_state );
4179 
4181  moDataSessionKey key( moGetTicksAbsolute(), MO_ACTION_EFFECT_SETSTATE, Object->GetId(), p_effect_state );
4183  }
4184 
4185  return 1;
4186  } else return -1;
4187  return 0;
4188 }
4189 
4190 int
4191 moConsole::SetParam( int m_MoldeoObjectId, int m_ParamId, const moParamDefinition &p_param_definition ) {
4192 
4193  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4194  if (Object && Object->GetConfig()) {
4195  moParam& Param( Object->GetConfig()->GetParam(m_ParamId));
4196  moParamDefinition mpdef = p_param_definition;
4197  Param.SetParamDefinition( mpdef );
4198 
4200  moDataSessionKey key( moGetTicksAbsolute(), MO_ACTION_PARAM_SET, Object->GetId(), m_ParamId, Param.GetParamDefinition() );
4202  }
4203 
4204  return 1;
4205  }
4206  return 0;
4207 }
4208 
4209 int moConsole::SetValue( int m_MoldeoObjectId, int m_ParamId, int m_ValueId, const moValue &p_value ) {
4210 
4211  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4212  if (Object && Object->GetConfig()) {
4213  moParam& Param( Object->GetConfig()->GetParam(m_ParamId));
4214  moValue& Value( Param.GetValue(m_ValueId) );
4215  Value = p_value;
4216  Object->ResolveValue( Param, m_ValueId );
4217 
4219  moDataSessionKey key( moGetTicksAbsolute(), MO_ACTION_VALUE_SET, Object->GetId(), m_ParamId, m_ValueId, p_value );
4221  }
4222 
4223  return 1;
4224  }
4225 
4226  return 0;
4227 }
4228 
4229 int moConsole::RefreshValue( int m_MoldeoObjectId, int m_ParamId, int m_ValueId, bool p_Refresh ) {
4230 
4231  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4232 
4233  if (Object && Object->GetConfig()) {
4234  moParam& Param( Object->GetConfig()->GetParam(m_ParamId));
4235  //moValue& Value( Param.GetValue(m_ValueId) );
4236  if (p_Refresh) Object->RefreshValue( Param, m_ValueId );
4237 
4239  moDataSessionKey key( moGetTicksAbsolute(), MO_ACTION_VALUE_REFRESH, Object->GetId(), m_ParamId, m_ValueId, -1 );
4241  }
4242 
4243  return 1;
4244  }
4245 
4246  return 0;
4247 }
4248 
4249 int
4250 moConsole::EffectPlay( int m_MoldeoObjectId ) {
4251  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4252  if (Object) {
4253  moEffect* fxEffect = (moEffect*)Object;
4254  fxEffect->Play();
4258  }
4259  return 1;
4260  }
4261  return 0;
4262 }
4263 
4264 int
4265 moConsole::EffectPause( int m_MoldeoObjectId ) {
4266  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4267  if (Object) {
4268  moEffect* fxEffect = (moEffect*)Object;
4269  fxEffect->Pause();
4273  }
4274  return 1;
4275  }
4276  return 0;
4277 }
4278 
4279 
4280 int
4281 moConsole::EffectStop( int m_MoldeoObjectId ) {
4282  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4283  if (Object) {
4284  moEffect* fxEffect = (moEffect*)Object;
4285  fxEffect->Stop();
4289  }
4290  return 1;
4291  }
4292  return 0;
4293 }
4294 
4295 int
4296 moConsole::ObjectEnable( int m_MoldeoObjectId ) {
4297 
4298  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4299  if (Object) {
4300 
4304  }
4305 
4306  switch ( Object->GetType() ) {
4307  case MO_OBJECT_EFFECT:
4308  case MO_OBJECT_PREEFFECT:
4309  case MO_OBJECT_POSTEFFECT:
4311  {
4312  moEffect* pEffect = (moEffect*) Object;
4313  //pEffect->Enable();
4314  pEffect->TurnOn();
4315  }
4316  return 1;
4317  break;
4318  case MO_OBJECT_IODEVICE:
4319  case MO_OBJECT_RESOURCE:
4320  {
4321  Object->Activate();
4322  return 1;
4323  }
4324  break;
4325  default:
4326  break;
4327  };
4328 
4329  } else return -1;
4330 
4331  return 0;
4332 }
4333 
4334 int
4335 moConsole::ObjectDisable( int m_MoldeoObjectId ) {
4336 
4337  moMoldeoObject* Object = this->GetObjectByIdx( m_MoldeoObjectId );
4338  if (Object) {
4339 
4343  }
4344 
4345  switch ( Object->GetType() ) {
4346  case MO_OBJECT_EFFECT:
4347  case MO_OBJECT_PREEFFECT:
4348  case MO_OBJECT_POSTEFFECT:
4350  {
4351  moEffect* pEffect = (moEffect*) Object;
4352  //pEffect->Enable();
4353  pEffect->TurnOff();
4354  }
4355  return 1;
4356  break;
4357  case MO_OBJECT_IODEVICE:
4358  case MO_OBJECT_RESOURCE:
4359  {
4360  Object->Deactivate();
4361  return 1;
4362  }
4363  break;
4364  default:
4365  break;
4366  };
4367 
4368  } else return -1;
4369 
4370  return 0;
4371 }
4372 
4373 
4375 
4376  return 0;
4377 }
4378 
4379 void moConsole::SetPreset( int presetid ) {
4380  //
4381  m_PresetParams.Get( presetid );
4382 }
4383 
4384 int moConsole::GetPreconf( int objectid ) {
4385  moMoldeoObject* MOB;
4386  MOB = m_MoldeoObjects.Get(objectid);
4387  return MOB->GetConfig()->GetCurrentPreConf();
4388 }
4389 
4390 void moConsole::SetPreconf( int objectid, int preconfid ) {
4391  moMoldeoObject* Object = GetObjectByIdx(objectid);
4392  if (Object && Object->GetConfig()) {
4393  Object->GetConfig()->SetCurrentPreConf( preconfid );
4394  }
4395 
4397  moDataSessionKey key( moGetTicksAbsolute(), MO_ACTION_PRECONFIG_SET, objectid, preconfid );
4399  }
4400 }
4401 
4402 
4403 void moConsole::SetTicks( int ticksid ) {
4404  moSetDuration( ticksid );
4405 }
4406 
4407 int moConsole::GetObjectId( const moText& p_objectlabelname ) {
4408 
4409  for( MOuint i=0; i<m_MoldeoObjects.Count(); i++) {
4410 
4411  if (p_objectlabelname == m_MoldeoObjects[i]->GetLabelName()) {
4412  return m_MoldeoObjects[i]->GetId();
4413  }
4414 
4415  }
4416 
4417  for( MOuint i=0; i<m_MoldeoSceneObjects.Count(); i++) {
4418 
4419  if (p_objectlabelname == m_MoldeoSceneObjects[i]->GetLabelName()) {
4420  return m_MoldeoSceneObjects[i]->GetId();
4421  }
4422 
4423  }
4424 
4425  return -1;
4426 }
4427 
4429 
4430  moMoldeoObject* returnMOB = NULL;
4431  //if ( p_object_id )
4432  int object_id_to_index = p_object_id - MO_MOLDEOOBJECTS_OFFSET_ID;
4433 
4434  if (0<=object_id_to_index && object_id_to_index<(int)m_MoldeoObjects.Count()) {
4435  returnMOB = m_MoldeoObjects[object_id_to_index];
4436  return returnMOB;
4437  }
4438 
4439  int object_id_to_subscene_index = p_object_id - MO_MOLDEOSCENEOBJECTS_OFFSET_ID;
4440 
4441  if (0<=object_id_to_subscene_index && object_id_to_subscene_index<(int)m_MoldeoSceneObjects.Count()) {
4442  returnMOB = m_MoldeoSceneObjects[object_id_to_subscene_index];
4443  return returnMOB;
4444  }
4445 
4446  return returnMOB;
4447 }
4448 
4449 
4451 
4452  moDirectory* pDir;
4453  pDir = NULL;
4454  moText completepath;
4455  completepath = m_pResourceManager->GetDataMan()->GetDataPath() + (moText)p_path;
4456  pDir = m_pResourceManager->GetFileMan()->GetDirectory(completepath);
4457  if (pDir) {
4458  pDir->Update();
4459  return pDir->GetFiles().Count();
4460  }
4461 
4462  return -1;
4463 }
4464 
4466 {
4469 
4471  RegisterBaseFunction("Play");//0
4472  RegisterFunction("Pause");//1
4473  RegisterFunction("Stop");//2
4474  RegisterFunction("State");//3
4475  RegisterFunction("GetObjectId");//4
4476 
4477  RegisterFunction("GetPreset");//5
4478  RegisterFunction("SetPreset");//6
4479  RegisterFunction("SetTicks");//7
4480  RegisterFunction("GetTicks");//8
4481 
4482  RegisterFunction("GetObjectPreconf");//9
4483  RegisterFunction("SetObjectPreconf");//10
4484  RegisterFunction("ObjectEnable");//11
4485  RegisterFunction("ObjectDisable");//12
4486 
4487  RegisterFunction("GetObjectParamIndex");//13
4488  RegisterFunction("GetObjectParamValues");//14
4489  RegisterFunction("GetObjectCurrentValue");//15
4490  RegisterFunction("SetObjectCurrentValue");//16
4491 
4492 
4493  RegisterFunction("GetObjectDataIndex");//17
4494  RegisterFunction("GetObjectData");//18
4495  RegisterFunction("SetObjectData");//19
4496 
4498 
4499  RegisterFunction("GetEffectState");//20
4500  RegisterFunction("SetEffectState");//21
4501 
4502 
4504 
4505  RegisterFunction("GetDeviceCode");//22
4506  RegisterFunction("GetDeviceCodeId");//23
4507  RegisterFunction("AddEvent");//24
4508 
4510  RegisterFunction("GetDirectoryFileCount");//25
4511  RegisterFunction("Screenshot");//26
4512 
4514 
4515 }
4516 
4517 int moConsole::ScriptCalling(moLuaVirtualMachine& vm, int iFunctionNumber)
4518 {
4519 
4520  switch ( iFunctionNumber - m_iMethodBase )
4521  {
4522  case 0:
4524  return luaPlay(vm);
4525  case 1:
4527  return luaPause(vm);
4528  case 2:
4530  return luaStop(vm);
4531  case 3:
4533  return luaState(vm);
4534  case 4:
4536  return luaGetObjectId(vm);
4537  case 5:
4539  return luaGetPreset(vm);
4540  case 6:
4542  return luaSetPreset(vm);
4543  case 7:
4545  return luaSetTicks(vm);
4546  case 8:
4548  return luaGetTicks(vm);
4549 
4550 
4551 
4552  case 9:
4554  return luaGetObjectPreconf(vm);
4555  case 10:
4557  return luaSetObjectPreconf(vm);
4558  case 11:
4560  return luaObjectEnable(vm);
4561  case 12:
4563  return luaObjectDisable(vm);
4564 
4565 
4566 
4567  case 13:
4569  return luaGetObjectParamIndex(vm);
4570  case 14:
4572  return luaGetObjectParamValues(vm);
4573  case 15:
4575  return luaGetObjectCurrentValue(vm);
4576  case 16:
4578  return luaSetObjectCurrentValue(vm);
4579 
4580  case 17:
4582  return luaGetObjectDataIndex(vm);
4583  case 18:
4585  return luaGetObjectData(vm);
4586  case 19:
4588  return luaSetObjectData(vm);
4589 
4590 
4592  case 20:
4594  return luaGetEffectState(vm);
4595  case 21:
4597  return luaSetEffectState(vm);
4598 
4599 
4601  case 22:
4603  return luaGetDeviceCode(vm);
4604  case 23:
4606  return luaGetDeviceCodeId(vm);
4607 
4608  case 24:
4610  return luaAddEvent(vm);
4611 
4613  case 25:
4615  return luaGetDirectoryFileCount(vm);
4616 
4617  case 26:
4619  return luaScreenshot(vm);
4620 
4621 
4622  default:
4624  return moMoldeoObject::ScriptCalling( vm, iFunctionNumber );
4625  }
4626 }
4627 
4629 
4630  lua_State *state = (lua_State *) vm;
4631  if (state)
4632  ConsolePlay();
4633 
4634  return 0;
4635 }
4636 
4638 
4639  lua_State *state = (lua_State *) vm;
4640  if (state)
4641  ConsolePause();
4642 
4643  return 0;
4644 }
4645 
4647 
4648  lua_State *state = (lua_State *) vm;
4649 
4650  if (state)
4651  ConsoleStop();
4652 
4653  return 0;
4654 }
4655 
4657 
4658  lua_State *state = (lua_State *) vm;
4659 
4660  moTimerState elstate = GetConsoleState();
4661  int retstate = (int) elstate;
4662  lua_pushnumber( state, (lua_Number) retstate);
4663 
4664  return 1;
4665 }
4666 
4668 {
4669  lua_State *state = (lua_State *) vm;
4670 
4671  char *objectlabelname = (char *) lua_tostring (state, 1);
4672 
4673  int objectid = -1;
4674 
4675  objectid = this->GetObjectId( objectlabelname );
4676 
4677  lua_pushnumber(state, (lua_Number) objectid );
4678 
4679  if (objectid==-1) {
4680  MODebug2->Error( moText("Object doesnt exists: ")+(moText)objectlabelname );
4681  }
4682 
4683  return 1;
4684 }
4685 
4687 {
4688  lua_State *state = (lua_State *) vm;
4689 
4690  lua_pushnumber(state, (lua_Number) this->GetPreset() );
4691 
4692  return 1;
4693 }
4694 
4696 {
4697  lua_State *state = (lua_State *) vm;
4698 
4699  MOint presetid = (MOint) lua_tonumber (state, 1);
4700 
4701  this->SetPreset( presetid );
4702 
4703  return 0;
4704 }
4705 
4707 {
4708  lua_State *state = (lua_State *) vm;
4709 
4710  MOint objectid = (MOint) lua_tonumber (state, 1);
4711 
4712  moMoldeoObject* Object = GetObjectByIdx(objectid);
4713 
4714  if (Object && Object->GetConfig()) {
4715  lua_pushnumber(state, (lua_Number) Object->GetConfig()->GetCurrentPreConf() );
4716  } else {
4717  lua_pushnumber(state, (lua_Number) -1 );
4718  MODebug2->Error( moText("in moConsole script: GetObjectPreconf : object not founded : id:")+(moText)IntToStr(objectid));
4719  }
4720 
4721  return 1;
4722 }
4723 
4725 {
4726  lua_State *state = (lua_State *) vm;
4727 
4728  MOint objectid = (MOint) lua_tonumber (state, 1);
4729  MOint preconfid = (MOint) lua_tonumber (state, 2);
4730 
4731  moMoldeoObject* Object = NULL;
4732 
4733  Object = GetObjectByIdx(objectid);
4734 
4735  if (Object && Object->GetConfig()) {
4736  SetPreconf( objectid, preconfid );
4737  } else {
4738  MODebug2->Error( moText("in console script: SetObjectPreconf : object not founded : id:")+(moText)IntToStr(objectid)+moText(" preconfid:")+(moText)IntToStr(preconfid) );
4739  }
4740 
4741  return 0;
4742 }
4743 
4745 {
4746  lua_State *state = (lua_State *) vm;
4747 
4748  MOint ticksint = (MOint) lua_tonumber (state, 1);
4749 
4750  this->SetTicks(ticksint);
4751 
4752  return 0;
4753 }
4754 
4756 {
4757  lua_State *state = (lua_State *) vm;
4758 
4759  lua_pushnumber(state, (lua_Number) moGetTicks() );
4760 
4761  return 1;
4762 }
4763 
4765 {
4766  lua_State *state = (lua_State *) vm;
4767 
4768  MOint objectid = (MOint) lua_tonumber (state, 1);
4769 
4770  moMoldeoObject* Object = NULL;
4771 
4772  Object = GetObjectByIdx(objectid);
4773 
4774  if (Object && Object->GetConfig()) {
4775  ObjectEnable( objectid );
4776  } else {
4777  MODebug2->Error( moText("in console script: ObjectEnable : object not founded : id:")+(moText)IntToStr(objectid));
4778  }
4779 
4780  return 0;
4781 }
4782 
4784 {
4785  lua_State *state = (lua_State *) vm;
4786 
4787  MOint objectid = (MOint) lua_tonumber (state, 1);
4788 
4789  moMoldeoObject* Object = NULL;
4790 
4791  Object = GetObjectByIdx(objectid);
4792 
4793  if (Object && Object->GetConfig()) {
4794  ObjectDisable( objectid );
4795  } else {
4796  MODebug2->Error( moText("in console script: ObjectDisable : object not founded : id:")+(moText)IntToStr(objectid));
4797  }
4798 
4799  return 0;
4800 }
4801 
4802 
4804 
4805  lua_State *state = (lua_State *) vm;
4806 
4807  MOint objectid = (MOint) lua_tonumber (state, 1);
4808  char *text = (char *) lua_tostring (state, 2);
4809 
4810  moMoldeoObject* Object = GetObjectByIdx(objectid);
4811 
4812  if (Object && Object->GetConfig()) {
4813  if (Object->GetConfig()->GetParamIndex(text)<0) {
4814  MODebug2->Error( moText("moConsole::luaGetObjectParamIndex > param not found: ") + text );
4815  }
4816  lua_pushnumber(state, (lua_Number) Object->GetConfig()->GetParamIndex(text) );
4817  }
4818 
4819  return 1;
4820 
4821 }
4822 
4823 
4825 
4826  lua_State *state = (lua_State *) vm;
4827 
4828  MOint objectid = (MOint) lua_tonumber (state, 1);
4829  char *text = (char *) lua_tostring (state, 2);
4830 
4831  moMoldeoObject* Object = GetObjectByIdx(objectid);
4832 
4833  if ( Object && Object->GetConfig() ) {
4834 
4835  if (Object->GetConfig()->GetParamIndex(text)<0) {
4836  MODebug2->Error( moText("moConsole::luaGetObjectParamValues > param not found: ") + text );
4837  lua_pushnumber(state, (lua_Number) 0 );
4838  return 1;
4839  }
4840  lua_pushnumber(state, (lua_Number) Object->GetConfig()->GetParam(text).GetValuesCount() );
4841 
4842  }
4843 
4844  return 1;
4845 }
4846 
4847 
4849 
4850  lua_State *state = (lua_State *) vm;
4851 
4852  MOint objectid = (MOint) lua_tonumber (state, 1);
4853  MOint paramid = (MOint) lua_tonumber (state, 2);
4854  MOint valueid = (MOint) lua_tonumber (state, 3);
4855 
4856  moMoldeoObject* Object = GetObjectByIdx(objectid);
4857 
4858  if (Object && Object->GetConfig()) {
4859  Object->GetConfig()->SetCurrentValueIndex( paramid, valueid );
4860 
4861  moParam pParam = Object->GetConfig()->GetParam(paramid);
4862 
4863  //MODebug2->Message( moText("in lua console script: SetObjectCurrentValue")+Object->GetLabelName() + " Param:" + pParam.GetParamDefinition().GetName() );
4864  } else {
4865  MODebug2->Error( moText("in console script: SetObjectCurrentValue : object not founded : id:")+(moText)IntToStr(objectid) );
4866  }
4867 
4868  return 0;
4869 }
4870 
4871 
4873 
4874  lua_State *state = (lua_State *) vm;
4875 
4876  MOint objectid = (MOint) lua_tonumber (state, 1);
4877  MOint paramid = (MOint) lua_tonumber (state, 2);
4878 
4879  moMoldeoObject* Object = GetObjectByIdx(objectid);
4880 
4881  if (Object && Object->GetConfig()) {
4882  int valueid = Object->GetConfig()->GetParam( paramid ).GetIndexValue();
4883  lua_pushnumber(state, (lua_Number) valueid );
4884  MODebug2->Message( moText("in lua console script: GetObjectCurrentValue")+Object->GetLabelName() );
4885  return 1;
4886  } else {
4887  MODebug2->Error( moText("in lua console script: GetObjectCurrentValue : object not founded : id:")+(moText)IntToStr(objectid) );
4888  }
4889 
4890  return 0;
4891 }
4892 
4893 
4895 
4896  lua_State *state = (lua_State *) vm;
4897 
4898  MOint objectid = (MOint) lua_tonumber (state, 1);
4899  char *text = (char *) lua_tostring (state, 2);
4900  int inletid = -1;
4901 
4902  moMoldeoObject* Object = GetObjectByIdx(objectid);
4903 
4904  if (Object) {
4905  inletid = Object->GetInletIndex( text );
4906  } else {
4907  MODebug2->Error( moText("in console script: GetObjectDataIndex : object not founded : id:")+(moText)IntToStr(objectid)+moText(" for param:")+moText(text) );
4908  }
4909 
4910  lua_pushnumber(state, (lua_Number) inletid );
4911 
4912  return 1;
4913 }
4914 
4916 
4917  lua_State *state = (lua_State *) vm;
4918 
4919  MOint objectid = (MOint) lua_tonumber (state, 1);
4920  MOint inletid = (MOint) lua_tonumber (state, 2);
4921 
4922  //MODebug2->Message( "in console script: GetObjectData : moldeo objectid: " + moText((long)objectid) );
4923 
4924  moMoldeoObject* Object = GetObjectByIdx(objectid);
4925 
4926  if (Object) {
4927  //MODebug2->Message( "in console script: GetObjectData : moldeo Object: " + moText((long)Object) );
4928  //MODebug2->Message( "in console script: GetObjectData : moldeo Object: " + Object->GetLabelName() );
4929  moInlet* pInlet = Object->GetInlets()->Get(inletid);
4930  if (pInlet) {
4931  //MODebug2->Message( "in console script: GetObjectData : moldeo Inlet: " + moText((long)pInlet) );
4932  //MODebug2->Message( "in console script: GetObjectData : moldeo Inlet: " + pInlet->GetConnectorLabelName() );
4933  moData* pData = pInlet->GetData();
4934  if (pData) {
4935  //MODebug2->Message( "in console script: GetObjectData : moldeo object: " + Object->GetLabelName()
4936  // + " inlet: " + pInlet->GetConnectorLabelName() + " Data:" + moText((long)pData)
4937  // + " Type:" + moText( (int)pData->Type() ) );
4938 
4939  switch(pData->Type()) {
4940 
4941  case MO_DATA_FUNCTION:
4942  lua_pushnumber(state, (lua_Number) pData->Eval() );
4943  return 1;
4944 
4945  case MO_DATA_NUMBER:
4946  case MO_DATA_NUMBER_CHAR:
4947  case MO_DATA_NUMBER_INT:
4948  case MO_DATA_NUMBER_LONG:
4949  case MO_DATA_NUMBER_MIDI:
4950  //MODebug2->Message( "Inlet Number:" + IntToStr(pData->Long() ) );
4951  lua_pushnumber(state, (lua_Number) pData->Long() );
4952  return 1;
4953 
4955  case MO_DATA_FONTPOINTER:
4956  case MO_DATA_IMAGESAMPLE:
4959  lua_pushnumber(state, (lua_Number) (long)pData->Pointer() );
4960  return 1;
4961 
4962  case MO_DATA_VECTOR2I:
4963  lua_pushnumber(state, (lua_Number) pData->Vector2i()->X() );
4964  lua_pushnumber(state, (lua_Number) pData->Vector2i()->Y() );
4965  return 2;
4966 
4967  case MO_DATA_VECTOR3I:
4968  lua_pushnumber(state, (lua_Number) pData->Vector3i()->X() );
4969  lua_pushnumber(state, (lua_Number) pData->Vector3i()->Y() );
4970  lua_pushnumber(state, (lua_Number) pData->Vector3i()->Z() );
4971  return 3;
4972 
4973  case MO_DATA_VECTOR4I:
4974  lua_pushnumber(state, (lua_Number) pData->Vector4i()->X() );
4975  lua_pushnumber(state, (lua_Number) pData->Vector4i()->Y() );
4976  lua_pushnumber(state, (lua_Number) pData->Vector4i()->Z() );
4977  lua_pushnumber(state, (lua_Number) pData->Vector4i()->W() );
4978  return 4;
4979 
4980  case MO_DATA_VECTOR2F:
4981  lua_pushnumber(state, (lua_Number) pData->Vector2d()->X() );
4982  lua_pushnumber(state, (lua_Number) pData->Vector2d()->Y() );
4983  return 2;
4984 
4985  case MO_DATA_VECTOR3F:
4986  lua_pushnumber(state, (lua_Number) pData->Vector3d()->X() );
4987  lua_pushnumber(state, (lua_Number) pData->Vector3d()->Y() );
4988  lua_pushnumber(state, (lua_Number) pData->Vector3d()->Z() );
4989  return 3;
4990 
4991  case MO_DATA_VECTOR4F:
4992  lua_pushnumber(state, (lua_Number) pData->Vector4d()->X() );
4993  lua_pushnumber(state, (lua_Number) pData->Vector4d()->Y() );
4994  lua_pushnumber(state, (lua_Number) pData->Vector4d()->Z() );
4995  lua_pushnumber(state, (lua_Number) pData->Vector4d()->W() );
4996  return 4;
4997 
4998  case MO_DATA_MESSAGE:
4999  case MO_DATA_MESSAGES:
5000  lua_pushstring(state, pData->ToText() );
5001  return 1;
5002 
5003  case MO_DATA_NUMBER_DOUBLE:
5004  case MO_DATA_NUMBER_FLOAT:
5005  lua_pushnumber(state, (lua_Number) pData->Double() );
5006  return 1;
5007 
5008  case MO_DATA_TEXT:
5009  lua_pushstring(state, pData->Text() );
5010  return 1;
5011 
5012  default:
5013  //MODebug2->Error( moText("in console script: GetObjectData : inlet found but type not available ")+(moText)pData->TypeToText() );
5014  MODebug2->Error( moText("in console script: GetObjectData : inlet found but type not available "));
5015  break;
5016  }
5017  } else {
5018  MODebug2->Error( moText("in console script: GetObjectData : inlet found but data is null!!!") );
5019  }
5020  } else {
5021  MODebug2->Error( moText("in console script: GetObjectData : inlet not found : id:")+(moText)IntToStr(inletid) );
5022  }
5023  } else {
5024  MODebug2->Error( moText("in console script: GetObjectData : object not found : id:")+(moText)IntToStr(objectid) );
5025  }
5026 
5027  moText tres("invalid");
5028  lua_pushstring( state, tres );
5029  return 1;
5030 }
5031 
5033  double deluavalor = -1.0f;
5034  lua_State *state = (lua_State *) vm;
5035 
5036  MOint objectid = (MOint) lua_tonumber (state, 1);
5037  MOint inletid = (MOint) lua_tonumber (state, 2);
5038 
5039  moMoldeoObject* Object = GetObjectByIdx(objectid);
5040 
5041  if (Object) {
5042  moInlet* pInlet = Object->GetInlets()->Get(inletid);
5043  if (pInlet) {
5044  moData* pData = pInlet->GetInternalData();
5045  if (pData) {
5046  switch(pData->Type()) {
5047  case MO_DATA_NUMBER:
5048  case MO_DATA_NUMBER_CHAR:
5049  case MO_DATA_NUMBER_INT:
5050  case MO_DATA_NUMBER_LONG:
5051  case MO_DATA_NUMBER_MIDI:
5052  pData->SetLong( (MOlong) lua_tonumber ( state, 3 ) );
5053  pInlet->Update(true);
5054  return 0;break;
5055 
5057  case MO_DATA_FONTPOINTER:
5058  case MO_DATA_IMAGESAMPLE:
5061  //pData->SetLong( (MOlong) lua_tonumber ( state, 3 ) );
5062  return 0;break;
5063 
5064  case MO_DATA_VECTOR2I:
5065  (*pData->Vector2i()) = moVector2i( (MOlong) lua_tonumber ( state, 3 ),
5066  (MOlong) lua_tonumber ( state, 4 ) );
5067  pInlet->Update(true);
5068  return 0;break;
5069 
5070  case MO_DATA_VECTOR3I:
5071  (*pData->Vector3i()) = moVector3i( (MOlong) lua_tonumber ( state, 3 ),
5072  (MOlong) lua_tonumber ( state, 4 ),
5073  (MOlong) lua_tonumber ( state, 5 ) );
5074  pInlet->Update(true);
5075  return 0;break;
5076 
5077  case MO_DATA_VECTOR4I:
5078  (*pData->Vector4i()) = moVector4i( (MOlong) lua_tonumber ( state, 3 ),
5079  (MOlong) lua_tonumber ( state, 4 ),
5080  (MOlong) lua_tonumber ( state, 5 ),
5081  (MOlong) lua_tonumber ( state, 6 ) );
5082  pInlet->Update(true);
5083  return 0;break;
5084 
5085  case MO_DATA_VECTOR2F:
5086  (*pData->Vector2d()) = moVector2d( (MOdouble) lua_tonumber ( state, 3 ),
5087  (MOdouble) lua_tonumber ( state, 4 ));
5088  pInlet->Update(true);
5089  return 0;break;
5090 
5091  case MO_DATA_VECTOR3F:
5092  (*pData->Vector3d()) = moVector3d( (MOdouble) lua_tonumber ( state, 3 ),
5093  (MOdouble) lua_tonumber ( state, 4 ),
5094  (MOdouble) lua_tonumber ( state, 5 ));
5095  pInlet->Update(true);
5096  return 0;break;
5097 
5098  case MO_DATA_VECTOR4F:
5099  (*pData->Vector4d()) = moVector4d( (MOdouble) lua_tonumber ( state, 3 ),
5100  (MOdouble) lua_tonumber ( state, 4 ),
5101  (MOdouble) lua_tonumber ( state, 5 ),
5102  (MOdouble) lua_tonumber ( state, 6 ) );
5103  pInlet->Update(true);
5104  return 0;break;
5105 
5106  case MO_DATA_MESSAGE:
5107  case MO_DATA_MESSAGES:
5108  return 0;break;
5109 
5110  case MO_DATA_NUMBER_DOUBLE:
5111  case MO_DATA_NUMBER_FLOAT:
5112  deluavalor = (MOdouble) lua_tonumber ( state, 3 );
5113  pData->SetDouble( deluavalor );
5114  pInlet->Update(true);
5115  return 0;break;
5116 
5117  case MO_DATA_TEXT:
5118  //lua_pushstring(state, pData->Text() );
5119  pData->SetText( lua_tostring ( state, 3 ) );
5120  pInlet->Update(true);
5121  return 0;
5122  break;
5123  default:
5124  break;
5125  }
5126  }
5127  } else {
5128  MODebug2->Error( moText("in console script: SetObjectData : inlet id not found : id:")+(moText)IntToStr(inletid) );
5129  }
5130  } else {
5131  MODebug2->Error( moText("in console script: SetObjectData : object not found : id:")+(moText)IntToStr(objectid) );
5132  }
5133 
5134  return 0;
5135 }
5136 
5137 
5139 
5140  lua_State *state = (lua_State *) vm;
5141 
5142  MOint objectid = (MOint) lua_tonumber (state, 1);
5143 
5144  moMoldeoObject* Object = GetObjectByIdx(objectid);
5145  moEffect* pEffect = NULL;
5146 
5147  moEffectState fxstate;
5148 
5149 
5150  if (Object && Object->GetConfig()) {
5151 
5152  switch (Object->GetType()) {
5153  case MO_OBJECT_EFFECT:
5154  case MO_OBJECT_PREEFFECT:
5155  case MO_OBJECT_POSTEFFECT:
5157  pEffect = (moEffect*) Object;
5158  fxstate = pEffect->GetEffectState();
5159  fxstate.alpha = (MOfloat) lua_tonumber (state, 2);
5160  fxstate.tint = (MOfloat) lua_tonumber (state, 3);
5161  fxstate.tintr = (MOfloat) lua_tonumber (state, 4);
5162  fxstate.tintg = (MOfloat) lua_tonumber (state, 5);
5163  fxstate.tintb = (MOfloat) lua_tonumber (state, 6);
5164  fxstate.tempo.ang = (MOfloat) lua_tonumber (state, 7);
5165 
5166  SetEffectState( Object->GetId(), fxstate);
5167  break;
5168  default:
5169  break;
5170  }
5171 
5172  } else {
5173  MODebug2->Error( moText("in console script: SetEffectState : object not founded : id:")+(moText)IntToStr(objectid) );
5174  }
5175 
5176  return 0;
5177 
5178 }
5179 
5181  lua_State *luastate = (lua_State *) vm;
5182 
5183  MOint objectid = (MOint) lua_tonumber (luastate, 1);
5184 
5185  moMoldeoObject* Object = GetObjectByIdx(objectid);
5186  moEffect* pEffect = NULL;
5187 
5188 
5189  if (Object && Object->GetConfig()) {
5190  switch (Object->GetType()) {
5191  case MO_OBJECT_EFFECT:
5192  case MO_OBJECT_PREEFFECT:
5193  case MO_OBJECT_POSTEFFECT:
5195  pEffect = (moEffect*) Object;
5196  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().alpha );
5197  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().tint );
5198  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().tintr );
5199  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().tintg );
5200  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().tintb );
5201  lua_pushnumber(luastate, (lua_Number) pEffect->GetEffectState().tempo.ang );
5202  return 6;
5203 
5204  default:
5205  MODebug2->Error( moText("in console script: GetEffectState : not an Effect! ") + (moText)Object->GetLabelName() );
5206  break;
5207  }
5208  } else {
5209  MODebug2->Error( moText("in console script: GetEffectState : object or config not founded > id: ")
5210  +(moText)IntToStr(objectid)
5211  + moText(" label name: ")
5212  + (moText)Object->GetLabelName() );
5213  }
5214 
5215  return 0;
5216 }
5217 
5219 {
5220  lua_State *state = (lua_State *) vm;
5221 
5222  MOint objectid = (MOint) lua_tonumber (state, 1);
5223  MOint devicecode = (MOint) lua_tonumber (state, 2);
5224  MOint codevalue = -1;
5225 
5226  moMoldeoObject* Object = GetObjectByIdx(objectid);
5227 
5228  if (Object && Object->GetConfig()) {
5229  if (Object->GetType()==MO_OBJECT_IODEVICE) {
5230  moIODevice* pDevice = (moIODevice*) Object;
5231  if (pDevice->GetStatus(devicecode)) {
5232  codevalue = pDevice->GetValue( devicecode );
5233  }
5234  }
5235  lua_pushnumber(state, (lua_Number) codevalue );
5236  } else {
5237  MODebug2->Error( moText("in console script: GetDeviceCode : object not founded : id:")+(moText)IntToStr(objectid));
5238  }
5239 
5240  return 1;
5241 }
5242 
5244 {
5245  lua_State *state = (lua_State *) vm;
5246 
5247  MOint objectid = (MOint) lua_tonumber (state, 1);
5248  char *devicecodestr = (char *) lua_tostring (state, 2);
5249  MOint devicecode = -1;
5250 
5251  moMoldeoObject* Object = GetObjectByIdx(objectid);
5252 
5253  if (Object && Object->GetConfig()) {
5254  if (Object->GetType()==MO_OBJECT_IODEVICE) {
5255  moIODevice* pDevice = (moIODevice*) Object;
5256  devicecode = pDevice->GetCode(devicecodestr);
5257  }
5258  lua_pushnumber(state, (lua_Number) devicecode );
5259  } else {
5260  MODebug2->Error( moText("in console script: GetDeviceCodeId : object not founded : id:")+(moText)IntToStr(objectid));
5261  }
5262 
5263  return 1;
5264 }
5265 
5266 int
5268 
5269  lua_State *state = (lua_State *) vm;
5270 
5271  MOint deviceid = (MOint) lua_tonumber (state, 1);
5272  MOint devicecode = (MOint) lua_tonumber (state, 2);
5273  MOint val0 = (MOint) lua_tonumber (state, 3);
5274  MOint val1 = (MOint) lua_tonumber (state, 4);
5275  MOint val2 = (MOint) lua_tonumber (state, 5);
5276  MOint val3 = (MOint) lua_tonumber (state, 6);
5277 
5278  moEventList* pEvents;
5279 
5280  pEvents = m_pIODeviceManager->GetEvents();
5281 
5282  if (pEvents) {
5283  pEvents->Add( deviceid, devicecode, val0, val1,val2,val3 );
5284  }
5285 
5286  return 0;
5287 
5288 }
5289 
5290 
5292  lua_State *state = (lua_State *) vm;
5293 
5294  char *pathname = (char *) lua_tostring (state, 1);
5295 
5296  int filecount = -1;
5297 
5298  filecount = this->GetDirectoryFileCount( pathname );
5299 
5300  lua_pushnumber(state, (lua_Number) filecount );
5301 
5302  if (filecount==-1) {
5303  MODebug2->Error( moText("console lua script: GetDirectoryFileCount > Directory doesn't exist") );
5304  }
5305 
5306  return 1;
5307 
5308 }
5309 
5311  lua_State *state = (lua_State *) vm;
5312 
5313  char *pathname = (char *) lua_tostring (state, 1);
5314 
5315  int res = -1;
5316 
5317  //filecount = this->GetDirectoryFileCount( pathname );
5318 
5319  //lua_pushnumber(state, (lua_Number) filecount );
5320 /*
5321  if (filecount==-1) {
5322  MODebug2->Error( moText("console lua script: GetDirectoryFileCount > Directory doesn't exist") );
5323  }
5324 */
5325  res = this->m_pResourceManager->GetRenderMan()->Screenshot( moText(pathname), m_LastScreenshot );
5326 
5327  lua_pushnumber(state, (lua_Number) res );
5328 
5329  return 1;
5330 
5331 }
5332 
5334  return moMoldeoObject::ToJSON();
5335 }
5336 
5337 int
5338 moConsole::TestScreen( const moDisplay& p_display_info ) {
5339 
5340 
5341  moShaderManager* pSMan;
5342  moGLManager* pGLMan;
5343  moRenderManager* pRMan;
5344  moTextureManager* pTMan;
5345 
5346  if (m_pResourceManager==NULL) {
5348  m_pResourceManager->Init( "", "", m_Config, 0, p_display_info.Resolution().Width(), p_display_info.Resolution().Height() );
5349  //m_pResourceManager->Init( "", "", m_Config, 0, 1280, 720);
5350  }
5351 
5352  //int tick = moGetTicksAbsolute( true );
5354  float stepi = m_ConsoleState.step_interval;
5356  float progress = (steps/stepi)/120.0;
5357 
5358  glClearColor( 1.0f - progress, 1.0f - progress, 1.0f - progress, 1.0 );
5359  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
5360 
5361  if (m_pResourceManager) {
5362  pSMan = m_pResourceManager->GetShaderMan();
5363  if (!pSMan) return 0;
5364 
5365  pGLMan = m_pResourceManager->GetGLMan();
5366  if (!pGLMan) return 0;
5367 
5368  pRMan = m_pResourceManager->GetRenderMan();
5369  if (!pRMan) return 0;
5370 
5371  pTMan = m_pResourceManager->GetTextureMan();
5372  if (!pTMan) return 0;
5373 
5374  } else return 0;
5375 
5376 
5377 
5378 
5379 
5387  glEnable(GL_DEPTH_TEST);
5388  glDisable(GL_BLEND);
5389  //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
5390  //moPlaneGeometry Plane2( 1.0, 1.0, 1, 1 );
5391 
5393  moMaterial Mat;
5394  Mat.m_Map = pTMan->GetTexture(pTMan->GetTextureMOId( "default", false ));
5395  Mat.m_MapGLId = Mat.m_Map->GetGLId();
5396  Mat.m_Color = moColor( 1.0, 1.0, 1.0 );
5397  Mat.m_fTextWSegments = 13.0f;
5398  Mat.m_fTextHSegments = 13.0f;
5399  Mat.m_vLight = moVector3f( -1.0, -1.0, -1.0 );
5400  Mat.m_vLight.Normalize();
5401  //Mat.m_PolygonMode = MO_POLYGONMODE_LINE;
5403  Mat.m_fWireframeWidth = 0.0005f;
5404 
5406  moSphereGeometry Sphere( 0.5, 13, 13 );
5407 
5409  moGLMatrixf Model;
5410  Model.MakeIdentity()
5411  .Rotate( 360.0*progress*moMathf::DEG_TO_RAD, 0.0, 1.0, 0.0 )
5412  .Translate( 0.0, 0.0, -2.618 + 0.618*progress );
5413  moMesh Mesh( Sphere, Mat );
5414  Mesh.SetModelMatrix(Model);
5415 
5417  moCamera3D Camera3D;
5418  pGLMan->SetDefaultPerspectiveView( p_display_info.Resolution().Width(), p_display_info.Resolution().Height() );
5419  // Camera3D.MakePerspective(60.0f, p_display_info.Proportion(), 0.01f, 1000.0f );
5420  Camera3D = pGLMan->GetProjectionMatrix();
5421 
5423  pRMan->Render( &Mesh, &Camera3D );
5424 
5431  glClear( GL_DEPTH_BUFFER_BIT);
5432 
5433  glDisable(GL_DEPTH_TEST);
5434  glEnable(GL_BLEND);
5435  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
5436 
5438  moMaterial Mat2;
5439  Mat2.m_Map = pTMan->GetTexture(pTMan->GetTextureMOId( "moldeotrans", false ));
5440  Mat2.m_MapGLId = Mat2.m_Map->GetGLId();
5441  Mat2.m_Color = moColor( 1.0, 1.0, 1.0 );
5442  Mat2.m_vLight = moVector3f( -1.0, -1.0, -1.0 );
5443  Mat2.m_vLight.Normalize();
5444 
5446  moPlaneGeometry Plane3( 1.0, 0.33, 1, 1 );
5447 
5449  moGLMatrixf Model2;
5450  Model2.MakeIdentity();
5451  Model2.Scale( 1.0, 1.0, 1.0 );
5452  Model2.Translate( 0.0, 0.0, 0.0 );
5453  moMesh Mesh2( Plane3, Mat2 );
5454  Mesh2.SetModelMatrix(Model2);
5455 
5457  moCamera3D Camera3D2;
5458  pGLMan->SetDefaultOrthographicView( p_display_info.Resolution().Width(), p_display_info.Resolution().Height() );
5459  Camera3D2 = pGLMan->GetProjectionMatrix();
5460 
5462  pRMan->Render( &Mesh2, &Camera3D2 );
5463 
5464 
5465 
5466  return 1;
5467 }
int EffectPlay(int m_MoldeoObjectId)
Definition: moConsole.cpp:4250
void UnloadIODevices()
Definition: moConsole.cpp:824
int iligia
Definition: moConsole.h:566
int luaSetEffectState(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5138
moVector3f m_vLight
Definition: moGUIManager.h:250
virtual void Deactivate()
int GetPreset()
devuelve el preset actualmente seleccionado
Definition: moConsole.cpp:4374
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
moTimerState GetConsoleState()
devuelve el estado del reloj de la consola
Definition: moConsole.cpp:4167
MOint GetParamIndex() const
Valor de un Parámetro.
Definition: moValue.h:501
static bool CopyFile(moText FileSrc, moText FileDst)
moEffectManager m_EffectManager
Definition: moConsole.h:560
virtual MOboolean Init()=0
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:4105
int luaGetEffectState(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5180
moVector4i * Vector4i()
Definition: moValue.cpp:400
bool IsValid() const
Objeto válido.
var b
Definition: jquery.js:16
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
const moText & GetLabelName() const
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()
MOint GetId() const
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:1671
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'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)
moEffectsArray & Effects()
g[c]
Definition: jquery.js:71
int EffectPause(int m_MoldeoObjectId)
Definition: moConsole.cpp:4265
void SetName(const moText &p_name)
int luaGetDirectoryFileCount(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5291
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:1206
int luaGetTicks(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4755
void Update()
Definition: moFile.cpp:374
virtual moMoldeoObject * GetObjectByIdx(int p_object_id)
Definition: moConsole.cpp:4428
#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
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 bool Activated() const
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:4173
#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:1586
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:733
virtual int Save(const moText &p_save_filename=moText(""))
Definition: moConsole.cpp:3980
moText m_LastScreenshot
Definition: moConsole.h:573
moRenderManagerMode
value type: NUM or FUNCTION
Definition: moParam.h:47
const moText & ToJSON()
Definition: moConsole.cpp:5333
moPresetParamDefinition & operator=(const moPresetParamDefinition &src)
Definition: moConsole.cpp:80
int luaPause(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4637
void SetDouble(MOdouble pdouble)
Definition: moValue.cpp:172
moPresetParams m_PresetParams
Definition: moConsole.h:616
value type: TXT or LNK
Definition: moParam.h:56
void LoadEffects()
Definition: moConsole.cpp:1060
int EffectStop(int m_MoldeoObjectId)
Definition: moConsole.cpp:4281
bool NextValue()
Selecciona el próximo valor del parámetro actual.
Definition: moConfig.cpp:1545
moEffectManager & GetEffectManager()
virtual MOulong GetTicks()
Definition: moConsole.cpp:1437
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:3454
virtual void LoadCodes(moIODeviceManager *)
Definition: moEffect.cpp:323
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
moText ToText() const
Definition: moValue.cpp:707
moRenderManager * GetRenderMan()
void SetPreconfig(int valueindex, moPreconfigIndexes &p_preconfindexes)
Setea una pre-configuración.
Definition: moConfig.cpp:1709
#define MOboolean
Definition: moTypes.h:385
int RelativeToGeneralIndex(int relativeindex, moMoldeoObjectType p_type)
Definition: moConsole.cpp:135
virtual void Set(moEffectManager *pEffectManager, moConsoleState *cstate)
void ConsoleRenderSession(const moText &p_frame_quality=moText("JPGGOOD"))
inicia el renderizado de una sesión pregrabada
Definition: moConsole.cpp:4112
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:556
moEffectsArray & AllEffects()
moMasterEffectsArray & MasterEffects()
virtual int ScriptCalling(moLuaVirtualMachine &vm, int iFunctionNumber)
int luaGetObjectParamIndex(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4803
MOuint tickselapsed
Definition: moConsole.h:571
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:5310
param 1: effect label name | effect id
Definition: moActions.h:416
int iborrado
Definition: moConsole.h:566
void StartMasterEffects()
Definition: moConsole.cpp:1375
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
Real Y() const
Definition: moMathVector4.h:77
void InitializeAllEffects()
Definition: moConsole.cpp:1282
moStereoSides stereoside
1: father object name | id, 2: object info
Definition: moActions.h:274
f
Definition: jquery.js:71
virtual void Pause()
Definition: moEffect.cpp:743
void moContinueTimer()
Continua luego de una pausa el temporizador global.
Definition: moTimer.cpp:120
void UnloadMasterEffects()
Definition: moConsole.cpp:960
#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:5267
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:4119
virtual moTimerState State() const
Definition: moTimer.cpp:101
#define MO_EFFECTS_TEX
Definition: moTypes.h:422
virtual MOboolean Init()
MOboolean RenderResEqualScreenRes()
const moText & GetName() const
Nombre del objeto.
#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
Real Z() const
Definition: moMathVector3.h:77
moInlets * GetInlets()
const moText & GetName() const
"consolepresetset" : MO_ACTION_CONSOLE_PRESET_SET
Definition: moActions.h:701
int TestScreen(const moDisplay &p_display_info)
Definition: moConsole.cpp:5338
int luaSetPreset(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4695
Clase Mensaje.
Definition: moEventList.h:97
virtual void SetConsoleValueIndex(MOint p_valueindex)
void StopMasterEffects()
Definition: moConsole.cpp:1408
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:4191
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:4403
moDataType Type() const
Definition: moValue.cpp:940
moGLMatrixf & Rotate(float angle, float vx, float vy, float vz)
int luaState(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4656
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
int RefreshValue(int m_MoldeoObjectId, int m_ParamId, int m_ValueId, bool p_Refresh=true)
Definition: moConsole.cpp:4229
void AddSubValue(const moText &strvalue, moValueType p_valuetype)
Definition: moValue.cpp:1707
void UnloadPreEffects()
Definition: moConsole.cpp:1047
void SetLong(MOlonglong plong)
Definition: moValue.cpp:188
Definition: moPostEffect.h:53
Real X() const
Definition: moMathVector3.h:73
"consolepause" : MO_ACTION_CONSOLE_PAUSE
Definition: moActions.h:543
#define MOswitch
Definition: moTypes.h:386
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:564
moShaderManager * GetShaderMan()
void DrawTexture(MOint p_resolution, MOint p_tex_num)
#define MOfloat
Definition: moTypes.h:403
MOboolean IsRenderToFBOEnabled()
void SetDuration(MOlong p_fun_duration)
Definition: moParam.cpp:734
virtual MOboolean Init()=0
const moText & ToJSON()
int luaPlay(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4628
MOpointer Pointer()
Definition: moValue.cpp:919
#define MO_SCREEN_RESOLUTION
virtual MOboolean Init()
int luaObjectDisable(moLuaVirtualMachine &vm)
habilita deshabilita
Definition: moConsole.cpp:4783
bool Set(int fx_index, moMoldeoObject *p_pMOB)
value type: TXT or LNK
Definition: moParam.h:57
#define MO_CFG_RESOURCE_LABEL
virtual double Alpha(double alpha)
Definition: moEffect.cpp:653
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
const moMobIndex & GetMobIndex() const
Devuelve la dupla de índices para el archivo de configuración.
MOboolean m_bExternalResources
Definition: moConsole.h:554
"valueget" > MO_ACTION_VALUE_GET
Definition: moActions.h:142
moPolygonModes m_PolygonMode
Definition: moGUIManager.h:276
int SendMoldeoAPIMessage(moDataMessage *p_pDataMessage)
Definition: moConsole.cpp:1877
virtual MOboolean Init()=0
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:559
moIODeviceManager * m_pIODeviceManager
Definition: moConsole.h:557
"consolesaves" : MO_ACTION_CONSOLE_SAVEAS
Definition: moActions.h:566
void UnloadResources()
Definition: moConsole.cpp:1268
const moText & ToJSON()
Definition: moParam.cpp:1368
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:738
moResourceManager * m_pResourceManager
Puntero al administrador de recursos.
void SetConsoleValueIndex(MOint p_valueindex)
#define MOlong
Definition: moTypes.h:391
virtual MOboolean Init()=0
void SetInterfaceView(int p_width, int p_height)
const moText & ToJSON()
Definition: moValue.cpp:1858
virtual const moEffectState & GetEffectState()
Definition: moEffect.cpp:59
void Stop()
Detiene el temporizador.
Definition: moTimer.h:219
MOint RenderHeight() const
int GetIndexValue() const
Definition: moParam.cpp:1227
Clase Base Descriptiva de un Objeto Moldeo.
int HexToInt(const moText &hex)
Definition: moText.cpp:1182
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:5243
virtual MOboolean Init()
Inicializa el objeto.
int luaGetObjectDataIndex(moLuaVirtualMachine &vm)
especificos de datos
Definition: moConsole.cpp:4894
moText GetDestinationMoldeoLabelName()
"consolerecordsession" : MO_ACTION_CONSOLE_RECORD_SESSION
Definition: moActions.h:522
Dispositivo de entrada/salida, típicamente, interfaces humanas de IO y datos ( teclado, mouse, tableta, tcp, udp, serial )
Definition: moTypes.h:532
if(!b.support.opacity)
Definition: jquery.js:28
moGLMatrixf & MakeIdentity()
Definition: moGLManager.cpp:79
virtual void GLSwapBuffers()
Definition: moConsole.cpp:1444
void LoadMasterEffects()
Definition: moConsole.cpp:908
MOboolean RemoveResource(MOint p_index)
moTypes MOint moText moParamIndex moParamReference int iRow int int i int i
Definition: all_f.js:18
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:1470
moMoldeoObjectType GetType() const
Nombre del archivo de configuración.
void Fix()
Corrige el reloj.
Definition: moTimer.cpp:262
int luaStop(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4646
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:4379
#define MO_RIGHT_TEX
Definition: moTypes.h:427
moText0 moText
Definition: moText.h:291
const moMobDefinition & GetMobDefinition() const
moConfig m_Config
Configuración de parámetros del objeto.
void RegisterFunctions()
beware ! call only once or die!!!
Definition: moConsole.cpp:4465
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
Real Z() const
Definition: moMathVector4.h:79
void SetDestinationMoldeoId(MOint p_DestinationMoldeoId)
void moStopTimer()
Detiene el temporizador global.
Definition: moTimer.cpp:124
#define MO_CFG_EFFECT_LABEL
Definition: moConsole.h:64
"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:572
MOdouble getTempo()
Definition: moTempo.cpp:153
#define MOint
Definition: moTypes.h:388
const moResolution & Resolution() const
int luaSetObjectPreconf(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4724
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
MOint GetMoldeoFatherId() const
Devuelve el identificador del padre de este objeto.
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
moFileArray & GetFiles()
Definition: moFile.cpp:381
int idebug
Definition: moConsole.h:566
int luaSetObjectData(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:5032
moFileManager * GetFileMan()
MOuint ticksprevious
Definition: moConsole.h:571
virtual int ResetScriptCalling()
Definition: moScript.h:172
"preconfigset" > MO_ACTION_PRECONFIG_SET
Definition: moActions.h:237
a max
Definition: jquery.js:72
const moDataSessionKey & NextKey(moConsoleState &m_ConsoleState)
virtual void Draw()
Dibuja.
Definition: moConsole.cpp:1479
int MoveMob(const moMobDefinition &p_MobDef, int position)
Definition: moConsole.cpp:3298
"objectgetpreconfig" : MO_ACTION_OBJECT_GETPRECONFIG
Definition: moActions.h:324
bool ScriptHasFunction(const char *strScriptName)
Definition: moScript.cpp:417
void SaveGLState()
moConsoleState m_ConsoleState
Definition: moConsole.h:552
void SetInt(MOint pint)
Definition: moValue.cpp:180
moTexture * m_Map
Definition: moGUIManager.h:274
virtual void Error(const moText &p_message)
Definition: moConsole.cpp:3099
virtual void GUIYield()
Definition: moConsole.cpp:1450
#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 )
int Width() const
moOutlets * GetOutlets()
Real X() const
Definition: moMathVector.h:77
bool InData(const moText &p_file_full_path)
#define MO_DEACTIVATED
Definition: moTypes.h:368
MOuint GetGLId() const
Definition: moTexture.h:224
Real Y() const
Definition: moMathVector.h:79
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:972
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)
moGLMatrixf & GetProjectionMatrix()
Objeto dibujable, pre-efecto ( primeros efectos en el orden de dibujado )
Definition: moTypes.h:529
int DeleteMob(const moMobDefinition &p_MobDef)
Definition: moConsole.cpp:3507
moConsoleMode GetConsoleMode()
devuelve el modo de la consola
Definition: moConsole.cpp:4162
#define MO_DATAMESSAGE
Definition: moEventList.h:85
MOdouble fps_current
Definition: moConsole.h:568
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)
MOuint Length() const
Definition: moText.cpp:347
void RestoreGLState()
const moText & ToJSON()
moMoldeoObjects m_MoldeoSceneObjects
Definition: moConsole.h:559
"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:4143
moConfigDefinition * GetConfigDefinition()
Devuelve el puntero al objeto de definición de la configuración.
Definition: moConfig.cpp:1572
#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
int luaGetObjectId(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4667
Objeto dibujable, efecto ( efectos en el orden de dibujado )
Definition: moTypes.h:528
moReactionListenerManager m_ReactionListenerManager
Definition: moConsole.h:561
"valueadd" > MO_ACTION_VALUE_ADD
Definition: moActions.h:88
virtual bool SetEffectState(const moEffectState &p_state)
Definition: moEffect.cpp:63
MOuint ticks
Definition: moConsole.h:571
void DeleteConfig()
Borra la configuracion de parámetros con sus respectivos valores.
Definition: moConfig.cpp:906
moVector3< MOdouble > moVector3d
MOdouble Double() const
Definition: moValue.cpp:859
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
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:3842
void UnloadEffects()
Definition: moConsole.cpp:1122
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.
MOint RenderWidth() const
"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
"paramget" > MO_ACTION_PARAM_GET
Definition: moActions.h:163
moVector3i * Vector3i()
Definition: moValue.cpp:390
void SetConsoleParamIndex(MOint p_paramindex)
int GetObjectId(const moText &p_objectlabelname)
Definition: moConsole.cpp:4407
value type: NUM or FUNCTION
Definition: moParam.h:42
moVector2< MOlong > moVector2i
Definition: moMathVector.h:422
MOint devicecode
Definition: moEventList.h:63
moMoldeoObjectType GetType() const
int luaSetObjectCurrentValue(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4848
void SetMoldeoGLState()
moDataManager * GetDataMan()
virtual const moText & GetConnectorLabelName() const
#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:4099
void ConsoleStop()
para el reloj de la consola
Definition: moConsole.cpp:4152
MOint GetConnectorId() const
void SetCurrentPreConf(MOint p_actual)
Posiciona la preconfiguración actual en el índice indicado.
Definition: moConfig.cpp:1591
int ObjectEnable(int m_MoldeoObjectId)
Definition: moConsole.cpp:4296
int luaObjectEnable(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4764
MOdouble fps_mean
Definition: moConsole.h:569
void SetPreconf(int objectid, int preconfid)
fija la configuración actualmente seleccionada de un objeto de la consola
Definition: moConsole.cpp:4390
virtual void Update()
Actualiza el estado de los recursos.
Definition: moConsole.cpp:3693
const moPreConfig & GetPreconfig(int valueindex)
Agrega una pre-configuración.
Definition: moConfig.cpp:1649
void Push(moText p_text)
Apila el mensaje dentro de la pila de mensajes.
Definition: moAbstract.h:115
Real Y() const
Definition: moMathVector3.h:75
void moPauseTimer()
Pausa el temporizador global.
Definition: moTimer.cpp:116
int luaGetObjectParamValues(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4824
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
MOlonglong Long() const
Definition: moValue.cpp:804
void ProcessConsoleMessage(moMessage *p_pMessage)
Definition: moConsole.cpp:3596
Real W() const
Definition: moMathVector4.h:81
const moText & GetLabelName() const
Devuelve la etiqueta de este objeto.
moParam & GetParam(MOint p_paramindex=-1)
Devuelve el parámetro por índice.
Definition: moConfig.cpp:984
"consolepresetsave" : MO_ACTION_CONSOLE_PRESET_SAVE
Definition: moActions.h:691
int AddChildMob(const moMobDefinition &p_MobDef, const moMobDefinition &p_MobDefFather)
Definition: moConsole.cpp:3286
virtual int Interaction()
Procesa los eventos de los dispositivos de entrada/salida.
Definition: moConsole.cpp:1747
void ScriptExeDraw()
Definition: moConsole.cpp:1455
void SetDestinationConnectorId(MOint p_DestinationConnectorId)
#define MOdouble
Definition: moTypes.h:404
MOboolean Init()
Inicializa el objeto.
void LoadPreEffects()
Definition: moConsole.cpp:974
#define DataMan()
void ConsoleModeUpdate()
Definition: moConsole.cpp:4014
bool PreviewShot(bool shot_start=false)
const moText & ToJSON()
"objectget" : MO_ACTION_OBJECT_GETCONFIG
Definition: moActions.h:307
#define RenderMan()
int luaSetTicks(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4744
#define MO_DEF_RENDER_WIDTH
Definition: moConsole.h:78
"effectgetstate" : MO_ACTION_EFFECT_SETSTATE
Definition: moActions.h:437
MOint GetMoldeoId() const
Devuelve el identificador de este objeto.
void SetId(MOint p_id)
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.
const moText & GetConfigName() const
Objeto principal de administración y dibujado de objetos de Moldeo.
Definition: moTypes.h:534
void FinalizeAllEffects()
Definition: moConsole.cpp:1362
moVector4d * Vector4d()
Definition: moValue.cpp:395
Real X() const
Definition: moMathVector4.h:75
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()
MOint GetValueIndex() 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()
MOint GetInletIndex(moText p_connector_name) const
virtual MOboolean Finish()
Finalizador.
Definition: moConsole.cpp:1701
virtual void Interaction(moIODeviceManager *)
Definition: moEffect.cpp:405
moText GetDataPath()
void LoadPostEffects()
Definition: moConsole.cpp:1137
void ConsolePlay()
enciende el reloj de la consola
Definition: moConsole.cpp:4124
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
int Height() const
void SetMobDefinition(const moMobDefinition &p_MobDef)
const moText & GetKeyName() const
Devuelve la etiqueta del padre de este objeto.
const moText & GetKeyName() const
bool Started() const
Devuelve el estado del temporizador.
Definition: moTimer.h:248
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:4686
void AddPreconfig(moPreconfigIndexes &p_preconfindexes)
Agrega una pre-configuración.
Definition: moConfig.cpp:1657
long m_ScreenshotInterval
Definition: moConsole.h:578
virtual ~moConsole()
Definition: moConsole.cpp:109
MOuint fps_count
Definition: moConsole.h:570
moVector4< MOdouble > moVector4d
moMoldeoActionType GetActionType() const
const moText & GetConfigName() const
Nombre del archivo de configuración.
MOswitch stereooutput
void FirstValue()
Definition: moParam.cpp:1254
bool SetCurrentParamIndex(int)
Selecciona el parámetro por el índice.
Definition: moConfig.cpp:1497
Objeto dibujable, post-efecto ( últímos efectos en el orden de dibujado )
Definition: moTypes.h:530
MOint Int() const
Definition: moValue.cpp:773
virtual void Draw(moTempo *, moEffectState *parentstate=NULL)=0
int luaGetObjectCurrentValue(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4872
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
MOuint GetValuesCount() const
Definition: moParam.cpp:1065
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:4209
int ObjectDisable(int m_MoldeoObjectId)
Definition: moConsole.cpp:4335
moText GetAbsolutePath()
Get relative path and filename "PP/myFileName.txt".
moMoldeoObjects m_MoldeoObjects
Definition: moConsole.h:558
"consoleget" : MO_ACTION_CONSOLE_GET
Definition: moActions.h:632
moTimer m_ScreenshotTimer
Definition: moConsole.h:577
int GetPreconf(int objectid)
devuelve la configuración actualmente seleccionada de un objeto de la consola
Definition: moConsole.cpp:4384
bool SelectScriptFunction(const char *strFuncName)
Definition: moScript.cpp:370
MOint GetPreConfCount()
Devuelve la cantidad de preconfiguraciones definidas.
Definition: moConfig.cpp:1581
int luaGetObjectData(moLuaVirtualMachine &vm)
Definition: moConsole.cpp:4915
MOboolean RemoveEffect(MOint p_ID, moMoldeoObjectType p_type)
int NewMob(const moMobDefinition &p_MobDef)
Definition: moConsole.cpp:3103
Administrador de efectos.
bool GetActivate() const
Devuelve el modo de activación al inicio del proyecto.
"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:3886
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:3807
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)
value type: TXT or LNK
Definition: moParam.h:53
bool FirstValue()
Selecciona el primer valor del parámetro actual.
Definition: moConfig.cpp:1532
int ScriptCalling(moLuaVirtualMachine &vm, int iFunctionNumber)
Definition: moConsole.cpp:4517
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:4706
void SetType(moMoldeoObjectType p_type)
var k
Definition: jquery.js:29
#define MO_CFG_RESOURCE_CONFIG
void LoadConnections()
Definition: moConsole.cpp:584
void UnloadPostEffects()
Definition: moConsole.cpp:1189
int ProcessMoldeoAPIMessage(moDataMessage *p_pDataMessage)
Procesa los mensajes de la Moldeo API 1.0.
Definition: moConsole.cpp:1900
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
int GetDirectoryFileCount(const moText &p_path)
Definition: moConsole.cpp:4450
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:3969
virtual void TurnOn()
Definition: moEffect.cpp:554
void SetResourceManager(moResourceManager *p_pResourceManager)
moVector2d * Vector2d()
Definition: moValue.cpp:375
int m_iMethodBase
Definition: moScript.h:206
"valuesave" > MO_ACTION_VALUE_SAVE
Definition: moActions.h:109
moTextureManager * GetTextureMan()
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:5218
virtual MOboolean Init()
Conección, vínculo entre dos objetos.
Definition: moConnectors.h:280