Overload  1.1
Game engine with editor
Public Types | Public Member Functions | Public Attributes | List of all members
OvEditor::Core::EditorActions Class Reference

#include <EditorActions.h>

Public Types

enum  EActorSpawnMode { EActorSpawnMode::ORIGIN, EActorSpawnMode::FRONT }
 
enum  EEditorMode { EEditorMode::EDIT, EEditorMode::PLAY, EEditorMode::PAUSE, EEditorMode::FRAME_BY_FRAME }
 

Public Member Functions

 EditorActions (Context &p_context, EditorRenderer &p_editorRenderer, PanelsManager &p_panelsManager)
 
ContextGetContext ()
 
EditorRendererGetRenderer ()
 
PanelsManagerGetPanelsManager ()
 
void SetActorSpawnAtOrigin (bool p_value)
 
void SetActorSpawnMode (EActorSpawnMode p_value)
 
void ResetLayout ()
 
void SetSceneViewCameraSpeed (int p_speed)
 
int GetSceneViewCameraSpeed ()
 
void SetAssetViewCameraSpeed (int p_speed)
 
int GetAssetViewCameraSpeed ()
 
void ResetSceneViewCameraPosition ()
 
void ResetAssetViewCameraPosition ()
 
EEditorMode GetCurrentEditorMode () const
 
void SetEditorMode (EEditorMode p_newEditorMode)
 
void StartPlaying ()
 
void PauseGame ()
 
void StopPlaying ()
 
void NextFrame ()
 
template<typename T >
OvCore::ECS::ActorCreateMonoComponentActor (bool p_focusOnCreation=true, OvCore::ECS::Actor *p_parent=nullptr)
 
OvMaths::FVector3 CalculateActorSpawnPoint (float p_distanceToCamera)
 
OvCore::ECS::ActorCreateEmptyActor (bool p_focusOnCreation=true, OvCore::ECS::Actor *p_parent=nullptr)
 
OvCore::ECS::ActorCreateActorWithModel (const std::string &p_path, bool p_focusOnCreation=true, OvCore::ECS::Actor *p_parent=nullptr)
 
OvCore::ECS::ActorCreatePhysicalBox (bool p_focusOnCreation=true, OvCore::ECS::Actor *p_parent=nullptr)
 
OvCore::ECS::ActorCreatePhysicalSphere (bool p_focusOnCreation=true, OvCore::ECS::Actor *p_parent=nullptr)
 
OvCore::ECS::ActorCreatePhysicalCapsule (bool p_focusOnCreation=true, OvCore::ECS::Actor *p_parent=nullptr)
 
bool DestroyActor (OvCore::ECS::Actor &p_actor)
 
void DuplicateActor (OvCore::ECS::Actor &p_toDuplicate, OvCore::ECS::Actor *p_forcedParent=nullptr, bool p_focus=true)
 
void SelectActor (OvCore::ECS::Actor &p_target)
 
void UnselectActor ()
 
bool IsAnyActorSelected () const
 
OvCore::ECS::ActorGetSelectedActor () const
 
void MoveToTarget (OvCore::ECS::Actor &p_target)
 
void CompileShaders ()
 
void SaveMaterials ()
 
bool ImportAsset (const std::string &p_initialDestinationDirectory)
 
bool ImportAssetAtLocation (const std::string &p_destination)
 
std::string GetRealPath (const std::string &p_path)
 
std::string GetResourcePath (const std::string &p_path, bool p_isFromEngine=false)
 
std::string GetScriptPath (const std::string &p_path)
 
void PropagateFolderRename (std::string p_previousName, const std::string p_newName)
 
void PropagateFolderDestruction (std::string p_folderPath)
 
void PropagateScriptRename (std::string p_previousName, std::string p_newName)
 
void PropagateFileRename (std::string p_previousName, std::string p_newName)
 
void PropagateFileRenameThroughSavedFilesOfType (const std::string &p_previousName, const std::string &p_newName, OvTools::Utils::PathParser::EFileType p_fileType)
 
void LoadEmptyScene ()
 
void SaveCurrentSceneTo (const std::string &p_path)
 
void LoadSceneFromDisk (const std::string &p_path, bool p_absolute=false)
 
bool IsCurrentSceneLoadedFromDisk () const
 
void SaveSceneChanges ()
 
void SaveAs ()
 
void RefreshScripts ()
 
std::optional< std::string > SelectBuildFolder ()
 
void Build (bool p_autoRun=false, bool p_tempFolder=false)
 
void BuildAtLocation (const std::string &p_configuration, const std::string p_buildPath, bool p_autoRun=false)
 
void DelayAction (std::function< void()> p_action, uint32_t p_frames=1)
 
void ExecuteDelayedActions ()
 

Public Attributes

OvTools::Eventing::Event< OvCore::ECS::Actor & > ActorSelectedEvent
 
OvTools::Eventing::Event< OvCore::ECS::Actor & > ActorUnselectedEvent
 
OvTools::Eventing::Event< EEditorModeEditorModeChangedEvent
 
OvTools::Eventing::Event PlayEvent
 

Detailed Description

A set of editor actions

Member Enumeration Documentation

◆ EActorSpawnMode

A simple enumeration that define two actor spawn modes

Enumerator
ORIGIN 
FRONT 

◆ EEditorMode

Defines some states for the editor

Enumerator
EDIT 
PLAY 
PAUSE 
FRAME_BY_FRAME 

Constructor & Destructor Documentation

◆ EditorActions()

OvEditor::Core::EditorActions::EditorActions ( Context p_context,
EditorRenderer p_editorRenderer,
PanelsManager p_panelsManager 
)

Constructor

Parameters
p_context
p_editorRenderer
p_panelsManager@project: Overload
Author
: Overload Tech. @restrictions: This software may not be resold, redistributed or otherwise conveyed to a third party.

Member Function Documentation

◆ Build()

void OvEditor::Core::EditorActions::Build ( bool  p_autoRun = false,
bool  p_tempFolder = false 
)

Build the current project

Parameters
p_autoRun
p_tempFolder

◆ BuildAtLocation()

void OvEditor::Core::EditorActions::BuildAtLocation ( const std::string &  p_configuration,
const std::string  p_buildPath,
bool  p_autoRun = false 
)

Build the current project at the given location

Parameters
p_configuration
p_buildPath
p_autoRun

◆ CalculateActorSpawnPoint()

OvMaths::FVector3 OvEditor::Core::EditorActions::CalculateActorSpawnPoint ( float  p_distanceToCamera)

Calculate the position where to spawn the actor using the current camera position and forward

Parameters
p_distanceToCamera

◆ CompileShaders()

void OvEditor::Core::EditorActions::CompileShaders ( )

Compile every loaded shaders

◆ CreateActorWithModel()

OvCore::ECS::Actor & OvEditor::Core::EditorActions::CreateActorWithModel ( const std::string &  p_path,
bool  p_focusOnCreation = true,
OvCore::ECS::Actor p_parent = nullptr 
)

Create an actor with a model renderer and a material renderer. The model renderer with use the model identified by the given path

Parameters
p_path
p_focusOnCreation
p_parent

◆ CreateEmptyActor()

OvCore::ECS::Actor & OvEditor::Core::EditorActions::CreateEmptyActor ( bool  p_focusOnCreation = true,
OvCore::ECS::Actor p_parent = nullptr 
)

Create an empty actor

Parameters
p_focusOnCreation
p_parent

◆ CreateMonoComponentActor()

template<typename T >
OvCore::ECS::Actor & OvEditor::Core::EditorActions::CreateMonoComponentActor ( bool  p_focusOnCreation = true,
OvCore::ECS::Actor p_parent = nullptr 
)
inline

Create an actor with the given component type

Parameters
p_focusOnCreation
p_parent

◆ CreatePhysicalBox()

OvCore::ECS::Actor & OvEditor::Core::EditorActions::CreatePhysicalBox ( bool  p_focusOnCreation = true,
OvCore::ECS::Actor p_parent = nullptr 
)

Create an actor whith a physical box

Parameters
p_focusOnCreation
p_parent

◆ CreatePhysicalCapsule()

OvCore::ECS::Actor & OvEditor::Core::EditorActions::CreatePhysicalCapsule ( bool  p_focusOnCreation = true,
OvCore::ECS::Actor p_parent = nullptr 
)

Create an actor whith a physical capsule

Parameters
p_focusOnCreation
p_parent

◆ CreatePhysicalSphere()

OvCore::ECS::Actor & OvEditor::Core::EditorActions::CreatePhysicalSphere ( bool  p_focusOnCreation = true,
OvCore::ECS::Actor p_parent = nullptr 
)

Create an actor whith a physical sphere

Parameters
p_focusOnCreation
p_parent

◆ DelayAction()

void OvEditor::Core::EditorActions::DelayAction ( std::function< void()>  p_action,
uint32_t  p_frames = 1 
)

Prepare an action for a future call

Parameters
p_action
p_frames

◆ DestroyActor()

bool OvEditor::Core::EditorActions::DestroyActor ( OvCore::ECS::Actor p_actor)

Destroy an actor from his scene

Parameters
p_focusOnCreation
p_parent

◆ DuplicateActor()

void OvEditor::Core::EditorActions::DuplicateActor ( OvCore::ECS::Actor p_toDuplicate,
OvCore::ECS::Actor p_forcedParent = nullptr,
bool  p_focus = true 
)

Duplicate an actor

Parameters
p_toDuplicate
p_forcedParent
bool

◆ ExecuteDelayedActions()

void OvEditor::Core::EditorActions::ExecuteDelayedActions ( )

Execute every actions that should be executed at this frame (Decrement the frame counter for each actions)

◆ GetAssetViewCameraSpeed()

int OvEditor::Core::EditorActions::GetAssetViewCameraSpeed ( )

Returns the asset view camera speed

◆ GetContext()

OvEditor::Core::Context & OvEditor::Core::EditorActions::GetContext ( )

Returns the context

◆ GetCurrentEditorMode()

OvEditor::Core::EditorActions::EEditorMode OvEditor::Core::EditorActions::GetCurrentEditorMode ( ) const

Returns the current editor state/mode

◆ GetPanelsManager()

OvEditor::Core::PanelsManager & OvEditor::Core::EditorActions::GetPanelsManager ( )

Returns the panels manager

◆ GetRealPath()

std::string OvEditor::Core::EditorActions::GetRealPath ( const std::string &  p_path)

Returns the real path of a resource (complete absolute path)

Parameters
p_path

◆ GetRenderer()

OvEditor::Core::EditorRenderer & OvEditor::Core::EditorActions::GetRenderer ( )

Returns the renderer

◆ GetResourcePath()

std::string OvEditor::Core::EditorActions::GetResourcePath ( const std::string &  p_path,
bool  p_isFromEngine = false 
)

Returns the resource path of a file

Parameters
p_path
p_isFromEngine

◆ GetSceneViewCameraSpeed()

int OvEditor::Core::EditorActions::GetSceneViewCameraSpeed ( )

Returns the scene view camera speed

◆ GetScriptPath()

std::string OvEditor::Core::EditorActions::GetScriptPath ( const std::string &  p_path)

Returns the script path of a file

Parameters
p_path

◆ GetSelectedActor()

OvCore::ECS::Actor & OvEditor::Core::EditorActions::GetSelectedActor ( ) const

Returns the selected actor. Make sur you verified that an actor is selected with IsAnyActorSelected() before calling this method

◆ ImportAsset()

bool OvEditor::Core::EditorActions::ImportAsset ( const std::string &  p_initialDestinationDirectory)

Import an asset

Parameters
p_initialDestinationDirectory

◆ ImportAssetAtLocation()

bool OvEditor::Core::EditorActions::ImportAssetAtLocation ( const std::string &  p_destination)

Import an asset at location

Parameters
p_destination

◆ IsAnyActorSelected()

bool OvEditor::Core::EditorActions::IsAnyActorSelected ( ) const

Returns true if any actor is selected

◆ IsCurrentSceneLoadedFromDisk()

bool OvEditor::Core::EditorActions::IsCurrentSceneLoadedFromDisk ( ) const

Returns true if the current scene has been loaded from disk

◆ LoadEmptyScene()

void OvEditor::Core::EditorActions::LoadEmptyScene ( )

Load an empty scene. Any unsaved changes to the current scene will be discarded

◆ LoadSceneFromDisk()

void OvEditor::Core::EditorActions::LoadSceneFromDisk ( const std::string &  p_path,
bool  p_absolute = false 
)

Load a scene from the disk

Parameters
p_path
p_absolute

◆ MoveToTarget()

void OvEditor::Core::EditorActions::MoveToTarget ( OvCore::ECS::Actor p_target)

Moves the camera to the target actor

◆ NextFrame()

void OvEditor::Core::EditorActions::NextFrame ( )

Play the current frame and pause the editor

◆ PauseGame()

void OvEditor::Core::EditorActions::PauseGame ( )

Pause the current playing scene and update the editor mode

◆ PropagateFileRename()

void OvEditor::Core::EditorActions::PropagateFileRename ( std::string  p_previousName,
std::string  p_newName 
)

Propagate the file rename everywhere it is used

Parameters
p_previousName
p_newName

◆ PropagateFileRenameThroughSavedFilesOfType()

void OvEditor::Core::EditorActions::PropagateFileRenameThroughSavedFilesOfType ( const std::string &  p_previousName,
const std::string &  p_newName,
OvTools::Utils::PathParser::EFileType  p_fileType 
)

Propagate the file rename through concerned files

Parameters
p_previousName
p_newName
p_fileType

◆ PropagateFolderDestruction()

void OvEditor::Core::EditorActions::PropagateFolderDestruction ( std::string  p_folderPath)

Propagate the folder destruction everywhere (Resource manager, scenes, materials...)

Parameters
p_folderPath

◆ PropagateFolderRename()

void OvEditor::Core::EditorActions::PropagateFolderRename ( std::string  p_previousName,
const std::string  p_newName 
)

Propagate the folder rename everywhere (Resource manager, scenes, materials...)

Parameters
p_previousName
p_newName

◆ PropagateScriptRename()

void OvEditor::Core::EditorActions::PropagateScriptRename ( std::string  p_previousName,
std::string  p_newName 
)

Propagate the script rename in scenes and inspector

Parameters
p_previousName
p_newName

◆ RefreshScripts()

void OvEditor::Core::EditorActions::RefreshScripts ( )

Refresh every scripts (Re-interpret)

◆ ResetAssetViewCameraPosition()

void OvEditor::Core::EditorActions::ResetAssetViewCameraPosition ( )

Resets the scene view camera position to the default one

◆ ResetLayout()

void OvEditor::Core::EditorActions::ResetLayout ( )

Reset the editor layout

◆ ResetSceneViewCameraPosition()

void OvEditor::Core::EditorActions::ResetSceneViewCameraPosition ( )

Resets the scene view camera position to the default one

◆ SaveAs()

void OvEditor::Core::EditorActions::SaveAs ( )

Save the current scene to a new disk location (Can create a duplication of the scene file)

◆ SaveCurrentSceneTo()

void OvEditor::Core::EditorActions::SaveCurrentSceneTo ( const std::string &  p_path)

Save the current scene to the given path

Parameters
p_path

◆ SaveMaterials()

void OvEditor::Core::EditorActions::SaveMaterials ( )

Save every materials to their respective files

◆ SaveSceneChanges()

void OvEditor::Core::EditorActions::SaveSceneChanges ( )

Save the current scene to its disk location

◆ SelectActor()

void OvEditor::Core::EditorActions::SelectActor ( OvCore::ECS::Actor p_target)

Select an actor and show him in inspector

Parameters
p_target

◆ SelectBuildFolder()

std::optional< std::string > OvEditor::Core::EditorActions::SelectBuildFolder ( )

Ask the user to select the build folder

◆ SetActorSpawnAtOrigin()

void OvEditor::Core::EditorActions::SetActorSpawnAtOrigin ( bool  p_value)

Defines if new actors should be spawned at origin

Parameters
p_value

◆ SetActorSpawnMode()

void OvEditor::Core::EditorActions::SetActorSpawnMode ( EActorSpawnMode  p_value)

Defines how new actors should be spawned

Parameters
p_value

◆ SetAssetViewCameraSpeed()

void OvEditor::Core::EditorActions::SetAssetViewCameraSpeed ( int  p_speed)

Defines the asset view camera speed

Parameters
p_speed

◆ SetEditorMode()

void OvEditor::Core::EditorActions::SetEditorMode ( EEditorMode  p_newEditorMode)

Defines the editor state/mode

Parameters
p_newEditorMode

◆ SetSceneViewCameraSpeed()

void OvEditor::Core::EditorActions::SetSceneViewCameraSpeed ( int  p_speed)

Defines the scene view camera speed

Parameters
p_speed

◆ StartPlaying()

void OvEditor::Core::EditorActions::StartPlaying ( )

Start playing the current scene and update the editor mode

◆ StopPlaying()

void OvEditor::Core::EditorActions::StopPlaying ( )

Stop platying the current scene and update the editor mode

◆ UnselectActor()

void OvEditor::Core::EditorActions::UnselectActor ( )

Unselect any selected actor and clearing the inspector

Member Data Documentation

◆ ActorSelectedEvent

OvTools::Eventing::Event<OvCore::ECS::Actor&> OvEditor::Core::EditorActions::ActorSelectedEvent

◆ ActorUnselectedEvent

OvTools::Eventing::Event<OvCore::ECS::Actor&> OvEditor::Core::EditorActions::ActorUnselectedEvent

◆ EditorModeChangedEvent

OvTools::Eventing::Event<EEditorMode> OvEditor::Core::EditorActions::EditorModeChangedEvent

◆ PlayEvent

OvTools::Eventing::Event OvEditor::Core::EditorActions::PlayEvent

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