public override void Exit() { Context.AbortAllReqests("Exiting build."); mInputCompile = null; base.Exit(); }
public override void Exit() { if (Context != null) { if (mCompiler != null && !mCompiler.IsFinished) Debug.LogError("Input compile aborted. (Forced exit.)"); } mCompiler = null; base.Exit(); }
public override void Exit() { if (Context != null) { if (mCompiler != null && !mCompiler.IsFinished) { Debug.LogError("Input compile aborted. (Forced exit.)"); } } mCompiler = null; base.Exit(); }
private void ApplyData() { NavmeshBuild build = Context.Build; // Caller checks for null. if (!build.SetInputData(Logger, mCompiler.Geometry , mCompiler.Info, mCompiler.Processors, mCompiler.Connections , true)) { Logger.PostError("Could not apply input data.", build); return; // Let the compiler persist so user can review it. } mCompiler = null; }
protected bool OnGUIStandardButtons() { bool result = false; NavmeshBuild build = Context.Build; if (!build) { return(result); } bool guiEnabled = GUI.enabled; GUI.enabled = guiEnabled && mInputCompile == null && Context.TaskCount == 0 && !NavEditorUtil.SceneMismatch(build.BuildTarget.BuildInfo); if (GUILayout.Button("Recompile Input")) { mInputCompile = new MiniInputCompile(Context); if (mInputCompile.IsFinished) { mInputCompile = null; } } GUI.enabled = guiEnabled && mInputCompile == null && Context.TaskCount == 0; if (GUILayout.Button("Reinitialize Builder")) { result = true; build.DiscardBuildData(); } GUI.enabled = guiEnabled; return(result); }
public override void Update() { if (Context == null || mCompiler == null) { // Either an error, or nothing to do. return; } NavmeshBuild build = Context.Build; if (!build) { return; } if (Context.Build.BuildState == NavmeshBuildState.Invalid && mCompiler != null) { Logger.PostError("Build has become invalid. Discarded input compile.", Context.Build); mCompiler = null; return; } if (!mCompiler.IsFinished) { mCompiler.Update(); return; } if (!mCompiler.HasData) { Logger.PostError("Input data compile failed.", null); mCompiler = null; } else if (build.HasInputData) { // Note: Don't apply the changes if it will cause // a state transition. It creates GUI control issues. ApplyData(); } }
public override void Update() { base.Update(); if (Context == null || mInputCompile == null) { return; } mInputCompile.Update(); if (!mInputCompile.IsFinished) { return; } NavmeshBuild build = Context.Build; if (!build) { return; } UnityBuildContext mLogger = new UnityBuildContext(); if (mInputCompile.HasData) { if (!build.SetInputData(mLogger, mInputCompile.Geometry , mInputCompile.Info, mInputCompile.Processors, mInputCompile.Connections , true)) { mLogger.PostError("Could not apply input data.", build); } } else { mLogger.PostError("Input compile did not produce anything.", build); } mInputCompile = null; }
protected bool OnGUIStandardButtons() { bool result = false; NavmeshBuild build = Context.Build; if (!build) return result; bool guiEnabled = GUI.enabled; GUI.enabled = guiEnabled && mInputCompile == null && Context.TaskCount == 0 && !NavEditorUtil.SceneMismatch(build.BuildTarget.BuildInfo); if (GUILayout.Button("Recompile Input")) { mInputCompile = new MiniInputCompile(Context); if (mInputCompile.IsFinished) mInputCompile = null; } GUI.enabled = guiEnabled && mInputCompile == null && Context.TaskCount == 0; if (GUILayout.Button("Reinitialize Builder")) { result = true; build.DiscardBuildData(); } GUI.enabled = guiEnabled; return result; }
public override void Update() { if (Context == null || mCompiler == null) // Either an error, or nothing to do. return; NavmeshBuild build = Context.Build; if (!build) return; if (Context.Build.BuildState == NavmeshBuildState.Invalid && mCompiler != null) { Logger.PostError("Build has become invalid. Discarded input compile.", Context.Build); mCompiler = null; return; } if (!mCompiler.IsFinished) { mCompiler.Update(); return; } if (!mCompiler.HasData) { Logger.PostError("Input data compile failed.", null); mCompiler = null; } else if (build.HasInputData) { // Note: Don't apply the changes if it will cause // a state transition. It creates GUI control issues. ApplyData(); } }
protected override void OnGUIButtons() { NavmeshBuild build = Context.Build; if (!build) { return; } if (build.BuildState == NavmeshBuildState.Invalid) { GUI.Box(Context.ButtonArea, ""); return; } bool hasLocalData = (mCompiler != null && mCompiler.HasData); bool dataExists = (build.HasInputData || hasLocalData); bool isCompiling = !(mCompiler == null || mCompiler.IsFinished); bool guiEnabled = GUI.enabled; GUI.enabled = !isCompiling; ControlUtil.BeginButtonArea(Context.ButtonArea); float origFVal = build.Config.WalkableSlope; GUILayout.Label(NMGenConfig.SlopeLabel); build.Config.WalkableSlope = EditorGUILayout.FloatField(build.Config.WalkableSlope); if (origFVal != build.Config.WalkableSlope) { build.IsDirty = true; } GUILayout.Space(MarginSize); string compileButtonText; GUIStyle style = (GUI.enabled && !dataExists) ? ControlUtil.HighlightedButton : GUI.skin.button; if (dataExists) { compileButtonText = "Recompile"; } else { compileButtonText = "Compile"; } if (GUILayout.Button(compileButtonText, style)) { GC.Collect(); Logger.ResetLog(); mCompiler = new MiniInputCompile(Context); if (mCompiler.IsFinished) { mCompiler = null; } } if (hasLocalData) { GUILayout.Space(MarginSize); style = (GUI.enabled ? ControlUtil.HighlightedButton : GUI.skin.button); if (GUILayout.Button("Accept", style)) { ApplyData(); } } GUI.enabled = guiEnabled; if (isCompiling) { GUILayout.Space(MarginSize); if (GUILayout.Button("Cancel Compile")) { mCompiler.Abort(); mCompiler = null; } } else { bool resetOK = (hasLocalData || build.HasInputData || build.HasBuildData); if (ControlUtil.OnGUIStandardButtons(Context, DebugContext, resetOK)) { // Reset button clicked. mCompiler = null; } } ControlUtil.EndButtonArea(); }
protected override void OnGUIButtons() { NavmeshBuild build = Context.Build; if (!build) return; if (build.BuildState == NavmeshBuildState.Invalid) { GUI.Box(Context.ButtonArea, ""); return; } bool hasLocalData = (mCompiler != null && mCompiler.HasData); bool dataExists = (build.HasInputData || hasLocalData); bool isCompiling = !(mCompiler == null || mCompiler.IsFinished); bool guiEnabled = GUI.enabled; GUI.enabled = !isCompiling; ControlUtil.BeginButtonArea(Context.ButtonArea); float origFVal = build.Config.WalkableSlope; GUILayout.Label(NMGenConfig.SlopeLabel); build.Config.WalkableSlope = EditorGUILayout.FloatField(build.Config.WalkableSlope); if (origFVal != build.Config.WalkableSlope) build.IsDirty = true; GUILayout.Space(MarginSize); string compileButtonText; GUIStyle style = (GUI.enabled && !dataExists) ? ControlUtil.HighlightedButton : GUI.skin.button; if (dataExists) compileButtonText = "Recompile"; else compileButtonText = "Compile"; if (GUILayout.Button(compileButtonText, style)) { GC.Collect(); Logger.ResetLog(); mCompiler = new MiniInputCompile(Context); if (mCompiler.IsFinished) mCompiler = null; } if (hasLocalData) { GUILayout.Space(MarginSize); style = (GUI.enabled ? ControlUtil.HighlightedButton : GUI.skin.button); if (GUILayout.Button("Accept", style)) ApplyData(); } GUI.enabled = guiEnabled; if (isCompiling) { GUILayout.Space(MarginSize); if (GUILayout.Button("Cancel Compile")) { mCompiler.Abort(); mCompiler = null; } } else { bool resetOK = (hasLocalData || build.HasInputData || build.HasBuildData); if (ControlUtil.OnGUIStandardButtons(Context, DebugContext, resetOK)) // Reset button clicked. mCompiler = null; } ControlUtil.EndButtonArea(); }
public override void Update() { base.Update(); if (Context == null || mInputCompile == null) return; mInputCompile.Update(); if (!mInputCompile.IsFinished) return; NavmeshBuild build = Context.Build; if (!build) return; UnityBuildContext mLogger = new UnityBuildContext(); if (mInputCompile.HasData) { if (!build.SetInputData(mLogger, mInputCompile.Geometry , mInputCompile.Info, mInputCompile.Processors, mInputCompile.Connections , true)) { mLogger.PostError("Could not apply input data.", build); } } else mLogger.PostError("Input compile did not produce anything.", build); mInputCompile = null; }