A* Pathfinding Project  3.8.5
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
AstarPathEditor Class Reference

Public Member Functions

void LoadGraphs ()
 
void OnDisable ()
 Cleans up editor stuff.
 
void OnEnable ()
 Enables editor stuff.
 
override void OnInspectorGUI ()
 
void OnSceneGUI ()
 
void SaveGraphsAndUndo (EventType et=EventType.Used, string eventCommand="")
 
byte[] SerializeGraphs (out uint checksum)
 
byte[] SerializeGraphs (Pathfinding.Serialization.SerializeSettings settings, out uint checksum)
 
override bool UseDefaultMargins ()
 Tell Unity that we want to use the whole inspector width.
 

Static Public Member Functions

static void EditTags ()
 Opens the A* Inspector and shows the section for editing tags.
 
static System.Version FullyDefinedVersion (System.Version v)
 Returns a version with all fields fully defined.
 
static void MenuScan ()
 

Static Public Attributes

static readonly string AstarProButton = "A* Pathfinding Project Pro only feature\nThe Pro version can be bought on the A* Pathfinding Project homepage, click here for info"
 
static readonly string AstarProTooltip = "A* Pathfinding Project Pro only feature\nThe Pro version can be bought on the A* Pathfinding Project homepage."
 
static string editorAssets = "Assets/AstarPathfindingProject/Editor/EditorAssets"
 Path to the editor assets folder for the A* Pathfinding Project.
 

Properties

static GUISkin astarSkin [get, set]
 
System.Type[] graphTypes [get]
 
static GUIStyle helpBox [get, set]
 
AstarPath script [get, set]
 AstarPath instance that is being inspected.
 
static GUIStyle thinHelpBox [get, set]
 

Private Member Functions

void AddGraph (System.Type type)
 
void CheckGraphEditors (bool forceRebuild=false)
 Make sure every graph has a graph editor.
 
void CreateFadeAreas ()
 
GraphEditor CreateGraphEditor (NavGraph graph)
 Creates a GraphEditor for a graph.
 
void DeserializeGraphs ()
 
void DeserializeGraphs (byte[] bytes)
 
void DrawAboutArea ()
 
void DrawColorSettings ()
 
void DrawDebugSettings ()
 
void DrawEditorSettings ()
 
void DrawFirstRun ()
 Draws the first run dialog.
 
void DrawGraph (GraphEditor graphEditor)
 Draws the inspector for the given graph with the given graph editor.
 
void DrawGraphHeader (GraphEditor graphEditor)
 
void DrawGraphInfoArea (GraphEditor graphEditor)
 
void DrawHeuristicOptimizationSettings ()
 
void DrawMainArea ()
 Draws the main area in the inspector.
 
void DrawOptimizationSettings ()
 Draws optimizations settings.
 
void DrawPathfindingSettings ()
 
void DrawSerializationSettings ()
 
void DrawSettings ()
 
void DrawTagSettings ()
 
void FindGraphTypes ()
 Searches in the current assembly for GraphEditor and NavGraph types.
 
void GetAstarEditorSettings ()
 Reads settings frome EditorPrefs.
 
bool HandleUndo ()
 
void OnDrawGizmos ()
 Draw Editor Gizmos in graphs.
 
void OnUndoRedoPerformed ()
 Called when an undo or redo operation has been performed.
 
void RemoveGraph (NavGraph graph)
 
void RepaintSceneView ()
 Repaints Scene View.
 
TextAsset SaveGraphData (byte[] bytes, TextAsset target=null)
 
void SerializeIfDataChanged ()
 
void SetAstarEditorSettings ()
 
void UnloadGizmoMeshes ()
 Unloads any temporary meshes used for drawing gizmos to prevent memory leaks.
 

Static Private Member Functions

static int ByteArrayHash (byte[] arr)
 Hashes the contents of a byte array.
 
static void DisableJs ()
 Disables JS support if it was enabled.
 
static void DiscardFirstRun ()
 Discards the first run window.
 
static void DrawColorSlider (ref float left, ref float right, bool editable)
 
static void EnableJs ()
 Enables JS support.
 
static bool IsJsEnabled ()
 Checks if JS support is enabled.
 
static bool LoadStyles ()
 Loads GUISkin and sets up styles.
 
static bool LocateEditorAssets ()
 Locates the editor assets folder in case the user has moved it.
 

Private Attributes

List
< OptimizationHandler.DefineDefinition
defines
 Holds defines found in script files, used for optimizations.
 
GraphEditor[] graphEditors
 List of all graph editors for the graphs.
 
const string scriptsFolder = "Assets/AstarPathfindingProject"
 

Static Private Attributes

static FadeArea aboutArea
 
static FadeArea addGraphsArea
 
static FadeArea alwaysVisibleArea
 
static FadeArea alwaysVisibleTopLevelArea
 
static FadeArea colorSettingsArea
 
static bool customAreaColorsOpen
 
static FadeArea editorSettingsArea
 
static bool editTags
 
static bool firstRun = true
 Used to show notifications to the user the first time the system is used in a project.
 
static GUIStyle graphDeleteButtonStyle
 
static Dictionary< string,
CustomGraphEditorAttribute
graphEditorTypes = new Dictionary<string, CustomGraphEditorAttribute>()
 List of all graph editors available (e.g GridGraphEditor)
 
static GUIStyle graphGizmoButtonStyle
 
static GUIStyle graphInfoButtonStyle
 
static Dictionary< NavGraph,
KeyValuePair< float,
KeyValuePair< int, int > > > 
graphNodeCounts
 Holds node counts for each graph to avoid calculating it every frame.
 
static FadeArea graphsArea
 
static uint ignoredChecksum
 Used to make sure correct behaviour when handling undos.
 
static int lastUndoGroup = -1000
 
static GUIStyle level0AreaStyle
 
static GUIStyle level0LabelStyle
 
static GUIStyle level1AreaStyle
 
static GUIStyle level1LabelStyle
 
static FadeArea optimizationSettingsArea
 
static FadeArea serializationSettingsArea
 
static FadeArea settingsArea
 
static bool showSettings
 
static bool stylesLoaded
 
static FadeArea tagsArea
 

Member Function Documentation

void AddGraph ( System.Type  type)
private
static int ByteArrayHash ( byte[]  arr)
staticprivate

Hashes the contents of a byte array.

void CheckGraphEditors ( bool  forceRebuild = false)
private

Make sure every graph has a graph editor.

void CreateFadeAreas ( )
private
GraphEditor CreateGraphEditor ( NavGraph  graph)
private

Creates a GraphEditor for a graph.

void DeserializeGraphs ( )
private
void DeserializeGraphs ( byte[]  bytes)
private
static void DisableJs ( )
staticprivate

Disables JS support if it was enabled.

This is done by restructuring folders in the project

static void DiscardFirstRun ( )
staticprivate

Discards the first run window.

It will not be shown for this project again

void DrawAboutArea ( )
private
void DrawColorSettings ( )
private
static void DrawColorSlider ( ref float  left,
ref float  right,
bool  editable 
)
staticprivate
void DrawDebugSettings ( )
private
void DrawEditorSettings ( )
private
void DrawFirstRun ( )
private

Draws the first run dialog.

Asks if the user wants to enable JS support

void DrawGraph ( GraphEditor  graphEditor)
private

Draws the inspector for the given graph with the given graph editor.

void DrawGraphHeader ( GraphEditor  graphEditor)
private
void DrawGraphInfoArea ( GraphEditor  graphEditor)
private
void DrawHeuristicOptimizationSettings ( )
private
void DrawMainArea ( )
private

Draws the main area in the inspector.

void DrawOptimizationSettings ( )
private

Draws optimizations settings.

A* Pro Feature:
This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited
The Pro version can be bought here
void DrawPathfindingSettings ( )
private
void DrawSerializationSettings ( )
private
void DrawSettings ( )
private
void DrawTagSettings ( )
private
static void EditTags ( )
static

Opens the A* Inspector and shows the section for editing tags.

static void EnableJs ( )
staticprivate

Enables JS support.

This is done by restructuring folders in the project

void FindGraphTypes ( )
private

Searches in the current assembly for GraphEditor and NavGraph types.

static System.Version FullyDefinedVersion ( System.Version  v)
static

Returns a version with all fields fully defined.

This is used because by default new Version(3,0,0) > new Version(3,0). This is not the desired behaviour so we make sure that all fields are defined here

void GetAstarEditorSettings ( )
private

Reads settings frome EditorPrefs.

bool HandleUndo ( )
private
static bool IsJsEnabled ( )
staticprivate

Checks if JS support is enabled.

This is done by checking if the directory 'Assets/AstarPathfindingEditor/Editor' exists

void LoadGraphs ( )
static bool LoadStyles ( )
staticprivate

Loads GUISkin and sets up styles.

See Also
editorAssets
Returns
True if all styles were found, false if there was an error somewhere
static bool LocateEditorAssets ( )
staticprivate

Locates the editor assets folder in case the user has moved it.

static void MenuScan ( )
static
void OnDisable ( )

Cleans up editor stuff.

void OnDrawGizmos ( )
private

Draw Editor Gizmos in graphs.

This is called using a delegate OnDrawGizmosCallback in the AstarPath script.

void OnEnable ( )

Enables editor stuff.

Loads graphs, reads settings and sets everything up

override void OnInspectorGUI ( )
void OnSceneGUI ( )
void OnUndoRedoPerformed ( )
private

Called when an undo or redo operation has been performed.

void RemoveGraph ( NavGraph  graph)
private
void RepaintSceneView ( )
private

Repaints Scene View.

Warning
Uses Undocumented Unity Calls (should be safe for Unity 3.x though)
TextAsset SaveGraphData ( byte[]  bytes,
TextAsset  target = null 
)
private
void SaveGraphsAndUndo ( EventType  et = EventType.Used,
string  eventCommand = "" 
)
byte [] SerializeGraphs ( out uint  checksum)
byte [] SerializeGraphs ( Pathfinding.Serialization.SerializeSettings  settings,
out uint  checksum 
)
void SerializeIfDataChanged ( )
private
void SetAstarEditorSettings ( )
private
void UnloadGizmoMeshes ( )
private

Unloads any temporary meshes used for drawing gizmos to prevent memory leaks.

override bool UseDefaultMargins ( )

Tell Unity that we want to use the whole inspector width.

Member Data Documentation

FadeArea aboutArea
staticprivate
FadeArea addGraphsArea
staticprivate
FadeArea alwaysVisibleArea
staticprivate
FadeArea alwaysVisibleTopLevelArea
staticprivate
readonly string AstarProButton = "A* Pathfinding Project Pro only feature\nThe Pro version can be bought on the A* Pathfinding Project homepage, click here for info"
static
readonly string AstarProTooltip = "A* Pathfinding Project Pro only feature\nThe Pro version can be bought on the A* Pathfinding Project homepage."
static
FadeArea colorSettingsArea
staticprivate
bool customAreaColorsOpen
staticprivate
List<OptimizationHandler.DefineDefinition> defines
private

Holds defines found in script files, used for optimizations.

A* Pro Feature:
This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited
The Pro version can be bought here
string editorAssets = "Assets/AstarPathfindingProject/Editor/EditorAssets"
static

Path to the editor assets folder for the A* Pathfinding Project.

If this path turns out to be incorrect, the script will try to find the correct path

See Also
LoadStyles
FadeArea editorSettingsArea
staticprivate
bool editTags
staticprivate
bool firstRun = true
staticprivate

Used to show notifications to the user the first time the system is used in a project.

GUIStyle graphDeleteButtonStyle
staticprivate
GraphEditor [] graphEditors
private

List of all graph editors for the graphs.

Dictionary<string, CustomGraphEditorAttribute> graphEditorTypes = new Dictionary<string, CustomGraphEditorAttribute>()
staticprivate

List of all graph editors available (e.g GridGraphEditor)

GUIStyle graphGizmoButtonStyle
staticprivate
GUIStyle graphInfoButtonStyle
staticprivate
Dictionary<NavGraph, KeyValuePair<float, KeyValuePair<int, int> > > graphNodeCounts
staticprivate

Holds node counts for each graph to avoid calculating it every frame.

Only used for visualization purposes

FadeArea graphsArea
staticprivate
uint ignoredChecksum
staticprivate

Used to make sure correct behaviour when handling undos.

int lastUndoGroup = -1000
staticprivate
GUIStyle level0AreaStyle
staticprivate
GUIStyle level0LabelStyle
staticprivate
GUIStyle level1AreaStyle
staticprivate
GUIStyle level1LabelStyle
staticprivate
FadeArea optimizationSettingsArea
staticprivate
const string scriptsFolder = "Assets/AstarPathfindingProject"
private
FadeArea serializationSettingsArea
staticprivate
FadeArea settingsArea
staticprivate
bool showSettings
staticprivate
bool stylesLoaded
staticprivate
FadeArea tagsArea
staticprivate

Property Documentation

GUISkin astarSkin
staticgetset
System.Type [] graphTypes
getprivate
GUIStyle helpBox
staticgetset
AstarPath script
getset

AstarPath instance that is being inspected.

GUIStyle thinHelpBox
staticgetset

The documentation for this class was generated from the following file: