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,12 +47,26 @@ PART
|
|||||||
|
|
||||||
decalFront = Decal-Front
|
decalFront = Decal-Front
|
||||||
decalBack = Decal-Back
|
decalBack = Decal-Back
|
||||||
decalShader = ConformalDecals/Feature/Bumped
|
|
||||||
|
|
||||||
useBaseNormal = false
|
useBaseNormal = false
|
||||||
|
|
||||||
TEXTURE
|
|
||||||
{
|
}
|
||||||
|
|
||||||
|
MODULE {
|
||||||
|
name = ModuleB9PartSwitch
|
||||||
|
|
||||||
|
SUBTYPE {
|
||||||
|
name = tortilla
|
||||||
|
|
||||||
|
MODULE {
|
||||||
|
IDENTIFIER {
|
||||||
|
name = ModuleConformalDecal
|
||||||
|
}
|
||||||
|
DATA {
|
||||||
|
decalShader = ConformalDecals/Feature/Bumped
|
||||||
|
|
||||||
|
TEXTURE {
|
||||||
name = _Decal
|
name = _Decal
|
||||||
textureURL = ConformalDecals/Assets/Tortilla-diffuse
|
textureURL = ConformalDecals/Assets/Tortilla-diffuse
|
||||||
isMain = true
|
isMain = true
|
||||||
@ -66,3 +80,25 @@ PART
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
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) {
|
foreach (var p in _materialProperties) {
|
||||||
if (p.PropertyName == property.PropertyName) {
|
if (p.PropertyName == property.PropertyName) {
|
||||||
_materialProperties.Remove(property);
|
_materialProperties.Remove(property);
|
||||||
@ -53,8 +59,14 @@ namespace ConformalDecals.MaterialModifiers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void SetShader(string shaderName) {
|
public void SetShader(string shaderName) {
|
||||||
if (_decalShader == null && string.IsNullOrEmpty(shaderName)) {
|
if (string.IsNullOrEmpty(shaderName)) {
|
||||||
throw new FormatException("Shader name not provided");
|
if (_decalShader == null) {
|
||||||
|
Debug.Log("Using default decal shader");
|
||||||
|
shaderName = "ConformalDecals/Paint/Diffuse";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var shader = Shabby.Shabby.FindShader(shaderName);
|
var shader = Shabby.Shabby.FindShader(shaderName);
|
||||||
|
@ -29,7 +29,7 @@ namespace ConformalDecals {
|
|||||||
[KSPField] public string decalBack = string.Empty;
|
[KSPField] public string decalBack = string.Empty;
|
||||||
[KSPField] public string decalModel = string.Empty;
|
[KSPField] public string decalModel = string.Empty;
|
||||||
[KSPField] public string decalProjector = 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 decalFrontTransform;
|
||||||
[KSPField] public Transform decalBackTransform;
|
[KSPField] public Transform decalBackTransform;
|
||||||
@ -93,6 +93,7 @@ namespace ConformalDecals {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// materialProperties already exists, so make a copy
|
// materialProperties already exists, so make a copy
|
||||||
|
this.Log($"{materialProperties == null}");
|
||||||
materialProperties = ScriptableObject.Instantiate(materialProperties);
|
materialProperties = ScriptableObject.Instantiate(materialProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using System;
|
|
||||||
using ConformalDecals.MaterialModifiers;
|
|
||||||
using ConformalDecals.Util;
|
using ConformalDecals.Util;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Rendering;
|
using UnityEngine.Rendering;
|
||||||
|
Loading…
Reference in New Issue
Block a user