Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions engine/includes/editor/assetmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <QTimer>
#include <QImage>

#include <set>

#include <engine.h>
#include <module.h>
#include <url.h>
Expand Down
2 changes: 2 additions & 0 deletions engine/includes/editor/codebuilder.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef CODEBUILDER_H
#define CODEBUILDER_H

#include <set>

#include "assetconverter.h"

class QAbstractItemModel;
Expand Down
2 changes: 2 additions & 0 deletions engine/includes/editor/projectsettings.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef PROJECTSETTINGS_H
#define PROJECTSETTINGS_H

#include <set>

#include <engine.h>

#include <resources/map.h>
Expand Down
4 changes: 3 additions & 1 deletion engine/includes/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,12 @@ class ENGINE_EXPORT Engine : public ObjectSystem {
void removeNativeBehaviour(NativeBehaviour *native);

private:
friend class System;

bool event(Event *event) override;

static void addSystem(System *system);

static void removeSystem(System *system);
};

#endif // ENGINE_H
1 change: 1 addition & 0 deletions engine/includes/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ENGINE_EXPORT System : public ObjectSystem {

public:
System();
~System();

virtual bool init();

Expand Down
21 changes: 19 additions & 2 deletions engine/src/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,13 @@ Engine::Engine(const char *path) {
Engine::~Engine() {
PROFILE_FUNCTION();

for(auto it : m_serial) {
auto localSerial = m_serial;
for(auto it : localSerial) {
delete it;
}

for(auto it : m_pool) {
auto localPool = m_pool;
for(auto it : localPool) {
delete it->m_system;
delete it;
}
Expand Down Expand Up @@ -610,6 +612,21 @@ void Engine::addSystem(System *system) {
m_resourceSystem = static_cast<ResourceSystem *>(system);
}
}
/*!
Removes a game \a system from pool.
*/
void Engine::removeSystem(System *system) {
PROFILE_FUNCTION();

m_serial.remove(system);

for(auto it : m_pool) {
if(it->m_system == system) {
m_pool.remove(it);
break;
}
}
}
/*!
Returns game World.
\note The game can have only one scene graph. World is a root object, all map loads on this World.
Expand Down
5 changes: 5 additions & 0 deletions engine/src/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ System::System() :
m_world(nullptr) {

}

System::~System() {
Engine::removeSystem(this);
}

/*!
Can be used to initialize and execute necessary routines.
This method will be called automatically just after the engine started.
Expand Down
2 changes: 2 additions & 0 deletions modules/renders/rendervk/src/wrappervk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <log.h>
#include <engine.h>

#include <set>

#if defined(SHARED_DEFINE)
#include <QDebug>

Expand Down
2 changes: 0 additions & 2 deletions thirdparty/next/inc/core/objectsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#define OBJECTSYSTEM_H

#include <unordered_map>
#include <set>
#include <memory>
#include <thread>

#include <astring.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <components/actor.h>
#include <components/component.h>

#include <set>

ChangeObjectProperty::ChangeObjectProperty(const Object::ObjectList &objects, const TString &property, const Variant &value, ObjectController *ctrl, const TString &name, UndoCommand *group) :
UndoCommand(name, group),
m_value(value),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <components/scene.h>
#include <components/actor.h>

#include <set>

CreateObject::CreateObject(const TString &type, Scene *scene, ObjectController *ctrl, UndoCommand *group) :
UndoCommand(QObject::tr("Create %1").arg(type.data()).toStdString(), group),
m_type(type),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include <log.h>

#include <set>

CreateObjectSerial::CreateObjectSerial(const TString &ref, const Vector3 &position, uint32_t parent, ObjectController *ctrl, const TString &name, UndoCommand *group) :
UndoCommand(name, group),
m_reference(ref),
Expand Down
11 changes: 4 additions & 7 deletions worldeditor/src/screens/scenecomposer/objectcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,9 @@ bool ObjectController::setIsolatedPrefab(Prefab *prefab) {
if(actor) {
onSelectActor({actor});

onFocusActor(actor);
float bottom;
setFocusOn(actor, bottom);

blockMovement(true);
setFree(false);
} else {
Expand Down Expand Up @@ -504,11 +506,6 @@ void ObjectController::onRemoveActor(Object::ObjectList objects) {
undoRedo()->push(new DeleteObjects(objects, this));
}

void ObjectController::onFocusActor(Object *object) {
float bottom;
setFocusOn(dynamic_cast<Actor *>(object), bottom);
}

void ObjectController::onChangeTool() {
std::string name(sender()->objectName().toStdString());
for(auto &it : m_tools) {
Expand Down Expand Up @@ -564,7 +561,7 @@ void ObjectController::onUpdateSelected() {
void ObjectController::onDrop(QDropEvent *event) {
StringList list = TString(event->mimeData()->data(gMimeContent)).split(";");
AssetManager *mgr = AssetManager::instance();
for(TString str : list) {
for(TString &str : list) {
if(!str.isEmpty()) {
if(mgr->assetTypeName(str) == Map::metaClass()->name()) {
emit dropMap((ProjectSettings::instance()->contentPath() + "/" + str).data(), (event->keyboardModifiers() & Qt::ControlModifier));
Expand Down
2 changes: 0 additions & 2 deletions worldeditor/src/screens/scenecomposer/objectcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public slots:
void onSelectActor(Object::ObjectList list, bool additive = false);
void onRemoveActor(Object::ObjectList objects);

void onFocusActor(Object *object);

void onChangeTool();

void onUpdated(Scene *scene = nullptr);
Expand Down
3 changes: 2 additions & 1 deletion worldeditor/src/screens/scenecomposer/scenecomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ void SceneComposer::onObjectCreate(TString type) {

void SceneComposer::onObjectsSelected(Object::ObjectList objects, bool force) {
if(force) {
m_controller->onFocusActor(objects.front());
float bottom;
m_controller->setFocusOn(dynamic_cast<Actor *>(objects.front()), bottom);
}

m_controller->onSelectActor(objects);
Expand Down
Loading