]> 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:29 +0000 (11:56 +0000)
committerouv <ouv@opencascade.com>
Fri, 26 Dec 2008 11:56:29 +0000 (11:56 +0000)
src/VISUGUI/VisuGUI_TimeAnimation.cxx

index 1950e856d8a65e5cd3a688950d03544ee5a461a7..326bac71e9792039da1189b0e2c6e83d917857a7 100644 (file)
@@ -97,6 +97,9 @@
 namespace {
   void GeneratePresentations(int theFieldId, VISU_TimeAnimation* theAnimator)
   {
+    if(theAnimator->getNbFields() == 0)
+      return;
+
     theAnimator->generatePresentations(theFieldId);
     FieldData& aFieldData = theAnimator->getFieldData(theFieldId);
 
@@ -690,12 +693,14 @@ SetupDlg::SetupDlg (QWidget* theParent,
   double aMaxTime = myAnimator->getMaxTime();
   double aMinTime = myAnimator->getMinTime();
   double aStep = 1;
-  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);
@@ -866,6 +871,9 @@ void SetupDlg::initialize()
 
   _PTR(Study) aStudy = myAnimator->getStudy();
 
+  if( myAnimator->getNbFields() == 0 )
+    return;
+
   FieldData& aData = myAnimator->getFieldData( 0 );
   _PTR(SObject) aField = aData.myField;
 
@@ -925,6 +933,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->addItem("Scalar Map");   // item 0
   myTypeId2ComboId[TSCALARMAP_ITEM] = myComboId2TypeId.size();
@@ -1131,6 +1142,14 @@ namespace
 
 void SetupDlg::onPreferencesDlg()
 {
+  if(myAnimator->getNbFields() == 0){
+    SUIT_MessageBox::warning(this,
+                           tr("ERROR"),
+                           VisuGUI_TimeAnimationDlg::tr("MSG_NO_ANIMATIONDATA"),
+                           tr("&OK"));
+    return;
+  }
+
   SUIT_OverrideCursor c;
 
   VISU::Animation::AnimationMode aMode = myAnimator->getAnimationMode();