#define MAXVAL 1e10
+namespace {
+ void GeneratePresentations(int theFieldId, VISU_TimeAnimation* theAnimator)
+ {
+ theAnimator->generatePresentations(theFieldId);
+ FieldData& aFieldData = theAnimator->getFieldData(theFieldId);
+
+
+ int aRefFieldId = ( theAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) ? theFieldId : 0;
+ if(VISU::ColoredPrs3d_i* aInitialPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(theAnimator->getFieldData(aRefFieldId).myPrs[0])){
+ for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
+ VISU::ColoredPrs3d_i* aColoredPrs3d = aFieldData.myPrs[aFrameId];
+
+ // Special case for DeformedShape And ScalarMap presentation
+ // Restore time stamp number for all presentations
+ VISU::DeformedShapeAndScalarMap_i* aDeformedAndScalPrs = dynamic_cast<VISU::DeformedShapeAndScalarMap_i*>(aColoredPrs3d);
+ int aTimeStampNum = -1;
+ if(aDeformedAndScalPrs){
+ aTimeStampNum = aDeformedAndScalPrs->GetScalarTimeStampNumber();
+ }
+ aColoredPrs3d->SameAs(aInitialPrs3d);
+
+ if(aDeformedAndScalPrs){
+ aDeformedAndScalPrs->SetScalarField(aDeformedAndScalPrs->GetScalarEntity(),
+ aDeformedAndScalPrs->GetScalarFieldName(),
+ aTimeStampNum);
+ }
+
+ std::string aTitle = aColoredPrs3d->GetCTitle();
+ if ( aFrameId != 0 && theAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) {
+ aColoredPrs3d->SetTitle(aTitle.c_str());
+ }
+ }
+ }
+ }
+}
+
ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
: QDialog(theParent, "ArrangeDlg", true,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
QApplication::setOverrideCursor( Qt::waitCursor );
FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem());
if (aData.myPrs.empty())
- myAnimator->generatePresentations(myFieldLst->currentItem());
+ GeneratePresentations(myFieldLst->currentItem(),myAnimator);
vtkFloatingPointType aBounds[6];
aData.myPrs[0]->GetBounds(aBounds);
vtkFloatingPointType aDist = 0;
DLG* aDlg = new DLG (myModule);
TYPE* aPrs3d = dynamic_cast<TYPE*>(aData.myPrs[0]);
aDlg->initFromPrsObject(aPrs3d, true);
- if (aDlg->exec() && aDlg->storeToPrsObject(aData.myPrs[0])) {
- for (int i = 1; i < aData.myNbFrames; i++){
- aData.myPrs[i]->SameAs(aData.myPrs[0]);
- }
+ if (aDlg->exec() && aDlg->storeToPrsObject(aData.myPrs[0])) {
+ for (long aFrameId = 1; aFrameId < aData.myNbFrames; aFrameId++){
+ TYPE* aDeformedPrs3d = dynamic_cast<TYPE*>(aData.myPrs[aFrameId]);
+ //Set correct time stamp number
+ int aTimeStampNum = aDeformedPrs3d->GetScalarTimeStampNumber();
+ aDeformedPrs3d->SameAs(aPrs3d);
+ aDeformedPrs3d->SetScalarField(aDeformedPrs3d->GetScalarEntity(),
+ aDeformedPrs3d->GetScalarFieldName(),
+ aTimeStampNum);
+
+ }
+
+ if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) {
+ for (int aFieldId = 1; aFieldId < myAnimator->getNbFields(); aFieldId++) {
+ FieldData& aFieldData = myAnimator->getFieldData(aFieldId);
+ for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
+ TYPE* aDeformedPrs3d = dynamic_cast<TYPE*>(aFieldData.myPrs[aFrameId]);
+ std::string aTitle = aDeformedPrs3d->GetCTitle();
+ //Set correct time stamp number
+ int aTimeStampNum = aDeformedPrs3d->GetScalarTimeStampNumber();
+ aDeformedPrs3d->SameAs(aPrs3d);
+ aDeformedPrs3d->SetTitle(aTitle.c_str());
+ aDeformedPrs3d->SetScalarField(aDeformedPrs3d->GetScalarEntity(),
+ aDeformedPrs3d->GetScalarFieldName(),
+ aTimeStampNum);
+
+ }
+ }
+ }
}
delete aDlg;
}
FieldData& aFieldData = myAnimator->getFieldData(i);
if( aFieldData.myPrs.empty() )
{
- myAnimator->generatePresentations(i);
+ //myAnimator->generatePresentations(i);
+ GeneratePresentations(i,myAnimator);
continue;
}
// when a range or a sequence of the animation has been changed
if( isRegenerate )
{
+ GeneratePresentations(i,myAnimator);
+ /*
VISU::ColoredPrs3d_i* aPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aFieldData.myPrs[0]);
if( !aPrs3d )
continue;
aColoredPrs3d->SetTitle(aTitle.c_str());
}
}
+ */
}
}
if( isRegenerate )
//myPlayFrame->setEnabled(true);
}
+
//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onPlayPressed()
{