From 02aa70387d8b75a185a4053872595d465b2e1946 Mon Sep 17 00:00:00 2001 From: ouv Date: Fri, 26 Dec 2008 11:56:29 +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 1950e856..326bac71 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -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 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); @@ -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(); -- 2.39.2