forked from qt-creator/qt-creator
QmlDesigner: Fix state preview rendering with multiple View3Ds
Multiple View3Ds with shared resources such as materials don't always properly dirty themselves when a shared resource changes. Work around this issue by rendering the base state twice if there are multiple View3Ds. Fixes: QDS-8618 Change-Id: I3840a082ff8e55557afe5a5f139382d82cd6b184 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Mahmoud Badri
parent
08d4eab619
commit
970af9e64d
@@ -53,15 +53,28 @@ void Qt5PreviewNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
||||
QQuickDesignerSupport::polishItems(quickWindow());
|
||||
|
||||
QVector<ImageContainer> imageContainerVector;
|
||||
|
||||
// Base state needs to be rendered twice to properly render shared resources,
|
||||
// if there is more than one View3D and at least one of them is dirty.
|
||||
bool dirtyView3d = false;
|
||||
const QList<ServerNodeInstance> view3dInstances = allView3DInstances();
|
||||
for (const auto &instance : view3dInstances) {
|
||||
if (QQuickDesignerSupport::isDirty(instance.rootQuickItem(),
|
||||
QQuickDesignerSupport::ContentUpdateMask)) {
|
||||
dirtyView3d = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dirtyView3d)
|
||||
renderPreviewImage();
|
||||
imageContainerVector.append(ImageContainer(0, renderPreviewImage(), -1));
|
||||
|
||||
QList<ServerNodeInstance> stateInstances = rootNodeInstance().stateInstances();
|
||||
|
||||
const QList<ServerNodeInstance> groupInstances = allGroupStateInstances();
|
||||
|
||||
for (ServerNodeInstance instance : groupInstances) {
|
||||
for (const ServerNodeInstance &instance : groupInstances)
|
||||
stateInstances.append(instance.stateInstances());
|
||||
}
|
||||
|
||||
for (ServerNodeInstance instance : std::as_const(stateInstances)) {
|
||||
instance.activateState();
|
||||
|
Reference in New Issue
Block a user