]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix of the bug IPAL13188 - SIGSEGV, CRASH after trying to "Show...", define "Properti...
authorouv <ouv@opencascade.com>
Fri, 26 Dec 2008 11:56:22 +0000 (11:56 +0000)
committerouv <ouv@opencascade.com>
Fri, 26 Dec 2008 11:56:22 +0000 (11:56 +0000)
src/VISUGUI/VisuGUI_TimeAnimation.cxx

index 01fa92e5b3d98a95e6a0fbfb8a343874a07d684c..e1afad6a82b07900e9c4f4a223109f7c3b203145 100644 (file)
@@ -91,6 +91,9 @@
 namespace {
   void GeneratePresentations(int theFieldId, VISU_TimeAnimation* theAnimator)
   {
+    if(theAnimator->getNbFields() == 0)
+      return;
+
     theAnimator->generatePresentations(theFieldId);
     FieldData& aFieldData = theAnimator->getFieldData(theFieldId);
     
@@ -626,12 +629,14 @@ SetupDlg::SetupDlg (QWidget* theParent,
   double aMaxTime = myAnimator->getMaxTime();
   double aMinTime = myAnimator->getMinTime();
   double aStep;
-  if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) 
-    aStep = (aMaxTime - aMinTime) / (myAnimator->getFieldData(0).myNbTimes - 1);
-  else { // successive animation mode
-    std::pair<int,long> aLastFieldFrame(myAnimator->getNbFields() - 1,
-                                       myAnimator->getFieldData(myAnimator->getNbFields() - 1).myNbTimes - 1);
-    aStep = (aMaxTime - aMinTime) / myAnimator->getAbsoluteFrameNumber(aLastFieldFrame);
+  if( myAnimator->getNbFields() > 0 ) {
+    if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) 
+      aStep = (aMaxTime - aMinTime) / (myAnimator->getFieldData(0).myNbTimes - 1);
+    else { // successive animation mode
+      std::pair<int,long> aLastFieldFrame(myAnimator->getNbFields() - 1,
+                                         myAnimator->getFieldData(myAnimator->getNbFields() - 1).myNbTimes - 1);
+      aStep = (aMaxTime - aMinTime) / myAnimator->getAbsoluteFrameNumber(aLastFieldFrame);
+    }
   }
 
   QLabel* aMinLbl = new QLabel("From", myUseRangeBox);
@@ -771,6 +776,9 @@ void SetupDlg::initialize()
 
   _PTR(Study) aStudy = myAnimator->getStudy();
 
+  if( myAnimator->getNbFields() == 0 )
+    return;
+
   FieldData& aData = myAnimator->getFieldData( 0 );
   _PTR(SObject) aField = aData.myField;
 
@@ -825,6 +833,9 @@ void SetupDlg::onFieldChange (int theIndex)
   myTypeId2ComboId.clear();
   myComboId2TypeId.clear();
 
+  if( myAnimator->getNbFields() == 0 )
+    return;
+
   // ATTENTION: append items in the same order like it is done in the PrsComboItem enumeration
   myTypeCombo->insertItem("Scalar Map");   // item 0
   myTypeId2ComboId[TSCALARMAP_ITEM] = myComboId2TypeId.size();
@@ -1031,6 +1042,14 @@ namespace
 
 void SetupDlg::onPreferencesDlg()
 {
+  if(myAnimator->getNbFields() == 0){
+    SUIT_MessageBox::warn1(this,
+                           tr("ERROR"),
+                           VisuGUI_TimeAnimationDlg::tr("MSG_NO_ANIMATIONDATA"),
+                           tr("&OK"));
+    return;
+  }
+
   SUIT_OverrideCursor c;
 
   VISU::Animation::AnimationMode aMode = myAnimator->getAnimationMode();