summaryrefslogtreecommitdiffstats
path: root/src/Runtime
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 /src/Runtime
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>
Diffstat (limited to 'src/Runtime')
-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
9 files changed, 28 insertions, 17 deletions
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