summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/ObjectBrowserView.cpp27
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/ObjectListModel.cpp8
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/ObjectListModel.h1
3 files changed, 34 insertions, 2 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/ObjectBrowserView.cpp b/src/Authoring/Studio/Palettes/Inspector/ObjectBrowserView.cpp
index 0b6db847..41be5767 100644
--- a/src/Authoring/Studio/Palettes/Inspector/ObjectBrowserView.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/ObjectBrowserView.cpp
@@ -30,6 +30,10 @@
#include "ObjectListModel.h"
#include "StudioPreferences.h"
#include "StudioUtils.h"
+#include "StudioApp.h"
+#include "Core.h"
+#include "Qt3DSDMStudioSystem.h"
+#include "ClientDataModelBridge.h"
#include <QtCore/qtimer.h>
#include <QtQml/qqmlcontext.h>
@@ -50,10 +54,29 @@ QAbstractItemModel *ObjectBrowserView::model() const
void ObjectBrowserView::setModel(ObjectListModel *model)
{
- if (!m_model) {
+ if (!m_model)
m_model = new FlatObjectListModel(model, this);
- }
m_model->setSourceModel(model);
+
+ const auto doc = g_StudioApp.GetCore()->GetDoc();
+ const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
+
+ // Remove "Scene.__Container" and "materials//Default" entries
+ QModelIndexList list = m_model->match(m_model->index(0, 0),
+ ObjectListModel::AbsolutePathRole,
+ QStringLiteral("Scene.")
+ + bridge->getMaterialContainerName(), 1,
+ Qt::MatchFlags(Qt::MatchWrap | Qt::MatchExactly
+ | Qt::MatchRecursive));
+ list.append(m_model->match(m_model->index(0, 0),
+ ObjectListModel::NameRole,
+ QStringLiteral("materials/") + bridge->getDefaultMaterialName(), 1,
+ Qt::MatchFlags(Qt::MatchWrap | Qt::MatchExactly
+ | Qt::MatchRecursive)));
+
+ for (int i = list.size(); i > 0; i--)
+ m_model->removeRow(list.at(i - 1).row(), m_model->index(0, 0));
+
m_ownerInstance = 0;
m_selection = -1;
diff --git a/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.cpp b/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.cpp
index 3bff2d7a..ad66274a 100644
--- a/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.cpp
@@ -407,6 +407,14 @@ int FlatObjectListModel::rowCount(const QModelIndex &parent) const
return m_sourceInfo.count();
}
+bool FlatObjectListModel::removeRows(int row, int count, const QModelIndex &parent)
+{
+ beginRemoveRows(parent, row, row + count - 1);
+ m_sourceInfo.remove(row, count);
+ endRemoveRows();
+ return true;
+}
+
void FlatObjectListModel::setSourceModel(ObjectListModel *sourceModel)
{
beginResetModel();
diff --git a/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.h b/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.h
index 89b5a93c..4013f15c 100644
--- a/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.h
+++ b/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.h
@@ -118,6 +118,7 @@ public:
int role = Qt::DisplayRole) const;
bool setData(const QModelIndex &index, const QVariant &data, int role = Qt::EditRole) override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
void setSourceModel(ObjectListModel *sourceModel);
ObjectListModel *sourceModel() const { return m_sourceModel; }