diff --git a/src/animation/editor/controller_editor.cpp b/src/animation/editor/controller_editor.cpp index 6e5f1d2376..391596adf5 100644 --- a/src/animation/editor/controller_editor.cpp +++ b/src/animation/editor/controller_editor.cpp @@ -911,7 +911,7 @@ struct ControllerEditorImpl : ControllerEditor, AssetBrowser::IPlugin, AssetComp ImGui::Columns(); if (ImGuiEx::IconButton(ICON_FA_PLUS_CIRCLE, "Add animation")) { Controller::AnimationEntry& entry = m_controller.m_animation_entries.emplace(); - entry.animation = nullptr; + entry.animation = Path(); entry.set = set_idx; entry.slot = 0; saveUndo(true); diff --git a/src/animation/editor/editor_nodes.cpp b/src/animation/editor/editor_nodes.cpp index 21f52098b1..a8f036899e 100644 --- a/src/animation/editor/editor_nodes.cpp +++ b/src/animation/editor/editor_nodes.cpp @@ -644,8 +644,23 @@ anim::Node* MathNode::compile(anim::Controller& controller) { } } +static bool isCompare(anim::NodeType type) { + switch (type) { + case anim::NodeType::CMP_EQ: + case anim::NodeType::CMP_GT: + case anim::NodeType::CMP_GTE: + case anim::NodeType::CMP_LT: + case anim::NodeType::CMP_LTE: + case anim::NodeType::CMP_NEQ: + return true; + default: + return false; + } +} + anim::Value::Type MathNode::getReturnType() { ValueNode* input0 = castToValueNode(getInput(0)); + if (isCompare(m_type)) return anim::Value::BOOL; if (!input0) return anim::Value::NUMBER; return input0->getReturnType(); } diff --git a/src/engine/path.cpp b/src/engine/path.cpp index 3a3211fa00..c3a95b4e61 100644 --- a/src/engine/path.cpp +++ b/src/engine/path.cpp @@ -74,12 +74,12 @@ bool Path::operator!=(const char* rhs) const { } bool Path::operator==(const Path& rhs) const { - ASSERT(equalIStrings(m_path, rhs.m_path) == (m_hash == rhs.m_hash)); + ASSERT(equalStrings(m_path, rhs.m_path) == (m_hash == rhs.m_hash)); return m_hash == rhs.m_hash; } bool Path::operator!=(const Path& rhs) const { - ASSERT(equalIStrings(m_path, rhs.m_path) == (m_hash == rhs.m_hash)); + ASSERT(equalStrings(m_path, rhs.m_path) == (m_hash == rhs.m_hash)); return m_hash != rhs.m_hash; } diff --git a/src/engine/string.h b/src/engine/string.h index 9a7f04b57c..ae4496bf70 100644 --- a/src/engine/string.h +++ b/src/engine/string.h @@ -17,7 +17,7 @@ LUMIX_ENGINE_API int stringLength(const char* str); struct StringView { StringView() {} - StringView(const char* str) : begin(str), end(str + stringLength(str)) {} + StringView(const char* str) : begin(str), end(str ? str + stringLength(str) : 0) {} StringView(const char* str, u32 len) : begin(str), end(str + len) {} StringView(const char* begin, const char* end) : begin(begin), end(end) {} template StringView(const StaticString& str); diff --git a/src/physics/physics_module.cpp b/src/physics/physics_module.cpp index 6df31cf41e..903a53b1d4 100644 --- a/src/physics/physics_module.cpp +++ b/src/physics/physics_module.cpp @@ -457,6 +457,12 @@ struct PhysicsModuleImpl final : PhysicsModule } m_joints.clear(); + // we have to reset mesh of rigid actor before calling m_actors.clear + // because ~RigidActor accesses m_actors, which might already contain invalid values in m_actors.clear() + for (RigidActor& a : m_actors) { + a.setMesh(nullptr); + } + m_actors.clear(); m_dynamic_actors.clear();