From: ouv Date: Mon, 3 Dec 2007 12:58:08 +0000 (+0000) Subject: Bug IPAL18064 - 4.x: wrong frames are generated after animation edition. X-Git-Tag: mergefrom_MERGE_MULTIPR_EVOLUTION_07-Dec-07~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=39a6450a249f965724091cd7012a59bc01aab20e;p=modules%2Fvisu.git Bug IPAL18064 - 4.x: wrong frames are generated after animation edition. --- diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index de85c274..f3d9b5e5 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -473,7 +473,8 @@ SetupDlg::SetupDlg (QWidget* theParent, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myAnimator(theAnimator), - myModule(theModule) + myModule(theModule), + myIsRegenerate( false ) { setCaption("Setup Animation"); setSizeGripEnabled( TRUE ); @@ -670,9 +671,6 @@ enum PrsComboItem { //------------------------------------------------------------------------ void SetupDlg::onClose() { - //for (int i = 0; i < myAnimator->getNbFields(); i++) - // myAnimator->clearData(myAnimator->getFieldData(i)); - if( !myUseRangeBox->isChecked() ) myAnimator->setAnimationRange( 0, 0 ); @@ -997,6 +995,8 @@ void SetupDlg::onRangeCheck (bool theCheck) myAnimator->setAnimationRange(0, 0); else myAnimator->setAnimationRange(myMinVal->value(), myMaxVal->value()); + + setIsRegenerate( true ); } //------------------------------------------------------------------------ @@ -1008,6 +1008,8 @@ void SetupDlg::onMinValue (double theVal) return; } myAnimator->setAnimationRange(theVal, myAnimator->getMaxRange()); + + setIsRegenerate( true ); } //------------------------------------------------------------------------ @@ -1019,6 +1021,8 @@ void SetupDlg::onMaxValue (double theVal) return; } myAnimator->setAnimationRange(myAnimator->getMinRange(), theVal); + + setIsRegenerate( true ); } //------------------------------------------------------------------------ @@ -1030,6 +1034,8 @@ void SetupDlg::onSequenceCheck( bool theCheck ) myUseRangeBox->setChecked( false ); myUseRangeBox->blockSignals( false ); } + + setIsRegenerate( true ); } //------------------------------------------------------------------------ @@ -1069,6 +1075,8 @@ void SetupDlg::onIndicesChanged( const QString& theIndices ) myIndices->setPaletteForegroundColor( Qt::black ); myAnimator->setAnimationSequence( theIndices.latin1() ); + + setIsRegenerate( true ); } //------------------------------------------------------------------------ @@ -1114,6 +1122,8 @@ void SetupDlg::onValuesChanged() myIndices->blockSignals( false ); myAnimator->setAnimationSequence( anIndices.latin1() ); + + setIsRegenerate( true ); } //------------------------------------------------------------------------ @@ -1505,26 +1515,37 @@ void VisuGUI_TimeAnimationDlg::createFrames() SUIT_OverrideCursor c; for (int i = 0; i < myAnimator->getNbFields(); i++) { - if (myAnimator->getFieldData(i).myPrs.empty()) - myAnimator->generatePresentations(i); - } - /* - for (int aFieldId = 0; aFieldId < myAnimator->getNbFields(); aFieldId++) { - FieldData& aFieldData = myAnimator->getFieldData(aFieldId); + FieldData& aFieldData = myAnimator->getFieldData(i); if( aFieldData.myPrs.empty() ) + { + myAnimator->generatePresentations(i); continue; + } + + // ouv : IPAL18064 + // even if aFieldData is not empty, we must regenerate presentations, + // when a range or a sequence of the animation has been changed + if( mySetupDlg->isRegenerate() ) + { + VISU::ColoredPrs3d_i* aPrs3d = dynamic_cast(aFieldData.myPrs[0]); + if( !aPrs3d ) + continue; - VISU::ColoredPrs3d_i* aPrs3d = dynamic_cast(aFieldData.myPrs[0]); - for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) { - VISU::ColoredPrs3d_i* aColoredPrs3d = aFieldData.myPrs[aFrameId]; - aColoredPrs3d->SameAs(aPrs3d); - if ( aFrameId != 0 && myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) { - std::string aTitle = aColoredPrs3d->GetCTitle(); - aColoredPrs3d->SetTitle(aTitle.c_str()); + myAnimator->generatePresentations(i); + + aFieldData = myAnimator->getFieldData(i); + for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) { + VISU::ColoredPrs3d_i* aColoredPrs3d = aFieldData.myPrs[aFrameId]; + aColoredPrs3d->SameAs(aPrs3d); + if ( aFrameId != 0 && myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) { + std::string aTitle = aColoredPrs3d->GetCTitle(); + aColoredPrs3d->SetTitle(aTitle.c_str()); + } } + mySetupDlg->setIsRegenerate( false ); } } - */ + if (myAnimator->getNbFrames() == 0) { myPlayFrame->setEnabled(false); c.suspend(); diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.h b/src/VISUGUI/VisuGUI_TimeAnimation.h index d19f7872..3d48e76b 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.h +++ b/src/VISUGUI/VisuGUI_TimeAnimation.h @@ -128,6 +128,9 @@ class SetupDlg: public QDialog { public: void initialize(); + bool isRegenerate() const { return myIsRegenerate; } + bool setIsRegenerate( const bool on ) { myIsRegenerate = on; } + private slots: void onClose(); void onFieldChange(int theIndex); @@ -146,6 +149,8 @@ class SetupDlg: public QDialog { VisuGUI* myModule; VISU_TimeAnimation* myAnimator; + bool myIsRegenerate; + QListBox* myFieldLst; QComboBox* myTypeCombo; std::vector myComboId2TypeId;