//---------------------------------------------------------------------------------------------------------------------- public void DrawServerSettings(MeshSyncServer t) { var styleFold = EditorStyles.foldout; styleFold.fontStyle = FontStyle.Bold; bool isServerStarted = m_meshSyncServer.IsServerStarted(); string serverStatus = isServerStarted ? "Server (Status: Started)" : "Server (Status: Stopped)"; t.foldServerSettings = EditorGUILayout.Foldout(t.foldServerSettings, serverStatus, true, styleFold); if (t.foldServerSettings) { bool autoStart = EditorGUILayout.Toggle("Auto Start", m_meshSyncServer.IsAutoStart()); m_meshSyncServer.SetAutoStartServer(autoStart); //Draw GUI that are disabled when autoStart is true EditorGUI.BeginDisabledGroup(autoStart); int serverPort = EditorGUILayout.IntField("Server Port:", (int)m_meshSyncServer.GetServerPort()); m_meshSyncServer.SetServerPort((ushort)serverPort); GUILayout.BeginHorizontal(); if (isServerStarted) { if (GUILayout.Button("Stop", GUILayout.Width(110.0f))) { m_meshSyncServer.StopServer(); } } else { if (GUILayout.Button("Start", GUILayout.Width(110.0f))) { m_meshSyncServer.StartServer(); } } GUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); string prevFolder = t.GetAssetsFolder(); string selectedFolder = AssetEditorUtility.NormalizePath( EditorGUIDrawerUtility.DrawFolderSelectorGUI("Asset Dir", "Asset Dir", prevFolder, null) ); if (selectedFolder != prevFolder) { if (string.IsNullOrEmpty(selectedFolder) || !AssetEditorUtility.IsPathNormalized(selectedFolder)) { Debug.LogError($"[MeshSync] {selectedFolder} is not under Assets. Ignoring."); } else { t.SetAssetsFolder(selectedFolder); } } Transform rootObject = (Transform)EditorGUILayout.ObjectField("Root Object", t.GetRootObject(), typeof(Transform), allowSceneObjects: true); t.SetRootObject(rootObject); EditorGUILayout.Space(); } }
//---------------------------------------------------------------------------------------------------------------------- private void DrawFolderGUI() { string prevFolder = m_asset.GetFolder(); string newLoadPath = EditorGUIDrawerUtility.DrawFolderSelectorGUI("Image Sequence", "Select Folder", prevFolder, ReloadFolder, AssetUtility.NormalizeAssetPath ); if (newLoadPath != prevFolder) { ImportImages(newLoadPath); GUIUtility.ExitGUI(); } }
//---------------------------------------------------------------------------------------------------------------------- private void DrawFolderGUI() { string prevFolder = m_asset.GetFolder(); string newLoadPath = EditorGUIDrawerUtility.DrawFolderSelectorGUI("Image Sequence", "Select Folder", prevFolder, ReloadFolder ); newLoadPath = AssetUtility.NormalizeAssetPath(newLoadPath); if (newLoadPath != prevFolder) { Undo.RecordObject(m_asset, "Change Image Sequence Folder"); ImportImages(newLoadPath); GUIUtility.ExitGUI(); } }
//---------------------------------------------------------------------------------------------------------------------- public override void OnInspectorGUI() { //View resolution Vector2 res = ViewEditorUtility.GetMainGameViewSize(); EditorGUILayout.LabelField("Resolution (Modify GameView size to change)"); ++EditorGUI.indentLevel; EditorGUILayout.LabelField("Width", res.x.ToString(CultureInfo.InvariantCulture)); EditorGUILayout.LabelField("Height", res.y.ToString(CultureInfo.InvariantCulture)); --EditorGUI.indentLevel; EditorGUILayout.Space(15f); //Check if the asset is actually inspected if (null != TimelineEditor.selectedClip && TimelineEditor.selectedClip.asset != m_asset) { return; } ValidateAssetFolder(); string prevFolder = m_asset.GetFolder(); string newFolder = EditorGUIDrawerUtility.DrawFolderSelectorGUI("Cache Output Folder", "Select Folder", prevFolder, null ); newFolder = AssetUtility.NormalizeAssetPath(newFolder); if (newFolder != prevFolder) { Undo.RecordObject(m_asset, "Change Output Folder"); m_asset.SetFolder(AssetUtility.NormalizeAssetPath(newFolder)); GUIUtility.ExitGUI(); } //Output Format EditorGUIDrawerUtility.DrawUndoableGUI(m_asset, "RenderCache Output Format", /*guiFunc=*/ () => (RenderCacheOutputFormat)EditorGUILayout.EnumPopup("Output Format:", m_asset.GetOutputFormat()), /*updateFunc=*/ (RenderCacheOutputFormat newOutputFormat) => { m_asset.SetOutputFormat(newOutputFormat); } ); RenderCacheClipData clipData = m_asset.GetBoundClipData(); if (null == clipData) { return; } GUILayout.Space(15); //Capture Selected Frames using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { DrawCaptureSelectedFramesGUI(TimelineEditor.selectedClip, clipData); DrawLockFramesGUI(TimelineEditor.selectedClip, clipData); } GUILayout.Space(15); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { EditorGUILayout.LabelField("Background Colors"); ++EditorGUI.indentLevel; RenderCachePlayableAssetEditorConfig editorConfig = m_asset.GetEditorConfig(); EditorGUIDrawerUtility.DrawUndoableGUI(m_asset, "Change Update BG Color", /*guiFunc=*/ () => EditorGUILayout.ColorField("In Game Window (Update)", editorConfig.GetUpdateBGColor()), /*updateFunc=*/ (Color newColor) => { editorConfig.SetUpdateBGColor(newColor); } ); EditorGUIDrawerUtility.DrawUndoableGUI(m_asset, "Change Timeline BG Color", /*guiFunc=*/ () => EditorGUILayout.ColorField("In Timeline Window", m_asset.GetTimelineBGColor()), /*updateFunc=*/ (Color newColor) => { m_asset.SetTimelineBGColor(newColor); } ); --EditorGUI.indentLevel; GUILayout.Space(5); } GUILayout.Space(15); DrawUpdateRenderCacheGUI(); }
//---------------------------------------------------------------------------------------------------------------------- public override void OnInspectorGUI() { //View resolution Vector2 res = ViewEditorUtility.GetMainGameViewSize(); EditorGUILayout.LabelField("Resolution (Modify GameView size to change)"); ++EditorGUI.indentLevel; EditorGUILayout.LabelField("Width", res.x.ToString(CultureInfo.InvariantCulture)); EditorGUILayout.LabelField("Height", res.y.ToString(CultureInfo.InvariantCulture)); --EditorGUI.indentLevel; EditorGUILayout.Space(15f); //Check if the asset is actually inspected if (null != TimelineEditor.selectedClip && TimelineEditor.selectedClip.asset != m_asset) { return; } ValidateAssetFolder(); string prevFolder = m_asset.GetFolder(); string newFolder = EditorGUIDrawerUtility.DrawFolderSelectorGUI("Cache Output Folder", "Select Folder", prevFolder, null, AssetUtility.NormalizeAssetPath ); if (newFolder != prevFolder) { m_asset.SetFolder(AssetUtility.NormalizeAssetPath(newFolder)); GUIUtility.ExitGUI(); } TimelineClipSISData timelineClipSISData = m_asset.GetBoundTimelineClipSISData(); if (null == timelineClipSISData) { return; } GUILayout.Space(15); //Capture Selected Frames using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { DrawCaptureSelectedFramesGUI(TimelineEditor.selectedClip, timelineClipSISData); DrawLockFramesGUI(TimelineEditor.selectedClip, timelineClipSISData); } GUILayout.Space(15); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { EditorGUILayout.LabelField("Background Colors"); ++EditorGUI.indentLevel; RenderCachePlayableAssetEditorConfig editorConfig = m_asset.GetEditorConfig(); Color updateBGColor = editorConfig.GetUpdateBGColor(); Color timelineBgColor = m_asset.GetTimelineBGColor(); editorConfig.SetUpdateBGColor(EditorGUILayout.ColorField("In Game Window (Update)", updateBGColor)); m_asset.SetTimelineBGColor(EditorGUILayout.ColorField("In Timeline Window", timelineBgColor)); --EditorGUI.indentLevel; GUILayout.Space(5); } GUILayout.Space(15); DrawUpdateRenderCacheGUI(); }