From 4eebb5d19788f8a9c8deb229629e5f47467e32ff Mon Sep 17 00:00:00 2001 From: ouv Date: Fri, 26 Dec 2008 11:56:22 +0000 Subject: [PATCH] Fix of the bug IPAL13188 - SIGSEGV, CRASH after trying to "Show...", define "Properties" of animation. --- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 31 +++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 01fa92e5..e1afad6a 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -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 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 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(); -- 2.39.2