summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp2
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/ImageChooserView.cpp1
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/ImageChooserView.h7
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp27
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.h3
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.cpp56
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.h13
7 files changed, 66 insertions, 43 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
index ac3c3b31..bc405586 100644
--- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
+++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp
@@ -2031,7 +2031,7 @@ public:
&& name != QLatin1String("timebartext");
}
- void saveIfMaterial(Qt3DSDMInstanceHandle instance)
+ void saveIfMaterial(Qt3DSDMInstanceHandle instance) override
{
Qt3DSDMInstanceHandle material;
if (m_Bridge.isInsideMaterialContainer(instance)) {
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/ImageChooserView.cpp b/src/Authoring/Qt3DStudio/Palettes/Inspector/ImageChooserView.cpp
index e8180f94..28819dc3 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/ImageChooserView.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/ImageChooserView.cpp
@@ -46,7 +46,6 @@ ImageChooserView::ImageChooserView(QWidget *parent)
: QQuickWidget(parent)
, m_model(new ImageChooserModel(true, this))
{
- setWindowTitle(tr("Images"));
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
setResizeMode(QQuickWidget::SizeRootObjectToView);
QTimer::singleShot(0, this, &ImageChooserView::initialize);
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/ImageChooserView.h b/src/Authoring/Qt3DStudio/Palettes/Inspector/ImageChooserView.h
index bbf8eff5..308356cc 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/ImageChooserView.h
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/ImageChooserView.h
@@ -36,6 +36,7 @@ class ImageChooserModel;
class ImageChooserView : public QQuickWidget
{
Q_OBJECT
+
Q_PROPERTY(bool focused READ isFocused NOTIFY focusChanged)
Q_PROPERTY(int instance READ instance)
Q_PROPERTY(int handle READ handle)
@@ -59,17 +60,17 @@ protected:
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
+ void showEvent(QShowEvent *event) override;
Q_SIGNALS:
void focusChanged();
private:
- void showEvent(QShowEvent *event) override;
void initialize();
bool isFocused() const;
- int m_handle = -1;
- int m_instance = -1;
+ int m_handle = 0;
+ int m_instance = 0;
ImageChooserModel *m_model = nullptr;
};
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
index 53519573..3680b5aa 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
@@ -172,17 +172,19 @@ void InspectorControlModel::notifyPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle
Q_EMIT dataChanged(index(0), index(rowCount() - 1));
}
-bool InspectorControlModel::hasInstanceProperty(long instance, int handle)
+bool InspectorControlModel::hasInstanceProperty(qt3dsdm::Qt3DSDMInstanceHandle instance,
+ qt3dsdm::Qt3DSDMPropertyHandle handle) const
{
for (const auto &group : qAsConst(m_groupElements)) {
for (const auto &element : qAsConst(group.controlElements)) {
InspectorControlBase *property = element.value<InspectorControlBase *>();
- if (property->m_property == qt3dsdm::CDataModelHandle(handle)
- && property->m_instance == qt3dsdm::CDataModelHandle(instance)) {
- return true;
+ if (property->m_property == handle) {
+ auto refInstance = getBridge()->getMaterialReference(property->m_instance);
+ return property->m_instance == instance || refInstance == instance;
}
}
}
+
return false;
}
@@ -772,9 +774,10 @@ InspectorControlBase* InspectorControlModel::createItem(Qt3DSDMInspectable *insp
// properties explicitly set as controllable in metadata
item->m_controllable = item->m_animatable || metaProperty.m_Controllable;
- // disable IBL Override for reference materials
+ // disable IBL Override for reference and 'default basic' materials
if (item->m_title == QLatin1String("IBL Override")
- && getBridge()->GetObjectType(item->m_instance) == OBJTYPE_REFERENCEDMATERIAL) {
+ && getBridge()->GetObjectType(item->m_instance) == OBJTYPE_REFERENCEDMATERIAL
+ && (!isBasicMaterial() || getBridge()->isDefaultMaterial(item->m_instance))) {
item->m_enabled = false;
}
auto signalProvider = studio->GetFullSystemSignalProvider();
@@ -1096,8 +1099,18 @@ void InspectorControlModel::updatePropertyValue(InspectorControlBase *element) c
auto studioSystem = doc->GetStudioSystem();
const auto propertySystem = studioSystem->GetPropertySystem();
qt3dsdm::SValue value;
- const auto instance = element->m_instance;
+ auto instance = element->m_instance;
qt3dsdm::Option<qt3dsdm::SMetaDataPropertyInfo> info;
+
+ // For ref materials update IBL Override from the referenced material. This applies only for
+ // basic materials as IBL Override is disabled for referenced (and default basic) materials.
+ if (element->m_property
+ == getBridge()->GetObjectDefinitions().m_MaterialBase.m_IblProbe.m_Property) {
+ int refInstance = getBridge()->getMaterialReference(instance);
+ if (refInstance)
+ instance = refInstance;
+ }
+
if (m_guideInspectable) {
value = m_guideInspectable->properties()
[handleToGuidePropIndex(element->m_property)]->GetInspectableData();
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.h b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.h
index 3063f047..05a3ee57 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.h
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.h
@@ -130,7 +130,8 @@ public:
void refresh();
void saveIfMaterial(qt3dsdm::Qt3DSDMInstanceHandle instance);
- bool hasInstanceProperty(long instance, int handle);
+ bool hasInstanceProperty(qt3dsdm::Qt3DSDMInstanceHandle instance,
+ qt3dsdm::Qt3DSDMPropertyHandle handle) const;
qt3dsdm::SValue currentPropertyValue(long instance, int handle) const;
QString currentControllerValue(long instance, int handle) const;
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.cpp
index e4e0379f..e73a0e24 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.cpp
@@ -278,8 +278,7 @@ QString InspectorControlView::titleText() const
bool InspectorControlView::isRefMaterial(int instance) const
{
- auto bridge = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetClientDataModelBridge();
- return bridge->IsReferencedMaterialInstance(instance);
+ return getBridge()->IsReferencedMaterialInstance(instance);
}
QString InspectorControlView::noneString() const
@@ -289,24 +288,23 @@ QString InspectorControlView::noneString() const
bool InspectorControlView::canLinkProperty(int instance, int handle) const
{
- CDoc *doc = g_StudioApp.GetCore()->GetDoc();
- const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
-
- if (bridge->isInsideMaterialContainer(instance))
+ if (getBridge()->isInsideMaterialContainer(instance))
return false;
- if (bridge->IsMaterialBaseInstance(instance)) // all material types are unlinkable
+ if (getBridge()->IsMaterialBaseInstance(instance)) // all material types are unlinkable
return false;
- if (handle == bridge->GetSceneAsset().m_Eyeball.m_Property) // eyeball is unlinkable
+ if (handle == getBridge()->GetSceneAsset().m_Eyeball.m_Property) // eyeball is unlinkable
return false;
+ CDoc *doc = g_StudioApp.GetCore()->GetDoc();
return doc->GetDocumentReader().CanPropertyBeLinked(instance, handle);
}
bool InspectorControlView::canOpenInInspector(int instance, int handle) const
{
const auto doc = g_StudioApp.GetCore()->GetDoc();
+
qt3dsdm::SValue value;
doc->GetPropertySystem()->GetInstancePropertyValue(instance, handle, value);
if (!value.empty() && value.getType() == qt3dsdm::DataModelDataType::Long4) {
@@ -319,12 +317,12 @@ bool InspectorControlView::canOpenInInspector(int instance, int handle) const
void InspectorControlView::openInInspector()
{
const auto doc = g_StudioApp.GetCore()->GetDoc();
- const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
+
qt3dsdm::SValue value;
doc->GetPropertySystem()->GetInstancePropertyValue(m_contextMenuInstance, m_contextMenuHandle,
value);
qt3dsdm::SLong4 guid = qt3dsdm::get<qt3dsdm::SLong4>(value);
- const auto instance = bridge->GetInstanceByGUID(guid);
+ const auto instance = getBridge()->GetInstanceByGUID(guid);
doc->SelectDataModelObject(instance);
}
@@ -333,11 +331,10 @@ void InspectorControlView::onPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle inIn
{
m_inspectorControlModel->notifyPropertyChanged(inInstance, inProperty);
- auto bridge = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetClientDataModelBridge();
// titleChanged implies icon change too, but that will only occur if inspectable type changes,
// which will invalidate the inspectable anyway, so in reality we are only interested in name
// property here
- if (inProperty == bridge->GetNameProperty() && m_inspectableBase
+ if (inProperty == getBridge()->GetNameProperty() && m_inspectableBase
&& m_inspectableBase->isValid()) {
Q_EMIT titleChanged();
}
@@ -349,13 +346,12 @@ void InspectorControlView::onChildAdded(int inChild)
if (m_activeBrowser.isActive() && m_activeBrowser.m_browser == m_objectReferenceView)
m_activeBrowser.clear();
- const auto doc = g_StudioApp.GetCore()->GetDoc();
- const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
- if (bridge->IsCustomMaterialInstance(inChild)) {
+ if (getBridge()->IsCustomMaterialInstance(inChild)) {
QVector<qt3dsdm::Qt3DSDMInstanceHandle> refMats;
+ auto doc = g_StudioApp.GetCore()->GetDoc();
doc->getSceneReferencedMaterials(doc->GetSceneInstance(), refMats);
for (auto &refMat : qAsConst(refMats)) {
- if ((int)bridge->getMaterialReference(refMat) == inChild)
+ if (int(getBridge()->getMaterialReference(refMat)) == inChild)
g_StudioApp.GetCore()->GetDispatch()->FireImmediateRefreshInstance(refMat);
}
}
@@ -429,16 +425,15 @@ CInspectableBase *InspectorControlView::createInspectableFromSelectable(
if (selectedsInstances.size() == 1) {
Qt3DSDMInstanceHandle selectedInstance = selectedsInstances[0];
if (doc->GetDocumentReader().IsInstance(selectedInstance)) {
- auto *bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
qt3dsdm::Qt3DSDMSlideHandle activeSlide = doc->GetActiveSlide();
// Scene or Component (when being edited)
- if (selectedInstance == bridge->GetOwningComponentInstance(activeSlide)) {
+ if (selectedInstance == getBridge()->GetOwningComponentInstance(activeSlide)) {
Qt3DSDMInstanceHandle activeSlideInstance = doc->GetStudioSystem()
->GetSlideSystem()->GetSlideInstance(activeSlide);
inspectableBase = new Qt3DSDMInspectable(selectedInstance,
activeSlideInstance);
- } else if (bridge->IsMaterialBaseInstance(selectedInstance)) {
+ } else if (getBridge()->IsMaterialBaseInstance(selectedInstance)) {
inspectableBase = new Qt3DSDMMaterialInspectable(selectedInstance);
} else {
inspectableBase = new Qt3DSDMInspectable(selectedInstance);
@@ -480,7 +475,6 @@ void InspectorControlView::showContextMenu(int x, int y, int handle, int instanc
QMenu theContextMenu;
- auto doc = g_StudioApp.GetCore()->GetDoc();
if (canOpenInInspector(instance, handle)) {
auto action = theContextMenu.addAction(tr("Open in Inspector"));
@@ -488,6 +482,7 @@ void InspectorControlView::showContextMenu(int x, int y, int handle, int instanc
}
if (canLinkProperty(instance, handle)) {
+ auto doc = g_StudioApp.GetCore()->GetDoc();
bool isLinked = doc->GetDocumentReader().IsPropertyLinked(instance, handle);
auto action = theContextMenu.addAction(isLinked ? tr("Unlink Property from Master Slide")
: tr("Link Property from Master Slide"));
@@ -634,6 +629,14 @@ QObject *InspectorControlView::showImageChooser(int handle, int instance, const
});
}
+ // For basic materials edit IBL Override of the referenced material. This applies only for basic
+ // materials as IBL Override is disabled for referenced (and default basic) materials.
+ if (handle == getBridge()->GetObjectDefinitions().m_MaterialBase.m_IblProbe.m_Property) {
+ int refInstance = getBridge()->getMaterialReference(instance);
+ if (refInstance)
+ instance = refInstance;
+ }
+
m_imageChooserView->setHandle(handle);
m_imageChooserView->setInstance(instance);
@@ -838,10 +841,8 @@ QColor InspectorControlView::showColorDialog(const QColor &color, int instance,
{
bool showAlpha = false;
if (instance && handle) {
- auto bridge = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()
- ->GetClientDataModelBridge();
- showAlpha = bridge->getBGColorProperty(instance).GetHandleValue() == handle
- || bridge->getTextColorProperty(instance).GetHandleValue() == handle;
+ showAlpha = getBridge()->getBGColorProperty(instance).GetHandleValue() == handle
+ || getBridge()->getTextColorProperty(instance).GetHandleValue() == handle;
}
m_currentColor = color;
@@ -854,7 +855,7 @@ QColor InspectorControlView::showColorDialog(const QColor &color, int instance,
return currentColor;
}
-bool InspectorControlView::toolTipsEnabled()
+bool InspectorControlView::toolTipsEnabled() const
{
return CStudioPreferences::ShouldShowTooltips();
}
@@ -919,6 +920,11 @@ void InspectorControlView::OnEndDataModelNotifications()
}
}
+CClientDataModelBridge *InspectorControlView::getBridge() const
+{
+ return g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetClientDataModelBridge();
+}
+
void InspectorControlView::OnImmediateRefreshInstanceSingle(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
{
m_inspectorControlModel->refresh();
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.h b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.h
index 75d07d73..ff969c03 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.h
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.h
@@ -51,6 +51,7 @@ class ObjectListModel;
class FileChooserView;
class TextureChooserView;
class MaterialRefView;
+class CClientDataModelBridge;
QT_FORWARD_DECLARE_CLASS(QAbstractItemModel)
@@ -86,7 +87,7 @@ public:
Q_INVOKABLE QObject *showObjectReference(int handle, int instance, const QPoint &point);
Q_INVOKABLE QObject *showMaterialReference(int handle, int instance, const QPoint &point);
Q_INVOKABLE QObject *showTextureChooser(int handle, int instance, const QPoint &point);
- Q_INVOKABLE bool toolTipsEnabled();
+ Q_INVOKABLE bool toolTipsEnabled() const;
Q_INVOKABLE bool isRefMaterial(int instance) const;
Q_INVOKABLE bool isEditable(int handle) const;
Q_INVOKABLE QString convertPathToProjectRoot(const QString &presentationPath);
@@ -143,6 +144,8 @@ private:
QPointer<MaterialRefView> m_matRefListWidget;
QPointer<ObjectListModel> m_objectReferenceModel;
QPointer<DataInputSelectView> m_dataInputChooserView;
+ CClientDataModelBridge *getBridge() const;
+
std::vector<Q3DStudio::CFilePath> m_fileList;
MouseHelper m_mouseHelper;
QmlUtils m_qmlUtils;
@@ -167,8 +170,8 @@ private:
if (isActive())
m_browser->close();
m_browser.clear();
- m_handle = -1;
- m_instance = -1;
+ m_handle = 0;
+ m_instance = 0;
}
bool isActive() const
{
@@ -176,8 +179,8 @@ private:
}
QPointer<QWidget> m_browser = nullptr;
- int m_handle = -1;
- int m_instance = -1;
+ int m_handle = 0;
+ int m_instance = 0;
};
ActiveBrowserData m_activeBrowser;