Disabling basetexture generation

There are no stupid questions, just stupid answers.

Disabling basetexture generation

Duion
Posts: 1647
Joined: Sun Feb 08, 2015 1:51 am

I need to disable the automatic basetexture regeneration when something is changed on the map, but only in certain cases.
My workflow involves editing the automaticly generated terrain level_basetex.dds file to make the terrain more individual and detailed and as a workaround I just set the file to write protected, the problem is if you distribute the game to other platforms the permissions are not kept, so I need a new method now, any ideas?

Re: Disabling basetexture generation

Gav
Posts: 13
Joined: Sun Feb 08, 2015 10:26 pm
I think the proper way is to add a new field to the terrain object (a boolean flag). Then you can modify this function to check the flag and enable or disable the basetexture generation.

Re: Disabling basetexture generation

Duion
Posts: 1647
Joined: Sun Feb 08, 2015 1:51 am

Sounds good, but I have no idea how to do that. I know that you can set dynamic fields for objects in the editor, but I don't know how to do it on the C++ side.

Re: Disabling basetexture generation

Gav
Posts: 13
Joined: Sun Feb 08, 2015 10:26 pm
You just need to copy an existing variable like this. You can create a new protected boolean variable mUpdateTexture to the class, initialize it with true here and add the field here. Then change this line to:

Code: Select all

if ( Platform::compareModifiedTimes( baseCachePath, mTerrFileName ) < 0 && mUpdateTexture )
.

EDIT: You also need to read/write the mUpdateTexture variable to the network stream (TerrainBlock::packUpdate() & TerrainBlock::unpackUpdate())

Re: Disabling basetexture generation

Duion
Posts: 1647
Joined: Sun Feb 08, 2015 1:51 am

Wow thanks, seems to work. Only drawback is when you paint the terrain it changes, but at least it does not get saved later into that file, which is enough for me for now.

Who is online

Users browsing this forum: Bing [Bot] and 6 guests