浏览代码

POV Handles Scene dirtying correctly now

/main
Thomas ICHÉ 6 年前
当前提交
952426a6
共有 1 个文件被更改,包括 13 次插入13 次删除
  1. 26
      Editor/SceneViewPOV/SceneViewPOV.cs

26
Editor/SceneViewPOV/SceneViewPOV.cs


if (activePOV == null)
{
activePOV = CreatePOVRootObject();
}
MarkDirtyPOVScene(POVRoot);
};
POVRoot = activePOV;
}

return povRoot.AddComponent<ScenePOVRoot>();
}
static GameObject CreatePOV(GameObject povRoot, string name, Transform transform)
{
var pov = new GameObject(name);
pov.isStatic = true;
pov.hideFlags = HideFlags.HideInHierarchy;
pov.transform.position = transform.position;
pov.transform.rotation = transform.rotation;
pov.transform.parent = povRoot.transform;
return pov;
}
public static void ShowPopup(Rect buttonRect, SceneView sceneView)
{
PopupWindow.Show(buttonRect, new SceneViewPOV(sceneView));

return new Vector2(256.0f, 80.0f + POVRoot.AllPOV.Length * 20);
}
static void MarkDirtyPOVScene(ScenePOVRoot root)
{
EditorSceneManager.MarkSceneDirty(root.gameObject.scene);
}
string m_NewPOVName = "New POV";
public override void OnGUI(Rect rect)

if (GUILayout.Button("+", GUILayout.Width(32)))
{
POVRoot.AddPOV(m_SceneView.camera.transform, m_NewPOVName);
MarkDirtyPOVScene(POVRoot);
m_NewPOVName = "New POV";
}
}

if (GUILayout.Button("X", GUILayout.Width(32)))
{
if (EditorUtility.DisplayDialog("Destroy POV?", "Do you want to destroy this POV: " + pov.gameObject.name + " ?", "Yes", "No"))
GameObject.Destroy(pov.gameObject);
{
GameObject.DestroyImmediate(pov.gameObject);
MarkDirtyPOVScene(POVRoot);
}
}
}
}

正在加载...
取消
保存