HaArLiNsH

[1.3]TextureReplacerReplaced v0.4

Recommended Posts

Gordon Dry    116
6 minutes ago, lajoswinkler said:

although I've only used it for a custom skybox

Hmm. Could this be the reason for my issue?

I also did only add a skybox (Default & EnvMap) - I did not add texture packs for kerbal heads or suits (btw hard to find such packs which are not way outdated or point to websites no more existing).

Share this post


Link to post
Share on other sites
xEvilReeperx    1066
On 6/13/2017 at 10:56 AM, Cetera said:

@xEvilReeperx made a custom mod to replace the navball texture after it stopped working in TR.  Dragging him into the discussion, in case he's still around and interested in contributing.

I'm around if help is needed but it's fairly straightforward. Only gotcha was (iirc) that the IVA NavBall is or was flipped horizontally for some reason

On 6/13/2017 at 5:46 AM, Ger_space said:

2. set the gameobject to inactive 

collarObject.SetActive(false); to make is dissapiar and collarObject.SetActive(true); to make it visible.

There isn't a collar object so it's not quite that easy, it's mixed in with the body mesh. But actually it's not too hard to just extract the collar triangles and create a new collar GO which you then treat exactly like that. The transparent texture idea would probably work but it's going to result in some side effects and is probably just more effort overall

Spoiler
wkWLL.pngwkXZb.png  

 

It would probably be wise to stitch the top of the suit closed as a next step though. You can see (in Val's case especially) that her suit doesn't quite meet her neck so the effect is somewhat spoiled

Spoiler

// Remove "Collar" from body of Kerbal mesh, moves it into its own mesh parented to the helmet
[KSPAddon(KSPAddon.Startup.MainMenu, true)]
class ModifyKerbalHelmetModel : MonoBehaviour
{
    private static readonly Color CollarMaskColor = Color.red;  
    
    private void Start()
    {
        var suitMask = new Texture2D(1, 1);

        // easiest way to identify the collar is just to take any suit texture, paint the relevant areas
        // whatever the collar mask color is, and sample it when checking vertices to identify the ones
        // associated with the collar. Only needs to be done at startup, texture can be destroyed as soon
        // as we're done
        if (!suitMask.LoadImage(File.ReadAllBytes(Application.dataPath + "/../GameData/suit_mask.png")))
        {
            Destroy(suitMask);
            Debug.LogError("missing suit mask");
            return;
        }

        var kerbals = new[]
        {
            PartLoader.getPartInfoByName("kerbalEVA"),
            PartLoader.getPartInfoByName("kerbalEVAfemale")
        };

        foreach (var k in kerbals)
        {
            if (k == null)
            {
                Debug.LogError("Failed to retrieve a kerbalEVA part prefab");
                continue;
            }

            var keva = k.partPrefab.GetComponent<KerbalEVA>();

            if (keva == null)
            {
                Debug.LogError("Missing KerbalEVA script on " + k.name);
                continue;
            }

            var bodyModel = keva.transform.Find("model01/female01/body01") ?? keva.transform.Find("model01/body01");

            if (bodyModel == null)
            {
                Debug.LogWarning("KerbalEVA transform hierarchy unexpected: " + k.name);
                continue;
            }

            var bodySmr = bodyModel.GetComponent<SkinnedMeshRenderer>();

            if (bodySmr == null)
            {
                Debug.LogWarning("KerbalEVA does not have SMR in expected place: " + k.name);
                continue;
            }

            try
            {
                MergeCollarToHelmet(keva, suitMask);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                Debug.LogError("Failed to edit suit collar: " + k.name);
            }
        }

        Destroy(suitMask);
        Destroy(gameObject);
    }


    private static void MergeCollarToHelmet([NotNull] KerbalEVA keva, [NotNull] Texture2D collarSuitMask)
    {
        if (keva == null) throw new ArgumentNullException("keva");
        if (collarSuitMask == null) throw new ArgumentNullException("collarSuitMask");

        var body = keva.transform.Find("model01/female01/body01") ?? keva.transform.Find("model01/body01");

        if (body == null) throw new ArgumentException("couldn't find body transform");

        var helmetModel = keva.transform.Find("model01/helmet01") ?? keva.transform.Find("model01/female01/helmet01");

        if (helmetModel == null)
        {

            throw new ArgumentException("couldn't find helmet transform");
        }

        var kerbalBody = body.GetComponent<SkinnedMeshRenderer>();

        if (kerbalBody == null)
            throw new ArgumentException("couldn't find SkinnedMeshRenderer for body");

        var collarMesh = new Mesh();

        var srcVertices = kerbalBody.sharedMesh.vertices;
        var srcUvs = kerbalBody.sharedMesh.uv;
        var srcTriangles = kerbalBody.sharedMesh.triangles;
        var srcBoneWeights = kerbalBody.sharedMesh.boneWeights;
        var srcNormals = kerbalBody.sharedMesh.normals;

        var vertices = new List<Vector3>();
        var uvs = new List<Vector2>();
        var triangles = new List<int>();
        var normals = new List<Vector3>();
        var boneWeights = new List<BoneWeight>();


        var srcVertexToDestVertexMap = new Dictionary<int, int>(); // [src index, dest index]

        // collect every vertex that's a part of the collar of the suit
        for (int i = 0; i < srcVertices.Length; ++i)
        {
            var maskColor = collarSuitMask.GetPixel((int)(srcUvs[i].x * collarSuitMask.width),
                (int)(srcUvs[i].y * collarSuitMask.height));

            if (!Mathf.Approximately(CollarMaskColor.r, maskColor.r) ||
                !Mathf.Approximately(CollarMaskColor.g, maskColor.g) ||
                !Mathf.Approximately(CollarMaskColor.b, maskColor.b)) continue;

            // this vertex is part of the collar, we just need its data so nothing
            // fancy going on here
            vertices.Add(srcVertices[i]);
            uvs.Add(srcUvs[i]);
            normals.Add(srcNormals[i]);
            boneWeights.Add(srcBoneWeights[i]);

            srcVertexToDestVertexMap[i] = vertices.Count - 1; // we need to know how old vertex index relates to new vertex index so
                                                                // we can figure out how to map triangles
        }


        // collect every triangle that's a part of the suit collar. Use the mapping of 
        // old vertex index -> new vertex index to figure out correct indices
        for (int tri = 0; tri < srcTriangles.Length; tri += 3)
        {
            // if every vertex is a part of the collar, tri belongs to the collar
            if (srcVertexToDestVertexMap.ContainsKey(srcTriangles[tri + 0]) &&
                srcVertexToDestVertexMap.ContainsKey(srcTriangles[tri + 1]) &&
                srcVertexToDestVertexMap.ContainsKey(srcTriangles[tri + 2]))
            {
                // 1. Add this tri to the collar
                triangles.Add(srcVertexToDestVertexMap[srcTriangles[tri + 0]]);
                triangles.Add(srcVertexToDestVertexMap[srcTriangles[tri + 1]]);
                triangles.Add(srcVertexToDestVertexMap[srcTriangles[tri + 2]]);

                // 2. remove this tri from the suit. Leaves vertices intact
                if (tri < srcTriangles.Length - 3) // if last tri, no need to shift elements
                {
                    Array.Copy(srcTriangles, tri + 3, srcTriangles, tri, srcTriangles.Length - (tri + 3));
                }

                Array.Resize(ref srcTriangles, srcTriangles.Length - 3);
                tri -= 3;
            }
        }

        // sanity check, because silently failing is bad 
        if (vertices.Count == 0 || triangles.Count == 0)
        {
            Debug.LogWarning("Suit mask seems wrong -- no vertices or triangles matched");
        }

        // create collar mesh
        collarMesh.vertices = vertices.ToArray();
        collarMesh.triangles = triangles.ToArray();
        collarMesh.uv = uvs.ToArray();
        collarMesh.normals = normals.ToArray();
        collarMesh.bindposes = kerbalBody.sharedMesh.bindposes;
        collarMesh.boneWeights = boneWeights.ToArray();
        collarMesh.Optimize();

        // update suit mesh's triangles (we removed some)
        kerbalBody.sharedMesh.triangles = srcTriangles;
        kerbalBody.sharedMesh.Optimize();

        // and here we set up the transform + renderer for the collar mesh just made
        var clone = new GameObject("Collar.Helmet");

        clone.AddComponent<MeshFilter>().sharedMesh = collarMesh;

        var collarRenderer = clone.AddComponent<SkinnedMeshRenderer>();

        collarRenderer.sharedMaterial = kerbalBody.sharedMaterial;
        collarRenderer.sharedMesh = collarMesh;
        collarRenderer.bones = kerbalBody.bones;

        clone.transform.position = kerbalBody.transform.position;
        clone.transform.rotation = kerbalBody.transform.rotation;
        clone.layer = kerbalBody.gameObject.layer;
        clone.transform.parent = helmetModel.transform; // now disabling the helmet will disable the helmet's collar, too
    }
}

 

 

Share this post


Link to post
Share on other sites
HaArLiNsH    176
Posted (edited)

I miss one day but the train never stop :cool:

19 hours ago, Gordon Dry said:

I just let Bob leave a rover-like vehicle that I launched with on KSC runway.

As soon as on EVA the log got spammed with:


NullReferenceException: Object reference not set to an instance of an object
  at TextureReplacer.Personaliser.isUnderSubOrbit (.Kerbal kerbal) [0x00000] in <filename unknown>:0 
  at TextureReplacer.Personaliser+TREvaModule.Update () [0x00000] in <filename unknown>:0 

This happened while I tried out Kerbal Konstructs but that also doesn't like my install and massively spammed.

So I'm not sure if "normally" TRR would not spam the log when doing EVA on earth.

I will try it again tomorrow without several problematic mods.

(Mods are usually always problematic as soon as more than a dozen are installed. Unity doesn't like mods. IMHO.)

Thx for the report, I will look into it as soon as I can. This is from my new suite sate and yes this is still kind of work in progress.

I did not checked the log ingame yet :)

Except the log spam, did you encounter another problem ?

 

4 hours ago, lajoswinkler said:

Now that this has been continued, why don't you put it on Spacedock, too?

 

BTW, Texture Replacer works fine with me on v1.3, although I've only used it for a custom skybox.

I will put it on spacedock at the same time I'll put it on CKAN, when it will be in a "stable" release state, and you really don't want to have 42 prereleases on spacedock :) 

TextureReplacer works effectively on 1.3. but we want to add more features to it. And you can be sure that there will be several (broken) prereleases before this process is finish as I'm new to this.

So use TextureReplacer for you main save on 1.3 and if you feel adventurous, go on TRR :) 

 

3 hours ago, xEvilReeperx said:

I'm around if help is needed but it's fairly straightforward. Only gotcha was (iirc) that the IVA NavBall is or was flipped horizontally for some reason

There isn't a collar object so it's not quite that easy, it's mixed in with the body mesh. But actually it's not too hard to just extract the collar triangles and create a new collar GO which you then treat exactly like that. The transparent texture idea would probably work but it's going to result in some side effects and is probably just more effort overall

  Reveal hidden contents
wkWLL.pngwkXZb.png  

 

It would probably be wise to stitch the top of the suit closed as a next step though. You can see (in Val's case especially) that her suit doesn't quite meet her neck so the effect is somewhat spoiled

  Reveal hidden contents


// Remove "Collar" from body of Kerbal mesh, moves it into its own mesh parented to the helmet
[KSPAddon(KSPAddon.Startup.MainMenu, true)]
class ModifyKerbalHelmetModel : MonoBehaviour
{
    private static readonly Color CollarMaskColor = Color.red;  
    
    private void Start()
    {
        var suitMask = new Texture2D(1, 1);

        // easiest way to identify the collar is just to take any suit texture, paint the relevant areas
        // whatever the collar mask color is, and sample it when checking vertices to identify the ones
        // associated with the collar. Only needs to be done at startup, texture can be destroyed as soon
        // as we're done
        if (!suitMask.LoadImage(File.ReadAllBytes(Application.dataPath + "/../GameData/suit_mask.png")))
        {
            Destroy(suitMask);
            Debug.LogError("missing suit mask");
            return;
        }

        var kerbals = new[]
        {
            PartLoader.getPartInfoByName("kerbalEVA"),
            PartLoader.getPartInfoByName("kerbalEVAfemale")
        };

        foreach (var k in kerbals)
        {
            if (k == null)
            {
                Debug.LogError("Failed to retrieve a kerbalEVA part prefab");
                continue;
            }

            var keva = k.partPrefab.GetComponent<KerbalEVA>();

            if (keva == null)
            {
                Debug.LogError("Missing KerbalEVA script on " + k.name);
                continue;
            }

            var bodyModel = keva.transform.Find("model01/female01/body01") ?? keva.transform.Find("model01/body01");

            if (bodyModel == null)
            {
                Debug.LogWarning("KerbalEVA transform hierarchy unexpected: " + k.name);
                continue;
            }

            var bodySmr = bodyModel.GetComponent<SkinnedMeshRenderer>();

            if (bodySmr == null)
            {
                Debug.LogWarning("KerbalEVA does not have SMR in expected place: " + k.name);
                continue;
            }

            try
            {
                MergeCollarToHelmet(keva, suitMask);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                Debug.LogError("Failed to edit suit collar: " + k.name);
            }
        }

        Destroy(suitMask);
        Destroy(gameObject);
    }


    private static void MergeCollarToHelmet([NotNull] KerbalEVA keva, [NotNull] Texture2D collarSuitMask)
    {
        if (keva == null) throw new ArgumentNullException("keva");
        if (collarSuitMask == null) throw new ArgumentNullException("collarSuitMask");

        var body = keva.transform.Find("model01/female01/body01") ?? keva.transform.Find("model01/body01");

        if (body == null) throw new ArgumentException("couldn't find body transform");

        var helmetModel = keva.transform.Find("model01/helmet01") ?? keva.transform.Find("model01/female01/helmet01");

        if (helmetModel == null)
        {

            throw new ArgumentException("couldn't find helmet transform");
        }

        var kerbalBody = body.GetComponent<SkinnedMeshRenderer>();

        if (kerbalBody == null)
            throw new ArgumentException("couldn't find SkinnedMeshRenderer for body");

        var collarMesh = new Mesh();

        var srcVertices = kerbalBody.sharedMesh.vertices;
        var srcUvs = kerbalBody.sharedMesh.uv;
        var srcTriangles = kerbalBody.sharedMesh.triangles;
        var srcBoneWeights = kerbalBody.sharedMesh.boneWeights;
        var srcNormals = kerbalBody.sharedMesh.normals;

        var vertices = new List<Vector3>();
        var uvs = new List<Vector2>();
        var triangles = new List<int>();
        var normals = new List<Vector3>();
        var boneWeights = new List<BoneWeight>();


        var srcVertexToDestVertexMap = new Dictionary<int, int>(); // [src index, dest index]

        // collect every vertex that's a part of the collar of the suit
        for (int i = 0; i < srcVertices.Length; ++i)
        {
            var maskColor = collarSuitMask.GetPixel((int)(srcUvs[i].x * collarSuitMask.width),
                (int)(srcUvs[i].y * collarSuitMask.height));

            if (!Mathf.Approximately(CollarMaskColor.r, maskColor.r) ||
                !Mathf.Approximately(CollarMaskColor.g, maskColor.g) ||
                !Mathf.Approximately(CollarMaskColor.b, maskColor.b)) continue;

            // this vertex is part of the collar, we just need its data so nothing
            // fancy going on here
            vertices.Add(srcVertices[i]);
            uvs.Add(srcUvs[i]);
            normals.Add(srcNormals[i]);
            boneWeights.Add(srcBoneWeights[i]);

            srcVertexToDestVertexMap[i] = vertices.Count - 1; // we need to know how old vertex index relates to new vertex index so
                                                                // we can figure out how to map triangles
        }


        // collect every triangle that's a part of the suit collar. Use the mapping of 
        // old vertex index -> new vertex index to figure out correct indices
        for (int tri = 0; tri < srcTriangles.Length; tri += 3)
        {
            // if every vertex is a part of the collar, tri belongs to the collar
            if (srcVertexToDestVertexMap.ContainsKey(srcTriangles[tri + 0]) &&
                srcVertexToDestVertexMap.ContainsKey(srcTriangles[tri + 1]) &&
                srcVertexToDestVertexMap.ContainsKey(srcTriangles[tri + 2]))
            {
                // 1. Add this tri to the collar
                triangles.Add(srcVertexToDestVertexMap[srcTriangles[tri + 0]]);
                triangles.Add(srcVertexToDestVertexMap[srcTriangles[tri + 1]]);
                triangles.Add(srcVertexToDestVertexMap[srcTriangles[tri + 2]]);

                // 2. remove this tri from the suit. Leaves vertices intact
                if (tri < srcTriangles.Length - 3) // if last tri, no need to shift elements
                {
                    Array.Copy(srcTriangles, tri + 3, srcTriangles, tri, srcTriangles.Length - (tri + 3));
                }

                Array.Resize(ref srcTriangles, srcTriangles.Length - 3);
                tri -= 3;
            }
        }

        // sanity check, because silently failing is bad 
        if (vertices.Count == 0 || triangles.Count == 0)
        {
            Debug.LogWarning("Suit mask seems wrong -- no vertices or triangles matched");
        }

        // create collar mesh
        collarMesh.vertices = vertices.ToArray();
        collarMesh.triangles = triangles.ToArray();
        collarMesh.uv = uvs.ToArray();
        collarMesh.normals = normals.ToArray();
        collarMesh.bindposes = kerbalBody.sharedMesh.bindposes;
        collarMesh.boneWeights = boneWeights.ToArray();
        collarMesh.Optimize();

        // update suit mesh's triangles (we removed some)
        kerbalBody.sharedMesh.triangles = srcTriangles;
        kerbalBody.sharedMesh.Optimize();

        // and here we set up the transform + renderer for the collar mesh just made
        var clone = new GameObject("Collar.Helmet");

        clone.AddComponent<MeshFilter>().sharedMesh = collarMesh;

        var collarRenderer = clone.AddComponent<SkinnedMeshRenderer>();

        collarRenderer.sharedMaterial = kerbalBody.sharedMaterial;
        collarRenderer.sharedMesh = collarMesh;
        collarRenderer.bones = kerbalBody.bones;

        clone.transform.position = kerbalBody.transform.position;
        clone.transform.rotation = kerbalBody.transform.rotation;
        clone.layer = kerbalBody.gameObject.layer;
        clone.transform.parent = helmetModel.transform; // now disabling the helmet will disable the helmet's collar, too
    }
}

 

 

Ooooooooooooooooooooooooooooooooooooooooooooooooohh, even if this in not perfect yet, this look so promising !! :confused:

Sorry man, I will have to ask your help on this, you showed to much, I can't let you go :)


I did not have the time to look at the navball, I was working on the first version of the TRR guide pack.

Alright guys, expect new and fixed things in the coming days. So far the suit part is nearly done, already 49 textures files and it will go to 55 when the visors are finished for the full level suit set :) 

When I said that I opened the Pandora's Box with this idea of maintaining TR , I couldn't be more close to the truth. There is a lot of things to do and learn for a new modder like me, so please be patient for a real release version with all the stuff we all want working and shining.  

3 hours ago, Gordon Dry said:

Coincidence?

 

I don't know where this come from :)

one more thing on the "to fix" list, thx for the report.

Edited by HaArLiNsH

Share this post


Link to post
Share on other sites
Cetera    129
30 minutes ago, HaArLiNsH said:

Alright guys, expect new and fixed things in the coming days. So far the suit part is nearly done, already 49 textures files and it will go to 55 when the visors are finished for the full level suit set :) 

Nice, I'm looking forward to it!  Very interested to see what you've done.  I'm about half-way through my redo of my pack, maybe a little less.  I've had to almost completely start over from before, but it is going much better this time.  Last time I did so much by hand and manually editing everything.  This time, I've built myself templates with layers, and am able to move through a LOT faster.  I learned a lot doing it last time, and that's what it was for, and now I've progressed beyond where I was then.  Building up the process and "infrastructure" took a bit of work, but now I'm able to get things done, and make corrections when needed, without too much issue.  Of course, I'm not really making any "new" textures, just adding colors and shapes to stuff that's already there. 

 

Share this post


Link to post
Share on other sites
HaArLiNsH    176
Posted (edited)

I just finished the new github repo for the new TRR_Guide !

There you will find a collection of textures to learn how to use TRR and make your own textures. You can find it on the OP.

Expect this to changes as TRR changes, but from now, you will be able to see a working example of the different features of TRR.

And I need to say that they are big, I mean, the old time is over and its time to update our textures.. so I present you textures sized at 4096x4096 instead of the olds ones in 1024x1024.

yeah 4k textures works in KSP :)

Extract from the readme :

Quote

As you can see, the textures are saved in .png, this is clearly not the format you need to use for your finished textures. BUT, as we use big 4k texures and flat color for the guides, the compressed png weight less than a .dds. It takes more time to load but its a lot easier to share and you don't need a special plugin to be able to see them in your explorer.

Something usefull to know about the size and the weight of the files :

 - 4096x4096 .png no compressed = 64Mb
 - 4096x4096 .png compressed = 200Ko - 1Mb   (from a simple texture like the guide)
 - 4096x4096 .png compressed = 20Mb - 30Mb (from a full detail texture)
 - 4096x4096 .dds DXT1 = 10,6Mb

 The same goes for the NormalMap (NRM) :
 
- 4096x4096 .png NormalMap compressed = 500-600Ko
- 4096x4096 .dds DXT5 = 21,3Mb

So my advice is : use compressed .png while you work on your texture, then when all is ready to be release online, save them in .png non compressed and convert them to .dds
Also, don't use compressed .png for your NRM. Save them uncompressed and use this full size texture to make the NRM, if you use the online tool, it will compress the result anyway, so don't make a double compression.

!!! BEWARE !!!!

I don't think that making a full suits set composed of the 55 textures is a good idea if you plan to make a suits for each class of MKS.
A single full set can weight up to 650Mb, so if you plan to make 14 of them ...   :)
The jetpack and visor are not meaned to be used to all the levels, just use them if you want a difference for your level 3 and 5.

Of course, if you make your textures in 1024x1024 (or any size you want), you wont have the weight problem (but you will have old and tiny textures :P )

I also included the .psd I used to make them. (sry I only use photoshop..)

I did not had the time to really look at the code but meantime, @Ger_space is working like a mad voodoo shaman and is using all his black magic to fix and improve the shaders and reflections (and some others stuff that you don't want to know but that will make TRR better). 

So a big Thumb up for him please! :)

Edited by HaArLiNsH

Share this post


Link to post
Share on other sites
severedsolo    1085
Posted (edited)

Hey guys, I'm just popping in to report an incompatibility between TRR and EarnYourStripes

EarnYourStripes flips the "ProtoCrewMember.veteran" flag and in stock at least, removes the orange IVA suits from the "Big 4" (Jeb, Bob Bill, Val).

It seems that TRR is not checking that flag when assigning suits, and the Big 4 still get their orange suits in the flight scene. My guess would be that you are checking by name, instead of checking the veteran flag?

I haven't checked whether the other Kerbals still get their orange suits when EarnYourStripes gives it to them, but I would guess not.

Edited by severedsolo

Share this post


Link to post
Share on other sites
HaArLiNsH    176
2 hours ago, severedsolo said:

Hey guys, I'm just popping in to report an incompatibility between TRR and EarnYourStripes

EarnYourStripes flips the "ProtoCrewMember.veteran" flag and in stock at least, removes the orange IVA suits from the "Big 4" (Jeb, Bob Bill, Val).

It seems that TRR is not checking that flag when assigning suits, and the Big 4 still get their orange suits in the flight scene. My guess would be that you are checking by name, instead of checking the veteran flag?

I haven't checked whether the other Kerbals still get their orange suits when EarnYourStripes gives it to them, but I would guess not.

I need to check, but I think TRR still use the veteran flag because my badasses still have the orange suit when using the default texture and the others (non badass) have the white one.

Anyway, if you use TRR (or TR), you can assign the suits you want to anybody, so if you use a good suit pack (with all the classes and their badass counterpart) you can give veteran suit to anybody (or give normal suit to your vet). If the suit pack you use don't have veteran suits, its not the fault of TRR and there is nothing I can do. :)

Share this post


Link to post
Share on other sites
severedsolo    1085
Posted (edited)
16 minutes ago, HaArLiNsH said:

I need to check, but I think TRR still use the veteran flag because my badasses still have the orange suit when using the default texture and the others (non badass) have the white one.

My apologies I should have explained that better.

I am not using any suit packs, I am just using the stock suits. What seems to be happening, is that EarnYourStripes is turning the veteran flag off, but when the flights are loaded up, (I am going to assume it's TRR because I can only reproduce it with TRR installed) - TRR is still giving the Big 4 the original orange suits, but they shouldn't. This does not happen without TRR installed.

Edit; if you decide to test this for yourself, you'll need to turn the "remove existing honours" option on in EarnYourStripes

Screenshots:

1: As you can see, EarnYourStripes has (correctly) turned the orange suits off, and Kerbals should be given white suits on loading a flight.

T0Tp9on.jpg

2: Upon loading the flight however, they still have their orange suits.

ZFIOMVi.png

Edited by severedsolo

Share this post


Link to post
Share on other sites
HaArLiNsH    176

I see what you mean now, well the 4 badasses where hardcoded as veteran in TR, I think this was done to fix a problem where KSP would keep switching the suits.

Just one question : Why do you use TRR (or TR) if you don't use any suit pack ?  Is is mandatory for your mod to work ?

 

 

Share this post


Link to post
Share on other sites
severedsolo    1085
Posted (edited)
16 minutes ago, HaArLiNsH said:

Just one question : Why do you use TRR (or TR) if you don't use any suit pack ?  Is is mandatory for your mod to work ?

I'm using Diverse Kerbal Heads. I just don't use any suits.

16 minutes ago, HaArLiNsH said:

the 4 badasses where hardcoded as veteran in TR, I think this was done to fix a problem where KSP would keep switching the suits.

I figured that they were probably hardcoded. That's not all bad news though, it does mean the core functionality of EarnYourStripes will work, I'll just have to add a warning that it won't work on those 4 when using TRR.

Edited by severedsolo

Share this post


Link to post
Share on other sites
HaArLiNsH    176
37 minutes ago, severedsolo said:

I'm using Diverse Kerbal Heads. I just don't use any suits.

I figured that they were probably hardcoded. That's not all bad news though, it does mean the core functionality of EarnYourStripes will work, I'll just have to add a warning that it won't work on those 4 when using TRR.

You don't have problems with the others kerbals ? only the big 4 ?

Share this post


Link to post
Share on other sites
severedsolo    1085
Posted (edited)
3 minutes ago, HaArLiNsH said:

You don't have problems with the others kerbals ? only the big 4 ?

Ah, sorry. I assumed from what you were saying that it would work on other kerbals.

I just tested, and can confirm that when using stock suits, other kerbals who are given veteran status also don't wear the orange suits.

So yes, this is a problem that affects all Kerbals

Edited by severedsolo

Share this post


Link to post
Share on other sites
HaArLiNsH    176
9 minutes ago, severedsolo said:

Ah, sorry. I assumed from what you were saying that it would work on other kerbals.

I just tested, and can confirm that when using stock suits, other kerbals who are given veteran status also don't wear the orange suits.

So yes, this is a problem that affects all Kerbals

I was pretty sure it wont work, that's why I asked :)

And normally it should not work with TextureReplacer (as I didn't change how this part behave). I was looking at this veteran status when doing the 3 states for the suits and I think that this part of code is old , like before the suit pack existed for TR. (correct me if I'm wrong , I don't know all the details in the story of TR) And you can find this, that state who is veteran

private static readonly string[] VETERANS = { "Jebediah Kerman", "Bill Kerman", "Bob Kerman", "Valentina Kerman" };

it should be possible to change this but honestly I don't really see the point of "loosing time" (for both of us) with this as I strongly encourage people to use a suit pack with TRR as this mod was made to control who can have witch suit and change them accordingly to their level. Your mod and TRR (or TR) are doing pretty much the same thing (even more with the suits with levels that you can use in both TR & TRR).

We are still in the making of an updated list for the texture packs, so I'm sure every will be able to find a texture pack that suit his gameplay (stock alike or more custom).  

If this is something really critical for you, I can add it to my TODO list but unfortunately, I have A LOT of things to do before :)

This makes me think that if you create a kustom kerbal with the badass or veteran state, it should also not work and they should have the white suit and not the orange (didn't tested). I could look into this, but again, i don't really see the point of using TRR and don't use a suit pack with level :)  Wait a bit and you will have new and gorgeous suit packs that I'm sure will please you.

 

 

Share this post


Link to post
Share on other sites
Sigma88    1606

a check to read the "veteran" or "badSS" attribute can be added pretty easily to TRR

I can add that to my todolist

Share this post


Link to post
Share on other sites
HaArLiNsH    176
Posted (edited)
29 minutes ago, Sigma88 said:

a check to read the "veteran" or "badSS" attribute can be added pretty easily to TRR

I can add that to my todolist

As always your help is welcomed :) 

Also look at the new code from space_ger, I think he made changes on your initial work for MM (in the loading part). There were some merges done (not tested yet as I was working a bit on the TRR_guide) but normally it goes in the same direction.

 

I will need to update the specials thanks (and make a proper patch log) when we have finished the transition :kiss:

 

Edited by HaArLiNsH

Share this post


Link to post
Share on other sites
Sigma88    1606
Posted (edited)
30 minutes ago, HaArLiNsH said:

As always your help is welcomed :) 

Also look at the new code from space_ger, I think he made changes on your initial work for MM (in the loading part). There were some merges done (not tested yet as I was working a bit on the TRR_guide) but normally it goes in the same direction.

 

I will need to update the specials thanks (and make a proper patch log) when we have finished the transition :kiss:

 

I compiled the source from master and the test loads the red image instead of the green one.

so either I messed up the compiling or the new commits have broken mm compatibility


haven't tested this throughly, it was working fine before so unless there are some meaningful reason to keep the changes we can always roll back

 

EDIT: ok, have taken a better look and it works, I probably messed up the compile.

anyways, MainMenu.Awake() is a really busy time for a lot of mods, so unless there is some tangible advantage to do stuff at that point, I'd say stick with ModuleManagerPostLoad() 

Edited by Sigma88

Share this post


Link to post
Share on other sites
HaArLiNsH    176
2 hours ago, Sigma88 said:

I compiled the source from master and the test loads the red image instead of the green one.

so either I messed up the compiling or the new commits have broken mm compatibility


haven't tested this throughly, it was working fine before so unless there are some meaningful reason to keep the changes we can always roll back

 

EDIT: ok, have taken a better look and it works, I probably messed up the compile.

anyways, MainMenu.Awake() is a really busy time for a lot of mods, so unless there is some tangible advantage to do stuff at that point, I'd say stick with ModuleManagerPostLoad() 

Can you discuss this on the github  ? This way @Ger_space can join the conversation as he the one making these change and you both need to agree so your changes works together :) 

I did not tried another build than the last prerelease I've made (v0.2)

 

Share this post


Link to post
Share on other sites
Wyzard    138
8 hours ago, HaArLiNsH said:

Just one question : Why do you use TRR (or TR) if you don't use any suit pack ?

FWIW: I've only used TextureReplacer to load custom skyboxes, and I'm not really interested in things like custom suits and reflective faceplates.

Share this post


Link to post
Share on other sites
Gordon Dry    116

Is is TRR or TR that makes textures dark or black when using forced OpenGL on Windows?

It does not happen always, but it's a reason that I avoid OpenGL for some time now...

Best example:

The Kerbal's faces are black, like in a total darkness, but everything else seems okay (eyes, suit etc.).

Share this post


Link to post
Share on other sites
HaArLiNsH    176
2 hours ago, Wyzard said:

FWIW: I've only used TextureReplacer to load custom skyboxes, and I'm not really interested in things like custom suits and reflective faceplates.

I understand. Well we'll try to fix this :) 

 

 

2 hours ago, Gordon Dry said:

Is is TRR or TR that makes textures dark or black when using forced OpenGL on Windows?

It does not happen always, but it's a reason that I avoid OpenGL for some time now...

Best example:

The Kerbal's faces are black, like in a total darkness, but everything else seems okay (eyes, suit etc.).

hmm that sounds funny. I did not tried forced OpenGl on windows, so I can't really tell you, BUT I can tell you that Ger_space is working on a new shader system so hopefully this should solve the problem.

Share this post


Link to post
Share on other sites
Ger_space    376
5 hours ago, HaArLiNsH said:

I understand. Well we'll try to fix this :) 

 

 

hmm that sounds funny. I did not tried forced OpenGl on windows, so I can't really tell you, BUT I can tell you that Ger_space is working on a new shader system so hopefully this should solve the problem.

This sounds like a lighting problem. That's normally nothing TR messes with (at least I think that).

@Gordon Dry

Could you please post am Screenshot here or as an github bug report, so I know exactly what issues you have? 

 

 

14 hours ago, Sigma88 said:

I compiled the source from master and the test loads the red image instead of the green one.

so either I messed up the compiling or the new commits have broken mm compatibility


haven't tested this throughly, it was working fine before so unless there are some meaningful reason to keep the changes we can always roll back

 

EDIT: ok, have taken a better look and it works, I probably messed up the compile.

anyways, MainMenu.Awake() is a really busy time for a lot of mods, so unless there is some tangible advantage to do stuff at that point, I'd say stick with ModuleManagerPostLoad() 

It needs to be there, because it is the earliest time ksp has loaded all assets (and so the shaders I want) it doesn't matter for a player when you start up, because the load time is always the same and TRR needs less code at the main menu. 

Share this post


Link to post
Share on other sites
Sigma88    1606
52 minutes ago, Ger_space said:

This sounds like a lighting problem. That's normally nothing TR messes with (at least I think that).

@Gordon Dry

Could you please post am Screenshot here or as an github bug report, so I know exactly what issues you have? 

 

 

It needs to be there, because it is the earliest time ksp has loaded all assets (and so the shaders I want) it doesn't matter for a player when you start up, because the load time is always the same and TRR needs less code at the main menu. 

I just mentioned it because on  stock install with just TRR the amount of time the game remained stuck on the black screen before main menu was worringly high.

Other mods tend to freeze ksp in that moment as well, so I wonder if it could cause trouble.

I assume the code you need for the shaders is not related to the texture replacing and compressing (which is the heaviest feature of trr) so I don't see the reason to move everything at mainmenu

But ultimately this is not my mod so I will leave this to you

Best case scenario I am just being paranoid and the freezing never gets worse than what it is now

Share this post


Link to post
Share on other sites
HaArLiNsH    176

I also noticed the freezing at start, maybe this is not a freeze but a discret loading, but as we don't see changes in the loading bar we can think of a freeze.

Is the new shader taking a long time to load or TRR is waiting for something then continue to load ?

Share this post


Link to post
Share on other sites
Sigma88    1606
Posted (edited)
3 hours ago, HaArLiNsH said:

I also noticed the freezing at start, maybe this is not a freeze but a discret loading, but as we don't see changes in the loading bar we can think of a freeze.

Is the new shader taking a long time to load or TRR is waiting for something then continue to load ?

The "freezing" I am referring to happens during the black screen between the loading screen and the main menu screen.

It's not a freeze in the sense that the program is not responding, it's just that there are a lot of calculations being done which prolongs the waiting time between loading and mainmenu

 

EDIT:

since I don't like to talk about stuff based on "feelings" I did a quick test to see if there actually was a delay or it was just my impression, this is the result:

STOCK = Basic KSP install (no mods)
TRR = STOCK + my version of TRR with the MM compatibility (should start at "Instantly")
TRR+MM = TRR + module manager (mm should delay TRR to start after mm is done changing the confignodes)
master = STOCK + the current master branch from @HaArLiNsH (which I compiled) (no mm)

 

loading%20time.png?dl=1

 

I'm not sure how ready the master branch is tho, maybe it has some code which is not ready yet.

I will try to roll back to my version and just move the code from Instantly to MainMenu and see if the issues persist

anyone that wants to try and reproduce the same experiment on another machine is welcome, more data = more we know if something is going wrong

EDIT2:

I've added the loading times from my old version but with the start moved at "MainMenu.Awake"

there doesn't seem to be any loading issues so it's probably something that has to do with the shader code, I don't know how that works, and I don't even know if an higher loading time has to be expected so I defer further testing to @HaArLiNsH and @Ger_space
 that are certainly more familiar with the code :D

I haven't tested this version with any heavy installations (planet packs + kopernicus tend to be really heavy at the MainMenu.Awake and MainMenu.Start so it wouldn't surprise me if there were some issues there)

but I don't have time now to test that, so it will have to wait

Edited by Sigma88

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now