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
1 change: 1 addition & 0 deletions engine/includes/editor/editorplatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class ENGINE_EXPORT EditorPlatform : public PlatformAdaptor {
void setKeys(QKeyEvent *ev, bool release);

void update() override;
void reset();

protected:
EditorPlatform();
Expand Down
2 changes: 0 additions & 2 deletions engine/includes/editor/viewport/cameracontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ class ENGINE_EXPORT CameraController : public QObject {

Camera *camera() const { return m_activeCamera; }

bool cameraInMove() const { return m_cameraInMove; }

Axis gridAxis() const { return m_gridAxis; }
void setGridAxis(Axis axis) { m_gridAxis = axis; }

Expand Down
4 changes: 4 additions & 0 deletions engine/includes/systems/resourcesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class ENGINE_EXPORT ResourceSystem : public System {

void deleteFromCahe(Resource *resource);

void makeClean();

private:
void update(World *) override;

Expand All @@ -60,6 +62,8 @@ class ENGINE_EXPORT ResourceSystem : public System {

ObjectList m_deleteList;

bool m_clean;

};

#endif // RESOURCESYSTEM_H
4 changes: 4 additions & 0 deletions engine/src/editor/assetmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ void AssetManager::rescan() {
#endif
m_assetProvider->onDirectoryChangedForce(m_projectManager->contentPath().data(), m_force);

if(m_force) {
Engine::resourceSystem()->makeClean();
}

emit directoryChanged(m_projectManager->contentPath().data());

reimport();
Expand Down
15 changes: 15 additions & 0 deletions engine/src/editor/editorplatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,21 @@ void EditorPlatform::update() {
m_mouseDelta = Vector4();
}

void EditorPlatform::reset() {
m_inputString.clear();

m_mouseScrollDelta = 0.0f;
m_mouseDelta = Vector4();

for(auto &it : m_keys) {
it = NONE;
}

for(auto &it : m_mouseButtons) {
it = NONE;
}
}

bool EditorPlatform::key(Input::KeyCode code) const {
return (m_keys.value(code) > RELEASE);
}
Expand Down
2 changes: 1 addition & 1 deletion engine/src/editor/viewport/cameracontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void CameraController::move() {

t->setPosition(pos - delta * m_activeCamera->focalDistance() * 0.1f);

m_cameraSpeed -= m_cameraSpeed * 3.0f * DT;
m_cameraSpeed -= m_cameraSpeed * 4.0f * DT;
if(m_cameraSpeed.length() <= .01f) {
m_cameraSpeed = Vector3();
}
Expand Down
4 changes: 3 additions & 1 deletion engine/src/editor/viewport/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,12 @@ void Viewport::onDraw() {
m_renderSystem->update(m_world);

if(isFocused()) {
if(!m_gameView) {
if(!m_gameView && m_controller) {
m_controller->update();
}
instance.update();
} else {
instance.reset();
}

if(m_screenInProgress && m_color) {
Expand Down
11 changes: 8 additions & 3 deletions engine/src/systems/resourcesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
#include "resources/tileset.h"
#include "resources/tilemap.h"

ResourceSystem::ResourceSystem() {
ResourceSystem::ResourceSystem() :
m_clean(false) {
setName("ResourceSystem");

// The order is critical for the import
Expand Down Expand Up @@ -101,7 +102,7 @@ void ResourceSystem::setResource(Resource *object, const TString &uuid) {
Resource *ResourceSystem::loadResource(const TString &path) {
PROFILE_FUNCTION();

if(!path.isEmpty() && !m_indexMap.empty()) {
if(!path.isEmpty() && !m_clean) {
TString uuid = path;

Resource *object = resource(uuid);
Expand Down Expand Up @@ -131,7 +132,7 @@ Resource *ResourceSystem::loadResource(const TString &path) {
}

Resource *ResourceSystem::loadResourceAsync(const TString &path) {
if(!path.isEmpty() && !m_indexMap.empty()) {
if(!path.isEmpty() && !m_clean) {
ResourceInfo info;

auto indexIt = m_indexMap.find(path);
Expand Down Expand Up @@ -235,6 +236,10 @@ void ResourceSystem::deleteFromCahe(Resource *resource) {
}
}

void ResourceSystem::makeClean() {
m_clean = true;
}

void ResourceSystem::processState(Resource *resource) {
if(resource) {
switch(resource->state()) {
Expand Down
Loading