From e0adc43255d4002ba5d4053c69166a8a5b5fcbf0 Mon Sep 17 00:00:00 2001 From: DMotorygin Date: Tue, 14 Nov 2023 12:14:14 -0800 Subject: [PATCH] Fix animation rigged referenced scenes transform issue (#417) --- FireRender.Maya.Src/Context/FireRenderContext.h | 4 ++++ FireRender.Maya.Src/FireRenderObjects.cpp | 11 ++++++++++- FireRender.Maya.Src/FireRenderUtils.h | 6 ++++++ FireRender.Maya.Src/frWrap.h | 10 +++++++++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/FireRender.Maya.Src/Context/FireRenderContext.h b/FireRender.Maya.Src/Context/FireRenderContext.h index 18c63daf..48043e46 100644 --- a/FireRender.Maya.Src/Context/FireRenderContext.h +++ b/FireRender.Maya.Src/Context/FireRenderContext.h @@ -563,6 +563,10 @@ class FireRenderContext : public IFireRenderContextInfo { assert(!uuid.empty()); +#ifdef _DEBUG + std::string uuidNameWithoutInstanceIndex = FireRenderObject::uuidWithoutInstanceNumberForString(uuid); +#endif + auto it = m_mainMeshesDictionary.find(FireRenderObject::uuidWithoutInstanceNumberForString(uuid)); if (it != m_mainMeshesDictionary.end()) diff --git a/FireRender.Maya.Src/FireRenderObjects.cpp b/FireRender.Maya.Src/FireRenderObjects.cpp index 64a8f246..e9d8a290 100644 --- a/FireRender.Maya.Src/FireRenderObjects.cpp +++ b/FireRender.Maya.Src/FireRenderObjects.cpp @@ -99,7 +99,16 @@ std::string FireRenderObject::uuidWithoutInstanceNumber() const std::string FireRenderObject::uuidWithoutInstanceNumberForString(const std::string& uuid) { - return splitString(uuid, ':')[0]; + size_t pos = uuid.find_last_of(":"); + if (pos == std::string::npos) + return uuid; + + if (!isNumber(uuid.substr(pos + 1, std::string::npos))) + return uuid; + + std::string ret = uuid.substr(0, pos); + + return ret; } void FireRenderObject::setDirty() diff --git a/FireRender.Maya.Src/FireRenderUtils.h b/FireRender.Maya.Src/FireRenderUtils.h index 82d47410..0f22babb 100644 --- a/FireRender.Maya.Src/FireRenderUtils.h +++ b/FireRender.Maya.Src/FireRenderUtils.h @@ -1259,6 +1259,12 @@ std::vector splitString(const T& s, typename T::traits_type::char_type delim) return elems; } +template +bool isNumber(const std::string& s) +{ + return !s.empty() && std::all_of(s.begin(), s.end(), ::isdigit); +} + // Backdoor to enable different AOVs from Render Settings in IPR and Viewport void EnableAOVsFromRSIfEnvVarSet(FireRenderContext& context, FireRenderAOVs& aovs); diff --git a/FireRender.Maya.Src/frWrap.h b/FireRender.Maya.Src/frWrap.h index eb6c710d..685119df 100644 --- a/FireRender.Maya.Src/frWrap.h +++ b/FireRender.Maya.Src/frWrap.h @@ -3787,7 +3787,15 @@ namespace frw { rpr_int res = rprMaterialNodeSetID(Handle(), id); - assert(res == MStatus::kSuccess); + if (res == RPR_ERROR_UNSUPPORTED || + res == RPR_ERROR_INVALID_PARAMETER) + { + // should not cancel execution if such error happens + } + else + { + checkStatus(res); + } } };