5#include "EntityStore.h"
7#include "Resources/Resources.h"
8#include "Serialization/EntityWriter.h"
10#include "Foundation/ComponentModel/Entity.h"
17#include <unordered_map>
21 using EntityIds = std::vector<EntityId>;
23 enum class EditingMode
32 enum class EditingPivot
37 Default = ObjectCenter,
63 std::string boundingBox;
77 EditingMode mode = EditingMode::Select;
78 EditingPivot pivot = EditingPivot::Default;
80 class Editor * editor =
nullptr;
81 class Context * context =
nullptr;
87 std::string directory;
92 bool scrolled =
false;
94 bool findEntities =
false;
95 size_t findOffset = 0;
97 bool showSettings =
false;
102 if (ids.size() != 1) this->pickId = -1;
111 void clearSelection() {
120 size_t numSelected()
const {
return selected.size(); }
122 bool hasSelected()
const {
return !selected.empty(); }
124 bool isSelected(EntityId entityId)
const {
125 for (
auto &
id : selected) {
if (
id == entityId)
return true; }
130 EntityId
getSelectedId()
const {
return numSelected() == 1U ? selected.back() : NoEntity; }
141 findPattern = pattern;
146 catch (std::regex_error) {
147 findRegex = std::string();
156 bool isFindRegexValid()
const {
return validRegex; }
162 std::string erasedSelections;
163 for (
size_t i = selected.size(); i > 0; --i) {
164 const size_t index = i - 1u;
166 erasedSelections +=
' ' + std::to_string(selected[index]);
167 selected.erase(selected.begin() + index);
171 if (!erasedSelections.empty()) {
175 return erasedSelections;
178 std::vector<ComponentModel::Entity *> selectedPath;
180 std::unordered_map<int, TextureHandle> icons;
182 glm::vec3 startTranslation = glm::vec3(0);
183 glm::vec3 endTranslation = glm::vec3(0);
185 glm::quat startRotation;
186 glm::quat endRotation;
188 glm::vec3 startScale;
191 std::vector<glm::vec3> startTranslations;
192 std::vector<glm::quat> startRotations;
193 std::vector<glm::vec3> startScales;
198 bool wasUsingGizmo =
false;
200 bool lButtonDown =
false;
205 rapidjson::Document copied;
207 float translateSnap = 0.1f;
208 float rotateSnap = 1.0f;
209 float scaleSnap = 0.1f;
215 std::string findPattern;
216 std::regex findRegex;
217 bool validRegex =
true;
Container for components, providing composition of dynamic entities.
A Context instance contains all the services, systems and runtime components needed to use Cogs.
class EntityStore * store
Entity store.
ComponentModel::Entity * getEntityPtr(const EntityId entityId)
Get a raw pointer to the entity with the given id.
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
std::weak_ptr< ComponentModel::Entity > WeakEntityPtr
Weak Smart pointer for Entity access.
std::vector< std::shared_ptr< ICommandState > > commandStates
EntityId getSelectedId() const
Gets entity ID of the single selected entity.
void updateSelectedInfo()
Update information in LastPickedState when selection changes.
std::string eraseInvalidSelected()
void setFindPattern(const std::string &pattern)
Entity search pattern.
const std::regex & getFindRegex() const
Entity search pattern as Regexp for lookup.
const std::string & getFindPattern() const
Gets Entity search pattern.
std::span< const EntityId > getAllSelectedIds() const
Get Entity Ids of all selected entities.
ComponentModel::Entity * getSelected() const
Gets entity Pointer to the single selected entity. Nullptr if not one selected or not found.
WeakEntityPtr editorCamera
Editor scene camera.
void setSelection(const EntityIds &ids)
Set new selected entities.
Shows information about last picking.
EntityId rootId
Root entity ID.
std::string assetRootGroupName
Asset root name (Name of root Group node from rvmparser - grandchild).
std::string pickId
Pick details. Picked Texture ID.
std::string details
Pick details. AssetTag.
void clear()
Clear Picking information.