forked from qt-creator/qt-creator
QmlPuppet: Fix imported 3D asset library icon generation
Recent changes to custom geometry handling now require that the zoom process in icon creation does each focus step asynchronously, so that selection box geometry has a chance to update between frames. Fixes: QDS-4652 Change-Id: If92bf580a556a68c10d3af1406c2eabef530254a Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -135,7 +135,7 @@ void IconRenderer::setupRender()
|
||||
resizeContent(m_size);
|
||||
if (!initRhi())
|
||||
QTimer::singleShot(0, qGuiApp, &QGuiApplication::quit);
|
||||
QTimer::singleShot(0, this, &IconRenderer::createIcon);
|
||||
QTimer::singleShot(0, this, &IconRenderer::startCreateIcon);
|
||||
} else {
|
||||
QTimer::singleShot(0, qGuiApp, &QGuiApplication::quit);
|
||||
}
|
||||
@@ -144,25 +144,41 @@ void IconRenderer::setupRender()
|
||||
}
|
||||
}
|
||||
|
||||
void IconRenderer::createIcon()
|
||||
void IconRenderer::startCreateIcon()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
m_designerSupport.refFromEffectItem(m_containerItem, false);
|
||||
#endif
|
||||
QQuickDesignerSupportItems::disableNativeTextRendering(m_containerItem);
|
||||
|
||||
if (m_is3D)
|
||||
QTimer::singleShot(0, this, &IconRenderer::focusCamera);
|
||||
else
|
||||
QTimer::singleShot(0, this, &IconRenderer::finishCreateIcon);
|
||||
}
|
||||
|
||||
void IconRenderer::focusCamera()
|
||||
{
|
||||
#ifdef QUICK3D_MODULE
|
||||
if (m_is3D) {
|
||||
// Render once to make sure scene is up to date before we set up the selection box
|
||||
render({});
|
||||
QMetaObject::invokeMethod(m_containerItem, "setSceneToBox");
|
||||
int tries = 0;
|
||||
while (tries < 10) {
|
||||
++tries;
|
||||
render({});
|
||||
QMetaObject::invokeMethod(m_containerItem, "fitAndHideBox");
|
||||
}
|
||||
if (m_focusStep >= 10) {
|
||||
QTimer::singleShot(0, this, &IconRenderer::finishCreateIcon);
|
||||
return;
|
||||
}
|
||||
|
||||
render({});
|
||||
|
||||
if (m_focusStep == 0) {
|
||||
QMetaObject::invokeMethod(m_containerItem, "setSceneToBox");
|
||||
} else if (m_focusStep > 1 && m_focusStep < 10) {
|
||||
QMetaObject::invokeMethod(m_containerItem, "fitAndHideBox");
|
||||
}
|
||||
++m_focusStep;
|
||||
QTimer::singleShot(0, this, &IconRenderer::focusCamera);
|
||||
#endif
|
||||
}
|
||||
|
||||
void IconRenderer::finishCreateIcon()
|
||||
{
|
||||
QFileInfo fi(m_filePath);
|
||||
|
||||
// Render regular size image
|
||||
|
||||
Reference in New Issue
Block a user