mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
36732ed4d4 | |||
d3388a4dad | |||
ece9d959fd | |||
dfdf280564 | |||
2cca6c37bb | |||
c653c9efc8 | |||
374fc8b753 | |||
88b2b4841a | |||
b2da56b1ca | |||
14bc694588 | |||
7e1b993d20 | |||
f8d692352d | |||
fa4b799788 | |||
970a69be11 | |||
dddb7f09f3 | |||
3cd229bc23 | |||
4948818065 | |||
036b084d34 | |||
1e3addeb4d | |||
47c70d3071 | |||
9955b9ce30 |
7
.github/workflows/ff-release.yml
vendored
7
.github/workflows/ff-release.yml
vendored
@ -1,5 +1,7 @@
|
|||||||
name: Fast-Forward Release Branch
|
name: Fast-Forward Release Branch
|
||||||
on: [ release ]
|
on:
|
||||||
|
release:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
fast-forward:
|
fast-forward:
|
||||||
@ -12,8 +14,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Merge into Release
|
- name: Merge into Release
|
||||||
run: |
|
run: git merge ${{github.ref_name}} --ff-only
|
||||||
git merge ${{github.ref_name}} --ff-only
|
|
||||||
|
|
||||||
- name: Push Changes
|
- name: Push Changes
|
||||||
uses: ad-m/github-push-action@master
|
uses: ad-m/github-push-action@master
|
||||||
|
6
.github/workflows/ksp-publish.yml
vendored
6
.github/workflows/ksp-publish.yml
vendored
@ -37,7 +37,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
wget --user drewcassidy --password ${{ secrets.PILE_OF_ROCKS_PASS }} https://pileof.rocks/Secret/conformal-decals-dependencies-1.zip
|
wget --user drewcassidy --password ${{ secrets.PILE_OF_ROCKS_PASS }} https://pileof.rocks/Secret/conformal-decals-dependencies-1.zip
|
||||||
unzip conformal-decals-dependencies-*.zip -d ConformalDecals/dlls
|
unzip conformal-decals-dependencies-*.zip -d ConformalDecals/dlls
|
||||||
dotnet build --configuration Release ConformalDecals.sln
|
|
||||||
|
|
||||||
- name: Build DLL
|
- name: Build DLL
|
||||||
working-directory: Source
|
working-directory: Source
|
||||||
@ -47,14 +46,17 @@ jobs:
|
|||||||
|
|
||||||
- name: Download KSP Dependencies
|
- name: Download KSP Dependencies
|
||||||
run: |
|
run: |
|
||||||
wget http://pileof.rocks/KSP/Shabby_v0.2.0.zip
|
wget http://taniwha.org/~bill/Shabby_v0.3.0.zip
|
||||||
wget https://ksp.sarbian.com/jenkins/job/ModuleManager/161/artifact/ModuleManager.4.2.1.dll
|
wget https://ksp.sarbian.com/jenkins/job/ModuleManager/161/artifact/ModuleManager.4.2.1.dll
|
||||||
wget https://github.com/blowfishpro/B9PartSwitch/releases/download/v2.19.0/B9PartSwitch_v2.19.0.zip
|
wget https://github.com/blowfishpro/B9PartSwitch/releases/download/v2.19.0/B9PartSwitch_v2.19.0.zip
|
||||||
|
wget https://github.com/KSPModdingLibs/HarmonyKSP/releases/download/2.0.4.0/HarmonyKSP_2.0.4.0_for_KSP1.8+.zip
|
||||||
unzip -d Shabby Shabby*.zip
|
unzip -d Shabby Shabby*.zip
|
||||||
unzip -d B9PartSwitch B9PartSwitch*.zip
|
unzip -d B9PartSwitch B9PartSwitch*.zip
|
||||||
|
unzip -d HarmonyKSP HarmonyKSP*.zip
|
||||||
mv Shabby/GameData/Shabby GameData/
|
mv Shabby/GameData/Shabby GameData/
|
||||||
mv ModuleManager*.dll GameData/
|
mv ModuleManager*.dll GameData/
|
||||||
mv B9PartSwitch/GameData/B9PartSwitch GameData/
|
mv B9PartSwitch/GameData/B9PartSwitch GameData/
|
||||||
|
mv HarmonyKSP/GameData/000_Harmony GameData/
|
||||||
|
|
||||||
- name: Upload Unbundled Build
|
- name: Upload Unbundled Build
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
@ -1 +0,0 @@
|
|||||||
USE_SSM_CREDENTIALS: false
|
|
@ -1,34 +0,0 @@
|
|||||||
# Example annotated build data file
|
|
||||||
mod-name: ConformalDecals
|
|
||||||
package:
|
|
||||||
include-dependencies: true # Include dependencies in the package
|
|
||||||
included-gamedata: # Include these gamedata-level folders in packages:
|
|
||||||
- ConformalDecals
|
|
||||||
included-support: # Include these root-level files in packages
|
|
||||||
- README.md
|
|
||||||
- LICENSE-ART.md
|
|
||||||
- LICENSE-SOURCE.md
|
|
||||||
- changelog.txt
|
|
||||||
dependencies: # Configure dependencies
|
|
||||||
ModuleManager:
|
|
||||||
location: url
|
|
||||||
url: https://ksp.sarbian.com/jenkins/job/ModuleManager/159/artifact/ModuleManager.4.1.4.dll
|
|
||||||
zip: false
|
|
||||||
B9PartSwitch:
|
|
||||||
location: url
|
|
||||||
url: http://pileof.rocks/KSP/B9PartSwitch-v2.18.0.zip
|
|
||||||
zip: true
|
|
||||||
Shabby:
|
|
||||||
location: url
|
|
||||||
url: http://pileof.rocks/KSP/Shabby_v0.2.0.zip
|
|
||||||
zip: true
|
|
||||||
HarmonyKSP:
|
|
||||||
location: url
|
|
||||||
url: https://github.com/KSPModdingLibs/HarmonyKSP/releases/download/2.0.4.0/HarmonyKSP_2.0.4.0_for_KSP1.8+.zip
|
|
||||||
zip: true
|
|
||||||
deploy:
|
|
||||||
SpaceDock:
|
|
||||||
enabled: true # activate/deactivate this deployment script
|
|
||||||
mod-id: 2451 # The Spacedock mod ID for deployment
|
|
||||||
GitHub:
|
|
||||||
enabled: true # activate/deactivate this deployment script
|
|
38
CHANGELOG.md
38
CHANGELOG.md
@ -8,6 +8,44 @@ All notable changes to this project will be documented in this file
|
|||||||
| website | https://forum.kerbalspaceprogram.com/index.php?/topic/194802-18-111-conformal-decals |
|
| website | https://forum.kerbalspaceprogram.com/index.php?/topic/194802-18-111-conformal-decals |
|
||||||
| author | Andrew Cassidy |
|
| author | Andrew Cassidy |
|
||||||
|
|
||||||
|
## 0.2.12 - 2022-10-31
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Updated bundled Shabby to 0.3.0. Does not affect CKAN users
|
||||||
|
- Made flag aspect ratio overrides configurable with `ASPECTRATIO` nodes in the config. User flags added to Squad/Flags should now be the correct aspect ratio
|
||||||
|
- All decal aspect ratios can now be overriden with the `aspectRatio` field
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Reverted some changes from last version that were causing issues on launch
|
||||||
|
|
||||||
|
|
||||||
|
## 0.2.11 - 2022-10-30
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- PR by LinuxGuruGamer:
|
||||||
|
- Fixed nullref caused when an entry in `_targets` was null
|
||||||
|
- Fixed memory leak caused by the OnDestroy() methods not being called due to them being virtual
|
||||||
|
|
||||||
|
|
||||||
|
## 0.2.10 - 2022-03-14
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed decals not projecting on loading prefabs
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Re-enabled projecting onto TransparentFX layer
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Allowed for regular expressions to be used when blacklisting shaders
|
||||||
|
- Added all Waterfall shaders to the shader blacklist when Waterfall is present
|
||||||
|
|
||||||
|
|
||||||
## 0.2.9 - 2022-03-12
|
## 0.2.9 - 2022-03-12
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
7
GameData/ConformalDecals/Patches/Waterfall.cfg
Normal file
7
GameData/ConformalDecals/Patches/Waterfall.cfg
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// Prevent projection onto Waterfall plumes
|
||||||
|
|
||||||
|
CONFORMALDECALS:NEEDS[Waterfall] {
|
||||||
|
SHADERBLACKLIST {
|
||||||
|
shaderRegex = Waterfall/.*
|
||||||
|
}
|
||||||
|
}
|
@ -4,21 +4,13 @@ CONFORMALDECALS {
|
|||||||
|
|
||||||
SHADERBLACKLIST {
|
SHADERBLACKLIST {
|
||||||
shader = DepthMask
|
shader = DepthMask
|
||||||
shader = KSP/Alpha/Cutoff
|
|
||||||
shader = KSP/Alpha/Cutoff Bumped
|
|
||||||
shader = KSP/Alpha/Translucent
|
|
||||||
shader = KSP/Alpha/Translucent Additive
|
|
||||||
shader = KSP/Alpha/Translucent Specular
|
|
||||||
shader = KSP/Alpha/Unlit Transparent
|
|
||||||
shader = KSP/Bumped Specular (Transparent)
|
shader = KSP/Bumped Specular (Transparent)
|
||||||
shader = KSP/FX/ScrollingUnlit
|
shader = KSP/FX/ScrollingUnlit
|
||||||
shader = KSP/Particles/Additive
|
|
||||||
shader = KSP/Particles/Additive (Soft)
|
|
||||||
shader = KSP/Particles/Alpha Blended
|
|
||||||
shader = KSP/Particles/Alpha Blended Emissive Cutout
|
|
||||||
shader = KSP/Specular (Cutoff)
|
shader = KSP/Specular (Cutoff)
|
||||||
shader = KSP/Specular (Transparent)
|
shader = KSP/Specular (Transparent)
|
||||||
shader = Solid Color (Alpha)
|
shader = Solid Color (Alpha)
|
||||||
|
shaderRegex = KSP/Alpha/.*
|
||||||
|
shaderRegex = KSP/Particles/.*
|
||||||
}
|
}
|
||||||
|
|
||||||
FONT {
|
FONT {
|
||||||
@ -57,4 +49,309 @@ CONFORMALDECALS {
|
|||||||
style = 32
|
style = 32
|
||||||
styleMask = 4
|
styleMask = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/09
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/Sentinel_Flag
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/blorbs
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/bullseye
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/capsule
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/circles
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/default
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/hexagon
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/hexagonCircles
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/kerbal1
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/kerbal2
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/kerbin
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/kerbinmunflag
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/line
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/minimalistic
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/orbit
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/orbs
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/retro
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/rings
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/rocketScience
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/satellite
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/spheres
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/squadLogo
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/squadLogo2
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/stripes
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/trees
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Flags/trippy
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/FlagsAgency/NASA
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/FlagsAgency/esa_dark_blue
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/FlagsAgency/uk_space_agency
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/FlagsOrganization/B612_Foundation_flag
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/FlagsOrganization/ESA_Arianespace
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/FlagsOrganization/electron
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/FlagsOrganization/rocketlab
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/C7AerospaceDivision
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/DinkelsteinKermansConstructionEmporium
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/ExperimentalEngineering
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/FlooydResearchLab
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/GoliathNationalProducts
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/IntegratedIntegrals
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/IonicSymphonicProtonicElectronics
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/JebsJunkyard
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/KerbalMotion
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/KerbinWorldFirstRecordKeepingSociety
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/Kerbodyne
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/Kerlington
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/MaxoConstructionToys
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/MovingPartsExpertsGroup
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/OMBDemolition
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/PeriapsisCo
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/Probodobodyne
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/R&D
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/ReactionSystemsLtd
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/Rockomax
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/Rokea
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/SeansCannery
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/SteadlerEngineeringCorps
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/StrutCo
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/Vac-Co
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/WinterOwl
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
|
|
||||||
|
ASPECTRATIO {
|
||||||
|
path = Squad/Agencies/ZaltonicElectronics
|
||||||
|
aspectRatio = 0.625
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"NAME": "ConformalDecals",
|
"NAME": "ConformalDecals",
|
||||||
"URL": "https://github.com/drewcassidy/KSP-Conformal-Decals/releases/latest/download/ConformalDecals.version.txt",
|
"URL": "https://github.com/drewcassidy/KSP-Conformal-Decals/releases/latest/download/ConformalDecals.version",
|
||||||
"DOWNLOAD": "https://github.com/drewcassidy/KSP-Conformal-Decals/releases/latest",
|
"DOWNLOAD": "https://github.com/drewcassidy/KSP-Conformal-Decals/releases/latest",
|
||||||
"CHANGE_LOG_URL": "https://raw.githubusercontent.com/drewcassidy/KSP-Conformal-Decals/release/CHANGELOG.md",
|
"CHANGE_LOG_URL": "https://raw.githubusercontent.com/drewcassidy/KSP-Conformal-Decals/release/CHANGELOG.md",
|
||||||
"VERSION": {
|
"VERSION": {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Conformal Decals v0.2.8
|
# Conformal Decals
|
||||||
[](https://travis-ci.com/drewcassidy/KSP-Conformal-Decals) [](https://creativecommons.org/licenses/by-sa/4.0/) [](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://creativecommons.org/licenses/by-sa/4.0/) [](https://www.gnu.org/licenses/gpl-3.0) [](https://github.com/KSP-CKAN/CKAN)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using ConformalDecals.Text;
|
using ConformalDecals.Text;
|
||||||
using ConformalDecals.Util;
|
using ConformalDecals.Util;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
@ -10,9 +11,11 @@ namespace ConformalDecals {
|
|||||||
public static class DecalConfig {
|
public static class DecalConfig {
|
||||||
private static Texture2D _blankNormal;
|
private static Texture2D _blankNormal;
|
||||||
private static List<string> _shaderBlacklist;
|
private static List<string> _shaderBlacklist;
|
||||||
|
private static List<Regex> _shaderRegexBlacklist;
|
||||||
private static Dictionary<string, DecalFont> _fontList;
|
private static Dictionary<string, DecalFont> _fontList;
|
||||||
private static int _decalLayer = 31;
|
private static int _decalLayer = 31;
|
||||||
private static bool _selectableInFlight;
|
private static bool _selectableInFlight;
|
||||||
|
private static Dictionary<string, float> _aspectRatios;
|
||||||
|
|
||||||
private struct LegacyShaderEntry {
|
private struct LegacyShaderEntry {
|
||||||
public string name;
|
public string name;
|
||||||
@ -50,15 +53,25 @@ namespace ConformalDecals {
|
|||||||
public static bool SelectableInFlight => _selectableInFlight;
|
public static bool SelectableInFlight => _selectableInFlight;
|
||||||
|
|
||||||
public static IEnumerable<DecalFont> Fonts => _fontList.Values;
|
public static IEnumerable<DecalFont> Fonts => _fontList.Values;
|
||||||
|
|
||||||
public static DecalFont FallbackFont { get; private set; }
|
public static Dictionary<string, float> AspectRatios => _aspectRatios;
|
||||||
|
|
||||||
public static bool IsBlacklisted(Shader shader) {
|
public static bool IsBlacklisted(Shader shader) {
|
||||||
return IsBlacklisted(shader.name);
|
return IsBlacklisted(shader.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsBlacklisted(string shaderName) {
|
public static bool IsBlacklisted(string shaderName) {
|
||||||
return _shaderBlacklist.Contains(shaderName);
|
if (_shaderBlacklist.Contains(shaderName)) return true;
|
||||||
|
|
||||||
|
foreach (var regex in _shaderRegexBlacklist) {
|
||||||
|
if (regex.IsMatch(shaderName)) {
|
||||||
|
_shaderBlacklist.Add(shaderName);
|
||||||
|
Logging.Log($"Caching blacklisted shader name '{shaderName}' which matches '{regex}'");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsLegacy(string shaderName, out string newShader, out string[] keywords) {
|
public static bool IsLegacy(string shaderName, out string newShader, out string[] keywords) {
|
||||||
@ -76,8 +89,7 @@ namespace ConformalDecals {
|
|||||||
public static DecalFont GetFont(string name) {
|
public static DecalFont GetFont(string name) {
|
||||||
if (_fontList.TryGetValue(name, out var font)) {
|
if (_fontList.TryGetValue(name, out var font)) {
|
||||||
return font;
|
return font;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw new KeyNotFoundException($"Font {name} not found");
|
throw new KeyNotFoundException($"Font {name} not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,16 +103,29 @@ namespace ConformalDecals {
|
|||||||
foreach (var shaderName in blacklist.GetValuesList("shader")) {
|
foreach (var shaderName in blacklist.GetValuesList("shader")) {
|
||||||
_shaderBlacklist.Add(shaderName);
|
_shaderBlacklist.Add(shaderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var shaderRegex in blacklist.GetValuesList("shaderRegex")) {
|
||||||
|
_shaderRegexBlacklist.Add(new Regex(shaderRegex));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var allFonts = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
|
var allFonts = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
|
||||||
|
|
||||||
foreach (var fontNode in node.GetNodes("FONT")) {
|
foreach (var fontNode in node.GetNodes("FONT")) {
|
||||||
try {
|
try {
|
||||||
var font = new DecalFont(fontNode, allFonts);
|
var font = new DecalFont(fontNode, allFonts);
|
||||||
_fontList.Add(font.Name, font);
|
_fontList.Add(font.Name, font);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Debug.LogException(e);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
}
|
||||||
|
|
||||||
|
foreach (var ratioNode in node.GetNodes("ASPECTRATIO")) {
|
||||||
|
try {
|
||||||
|
var path = ParseUtil.ParseString(ratioNode, "path");
|
||||||
|
var ratio = ParseUtil.ParseFloat(ratioNode, "aspectRatio");
|
||||||
|
_aspectRatios[path] = ratio;
|
||||||
|
} catch (Exception e) {
|
||||||
Debug.LogException(e);
|
Debug.LogException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,13 +153,15 @@ namespace ConformalDecals {
|
|||||||
// ReSharper disable once UnusedMember.Global
|
// ReSharper disable once UnusedMember.Global
|
||||||
public static void ModuleManagerPostLoad() {
|
public static void ModuleManagerPostLoad() {
|
||||||
_shaderBlacklist = new List<string>();
|
_shaderBlacklist = new List<string>();
|
||||||
|
_shaderRegexBlacklist = new List<Regex>();
|
||||||
_fontList = new Dictionary<string, DecalFont>();
|
_fontList = new Dictionary<string, DecalFont>();
|
||||||
|
_aspectRatios = new Dictionary<string, float>();
|
||||||
|
|
||||||
var configs = GameDatabase.Instance.GetConfigs("CONFORMALDECALS");
|
var configs = GameDatabase.Instance.GetConfigs("CONFORMALDECALS");
|
||||||
|
|
||||||
if (configs.Length > 0) {
|
if (configs.Length > 0) {
|
||||||
Logging.Log("loading config");
|
|
||||||
foreach (var config in configs) {
|
foreach (var config in configs) {
|
||||||
|
Logging.Log($"loading config node '{config.url}'");
|
||||||
ParseConfig(config.config);
|
ParseConfig(config.config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,12 @@ namespace ConformalDecals.MaterialProperties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float AspectRatio => MainTexture == null ? 1 : MainTexture.AspectRatio;
|
public float AspectRatio {
|
||||||
|
get => MainTexture == null ? 1 : MainTexture.AspectRatio;
|
||||||
|
set {
|
||||||
|
if (MainTexture != null) MainTexture.AspectRatio = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void OnBeforeSerialize() {
|
public void OnBeforeSerialize() {
|
||||||
if (_materialProperties == null) throw new SerializationException("Tried to serialize an uninitialized MaterialPropertyCollection");
|
if (_materialProperties == null) throw new SerializationException("Tried to serialize an uninitialized MaterialPropertyCollection");
|
||||||
@ -136,8 +141,7 @@ namespace ConformalDecals.MaterialProperties {
|
|||||||
public T GetProperty<T>(string propertyName) where T : MaterialProperty {
|
public T GetProperty<T>(string propertyName) where T : MaterialProperty {
|
||||||
if (_materialProperties.ContainsKey(propertyName) && _materialProperties[propertyName] is T property) {
|
if (_materialProperties.ContainsKey(propertyName) && _materialProperties[propertyName] is T property) {
|
||||||
return property;
|
return property;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,8 +149,7 @@ namespace ConformalDecals.MaterialProperties {
|
|||||||
public T AddOrGetProperty<T>(string propertyName) where T : MaterialProperty {
|
public T AddOrGetProperty<T>(string propertyName) where T : MaterialProperty {
|
||||||
if (_materialProperties.ContainsKey(propertyName) && _materialProperties[propertyName] is T property) {
|
if (_materialProperties.ContainsKey(propertyName) && _materialProperties[propertyName] is T property) {
|
||||||
return property;
|
return property;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return AddProperty<T>(propertyName);
|
return AddProperty<T>(propertyName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,9 +159,10 @@ namespace ConformalDecals.MaterialProperties {
|
|||||||
foreach (var material in Materials) {
|
foreach (var material in Materials) {
|
||||||
property.Remove(material);
|
property.Remove(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
_materialProperties.Remove(propertyName);
|
_materialProperties.Remove(propertyName);
|
||||||
Destroy(property);
|
Destroy(property);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,8 +208,7 @@ namespace ConformalDecals.MaterialProperties {
|
|||||||
if (_shader == null) {
|
if (_shader == null) {
|
||||||
Logging.Log("Using default decal shader");
|
Logging.Log("Using default decal shader");
|
||||||
shaderName = "ConformalDecals/Decal/Standard";
|
shaderName = "ConformalDecals/Decal/Standard";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@ namespace ConformalDecals.MaterialProperties {
|
|||||||
[SerializeField] private Vector2 _textureOffset;
|
[SerializeField] private Vector2 _textureOffset;
|
||||||
[SerializeField] private Vector2 _textureScale = Vector2.one;
|
[SerializeField] private Vector2 _textureScale = Vector2.one;
|
||||||
|
|
||||||
|
[SerializeField] private float _aspectRatioOverride = -1.0f;
|
||||||
|
|
||||||
public Texture2D Texture {
|
public Texture2D Texture {
|
||||||
get => _texture;
|
get => _texture;
|
||||||
set => _texture = value;
|
set => _texture = value;
|
||||||
@ -43,10 +45,12 @@ namespace ConformalDecals.MaterialProperties {
|
|||||||
|
|
||||||
public float AspectRatio {
|
public float AspectRatio {
|
||||||
get {
|
get {
|
||||||
|
if (_aspectRatioOverride > 0) return _aspectRatioOverride;
|
||||||
if (_texture == null) return 1;
|
if (_texture == null) return 1;
|
||||||
if (_textureUrl?.Contains("Squad/Flags") == true) return 0.625f;
|
|
||||||
return MaskedHeight / (float) MaskedWidth;
|
return MaskedHeight / (float) MaskedWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set => _aspectRatioOverride = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ParseNode(ConfigNode node) {
|
public override void ParseNode(ConfigNode node) {
|
||||||
@ -64,7 +68,7 @@ namespace ConformalDecals.MaterialProperties {
|
|||||||
if (ParseUtil.ParseStringIndirect(ref _textureUrl, node, "textureUrl")) {
|
if (ParseUtil.ParseStringIndirect(ref _textureUrl, node, "textureUrl")) {
|
||||||
_texture = LoadTexture(_textureUrl, isNormal);
|
_texture = LoadTexture(_textureUrl, isNormal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_texture == null) {
|
if (_texture == null) {
|
||||||
_texture = isNormal ? DecalConfig.BlankNormal : Texture2D.whiteTexture;
|
_texture = isNormal ? DecalConfig.BlankNormal : Texture2D.whiteTexture;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,8 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
[KSPField] public DecalScaleMode scaleMode = DecalScaleMode.HEIGHT;
|
[KSPField] public DecalScaleMode scaleMode = DecalScaleMode.HEIGHT;
|
||||||
|
|
||||||
|
[KSPField] public float aspectRatio = -1.0f; // < 0 = use texture
|
||||||
|
|
||||||
[KSPField] public bool depthAdjustable = true;
|
[KSPField] public bool depthAdjustable = true;
|
||||||
[KSPField] public float defaultDepth = 0.1f;
|
[KSPField] public float defaultDepth = 0.1f;
|
||||||
[KSPField] public Vector2 depthRange = new Vector2(0, 2);
|
[KSPField] public Vector2 depthRange = new Vector2(0, 2);
|
||||||
@ -122,8 +124,7 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
if (materialProperties == null) {
|
if (materialProperties == null) {
|
||||||
materialProperties = ScriptableObject.CreateInstance<MaterialPropertyCollection>();
|
materialProperties = ScriptableObject.CreateInstance<MaterialPropertyCollection>();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
materialProperties = ScriptableObject.Instantiate(materialProperties);
|
materialProperties = ScriptableObject.Instantiate(materialProperties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,14 +154,12 @@ namespace ConformalDecals {
|
|||||||
if (backRenderer == null) {
|
if (backRenderer == null) {
|
||||||
this.LogError($"Specified decalBack transform {decalBack} has no renderer attached! Setting updateBackScale to false.");
|
this.LogError($"Specified decalBack transform {decalBack} has no renderer attached! Setting updateBackScale to false.");
|
||||||
updateBackScale = false;
|
updateBackScale = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
backMaterial = backRenderer.material;
|
backMaterial = backRenderer.material;
|
||||||
if (backMaterial == null) {
|
if (backMaterial == null) {
|
||||||
this.LogError($"Specified decalBack transform {decalBack} has a renderer but no material! Setting updateBackScale to false.");
|
this.LogError($"Specified decalBack transform {decalBack} has a renderer but no material! Setting updateBackScale to false.");
|
||||||
updateBackScale = false;
|
updateBackScale = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (backTextureBaseScale == default) backTextureBaseScale = backMaterial.GetTextureScale(PropertyIDs._MainTex);
|
if (backTextureBaseScale == default) backTextureBaseScale = backMaterial.GetTextureScale(PropertyIDs._MainTex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,12 +200,14 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
if (tileRect.x >= 0) {
|
if (tileRect.x >= 0) {
|
||||||
materialProperties.UpdateTile(tileRect);
|
materialProperties.UpdateTile(tileRect);
|
||||||
}
|
} else if (tileIndex >= 0) {
|
||||||
else if (tileIndex >= 0) {
|
|
||||||
materialProperties.UpdateTile(tileIndex, tileSize);
|
materialProperties.UpdateTile(tileIndex, tileSize);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e) {
|
// handle aspect ratio overrides
|
||||||
|
materialProperties.AspectRatio = aspectRatio;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
this.LogException("Exception parsing partmodule", e);
|
this.LogException("Exception parsing partmodule", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,8 +223,7 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
if (HighLogic.LoadedSceneIsGame) {
|
if (HighLogic.LoadedSceneIsGame) {
|
||||||
UpdateScale();
|
UpdateScale();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
scale = defaultScale;
|
scale = defaultScale;
|
||||||
depth = defaultDepth;
|
depth = defaultDepth;
|
||||||
opacity = defaultOpacity;
|
opacity = defaultOpacity;
|
||||||
@ -261,8 +261,7 @@ namespace ConformalDecals {
|
|||||||
// set initial attachment state
|
// set initial attachment state
|
||||||
if (part.parent == null) {
|
if (part.parent == null) {
|
||||||
OnDetach();
|
OnDetach();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
OnAttach();
|
OnAttach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -400,30 +399,32 @@ namespace ConformalDecals {
|
|||||||
protected void UpdateScale() {
|
protected void UpdateScale() {
|
||||||
scale = Mathf.Max(0.01f, scale);
|
scale = Mathf.Max(0.01f, scale);
|
||||||
depth = Mathf.Max(0.01f, depth);
|
depth = Mathf.Max(0.01f, depth);
|
||||||
var aspectRatio = Mathf.Max(0.01f, materialProperties.AspectRatio);
|
|
||||||
|
var sizeRatio = Mathf.Max(0.01f, materialProperties.AspectRatio);
|
||||||
|
|
||||||
Vector2 size;
|
Vector2 size;
|
||||||
|
|
||||||
switch (scaleMode) {
|
switch (scaleMode) {
|
||||||
default:
|
default:
|
||||||
case DecalScaleMode.HEIGHT:
|
case DecalScaleMode.HEIGHT:
|
||||||
size = new Vector2(scale / aspectRatio, scale);
|
size = new Vector2(scale / sizeRatio, scale);
|
||||||
break;
|
break;
|
||||||
case DecalScaleMode.WIDTH:
|
case DecalScaleMode.WIDTH:
|
||||||
size = new Vector2(scale, scale * aspectRatio);
|
size = new Vector2(scale, scale * sizeRatio);
|
||||||
break;
|
break;
|
||||||
case DecalScaleMode.AVERAGE:
|
case DecalScaleMode.AVERAGE:
|
||||||
var width1 = 2 * scale / (1 + aspectRatio);
|
var width1 = 2 * scale / (1 + sizeRatio);
|
||||||
size = new Vector2(width1, width1 * aspectRatio);
|
size = new Vector2(width1, width1 * sizeRatio);
|
||||||
break;
|
break;
|
||||||
case DecalScaleMode.AREA:
|
case DecalScaleMode.AREA:
|
||||||
var width2 = Mathf.Sqrt(scale / aspectRatio);
|
var width2 = Mathf.Sqrt(scale / sizeRatio);
|
||||||
size = new Vector2(width2, width2 * aspectRatio);
|
size = new Vector2(width2, width2 * sizeRatio);
|
||||||
break;
|
break;
|
||||||
case DecalScaleMode.MINIMUM:
|
case DecalScaleMode.MINIMUM:
|
||||||
if (aspectRatio > 1) goto case DecalScaleMode.WIDTH;
|
if (sizeRatio > 1) goto case DecalScaleMode.WIDTH;
|
||||||
else goto case DecalScaleMode.HEIGHT;
|
else goto case DecalScaleMode.HEIGHT;
|
||||||
case DecalScaleMode.MAXIMUM:
|
case DecalScaleMode.MAXIMUM:
|
||||||
if (aspectRatio > 1) goto case DecalScaleMode.HEIGHT;
|
if (sizeRatio > 1) goto case DecalScaleMode.HEIGHT;
|
||||||
else goto case DecalScaleMode.WIDTH;
|
else goto case DecalScaleMode.WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,10 +441,13 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
// update projection
|
// update projection
|
||||||
foreach (var target in _targets) {
|
foreach (var target in _targets) {
|
||||||
target.Project(_orthoMatrix, decalProjectorTransform, _boundsRenderer.bounds, useBaseNormal);
|
if (target.target == null) {
|
||||||
|
_targets.Remove(target);
|
||||||
|
} else {
|
||||||
|
target.Project(_orthoMatrix, decalProjectorTransform, _boundsRenderer.bounds, useBaseNormal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// rescale preview model
|
// rescale preview model
|
||||||
decalModelTransform.localScale = new Vector3(size.x, size.y, (size.x + size.y) / 2);
|
decalModelTransform.localScale = new Vector3(size.x, size.y, (size.x + size.y) / 2);
|
||||||
|
|
||||||
@ -471,8 +475,7 @@ namespace ConformalDecals {
|
|||||||
protected void UpdateTargets() {
|
protected void UpdateTargets() {
|
||||||
if (_targets == null) {
|
if (_targets == null) {
|
||||||
_targets = new List<ProjectionTarget>();
|
_targets = new List<ProjectionTarget>();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
_targets.Clear();
|
_targets.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,9 +484,6 @@ namespace ConformalDecals {
|
|||||||
foreach (var renderer in renderers) {
|
foreach (var renderer in renderers) {
|
||||||
// skip disabled renderers
|
// skip disabled renderers
|
||||||
if (renderer.gameObject.activeInHierarchy == false) continue;
|
if (renderer.gameObject.activeInHierarchy == false) continue;
|
||||||
|
|
||||||
// skip transparentFX layer, which causes issues with Waterfall
|
|
||||||
if (renderer.gameObject.layer == 1) continue;
|
|
||||||
|
|
||||||
// skip blacklisted shaders
|
// skip blacklisted shaders
|
||||||
if (DecalConfig.IsBlacklisted(renderer.material.shader)) continue;
|
if (DecalConfig.IsBlacklisted(renderer.material.shader)) continue;
|
||||||
@ -577,10 +577,11 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
public void Render(Camera camera) {
|
public void Render(Camera camera) {
|
||||||
if (!_isAttached) return;
|
if (!_isAttached) return;
|
||||||
|
|
||||||
// render on each target object
|
// render on each target object
|
||||||
foreach (var target in _targets) {
|
foreach (var target in _targets) {
|
||||||
target.Render(_decalMaterial, part.mpb, camera);
|
if (ReferenceEquals(target.target, null)) _targets.Remove(target);
|
||||||
|
else target.Render(_decalMaterial, part.mpb, camera);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using ConformalDecals.Util;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ConformalDecals {
|
namespace ConformalDecals {
|
||||||
@ -38,7 +39,7 @@ namespace ConformalDecals {
|
|||||||
if (HighLogic.LoadedSceneIsEditor) {
|
if (HighLogic.LoadedSceneIsEditor) {
|
||||||
// Register flag change event
|
// Register flag change event
|
||||||
GameEvents.onMissionFlagSelect.Add(OnEditorFlagSelected);
|
GameEvents.onMissionFlagSelect.Add(OnEditorFlagSelected);
|
||||||
|
|
||||||
// Register reset button event
|
// Register reset button event
|
||||||
Events[nameof(ResetFlag)].guiActiveEditor = useCustomFlag;
|
Events[nameof(ResetFlag)].guiActiveEditor = useCustomFlag;
|
||||||
}
|
}
|
||||||
@ -53,7 +54,7 @@ namespace ConformalDecals {
|
|||||||
// Unregister flag change event
|
// Unregister flag change event
|
||||||
GameEvents.onMissionFlagSelect.Remove(OnEditorFlagSelected);
|
GameEvents.onMissionFlagSelect.Remove(OnEditorFlagSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnDestroy();
|
base.OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ namespace ConformalDecals {
|
|||||||
// Button for selecting a flag
|
// Button for selecting a flag
|
||||||
// This is a bit of a hack to bring up the stock flag selection menu
|
// This is a bit of a hack to bring up the stock flag selection menu
|
||||||
// When its done, it calls OnCustomFlagSelected()
|
// When its done, it calls OnCustomFlagSelected()
|
||||||
|
|
||||||
// ReSharper disable once PossibleNullReferenceException
|
// ReSharper disable once PossibleNullReferenceException
|
||||||
var flagBrowser = (Instantiate((Object) (new FlagBrowserGUIButton(null, null, null, null)).FlagBrowserPrefab) as GameObject).GetComponent<FlagBrowser>();
|
var flagBrowser = (Instantiate((Object) (new FlagBrowserGUIButton(null, null, null, null)).FlagBrowserPrefab) as GameObject).GetComponent<FlagBrowser>();
|
||||||
flagBrowser.OnFlagSelected = OnCustomFlagSelected;
|
flagBrowser.OnFlagSelected = OnCustomFlagSelected;
|
||||||
@ -70,24 +71,24 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
[KSPEvent(guiActive = false, guiActiveEditor = true, guiName = "#LOC_ConformalDecals_gui-reset-flag")]
|
[KSPEvent(guiActive = false, guiActiveEditor = true, guiName = "#LOC_ConformalDecals_gui-reset-flag")]
|
||||||
public void ResetFlag() {
|
public void ResetFlag() {
|
||||||
|
|
||||||
// we are no longer using a custom flag, so instead use the mission or agency flag
|
// we are no longer using a custom flag, so instead use the mission or agency flag
|
||||||
useCustomFlag = false;
|
useCustomFlag = false;
|
||||||
flagUrl = "Mission";
|
flagUrl = "Mission";
|
||||||
UpdateFlag(true);
|
UpdateFlag(true);
|
||||||
|
|
||||||
// disable the reset button, since it no longer makes sense
|
// disable the reset button, since it no longer makes sense
|
||||||
Events[nameof(ResetFlag)].guiActiveEditor = false;
|
Events[nameof(ResetFlag)].guiActiveEditor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCustomFlagSelected(FlagBrowser.FlagEntry newFlagEntry) {
|
private void OnCustomFlagSelected(FlagBrowser.FlagEntry newFlagEntry) {
|
||||||
// Callback for when a flag is selected in the menu spawned by SelectFlag()
|
// Callback for when a flag is selected in the menu spawned by SelectFlag()
|
||||||
|
|
||||||
// we are now using a custom flag with the URL of the new flag entry
|
// we are now using a custom flag with the URL of the new flag entry
|
||||||
useCustomFlag = true;
|
useCustomFlag = true;
|
||||||
flagUrl = newFlagEntry.textureInfo.name;
|
flagUrl = newFlagEntry.textureInfo.name;
|
||||||
UpdateFlag(true);
|
UpdateFlag(true);
|
||||||
|
|
||||||
// make sure the reset button is now available
|
// make sure the reset button is now available
|
||||||
Events[nameof(ResetFlag)].guiActiveEditor = true;
|
Events[nameof(ResetFlag)].guiActiveEditor = true;
|
||||||
}
|
}
|
||||||
@ -105,16 +106,16 @@ namespace ConformalDecals {
|
|||||||
private void UpdateFlag(bool recursive = false) {
|
private void UpdateFlag(bool recursive = false) {
|
||||||
// get the decal material property for the decal texture
|
// get the decal material property for the decal texture
|
||||||
var textureProperty = materialProperties.AddOrGetTextureProperty("_Decal", true);
|
var textureProperty = materialProperties.AddOrGetTextureProperty("_Decal", true);
|
||||||
|
|
||||||
if(useCustomFlag) {
|
string textureURL = useCustomFlag ? flagUrl : MissionFlagUrl;
|
||||||
// set the texture to the custom flag
|
textureProperty.TextureUrl = textureURL;
|
||||||
textureProperty.TextureUrl = flagUrl;
|
|
||||||
|
if (DecalConfig.AspectRatios.ContainsKey(textureURL)) {
|
||||||
|
var ratio = DecalConfig.AspectRatios[textureURL];
|
||||||
|
this.Log($"Overriding aspect ratio for {textureURL} with {ratio}");
|
||||||
|
textureProperty.AspectRatio = ratio;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// set the texture to the mission flag
|
|
||||||
textureProperty.TextureUrl = MissionFlagUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateMaterials();
|
UpdateMaterials();
|
||||||
UpdateScale();
|
UpdateScale();
|
||||||
|
|
||||||
@ -122,7 +123,7 @@ namespace ConformalDecals {
|
|||||||
// for each symmetry counterpart, copy this part's properties and update it in turn
|
// for each symmetry counterpart, copy this part's properties and update it in turn
|
||||||
foreach (var counterpart in part.symmetryCounterparts) {
|
foreach (var counterpart in part.symmetryCounterparts) {
|
||||||
var decal = counterpart.GetComponent<ModuleConformalFlag>();
|
var decal = counterpart.GetComponent<ModuleConformalFlag>();
|
||||||
|
|
||||||
decal.useCustomFlag = useCustomFlag;
|
decal.useCustomFlag = useCustomFlag;
|
||||||
decal.flagUrl = flagUrl;
|
decal.flagUrl = flagUrl;
|
||||||
decal.UpdateFlag();
|
decal.UpdateFlag();
|
||||||
|
@ -227,7 +227,7 @@ namespace ConformalDecals {
|
|||||||
if (_textEntryController != null) _textEntryController.Close();
|
if (_textEntryController != null) _textEntryController.Close();
|
||||||
if (_fillColorPickerController != null) _fillColorPickerController.Close();
|
if (_fillColorPickerController != null) _fillColorPickerController.Close();
|
||||||
if (_outlineColorPickerController != null) _outlineColorPickerController.Close();
|
if (_outlineColorPickerController != null) _outlineColorPickerController.Close();
|
||||||
|
|
||||||
base.OnDestroy();
|
base.OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user