summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2017-12-15 11:53:56 +0200
committerJanne Kangas <janne.kangas@qt.io>2018-01-12 08:33:15 +0000
commit0707c13c34653066c89d5b25abe60a779650ee27 (patch)
tree83d6556f01eda5c7977b505bbe1b0d74a2eb62ee
parent4607f5ff35da9642e656476b78b1318bca7a1fa6 (diff)
[DataInput] Implement linking of Text element textstring to DataInput
Adds Text-element specific functionality that allows linking of text element(s) "textstring" property to DataInput. This link forwards any changes in DataInput valuestr property to linked element property. DataInput path is hardwired to "this.DataInput" in proto implementation. Future patches will integrate DataInput selection dialog that allows choosing controlling datainput from the ones currently in scene. User-visible DataInput functionality is still disabled from editor. Task-ID: QT3DS-338 Change-Id: I064c616f6cf651fc12f1e810c7b807ed5cc04555 Reviewed-by: Marianne Yrjänä <marianne.yrjana@qt.io> Reviewed-by: Antti Määttä <antti.maatta@qt.io>
-rw-r--r--src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp49
-rw-r--r--src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h5
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.cpp4
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.h2
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.cpp1
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h3
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp18
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.h3
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaDataTypes.h12
-rw-r--r--src/Authoring/QT3DSDM/Systems/Qt3DSDMSignals.h4
-rw-r--r--src/Authoring/QT3DSDM/Systems/SignalsImpl.cpp15
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp58
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h10
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml37
-rw-r--r--src/Authoring/Studio/Render/StudioRendererTranslation.cpp39
-rw-r--r--src/Runtime/Source/Engine/Source/Qt3DSRenderRuntimeBindingImplTranslation.cpp26
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.cpp1
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.h4
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h7
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPLoader.cpp1
-rw-r--r--src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.h1
-rw-r--r--src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.txt2
-rw-r--r--src/Runtime/Source/Runtime/Source/Qt3DSAttributeHashes.cpp1
-rw-r--r--src/Runtime/res/DataModelMetadata/en-us/MetaData.xml2
24 files changed, 265 insertions, 40 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
index 5aa14288..87662d5b 100644
--- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
@@ -1373,6 +1373,55 @@ public:
SetName(theMaterial, materialName);
}
+ void SetInstancePropertyControlled(TInstanceHandle instance, CString instancepath,
+ TPropertyHandle propName, TInstanceHandle controller,
+ bool controlled) override
+ {
+ SComposerObjectDefinitions &theDefinitions(m_Bridge.GetObjectDefinitions());
+
+ // get the name of controlled property
+ auto metadataHandle = m_MetaData.GetMetaDataProperty(instance, propName);
+ auto metadata = m_MetaData.GetMetaDataPropertyInfo(metadataHandle);
+ const wchar_t *propname = metadata->m_Name.wide_str();
+ qt3dsdm::SValue controlledProperty = std::make_shared<CDataStr>(propname);
+
+ // get existing string of controlled elements and properties from controlling
+ // datainput
+ qt3dsdm::SValue controlledElemProp;
+ m_DataCore.GetInstancePropertyValue(
+ controller, theDefinitions.m_DataInput.m_ControlledElemProp, controlledElemProp);
+ QString controlledElemPropStr = controlledElemProp.toQVariant().toString();
+
+ // build the controlled element - controlled property string specific for this element
+ instancepath.append(" ");
+ instancepath.append(propname);
+ instancepath.append(" ");
+
+ // If property was set to controlled, append element - property string to the list
+ // held by the controlling datainput. Otherwise, remove this element-property -pair from it.
+ if (controlled)
+ controlledElemPropStr.append(instancepath.toQString());
+ else
+ controlledElemPropStr.remove(instancepath.toQString());
+
+ qCDebug(qt3ds::TRACE_INFO) << "SetInstance datainput controlledelemprop: instance "
+ << controller
+ << " property " << theDefinitions.m_DataInput.m_ControlledElemProp.m_Property
+ << " value " << controlledElemPropStr;
+
+ controlledElemProp = std::make_shared<CDataStr>(controlledElemPropStr.toStdWString().c_str());
+ // For DataInput and Alias, property values are set through datacore.
+ // Set the newly built controlledelemprop string for the controlling datainput
+ m_DataCore.SetInstancePropertyValue(controller,
+ theDefinitions.m_DataInput.m_ControlledElemProp,
+ controlledElemProp);
+ // Set the controlledproperty string in the controlled element
+ // TODO: For the moment this is Text element -specific only
+ m_DataCore.SetInstancePropertyValue(instance,
+ theDefinitions.m_Text.m_ControlledProperty,
+ controlledProperty);
+ }
+
// Normal way in to the system.
void SetInstancePropertyValue(TInstanceHandle instance, TPropertyHandle propName,
const SValue &value, bool inAutoDelete = true) override
diff --git a/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h b/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h
index 7dea9b34..765c5b4c 100644
--- a/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h
+++ b/src/Authoring/Client/Code/Core/Doc/IDocumentEditor.h
@@ -196,6 +196,11 @@ public:
SetInstancePropertyValueAsRenderable(TInstanceHandle instance, TPropertyHandle propName,
const Q3DStudio::CString &inSourcePath) = 0;
+ virtual void SetInstancePropertyControlled(TInstanceHandle instance, CString instancepath,
+ TPropertyHandle propName,
+ TInstanceHandle controller,
+ bool controlled) = 0;
+
virtual void SetMaterialType(TInstanceHandle instance,
const Q3DStudio::CString &inRelativePathToMaterialFile) = 0;
diff --git a/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.cpp b/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.cpp
index ede4df88..2a7dd8ca 100644
--- a/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.cpp
@@ -209,6 +209,10 @@ IStudioFullSystemSignalProvider *CStudioSystem::GetFullSystemSignalProvider()
{
return m_StudioSystem->GetSignalProvider();
}
+IStudioFullSystemSignalSender *CStudioSystem::GetFullSystemSignalSender()
+{
+ return m_StudioSystem->GetSignalSender();
+}
IAnimationCore *CStudioSystem::GetAnimationCore()
{
return m_StudioSystem->GetAnimationCore().get();
diff --git a/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.h b/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.h
index cc7d5c5e..f43056d9 100644
--- a/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.h
+++ b/src/Authoring/Client/Code/Core/Doc/Qt3DSDMStudioSystem.h
@@ -46,6 +46,7 @@ class IAnimationCore;
class IActionCore;
class CStudioFullSystem;
class IStudioFullSystemSignalProvider;
+class IStudioFullSystemSignalSender;
class IStudioAnimationSystem;
class IActionSystem;
class ISignalConnection;
@@ -69,6 +70,7 @@ public:
ISlideCore *GetSlideCore();
IPropertySystem *GetPropertySystem();
IStudioFullSystemSignalProvider *GetFullSystemSignalProvider();
+ IStudioFullSystemSignalSender *GetFullSystemSignalSender();
IAnimationCore *GetAnimationCore();
IStudioAnimationSystem *GetAnimationSystem();
IActionCore *GetActionCore();
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.cpp b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.cpp
index 686c2c3e..62d21463 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.cpp
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.cpp
@@ -308,6 +308,7 @@ struct DataConstructor<SObjectRefType>
#define QT3DS_WCHAR_T_timefrom L"timefrom"
#define QT3DS_WCHAR_T_timeto L"timeto"
#define QT3DS_WCHAR_T_controlledelemprop L"controlledelemprop"
+#define QT3DS_WCHAR_T_controlledproperty L"controlledproperty"
const wchar_t *ComposerObjectTypes::Convert(ComposerObjectTypes::Enum inType)
{
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h
index 834a87ef..5289b76e 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h
@@ -262,7 +262,8 @@ class IPropertySystem;
HANDLE_COMPOSER_PROPERTY(vertalign, m_VertAlign, TDataStrPtr, L"Middle") \
HANDLE_COMPOSER_PROPERTY(leading, m_Leading, float, 0.f) \
HANDLE_COMPOSER_PROPERTY(tracking, m_Tracking, float, 0.f) \
- HANDLE_COMPOSER_PROPERTY(enableacceleratedfont, m_EnableAcceleratedFont, bool, false)
+ HANDLE_COMPOSER_PROPERTY(enableacceleratedfont, m_EnableAcceleratedFont, bool, false) \
+ HANDLE_COMPOSER_PROPERTY(controlledproperty, m_ControlledProperty, TDataStrPtr, L"")
#define ITERATE_COMPOSER_SLIDE_PROPERTIES \
HANDLE_COMPOSER_PROPERTY(componentid, m_ComponentId, SLong4, 0) \
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp
index edaf49ad..c9a453c3 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp
@@ -1366,9 +1366,8 @@ public:
CompleteMetaDataType::Enum inDataType,
const SValue &inDefaultValue,
const TMetaDataData &inMetaData, TStrType inGroupName,
- Qt3DSDMInstanceHandle inDataInputSource,
bool inIsHidden, bool inIsAnimatable,
- bool inIsControlled) override
+ bool inIsControllable) override
{
SMetaDataPropertyInfo *infoPtr = FindProperty(inPropertyHandle);
if (infoPtr == NULL) {
@@ -1382,9 +1381,8 @@ public:
inDefaultValue, inMetaData);
newInfo.m_IsHidden = inIsHidden;
newInfo.m_Animatable = inIsAnimatable;
- newInfo.m_IsControlledByDataInput = inIsControlled;
+ newInfo.m_Controllable = inIsControllable;
newInfo.m_GroupName = inGroupName;
- newInfo.m_DataInputSource = inDataInputSource;
EnsureDataCoreProperty(newInfo);
SetItemInfo(__FILE__, __LINE__, inPropertyHandle, oldInfo, newInfo, m_Properties,
@@ -2288,6 +2286,8 @@ public:
inArchive.Att(L"hidden", inItem.m_IsHidden);
if (inItem.m_Animatable == false)
inArchive.Att(L"animatable", inItem.m_Animatable);
+ if (inItem.m_Controllable == true)
+ inArchive.Att(L"controllable", inItem.m_Controllable);
NVConstDataRef<SPropertyFilterInfo> theInfos = GetMetaDataPropertyFilters(inHandle);
for (QT3DSU32 idx = 0, end = theInfos.size(); idx < end; ++idx) {
const SPropertyFilterInfo &theInfo(theInfos[idx]);
@@ -2314,6 +2314,7 @@ public:
SerializePropertyBase(inArchive, inItem);
inArchive.Att(L"hidden", inItem.m_IsHidden);
inArchive.Att(L"animatable", inItem.m_Animatable);
+ inArchive.Att(L"controllable", inItem.m_Controllable);
inArchive.Att(L"category", inItem.m_GroupName);
}
@@ -2725,9 +2726,8 @@ public:
theInfo.m_Description, theInfo.m_Usage,
theInfo.m_CompleteType, theInfo.m_DefaultValue,
theInfo.m_MetaDataData, theInfo.m_GroupName,
- theInfo.m_DataInputSource,
theInfo.m_IsHidden, theInfo.m_Animatable,
- theInfo.m_IsControlledByDataInput);
+ theInfo.m_Controllable);
CreateInstanceGroupInfo(theInfo);
theProperties.push_back(theProperty);
ReadChildren(inReader, theInfo, theProperty);
@@ -3072,11 +3072,11 @@ public:
SetMetaDataPropertyInfo(theProp, theInfo.m_Name, theInfo.m_FormalName,
theInfo.m_Description, theInfo.m_Usage, theInfo.m_CompleteType,
theInfo.m_DefaultValue, theInfo.m_MetaDataData,
- theInfo.m_GroupName, theInfo.m_DataInputSource,
- true, theInfo.m_Animatable,
- theInfo.m_IsControlledByDataInput);
+ theInfo.m_GroupName, true, theInfo.m_Animatable,
+ theInfo.m_Controllable);
}
}
+
static inline void GetShaderName(const TCharStr &inObjectName,
const char8_t *inShaderSpecificName,
eastl::string &outShaderName)
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.h
index 1d7965a4..03e3a178 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.h
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.h
@@ -188,9 +188,8 @@ public:
CompleteMetaDataType::Enum inDataType,
const SValue &inDefaultValue,
const TMetaDataData &inMetaData, TStrType inGroupName,
- Qt3DSDMInstanceHandle inDataInputSource = 0,
bool inIsHidden = false, bool inIsAnimatable = false,
- bool inisControlled = false ) = 0;
+ bool inIsControllable = false) = 0;
// Destroy just this meta data property
// Does not destroy the underlying data core property, so this function isn't a perfect
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaDataTypes.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaDataTypes.h
index ec94a3bc..ead6c4ff 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaDataTypes.h
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaDataTypes.h
@@ -153,9 +153,7 @@ struct SMetaDataPropertyInfo : SMetaPropertyBase
{
Qt3DSDMInstanceHandle m_Instance;
Qt3DSDMPropertyHandle m_Property;
- // TODO set these properties
- Qt3DSDMInstanceHandle m_DataInputSource; // controller for this property
- bool m_IsControlledByDataInput; // Is this property controlled externally from datainput
+ 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
@@ -172,17 +170,15 @@ struct SMetaDataPropertyInfo : SMetaPropertyBase
m_IsHidden = false;
// We default to being animatable
m_Animatable = true;
- // Default to not being controlled with controlling datainput handle
- // being zero
- m_IsControlledByDataInput = false;
- m_DataInputSource = 0;
+ // Default to not being controlled
+ m_Controllable = false;
}
bool operator==(const SMetaDataPropertyInfo &inOther) const
{
return m_Instance == inOther.m_Instance && m_Property == inOther.m_Property
&& m_IsHidden == inOther.m_IsHidden && m_Animatable == inOther.m_Animatable
&& m_GroupName == inOther.m_GroupName
- && m_IsControlledByDataInput == inOther.m_IsControlledByDataInput
+ && m_Controllable == inOther.m_Controllable
&& SMetaPropertyBase::operator==(inOther);
}
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMSignals.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMSignals.h
index 6cf242f4..57b96591 100644
--- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMSignals.h
+++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMSignals.h
@@ -514,6 +514,8 @@ public:
const std::function<void(Qt3DSDMHandlerParamHandle)> &inCallback) = 0;
virtual TSignalConnectionPtr ConnectCustomReferencesModified(
const std::function<void(Qt3DSDMInstanceHandle, const TCharStr &)> &inCallback) = 0;
+ virtual TSignalConnectionPtr ConnectControlledToggled(
+ const std::function<void(Qt3DSDMInstanceHandle, Qt3DSDMPropertyHandle)> &inCallback) = 0;
};
class IStudioFullSystemSignalSender : public ISignalItem
@@ -584,6 +586,8 @@ public:
virtual void SendCustomHandlerParamModified(Qt3DSDMHandlerParamHandle inParameter) = 0;
virtual void SendCustomReferencesModified(Qt3DSDMInstanceHandle inOwner,
const TCharStr &inString) = 0;
+ virtual void SendControlledToggled(Qt3DSDMInstanceHandle inInstance,
+ Qt3DSDMPropertyHandle inProperty) = 0;
};
// Use this if you want to register for only a specific instance or specific property
diff --git a/src/Authoring/QT3DSDM/Systems/SignalsImpl.cpp b/src/Authoring/QT3DSDM/Systems/SignalsImpl.cpp
index 42ad114b..6f42516b 100644
--- a/src/Authoring/QT3DSDM/Systems/SignalsImpl.cpp
+++ b/src/Authoring/QT3DSDM/Systems/SignalsImpl.cpp
@@ -1059,6 +1059,7 @@ Q_SIGNALS:
void instanceDeleted(Qt3DSDMInstanceHandle);
void animationCreated(Qt3DSDMAnimationHandle, Qt3DSDMInstanceHandle, Qt3DSDMPropertyHandle);
void animationDeleted(Qt3DSDMAnimationHandle, Qt3DSDMInstanceHandle, Qt3DSDMPropertyHandle);
+ void controlledToggled(Qt3DSDMInstanceHandle, Qt3DSDMPropertyHandle);
void keyframeInserted(Qt3DSDMAnimationHandle, Qt3DSDMKeyframeHandle);
void keyframeErased(Qt3DSDMAnimationHandle, Qt3DSDMKeyframeHandle);
void keyframeUpdated(Qt3DSDMKeyframeHandle);
@@ -1165,7 +1166,6 @@ public:
{
return CONNECT_SIGNAL_QT(&CStudioFullSystemSignaller::instanceDeleted);
}
-
virtual TSignalConnectionPtr
ConnectAnimationCreated(const std::function<void(Qt3DSDMAnimationHandle, Qt3DSDMInstanceHandle,
Qt3DSDMPropertyHandle)> &inCallback) override
@@ -1307,6 +1307,12 @@ public:
{
return CONNECT_SIGNAL_QT(&CStudioFullSystemSignaller::customReferencesModified);
}
+ TSignalConnectionPtr ConnectControlledToggled(
+ const std::function<void(
+ Qt3DSDMInstanceHandle, Qt3DSDMPropertyHandle)> &inCallback) override
+ {
+ return CONNECT_SIGNAL_QT(&CStudioFullSystemSignaller::controlledToggled);
+ }
virtual void SendChangeSetBegin()
{
@@ -1539,6 +1545,13 @@ public:
CHECK_SIGNALS_ENABLED();
Q_EMIT customReferencesModified(inOwner, inString);
}
+
+ void SendControlledToggled(Qt3DSDMInstanceHandle inInstance,
+ Qt3DSDMPropertyHandle inProperty) override
+ {
+ CHECK_SIGNALS_ENABLED();
+ Q_EMIT controlledToggled(inInstance, inProperty);
+ }
};
TSignalItemPtr
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
index b7b38455..53a16861 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
@@ -58,6 +58,7 @@
#include "ClientDataModelBridge.h"
#include "IDocumentReader.h"
#include "IStudioRenderer.h"
+#include "foundation/Qt3DSLogging.h"
static QStringList renderableItems()
{
@@ -347,12 +348,15 @@ InspectorControlBase* InspectorControlModel::createItem(Qt3DSDMInspectable *insp
item->m_animatable = metaProperty.m_Animatable &&
studio->GetAnimationSystem()->IsPropertyAnimatable(item->m_instance,
metaProperty.m_Property);
+
+ item->m_controllable = metaProperty.m_Controllable;
+
+ auto signalProvider = studio->GetFullSystemSignalProvider();
if (item->m_animatable) {
item->m_animated = studio->GetAnimationSystem()->IsPropertyAnimated(item->m_instance,
metaProperty.m_Property);
// Update the Animate Toggle on undo/redo
- auto signalProvider = studio->GetFullSystemSignalProvider();
item->m_connections.push_back(signalProvider->ConnectAnimationCreated(
std::bind(&InspectorControlModel::updateAnimateToggleState,
this, item)));
@@ -362,6 +366,21 @@ InspectorControlBase* InspectorControlModel::createItem(Qt3DSDMInspectable *insp
this, item)));
}
+ if (item->m_controllable) {
+ // get the current control status for this element
+ qt3dsdm::SValue currPropVal = currentPropertyValue(
+ item->m_instance, studio->GetPropertySystem()->GetAggregateInstancePropertyByName(
+ item->m_instance, qt3dsdm::TCharStr(L"controlledproperty")));
+ QString currPropValStr = qt3dsdm::get<QString>(currPropVal);
+ Q3DStudio::CString propertyNameStr = metaProperty.m_Name.c_str();
+ // is this property controlled in this element?
+ item->m_controlled = currPropValStr.contains(propertyNameStr.toQString());
+
+ m_controlledToggleConnection = signalProvider->ConnectControlledToggled(
+ std::bind(&InspectorControlModel::updateControlledToggleState,
+ this, item));
+ }
+
// synchronize the value itself
updatePropertyValue(item);
return item;
@@ -378,6 +397,12 @@ qt3dsdm::SValue InspectorControlModel::currentPropertyValue(long instance, int h
return value;
}
+void InspectorControlModel::updateControlledToggleState(InspectorControlBase* inItem)
+{
+ inItem->m_controlled = !inItem->m_controlled;
+ Q_EMIT inItem->controlledChanged();
+}
+
void InspectorControlModel::updateAnimateToggleState(InspectorControlBase* inItem)
{
const auto studio = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem();
@@ -891,6 +916,37 @@ void InspectorControlModel::setSlideSelection(long instance, int handle, int ind
->SetInstancePropertyValue(instance, handle, newSelectedData);
}
+void InspectorControlModel::setPropertyControlled(long instance, int property, bool controlled)
+{
+ CDoc *doc = g_StudioApp.GetCore()->GetDoc();
+ const auto studio = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem();
+ CClientDataModelBridge *theBridge = studio->GetClientDataModelBridge();
+ IObjectReferenceHelper *objRefHelper = doc->GetDataModelObjectReferenceHelper();
+
+ Q3DStudio::CString instancepath = Q3DStudio::CString(
+ objRefHelper->GetObjectReferenceString(doc->GetSceneInstance(),
+ CRelativePathTools::EPATHTYPE_GUID, instance));
+ // TODO this is test code, hardwired for item named DataInput
+ // We need to have the datainput handle or name as input to this
+ // function, coming from dialog
+ Q3DStudio::CString controller = Q3DStudio::CString("this.DataInput");
+
+ bool theFullResolvedFlag;
+ CRelativePathTools::EPathType type;
+ qt3dsdm::Qt3DSDMInstanceHandle controllerhandle
+ = CRelativePathTools::FindAssetInstanceByObjectPath(
+ doc, doc->GetActiveRootInstance(), controller,
+ type, theFullResolvedFlag, objRefHelper);
+
+ Q3DStudio::SCOPED_DOCUMENT_EDITOR(*doc, QObject::tr("Set Property Controlled"))
+ ->SetInstancePropertyControlled(instance, instancepath, property,
+ controllerhandle, controlled);
+
+ const auto signalSender
+ = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetFullSystemSignalSender();
+ signalSender->SendControlledToggled(instance, property);
+}
+
void InspectorControlModel::setPropertyAnimated(long instance, int handle, bool animated)
{
CCmd* cmd = nullptr;
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
index 493d4dd2..36bfef06 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
@@ -67,6 +67,8 @@ class InspectorControlBase : public QObject
Q_PROPERTY(bool animatable MEMBER m_animatable CONSTANT)
Q_PROPERTY(bool animated MEMBER m_animated NOTIFY animatedChanged)
+ Q_PROPERTY(bool controlled MEMBER m_controlled NOTIFY controlledChanged)
+ Q_PROPERTY(bool controllable MEMBER m_controllable CONSTANT)
public:
virtual ~InspectorControlBase();
@@ -75,6 +77,7 @@ Q_SIGNALS:
void valueChanged();
void valuesChanged();
void animatedChanged();
+ void controlledChanged();
public:
qt3dsdm::DataModelDataType::Value m_dataType;
@@ -89,6 +92,8 @@ public:
bool m_animatable = false;
bool m_animated = false;
+ bool m_controlled = false;
+ bool m_controllable = false;
std::vector<qt3dsdm::TSignalConnectionPtr> m_connections;
};
@@ -125,6 +130,7 @@ public:
Q_INVOKABLE void setSlideSelection(long instance, int handle, int index,
const QStringList &list);
Q_INVOKABLE void setPropertyAnimated(long instance, int handle, bool animated);
+ Q_INVOKABLE void setPropertyControlled(long instance, int handle, bool controlled);
private:
void onSlideRearranged(const qt3dsdm::Qt3DSDMSlideHandle &inMaster, int inOldIndex,
@@ -160,10 +166,12 @@ private:
void rebuildTree();
void refreshTree();
void notifyInstancePropertyValue(qt3dsdm::Qt3DSDMInstanceHandle, qt3dsdm::Qt3DSDMPropertyHandle inProperty);
- void updateAnimateToggleState(InspectorControlBase* inItem);
+ void updateAnimateToggleState(InspectorControlBase *inItem);
+ void updateControlledToggleState(InspectorControlBase *inItem);
std::shared_ptr<qt3dsdm::ISignalConnection> m_notifier;
std::shared_ptr<qt3dsdm::ISignalConnection> m_slideNotifier;
+ std::shared_ptr<qt3dsdm::ISignalConnection> m_controlledToggleConnection;
QStringList materialValues() const;
InspectorControlBase *createMaterialItem(Qt3DSDMInspectable *inspectable, int groupIndex);
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
index f86119b1..758572e2 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
@@ -180,6 +180,43 @@ Rectangle {
}
}
+ Item {
+ Layout.alignment: Qt.AlignTop
+ width: controlledPropertyButton.sourceSize.width
+ height: _controlBaseHeight
+ visible: model.modelData.controllable
+ Image {
+ id: controlledPropertyButton
+
+ property bool controlled: model.modelData.controlled
+
+ anchors.fill: parent
+ fillMode: Image.Pad
+
+ source: {
+ _resDir + (controlled
+ ? "Objects-DataInput-Normal.png"
+ : "Objects-DataInput-Disabled.png")
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton | Qt.LeftButton
+ onClicked: {
+ if (mouse.button === Qt.LeftButton) {
+ _inspectorModel.setPropertyControlled(
+ model.modelData.instance,
+ model.modelData.handle,
+ !model.modelData.controlled)
+ } else {
+ const coords = mapToItem(root, mouse.x, mouse.y);
+ groupDelegateItem.showContextMenu(coords);
+ }
+ }
+ }
+ }
+ }
+
Item {
// Spacer item
diff --git a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
index e6e83e4f..a81607bb 100644
--- a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
+++ b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp
@@ -453,6 +453,7 @@ struct STranslatorDataModelParser
#define Text_Leading m_Text.m_Leading
#define Text_Tracking m_Text.m_Tracking
#define Text_TextColor m_Text.m_TextColor
+#define Text_ControlledProperty m_Text.m_ControlledProperty
#define Text_EnableAcceleratedFont m_Text.m_EnableAcceleratedFont
#define Path_Width m_Path.m_Width
#define Path_LinearError m_Path.m_LinearError
@@ -904,14 +905,52 @@ struct SDataInputTranslator : public SGraphObjectTranslator
SGraphObjectTranslator::PushTranslation(inContext);
qt3ds::render::SDataInput &theItem =
static_cast<qt3ds::render::SDataInput &>(GetGraphObject());
+
STranslatorDataModelParser theParser(inContext, GetInstanceHandle());
+
ITERATE_QT3DS_RENDER_DATAINPUT_PROPERTIES
+
+ // Handle incoming controlled element - property pairs
+ CRegisteredString incomingElemProp = CRegisteredString();
+ theParser.ParseProperty(
+ inContext.m_ObjectDefinitions.m_DataInput.m_ControlledElemProp,
+ incomingElemProp);
+ qt3ds::render::IStringTable &theStrTable(inContext.m_Context.GetStringTable());
+
+ QVector<QPair<CRegisteredString, CRegisteredString>> newVec
+ = ResolveControlledElemProps(incomingElemProp.c_str(), theStrTable);
+ theItem.SetControlledElementProperties(newVec);
}
void AppendChild(SGraphObject &inChild) override {}
void ClearChildren() override { }
void SetActive(bool /*inActive*/) override {}
+
+ QVector<QPair<CRegisteredString, CRegisteredString>> ResolveControlledElemProps(
+ std::string elemProp, qt3ds::render::IStringTable &strTable)
+ {
+ if (!elemProp.size())
+ return QVector<QPair<CRegisteredString, CRegisteredString>>();
+
+ QVector<QPair<CRegisteredString, CRegisteredString>> ret;
+ std::string theStr = elemProp;
+ std::string theCurrentElemStr;
+ std::string theCurrentPropStr;
+ std::string::size_type thePos = 0;
+ while (thePos < theStr.length()) {
+ theCurrentElemStr = theStr.substr(thePos, theStr.find(' ', thePos) - thePos);
+ thePos += theCurrentElemStr.length() + 1;
+
+ theCurrentPropStr = theStr.substr(thePos, theStr.find(' ', thePos) - thePos);
+ thePos += theCurrentPropStr.length() + 1;
+
+ ret.append(QPair<CRegisteredString, CRegisteredString>(
+ strTable.RegisterStr(theCurrentElemStr.c_str()),
+ strTable.RegisterStr(theCurrentPropStr.c_str())));
+ }
+ return ret;
+ }
};
struct SPathTranslator : public SNodeTranslator
diff --git a/src/Runtime/Source/Engine/Source/Qt3DSRenderRuntimeBindingImplTranslation.cpp b/src/Runtime/Source/Engine/Source/Qt3DSRenderRuntimeBindingImplTranslation.cpp
index 723575b7..4f81f124 100644
--- a/src/Runtime/Source/Engine/Source/Qt3DSRenderRuntimeBindingImplTranslation.cpp
+++ b/src/Runtime/Source/Engine/Source/Qt3DSRenderRuntimeBindingImplTranslation.cpp
@@ -628,6 +628,7 @@ struct SRuntimePropertyParser
#define Text_BackColor_B ATTRIBUTE_BACKCOLOR_B
#define Text_UseBackColor ATTRIBUTE_USEBACKCOLOR
#define Text_EnableAcceleratedFont ATTRIBUTE_ENABLEACCELERATEDFONT
+#define Text_ControlledProperty ATTRIBUTE_CONTROLLEDPROPERTY
#define Path_PathType ATTRIBUTE_PATHTYPE
#define Path_Width ATTRIBUTE_WIDTH
#define Path_LinearError ATTRIBUTE_LINEARERROR
@@ -1211,21 +1212,12 @@ struct SDataInputTranslator : public Qt3DSTranslator
SRuntimePropertyParser ControlledElementParser(presentation,
inParser.m_RenderContext,
*controlledElem);
+ ControlledElementParser.Setup(
+ Q3DStudio::CHash::HashAttribute(elemAndProperty.second),
+ inParser.m_Value, inParser.m_Type);
switch (inParser.m_PropertyName) {
-
- case Q3DStudio::ATTRIBUTE_VALUESTR:
case Q3DStudio::ATTRIBUTE_VALUE:
- // TODO remove
- qCDebug(qt3ds::TRACE_INFO) << "SDataInputTranslator OnSpecificPropertyChange "
- << Q3DStudio::GetAttributeString(
- (Q3DStudio::EAttribute)inParser.m_PropertyName)
- << " " << inParser.m_Value.m_FLOAT;
-
- ControlledElementParser.Setup(
- Q3DStudio::CHash::HashAttribute(elemAndProperty.second),
- inParser.m_Value, inParser.m_Type);
-
// Instead of generic macro, iterate through object types that are relevant for
// DataInput control and which have propertychange handler
switch (controlledTranslator->GetUIPType()) {
@@ -1293,6 +1285,16 @@ struct SDataInputTranslator : public Qt3DSTranslator
QT3DS_ASSERT(false);
break;
}
+ break;
+ case Q3DStudio::ATTRIBUTE_VALUESTR:
+ if (controlledTranslator->GetUIPType() == GraphObjectTypes::Text) {
+ (reinterpret_cast<STextTranslator *>(controlledTranslator))
+ ->OnSpecificPropertyChange(ControlledElementParser);
+ (reinterpret_cast<STextTranslator *>(controlledTranslator))
+ ->PostPropertyChanged(ControlledElementParser,
+ *m_Element->GetBelongedPresentation());
+ }
+ break;
// TODO handle remaining properties
// (timefrom/to)
default:
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.cpp
index 89abe50a..2b950659 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.cpp
@@ -51,6 +51,7 @@ SText::SText()
: SNode(GraphObjectTypes::Text)
, m_TextColor(1, 1, 1)
, m_TextTexture(NULL)
+ , m_ControlledProperty(CRegisteredString())
{
m_Bounds.setEmpty();
}
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.h b/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.h
index ea8fb850..79f953c7 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.h
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.h
@@ -45,7 +45,8 @@ namespace render {
// These properties can change every frame with no additional cost.
QT3DSVec3 m_TextColor;
-
+ // Used by Editor to keep track of controlled properties in this element
+ CRegisteredString m_ControlledProperty;
// Setup and utilized by the rendering system
NVRenderTexture2D *m_TextTexture;
STextTextureDetails m_TextTextureDetails;
@@ -67,6 +68,7 @@ namespace render {
SNode::Remap(inRemapper);
inRemapper.Remap(m_Text);
inRemapper.Remap(m_Font);
+ inRemapper.Remap(m_ControlledProperty);
inRemapper.NullPtr(m_TextTexture);
inRemapper.NullPtr(m_PathFontItem);
inRemapper.NullPtr(m_PathFontDetails);
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h
index c28faee2..86eba3db 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h
@@ -437,7 +437,8 @@ namespace render {
HANDLE_QT3DS_RENDER_PROPERTY(Text, Tracking, TextDirty) \
HANDLE_QT3DS_RENDER_COLOR_VEC3_PROPERTY(Text, TextColor, Dirty) \
HANDLE_QT3DS_RENDER_COLOR_PROPERTY(Text, TextColor, Dirty) \
- HANDLE_QT3DS_RENDER_PROPERTY(Text, EnableAcceleratedFont, Dirty)
+ HANDLE_QT3DS_RENDER_PROPERTY(Text, EnableAcceleratedFont, Dirty) \
+ HANDLE_QT3DS_RENDER_PROPERTY(Text, ControlledProperty, Dirty)
#define ITERATE_QT3DS_RENDER_PATH_PROPERTIES \
HANDLE_QT3DS_RENDER_ENUM_PROPERTY(Path, PathType, Dirty) \
@@ -463,8 +464,8 @@ namespace render {
HANDLE_QT3DS_RENDER_PROPERTY(DataInput, Value, Dirty) \
HANDLE_QT3DS_RENDER_PROPERTY(DataInput, ValueStr, Dirty) \
HANDLE_QT3DS_RENDER_PROPERTY(DataInput, TimeFrom, Dirty) \
- HANDLE_QT3DS_RENDER_PROPERTY(DataInput, ControlledElemProp, Dirty) \
- HANDLE_QT3DS_RENDER_PROPERTY(DataInput, TimeTo, Dirty)
+ HANDLE_QT3DS_RENDER_PROPERTY(DataInput, TimeTo, Dirty) \
+ HANDLE_QT3DS_RENDER_PROPERTY(DataInput, ControlledElemProp, Dirty)
}
}
#endif
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPLoader.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPLoader.cpp
index 881e0dd5..29dd0510 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPLoader.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPLoader.cpp
@@ -810,6 +810,7 @@ struct SRenderUIPLoader : public IDOMReferenceResolver
#define Text_TextColor "textcolor"
#define Text_BackColor "backcolor"
#define Text_EnableAcceleratedFont "enableacceleratedfont"
+#define Text_ControlledProperty "controlledproperty"
#define Layer_ProgressiveAAMode "progressiveaa"
#define Layer_MultisampleAAMode "multisampleaa"
#define Light_Scope "scope"
diff --git a/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.h b/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.h
index b5f8d8bf..191ce9eb 100644
--- a/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.h
+++ b/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.h
@@ -256,6 +256,7 @@ enum EAttribute {
ATTRIBUTE_TIMEFROM = 0x01028DC9, // timefrom
ATTRIBUTE_TIMETO = 0x000AE5D8, // timeto
ATTRIBUTE_CONTROLLEDELEMPROP = 0x021D0620, // controlledelemprop
+ ATTRIBUTE_CONTROLLEDPROPERTY = 0x022C0A1D, // controlledproperty
ATTRIBUTE_QT_IO = 0x010EF2CF, // qt.io
}; // enum EAttribute
diff --git a/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.txt b/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.txt
index 925e5720..1dc55eb6 100644
--- a/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.txt
+++ b/src/Runtime/Source/Runtime/Include/Qt3DSAttributeHashes.txt
@@ -229,4 +229,4 @@ valuestr
timefrom
timeto
controlledelemprop
-
+controlledproperty
diff --git a/src/Runtime/Source/Runtime/Source/Qt3DSAttributeHashes.cpp b/src/Runtime/Source/Runtime/Source/Qt3DSAttributeHashes.cpp
index 6839b438..4face028 100644
--- a/src/Runtime/Source/Runtime/Source/Qt3DSAttributeHashes.cpp
+++ b/src/Runtime/Source/Runtime/Source/Qt3DSAttributeHashes.cpp
@@ -265,6 +265,7 @@ const char *GetAttributeString(const EAttribute inAttribute)
case ATTRIBUTE_TIMEFROM: return "timefrom";
case ATTRIBUTE_TIMETO: return "timeto";
case ATTRIBUTE_CONTROLLEDELEMPROP: return "controlledelemprop";
+ case ATTRIBUTE_CONTROLLEDPROPERTY: return "controlledproperty";
case ATTRIBUTE_QT_IO: return "qt.io";
default: {
static char s_UnknownHash[16];
diff --git a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml
index 4b2c9fd8..344d747b 100644
--- a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml
+++ b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml
@@ -433,6 +433,8 @@
<Text>
<Property name="name" formalName="Name" type="String" default="Text" hidden="True" />
<Property name="textstring" formalName="Text String" description="Text String" type="MultiLineString" default="Text" />
+ <!-- Set controllable to true when enabling
+ <Property name="textstring" formalName="Text String" description="Text String" type="MultiLineString" default="Text" controllable="True" /> -->
<Property name="textcolor" formalName="Text Color" description="Text Color" type="Color" default="1 1 1" />
<Property name="font" formalName="Font" description="Font" type="Font" default="TitilliumWeb-Regular" />
<!-- HW accelerated fonts not supported