mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Get decal switching working mostly
This commit is contained in:
parent
c72e20bd2a
commit
eda068cd66
Binary file not shown.
After Width: | Height: | Size: 811 KiB |
@ -47,22 +47,58 @@ PART
|
||||
|
||||
decalFront = Decal-Front
|
||||
decalBack = Decal-Back
|
||||
decalShader = ConformalDecals/Feature/Bumped
|
||||
|
||||
useBaseNormal = false
|
||||
|
||||
TEXTURE
|
||||
{
|
||||
name = _Decal
|
||||
textureURL = ConformalDecals/Assets/Tortilla-diffuse
|
||||
isMain = true
|
||||
|
||||
}
|
||||
|
||||
MODULE {
|
||||
name = ModuleB9PartSwitch
|
||||
|
||||
SUBTYPE {
|
||||
name = tortilla
|
||||
|
||||
MODULE {
|
||||
IDENTIFIER {
|
||||
name = ModuleConformalDecal
|
||||
}
|
||||
DATA {
|
||||
decalShader = ConformalDecals/Feature/Bumped
|
||||
|
||||
TEXTURE {
|
||||
name = _Decal
|
||||
textureURL = ConformalDecals/Assets/Tortilla-diffuse
|
||||
isMain = true
|
||||
}
|
||||
|
||||
TEXTURE
|
||||
{
|
||||
name = _BumpMap
|
||||
textureURL = ConformalDecals/Assets/Tortilla-normal
|
||||
isNormalMap = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEXTURE
|
||||
{
|
||||
name = _BumpMap
|
||||
textureURL = ConformalDecals/Assets/Tortilla-normal
|
||||
isNormalMap = true
|
||||
SUBTYPE {
|
||||
name = Danger
|
||||
|
||||
MODULE {
|
||||
IDENTIFIER {
|
||||
name = ModuleConformalDecal
|
||||
}
|
||||
DATA {
|
||||
decalShader = ConformalDecals/Paint/Diffuse
|
||||
useBaseNormal = true
|
||||
TEXTURE {
|
||||
name = _Decal
|
||||
textureURL = ConformalDecals/Assets/Sign-HighVoltage-2
|
||||
isMain = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -31,6 +31,12 @@ namespace ConformalDecals.MaterialModifiers {
|
||||
}
|
||||
|
||||
public void AddProperty(MaterialProperty property) {
|
||||
if (property == null) throw new ArgumentNullException("Tried to add a null property");
|
||||
if (_materialProperties == null || _textureMaterialProperties == null) {
|
||||
Initialize();
|
||||
Debug.LogWarning("Tried to add a property to uninitialized property collection! correcting now.");
|
||||
}
|
||||
|
||||
foreach (var p in _materialProperties) {
|
||||
if (p.PropertyName == property.PropertyName) {
|
||||
_materialProperties.Remove(property);
|
||||
@ -53,8 +59,14 @@ namespace ConformalDecals.MaterialModifiers {
|
||||
}
|
||||
|
||||
public void SetShader(string shaderName) {
|
||||
if (_decalShader == null && string.IsNullOrEmpty(shaderName)) {
|
||||
throw new FormatException("Shader name not provided");
|
||||
if (string.IsNullOrEmpty(shaderName)) {
|
||||
if (_decalShader == null) {
|
||||
Debug.Log("Using default decal shader");
|
||||
shaderName = "ConformalDecals/Paint/Diffuse";
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var shader = Shabby.Shabby.FindShader(shaderName);
|
||||
|
@ -29,7 +29,7 @@ namespace ConformalDecals {
|
||||
[KSPField] public string decalBack = string.Empty;
|
||||
[KSPField] public string decalModel = string.Empty;
|
||||
[KSPField] public string decalProjector = string.Empty;
|
||||
[KSPField] public string decalShader = string.Empty;
|
||||
[KSPField] public string decalShader = "ConformalDecals/Paint/Diffuse";
|
||||
|
||||
[KSPField] public Transform decalFrontTransform;
|
||||
[KSPField] public Transform decalBackTransform;
|
||||
@ -93,6 +93,7 @@ namespace ConformalDecals {
|
||||
}
|
||||
else {
|
||||
// materialProperties already exists, so make a copy
|
||||
this.Log($"{materialProperties == null}");
|
||||
materialProperties = ScriptableObject.Instantiate(materialProperties);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
using System;
|
||||
using ConformalDecals.MaterialModifiers;
|
||||
using ConformalDecals.Util;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
Loading…
Reference in New Issue
Block a user