22
22
23
23
void QgsSkyboxSettings::readXml ( const QDomElement &element, const QgsReadWriteContext &context )
24
24
{
25
- Q_UNUSED ( context );
25
+ const QgsPathResolver &pathResolver = context. pathResolver ( );
26
26
mIsSkyboxEnabled = element.attribute ( QStringLiteral ( " skybox-enabled" ) ).toInt ();
27
27
QString skyboxTypeStr = element.attribute ( QStringLiteral ( " skybox-type" ) );
28
28
if ( skyboxTypeStr == QStringLiteral ( " Textures collection" ) )
@@ -33,19 +33,18 @@ void QgsSkyboxSettings::readXml( const QDomElement &element, const QgsReadWriteC
33
33
mSkyboxType = QgsSkyboxEntity::HDRSkybox;
34
34
mSkyboxBaseName = element.attribute ( QStringLiteral ( " base-name" ) );
35
35
mSkyboxExt = element.attribute ( QStringLiteral ( " extension" ) );
36
- mHDRTexturePath = element.attribute ( QStringLiteral ( " HDR-texture-path" ) );
36
+ mHDRTexturePath = element.attribute ( pathResolver. readPath ( QStringLiteral ( " HDR-texture-path" ) ) );
37
37
mCubeMapFacesPaths .clear ();
38
- mCubeMapFacesPaths [ QStringLiteral ( " posX" ) ] = element.attribute ( QStringLiteral ( " posX-texture-path" ) );
39
- mCubeMapFacesPaths [ QStringLiteral ( " posY" ) ] = element.attribute ( QStringLiteral ( " posY-texture-path" ) );
40
- mCubeMapFacesPaths [ QStringLiteral ( " posZ" ) ] = element.attribute ( QStringLiteral ( " posZ-texture-path" ) );
41
- mCubeMapFacesPaths [ QStringLiteral ( " negX" ) ] = element.attribute ( QStringLiteral ( " negX-texture-path" ) );
42
- mCubeMapFacesPaths [ QStringLiteral ( " negY" ) ] = element.attribute ( QStringLiteral ( " negY-texture-path" ) );
43
- mCubeMapFacesPaths [ QStringLiteral ( " negZ" ) ] = element.attribute ( QStringLiteral ( " negZ-texture-path" ) );
38
+ mCubeMapFacesPaths [ QStringLiteral ( " posX" ) ] = element.attribute ( pathResolver. readPath ( QStringLiteral ( " posX-texture-path" ) ) );
39
+ mCubeMapFacesPaths [ QStringLiteral ( " posY" ) ] = element.attribute ( pathResolver. readPath ( QStringLiteral ( " posY-texture-path" ) ) );
40
+ mCubeMapFacesPaths [ QStringLiteral ( " posZ" ) ] = element.attribute ( pathResolver. readPath ( QStringLiteral ( " posZ-texture-path" ) ) );
41
+ mCubeMapFacesPaths [ QStringLiteral ( " negX" ) ] = element.attribute ( pathResolver. readPath ( QStringLiteral ( " negX-texture-path" ) ) );
42
+ mCubeMapFacesPaths [ QStringLiteral ( " negY" ) ] = element.attribute ( pathResolver. readPath ( QStringLiteral ( " negY-texture-path" ) ) );
43
+ mCubeMapFacesPaths [ QStringLiteral ( " negZ" ) ] = element.attribute ( pathResolver. readPath ( QStringLiteral ( " negZ-texture-path" ) ) );
44
44
}
45
45
46
46
void QgsSkyboxSettings::writeXml ( QDomElement &element, const QgsReadWriteContext &context ) const
47
47
{
48
- Q_UNUSED ( context );
49
48
element.setAttribute ( QStringLiteral ( " skybox-enabled" ), mIsSkyboxEnabled );
50
49
switch ( mSkyboxType )
51
50
{
@@ -59,13 +58,15 @@ void QgsSkyboxSettings::writeXml( QDomElement &element, const QgsReadWriteContex
59
58
element.setAttribute ( QStringLiteral ( " skybox-type" ), QStringLiteral ( " HDR texture" ) );
60
59
break ;
61
60
}
61
+
62
+ const QgsPathResolver &pathResolver = context.pathResolver ();
62
63
element.setAttribute ( QStringLiteral ( " base-name" ), mSkyboxBaseName );
63
64
element.setAttribute ( QStringLiteral ( " extension" ), mSkyboxExt );
64
- element.setAttribute ( QStringLiteral ( " HDR-texture-path" ), mHDRTexturePath );
65
- element.setAttribute ( QStringLiteral ( " posX-texture-path" ), mCubeMapFacesPaths [ QStringLiteral ( " posX" ) ] );
66
- element.setAttribute ( QStringLiteral ( " posY-texture-path" ), mCubeMapFacesPaths [ QStringLiteral ( " posY" ) ] );
67
- element.setAttribute ( QStringLiteral ( " posZ-texture-path" ), mCubeMapFacesPaths [ QStringLiteral ( " posZ" ) ] );
68
- element.setAttribute ( QStringLiteral ( " negX-texture-path" ), mCubeMapFacesPaths [ QStringLiteral ( " negX" ) ] );
69
- element.setAttribute ( QStringLiteral ( " negY-texture-path" ), mCubeMapFacesPaths [ QStringLiteral ( " negY" ) ] );
70
- element.setAttribute ( QStringLiteral ( " negZ-texture-path" ), mCubeMapFacesPaths [ QStringLiteral ( " negZ" ) ] );
65
+ element.setAttribute ( QStringLiteral ( " HDR-texture-path" ), pathResolver. writePath ( mHDRTexturePath ) );
66
+ element.setAttribute ( QStringLiteral ( " posX-texture-path" ), pathResolver. writePath ( mCubeMapFacesPaths [ QStringLiteral ( " posX" ) ] ) );
67
+ element.setAttribute ( QStringLiteral ( " posY-texture-path" ), pathResolver. writePath ( mCubeMapFacesPaths [ QStringLiteral ( " posY" ) ] ) );
68
+ element.setAttribute ( QStringLiteral ( " posZ-texture-path" ), pathResolver. writePath ( mCubeMapFacesPaths [ QStringLiteral ( " posZ" ) ] ) );
69
+ element.setAttribute ( QStringLiteral ( " negX-texture-path" ), pathResolver. writePath ( mCubeMapFacesPaths [ QStringLiteral ( " negX" ) ] ) );
70
+ element.setAttribute ( QStringLiteral ( " negY-texture-path" ), pathResolver. writePath ( mCubeMapFacesPaths [ QStringLiteral ( " negY" ) ] ) );
71
+ element.setAttribute ( QStringLiteral ( " negZ-texture-path" ), pathResolver. writePath ( mCubeMapFacesPaths [ QStringLiteral ( " negZ" ) ] ) );
71
72
}
0 commit comments