Jump to content

[1.12.x] Textures Unlimited Recolour Depot


Recommended Posts

@Manwith Noname I have question regarding how to handle a situation.

The standard way to define a Switching behaviour looks like the following.

@PART[controller1000]:FOR[000_Standardised_Switching]:NEEDS[TexturesUnlimited]
{
    MODULE
    {
        name = KSPTextureSwitch
        sectionName = Appearance
        currentTextureSet = Stock_Default_KAL-1000
        textureSet = Stock_Default_KAL-1000
    }
}
+KSP_TEXTURE_SET[Stock_Default]:NEEDS[TexturesUnlimited]
{
    @name = Stock_Default_KAL-1000
    @MATERIAL
    {
        mesh = controller
        mesh = indicator

        texture = _MainTex,SquadExpansion/Serenity/Parts/Robotics/Controllers/roboController_diffuse
        texture = _BumpMap,TURD/TU_Standardised_Switching/000_PlaceholderTextures/Bump
        texture = _Emissive,SquadExpansion/Serenity/Parts/Robotics/Controllers/roboController_emissive
    }
}

But with BG deployable science instruments I have multiple associations of meshes/textures.

I've tried some workarounds including this one

+KSP_TEXTURE_SET[Stock_Default]:NEEDS[TexturesUnlimited]
{
    @name = Stock_Default_KAL-1000
    @MATERIAL
    {
        // BLOCK1
    }
    @MATERIAL
    {
        // BLOCK2
    }
    @MATERIAL
    {
        // BLOCK3
    }
}

But it does not work, all meshes and textures are mixed up and the wrong textures are assigned to meshes.

Multiplying textureSet = statements is not the solution as it is the way to handle variants with this switching capability.

	MODULE
	{
		name = KSPTextureSwitch
		sectionName = Appearance
		currentTextureSet = Stock_Default_FLAdapters_W
		textureSet = Stock_Default_FLAdapters_W // White variant
		textureSet = Stock_Default_FLAdapters_O // Orange variant
	}

Is there a way to have multiple Stock_Default_* texture sets without multiplying KSPTextureSwitch entries in the UI ?

 

Edited by OnlyLightMatters
Link to comment
Share on other sites

@OnlyLightMatters I'm not entirely sure I follow but something that stands out to me...

14 hours ago, OnlyLightMatters said:

I've tried some workarounds including this one



+KSP_TEXTURE_SET[Stock_Default]:NEEDS[TexturesUnlimited]
{
    @name = Stock_Default_KAL-1000
    @MATERIAL
    {
        // BLOCK1
    }
    @MATERIAL
    {
        // BLOCK2
    }
    @MATERIAL
    {
        // BLOCK3
    }
}

 

 

...you probably want to drop the @ on the second and third MATERIAL blocks. This is module manager syntax related. + is copy, @ is edit. So, what's going on here is you copy the Stock_Default KSP_TEXTURE_SET which only has one MATERIAL defined. Then, you're editing that material block, then again, then again. If you want to add further MATERIAL definitions for specific meshes, as previously mentioned, just drop the @ symbol on block 2 and 3, so it looks like this...

+KSP_TEXTURE_SET[Stock_Default]:NEEDS[TexturesUnlimited]
{
    @name = Stock_Default_KAL-1000
    @MATERIAL
    {
        // BLOCK1
    }
    MATERIAL
    {
        // BLOCK2
    }
    MATERIAL
    {
        // BLOCK3
    }
}

This will create new MATERIAL nodes within that new KSP_TEXTURE_SET.

Further to this, when it comes to editing multiple previously defined MATERIAL blocks, module manager will accept indexes from 0. So, to edit previously defined MATERIAL blocks later you'll want something like...

@MATERIAL, 0
{
	Edit stuff in MATERIAL block "1"
}
@MATERIAL, 1
{
	Edit stuff in MATERIAL block "2"
}
@MATERIAL, 2
{
	Edit stuff in MATERIAL block "3"
}

If this doesn't answer the question, let me know.

Link to comment
Share on other sites

I had already tried the MATERIAL blocks with no  @ starting from block 2 with no result.
I've tried the way your propose and I have the same behaviour, it seems the last textures applied in the last block override everything defined previously for a +KSP_TEXTURE_SET statement.

Link to comment
Share on other sites

@Manwith Noname I've pushed the code & materials in an experimental branch on Github.

https://github.com/OnlyLightMatters/TURD-MH-BG/tree/experimental_BGDeployableInstruments

The code of the 1110 Switching file for DeployedSatDish // Communotron Ground HG-48. I replaced the squad texture with a allred.dds texture.

// Communotron Ground HG-48
@PART[DeployedSatDish]:FOR[000_Standardised_Switching]:NEEDS[TexturesUnlimited]
{
	MODULE
	{
		name = KSPTextureSwitch
		sectionName = Appearance
		currentTextureSet = Stock_Default_DeployedSatDish
		textureSet = Stock_Default_DeployedSatDish
	}
}
+KSP_TEXTURE_SET[Stock_Default]:NEEDS[TexturesUnlimited]
{
	@name = Stock_Default_DeployedSatDish

	@MATERIAL,0
	{
		shader = KSP/Specular

		mesh = Base
		mesh = MountBase
		mesh = PanelMount
		mesh = DishCore
		mesh = Antenna
		mesh = LeafBot
		mesh = LeafLeft
		mesh = LeafRight
		mesh = LeafTop

		texture = _MainTex,SquadExpansion/Serenity/Parts/DeployedScience/Assets/satDish_diffuse
		texture = _BumpMap,TURD/TU_Standardised_Switching/000_PlaceholderTextures/Bump
		texture = _Emissive,TURD/TU_Standardised_Switching/000_PlaceholderTextures/Emis
	}
	@MATERIAL,1
	{
		shader = KSP/Alpha/Translucent Additive
		
		mesh = Screen (1)

		texture = _MainTex,SquadExpansion/Serenity/Parts/DeployedScience/Assets/Grid
		texture = _BumpMap,TURD/TU_Standardised_Switching/000_PlaceholderTextures/Bump
		texture = _Emissive,TURD/TU_Standardised_Switching/000_PlaceholderTextures/Emis
	}

	@MATERIAL,2
	{
		shader =  KSP/Emissive/Specular
		
		mesh = marcoPantalla
		mesh = polySurface116
		mesh = Switch1
		mesh = Switch2
		mesh = Switch3
		mesh = Switch4
		mesh = BaseGenericParts
		mesh = squareButton1
		mesh = squareButton2
		mesh = squareButton3
		mesh = squareButton4
		mesh = squareButton5
		mesh = squareButton6
		mesh = squareButton7
		mesh = squareButton8
		mesh = squareButton9

		//texture = _MainTex,SquadExpansion/Serenity/Parts/DeployedScience/Assets/GenericParts_diffuse 
		texture = _MainTex,TURD/TU_BG_AllInOne/allred
		texture = _BumpMap,TURD/TU_Standardised_Switching/000_PlaceholderTextures/Bump
		texture = _Emissive,SquadExpansion/Serenity/Parts/DeployedScience/Assets/GenericParts_emissive
	}		
}	

Screen capture

210613061210348862.png

You can see that all meshes are red, including these which are not linked to the allred texture (sat dish meshes in particular).

 

 

Link to comment
Share on other sites

@OnlyLightMatters You may have tried this but this is where I would start...

@PART[DeployedSatDish]:FOR[000_Standardised_Switching]:NEEDS[TexturesUnlimited]
{
	MODULE
	{
		name = KSPTextureSwitch
		sectionName = Appearance
		currentTextureSet = Stock_Default_DeployedSatDish
		textureSet = Stock_Default_DeployedSatDish
	}
}
+KSP_TEXTURE_SET[Stock_Default]:NEEDS[TexturesUnlimited]
{
	@name = Stock_Default_DeployedSatDish

	@MATERIAL
	{
		@shader = KSP/Specular

		mesh = Base
		mesh = MountBase
		mesh = PanelMount
		mesh = DishCore
		mesh = Antenna
		mesh = LeafBot
		mesh = LeafLeft
		mesh = LeafRight
		mesh = LeafTop

		texture = _MainTex,SquadExpansion/Serenity/Parts/DeployedScience/Assets/satDish_diffuse
		texture = _BumpMap,TURD/TU_Standardised_Switching/000_PlaceholderTextures/Bump
		texture = _Emissive,TURD/TU_Standardised_Switching/000_PlaceholderTextures/Emis
	}
	MATERIAL
	{
		mode = create
		shader = KSP/Alpha/Translucent Additive
		
		mesh = Screen (1)

		texture = _MainTex,SquadExpansion/Serenity/Parts/DeployedScience/Assets/Grid
		texture = _BumpMap,TURD/TU_Standardised_Switching/000_PlaceholderTextures/Bump
		texture = _Emissive,TURD/TU_Standardised_Switching/000_PlaceholderTextures/Emis
	}
	MATERIAL
	{
		mode = create
		shader =  KSP/Emissive/Specular
		
		mesh = marcoPantalla
		mesh = polySurface116
		mesh = Switch1
		mesh = Switch2
		mesh = Switch3
		mesh = Switch4
		mesh = BaseGenericParts
		mesh = squareButton1
		mesh = squareButton2
		mesh = squareButton3
		mesh = squareButton4
		mesh = squareButton5
		mesh = squareButton6
		mesh = squareButton7
		mesh = squareButton8
		mesh = squareButton9

		//texture = _MainTex,SquadExpansion/Serenity/Parts/DeployedScience/Assets/GenericParts_diffuse 
		texture = _MainTex,TURD/TU_BG_AllInOne/allred
		texture = _BumpMap,TURD/TU_Standardised_Switching/000_PlaceholderTextures/Bump
		texture = _Emissive,SquadExpansion/Serenity/Parts/DeployedScience/Assets/GenericParts_emissive
	}		
}	

If that doesn't work, my main suspicion would be the Screen mesh with (1) in the name might be causing a severe breakage. Also, if it doesn't work, can you paste the contents of the ModelData.txt file from a TU export, if you ran that, or expand the mesh hierarchy in the Object Inspector window and grab a screenshot.

Something else that might be useful, enable verbose logging, also log errors and exceptions to screen in game so you'll get a heads up when things break. Check in the TU options accessed through the game difficulty menu to enable some extra logging (if I remember correctly where that is now).  You can upload a paste to somewhere like pastebin.com or PM a copy of the entire KSP.log if you want me to scan through that for ideas. To keep it clean, load the game, go straight to the editor, add the parts in and try to alter them through TU controls, then exit out.

 

The thing I will say, although I covered some objects that Kerbals grab out of storage containers, they're not very nice to work with in game. Though I suspect you may have found that already.

 

Edit: Oh, another useful thing to check when debugging, the module manager cache.

Edited by Manwith Noname
Link to comment
Share on other sites

There are no visible errors linked to Screen (1) in the KSP.log, which I check every time things are going south, both for game loading and running /playing with the part in the VAB.

Full logs from TU in this KSP.log https://drive.google.com/file/d/13VXnXXdG1X_HkwSC6vIhSkt8o5nATf3c/view?usp=sharing


I make my cfgs from the exported UVs from TU to see how the meshes are linked to textures, and this is where I saw the odd name of this mesh (space and parenthesis for an identifier, really?)

Short extract here

-------------------------------------------
Mesh Name Model: Screen (1)
Render Type: MeshRenderer
++++++++++++++++++
Material #: 0
   Material Name: ScreenGrid
       Shader Name               : KSP/Alpha/Translucent Additive
       RenderQueue               : 3000
       _MainTex                  : SquadExpansion/Serenity/Parts/DeployedScience/Assets/Grid (UnityEngine.Texture2D)
       _MainTexOffset            : (0.0, 0.0)

++++++++++++++++++
-------------------------------------------

Complete file here : https://drive.google.com/file/d/1whtXsMqfkFe_YTEGmPPl5QRtfKUwoM51/view?usp=sharin

Object Inspector confirmed the information already collected https://nsa40.casimages.com/img/2021/06/14/210614084626461874.png

I've sometimes had some issues with MM's cache so I already tried to delete it then rerun the game. No effect here. Do you mean inspect MM cache ?

I've not tried yet adding the create statements, will do that this morning.

 

 

 

Edited by OnlyLightMatters
Link to comment
Share on other sites

9 hours ago, OnlyLightMatters said:

@Manwith Noname finally i've had some time to test your code proposal between 2 meetings and it's working!

Great news!

Strictly speaking, that line shouldn't be required and TU will default to that mode if no mode is set. I just put it there for completeness as when checking logs, you can end up with lots of messages about it being missing.

16 hours ago, OnlyLightMatters said:

Do you mean inspect MM cache ?

Yes, it can be very helpful. You can basically see how the entire part config ends up after all module manager patches.

Also, a note on your allred test texture. There is already a red texture available in the placeholder textures folder named Paint. Can be handy sometimes ;D

Link to comment
Share on other sites

  • 2 weeks later...

I am unable to make the stock game parts shiny at all(there is no recolouring GUI option showing), but this mod is working for Procedural Parts...please help...

Edit: Uninstalling ReStock fixed the issue.

Edited by theleg
Link to comment
Share on other sites

On 6/15/2021 at 2:44 AM, OnlyLightMatters said:

New Pre-Release. It's all Shiny effect is available for deployable science instruments.

 

Any updates? Can't wait to try out MH with TURD and your mod...

Link to comment
Share on other sites

Ok, so I deleted Restock, installed Textures Unlimited, made sure Module Manager was installed, and put the .zip file in the gamedata directory. I'm not seeing anything other than a few parts being a bit shinier than usual, and no way whatsoever to change the colors of parts in the VAB. What did I do wrong?

Link to comment
Share on other sites

3 hours ago, LHACK4142 said:

Ok, so I deleted Restock, installed Textures Unlimited, made sure Module Manager was installed, and put the .zip file in the gamedata directory. I'm not seeing anything other than a few parts being a bit shinier than usual, and no way whatsoever to change the colors of parts in the VAB. What did I do wrong?

Did you install TURD? Install TURD with TU...

Link to comment
Share on other sites

27 minutes ago, LHACK4142 said:

Yep. TURD is the aforementioned .zip file

Don't put the .zip file in the Gamedata folder. First extract it, then you will see a Gamedata folder within the extracted file. Copy the contents of that Gamedata folder in the Gamedata folder of the game.

Link to comment
Share on other sites

17 hours ago, theleg said:

Don't put the .zip file in the Gamedata folder. First extract it, then you will see a Gamedata folder within the extracted file. Copy the contents of that Gamedata folder in the Gamedata folder of the game.

Worked. Thank you!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...