diff --git a/engine/includes/components/component.h b/engine/includes/components/component.h index f7be1d132..49b648a80 100644 --- a/engine/includes/components/component.h +++ b/engine/includes/components/component.h @@ -68,7 +68,7 @@ class ENGINE_EXPORT Component : public Object { bool hasTag(const TString &tag); bool hasTagByHash(uint32_t hash); - const std::vector &tags() const; + std::vector &tags(); virtual void composeComponent(); diff --git a/engine/includes/components/scene.h b/engine/includes/components/scene.h index c51df0caf..037dfbb18 100644 --- a/engine/includes/components/scene.h +++ b/engine/includes/components/scene.h @@ -20,6 +20,7 @@ class ENGINE_EXPORT Scene : public Object { public: Scene(); Scene(const Scene &origin); + ~Scene(); World *world() const; diff --git a/engine/src/components/component.cpp b/engine/src/components/component.cpp index d96f5907e..97f03bce7 100644 --- a/engine/src/components/component.cpp +++ b/engine/src/components/component.cpp @@ -191,7 +191,7 @@ bool Component::hasTagByHash(uint32_t hash) { /*! Returns list of component tags. */ -const std::vector &Component::tags() const { +std::vector &Component::tags() { return m_tags; } /*! diff --git a/engine/src/components/scene.cpp b/engine/src/components/scene.cpp index 4fda548f7..64256c6d6 100644 --- a/engine/src/components/scene.cpp +++ b/engine/src/components/scene.cpp @@ -1,6 +1,7 @@ #include "components/scene.h" #include "components/world.h" +#include "components/component.h" /*! \class Scene @@ -21,6 +22,17 @@ Scene::Scene(const Scene &origin) : m_modified(origin.m_modified) { } + +Scene::~Scene() { + for(auto &group : m_groups) { + for(auto it : group.second) { + Component *component = dynamic_cast(it); + if(component) { + component->tags().clear(); + } + } + } +} /*! Returns the World to which the scene belongs. */ diff --git a/engine/src/components/transform.cpp b/engine/src/components/transform.cpp index 37ef27133..b163a8d78 100644 --- a/engine/src/components/transform.cpp +++ b/engine/src/components/transform.cpp @@ -207,9 +207,12 @@ void Transform::setParent(Object *parent, int32_t position, bool force) { } Object::setParent(parent, 0, force); - Actor *p = dynamic_cast(actor()->parent()); - if(p) { - setParentTransform(p->transform(), true); + Actor *actor = Transform::actor(); + if(actor) { + Actor *p = dynamic_cast(actor->parent()); + if(p) { + setParentTransform(p->transform(), true); + } } } /*! diff --git a/worldeditor/bin/editor/materials/gizmo.shader b/worldeditor/bin/editor/materials/gizmo.shader index d82837386..28724cbb6 100644 --- a/worldeditor/bin/editor/materials/gizmo.shader +++ b/worldeditor/bin/editor/materials/gizmo.shader @@ -27,7 +27,7 @@ void main(void) { proj.y = 1.0 - proj.y; #endif float depth = getLinearDepth(texture(depthMap, proj).x, nearClipPlane(), farClipPlane()); - rgb = _color;//(depth >= _vertex.z) ? _color : vec4(_color.xyz, _color.w * 0.25); + rgb = (depth >= _vertex.z) ? _color : vec4(_color.xyz, _color.w * 0.1); } ]]> assetTypeName(str) == Map::metaClass()->name()) { - emit dropMap((ProjectSettings::instance()->contentPath() + "/" + str).data(), (event->keyboardModifiers() & Qt::ControlModifier)); + emit dropMap(str.data(), (event->keyboardModifiers() & Qt::ControlModifier)); return; } } @@ -606,9 +606,8 @@ void ObjectController::onDragEnter(QDragEnterEvent *event) { StringList list = TString(event->mimeData()->data(gMimeContent)).split(";"); AssetManager *mgr = AssetManager::instance(); - for(TString str : list) { + for(TString &str : list) { if(!str.isEmpty()) { - str = ProjectSettings::instance()->contentPath() + "/" + str; TString type = mgr->assetTypeName(str); if(type != Map::metaClass()->name()) { Actor *actor = mgr->createActor(str);