summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes/TimelineGraphicsView
diff options
context:
space:
mode:
Diffstat (limited to 'src/Authoring/Studio/Palettes/TimelineGraphicsView')
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp3
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp31
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h2
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp40
4 files changed, 45 insertions, 31 deletions
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
index 1f750f15..9e77a2ce 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
@@ -1012,8 +1012,7 @@ void TimelineGraphicsScene::updateHoverStatus(const QPointF &scenePos)
SValue sValue;
if (propertySystem->GetInstancePropertyValue(rowTree->instance(), property,
sValue)) {
- QString propVal = QString::fromWCharArray(get<TDataStrPtr>(sValue)
- ->GetData());
+ QString propVal = qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->toQString();
if (!propVal.isEmpty()) {
// parse propVal into variantsHash (group => tags)
const QStringList tagPairs = propVal.split(QLatin1Char(','));
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
index 7fa54cb6..c0d7a965 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
@@ -544,6 +544,20 @@ void TimelineWidget::onAssetCreated(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
->createRowFromBinding(binding, bindingParent->getRowTree());
row->updateSubpresentations();
insertToHandlesMap(binding);
+
+ // refresh the created object variants if it is a layer with variants property
+ // set.
+ if (m_bridge->IsLayerInstance(inInstance)) {
+ const auto propertySystem = g_StudioApp.GetCore()->GetDoc()
+ ->GetPropertySystem();
+ qt3dsdm::SValue sValue;
+ if (propertySystem->GetInstancePropertyValue(inInstance,
+ m_bridge->GetLayer().m_variants,
+ sValue)) {
+ if (qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->GetLength() != 0)
+ refreshVariants(inInstance);
+ }
+ }
} else {
qWarning() << "Binding parent was not found.";
}
@@ -755,8 +769,7 @@ void TimelineWidget::onPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle inInstance
} else if (inProperty == m_bridge->GetLayer().m_variants) {
qt3dsdm::SValue sValue;
if (doc->GetPropertySystem()->GetInstancePropertyValue(inInstance, inProperty, sValue)) {
- QString propVal = QString::fromWCharArray(qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)
- ->GetData());
+ QString propVal = qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->toQString();
if (!propVal.isEmpty()) {
QStringList tagPairs = propVal.split(QLatin1Char(','));
QStringList groups;
@@ -1247,19 +1260,23 @@ void TimelineWidget::setSelectedTimeBarsColor(const QColor &color, bool preview)
}
}
-void TimelineWidget::refreshVariants()
+void TimelineWidget::refreshVariants(int instance)
{
const auto propertySystem = g_StudioApp.GetCore()->GetDoc()->GetPropertySystem();
- const auto layers = g_StudioApp.GetCore()->GetDoc()->getLayers();
- for (auto layer : layers) {
+ QVector<int> layers;
+ if (instance)
+ layers << instance;
+ else
+ layers = g_StudioApp.GetCore()->GetDoc()->getLayers();
+
+ for (auto layer : qAsConst(layers)) {
if (!m_handlesMap.contains(layer))
continue;
qt3dsdm::SValue sValue;
if (propertySystem->GetInstancePropertyValue(layer, m_bridge->GetLayer().m_variants,
sValue)) {
- QString propVal = QString::fromWCharArray(qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)
- ->GetData());
+ QString propVal = qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->toQString();
if (!propVal.isEmpty()) {
QStringList tagPairs = propVal.split(QLatin1Char(','));
QStringList groups;
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h
index ac01367a..d4a76ba1 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h
@@ -73,7 +73,7 @@ public:
void openBarColorDialog();
void onTimeBarColorChanged(const QColor &color);
void setSelectedTimeBarsColor(const QColor &color, bool preview);
- void refreshVariants();
+ void refreshVariants(int instance = 0);
void enableDnD(bool b = true);
bool dndActive() const;
bool blockMousePress() const;
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
index 39405ac4..bf4820ea 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
@@ -53,15 +53,28 @@
// object row constructor
RowTree::RowTree(TimelineGraphicsScene *timelineScene, EStudioObjectType rowType,
const QString &label)
+ : m_rowTimeline(new RowTimeline())
+ , m_scene(timelineScene)
+ , m_rowType(rowType)
+ , m_label(label)
+{
+ CDoc *doc = g_StudioApp.GetCore()->GetDoc();
+ m_onMasterSlide = doc->GetStudioSystem()->GetSlideSystem()
+ ->IsMasterSlide(doc->GetActiveSlide());
+
+ initialize();
+}
+
+// property row constructor
+RowTree::RowTree(TimelineGraphicsScene *timelineScene, const QString &propType)
: InteractiveTimelineItem()
, m_rowTimeline(new RowTimeline())
+ , m_isProperty(true)
+ , m_scene(timelineScene)
+ , m_propertyType(propType)
+ , m_label(propType)
{
- m_scene = timelineScene;
- m_rowType = rowType;
- m_label = label;
- CDoc *doc = g_StudioApp.GetCore()->GetDoc();
- m_onMasterSlide = doc->GetStudioSystem()->GetSlideSystem()->IsMasterSlide(
- doc->GetActiveSlide());
+ m_rowTimeline->m_isProperty = true;
initialize();
}
@@ -83,21 +96,6 @@ int RowTree::instance() const
return static_cast<Qt3DSDMTimelineItemBinding *>(m_binding)->GetInstance();
}
-// property row constructor
-RowTree::RowTree(TimelineGraphicsScene *timelineScene, const QString &propType)
- : InteractiveTimelineItem()
- , m_rowTimeline(new RowTimeline())
-{
- m_scene = timelineScene;
- m_label = propType;
- m_propertyType = propType;
-
- m_isProperty = true;
- m_rowTimeline->m_isProperty = true;
-
- initialize();
-}
-
void RowTree::initialize()
{
setTimelineRow(m_rowTimeline);