summaryrefslogtreecommitdiffstats
path: root/src/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp')
-rw-r--r--src/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp b/src/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp
index 03ad243..b19cd93 100644
--- a/src/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp
+++ b/src/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp
@@ -1362,7 +1362,7 @@ struct SDynamicObjectTranslatorContext : public STranslatorContext
}
bool ApplyChanges(SPresentation &inPresentation, IQt3DSRenderContext &inRenderContext,
SDynamicGraphObject &inObject, Q3DStudio::TElement &element,
- IDynamicObjectSystem &inSystem)
+ IDynamicObjectSystem &inSystem, int uipVersion)
{
bool ret = false;
IStringTable &strTable = element.GetBelongedPresentation()->GetStringTable();
@@ -1406,16 +1406,35 @@ struct SDynamicObjectTranslatorContext : public STranslatorContext
Q3DStudio::TElement *theElem = NULL;
theElem = element.GetBelongedPresentation()->GetApplication()
.GetElementAllocator().FindElementById(theStr);
- auto *translator = static_cast<Qt3DSTranslator *>(theElem->GetAssociation());
+ auto *translator = static_cast<Qt3DSTranslator *>(
+ theElem->GetAssociation());
img = static_cast<SImage *>(&translator->RenderObject());
if (img)
theItem.setImage(theDefinition.m_Name, img);
}
if (img) {
- dynObj.SetPropertyValue(theDefinition, str.c_str(),
- inPresentation.m_PresentationDirectory.c_str(),
- m_Workspace, inRenderContext.GetStringTable());
+ dynObj.SetPropertyValue(
+ theDefinition, str.c_str(),
+ inPresentation.m_PresentationDirectory.c_str(),
+ m_Workspace, inRenderContext.GetStringTable());
+ } else {
+ dynObj.SetPropertyValue(
+ theDefinition, {},
+ inPresentation.m_PresentationDirectory.c_str(),
+ m_Workspace, inRenderContext.GetStringTable());
}
+ } else if (uipVersion < 7) {
+ // Backwards compatibility for older versions
+ SImage *img = theItem.getImageByPropertyName(theDefinition.m_Name);
+ if (img) {
+ img->m_ImagePath = strTable.RegisterStr(theStr.c_str());
+ img->m_Flags.SetDirty(true);
+ }
+ } else {
+ dynObj.SetPropertyValue(
+ theDefinition, {},
+ inPresentation.m_PresentationDirectory.c_str(),
+ m_Workspace, inRenderContext.GetStringTable());
}
} break;
default:
@@ -1441,13 +1460,14 @@ struct SEffectTranslator : public Qt3DSTranslator
}
void OnElementChanged(SPresentation &inPresentation, IQt3DSRenderContext &inRenderContext,
- Q3DStudio::IPresentation &)
+ Q3DStudio::IPresentation &runtimePresentation)
{
SRuntimePropertyParser theParser(inPresentation, inRenderContext, *m_Element);
SEffect &theItem = *static_cast<SEffect *>(m_RenderObject);
bool dirty = static_cast<SDynamicObjectTranslatorContext *>(m_TranslatorContext)
->ApplyChanges(inPresentation, inRenderContext, theItem, Element(),
- inRenderContext.GetDynamicObjectSystem());
+ inRenderContext.GetDynamicObjectSystem(),
+ runtimePresentation.getUIPVersion());
theItem.m_Flags.SetDirty(dirty);
theItem.SetActive(Element().GetActive(), inRenderContext.GetEffectSystem());
}
@@ -1464,13 +1484,14 @@ struct SCustomMaterialTranslator : public Qt3DSTranslator
}
void OnElementChanged(SPresentation &inPresentation, IQt3DSRenderContext &inRenderContext,
- Q3DStudio::IPresentation &)
+ Q3DStudio::IPresentation &runtimePresentation)
{
SRuntimePropertyParser theParser(inPresentation, inRenderContext, *m_Element);
SCustomMaterial &theItem = *static_cast<SCustomMaterial *>(m_RenderObject);
bool dirty = static_cast<SDynamicObjectTranslatorContext *>(m_TranslatorContext)
->ApplyChanges(inPresentation, inRenderContext, theItem, Element(),
- inRenderContext.GetDynamicObjectSystem());
+ inRenderContext.GetDynamicObjectSystem(),
+ runtimePresentation.getUIPVersion());
theItem.m_Flags.SetDirty(dirty);
bool active = m_Element->GetActive();
if (active != theItem.m_Flags.IsActive()) {