summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes/Inspector
diff options
context:
space:
mode:
Diffstat (limited to 'src/Authoring/Studio/Palettes/Inspector')
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp1
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp42
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h2
3 files changed, 24 insertions, 21 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
index 2335ba2d..0f4e2032 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
@@ -1608,6 +1608,7 @@ void InspectorControlModel::setShaderValue(long instance, int handle, const QVar
const auto doc = g_StudioApp.GetCore()->GetDoc();
const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
+
Q3DStudio::SCOPED_DOCUMENT_EDITOR(*doc, QObject::tr("Set Material Type"))
->SetMaterialType(instance, v);
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
index e427c2de..361ad0e0 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
@@ -121,6 +121,24 @@ void InspectorControlView::OnNewPresentation()
m_DirectoryConnection = g_StudioApp.getDirectoryWatchingSystem().AddDirectory(
g_StudioApp.GetCore()->getProjectFile().getProjectPath(),
std::bind(&InspectorControlView::onFilesChanged, this, std::placeholders::_1));
+
+ Q3DStudio::CGraph &theGraph(*g_StudioApp.GetCore()->GetDoc()->GetAssetGraph());
+ m_connections.push_back(theGraph.ConnectChildAdded(
+ std::bind(&InspectorControlView::onChildAdded, this, std::placeholders::_2)));
+}
+
+void InspectorControlView::onChildAdded(int inChild)
+{
+ const auto doc = g_StudioApp.GetCore()->GetDoc();
+ const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
+ if (bridge->IsCustomMaterialInstance(inChild)) {
+ QVector<qt3dsdm::Qt3DSDMInstanceHandle> refMats;
+ doc->getSceneReferencedMaterials(doc->GetSceneInstance(), refMats);
+ for (auto &refMat : qAsConst(refMats)) {
+ if ((int)bridge->getMaterialReference(refMat) == inChild)
+ g_StudioApp.GetCore()->GetDispatch()->FireImmediateRefreshInstance(refMat);
+ }
+ }
}
void InspectorControlView::OnClosingPresentation()
@@ -129,6 +147,7 @@ void InspectorControlView::OnClosingPresentation()
// presentations count as subpresentations
delete m_imageChooserView;
m_fileList.clear();
+ m_connections.clear();
}
void InspectorControlView::OnTimeChanged()
@@ -158,29 +177,10 @@ void InspectorControlView::onFilesChanged(
g_StudioApp.GetCore()->GetDoc()->GetDocumentDirectory(),
record.m_File));
- if (record.m_ModificationType == Q3DStudio::FileModificationType::Created) {
+ if (record.m_ModificationType == Q3DStudio::FileModificationType::Created)
qt3dsdm::binary_sort_insert_unique(m_fileList, relativePath);
- } else if (record.m_ModificationType
- == Q3DStudio::FileModificationType::Destroyed) {
+ else if (record.m_ModificationType == Q3DStudio::FileModificationType::Destroyed)
qt3dsdm::binary_sort_erase(m_fileList, relativePath);
- } else if (record.m_ModificationType == Q3DStudio::FileModificationType::Modified) {
- // TODO: Hot fix for a case when undoing a material type change does not update
- // in the scene (QT3DS-2768) (any better solution?)
- // This fix should be checked and removed if not needed after (QT3DS-2827) is
- // fixed
- const auto doc = g_StudioApp.GetCore()->GetDoc();
- const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
- auto mat = doc->getSceneEditor()->getMaterial(record.m_File.toQString());
- QVector<qt3dsdm::Qt3DSDMInstanceHandle> refMats;
- doc->getSceneReferencedMaterials(doc->GetSceneInstance(), refMats);
- for (auto &refMat : qAsConst(refMats)) {
- if (bridge->getMaterialReference(refMat) == mat) {
- const auto dispatch = g_StudioApp.GetCore()->GetDispatch();
- dispatch->FireImmediateRefreshInstance(refMat);
- break;
- }
- }
- }
} else if (isInList(fontExtensions, record.m_File.GetExtension())) {
if (record.m_ModificationType == Q3DStudio::FileModificationType::Created
|| record.m_ModificationType == Q3DStudio::FileModificationType::Destroyed) {
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h
index 400a26b4..3d62938f 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h
@@ -120,6 +120,7 @@ private:
bool canOpenInInspector(int instance, int handle) const;
void openInInspector();
void onInstancePropertyValueChanged(qt3dsdm::Qt3DSDMPropertyHandle propertyHandle);
+ void onChildAdded(int inChild);
std::shared_ptr<qt3dsdm::ISignalConnection> m_selectionChangedConnection;
std::shared_ptr<qt3dsdm::ISignalConnection> m_timeChanged;
@@ -138,6 +139,7 @@ private:
QPointer<DataInputSelectView> m_dataInputChooserView;
std::vector<Q3DStudio::CFilePath> m_fileList;
MouseHelper m_mouseHelper;
+ std::vector<std::shared_ptr<qt3dsdm::ISignalConnection>> m_connections;
int m_instance;
int m_handle;