diff --git a/CHANGELOG.md b/CHANGELOG.md index df6c251..fd82827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ +# v1.4.6 + +**CHANGED** + +* SkinBindings are now updated at the end of logic update + # v1.4.5 **FIXED** -- SkinBinding update order bug where skin bindings use old values in update +* SkinBinding update order bug where skin bindings use old values in update # v1.4.4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ce468f..05c2019 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ cmake_minimum_required(VERSION 3.13) set(RLOGIC_VERSION_MAJOR 1) set(RLOGIC_VERSION_MINOR 4) -set(RLOGIC_VERSION_PATCH 5) +set(RLOGIC_VERSION_PATCH 6) set(RLOGIC_VERSION ${RLOGIC_VERSION_MAJOR}.${RLOGIC_VERSION_MINOR}.${RLOGIC_VERSION_PATCH}) set(ramses-logic_VERSION "${RLOGIC_VERSION}" CACHE STRING "Ramses Logic version" FORCE) diff --git a/README.md b/README.md index 7c0d2f4..2a4ff2d 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ existing files exported with Logic Engine version **W** or newer (Binary file co |Logic | Included Ramses version | Minimum required Ramses version | Binary file compatibility | |----------|-------------------------------|------------------------------------|------------------------------| +|v1.4.6 | 27.0.139 | 27.0.102 | >= 1.0.0, F-Levels 01 - 05 | |v1.4.5 | 27.0.139 | 27.0.102 | >= 1.0.0, F-Levels 01 - 05 | |v1.4.4 | 27.0.139 | 27.0.102 | >= 1.0.0, F-Levels 01 - 05 | |v1.4.3 | 27.0.130 | 27.0.102 | >= 1.0.0, F-Levels 01 - 05 | diff --git a/lib/impl/LogicEngineImpl.cpp b/lib/impl/LogicEngineImpl.cpp index 603bd22..754c7a4 100644 --- a/lib/impl/LogicEngineImpl.cpp +++ b/lib/impl/LogicEngineImpl.cpp @@ -30,6 +30,7 @@ #include "impl/LuaModuleImpl.h" #include "impl/LuaConfigImpl.h" #include "impl/SaveFileConfigImpl.h" +#include "impl/SkinBindingImpl.h" #include "impl/LogicEngineReportImpl.h" #include "impl/RamsesRenderGroupBindingElementsImpl.h" @@ -436,7 +437,11 @@ namespace rlogic::internal // force dirty all timer nodes, anchor points and skinbindings setNodeToBeAlwaysUpdatedDirty(); - const bool success = updateNodes(*sortedNodes); + bool success = updateNodes(*sortedNodes); + + // update skin bindings only if updating the other nodes succeeded + if (success) + success = updateSkinBindings(); if (m_statisticsEnabled || m_updateReportEnabled) { @@ -449,13 +454,24 @@ namespace rlogic::internal return success; } + bool LogicEngineImpl::updateSkinBindings() + { + for (SkinBinding* skinBinding : m_apiObjects->getApiObjectContainer()) { + if (!updateNode(skinBinding->m_skinBinding)) { + return false; + } + } + return true; + } + bool LogicEngineImpl::updateNodes(const NodeVector& sortedNodes) { for (LogicNodeImpl* nodeIter : sortedNodes) { LogicNodeImpl& node = *nodeIter; - if (!node.isDirty()) + // skip also processing of SkinBindings, since they will be processed after updating everything else + if (!node.isDirty() || dynamic_cast(&node)) { if (m_updateReportEnabled) m_updateReport.nodeSkippedExecution(node); @@ -464,33 +480,40 @@ namespace rlogic::internal continue; } - if (m_updateReportEnabled) - m_updateReport.nodeExecutionStarted(node); - if (m_statisticsEnabled) - m_statistics.nodeExecuted(); - - const std::optional potentialError = node.update(); - if (potentialError) - { - m_errors.add(potentialError->message, m_apiObjects->getApiObject(node), EErrorType::RuntimeError); + if (!updateNode(node)) return false; - } + } - Property* outputs = node.getOutputs(); - if (outputs != nullptr) - { - const size_t activatedLinks = activateLinksRecursive(*outputs->m_impl); + return true; + } - if (m_statisticsEnabled || m_updateReportEnabled) - m_updateReport.linksActivated(activatedLinks); - } + bool LogicEngineImpl::updateNode(LogicNodeImpl& node) + { + if (m_updateReportEnabled) + m_updateReport.nodeExecutionStarted(node); + if (m_statisticsEnabled) + m_statistics.nodeExecuted(); + + const std::optional potentialError = node.update(); + if (potentialError) + { + m_errors.add(potentialError->message, m_apiObjects->getApiObject(node), EErrorType::RuntimeError); + return false; + } - if (m_updateReportEnabled) - m_updateReport.nodeExecutionFinished(); + Property* outputs = node.getOutputs(); + if (outputs != nullptr) + { + const size_t activatedLinks = activateLinksRecursive(*outputs->m_impl); - node.setDirty(false); + if (m_statisticsEnabled || m_updateReportEnabled) + m_updateReport.linksActivated(activatedLinks); } + if (m_updateReportEnabled) + m_updateReport.nodeExecutionFinished(); + node.setDirty(false); + return true; } diff --git a/lib/impl/LogicEngineImpl.h b/lib/impl/LogicEngineImpl.h index 4bcedc6..b950399 100644 --- a/lib/impl/LogicEngineImpl.h +++ b/lib/impl/LogicEngineImpl.h @@ -163,6 +163,9 @@ namespace rlogic::internal [[nodiscard]] bool updateNodes(const NodeVector& nodes); + [[nodiscard]] bool updateSkinBindings(); + [[nodiscard]] bool updateNode(LogicNodeImpl& node); + [[nodiscard]] bool loadFromByteData(const void* byteData, size_t byteSize, ramses::Scene* scene, bool enableMemoryVerification, const std::string& dataSourceDescription); [[nodiscard]] bool checkFileIdentifierBytes(const std::string& dataSourceDescription, const std::string& fileIdBytes); [[nodiscard]] const char* getFileIdentifierMatchingFeatureLevel() const;