chore: sync workspace state
This commit is contained in:
35
MVS/3DGS-Unity/Editor/GaussianMoveTool.cs
Normal file
35
MVS/3DGS-Unity/Editor/GaussianMoveTool.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
using GaussianSplatting.Runtime;
|
||||
using UnityEditor;
|
||||
using UnityEditor.EditorTools;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GaussianSplatting.Editor
|
||||
{
|
||||
[EditorTool("Gaussian Move Tool", typeof(GaussianSplatRenderer), typeof(GaussianToolContext))]
|
||||
class GaussianMoveTool : GaussianTool
|
||||
{
|
||||
public override void OnToolGUI(EditorWindow window)
|
||||
{
|
||||
var gs = GetRenderer();
|
||||
if (!gs || !CanBeEdited() || !HasSelection())
|
||||
return;
|
||||
var tr = gs.transform;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
var selCenterLocal = GetSelectionCenterLocal();
|
||||
var selCenterWorld = tr.TransformPoint(selCenterLocal);
|
||||
var newPosWorld = Handles.DoPositionHandle(selCenterWorld, Tools.handleRotation);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
var newPosLocal = tr.InverseTransformPoint(newPosWorld);
|
||||
var wasModified = gs.editModified;
|
||||
gs.EditTranslateSelection(newPosLocal - selCenterLocal);
|
||||
if (!wasModified)
|
||||
GaussianSplatRendererEditor.RepaintAll();
|
||||
Event.current.Use();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user