Salome HOME
python dump SetColor() only if the color changes
[modules/smesh.git] / src / SMESH_I / SMESH_Filter_i.cxx
index 8dd7ca4f03ac19d7e9c3be2f18b1227ef9be39ce..0a7d4d67ea4247e7afd1755874f704031af67f47 100644 (file)
@@ -2294,6 +2294,8 @@ void Filter_i::SetPredicate( Predicate_ptr thePredicate )
   {
     myFilter.SetPredicate( myPredicate->GetPredicate() );
     myPredicate->Register();
+    if ( const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(myMesh))
+      myPredicate->GetPredicate()->SetMesh( aMesh );
     TPythonDump()<<this<<".SetPredicate("<<myPredicate<<")";
   }
   std::list<TPredicateChangeWaiter*>::iterator i = myWaiters.begin();
@@ -2326,6 +2328,10 @@ SetMesh( SMESH_Mesh_ptr theMesh )
 
   myMesh = SMESH_Mesh::_duplicate( theMesh );
   TPythonDump()<<this<<".SetMesh("<<theMesh<<")";
+
+  if ( myPredicate )
+    if ( const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
+      myPredicate->GetPredicate()->SetMesh( aMesh );
 }
 
 SMESH::long_array*
@@ -3100,6 +3106,8 @@ Predicate_ptr Filter_i::GetPredicate()
   else
   {
     SMESH::Predicate_var anObj = myPredicate->_this();
+    // if ( SMESH::Functor_i* fun = SMESH::DownCast<SMESH::Functor_i*>( anObj ))
+    //   TPythonDump() << fun << " = " << this << ".GetPredicate()";
     return anObj._retn();
   }
 }
@@ -3811,8 +3819,8 @@ SMESH::FunctorType SMESH::StringToFunctorType(const char* str)
 {
   std::string name( str + 3 ); // skip "FT_"
   const char** functNames = getFunctNames();
-  int ft = SMESH::FT_Undefined;
-  for ( ; ft >= 0; --ft )
+  int ft = 0;
+  for ( ; ft < SMESH::FT_Undefined; ++ft )
     if ( name == ( functNames[ft] + 3 ))
       break;