Skip to content

Commit 229f5df

Browse files
committed
Various fixes
1 parent 529c2bd commit 229f5df

File tree

8 files changed

+36
-7
lines changed

8 files changed

+36
-7
lines changed

engine/includes/editor/editorplatform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class ENGINE_EXPORT EditorPlatform : public PlatformAdaptor {
3333
void setKeys(QKeyEvent *ev, bool release);
3434

3535
void update() override;
36+
void reset();
3637

3738
protected:
3839
EditorPlatform();

engine/includes/editor/viewport/cameracontroller.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ class ENGINE_EXPORT CameraController : public QObject {
5959

6060
Camera *camera() const { return m_activeCamera; }
6161

62-
bool cameraInMove() const { return m_cameraInMove; }
63-
6462
Axis gridAxis() const { return m_gridAxis; }
6563
void setGridAxis(Axis axis) { m_gridAxis = axis; }
6664

engine/includes/systems/resourcesystem.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class ENGINE_EXPORT ResourceSystem : public System {
4343

4444
void deleteFromCahe(Resource *resource);
4545

46+
void makeClean();
47+
4648
private:
4749
void update(World *) override;
4850

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

6163
ObjectList m_deleteList;
6264

65+
bool m_clean;
66+
6367
};
6468

6569
#endif // RESOURCESYSTEM_H

engine/src/editor/assetmanager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ void AssetManager::rescan() {
144144
#endif
145145
m_assetProvider->onDirectoryChangedForce(m_projectManager->contentPath().data(), m_force);
146146

147+
if(m_force) {
148+
Engine::resourceSystem()->makeClean();
149+
}
150+
147151
emit directoryChanged(m_projectManager->contentPath().data());
148152

149153
reimport();

engine/src/editor/editorplatform.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,21 @@ void EditorPlatform::update() {
198198
m_mouseDelta = Vector4();
199199
}
200200

201+
void EditorPlatform::reset() {
202+
m_inputString.clear();
203+
204+
m_mouseScrollDelta = 0.0f;
205+
m_mouseDelta = Vector4();
206+
207+
for(auto &it : m_keys) {
208+
it = NONE;
209+
}
210+
211+
for(auto &it : m_mouseButtons) {
212+
it = NONE;
213+
}
214+
}
215+
201216
bool EditorPlatform::key(Input::KeyCode code) const {
202217
return (m_keys.value(code) > RELEASE);
203218
}

engine/src/editor/viewport/cameracontroller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ void CameraController::move() {
207207

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

210-
m_cameraSpeed -= m_cameraSpeed * 3.0f * DT;
210+
m_cameraSpeed -= m_cameraSpeed * 4.0f * DT;
211211
if(m_cameraSpeed.length() <= .01f) {
212212
m_cameraSpeed = Vector3();
213213
}

engine/src/editor/viewport/viewport.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,12 @@ void Viewport::onDraw() {
215215
m_renderSystem->update(m_world);
216216

217217
if(isFocused()) {
218-
if(!m_gameView) {
218+
if(!m_gameView && m_controller) {
219219
m_controller->update();
220220
}
221221
instance.update();
222+
} else {
223+
instance.reset();
222224
}
223225

224226
if(m_screenInProgress && m_color) {

engine/src/systems/resourcesystem.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
#include "resources/tileset.h"
3535
#include "resources/tilemap.h"
3636

37-
ResourceSystem::ResourceSystem() {
37+
ResourceSystem::ResourceSystem() :
38+
m_clean(false) {
3839
setName("ResourceSystem");
3940

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

104-
if(!path.isEmpty() && !m_indexMap.empty()) {
105+
if(!path.isEmpty() && !m_clean) {
105106
TString uuid = path;
106107

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

133134
Resource *ResourceSystem::loadResourceAsync(const TString &path) {
134-
if(!path.isEmpty() && !m_indexMap.empty()) {
135+
if(!path.isEmpty() && !m_clean) {
135136
ResourceInfo info;
136137

137138
auto indexIt = m_indexMap.find(path);
@@ -235,6 +236,10 @@ void ResourceSystem::deleteFromCahe(Resource *resource) {
235236
}
236237
}
237238

239+
void ResourceSystem::makeClean() {
240+
m_clean = true;
241+
}
242+
238243
void ResourceSystem::processState(Resource *resource) {
239244
if(resource) {
240245
switch(resource->state()) {

0 commit comments

Comments
 (0)