diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2019-06-28 10:46:43 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2019-06-28 10:46:54 +0300 |
commit | 0c4183e5748576845d9ce2aa61f56cf5c69c6350 (patch) | |
tree | dcf76e4de1dccb9646fbd35c6b9a5a1ea2009922 /src/runtime/Qt3DSQmlElementHelper.cpp | |
parent | 427bf6fac383f066a1378679a88546b16f156c7e (diff) | |
parent | 1fee43d7b31f71f1f0c9d4498fbc52a11f7338f5 (diff) |
Merge branch '2.4'
Change-Id: If71792b205f44b2cf9998ddfe03ce18a225285ca
Diffstat (limited to 'src/runtime/Qt3DSQmlElementHelper.cpp')
-rw-r--r-- | src/runtime/Qt3DSQmlElementHelper.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/runtime/Qt3DSQmlElementHelper.cpp b/src/runtime/Qt3DSQmlElementHelper.cpp index 9b58a73..0a13a1f 100644 --- a/src/runtime/Qt3DSQmlElementHelper.cpp +++ b/src/runtime/Qt3DSQmlElementHelper.cpp @@ -150,10 +150,11 @@ TElement *CQmlElementHelper::GetElement(qt3ds::runtime::IApplication &inApplicat } bool CQmlElementHelper::SetAttribute(TElement *theElement, const char *theAttName, - const void *value, bool inDelay) + const void *value) { SAttributeKey theAttributeKey; theAttributeKey.m_Hash = CHash::HashAttribute(theAttName); + bool force = false; // Early out for our single 'read only' attribute if (ATTRIBUTE_URI == theAttributeKey.m_Hash) { @@ -165,7 +166,8 @@ bool CQmlElementHelper::SetAttribute(TElement *theElement, const char *theAttNam Option<qt3ds::runtime::element::TPropertyDescAndValuePtr> thePropertyInfo = theElement->FindProperty(theAttributeKey.m_Hash); - if (!thePropertyInfo.hasValue()) { + // Do not create property for eyeball, it uses the explicit activity flag + if (!thePropertyInfo.hasValue() && theAttributeKey.m_Hash != Q3DStudio::ATTRIBUTE_EYEBALL) { // if not search in the dynamic properties thePropertyInfo = theElement->FindDynamicProperty(theAttributeKey.m_Hash); if (!thePropertyInfo.hasValue()) { @@ -178,10 +180,15 @@ bool CQmlElementHelper::SetAttribute(TElement *theElement, const char *theAttNam theElement->GetBelongedPresentation()->GetApplication().GetMetaData(); thePropertyInfo = theElemAllocator.CreateDynamicProperty( theMetaData, *theElement, theStringTable.RegisterStr(theAttName)); + force = true; } } - if (thePropertyInfo.hasValue()) { + if (theAttributeKey.m_Hash == Q3DStudio::ATTRIBUTE_EYEBALL) { + UVariant theNewValue; + theNewValue.m_INT32 = *(INT32 *)value; + theElement->SetAttribute(theAttributeKey.m_Hash, theNewValue); + } else if (thePropertyInfo.hasValue()) { UVariant theNewValue; QString name(thePropertyInfo->first.m_Name.c_str()); EAttributeType theAttributeType = thePropertyInfo->first.m_Type; @@ -203,8 +210,8 @@ bool CQmlElementHelper::SetAttribute(TElement *theElement, const char *theAttNam case ATTRIBUTETYPE_STRING: theNewValue.m_StringHandle = - theElement->GetBelongedPresentation()->GetStringTable().GetHandle( - (const char *)value); + theElement->GetBelongedPresentation()->GetStringTable().getDynamicHandle( + QByteArray(static_cast<const char *>(value))); break; case ATTRIBUTETYPE_POINTER: @@ -239,15 +246,7 @@ bool CQmlElementHelper::SetAttribute(TElement *theElement, const char *theAttNam break; } - if (inDelay) { - UVariant arg1; - arg1.m_INT32 = theAttributeKey.m_Hash; - theElement->GetBelongedPresentation()->FireCommand( - COMMAND_SETPROPERTY, theElement, &arg1, &theNewValue, ATTRIBUTETYPE_HASH, - theAttributeType); - } else { - theElement->SetAttribute(*thePropertyInfo, theNewValue); - } + theElement->SetAttribute(*thePropertyInfo, theNewValue, force); } else { return false; } @@ -266,7 +265,10 @@ bool CQmlElementHelper::GetAttribute(TElement *inElement, const char *inAttribut if (!thePropertyInfo.hasValue()) thePropertyInfo = inElement->FindDynamicProperty(theAttributeKey.m_Hash); - if (thePropertyInfo.hasValue()) { + if (theAttributeKey.m_Hash == Q3DStudio::ATTRIBUTE_EYEBALL) { + INT32 val = inElement->IsExplicitActive() ? 1 : 0; + *(INT32 *)value = val; + } else if (thePropertyInfo.hasValue()) { UVariant *theValuePtr = thePropertyInfo->second; EAttributeType theAttributeType = thePropertyInfo->first.m_Type; switch (theAttributeType) { |