summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp17
-rw-r--r--src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h232
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Doc.cpp39
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Doc.h3
-rw-r--r--src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp18
-rw-r--r--src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp5
-rw-r--r--src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.h5
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h1
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp2
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaDataTypes.h20
-rw-r--r--src/Authoring/Studio/Application/ProjectFile.cpp341
-rw-r--r--src/Authoring/Studio/Application/ProjectFile.h13
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp2
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp24
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/VariantsGroupModel.cpp10
-rw-r--r--src/Authoring/Studio/Palettes/Slide/SlideModel.cpp9
-rw-r--r--src/Authoring/Studio/Palettes/Slide/SlideView.cpp9
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp2
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp28
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp4
-rw-r--r--src/Runtime/res/DataModelMetadata/en-us/MetaData.xml29
21 files changed, 349 insertions, 464 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp
index 1fc0c411..e839b1db 100644
--- a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp
@@ -311,6 +311,19 @@ qt3dsdm::Qt3DSDMPropertyHandle CClientDataModelBridge::getSubpresentationPropert
return m_SceneImage.m_SubPresentation;
}
+qt3dsdm::Qt3DSDMPropertyHandle CClientDataModelBridge::getVariantsProperty(int instance) const
+{
+ EStudioObjectType instanceType = GetObjectType(instance);
+
+ if (instanceType == OBJTYPE_LAYER)
+ return m_Layer.m_variants;
+
+ if (instanceType == OBJTYPE_MODEL)
+ return m_Model.m_variants;
+
+ return 0;
+}
+
bool CClientDataModelBridge::IsInternalProperty(const TCharStr &inPropertyName) const
{
return (inPropertyName == L"name" || inPropertyName == L"importid" || inPropertyName == L"type"
@@ -378,7 +391,7 @@ CClientDataModelBridge::GetOwningComponentInstance(qt3dsdm::Qt3DSDMSlideHandle i
}
// Find the component Guid of the Slide Handle
-SLong4 CClientDataModelBridge::GetComponentGuid(qt3dsdm::Qt3DSDMSlideHandle inSlideHandle)
+SLong4 CClientDataModelBridge::GetComponentGuid(qt3dsdm::Qt3DSDMSlideHandle inSlideHandle) const
{
qt3dsdm::SLong4 theComponentGuid;
@@ -497,7 +510,7 @@ Q3DStudio::CString CClientDataModelBridge::GetName(
return (theString) ? Q3DStudio::CString(theString->GetData()) : "";
}
-bool CClientDataModelBridge::IsActiveComponent(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
+bool CClientDataModelBridge::IsActiveComponent(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const
{
using namespace qt3dsdm;
using namespace Q3DStudio;
diff --git a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h
index 060fc8a2..c87d7604 100644
--- a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h
+++ b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h
@@ -26,7 +26,6 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#pragma once
#ifndef CLIENTDATAMODELBRIDGEH
#define CLIENTDATAMODELBRIDGEH
@@ -116,13 +115,13 @@ class CClientDataModelBridge
{
Q_DISABLE_COPY(CClientDataModelBridge)
- qt3dsdm::IDataCore *m_DataCore;
- qt3dsdm::ISlideCore *m_SlideCore;
- qt3dsdm::ISlideGraphCore *m_SlideGraphCore;
- qt3dsdm::IAnimationCore *m_AnimationCore;
- std::shared_ptr<qt3dsdm::IMetaData> m_NewMetaData;
- std::shared_ptr<qt3dsdm::SComposerObjectDefinitions> m_ObjectDefinitions;
- CDoc *m_Doc;
+ qt3dsdm::IDataCore *m_DataCore = nullptr;
+ qt3dsdm::ISlideCore *m_SlideCore = nullptr;
+ qt3dsdm::ISlideGraphCore *m_SlideGraphCore = nullptr;
+ qt3dsdm::IAnimationCore *m_AnimationCore = nullptr;
+ std::shared_ptr<qt3dsdm::IMetaData> m_NewMetaData = nullptr;
+ std::shared_ptr<qt3dsdm::SComposerObjectDefinitions> m_ObjectDefinitions = nullptr;
+ CDoc *m_Doc = nullptr;
SDataModelDefaultMaterial &m_DefaultMaterial;
SDataModelSceneImage &m_SceneImage;
@@ -148,7 +147,7 @@ class CClientDataModelBridge
SDataModelLightmaps &m_Lightmaps;
// cache to increase performance
- bool m_CacheEnabled;
+ bool m_CacheEnabled = false;
typedef std::unordered_map<qt3dsdm::SLong4, qt3dsdm::Qt3DSDMInstanceHandle, SLong4Hasher>
TGUIDInstanceHash;
@@ -171,50 +170,53 @@ public:
std::shared_ptr<qt3dsdm::IMetaData> inNewMetaData,
std::shared_ptr<qt3dsdm::SComposerObjectDefinitions> inDefinitions,
CDoc *inDoc);
- virtual ~CClientDataModelBridge();
-
- virtual qt3dsdm::Qt3DSDMInstanceHandle CreateAssetInstance(Q3DStudio::CId &inId,
- EStudioObjectType inObjectType);
- virtual qt3dsdm::Qt3DSDMSlideGraphHandle GetOrCreateGraph(qt3dsdm::Qt3DSDMInstanceHandle inInstance);
- virtual qt3dsdm::Qt3DSDMSlideHandle GetOrCreateGraphRoot(qt3dsdm::Qt3DSDMInstanceHandle inInstance);
- virtual qt3dsdm::Qt3DSDMInstanceHandle GetSlideInstance();
- virtual qt3dsdm::Qt3DSDMPropertyHandle GetSlideComponentIdProperty();
- virtual qt3dsdm::Qt3DSDMPropertyHandle GetNameProperty() const;
- virtual qt3dsdm::Qt3DSDMPropertyHandle GetIdProperty();
- virtual qt3dsdm::Qt3DSDMPropertyHandle GetTypeProperty() const;
- virtual qt3dsdm::Qt3DSDMPropertyHandle GetSourcePathProperty() const;
- virtual qt3dsdm::Qt3DSDMPropertyHandle getSubpresentationProperty() const;
- virtual qt3dsdm::Qt3DSDMInstanceHandle GetActionInstance();
- virtual qt3dsdm::Qt3DSDMPropertyHandle GetActionEyeball();
- virtual qt3dsdm::Qt3DSDMPropertyHandle GetImportId();
-
- virtual qt3dsdm::SComposerObjectDefinitions &GetObjectDefinitions()
+ ~CClientDataModelBridge();
+
+ qt3dsdm::Qt3DSDMInstanceHandle CreateAssetInstance(Q3DStudio::CId &inId,
+ EStudioObjectType inObjectType);
+ qt3dsdm::Qt3DSDMSlideGraphHandle GetOrCreateGraph(qt3dsdm::Qt3DSDMInstanceHandle inInstance);
+ qt3dsdm::Qt3DSDMSlideHandle GetOrCreateGraphRoot(qt3dsdm::Qt3DSDMInstanceHandle inInstance);
+ qt3dsdm::Qt3DSDMInstanceHandle GetSlideInstance();
+ qt3dsdm::Qt3DSDMPropertyHandle GetSlideComponentIdProperty();
+ qt3dsdm::Qt3DSDMPropertyHandle GetNameProperty() const;
+ qt3dsdm::Qt3DSDMPropertyHandle GetIdProperty();
+ qt3dsdm::Qt3DSDMPropertyHandle GetTypeProperty() const;
+ qt3dsdm::Qt3DSDMPropertyHandle GetSourcePathProperty() const;
+ qt3dsdm::Qt3DSDMPropertyHandle getSubpresentationProperty() const;
+ qt3dsdm::Qt3DSDMPropertyHandle getVariantsProperty(int instance) const;
+ qt3dsdm::Qt3DSDMInstanceHandle GetActionInstance();
+ qt3dsdm::Qt3DSDMPropertyHandle GetActionEyeball();
+ qt3dsdm::Qt3DSDMPropertyHandle GetImportId();
+
+ qt3dsdm::SComposerObjectDefinitions &GetObjectDefinitions()
{
return *m_ObjectDefinitions;
}
- virtual const qt3dsdm::SComposerObjectDefinitions &GetObjectDefinitions() const
+
+ const qt3dsdm::SComposerObjectDefinitions &GetObjectDefinitions() const
{
return *m_ObjectDefinitions;
}
- virtual bool IsInternalProperty(const qt3dsdm::TCharStr &inPropertyName) const;
+ bool IsInternalProperty(const qt3dsdm::TCharStr &inPropertyName) const;
- virtual qt3dsdm::Qt3DSDMInstanceHandle
- GetOwningComponentInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstanceHandle);
- virtual qt3dsdm::Qt3DSDMInstanceHandle
- GetOwningComponentInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstanceHandle, int &outSlideIndex);
- virtual qt3dsdm::Qt3DSDMInstanceHandle
- GetOwningComponentInstance(qt3dsdm::Qt3DSDMSlideHandle inSlideHandle, int &outSlideIndex);
- virtual qt3dsdm::Qt3DSDMInstanceHandle
- GetOwningComponentInstance(qt3dsdm::Qt3DSDMSlideHandle inSlideHandle);
- virtual qt3dsdm::SLong4 GetComponentGuid(qt3dsdm::Qt3DSDMSlideHandle inSlideHandle);
+ qt3dsdm::Qt3DSDMInstanceHandle GetOwningComponentInstance(
+ qt3dsdm::Qt3DSDMInstanceHandle inInstanceHandle);
+ qt3dsdm::Qt3DSDMInstanceHandle GetOwningComponentInstance(
+ qt3dsdm::Qt3DSDMInstanceHandle inInstanceHandle,
+ int &outSlideIndex);
+ qt3dsdm::Qt3DSDMInstanceHandle GetOwningComponentInstance(
+ qt3dsdm::Qt3DSDMSlideHandle inSlideHandle,
+ int &outSlideIndex);
+ qt3dsdm::Qt3DSDMInstanceHandle GetOwningComponentInstance(
+ qt3dsdm::Qt3DSDMSlideHandle inSlideHandle);
+ qt3dsdm::SLong4 GetComponentGuid(qt3dsdm::Qt3DSDMSlideHandle inSlideHandle) const;
- virtual bool IsActive(qt3dsdm::Qt3DSDMInstanceHandle inInstanceHandle, long inCurrentTime);
+ bool IsActive(qt3dsdm::Qt3DSDMInstanceHandle inInstanceHandle, long inCurrentTime);
- virtual qt3dsdm::Qt3DSDMSlideHandle
- GetComponentActiveSlide(qt3dsdm::Qt3DSDMInstanceHandle inComponent);
- virtual qt3dsdm::Qt3DSDMSlideHandle GetComponentSlide(qt3dsdm::Qt3DSDMInstanceHandle inComponent,
- long inIndex);
+ qt3dsdm::Qt3DSDMSlideHandle GetComponentActiveSlide(qt3dsdm::Qt3DSDMInstanceHandle inComponent);
+ qt3dsdm::Qt3DSDMSlideHandle GetComponentSlide(qt3dsdm::Qt3DSDMInstanceHandle inComponent,
+ long inIndex);
const SDataModelDefaultMaterial &GetDefaultMaterial() const { return m_DefaultMaterial; }
const SDataModelSceneImage &GetSceneImage() const { return m_SceneImage; }
@@ -236,18 +238,18 @@ public:
const SDataModelLightmaps &GetLightmaps() const { return m_Lightmaps; }
// Is this the instance that owns the document's currently active slide?
- bool IsActiveComponent(qt3dsdm::Qt3DSDMInstanceHandle inInstance);
-
-public: // Operations which likely don't belong on this class
- virtual bool GetMaterialFromImageInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
- qt3dsdm::Qt3DSDMInstanceHandle &outMaterialInstance,
- qt3dsdm::Qt3DSDMPropertyHandle &outProperty) const;
- virtual bool GetLayerFromImageProbeInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
- qt3dsdm::Qt3DSDMInstanceHandle &outLayerInstance,
- qt3dsdm::Qt3DSDMPropertyHandle &outProperty) const;
-
-public: // Bridging to Actions. These needs to be here as DataModel has no hierarchy info and we need to
- // resolve the path to idenitfy the object referenced
+ bool IsActiveComponent(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
+
+ // Operations which likely don't belong on this class
+ bool GetMaterialFromImageInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
+ qt3dsdm::Qt3DSDMInstanceHandle &outMaterialInstance,
+ qt3dsdm::Qt3DSDMPropertyHandle &outProperty) const;
+ bool GetLayerFromImageProbeInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
+ qt3dsdm::Qt3DSDMInstanceHandle &outLayerInstance,
+ qt3dsdm::Qt3DSDMPropertyHandle &outProperty) const;
+
+ // Bridging to Actions. These needs to be here as DataModel has no hierarchy info and we need to
+ // resolve the path to idenitfy the object referenced
// We should really reconsider to have the hierachcy store outside of DataModel.
void GetReferencedActions(qt3dsdm::Qt3DSDMInstanceHandle inReferencedInstance,
long inReferencedMode, qt3dsdm::TActionHandleList &outActions);
@@ -263,11 +265,11 @@ public: // Bridging to Actions. These needs to be here as DataModel has no hiera
// Resolve the path
void ResetHandlerArguments(qt3dsdm::Qt3DSDMActionHandle inAction, const std::wstring &inHandler);
qt3dsdm::Qt3DSDMEventHandle ResolveEvent(qt3dsdm::Qt3DSDMInstanceHandle inResolveRoot,
- const qt3dsdm::SObjectRefType &inResolution,
- const std::wstring &inEventName);
+ const qt3dsdm::SObjectRefType &inResolution,
+ const std::wstring &inEventName);
qt3dsdm::Qt3DSDMHandlerHandle ResolveHandler(qt3dsdm::Qt3DSDMInstanceHandle inResolveRoot,
- const qt3dsdm::SObjectRefType &inResolution,
- const std::wstring &inHandlerName);
+ const qt3dsdm::SObjectRefType &inResolution,
+ const std::wstring &inHandlerName);
qt3dsdm::Qt3DSDMEventHandle ResolveEvent(const qt3dsdm::SActionInfo &inInfo);
qt3dsdm::Qt3DSDMHandlerHandle ResolveHandler(const qt3dsdm::SActionInfo &inInfo);
void SetHandlerArgumentValue(qt3dsdm::Qt3DSDMHandlerArgHandle inHandlerArgument,
@@ -278,44 +280,20 @@ public: // Bridging to Actions. These needs to be here as DataModel has no hiera
void GetSlideNamesOfAction(qt3dsdm::Qt3DSDMActionHandle inAction,
std::list<Q3DStudio::CString> &outSlideNames);
-protected:
- void SetArgTypeDependentDefaultValue(qt3dsdm::Qt3DSDMHandlerArgHandle inHandlerArgument,
- qt3dsdm::DataModelDataType::Value inDataType,
- qt3dsdm::Qt3DSDMInstanceHandle inInstance,
- qt3dsdm::Qt3DSDMPropertyHandle inProperty);
-
-public: // TODO: We should really consider having CStudioCoreSystem or CStudioFullSystem manages the
- // MetaData, so that we can query directly from within
+ // TODO: We should really consider having CStudioCoreSystem or CStudioFullSystem manages the
+ // MetaData, so that we can query directly from within
void GetEvents(qt3dsdm::Qt3DSDMInstanceHandle inInstance, qt3dsdm::TEventHandleList &outEvents);
qt3dsdm::SEventInfo GetEventInfo(qt3dsdm::Qt3DSDMEventHandle inEvent);
- void GetHandlers(qt3dsdm::Qt3DSDMInstanceHandle inInstance, qt3dsdm::THandlerHandleList &outHandles);
+ void GetHandlers(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
+ qt3dsdm::THandlerHandleList &outHandles);
qt3dsdm::SHandlerInfo GetHandlerInfo(qt3dsdm::Qt3DSDMHandlerHandle inHandler);
- qt3dsdm::Qt3DSDMPropertyHandle
- GetAggregateInstancePropertyByName(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
- const qt3dsdm::TCharStr &inStr);
+ qt3dsdm::Qt3DSDMPropertyHandle GetAggregateInstancePropertyByName(
+ qt3dsdm::Qt3DSDMInstanceHandle inInstance,
+ const qt3dsdm::TCharStr &inStr);
-private:
- qt3dsdm::Qt3DSDMInstanceHandle
- GetInstanceByGUIDDerivedFrom(qt3dsdm::SLong4 inLong4, qt3dsdm::Qt3DSDMInstanceHandle inParentHandle,
- qt3dsdm::Qt3DSDMPropertyHandle inProperty);
- qt3dsdm::Qt3DSDMInstanceHandle
- GetInstanceByGUIDDerivedFrom(qt3dsdm::SLong4 inLong4, const qt3dsdm::TInstanceHandleList &instances,
- qt3dsdm::Qt3DSDMPropertyHandle inProperty);
- qt3dsdm::Qt3DSDMInstanceHandle MaybeCacheGetInstanceByGUIDDerivedFrom(
- qt3dsdm::SLong4 inLong4, qt3dsdm::TInstanceHandleList &ioCacheInstances,
- qt3dsdm::Qt3DSDMInstanceHandle inParentHandle, qt3dsdm::Qt3DSDMPropertyHandle inProperty);
- static bool DerivedGuidMatches(qt3dsdm::IDataCore &inDataCore,
- qt3dsdm::Qt3DSDMInstanceHandle inInstance,
- qt3dsdm::Qt3DSDMPropertyHandle inProperty, qt3dsdm::SLong4 inGuid);
- void ClearCache();
- qt3dsdm::Qt3DSDMInstanceHandle GetSceneOrComponentInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstance);
- qt3dsdm::Qt3DSDMSlideHandle CreateNonMasterSlide(qt3dsdm::Qt3DSDMSlideHandle inMasterSlide,
- Q3DStudio::CId inGuid,
- const Q3DStudio::CString &inName);
-
-public: // helpers
+ // helpers
void BeginRender(); // enable cache to increase performance
void EndRender(); // disable cache
qt3dsdm::Qt3DSDMInstanceHandle GetInstanceByGUID(const Q3DStudio::CId &inId);
@@ -334,34 +312,27 @@ public: // helpers
qt3dsdm::Qt3DSDMInstanceHandle GetComponentInstanceByGUID(const Q3DStudio::CId &inId);
qt3dsdm::Qt3DSDMInstanceHandle GetComponentInstanceByGUID(qt3dsdm::SLong4 inLong4);
qt3dsdm::Qt3DSDMInstanceHandle GetInstanceByRelativeRef(
- qt3dsdm::Qt3DSDMInstanceHandle inRoot,
- const qt3dsdm::SObjectRefType &inValue) const;
+ qt3dsdm::Qt3DSDMInstanceHandle inRoot, const qt3dsdm::SObjectRefType &inValue) const;
qt3dsdm::Qt3DSDMInstanceHandle GetInstance(qt3dsdm::Qt3DSDMInstanceHandle inRoot,
- const qt3dsdm::SValue &inValue);
+ const qt3dsdm::SValue &inValue);
qt3dsdm::Qt3DSDMInstanceHandle GetInstance(qt3dsdm::Qt3DSDMInstanceHandle inRoot,
- const qt3dsdm::SObjectRefType &inValue);
+ const qt3dsdm::SObjectRefType &inValue);
qt3dsdm::TInstanceHandleList GetItemBaseInstances() const;
- std::pair<qt3dsdm::Qt3DSDMInstanceHandle, qt3dsdm::SLong4>
- CreateImageInstance(qt3dsdm::Qt3DSDMInstanceHandle inSourceInstance,
+ std::pair<qt3dsdm::Qt3DSDMInstanceHandle, qt3dsdm::SLong4> CreateImageInstance(
+ qt3dsdm::Qt3DSDMInstanceHandle inSourceInstance,
qt3dsdm::Qt3DSDMPropertyHandle inSlot, qt3dsdm::Qt3DSDMSlideHandle inSlide);
void SetName(qt3dsdm::Qt3DSDMInstanceHandle inInstanceHandle, const Q3DStudio::CString &inName);
Q3DStudio::CString GetName(qt3dsdm::Qt3DSDMInstanceHandle inInstanceHandle,
bool renameMaterials = false) const;
- // Convenience functions to get GUID property value from instance handle
-private:
- Q3DStudio::CId GetId(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
- qt3dsdm::Qt3DSDMPropertyHandle inProperty) const;
-
// Helper for old methods in CAsset
-public:
bool IsInActiveComponent(qt3dsdm::Qt3DSDMInstanceHandle inInstance);
bool IsInComponent(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
qt3dsdm::Qt3DSDMInstanceHandle inComponentInstance);
qt3dsdm::Qt3DSDMInstanceHandle GetParentComponent(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
- bool inIsFirstCall = true);
+ bool inIsFirstCall = true);
Q3DStudio::CString GetUniqueChildName(qt3dsdm::Qt3DSDMInstanceHandle inParent,
qt3dsdm::Qt3DSDMInstanceHandle inInstance,
Q3DStudio::CString inDesiredName);
@@ -393,22 +364,11 @@ public:
void GetValueListFromAllSlides(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
qt3dsdm::Qt3DSDMPropertyHandle inProperty,
std::vector<qt3dsdm::SValue> &outValueList,
- IValueFilter *inFilter = NULL) const;
-
-protected:
- qt3dsdm::Qt3DSDMInstanceHandle GetChildByName(qt3dsdm::Qt3DSDMInstanceHandle inParent,
- Q3DStudio::CString inChildName,
- qt3dsdm::Qt3DSDMInstanceHandle skipInstance);
- std::vector<qt3dsdm::SValue>
- GetValueList(qt3dsdm::Qt3DSDMInstanceHandle inParentInstance,
- qt3dsdm::Qt3DSDMPropertyHandle inProperty,
- IValueFilter *inFilter = NULL) const;
-
-public:
+ IValueFilter *inFilter = nullptr) const;
Q3DStudio::CId GetGUID(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
qt3dsdm::Qt3DSDMInstanceHandle GetParentInstance(
- qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
+ qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
// TODO: EStudioObjectType and EASSETTYPE can't co-exist, one must go. Think EStudioObjectType
// should win since things are better classified
@@ -434,6 +394,44 @@ public:
bool IsNodeType(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
// Returns true if this instance would be in the scene graph
bool IsSceneGraphInstance(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const;
+
+protected:
+ void SetArgTypeDependentDefaultValue(qt3dsdm::Qt3DSDMHandlerArgHandle inHandlerArgument,
+ qt3dsdm::DataModelDataType::Value inDataType,
+ qt3dsdm::Qt3DSDMInstanceHandle inInstance,
+ qt3dsdm::Qt3DSDMPropertyHandle inProperty);
+ qt3dsdm::Qt3DSDMInstanceHandle GetChildByName(qt3dsdm::Qt3DSDMInstanceHandle inParent,
+ Q3DStudio::CString inChildName,
+ qt3dsdm::Qt3DSDMInstanceHandle skipInstance);
+ std::vector<qt3dsdm::SValue> GetValueList(qt3dsdm::Qt3DSDMInstanceHandle inParentInstance,
+ qt3dsdm::Qt3DSDMPropertyHandle inProperty,
+ IValueFilter *inFilter = nullptr) const;
+
+private:
+ qt3dsdm::Qt3DSDMInstanceHandle GetInstanceByGUIDDerivedFrom(qt3dsdm::SLong4 inLong4,
+ qt3dsdm::Qt3DSDMInstanceHandle inParentHandle,
+ qt3dsdm::Qt3DSDMPropertyHandle inProperty);
+ qt3dsdm::Qt3DSDMInstanceHandle GetInstanceByGUIDDerivedFrom(qt3dsdm::SLong4 inLong4,
+ const qt3dsdm::TInstanceHandleList &instances,
+ qt3dsdm::Qt3DSDMPropertyHandle inProperty);
+ qt3dsdm::Qt3DSDMInstanceHandle MaybeCacheGetInstanceByGUIDDerivedFrom(
+ qt3dsdm::SLong4 inLong4, qt3dsdm::TInstanceHandleList &ioCacheInstances,
+ qt3dsdm::Qt3DSDMInstanceHandle inParentHandle, qt3dsdm::Qt3DSDMPropertyHandle inProperty);
+ static bool DerivedGuidMatches(qt3dsdm::IDataCore &inDataCore,
+ qt3dsdm::Qt3DSDMInstanceHandle inInstance,
+ qt3dsdm::Qt3DSDMPropertyHandle inProperty,
+ qt3dsdm::SLong4 inGuid);
+ void ClearCache();
+ qt3dsdm::Qt3DSDMInstanceHandle GetSceneOrComponentInstance(
+ qt3dsdm::Qt3DSDMInstanceHandle inInstance);
+ qt3dsdm::Qt3DSDMSlideHandle CreateNonMasterSlide(qt3dsdm::Qt3DSDMSlideHandle inMasterSlide,
+ Q3DStudio::CId inGuid,
+ const Q3DStudio::CString &inName);
+
+
+ // Convenience functions to get GUID property value from instance handle
+ Q3DStudio::CId GetId(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
+ qt3dsdm::Qt3DSDMPropertyHandle inProperty) const;
};
inline qt3dsdm::SLong4 GuidtoSLong4(const Q3DStudio::CId &inId)
diff --git a/src/Authoring/Client/Code/Core/Doc/Doc.cpp b/src/Authoring/Client/Code/Core/Doc/Doc.cpp
index ef6fc42f..d8dabd0b 100644
--- a/src/Authoring/Client/Code/Core/Doc/Doc.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/Doc.cpp
@@ -727,19 +727,27 @@ qt3dsdm::Qt3DSDMInstanceHandle CDoc::GetFirstSelectableLayer()
return theFoundLayer;
}
-QVector<int> CDoc::getLayers()
+// returns all instances that has a 'variants' property
+QVector<int> CDoc::getVariantInstances(int instance)
{
- Q3DStudio::CGraphIterator layerIterator;
- GetAssetChildren(this, m_SceneInstance, layerIterator, OBJTYPE_LAYER);
+ auto bridge = m_StudioSystem->GetClientDataModelBridge();
+ if (!instance)
+ instance = int(m_SceneInstance);
+ Q3DStudio::CGraphIterator it;
+ GetAssetChildren(this, instance, it);
- QVector<int> layerList;
+ QVector<int> list;
- for (; !layerIterator.IsDone(); ++layerIterator) {
- if (m_StudioSystem->IsInstance(layerIterator.GetCurrent()))
- layerList.append(layerIterator.GetCurrent());
+ for (; !it.IsDone(); ++it) {
+ if (m_StudioSystem->IsInstance(it.GetCurrent())) {
+ if (bridge->GetObjectType(it.GetCurrent()) & OBJTYPE_IS_VARIANT)
+ list.append(it.GetCurrent());
+
+ list.append(getVariantInstances(it.GetCurrent()));
+ }
}
- return layerList;
+ return list;
}
qt3dsdm::Qt3DSDMInstanceHandle CDoc::GetActiveRootInstance()
@@ -793,17 +801,6 @@ void CDoc::SetActiveLayer(qt3dsdm::Qt3DSDMInstanceHandle inLayerInstance)
//=============================================================================
/**
- * Informs that a layer has been deleted. If this is the active one, try to promote another.
- */
-
-void CDoc::OnLayerDeleted(qt3dsdm::Qt3DSDMInstanceHandle inLayerInstance)
-{
- if (m_ActiveLayer == inLayerInstance)
- m_ActiveLayer = 0;
-}
-
-//=============================================================================
-/**
* Deselects all the items and keyframes that are currently selected.
*/
void CDoc::DeselectAllItems(bool inSendEvent)
@@ -1225,6 +1222,7 @@ void CDoc::OnSlideDeleted(qt3dsdm::Qt3DSDMSlideHandle inSlide)
SetActiveSlideWithTransaction(theNewSlide);
}
}
+
void CDoc::OnInstanceDeleted(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
{
if (GetSelectedInstance() == inInstance)
@@ -2356,7 +2354,8 @@ void CDoc::SetupDataCoreSignals()
if (theProvider)
m_Connections.push_back(theProvider->ConnectBeforeInstanceDeleted(
- std::bind(&CDoc::OnInstanceDeleted, this, std::placeholders::_1)));
+ std::bind(&CDoc::OnInstanceDeleted, this, std::placeholders::_1)));
+
if (theSlideProvider)
m_Connections.push_back(theSlideProvider->ConnectBeforeSlideDeleted(
std::bind(&CDoc::OnSlideDeleted, this, std::placeholders::_1)));
diff --git a/src/Authoring/Client/Code/Core/Doc/Doc.h b/src/Authoring/Client/Code/Core/Doc/Doc.h
index 60f0c3e6..54e0e3c1 100644
--- a/src/Authoring/Client/Code/Core/Doc/Doc.h
+++ b/src/Authoring/Client/Code/Core/Doc/Doc.h
@@ -324,7 +324,6 @@ public:
qt3dsdm::Qt3DSDMInstanceHandle GetActiveLayer();
void SetActiveLayer(qt3dsdm::Qt3DSDMInstanceHandle inLayerInstance);
qt3dsdm::Qt3DSDMSlideHandle GetActiveSlide();
- void OnLayerDeleted(qt3dsdm::Qt3DSDMInstanceHandle inLayerInstance);
void SetPlayMode(EPlayMode inPlayMode, long inRestoreTime = -1);
bool IsPlaying();
@@ -465,7 +464,7 @@ public:
int getSelectedInstancesCount() const;
std::shared_ptr<Q3DStudio::IInternalDocumentEditor> getSceneEditor() { return m_SceneEditor; }
- QVector<int> getLayers();
+ QVector<int> getVariantInstances(int instance = 0);
void queueMaterialRename(const QString &oldName, const QString &newName);
diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
index 4404ac71..d224c975 100644
--- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
@@ -4566,24 +4566,6 @@ public:
}
}
- void SetUniqueName(TInstanceHandle inItem, const char8_t *inNameBase,
- eastl::vector<Q3DStudio::CString> &inExistingNames)
- {
- Q3DStudio::CString theName(inNameBase);
- QT3DSU32 idx = 1;
- while (eastl::find(inExistingNames.begin(), inExistingNames.end(), theName)
- != inExistingNames.end()) {
- char8_t nameBuffer[64];
- sprintf(nameBuffer, "%d", idx);
- ++idx;
- theName.assign(inNameBase);
- theName.append("_");
- theName.append(nameBuffer);
- }
- SetName(inItem, theName, false);
- inExistingNames.push_back(theName);
- }
-
virtual TInstanceHandle LoadPathBuffer(const Q3DStudio::CString &inFullPathToDocument,
TInstanceHandle inParent, TSlideHandle inSlide,
DocumentEditorInsertType::Enum inDropType,
diff --git a/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp b/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp
index 462549b5..d80ce37b 100644
--- a/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp
@@ -1612,8 +1612,9 @@ struct SComposerSerializerImpl : public IComposerSerializer
IDOMWriter::Scope __instanceScope(inWriter, theType->wide_str());
inWriter.Att(L"id", GetInstanceId(inInstance));
- // for layers, save the variants property under the <Graph>
- if (theType.getValue() == L"Layer") {
+ // for objects with a 'variants' property (layers and models) save the variants property
+ // under the <Graph> node
+ if (theType.getValue() == L"Layer" || theType.getValue() == L"Model") {
auto prop = m_propertySystem.GetAggregateInstancePropertyByName(inInstance,
L"variants");
SValue sVal;
diff --git a/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.h b/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.h
index 9b7c7ffc..aed93159 100644
--- a/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.h
+++ b/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.h
@@ -69,7 +69,10 @@ enum EStudioObjectType {
OBJTYPE_PRESENTATION = 0x08000000,
OBJTYPE_PROJECT = 0x10000000,
OBJTYPE_QML_STREAM = 0x20000000,
- OBJTYPE_MATERIALDATA = 0x40000000
+ OBJTYPE_MATERIALDATA = 0x40000000,
+
+ // filters
+ OBJTYPE_IS_VARIANT = OBJTYPE_LAYER | OBJTYPE_MODEL
};
typedef enum {
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h
index 74b6043e..f5db0e38 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h
@@ -128,6 +128,7 @@ class IPropertySystem;
HANDLE_COMPOSER_PROPERTY(tessellation, m_Tessellation, TDataStrPtr, L"None") \
HANDLE_COMPOSER_PROPERTY(edgetess, m_EdgeTess, float, 1.0) \
HANDLE_COMPOSER_PROPERTY(innertess, m_InnerTess, float, 1.0) \
+ HANDLE_COMPOSER_PROPERTY_DUPLICATE(variants, m_variants, TDataStrPtr, L"") \
HANDLE_COMPOSER_PROPERTY_DUPLICATE(controlledproperty, m_ControlledProperty, TDataStrPtr, L"")
#define ITERATE_COMPOSER_IMAGE_PROPERTIES \
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp
index 542b05d3..6d8c19ea 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp
@@ -2252,7 +2252,7 @@ public:
if (inItem.m_FormalName.empty())
inItem.m_FormalName = inItem.m_Name;
if (inItem.m_Description.empty())
- inItem.m_Description = inItem.m_Name;
+ inItem.m_Description = inItem.m_FormalName;
// Ensure that users can use a float type and make minimal decisions
SerializeMetaDataData(inArchive, inItem.m_MetaDataData, inItem.m_CompleteType);
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaDataTypes.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaDataTypes.h
index 60b61f5c..5532e0a5 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaDataTypes.h
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaDataTypes.h
@@ -153,27 +153,19 @@ struct SMetaDataPropertyInfo : SMetaPropertyBase
{
Qt3DSDMInstanceHandle m_Instance;
Qt3DSDMPropertyHandle m_Property;
- bool m_Controllable; // Can this property be controlled
- bool m_IsHidden; // Is this property visible in the UI
- bool m_Animatable; // Is this property visible in the UI
+ bool m_Controllable = false; // Can this property be controlled via data input (default no)
+ bool m_IsHidden = false; // Is this property hidden in the inspector (default no)
+ bool m_Animatable = true; // Is this property animatable (default yes)
+ // Note: all animatables are controllable
TCharStr m_GroupName; // Name of the group this property belongs to or "default"
SMetaDataPropertyInfo(Qt3DSDMInstanceHandle inInstance)
: m_Instance(inInstance)
{
- init();
- }
- SMetaDataPropertyInfo() { init(); }
- void init()
- {
- m_IsHidden = false;
- // We default to being animatable
- m_Animatable = true;
- // Default to not being explicitly controllable.
- // (Note that all animables are controllable.)
- m_Controllable = false;
}
+ SMetaDataPropertyInfo() {}
+
bool operator==(const SMetaDataPropertyInfo &inOther) const
{
return m_Instance == inOther.m_Instance && m_Property == inOther.m_Property
diff --git a/src/Authoring/Studio/Application/ProjectFile.cpp b/src/Authoring/Studio/Application/ProjectFile.cpp
index 05a0b173..11d4985c 100644
--- a/src/Authoring/Studio/Application/ProjectFile.cpp
+++ b/src/Authoring/Studio/Application/ProjectFile.cpp
@@ -1138,7 +1138,7 @@ void ProjectFile::renameVariantTag(const QString &group, const QString &oldTag,
for (int i = 0; i < presElems.count(); ++i) {
QString pPath = m_fileInfo.path() + QLatin1Char('/')
+ presElems.at(i).toElement().attribute(QStringLiteral("src"));
- renameTagInUip(pPath, group, oldTag, newTag);
+ updateVariantsInUip(pPath, VariantsUpdateMode::Rename, group, oldTag, newTag);
}
// update and save the uia
@@ -1169,18 +1169,16 @@ void ProjectFile::renameVariantTag(const QString &group, const QString &oldTag,
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
const auto propertySystem = doc->GetStudioSystem()->GetPropertySystem();
const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
- const auto layers = doc->getLayers();
- auto property = bridge->GetLayer().m_variants;
- for (auto layer : layers) {
+ const QVector<int> instances = doc->getVariantInstances();
+ for (auto instance : instances) {
+ auto property = bridge->getVariantsProperty(instance);
qt3dsdm::SValue sValue;
- if (propertySystem->GetInstancePropertyValue(layer, property, sValue)) {
+ if (propertySystem->GetInstancePropertyValue(instance, property, sValue)) {
QString propVal = qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->toQString();
QString oldGroupTagPair = QStringLiteral("%1:%2").arg(group).arg(oldTag);
if (propVal.contains(oldGroupTagPair)) {
propVal.replace(oldGroupTagPair, QStringLiteral("%1:%2").arg(group).arg(newTag));
- qt3dsdm::SValue sVal
- = std::make_shared<qt3dsdm::CDataStr>(Q3DStudio::CString::fromQString(propVal));
- propertySystem->SetInstancePropertyValue(layer, property, sVal);
+ propertySystem->SetInstancePropertyValue(instance, property, QVariant(propVal));
}
}
}
@@ -1210,7 +1208,7 @@ void ProjectFile::renameVariantGroup(const QString &oldGroup, const QString &new
for (int i = 0; i < presElems.count(); ++i) {
QString pPath = m_fileInfo.path() + QLatin1Char('/')
+ presElems.at(i).toElement().attribute(QStringLiteral("src"));
- renameGroupInUip(pPath, oldGroup, newGroup);
+ updateVariantsInUip(pPath, VariantsUpdateMode::Rename, oldGroup, {}, newGroup);
}
// update and save the uia
@@ -1231,18 +1229,16 @@ void ProjectFile::renameVariantGroup(const QString &oldGroup, const QString &new
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
const auto propertySystem = doc->GetStudioSystem()->GetPropertySystem();
const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
- const auto layers = doc->getLayers();
- auto property = bridge->GetLayer().m_variants;
- for (auto layer : layers) {
+ const QVector<int> instances = doc->getVariantInstances();
+ for (auto instance : instances) {
+ auto property = bridge->getVariantsProperty(instance);
qt3dsdm::SValue sValue;
- if (propertySystem->GetInstancePropertyValue(layer, property, sValue)) {
+ if (propertySystem->GetInstancePropertyValue(instance, property, sValue)) {
QString propVal = qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->toQString();
QString oldGroupWithColon = QStringLiteral("%1:").arg(oldGroup);
if (propVal.contains(oldGroupWithColon)) {
propVal.replace(oldGroupWithColon, QStringLiteral("%1:").arg(newGroup));
- qt3dsdm::SValue sVal = std::make_shared<qt3dsdm::CDataStr>(
- Q3DStudio::CString::fromQString(propVal));
- propertySystem->SetInstancePropertyValue(layer, property, sVal);
+ propertySystem->SetInstancePropertyValue(instance, property, QVariant(propVal));
}
}
}
@@ -1275,7 +1271,7 @@ void ProjectFile::deleteVariantGroup(const QString &group)
for (int i = 0; i < presElems.count(); ++i) {
QString pPath = m_fileInfo.path() + QLatin1Char('/')
+ presElems.at(i).toElement().attribute(QStringLiteral("src"));
- if (pPath != doc->GetDocumentPath() && groupExistsInUip(pPath, group)) {
+ if (pPath != doc->GetDocumentPath() && tagExistsInUip(pPath, group)) {
inUseIdx = i;
break;
}
@@ -1288,15 +1284,15 @@ void ProjectFile::deleteVariantGroup(const QString &group)
" want to delete the group?").arg(group));
box.setIcon(QMessageBox::Warning);
box.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
- box.setButtonText(QMessageBox::Yes, QStringLiteral("Delete"));
+ box.setButtonText(QMessageBox::Yes, tr("Delete"));
switch (box.exec()) {
case QMessageBox::Yes:
// delete the group from all uips that use it
for (int i = inUseIdx; i < presElems.count(); ++i) {
QString pPath = m_fileInfo.path() + QLatin1Char('/')
- + presElems.at(i).toElement().attribute(QStringLiteral("src"));
+ + presElems.at(i).toElement().attribute(QStringLiteral("src"));
if (pPath != doc->GetDocumentPath())
- deleteGroupFromUip(pPath, group);
+ updateVariantsInUip(pPath, VariantsUpdateMode::Delete, group);
}
break;
@@ -1307,25 +1303,23 @@ void ProjectFile::deleteVariantGroup(const QString &group)
}
// delete the group from current uip, if exists
- deleteGroupFromUip(doc->GetDocumentPath(), group);
+ updateVariantsInUip(doc->GetDocumentPath(), VariantsUpdateMode::Delete, group);
// delete the group from the property (if set)
const auto propertySystem = doc->GetStudioSystem()->GetPropertySystem();
const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
- const auto layers = doc->getLayers();
- auto property = bridge->GetLayer().m_variants;
- for (auto layer : layers) {
+ const QVector<int> instances = doc->getVariantInstances();
+ for (auto instance : instances) {
+ auto property = bridge->getVariantsProperty(instance);
qt3dsdm::SValue sValue;
- if (propertySystem->GetInstancePropertyValue(layer, property, sValue)) {
+ if (propertySystem->GetInstancePropertyValue(instance, property, sValue)) {
QString propVal = qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->toQString();
if (propVal.contains(QStringLiteral("%1:").arg(group))) {
// property has the deleted group, need to update it, else the deleted group
// will be saved the uip if the user saves the presentation.
QRegExp rgx(QStringLiteral("%1:\\w*,*|,%1:\\w*").arg(group));
propVal.replace(rgx, {});
- qt3dsdm::SValue sVal = std::make_shared<qt3dsdm::CDataStr>(
- Q3DStudio::CString::fromQString(propVal));
- propertySystem->SetInstancePropertyValue(layer, property, sVal);
+ propertySystem->SetInstancePropertyValue(instance, property, QVariant(propVal));
}
}
}
@@ -1335,13 +1329,11 @@ void ProjectFile::deleteVariantGroup(const QString &group)
.firstChildElement(QStringLiteral("variants"));
QDomNodeList groupsElems = variantsElem.elementsByTagName(QStringLiteral("variantgroup"));
- bool deleted = false;
for (int i = 0; i < groupsElems.count(); ++i) {
QDomElement gElem = groupsElems.at(i).toElement();
if (gElem.attribute(QStringLiteral("id")) == group) {
variantsElem.removeChild(gElem);
StudioUtils::commitDomDocumentSave(file, domDoc);
- deleted = true;
break;
}
}
@@ -1376,188 +1368,6 @@ void ProjectFile::changeVariantGroupColor(const QString &group, const QString &n
m_variantsDef[group].m_color = newColor;
}
-bool ProjectFile::tagExistsInUip(const QString &src, const QString &group, const QString &tag) const
-{
- QFile file(src);
- if (!file.open(QFile::Text | QFile::ReadOnly)) {
- qWarning() << file.errorString();
- return false;
- }
-
- QXmlStreamReader reader(&file);
- reader.setNamespaceProcessing(false);
-
- while (!reader.atEnd()) {
- if (reader.readNextStartElement()) {
- if (reader.name() == QLatin1String("Layer")
- && reader.attributes().hasAttribute(QLatin1String("variants"))) {
- QStringRef v = reader.attributes().value(QLatin1String("variants"));
- if (v.contains(group + QLatin1Char(':') + tag))
- return true;
- } else if (reader.name() == QLatin1String("Logic")) {
- break;
- }
- }
- }
-
- return false;
-}
-
-bool ProjectFile::groupExistsInUip(const QString &src, const QString &group) const
-{
- QFile file(src);
- if (!file.open(QFile::Text | QFile::ReadOnly)) {
- qWarning() << file.errorString();
- return false;
- }
-
- QXmlStreamReader reader(&file);
- reader.setNamespaceProcessing(false);
-
- while (!reader.atEnd()) {
- if (reader.readNextStartElement()) {
- if (reader.name() == QLatin1String("Layer")
- && reader.attributes().hasAttribute(QLatin1String("variants"))) {
- QStringRef v = reader.attributes().value(QLatin1String("variants"));
- if (v.contains(group + QLatin1Char(':')))
- return true;
- } else if (reader.name() == QLatin1String("Logic")) {
- break;
- }
- }
- }
-
- return false;
-}
-
-// renames a tag (if exists) in all layers in a uip file
-void ProjectFile::renameTagInUip(const QString &src, const QString &group, const QString &tag,
- const QString &newName)
-{
- QDomDocument domDoc;
- QSaveFile file(src);
- if (!StudioUtils::openDomDocumentSave(file, domDoc))
- return;
-
- QDomNodeList layerElems = domDoc.documentElement()
- .elementsByTagName(QStringLiteral("Layer"));
- bool needSave = false;
- for (int i = 0; i < layerElems.count(); ++i) {
- QDomElement lElem = layerElems.at(i).toElement();
- if (lElem.hasAttribute(QStringLiteral("variants"))) {
- QStringList tagPairs = lElem.attribute(QStringLiteral("variants"))
- .split(QLatin1Char(','));
- QString tagFrom = group + QLatin1Char(':') + tag;
- QString tagTo = group + QLatin1Char(':') + newName;
-
- if (tagPairs.contains(tagFrom)) {
- tagPairs.replaceInStrings(tagFrom, tagTo);
- lElem.setAttribute(QStringLiteral("variants"), tagPairs.join(QLatin1Char(',')));
- needSave = true;
- }
- }
- }
-
- if (needSave)
- StudioUtils::commitDomDocumentSave(file, domDoc);
-}
-
-void ProjectFile::renameGroupInUip(const QString &src, const QString &group, const QString &newName)
-{
- QDomDocument domDoc;
- QSaveFile file(src);
- if (!StudioUtils::openDomDocumentSave(file, domDoc))
- return;
-
- QDomNodeList layerElems = domDoc.documentElement()
- .elementsByTagName(QStringLiteral("Layer"));
- bool needSave = false;
- for (int i = 0; i < layerElems.count(); ++i) {
- QDomElement lElem = layerElems.at(i).toElement();
- if (lElem.hasAttribute(QStringLiteral("variants"))) {
- QString variants = lElem.attribute(QStringLiteral("variants"));
- if (variants.contains(group + QLatin1Char(':'))) {
- variants.replace(group + QLatin1Char(':'), newName + QLatin1Char(':'));
- lElem.setAttribute(QStringLiteral("variants"), variants);
- needSave = true;
- }
- }
- }
-
- if (needSave)
- StudioUtils::commitDomDocumentSave(file, domDoc);
-}
-
-// deletes a tag (if exists) from all layers in a uip file
-void ProjectFile::deleteTagFromUip(const QString &src, const QString &group, const QString &tag)
-{
- QDomDocument domDoc;
- QSaveFile file(src);
- if (!StudioUtils::openDomDocumentSave(file, domDoc))
- return;
-
- QDomNodeList layerElems = domDoc.documentElement()
- .elementsByTagName(QStringLiteral("Layer"));
- bool needSave = false;
- for (int i = 0; i < layerElems.count(); ++i) {
- QDomElement lElem = layerElems.at(i).toElement();
- if (lElem.hasAttribute(QStringLiteral("variants"))) {
- QStringList tagPairs = lElem.attribute(QStringLiteral("variants"))
- .split(QLatin1Char(','));
- QString tagPair = group + QLatin1Char(':') + tag;
- if (tagPairs.contains(tagPair)) {
- tagPairs.removeOne(tagPair);
- lElem.setAttribute(QStringLiteral("variants"), tagPairs.join(QLatin1Char(',')));
- needSave = true;
- }
- }
- }
-
- if (needSave)
- StudioUtils::commitDomDocumentSave(file, domDoc);
-}
-
-// deletes a group (if exists) from all layers in a uip file
-void ProjectFile::deleteGroupFromUip(const QString &src, const QString &group)
-{
- QDomDocument domDoc;
- QSaveFile file(src);
- if (!StudioUtils::openDomDocumentSave(file, domDoc))
- return;
-
- QDomNodeList layerElems = domDoc.documentElement()
- .elementsByTagName(QStringLiteral("Layer"));
- bool needSave = false;
- QRegExp rgx(group + ":\\w*,*|," + group + ":\\w*");
- for (int i = 0; i < layerElems.count(); ++i) {
- QDomElement lElem = layerElems.at(i).toElement();
- if (lElem.hasAttribute(QStringLiteral("variants"))) {
- QString val = lElem.attribute(QStringLiteral("variants"));
- if (rgx.indexIn(val) != -1) {
- val.replace(rgx, "");
- lElem.setAttribute(QStringLiteral("variants"), val);
- needSave = true;
- }
- }
- }
-
- if (needSave)
- StudioUtils::commitDomDocumentSave(file, domDoc);
-}
-
-bool ProjectFile::isVariantGroupUnique(const QString &group) const
-{
- return !m_variantsDef.contains(group);
-}
-
-bool ProjectFile::isVariantTagUnique(const QString &group, const QString &tag) const
-{
- if (!m_variantsDef.contains(group))
- return true;
-
- return !m_variantsDef[group].m_tags.contains(tag);
-}
-
void ProjectFile::deleteVariantTag(const QString &group, const QString &tag)
{
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
@@ -1588,7 +1398,7 @@ void ProjectFile::deleteVariantTag(const QString &group, const QString &tag)
" delete it?").arg(tag));
box.setIcon(QMessageBox::Warning);
box.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
- box.setButtonText(QMessageBox::Yes, QStringLiteral("Delete"));
+ box.setButtonText(QMessageBox::Yes, tr("Delete"));
switch (box.exec()) {
case QMessageBox::Yes:
// delete the tag from all uips that use it
@@ -1596,7 +1406,7 @@ void ProjectFile::deleteVariantTag(const QString &group, const QString &tag)
QString pPath = m_fileInfo.path() + QLatin1Char('/')
+ presElems.at(i).toElement().attribute(QStringLiteral("src"));
if (pPath != doc->GetDocumentPath())
- deleteTagFromUip(pPath, group, tag);
+ updateVariantsInUip(pPath, VariantsUpdateMode::Delete, group, tag);
}
break;
@@ -1607,7 +1417,7 @@ void ProjectFile::deleteVariantTag(const QString &group, const QString &tag)
}
// delete the tag from current doc, if exists
- deleteTagFromUip(doc->GetDocumentPath(), group, tag);
+ updateVariantsInUip(doc->GetDocumentPath(), VariantsUpdateMode::Delete, group, tag);
QDomNodeList groupsElems = domDoc.documentElement()
.firstChildElement(QStringLiteral("variants"))
@@ -1616,21 +1426,18 @@ void ProjectFile::deleteVariantTag(const QString &group, const QString &tag)
// delete the tag from the property (if set)
const auto propertySystem = doc->GetStudioSystem()->GetPropertySystem();
const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
- const auto layers = doc->getLayers();
- auto property = bridge->GetLayer().m_variants;
- for (auto layer : layers) {
+ const QVector<int> instances = doc->getVariantInstances();
+ for (auto instance : instances) {
+ auto property = bridge->getVariantsProperty(instance);
qt3dsdm::SValue sValue;
- if (propertySystem->GetInstancePropertyValue(layer, property, sValue)) {
- QString propVal = QString::fromWCharArray(qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)
- ->GetData());
+ if (propertySystem->GetInstancePropertyValue(instance, property, sValue)) {
+ QString propVal = qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->toQString();
if (propVal.contains(QStringLiteral("%1:%2").arg(group).arg(tag))) {
// property has the deleted tag, need to update it, else the deleted tag will be
// saved in the uip if the user saves the presentation.
QRegExp rgx(QStringLiteral("%1:%2,*|,%1:%2").arg(group).arg(tag));
propVal.replace(rgx, {});
- qt3dsdm::SValue sVal = std::make_shared<qt3dsdm::CDataStr>(
- Q3DStudio::CString::fromQString(propVal));
- propertySystem->SetInstancePropertyValue(layer, property, sVal);
+ propertySystem->SetInstancePropertyValue(instance, property, QVariant(propVal));
}
}
}
@@ -1658,3 +1465,89 @@ void ProjectFile::deleteVariantTag(const QString &group, const QString &tag)
// update m_variantsDef
m_variantsDef[group].m_tags.removeOne(tag);
}
+
+// rename or delete a tag or group in a uip file
+void ProjectFile::updateVariantsInUip(const QString &src, const VariantsUpdateMode &updateType,
+ const QString &group, const QString &tag,
+ const QString &newName)
+{
+ QDomDocument domDoc;
+ QSaveFile file(src);
+ if (!StudioUtils::openDomDocumentSave(file, domDoc))
+ return;
+
+ QDomElement graphElem = domDoc.documentElement().firstChild()
+ .firstChildElement(QStringLiteral("Graph"));
+ QDomElement sceneElem = graphElem.firstChildElement(QStringLiteral("Scene"));
+
+ bool needsSave = false;
+ QString sceneStr;
+ QTextStream stream(&sceneStr);
+ sceneElem.save(stream, 4);
+
+ // if tag isEmpty() update group, else update tag
+
+ if (updateType == VariantsUpdateMode::Rename) { // rename a tag or a group
+ QString oldPair = group + QLatin1Char(':') + tag;
+ QString newPair = QStringLiteral("%1:%2").arg(tag.isEmpty() ? newName : group)
+ .arg(tag.isEmpty() ? tag : newName);
+ if (sceneStr.contains(oldPair)) {
+ sceneStr.replace(oldPair, newPair);
+ needsSave = true;
+ }
+ } else if (updateType == VariantsUpdateMode::Delete) { // delete a tag or a group
+ QRegExp rgx(tag.isEmpty() ? QStringLiteral("%1:\\w*,*|,%1:\\w*").arg(group)
+ : QStringLiteral("%1:%2,*|,%1:%2").arg(group).arg(tag));
+ if (rgx.indexIn(sceneStr) != -1) {
+ sceneStr.replace(rgx, "");
+ needsSave = true;
+ }
+ }
+
+ if (needsSave) {
+ QDomDocument sceneDom;
+ sceneDom.setContent(sceneStr);
+ graphElem.replaceChild(sceneDom, sceneElem);
+ StudioUtils::commitDomDocumentSave(file, domDoc);
+ }
+}
+
+// if tag param is empty, the method checks if a group exists
+bool ProjectFile::tagExistsInUip(const QString &src, const QString &group, const QString &tag) const
+{
+ QFile file(src);
+ if (!file.open(QFile::Text | QFile::ReadOnly)) {
+ qWarning() << file.errorString();
+ return false;
+ }
+
+ QXmlStreamReader reader(&file);
+ reader.setNamespaceProcessing(false);
+
+ while (!reader.atEnd()) {
+ if (reader.readNextStartElement()) {
+ if (reader.attributes().hasAttribute(QLatin1String("variants"))) {
+ QStringRef v = reader.attributes().value(QLatin1String("variants"));
+ if (v.contains(group + QLatin1Char(':') + tag))
+ return true;
+ } else if (reader.name() == QLatin1String("Logic")) {
+ break;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool ProjectFile::isVariantGroupUnique(const QString &group) const
+{
+ return !m_variantsDef.contains(group);
+}
+
+bool ProjectFile::isVariantTagUnique(const QString &group, const QString &tag) const
+{
+ if (!m_variantsDef.contains(group))
+ return true;
+
+ return !m_variantsDef[group].m_tags.contains(tag);
+}
diff --git a/src/Authoring/Studio/Application/ProjectFile.h b/src/Authoring/Studio/Application/ProjectFile.h
index 7a59ca5e..b53f559c 100644
--- a/src/Authoring/Studio/Application/ProjectFile.h
+++ b/src/Authoring/Studio/Application/ProjectFile.h
@@ -105,14 +105,13 @@ Q_SIGNALS:
void assetNameChanged();
private:
+ enum class VariantsUpdateMode { Rename, Delete };
+
QString ensureUniquePresentationId(const QString &id) const;
- bool tagExistsInUip(const QString &src, const QString &group, const QString &tag) const;
- bool groupExistsInUip(const QString &src, const QString &group) const;
- void deleteTagFromUip(const QString &src, const QString &group, const QString &tag);
- void deleteGroupFromUip(const QString &src, const QString &group);
- void renameTagInUip(const QString &src, const QString &group, const QString &tag,
- const QString &newName);
- void renameGroupInUip(const QString &src, const QString &group, const QString &newName);
+ bool tagExistsInUip(const QString &src, const QString &group, const QString &tag = {}) const;
+ void updateVariantsInUip(const QString &src, const VariantsUpdateMode &updateType,
+ const QString &group, const QString &tag = {},
+ const QString &newName = {});
QFileInfo m_fileInfo; // uia file info
QString m_initialPresentation;
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
index 47f9f7a5..01d8a3a1 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
@@ -162,7 +162,7 @@ void InspectorControlModel::notifyPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle
if (!bridge->IsSceneGraphInstance(inInstance))
return;
- if (inProperty == bridge->GetLayer().m_variants) {
+ if (inProperty == bridge->getVariantsProperty(inInstance)) {
// variants model is updated upon edit but this is needed to handle undoing
m_variantsModel->refresh();
return;
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
index ddcec94c..0c04ba55 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
@@ -60,8 +60,6 @@
#include "Qt3DSDMSlides.h"
#include "VariantsGroupModel.h"
#include "VariantTagDialog.h"
-#include "Views.h"
-#include "MainFrm.h"
#include "SlideView.h"
#include "TimelineWidget.h"
@@ -466,18 +464,18 @@ void InspectorControlView::showTagContextMenu(int x, int y, const QString &group
// refresh slide view so the tooltip show the renamed tag immediately, no need to
// refresh the timeline because each row gets the tags directly from the property which
// is always up to date.
- g_StudioApp.GetViews()->getMainFrame()->getSlideView()->refreshVariants();
+ g_StudioApp.m_pMainWnd->getSlideView()->refreshVariants();
}
});
auto actionDelete = theContextMenu.addAction(QObject::tr("Delete Tag"));
connect(actionDelete, &QAction::triggered, this, [&]() {
g_StudioApp.GetCore()->getProjectFile().deleteVariantTag(group, tag);
- g_StudioApp.GetViews()->getMainFrame()->getTimelineWidget()->refreshVariants();
- g_StudioApp.GetViews()->getMainFrame()->getSlideView()->refreshVariants();
+ g_StudioApp.m_pMainWnd->getTimelineWidget()->refreshVariants();
+ g_StudioApp.m_pMainWnd->getSlideView()->refreshVariants();
m_variantsGroupModel->refresh();
if (g_StudioApp.GetCore()->getProjectFile().variantsDef()[group].m_tags.size() == 0)
- g_StudioApp.GetViews()->getMainFrame()->updateActionFilterEnableState();
+ g_StudioApp.m_pMainWnd->updateActionFilterEnableState();
});
theContextMenu.exec(mapToGlobal({x, y}));
@@ -495,33 +493,33 @@ void InspectorControlView::showGroupContextMenu(int x, int y, const QString &gro
VariantTagDialog dlg(VariantTagDialog::RenameGroup, {}, group);
if (dlg.exec() == QDialog::Accepted) {
projectFile.renameVariantGroup(dlg.getNames().first, dlg.getNames().second);
- g_StudioApp.GetViews()->getMainFrame()->getTimelineWidget()->refreshVariants();
+ g_StudioApp.m_pMainWnd->getTimelineWidget()->refreshVariants();
m_variantsGroupModel->refresh();
// refresh slide view so the tooltip show the renamed group immediately, no need to
// refresh the timeline because each row gets the tags directly from the property which
// is always up to date.
- g_StudioApp.GetViews()->getMainFrame()->getSlideView()->refreshVariants();
+ g_StudioApp.m_pMainWnd->getSlideView()->refreshVariants();
}
});
auto actionColor = theContextMenu.addAction(QObject::tr("Change Group Color"));
connect(actionColor, &QAction::triggered, this, [&]() {
- const auto variantsDef = g_StudioApp.GetCore()->getProjectFile().variantsDef();
+ const auto variantsDef = projectFile.variantsDef();
QColor newColor = this->showColorDialog(variantsDef[group].m_color);
projectFile.changeVariantGroupColor(group, newColor.name());
// no need to refresh variants in the timeline widget as it references the group color in
// the project file m_variants, and a redraw is triggered upon color selection dialog close.
- g_StudioApp.GetViews()->getMainFrame()->getSlideView()->refreshVariants();
+ g_StudioApp.m_pMainWnd->getSlideView()->refreshVariants();
m_variantsGroupModel->refresh();
});
auto actionDelete = theContextMenu.addAction(QObject::tr("Delete Group"));
connect(actionDelete, &QAction::triggered, this, [&]() {
projectFile.deleteVariantGroup(group);
- g_StudioApp.GetViews()->getMainFrame()->getTimelineWidget()->refreshVariants();
- g_StudioApp.GetViews()->getMainFrame()->getSlideView()->refreshVariants();
- g_StudioApp.GetViews()->getMainFrame()->updateActionFilterEnableState();
+ g_StudioApp.m_pMainWnd->getTimelineWidget()->refreshVariants();
+ g_StudioApp.m_pMainWnd->getSlideView()->refreshVariants();
+ g_StudioApp.m_pMainWnd->updateActionFilterEnableState();
m_variantsGroupModel->refresh();
});
diff --git a/src/Authoring/Studio/Palettes/Inspector/VariantsGroupModel.cpp b/src/Authoring/Studio/Palettes/Inspector/VariantsGroupModel.cpp
index f2427805..066f912a 100644
--- a/src/Authoring/Studio/Palettes/Inspector/VariantsGroupModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/VariantsGroupModel.cpp
@@ -30,7 +30,6 @@
#include "VariantsTagModel.h"
#include "StudioApp.h"
#include "Core.h"
-#include "Views.h"
#include "MainFrm.h"
#include "Qt3DSDMStudioSystem.h"
#include "ClientDataModelBridge.h"
@@ -52,7 +51,7 @@ void VariantsGroupModel::refresh()
int instance = g_StudioApp.GetCore()->GetDoc()->GetSelectedInstance();
auto bridge = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetClientDataModelBridge();
- if (instance == 0 || !bridge->IsLayerInstance(instance)) {
+ if (instance == 0 || bridge->GetObjectType(instance) & ~OBJTYPE_IS_VARIANT) {
m_instance = 0;
m_property = 0;
return;
@@ -60,7 +59,7 @@ void VariantsGroupModel::refresh()
auto propertySystem = g_StudioApp.GetCore()->GetDoc()->GetPropertySystem();
m_instance = instance;
- m_property = bridge->GetLayer().m_variants.m_Property;
+ m_property = bridge->getVariantsProperty(instance);
qt3dsdm::SValue sValue;
if (propertySystem->GetInstancePropertyValue(m_instance, m_property, sValue)) {
@@ -153,9 +152,8 @@ void VariantsGroupModel::setTagState(const QString &group, const QString &tag, b
}
}
- auto sVal = std::make_shared<qt3dsdm::CDataStr>(Q3DStudio::CString::fromQString(val));
Q3DStudio::SCOPED_DOCUMENT_EDITOR(*g_StudioApp.GetCore()->GetDoc(), QObject::tr("Set Property"))
- ->SetInstancePropertyValue(m_instance, m_property, sVal);
+ ->SetInstancePropertyValue(m_instance, m_property, QVariant(val));
}
void VariantsGroupModel::addNewTag(const QString &group)
@@ -167,7 +165,7 @@ void VariantsGroupModel::addNewTag(const QString &group)
refresh();
if (g_StudioApp.GetCore()->getProjectFile().variantsDef()[group].m_tags.size() == 1)
- g_StudioApp.GetViews()->getMainFrame()->updateActionFilterEnableState();
+ g_StudioApp.m_pMainWnd->updateActionFilterEnableState();
}
}
diff --git a/src/Authoring/Studio/Palettes/Slide/SlideModel.cpp b/src/Authoring/Studio/Palettes/Slide/SlideModel.cpp
index 66ff7ee1..8265d6bc 100644
--- a/src/Authoring/Studio/Palettes/Slide/SlideModel.cpp
+++ b/src/Authoring/Studio/Palettes/Slide/SlideModel.cpp
@@ -374,11 +374,12 @@ void SlideModel::refreshVariants(const QVector<QHash<QString, QStringList>> &vMo
m_variantsModelKeys.resize(slideCount);
const auto propertySystem = GetDoc()->GetPropertySystem();
- const auto layers = GetDoc()->getLayers();
- for (auto layer : layers) {
- int slideIdx = slideIndex(slideSystem->GetAssociatedSlide(layer));
+ const QVector<int> instances = GetDoc()->getVariantInstances();
+ for (auto instance : instances) {
+ int slideIdx = slideIndex(slideSystem->GetAssociatedSlide(instance));
qt3dsdm::SValue sValue;
- if (propertySystem->GetInstancePropertyValue(layer, GetBridge()->GetLayer().m_variants,
+ if (propertySystem->GetInstancePropertyValue(instance,
+ GetBridge()->getVariantsProperty(instance),
sValue)) {
QString propVal = qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->toQString();
if (!propVal.isEmpty()) {
diff --git a/src/Authoring/Studio/Palettes/Slide/SlideView.cpp b/src/Authoring/Studio/Palettes/Slide/SlideView.cpp
index 5db59ad5..c49f34d2 100644
--- a/src/Authoring/Studio/Palettes/Slide/SlideView.cpp
+++ b/src/Authoring/Studio/Palettes/Slide/SlideView.cpp
@@ -382,11 +382,12 @@ void SlideView::onDataInputChange(int handle, int instance, const QString &dataI
void SlideView::onAssetCreated(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
{
- // refresh the variants model if the created asset is a layer with variants property set.
- if (GetBridge()->IsLayerInstance(inInstance)) {
+ // refresh the variants model if the created asset has a variants property set.
+ if (GetBridge()->GetObjectType(inInstance) & OBJTYPE_IS_VARIANT) {
const auto propertySystem = GetDoc()->GetPropertySystem();
qt3dsdm::SValue sValue;
- if (propertySystem->GetInstancePropertyValue(inInstance, GetBridge()->GetLayer().m_variants,
+ if (propertySystem->GetInstancePropertyValue(inInstance,
+ GetBridge()->getVariantsProperty(inInstance),
sValue)) {
if (qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->GetLength() != 0)
refreshVariants();
@@ -408,7 +409,7 @@ void SlideView::onPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
m_SlidesModel->refreshSlideLabel(inInstance, inProperty);
// refresh variants
- if (inProperty == GetBridge()->GetLayer().m_variants)
+ if (inProperty == GetBridge()->getVariantsProperty(inInstance))
refreshVariants();
}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
index ae6fec47..47e33461 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
@@ -1008,7 +1008,7 @@ void TimelineGraphicsScene::updateHoverStatus(const QPointF &scenePos)
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
const auto propertySystem = doc->GetStudioSystem()->GetPropertySystem();
const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
- auto property = bridge->GetLayer().m_variants;
+ auto property = bridge->getVariantsProperty(rowTree->instance());
using namespace qt3dsdm;
SValue sValue;
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
index d74ddeb2..78ed54ef 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
@@ -548,15 +548,14 @@ void TimelineWidget::onAssetCreated(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
row->updateSubpresentations();
insertToHandlesMap(binding);
- // refresh the created object variants if it is a layer with variants property
- // set.
- if (m_bridge->IsLayerInstance(inInstance)) {
+ // refresh the created object variants if it has a variants property set.
+ if (m_bridge->GetObjectType(inInstance) & OBJTYPE_IS_VARIANT) {
const auto propertySystem = g_StudioApp.GetCore()->GetDoc()
->GetPropertySystem();
qt3dsdm::SValue sValue;
if (propertySystem->GetInstancePropertyValue(inInstance,
- m_bridge->GetLayer().m_variants,
- sValue)) {
+ m_bridge->getVariantsProperty(inInstance),
+ sValue)) {
if (qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->GetLength() != 0)
refreshVariants(inInstance);
}
@@ -770,7 +769,7 @@ void TimelineWidget::onPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle inInstance
m_subpresentationChanges.insert(inInstance);
if (!m_asyncUpdateTimer.isActive())
m_asyncUpdateTimer.start();
- } else if (inProperty == m_bridge->GetLayer().m_variants) {
+ } else if (inProperty == m_bridge->getVariantsProperty(inInstance)) {
qt3dsdm::SValue sValue;
if (doc->GetPropertySystem()->GetInstancePropertyValue(inInstance, inProperty, sValue)) {
QString propVal = qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->toQString();
@@ -1269,18 +1268,19 @@ void TimelineWidget::setSelectedTimeBarsColor(const QColor &color, bool preview)
void TimelineWidget::refreshVariants(int instance)
{
const auto propertySystem = g_StudioApp.GetCore()->GetDoc()->GetPropertySystem();
- QVector<int> layers;
+ QVector<int> instances;
if (instance)
- layers << instance;
+ instances << instance;
else
- layers = g_StudioApp.GetCore()->GetDoc()->getLayers();
+ instances = g_StudioApp.GetCore()->GetDoc()->getVariantInstances();
- for (auto layer : qAsConst(layers)) {
- if (!m_handlesMap.contains(layer))
+ for (auto instance : qAsConst(instances)) {
+ if (!m_handlesMap.contains(instance))
continue;
qt3dsdm::SValue sValue;
- if (propertySystem->GetInstancePropertyValue(layer, m_bridge->GetLayer().m_variants,
+ if (propertySystem->GetInstancePropertyValue(instance,
+ m_bridge->getVariantsProperty(instance),
sValue)) {
QString propVal = qt3dsdm::get<qt3dsdm::TDataStrPtr>(sValue)->toQString();
if (!propVal.isEmpty()) {
@@ -1292,9 +1292,9 @@ void TimelineWidget::refreshVariants(int instance)
groups.append(group);
}
- m_handlesMap[layer]->updateVariants(groups);
+ m_handlesMap[instance]->updateVariants(groups);
} else {
- m_handlesMap[layer]->updateVariants({});
+ m_handlesMap[instance]->updateVariants({});
}
}
}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
index 8015459a..69d6f1c2 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
@@ -668,7 +668,7 @@ bool RowTree::isInVariantsFilter() const
{
const QString filterStr = g_StudioApp.m_pMainWnd->getVariantsFilterStr();
- if (m_rowType != OBJTYPE_LAYER || filterStr.isEmpty()
+ if (m_rowType & ~OBJTYPE_IS_VARIANT || filterStr.isEmpty()
|| !m_scene->widgetTimeline()->toolbar()->isVariantsFilterOn()) {
return true;
}
@@ -676,7 +676,7 @@ bool RowTree::isInVariantsFilter() const
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
const auto propertySystem = doc->GetStudioSystem()->GetPropertySystem();
const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
- auto property = bridge->GetLayer().m_variants;
+ auto property = bridge->getVariantsProperty(instance());
using namespace qt3dsdm;
SValue sValue;
diff --git a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml
index dfc1ccfa..0e003008 100644
--- a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml
+++ b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml
@@ -95,7 +95,7 @@
<Property name="sourcepath" formalName="Sub-Presentation" description="Presentation or QML stream to\nrender for this layer" type="Renderable" controllable="True" category="Basic Properties" />
<!-- Variant Tags -->
- <Property name="variants" type="String" category="Variant Tags" />
+ <Property name="variants" type="String" animatable="False" category="Variant Tags" />
<!-- Antialiasing -->
<Property name="progressiveaa" formalName="Progressive AA" description="Improves the visual quality when no\nitems are moving" list="None:2x:4x:8x" default="None" category="Antialiasing" />
@@ -288,16 +288,23 @@
</ReferencedMaterial>
<Model>
<!-- Basic Properties -->
- <Property name="name" formalName="Name" description="Object name" type="String" default="Light" hidden="False" category="Basic Properties" />
- <Property name="eyeball" formalName="Visible" description="Item visibility" type="Boolean" default="True" hidden="False" controllable="True" category="Basic Properties" />
- <Property name="opacity" formalName="Opacity" min="0" max="100" default="100" hidden="True" category="Basic Properties" />
- <Property name="position" formalName="Position" description="Location in local space" type="Vector" category="Basic Properties" />
- <Property name="rotation" formalName="Rotation" description="Rotation around local axes" type="Rotation" category="Basic Properties" />
- <Property name="scale" formalName="Scale" description="Size adjustments along local axes" type="Vector" default="1 1 1" category="Basic Properties" />
- <Property name="pivot" formalName="Pivot" description="Offset of the contents away from the local center" type="Vector" category="Basic Properties" />
- <Property name="sourcepath" formalName="Mesh" description="Geometry to use for this model" type="Mesh" category="Model"/>
- <Property name="shadowcaster" formalName="Cast Shadows" description="Whether the model is a shadow caster or not" type="Boolean" default="True" category="Model"/>
- <Property name="poseroot" hidden="True" type="Long" default="-1" category="Model"/>
+ <Property name="name" formalName="Name" type="String" default="Model" category="Basic Properties" description="Object name" />
+ <Property name="eyeball" formalName="Visible" type="Boolean" default="True" category="Basic Properties" description="Item visibility" />
+ <Property name="position" formalName="Position" type="Vector" category="Basic Properties" description="Location in local space" />
+ <Property name="rotation" formalName="Rotation" type="Rotation" category="Basic Properties" description="Rotation around local axes" />
+ <Property name="scale" formalName="Scale" type="Vector" default="1 1 1" category="Basic Properties" description="Size adjustments along local axes" />
+ <Property name="pivot" formalName="Pivot" type="Vector" category="Basic Properties" description="Offset of the contents away from the local center" />
+ <Property name="opacity" formalName="Opacity" min="0" max="100" default="100" category="Basic Properties" />
+
+ <!-- Variant Tags -->
+ <Property name="variants" type="String" animatable="False" category="Variant Tags" />
+
+ <!-- Model -->
+ <Property name="sourcepath" formalName="Mesh" type="Mesh" category="Model" description="Geometry to use for this model" />
+ <Property name="shadowcaster" formalName="Cast Shadows" type="Boolean" default="True" category="Model" description="Whether the model is a shadow caster or not" />
+
+ <!-- Hidden and commented out props -->
+ <Property name="poseroot" hidden="True" type="Long" default="-1" category="Model" />
<!--<Property name="tessellation" formalName="Tessellation Mode" description="Type of tessellation to subdivide\nthe geometry" list="None:Linear:Phong:NPatch" default="None" />
<Property name="edgetess" formalName="Edge Tessellation" description="Max Tessellation amount" min="1" max="64" default="4" />
<Property name="innertess" formalName="Inner Tessellation" description="Min Tessellation amount" min="1" max="64" default="4" />-->