Question about nature model scaling when using model replacements

Discuss modding questions and implementation details.
Post Reply
User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Question about nature model scaling when using model replacements

Post by BadLuckBurt »

I have a question about the random scaling that's applied when you use 3d replacements for the nature flats.

My concrete question is if there is already a way to override the function I mention below?

In the MeshReplacement class there is this function:

Code: Select all

static Func<float> getTreeScaleCallback = () => Random.Range(0.6f, 1.4f);
This gets called when a replacement model is loaded in for a nature flat. The random range is a bit large for some models but there doesn't seem to be any way to override or control this to a finer degree. I'm aware this was implemented back when VMBlast did his trees and it never got any attention after that so probably needs to be developed further.

The problem is that you never get the nature object back when MeshReplacement loads it, it just gets added to the terrain with the random scaling applied so it can't be manipulated afterwards. Ideally I'd just like to pass the scaling as an optional parameter to the ImportNatureGameObject method.

There's also another function that deals with randomizing the color of the trees, I'd probably add that as an optional parameter as well. When the parameters are unset they can still fall back on the getTreeScaleCallback and getTreeColorCallback functions.

Alternatively, if it's already possible to override these two functions I'd appreciate it if someone could point me in the right direction on how to do it :)
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

Post Reply