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
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ void ObjectHierarchyModel::showNone() {
m_showNone = true;
}

Object *ObjectHierarchyModel::getObject(const QModelIndex &index) const {
return Engine::findObject(index.internalId(), m_rootItem);
}

QVariant ObjectHierarchyModel::data(const QModelIndex &index, int role) const {
if(!index.isValid()) {
return QVariant();
}
Object *object = Engine::findObject(index.internalId(), m_rootItem);
Object *object = getObject(index);
Actor *actor = dynamic_cast<Actor *>(object);
Scene *scene = dynamic_cast<Scene *>(object);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class ObjectHierarchyModel : public QAbstractItemModel {

void showNone();

Object *getObject(const QModelIndex &index) const;

private:
QVariant data(const QModelIndex &index, int role) const override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
#include "assetlist.h"

ObjectSelectBrowser::ObjectSelectBrowser(QWidget *parent) :
QWidget(parent),
ui(new Ui::ObjectSelectBrowser),
m_object(nullptr),
m_componentProxy(new ObjectsFilter(this)),
m_contentProxy(new AssetFilter(this)),
m_contentNone(new ProxyModelNoneEntry(this)) {
QWidget(parent),
ui(new Ui::ObjectSelectBrowser),
m_object(nullptr),
m_componentProxy(new ObjectsFilter(this)),
m_contentProxy(new AssetFilter(this)),
m_contentNone(new ProxyModelNoneEntry(this)) {

ui->setupUi(this);

Expand Down Expand Up @@ -102,7 +102,9 @@ void ObjectSelectBrowser::on_lineEdit_textChanged(const QString &arg1) {
}

void ObjectSelectBrowser::on_treeView_doubleClicked(const QModelIndex &index) {
emit componentSelected(static_cast<Object *>(m_componentProxy->mapToSource(index).internalPointer()));
QModelIndex origin = m_componentProxy->mapToSource(index);
ObjectHierarchyModel *model = static_cast<ObjectHierarchyModel *>(m_componentProxy->sourceModel());
emit componentSelected(model->getObject(origin));
}

void ObjectSelectBrowser::on_listView_doubleClicked(const QModelIndex &index) {
Expand Down
6 changes: 6 additions & 0 deletions worldeditor/src/screens/propertyedit/property.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <system.h>
#include <invalid.h>
#include <world.h>
#include <editor/propertyedit.h>

#include <QMetaProperty>
Expand Down Expand Up @@ -389,6 +390,11 @@ QVariant Property::qObjectVariant(const Variant &value, const std::string &typeN
Actor *actor = dynamic_cast<Actor *>(m_nextObject);
if(actor) {
scene = actor->scene();
} else {
Component *comp = dynamic_cast<Component *>(m_nextObject);
if(comp) {
scene = comp->scene();
}
}
}

Expand Down