Cogs.Core
Public Member Functions | Public Attributes | Private Attributes | List of all members
Cogs::Core::EditorState Struct Reference

Public Member Functions

void setSelection (const EntityIds &ids)
 Set new selected entities.
 
void setSelection (EntityId id)
 
void clearSelection ()
 
void updateSelectedInfo ()
 Update information in LastPickedState when selection changes.
 
size_t numSelected () const
 
bool hasSelected () const
 
bool isSelected (EntityId entityId) const
 
EntityId getSelectedId () const
 Gets entity ID of the single selected entity.
 
ComponentModel::EntitygetSelected () const
 Gets entity Pointer to the single selected entity. Nullptr if not one selected or not found.
 
std::span< const EntityId > getAllSelectedIds () const
 Get Entity Ids of all selected entities.
 
void setFindPattern (const std::string &pattern)
 Entity search pattern.
 
const std::string & getFindPattern () const
 Gets Entity search pattern.
 
const std::regex & getFindRegex () const
 Entity search pattern as Regexp for lookup.
 
bool isFindRegexValid () const
 
std::string eraseInvalidSelected ()
 

Public Attributes

EditingMode mode = EditingMode::Select
 
EditingPivot pivot = EditingPivot::Default
 
class Editoreditor = nullptr
 
class Contextcontext = nullptr
 
WeakEntityPtr editorCamera
 Editor scene camera.
 
std::string fileName
 
std::string directory
 
LastPickState lastPickState
 
EntityIds selected
 
int pickId = -1
 
bool scrolled = false
 
bool findEntities = false
 
size_t findOffset = 0
 
bool showSettings = false
 
std::vector< ComponentModel::Entity * > selectedPath
 
std::unordered_map< int, TextureHandleicons
 
glm::vec3 startTranslation = glm::vec3(0)
 
glm::vec3 endTranslation = glm::vec3(0)
 
glm::quat startRotation
 
glm::quat endRotation
 
glm::vec3 startScale
 
glm::vec3 endScale
 
std::vector< glm::vec3 > startTranslations
 
std::vector< glm::quat > startRotations
 
std::vector< glm::vec3 > startScales
 
glm::vec3 startMin
 
glm::vec3 startMax
 
bool wasUsingGizmo = false
 
bool lButtonDown = false
 
int downX = 0
 
int downY = 0
 
rapidjson::Document copied
 
float translateSnap = 0.1f
 
float rotateSnap = 1.0f
 
float scaleSnap = 0.1f
 
std::vector< std::shared_ptr< ICommandState > > commandStates
 

Private Attributes

std::string findPattern
 
std::regex findRegex
 
bool validRegex = true
 

Detailed Description

Definition at line 75 of file EditorState.h.

Member Function Documentation

◆ clearSelection()

void Cogs::Core::EditorState::clearSelection ( )
inline

Definition at line 111 of file EditorState.h.

◆ eraseInvalidSelected()

std::string Cogs::Core::EditorState::eraseInvalidSelected ( )
inline

Erase invalid selected entities. Like Internal Asset LOD entites. Returns string with entity ids.

Definition at line 161 of file EditorState.h.

References Cogs::Core::EntityStore::getEntityPtr(), Cogs::Core::Context::store, and updateSelectedInfo().

◆ getAllSelectedIds()

std::span< const EntityId > Cogs::Core::EditorState::getAllSelectedIds ( ) const
inline

Get Entity Ids of all selected entities.

Definition at line 136 of file EditorState.h.

Referenced by Cogs::Core::Editor::open().

◆ getFindPattern()

const std::string & Cogs::Core::EditorState::getFindPattern ( ) const
inline

Gets Entity search pattern.

Definition at line 153 of file EditorState.h.

◆ getFindRegex()

const std::regex & Cogs::Core::EditorState::getFindRegex ( ) const
inline

Entity search pattern as Regexp for lookup.

Definition at line 155 of file EditorState.h.

◆ getSelected()

ComponentModel::Entity * Cogs::Core::EditorState::getSelected ( ) const
inline

Gets entity Pointer to the single selected entity. Nullptr if not one selected or not found.

Definition at line 133 of file EditorState.h.

References Cogs::Core::EntityStore::getEntityPtr(), getSelectedId(), and Cogs::Core::Context::store.

Referenced by Cogs::Core::CreateEntityCommand::apply(), and Cogs::Core::ExportCommand::apply().

◆ getSelectedId()

EntityId Cogs::Core::EditorState::getSelectedId ( ) const
inline

Gets entity ID of the single selected entity.

Definition at line 130 of file EditorState.h.

Referenced by getSelected(), and Cogs::Core::Editor::open().

◆ hasSelected()

bool Cogs::Core::EditorState::hasSelected ( ) const
inline

Definition at line 122 of file EditorState.h.

◆ isFindRegexValid()

bool Cogs::Core::EditorState::isFindRegexValid ( ) const
inline

Definition at line 156 of file EditorState.h.

◆ isSelected()

bool Cogs::Core::EditorState::isSelected ( EntityId  entityId) const
inline

Definition at line 124 of file EditorState.h.

◆ numSelected()

size_t Cogs::Core::EditorState::numSelected ( ) const
inline

Definition at line 120 of file EditorState.h.

◆ setFindPattern()

void Cogs::Core::EditorState::setFindPattern ( const std::string &  pattern)
inline

Entity search pattern.

Definition at line 139 of file EditorState.h.

◆ setSelection() [1/2]

void Cogs::Core::EditorState::setSelection ( const EntityIds &  ids)
inline

Set new selected entities.

Definition at line 100 of file EditorState.h.

References updateSelectedInfo().

Referenced by Cogs::Core::CreateEntityCommand::apply(), and Cogs::Core::Editor::open().

◆ setSelection() [2/2]

void Cogs::Core::EditorState::setSelection ( EntityId  id)
inline

Definition at line 106 of file EditorState.h.

◆ updateSelectedInfo()

void Cogs::Core::EditorState::updateSelectedInfo ( )

Member Data Documentation

◆ commandStates

std::vector<std::shared_ptr<ICommandState> > Cogs::Core::EditorState::commandStates

Preserved command state. See ICommandState. Cleared at end of batch run.

Definition at line 213 of file EditorState.h.

◆ context

class Context* Cogs::Core::EditorState::context = nullptr

Definition at line 81 of file EditorState.h.

◆ copied

rapidjson::Document Cogs::Core::EditorState::copied

Definition at line 205 of file EditorState.h.

◆ directory

std::string Cogs::Core::EditorState::directory

Definition at line 87 of file EditorState.h.

◆ downX

int Cogs::Core::EditorState::downX = 0

Definition at line 202 of file EditorState.h.

◆ downY

int Cogs::Core::EditorState::downY = 0

Definition at line 203 of file EditorState.h.

◆ editor

class Editor* Cogs::Core::EditorState::editor = nullptr

Definition at line 80 of file EditorState.h.

◆ editorCamera

WeakEntityPtr Cogs::Core::EditorState::editorCamera

Editor scene camera.

Definition at line 84 of file EditorState.h.

◆ endRotation

glm::quat Cogs::Core::EditorState::endRotation

Definition at line 186 of file EditorState.h.

◆ endScale

glm::vec3 Cogs::Core::EditorState::endScale

Definition at line 189 of file EditorState.h.

◆ endTranslation

glm::vec3 Cogs::Core::EditorState::endTranslation = glm::vec3(0)

Definition at line 183 of file EditorState.h.

◆ fileName

std::string Cogs::Core::EditorState::fileName

Definition at line 86 of file EditorState.h.

◆ findEntities

bool Cogs::Core::EditorState::findEntities = false

Definition at line 94 of file EditorState.h.

◆ findOffset

size_t Cogs::Core::EditorState::findOffset = 0

Definition at line 95 of file EditorState.h.

◆ findPattern

std::string Cogs::Core::EditorState::findPattern
private

Definition at line 215 of file EditorState.h.

◆ findRegex

std::regex Cogs::Core::EditorState::findRegex
private

Definition at line 216 of file EditorState.h.

◆ icons

std::unordered_map<int, TextureHandle> Cogs::Core::EditorState::icons

Definition at line 180 of file EditorState.h.

◆ lastPickState

LastPickState Cogs::Core::EditorState::lastPickState

Definition at line 89 of file EditorState.h.

◆ lButtonDown

bool Cogs::Core::EditorState::lButtonDown = false

Definition at line 200 of file EditorState.h.

◆ mode

EditingMode Cogs::Core::EditorState::mode = EditingMode::Select

Definition at line 77 of file EditorState.h.

◆ pickId

int Cogs::Core::EditorState::pickId = -1

Definition at line 91 of file EditorState.h.

◆ pivot

EditingPivot Cogs::Core::EditorState::pivot = EditingPivot::Default

Definition at line 78 of file EditorState.h.

◆ rotateSnap

float Cogs::Core::EditorState::rotateSnap = 1.0f

Definition at line 208 of file EditorState.h.

◆ scaleSnap

float Cogs::Core::EditorState::scaleSnap = 0.1f

Definition at line 209 of file EditorState.h.

◆ scrolled

bool Cogs::Core::EditorState::scrolled = false

Definition at line 92 of file EditorState.h.

◆ selected

EntityIds Cogs::Core::EditorState::selected

Definition at line 90 of file EditorState.h.

◆ selectedPath

std::vector<ComponentModel::Entity *> Cogs::Core::EditorState::selectedPath

Definition at line 178 of file EditorState.h.

◆ showSettings

bool Cogs::Core::EditorState::showSettings = false

Definition at line 97 of file EditorState.h.

◆ startMax

glm::vec3 Cogs::Core::EditorState::startMax

Definition at line 196 of file EditorState.h.

◆ startMin

glm::vec3 Cogs::Core::EditorState::startMin

Definition at line 195 of file EditorState.h.

◆ startRotation

glm::quat Cogs::Core::EditorState::startRotation

Definition at line 185 of file EditorState.h.

◆ startRotations

std::vector<glm::quat> Cogs::Core::EditorState::startRotations

Definition at line 192 of file EditorState.h.

◆ startScale

glm::vec3 Cogs::Core::EditorState::startScale

Definition at line 188 of file EditorState.h.

◆ startScales

std::vector<glm::vec3> Cogs::Core::EditorState::startScales

Definition at line 193 of file EditorState.h.

◆ startTranslation

glm::vec3 Cogs::Core::EditorState::startTranslation = glm::vec3(0)

Definition at line 182 of file EditorState.h.

◆ startTranslations

std::vector<glm::vec3> Cogs::Core::EditorState::startTranslations

Definition at line 191 of file EditorState.h.

◆ translateSnap

float Cogs::Core::EditorState::translateSnap = 0.1f

Definition at line 207 of file EditorState.h.

◆ validRegex

bool Cogs::Core::EditorState::validRegex = true
private

Definition at line 217 of file EditorState.h.

◆ wasUsingGizmo

bool Cogs::Core::EditorState::wasUsingGizmo = false

Definition at line 198 of file EditorState.h.


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