Commit f4161fec authored by T.J. Corona's avatar T.J. Corona

Add parameter to set animation clock precision.

This commit is in reference to issue # 0015767. Originally, the clock
precision for the animation toolbar was set to 17 digits of precision. Now,
this value is definable as an Animation setting (its default is 17).
parent 1e43d80c
Pipeline #18211 passed with stage
......@@ -244,6 +244,18 @@
</Hints>
</IntVectorProperty>
<IntVectorProperty name="AnimationTimePrecision"
number_of_elements="1"
default_values="17"
command="SetAnimationTimePrecision"
panel_visibility="advanced">
<Documentation>
Set the number of significant digits displayed for the time in the animation
toolbar.
</Documentation>
<IntRangeDomain min="1" max="17" />
</IntVectorProperty>
<DoubleVectorProperty name="MultiViewImageBorderColor"
command="SetMultiViewImageBorderColor"
number_of_elements="3"
......@@ -334,6 +346,7 @@
<PropertyGroup label="Animation">
<Property name="CacheGeometryForAnimation" />
<Property name="AnimationGeometryCacheLimit" />
<Property name="AnimationTimePrecision" />
</PropertyGroup>
<PropertyGroup label="Screenshot Options">
......
......@@ -48,6 +48,7 @@ vtkPVGeneralSettings::vtkPVGeneralSettings()
ScalarBarMode(vtkPVGeneralSettings::AUTOMATICALLY_HIDE_SCALAR_BARS),
CacheGeometryForAnimation(false),
AnimationGeometryCacheLimit(0),
AnimationTimePrecision(17),
PropertiesPanelMode(vtkPVGeneralSettings::ALL_IN_ONE)
{
this->SetDefaultViewType("RenderView");
......
......@@ -123,6 +123,11 @@ public:
void SetAnimationGeometryCacheLimit(unsigned long val);
vtkGetMacro(AnimationGeometryCacheLimit, unsigned long);
// Description:
// Set the precision of the animation time toolbar.
vtkSetMacro(AnimationTimePrecision, int);
vtkGetMacro(AnimationTimePrecision, int);
// Description:
// Forwarded for vtkSMParaViewPipelineControllerWithRendering.
void SetInheritRepresentationProperties(bool val);
......@@ -160,6 +165,7 @@ protected:
int ScalarBarMode;
bool CacheGeometryForAnimation;
unsigned long AnimationGeometryCacheLimit;
int AnimationTimePrecision;
int PropertiesPanelMode;
private:
......
......@@ -7,7 +7,7 @@
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
......@@ -34,7 +34,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqAnimationManager.h"
#include "pqAnimationScene.h"
#include "pqAnimationTimeWidget.h"
#include "pqCoreUtilities.h"
#include "pqPVApplicationCore.h"
#include "vtkCommand.h"
#include "vtkPVGeneralSettings.h"
//-----------------------------------------------------------------------------
void pqAnimationTimeToolbar::constructor()
......@@ -46,6 +49,9 @@ void pqAnimationTimeToolbar::constructor()
this->connect(pqPVApplicationCore::instance()->animationManager(),
SIGNAL(activeSceneChanged(pqAnimationScene*)),
SLOT(setAnimationScene(pqAnimationScene*)));
pqCoreUtilities::connect(vtkPVGeneralSettings::GetInstance(),
vtkCommand::ModifiedEvent,
this, SLOT(updateTimePrecision()));
}
//-----------------------------------------------------------------------------
......@@ -55,6 +61,17 @@ void pqAnimationTimeToolbar::setAnimationScene(pqAnimationScene* scene)
scene? scene->getProxy() : NULL);
}
//-----------------------------------------------------------------------------
void pqAnimationTimeToolbar::updateTimePrecision()
{
if (this->AnimationTimeWidget->timePrecision() !=
vtkPVGeneralSettings::GetInstance()->GetAnimationTimePrecision())
{
this->AnimationTimeWidget->setTimePrecision(
vtkPVGeneralSettings::GetInstance()->GetAnimationTimePrecision());
}
}
//-----------------------------------------------------------------------------
pqAnimationTimeWidget* pqAnimationTimeToolbar::animationTimeWidget() const
{
......
......@@ -64,6 +64,8 @@ public:
private slots:
void setAnimationScene(pqAnimationScene* scene);
void updateTimePrecision();
private:
Q_DISABLE_COPY(pqAnimationTimeToolbar)
void constructor();
......@@ -71,5 +73,3 @@ private:
};
#endif
......@@ -48,10 +48,12 @@ public:
void* AnimationSceneVoidPtr;
pqPropertyLinks Links;
int CachedTimestepCount;
int Precision;
pqInternals(pqAnimationTimeWidget* self) :
AnimationSceneVoidPtr(NULL),
CachedTimestepCount(-1)
CachedTimestepCount(-1),
Precision(17)
{
this->Ui.setupUi(self);
this->Ui.timeValue->setValidator(new QDoubleValidator(self));
......@@ -170,7 +172,8 @@ vtkSMProxy* pqAnimationTimeWidget::timeKeeper() const
void pqAnimationTimeWidget::setTimeValue(double time)
{
Ui::AnimationTimeWidget &ui = this->Internals->Ui;
ui.timeValue->setTextAndResetCursor(QString::number(time, 'g', 17));
ui.timeValue->setTextAndResetCursor(
QString::number(time, 'g', this->Internals->Precision));
bool prev = ui.timestepValue->blockSignals(true);
int index = vtkSMTimeKeeperProxy::GetLowerBoundTimeStepIndex(this->timeKeeper(), time);
ui.timestepValue->setValue(index);
......@@ -184,6 +187,18 @@ double pqAnimationTimeWidget::timeValue() const
return ui.timeValue->text().toDouble();
}
//-----------------------------------------------------------------------------
void pqAnimationTimeWidget::setTimePrecision(int val)
{
this->Internals->Precision = val;
}
//-----------------------------------------------------------------------------
int pqAnimationTimeWidget::timePrecision() const
{
return this->Internals->Precision;
}
//-----------------------------------------------------------------------------
void pqAnimationTimeWidget::setTimeStepCount(int value)
{
......
......@@ -73,6 +73,10 @@ public:
void setTimeValue(double time);
double timeValue() const;
/// Get/set the precision with which time is reported.
void setTimePrecision(int val);
int timePrecision() const;
/// Get/set the number of timesteps.
void setTimeStepCount(int count);
int timeStepCount() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment