Jump to content

[Solved] Regarding ModuleColorChanger


Recommended Posts

I've discovered the awesome ModuleColorChanger recently and played around with it for a while. Also started a documentation until I noticed that it is already pretty well documented (Thank you @JPLRepo !). In the community API documentation I saw two additional entrys called "excludedRenderer" and "includedRenderer". Found some information about that in @Snarks Indicator Lights thread. So I took a look at the configs, but I only found examples to in/exclude entire .mu files.

Is it possible to use the ex/includedRenderer entry for different meshes in one single .mu file? Did some trial & error but without success so far (see bottom).

My particular situation:
I have a series of storage tanks that make use of the meshswitcher provided by Firespitter/IFS. The switchable meshes also use a glow animation with different color settings for each mesh. The trouble is that every time I change one emissive color of a mesh I have to edit all the animations and re-export all tanks which is annoying. The ColorChanger module could make that a lot easyier in combination with the apropriate MM config.

Couple of month ago I did some experiments with multiple MODEL {} entrys in a single part-config but I couldn't get the meshswitch to work properly.

unity setup:
aX64VJ6.png

This is what I have tested so far:

excludedRenderer = KeridianDynamics/Parts/KD-MobileVAB/modelT2501FS/KD-T2501FS/Model/FS01(Clone)
excludedRenderer = KeridianDynamics/Parts/KD-MobileVAB/modelT2501FS/KD-T2501FS/Model/FS01
excludedRenderer = KeridianDynamics/Parts/KD-MobileVAB/modelT2501FS/GameObject/KD-T2501FS/Model/FS01(Clone)
excludedRenderer = KeridianDynamics/Parts/KD-MobileVAB/modelT2501FS/GameObject/KD-T2501FS/Model/FS01
excludedRenderer = KD-T2501FS/Model/FS01(Clone)
excludedRenderer = KD-T2501FS/Model/FS01
excludedRenderer = GameObject/KD-T2501FS/Model/FS01(Clone)
excludedRenderer = GameObject/KD-T2501FS/Model/FS01

modelT2501FS.mu is located in "GameData/KeridianDynamics/Parts/KD-MobileVAB/"

Entire part config:

Spoiler

 


// Keridian Dynamics
// KD-T2501FS

PART
{
	// General parameters
	name = KD-T2501FS
	module = Part
	author = Eleusis La Arwall

	// Asset parameters
	MODEL
	{
		model = KeridianDynamics/Parts/KD-MobileVAB/modelT2501FS
	}
//	mesh = modelT2501FS.mu
	scale = 1
	rescaleFactor = 1

	// Node definitions - Position X, Position Y, Position Z, Up X, Up Y, Up Z
	node_stack_top = 0.0, 0.6, 0.0, 0.0, 1.0, 0.0, 2
	node_stack_bottom = 0.0, -0.6, 0.0, 0.0, -1.0, 0.0, 2
	node_attach = 0.0, 0.0, 1.3, 0.0, 0.0, -1.0

	// Editor parameters
	TechRequired = advConstruction
	entryCost = 2800
	cost = 1600
	category = FuelTank
	subcategory = 0
	title = KD-T2501FS
	manufacturer = Keridian Dynamics
	description = 2.5 m sized non-passable storage tank (Small).

	// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
	attachRules = 1,1,1,1,0

	// Standard part parameters
	mass = 1.15
	fuelCrossFeed = True
	CrewCapacity = 0
	bulkheadProfiles = size2
	tags = base station (stor (tank contain resource (ore metal rocketparts

	// Drag
	dragModelType = default
	maximum_drag = 0.2
	minimum_drag = 0.2
	angularDrag = 2

	// Damage and Temperature
	crashTolerance = 10
	maxTemp = 1600

	// Internals
	INTERNAL
	{
		name = KD_T2501_IVA
	}

	// Modules
	MODULE
	{
		name = ModuleAnimateGeneric
		animationName = T2501FSLight
		startEventGUIName = Lights On
		endEventGUIName = Lights Off
		actionGUIName = Toggle Lights
	}
	MODULE
	{
		name = ModuleColorChanger
		shaderProperty = _EmissiveColor
		animRate = 0.8
		animState = false
		useRate = true
		toggleInEditor = true
		toggleInFlight = true
		unfocusedRange = 5
		toggleName = Toggle Lights
		eventOnName = Lights On
		eventOffName = Lights Off
		toggleAction = True
		defaultActionGroup = Light
		redCurve
		{
			key = 0 0 0 3
			key = 1 1 0 0
		}
		greenCurve
		{
			key = 0 0 0 1
			key = 1 1 1 0
		}
		blueCurve
		{
			key = 0 0 0 0
			key = 1 0.7 1.5 0
		}
		alphaCurve
		{
			key = 0 1
		}
		excludedRenderer = KD-T2501FS/Model/FS01(Clone)
	}

	// Resources
}

 

 

 

 

Edited by Eleusis La Arwall
Solved
Link to comment
Share on other sites

34 minutes ago, Eleusis La Arwall said:

Is it possible to use the ex/includedRenderer entry for different meshes in one single .mu file?

Yes, and in fact I do that in IndicatorLights.  I ran smack into this when they added the ModuleColorChanger in 1.2, because one of the things my mod does is to add additional meshes to some of the stock crewed parts, and I need to make it so that the ModuleColorChanger that controls the cabin lights on the stock part won't stomp on the meshes that I'm adding.

Here's an example of it in action, in which I specify excludedRenderer on a per-mesh basis:

https://github.com/KSPSnark/IndicatorLights/blob/master/files/Parts/crewable/mk1pod.cfg

...scroll down to the "tweaks" section at the bottom.

Basically, the path needed in order to work will be one of two forms:

  • If you're referencing a "native" mesh that's part of the model itself, it's just the mesh name; no path information.
  • If you're referencing a mesh that got added via ModuleManager, then you need the complete path to the mesh file under GameData, with "(Clone)" appended to the end.
Link to comment
Share on other sites

It works! Thank you very much for the detailed explanation! This module is getting better and better :)

Unfortunately I have 9 Light on/off buttons on that part now. with

		toggleInEditor = false
		toggleInFlight = false

the menu-spam can be avoided but the lights can only be toggled by action groups.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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...