protected void OnSceneGUI() { ProbeTouchupVolume touchupVolume = target as ProbeTouchupVolume; //important: if the origin of the handle's space move along the handle, //handles displacement will appears as moving two time faster. using (new Handles.DrawingScope(Matrix4x4.TRS(Vector3.zero, touchupVolume.transform.rotation, Vector3.one))) { //contained must be initialized in all case s_ShapeBox.center = Quaternion.Inverse(touchupVolume.transform.rotation) * touchupVolume.transform.position; s_ShapeBox.size = touchupVolume.size; s_ShapeBox.monoHandle = false; EditorGUI.BeginChangeCheck(); s_ShapeBox.DrawHandle(); if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(new UnityEngine.Object[] { touchupVolume, touchupVolume.transform }, "Change Probe Touchup Volume Bounding Box"); touchupVolume.size = s_ShapeBox.size; Vector3 delta = touchupVolume.transform.rotation * s_ShapeBox.center - touchupVolume.transform.position; touchupVolume.transform.position += delta;; } } }
static void DrawGizmosSelected(ProbeTouchupVolume touchupVolume, GizmoType gizmoType) { using (new Handles.DrawingScope(Matrix4x4.TRS(touchupVolume.transform.position, touchupVolume.transform.rotation, Vector3.one))) { // Bounding box. s_ShapeBox.center = Vector3.zero; s_ShapeBox.size = touchupVolume.size; s_ShapeBox.SetBaseColor(ProbeTouchupColorPreferences.GetColorPrefProbeVolumeGizmoColor()); s_ShapeBox.DrawHull(true); } }
static void DrawGizmosSelected(ProbeTouchupVolume touchupVolume, GizmoType gizmoType) { using (new Handles.DrawingScope(Matrix4x4.TRS(touchupVolume.transform.position, touchupVolume.transform.rotation, Vector3.one))) { // Bounding box. s_ShapeBox.center = Vector3.zero; s_ShapeBox.size = touchupVolume.size; s_ShapeBox.baseColor = new Color(0.75f, 0.2f, 0.18f); s_ShapeBox.DrawHull(true); } }