From cedcbcb2f62f29b1c62e9c5b49eced455e07f40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tur=C3=A1nszki=20J=C3=A1nos?= Date: Sun, 13 Mar 2022 11:17:24 +0100 Subject: [PATCH] editor: copy-paste fixes --- Editor/Editor.cpp | 8 ++------ Editor/Translator.cpp | 9 --------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index ab7f79eb7..befe438c8 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -979,6 +979,8 @@ void EditorComponent::Update(float dt) { wi::profiler::range_id profrange = wi::profiler::BeginRangeCPU("Editor Update"); + translator.Update(*this); + Scene& scene = wi::scene::GetScene(); CameraComponent& camera = wi::scene::GetCamera(); @@ -1441,12 +1443,10 @@ void EditorComponent::Update(float dt) EntitySerializer seri; clipboard.SetReadModeAndResetPos(false); clipboard << prevSel.size(); - translator.PreTranslate(); for (auto& x : prevSel) { scene.Entity_Serialize(clipboard, seri, x); } - translator.PostTranslate(); if (wi::input::Press((wi::input::BUTTON)'X')) { @@ -1488,7 +1488,6 @@ void EditorComponent::Update(float dt) RecordSelection(archive); auto& prevSel = translator.selectedEntitiesNonRecursive; - translator.PreTranslate(); wi::vector addedEntities; for (auto& x : prevSel) { @@ -1496,7 +1495,6 @@ void EditorComponent::Update(float dt) picked.entity = scene.Entity_Duplicate(x); addedEntities.push_back(picked.entity); } - translator.PostTranslate(); ClearSelected(); @@ -1685,8 +1683,6 @@ void EditorComponent::Update(float dt) } } - translator.Update(*this); - if (translator.IsDragEnded()) { wi::Archive& archive = AdvanceHistory(); diff --git a/Editor/Translator.cpp b/Editor/Translator.cpp index 122aa2773..7c85bcb1a 100644 --- a/Editor/Translator.cpp +++ b/Editor/Translator.cpp @@ -594,8 +594,6 @@ void Translator::PostTranslate() TransformComponent* transform_selected = scene.transforms.GetComponent(x); if (transform_selected != nullptr) { - XMFLOAT4X4 worldPrev = transform_selected->world; - transform_selected->UpdateTransform_Parented(transform); // selected to world space: @@ -611,13 +609,6 @@ void Translator::PostTranslate() transform_selected->MatrixTransform(XMMatrixInverse(nullptr, XMLoadFloat4x4(&transform_parent->world))); } } - - // Restore worldPrev, so velocity buffer is correctly updated: - // (Only when dragging, otherwise if it's released, we want to record the matrix properly for undo) - if (dragging) - { - transform_selected->world = worldPrev; - } } } }