Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • LidarView/lidarview-core
  • nick.laurenson/lidarview-core
  • aerezarang/lidarview-core
3 results
Show changes
Commits on Source (8)
  • Nick Laurenson's avatar
    8aac87bd
  • MelanieCarriere's avatar
    [fix] Allow applying a property to a proxy of the same group in LoadLidarState · a11a9010
    MelanieCarriere authored
    During loadLidarState function, the property was applied only if a proxy of the same name of the one saved was found in the pipeline.
    For exemple :
    If you save the LidarState with a LidarPacketInterpreter i1 and you open a file using a LidarPacketInterpreter i2
    The properties saved from i1 couldn't be applied to i2.
    This commit allows applying the property to a proxy of the same group.
    
    If the property is not found in this proxy, the message is still display to the user.
    a11a9010
  • MelanieCarriere's avatar
    Merge branch 'allowApplyPropertyToTheProxyGroup' into 'master' · 6eed5610
    MelanieCarriere authored
    [fix] Allow applying a property to a proxy of the same group in LoadLidarState
    
    See merge request !149
    6eed5610
  • Nicolas Cadart's avatar
    [fix][ui][change] Change animation PlayMode/Duration when speedFactor/timeRange are changed · 761cbf4d
    Nicolas Cadart authored
    Animation PlayMode and Duration were reset each time Play/Pause buttons were clicked.
    This prevented using general paraview animations by manually chosing animation settings.
    
    Now, the animation PlayMode and Duration is directly updated when the user selects a different playing speed,
    and Play/Pause buttons have trivial behavior of invoking Play/Pause commands.
    The animation Duration is also updated when timesteps range changes, e.g. when a new pcap is loaded.
    
    NOTE : When upgrading LVCore in your specific LidarView based application,
    you should consider removing the line `app.scene.UpdateAnimationUsingDataTimeSteps()`
    in function `applogic.openPCAP()`. Without this change, the speed mode will be set to 'All Frames'
    when a new pcap will be loaded. By removing this line, the speed mode and animation settings
    won't be changed, and will be kept as user set them before.
    761cbf4d
  • Nicolas Cadart's avatar
    [fix][ui] Set speed factor combo box according to animation play mode · 46e2e999
    Nicolas Cadart authored
    Changing speed factor using combo box may lead to animation play mode change.
    However, if user changes manually the animation play mode, it may be contradictory with the information displayed by the combo box.
    
    lqPlayerControlsToolbar now listens to animation play mode changes, and adapt the combo box display accordingly.
    
    Furthermore, when a new animations scene is set, lqPlayerControlsToolbar set its PlayMode accordingly with UI speed combo box.
    46e2e999
  • Nicolas Cadart's avatar
    [fix][ui] Avoid speed factor change when going previous/next frame · 8551e89f
    Nicolas Cadart authored
    Going previous/next frame changes animation mode to 'Snap To Timesteps'.
    This will set the speed factor text to 'All frames'.
    Currently, user has to set back themselves the desired speed factor using the combo box.
    
    This commit restores previous animation play mode after having snaped to previous/next frame,
    so that user does not have to set it themselves again using the speed factor combo box.
    
    Also, if we are in 'Real Time' play mode with for example a speed factor 'x5',
    and if we click Next frame, the speed factor will blink to 'All frames' before going back to 'x5'.
    As this blink is noisy, we block all animations signals to keep it unchanged during operation.
    8551e89f
  • Nicolas Cadart's avatar
    Merge branch 'fix/AnimationPlayMode' into 'master' · 6c821a81
    Nicolas Cadart authored
    Using custom animation play mode in LidarView
    
    See merge request !148
    6c821a81
  • Nick Laurenson's avatar
    Merge branch 'Doc/AddAContributionGuide' into 'master' · a8eecdb6
    Nick Laurenson authored
    [doc] Add contribution.md and .gitmessage template
    
    Closes #29
    
    See merge request !132
    a8eecdb6
......@@ -91,6 +91,14 @@ void lqLoadLidarStateReaction::onTriggered()
std::string propertyName = currentProp.propertyName;
vtkSMProxy* lidarProxy = SearchProxyByName(lidarCurrentProxy, proxyName);
// If the proxy is not found, search proxy from the same proxygroup
// ex : Apply a property from an other LidarPacketInterpreter to the current one
if (lidarProxy == nullptr)
{
std::string proxyGroupName = GetGroupName(lidarCurrentProxy, proxyName);
lidarProxy = SearchProxyByGroupName(lidarCurrentProxy, proxyGroupName);
}
if (lidarProxy == nullptr)
{
std::string message = "No matching proxy found. Property " + propertyName + " of the proxy " + proxyName + " not applied";
......
......@@ -6,9 +6,13 @@
#include "vtkLidarReader.h"
#include "vtkLidarStream.h"
#include <vtkSMSessionProxyManager.h>
#include <vtkSMBooleanDomain.h>
#include <vtkSMPropertyIterator.h>
#include <vtkSMPropertyHelper.h>
#include <vtkSMProxyDefinitionManager.h>
#include <vtkSMSessionProxyManager.h>
#include <vtkPVProxyDefinitionIterator.h>
#include <pqApplicationCore.h>
#include <pqPipelineSource.h>
......@@ -206,3 +210,34 @@ void UpdateProperty(vtkSMProxy * proxy, const std::string &propNameToFind,
}
}
}
//-----------------------------------------------------------------------------
std::string GetGroupName(vtkSMProxy * existingProxy, const std::string & proxyToFindName)
{
vtkSMSessionProxyManager* pxm = existingProxy->GetSessionProxyManager();
if(!pxm)
{
std::cout << "Couldn't get the SM Session Proxy Manager" << std::endl;
return "";
}
vtkSMProxyDefinitionManager* pxdm = pxm->GetProxyDefinitionManager();
if(!pxdm)
{
std::cout << "Couldn't get the SM Proxy Definition Manager" << std::endl;
return "";
}
vtkPVProxyDefinitionIterator* iter = pxdm->NewIterator();
for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem())
{
if(strcmp(iter->GetProxyName(), proxyToFindName.c_str()) == 0)
{
return iter->GetGroupName();
}
}
return "";
}
......@@ -60,4 +60,12 @@ vtkSMProperty* GetPropertyFromProxy(vtkSMProxy * proxy, const std::string &propN
void UpdateProperty(vtkSMProxy * proxy, const std::string & propNameToFind,
const std::vector<std::string> & values);
/**
* @brief GetGroupName Get the name of the first group where appear a proxy
* @param existingProxy a proxy of the pipeline, use to get the ProxyDefinitionManager
* @param proxyToFindName name of the proxy to look for
* @return the name of the first group where a corresponding proxy is found
*/
std::string GetGroupName(vtkSMProxy * existingProxy, const std::string & proxyToFindName);
#endif // LQHELPER_H
......@@ -61,6 +61,11 @@ void SetProperty(QPointer<pqAnimationScene> scene, const char* property, int val
(scene->getProxy()->GetProperty(property))->SetElements1(value);
scene->getProxy()->UpdateProperty(property);
}
int GetProperty(QPointer<pqAnimationScene> scene, const char* property)
{
return pqSMAdaptor::getElementProperty(scene->getProxy()->GetProperty(property)).toInt();
}
}
//-----------------------------------------------------------------------------
......@@ -120,11 +125,15 @@ void lqPlayerControlsController::setAnimationScene(pqAnimationScene* scene)
void lqPlayerControlsController::onTimeRangesChanged()
{
if (this->Scene)
{
{
QPair<double, double> range = this->Scene->getClockTimeRange();
emit this->timeRanges(range.first, range.second);
this->duration = range.second - range.first;
if (speed != 0)
{
SetProperty(this->Scene, "Duration", this->duration / this->speed);
}
}
}
//-----------------------------------------------------------------------------
......@@ -149,17 +158,6 @@ void lqPlayerControlsController::onPlay()
.arg(this->Scene->getProxy())
.arg("Play");
if (speed != 0)
{
SetProperty(this->Scene, "Duration", this->duration / this->speed);
SetProperty(this->Scene, "PlayMode", vtkAnimationScene::PLAYMODE_REALTIME);
}
else
{
// there is no enum for mode 2...
SetProperty(this->Scene, "PlayMode", 2);
}
this->Scene->getProxy()->InvokeCommand("Play");
// NOTE: This is a blocking call, returns only after the
......@@ -232,7 +230,6 @@ void lqPlayerControlsController::onPause()
return;
}
this->Scene->getProxy()->InvokeCommand("Stop");
SetProperty(this->Scene, "PlayMode", 2);
}
}
......@@ -250,6 +247,11 @@ void lqPlayerControlsController::onFirstFrame()
//-----------------------------------------------------------------------------
void lqPlayerControlsController::onPreviousFrame()
{
// Get current animation PlayMode, and disable its signals so that toolbar
// will not be updated to avoid blinking
int playMode = GetProperty(this->Scene, "PlayMode");
bool signalsWereBlocked = this->Scene->blockSignals(true);
emit this->beginNonUndoableChanges();
SetProperty(this->Scene, "PlayMode", 2);
this->Scene->getProxy()->InvokeCommand("GoToPrevious");
......@@ -257,11 +259,20 @@ void lqPlayerControlsController::onPreviousFrame()
.arg(this->Scene->getProxy())
.arg("GoToPrevious");
emit this->endNonUndoableChanges();
// Restore animation PlayMode and signals
SetProperty(this->Scene, "PlayMode", playMode);
this->Scene->blockSignals(signalsWereBlocked);
}
//-----------------------------------------------------------------------------
void lqPlayerControlsController::onNextFrame()
{
// Get current animation PlayMode, and disable its signals so that toolbar
// will not be updated to avoid blinking
int playMode = GetProperty(this->Scene, "PlayMode");
bool signalsWereBlocked = this->Scene->blockSignals(true);
emit this->beginNonUndoableChanges();
SetProperty(this->Scene, "PlayMode", 2);
this->Scene->getProxy()->InvokeCommand("GoToNext");
......@@ -269,6 +280,10 @@ void lqPlayerControlsController::onNextFrame()
.arg(this->Scene->getProxy())
.arg("GoToNext");
emit this->endNonUndoableChanges();
// Restore animation PlayMode and signals
SetProperty(this->Scene, "PlayMode", playMode);
this->Scene->blockSignals(signalsWereBlocked);
}
//-----------------------------------------------------------------------------
......@@ -286,6 +301,21 @@ void lqPlayerControlsController::onLastFrame()
void lqPlayerControlsController::onSpeedChange(double speed)
{
this->speed = speed;
// Update animation mode depending on speed
// If speed is valid, set animation PlayMode to REALTIME
if (speed != 0)
{
SetProperty(this->Scene, "Duration", this->duration / this->speed);
SetProperty(this->Scene, "PlayMode", vtkAnimationScene::PLAYMODE_REALTIME);
}
// If speed is null, set animation PlayMode to SNAP TO TIMESTEPS to play all frames
else
{
// There is no enum for mode 2 'Snap To Timesteps'...
SetProperty(this->Scene, "PlayMode", 2);
}
this->onPause();
}
......
......@@ -52,6 +52,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "lqPlayerControlsController.h"
#include "pqAnimationScene.h"
#include "vtkAnimationScene.h"
#include <vtkSMProxy.h>
#include <vtkSMProperty.h>
#include <vtkSMPropertyHelper.h>
......@@ -135,7 +136,7 @@ lqPlayerControlsToolbar::lqPlayerControlsToolbar(QWidget* parentObject)
// we need to keep an order to display so we can't use hash table or set
// however the developper is reponsable for for the uniqueness of each element
this->UI->speedFactor.append(qMakePair(0., QString("All frames")));
this->UI->speedFactor.append(qMakePair(0.1, QString("x 0.1")));
this->UI->speedFactor.append(qMakePair(0.1, QString("x 0.1")));
this->UI->speedFactor.append(qMakePair(0.25, QString("x 0.25")));
this->UI->speedFactor.append(qMakePair(0.5, QString("x 0.5")));
this->UI->speedFactor.append(qMakePair(1., QString("x 1"))) ;
......@@ -144,7 +145,7 @@ lqPlayerControlsToolbar::lqPlayerControlsToolbar(QWidget* parentObject)
this->UI->speedFactor.append(qMakePair(5., QString("x 5")));
this->UI->speedFactor.append(qMakePair(10., QString("x 10")));
this->UI->speedFactor.append(qMakePair(20., QString("x 20")));
this->UI->speedFactor.append(qMakePair(100., QString("x100")));
this->UI->speedFactor.append(qMakePair(100., QString("x 100")));
// add the widget to the toolbar
this->addWidget(new QLabel("Speed:", this));
......@@ -290,18 +291,56 @@ void lqPlayerControlsToolbar::onSpeedChanged()
}
}
//-----------------------------------------------------------------------------
void lqPlayerControlsToolbar::onPlayModeChanged()
{
// Get new animation play mode and current combo box index
int playMode = vtkSMPropertyHelper(this->Controller->getAnimationScene()->getProxy(), "PlayMode").GetAsInt();
int idx = this->UI->speedComboBox->currentIndex();
// If we are in 'Snap To Timesteps' mode (no enum defined yet),
// set combo box to 'All frames'
if (playMode == 2)
{
this->UI->speedComboBox->setCurrentIndex(0);
}
// If we are in 'Sequence' mode, disable combo box display
else if (playMode == vtkAnimationScene::PLAYMODE_SEQUENCE)
{
this->UI->speedComboBox->setCurrentIndex(-1);
}
// If we are now in 'Real Time' mode and were displaying neither 'All frames'
// nor a real time 'xS' speed, set combo box to 'x1'
else if (playMode == vtkAnimationScene::PLAYMODE_REALTIME && (idx == -1 || idx == 0))
{
// Find and set x1 item
for (int i = 0; i < this->UI->speedFactor.size(); ++i)
{
if (this->UI->speedFactor[i].first == 1.)
this->UI->speedComboBox->setCurrentIndex(i);
}
}
}
//-----------------------------------------------------------------------------
void lqPlayerControlsToolbar::setAnimationScene(pqAnimationScene* scene)
{
this->UI->Links.clear();
this->Controller->setAnimationScene(scene);
QObject::connect(scene, SIGNAL(playModeChanged()), this, SLOT(onPlayModeChanged()));
this->UI->Links.addPropertyLink<lqPlayerControlsToolbarLinks>(
this, "timeStepCount", SIGNAL(dummySignal()),
this->timeKeeper(), this->timeKeeper()->GetProperty("TimestepValues"));
this->UI->Links.addPropertyLink(
this, "timeValue", SIGNAL(timeValueChanged()),
scene->getProxy(), scene->getProxy()->GetProperty("AnimationTime"));
// Update animation mode according to current UI state
this->onSpeedChanged();
}
//-----------------------------------------------------------------------------
......
......@@ -63,6 +63,7 @@ public slots:
protected slots:
void onPlaying(bool);
void onSpeedChanged();
void onPlayModeChanged();
void setAnimationScene(pqAnimationScene*);
void PressSlider();
void ReleaseSlider();
......
# Contribution to LidarView and Co.
## Commit convention
Developers are encouraged to use the provided [gitmessage template](Documentation/.gitmessage) in their [git configuration](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_commit_template), so every commit message follows the same convention.
```bash
$ git config --global commit.template <LVCore_path>/Documentation/.gitmessage
```
Adopting a commit convention, has multiple advantages:
* enforce coherence
* force to have atomic commits
* enable to parse automatically commit messages
* quickly see if a submodule upgrade could be done easily (no api break, no default value change, ...)
* and many more ...
\ No newline at end of file
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
# Example: fix #23
# --- COMMIT END ---
# Remember to:
# * Capitalize the subject line
# * Use the imperative mood in the subject line
# * Do not end the subject line with a period
# * Separate subject from body with a blank line
# * Use the body to explain what and why vs. how
# * Can use multiple lines with "-" or "*" for bullet points in body
# --------------------
# Tag can be
#
# feat (new feature)
# fix (bug fix)
# ci (change to ci scripts)
# refactor (refactoring code)
# deprec (deprecate or remove deprecated code)
# style (formatting, missing semi colons, etc; no code change)
# doc (changes to documentation)
# test (adding or refactoring tests; no production code change)
# version (version bump/new release; no production code change)
# license (edits regarding licensing; no production code change)
# perf (improve code performance)
# defaults (changes default options)
# submodule (update one or several submodules)
# api (break the public api)
# ui (user interface change)
#
# Please avoid the following, but in case none of the above fit:
#
# hack (temporary fix to make things move forward)
# change (in case none of them work)
# --------------------
# Credit && Resources:
# https://www.conventionalcommits.org/en/v1.0.0/#specification
# https://gitmoji.carloscuesta.me/
# https://gist.github.com/zakkak/7e06725ebd1336bfebebe254de3de825