Salome HOME
Issue 0013373: EDF PAL 273 : Option Single/Multi file dump V6_main_20110330 V6_main_20110331 V6_main_20110405
authorouv <ouv@opencascade.com>
Tue, 29 Mar 2011 07:37:14 +0000 (07:37 +0000)
committerouv <ouv@opencascade.com>
Tue, 29 Mar 2011 07:37:14 +0000 (07:37 +0000)
src/ENGINE/VISU_Engine_i.cc
src/ENGINE/VISU_Engine_i.hh
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_Gen_i.hh

index 37ee82ea948543471662af58776463b6fb48db73..c0ccce709ac9025af15ffc0b2daffa6ab7080122 100644 (file)
@@ -488,9 +488,10 @@ namespace VISU{
   }
   Engines::TMPFile* VISU_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
                                            CORBA::Boolean theIsPublished,
+                                           CORBA::Boolean theIsMultiFile,
                                            CORBA::Boolean& theIsValidScript)
   {
-    return myVisuGen->DumpPython(theStudy, theIsPublished, theIsValidScript);
+    return myVisuGen->DumpPython(theStudy, theIsPublished, theIsMultiFile, theIsValidScript);
   }
 
   VISU::ColoredPrs3dCache_ptr
index 70deb92975eb1adf262075048f13bf90d4243c1f..dbb80c5ef0ba7d4c6c1c898af9a1a5366e2d44d3 100644 (file)
@@ -243,6 +243,7 @@ namespace VISU
     // inherited methods from Engines::Component
     virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
                                         CORBA::Boolean theIsPublished,
+                                        CORBA::Boolean theIsMultiFile,
                                         CORBA::Boolean& theIsValidScript);   
 
     virtual
index 04b04ed9e7e21739cc2560752ea66fd2b86166b2..38b1318d8878861529af5be5a4018321eb5235c7 100644 (file)
@@ -2297,6 +2297,7 @@ namespace VISU
   VISU_Gen_i::
   DumpPython(CORBA::Object_ptr theStudy,
             CORBA::Boolean theIsPublished,
+            CORBA::Boolean theIsMultiFile,
             CORBA::Boolean& theIsValidScript)
   {
     theIsValidScript = false;
@@ -2314,14 +2315,17 @@ namespace VISU
 #define aStr cout
 #endif
 
-    std::string aPrefix(PREFIX);
-    aStr<<"def RebuildData(theStudy):"<<endl;
+    std::string aPrefix = theIsMultiFile ? PREFIX : "";
+    if( theIsMultiFile )
+      aStr<<"def RebuildData(theStudy):"<<endl;
     aStr<<aPrefix<<"from batchmode_salome import orb, naming_service, lcc, myStudyManager"<<endl;
     aStr<<aPrefix<<"import SALOME_MED"<<endl;
     aStr<<aPrefix<<"import SALOMEDS"<<endl;
     aStr<<aPrefix<<"import VISU"<<endl;
     aStr<<aPrefix<<"import visu"<<endl;
     aStr<<endl;
+    if( !theIsMultiFile )
+      aStr<<"theStudy = salome.myStudy"<<endl;
     aStr<<aPrefix<<"aVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,theStudy,0)"<<endl;
     aStr<<aPrefix<<"aSComponent = visu.PublishComponent(theStudy)"<<endl;
     aStr<<aPrefix<<"aMed = lcc.FindOrLoadComponent('FactoryServer','MED')"<<endl;
@@ -2403,10 +2407,13 @@ namespace VISU
       }
     }
 
-    aStr<<aPrefix<<"pass"<<endl;
+    if( theIsMultiFile )
+      aStr<<aPrefix<<"pass"<<endl;
 
     if(theIsPublished) { //SRN: define function for Animation
 
+      aPrefix = PREFIX;
+
       //Define a function that find a SObject by its father's path and its name
       aStr<<endl;
       aStr<<endl;
index 70e3833f647b012598dbac0db2a433dfcadeb285..a3ae8fa2b866ab1efd7f5bf6012426c710d695d3 100644 (file)
@@ -315,6 +315,7 @@ namespace VISU
     Engines::TMPFile*
     DumpPython(CORBA::Object_ptr theStudy,
               CORBA::Boolean theIsPublished,
+              CORBA::Boolean theIsMultiFile,
               CORBA::Boolean& theIsValidScript);
 
     // inherited methods from SALOMEDS::Driver