]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Definition of getSObjectByFatherPathAndName() function moved to visu.py
authorouv <ouv@opencascade.com>
Wed, 27 Apr 2011 09:22:16 +0000 (09:22 +0000)
committerouv <ouv@opencascade.com>
Wed, 27 Apr 2011 09:22:16 +0000 (09:22 +0000)
src/VISU_I/VISU_DumpPython.cc
src/VISU_SWIG/visu.py

index 38b1318d8878861529af5be5a4018321eb5235c7..7254fe5663dbbeeea2ade94839bfd714ef027bc8 100644 (file)
@@ -2115,7 +2115,8 @@ namespace VISU
           value = refObj->GetName();
           QString path(theStudy->GetObjectPath(father));
           //The following code requierd as a field name can contain '/' character
-          theStr<<thePrefix<<"aBuilder.Addreference(fieldSO,getSObjectByFatherPathAndName(theStudy, '"<<path.toLatin1().data()<<"', '"<<value.toLatin1().data()<<"'))"<<endl;
+          theStr<<thePrefix<<"aBuilder.Addreference(fieldSO,visu.getSObjectByFatherPathAndName(theStudy, '"<<
+            path.toLatin1().data()<<"', '"<<value.toLatin1().data()<<"'))"<<endl;
         }
         value = anObj->GetName();
         if(!value.isEmpty()) theStr<<thePrefix<<"aBuilder.SetName(fieldSO, '"<<value.toLatin1().data()<<"')"<< endl;
@@ -2204,7 +2205,8 @@ namespace VISU
          value = refObj->GetName();
          QString path(theStudy->GetObjectPath(father));
          //The following code requierd as a field name can contain '/' character
-         theStr<<thePrefix<<"aBuilder.Addreference(fieldSO,getSObjectByFatherPathAndName(theStudy, '"<<path.toLatin1().data()<<"', '"<<value.toLatin1().data()<<"'))"<<endl;
+         theStr<<thePrefix<<"aBuilder.Addreference(fieldSO,visu.getSObjectByFatherPathAndName(theStudy, '"<<
+            path.toLatin1().data()<<"', '"<<value.toLatin1().data()<<"'))"<<endl;
        }
        value = anObj->GetName();
        if(!value.isEmpty()) theStr<<thePrefix<<"aBuilder.SetName(fieldSO, '"<<value.toLatin1().data()<<"')"<< endl;
@@ -2410,27 +2412,6 @@ namespace VISU
     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;
-
-      aStr<<"def getSObjectByFatherPathAndName(theStudy, thePath, theName):"<<endl;
-      aStr<<aPrefix<<"father = theStudy.FindObjectByPath(thePath)"<<endl;
-      aStr<<aPrefix<<"itr = theStudy.NewChildIterator(father)"<<endl;
-      aStr<<aPrefix<<"while itr.More():"<<endl;
-      aStr<<aPrefix<<aPrefix<<"so = itr.Value()"<<endl;
-      aStr<<aPrefix<<aPrefix<<"if so.GetName()==theName: return so"<<endl;
-      aStr<<aPrefix<<aPrefix<<"itr.Next()"<<endl;
-      aStr<<aPrefix<<aPrefix<<"pass"<<endl;
-      aStr<<aPrefix<<"return None"<<endl;
-
-      aStr<<endl;
-    }
-
     // theIsValidScript currently is not used by internal dump methods (DumpChildrenToPython(), etc.)
     // If the situation changes, then the following line should be removed, and theIsValidScript
     // should be set properly by those internal methods
index d1d65e67889ffe4e1bf3afe57ebe33628f97cfe6..d51dea9255f4529208be3296c0731c0322becbb0 100644 (file)
@@ -195,6 +195,16 @@ def getFieldObjectFromStudy(number, subnumber, theStudy = myLocalStudy):
         print "ERROR: No Field Object stored in this Study"
         return None
 
+def getSObjectByFatherPathAndName(theStudy, thePath, theName):
+    father = theStudy.FindObjectByPath(thePath)
+    itr = theStudy.NewChildIterator(father)
+    while itr.More():
+        so = itr.Value()
+        if so.GetName()==theName: return so
+        itr.Next()
+        pass
+    return None
+
 def SObjectToObject(theSObject) :
      #    global myORB
     if theSObject is None :