mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Compare commits
74 Commits
feature-mu
...
feature-be
Author | SHA1 | Date | |
---|---|---|---|
5a7f101155 | |||
39555d92d1 | |||
7a909c18bc | |||
d714c498fb | |||
fa4b799788 | |||
970a69be11 | |||
dddb7f09f3 | |||
3cd229bc23 | |||
4948818065 | |||
036b084d34 | |||
1e3addeb4d | |||
47c70d3071 | |||
9955b9ce30 | |||
32ddc54019 | |||
ff262d55c8 | |||
d1f3d1fa55 | |||
2965633235 | |||
a82369e595 | |||
16c4fa2b96 | |||
591ec0aa74 | |||
210d326469 | |||
dd405a21db | |||
c40f700235 | |||
36cc896b2a | |||
4c02e91dfd | |||
41b15477fb | |||
b61f71bc00 | |||
74fe42a7ff | |||
7fa8969d5b | |||
21f8332d66 | |||
cb219a52c0 | |||
f2f2100334 | |||
9bdb95527a | |||
ad504ce4cc | |||
18ebbd7b4c | |||
ba189f18c4 | |||
322aaa613e | |||
5443377bfe | |||
1ed6dc0f68 | |||
90dec1b42a | |||
80da98d95a | |||
76016fbbf1 | |||
53657b8fad | |||
9d7502091c | |||
f788c25837 | |||
017110738b | |||
fd7134ece9 | |||
68ceacfef4 | |||
a452844cd1 | |||
4b8d11e1de | |||
8f888ee552 | |||
95b99d1d42 | |||
ba6676b625 | |||
495441be06 | |||
8025a0a418 | |||
760609fae2 | |||
ecc60751f7 | |||
e10b7e4b51 | |||
a91a83a280 | |||
316f92df2c | |||
f20119565f | |||
6ee52ac18e | |||
67ccaa1dae | |||
c33f5bacdd | |||
03d2e66543 | |||
be3b7f791a | |||
3effae6ecd | |||
938babb41b | |||
1e7c6d81c9 | |||
900061f7f6 | |||
d8d3d4ed92 | |||
a6d58690f9 | |||
f108341068 | |||
fb0070f92f |
23
.github/workflows/ff-release.yml
vendored
Normal file
23
.github/workflows/ff-release.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
name: Fast-Forward Release Branch
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
fast-forward:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: release
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Merge into Release
|
||||
run: git merge ${{github.ref_name}} --ff-only
|
||||
|
||||
- name: Push Changes
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: release
|
139
.github/workflows/ksp-publish.yml
vendored
Normal file
139
.github/workflows/ksp-publish.yml
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
name: Build and Release
|
||||
on: [ push ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Setup .NET Core SDK
|
||||
uses: actions/setup-dotnet@v1.7.2
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
|
||||
- name: Install Python Tools
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install yaclog yaclog-ksp
|
||||
|
||||
- name: Generate Version Info
|
||||
run: |
|
||||
echo "VERSION_TITLE=$(yaclog show -n)" >> $GITHUB_ENV
|
||||
python Scripts/version.py
|
||||
yaclog-ksp -n "Conformal Decals"
|
||||
|
||||
- name: Validate Version Info
|
||||
uses: DasSkelett/AVC-VersionFileValidator@master
|
||||
|
||||
- name: Download DLL Dependencies
|
||||
working-directory: Source
|
||||
run: |
|
||||
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
|
||||
|
||||
- name: Build DLL
|
||||
working-directory: Source
|
||||
run: |
|
||||
mkdir -p ../GameData/ConformalDecals/Plugins
|
||||
dotnet build --configuration Release ConformalDecals.sln
|
||||
|
||||
- name: Download KSP Dependencies
|
||||
run: |
|
||||
wget http://pileof.rocks/KSP/Shabby_v0.2.0.zip
|
||||
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/KSPModdingLibs/HarmonyKSP/releases/download/2.0.4.0/HarmonyKSP_2.0.4.0_for_KSP1.8+.zip
|
||||
unzip -d Shabby Shabby*.zip
|
||||
unzip -d B9PartSwitch B9PartSwitch*.zip
|
||||
unzip -d HarmonyKSP HarmonyKSP*.zip
|
||||
mv Shabby/GameData/Shabby GameData/
|
||||
mv ModuleManager*.dll GameData/
|
||||
mv B9PartSwitch/GameData/B9PartSwitch GameData/
|
||||
mv HarmonyKSP/GameData/000_Harmony GameData/
|
||||
|
||||
- name: Upload Unbundled Build
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ConformalDecals-unbundled
|
||||
path: |
|
||||
GameData/ConformalDecals
|
||||
README.md
|
||||
CHANGELOG.md
|
||||
LICENSE-ART.md
|
||||
LICENSE-SOURCE.md
|
||||
|
||||
- name: Upload Bundled Build
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ConformalDecals
|
||||
path: |
|
||||
GameData
|
||||
README.md
|
||||
CHANGELOG.md
|
||||
LICENSE-ART.md
|
||||
LICENSE-SOURCE.md
|
||||
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install Python Tools
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install yaclog
|
||||
|
||||
- name: Get version name and body
|
||||
run: |
|
||||
echo "VERSION_TITLE=$(yaclog show -n)" >> $GITHUB_ENV
|
||||
echo "$(yaclog show -mb)" >> RELEASE.md
|
||||
|
||||
- name: Download Build Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
- name: Zip Download Packages
|
||||
run: |
|
||||
mkdir bundled
|
||||
mkdir unbundled
|
||||
zip -r bundled/ConformalDecals-$VERSION_TITLE.zip ConformalDecals/*
|
||||
zip -r unbundled/ConformalDecals-$VERSION_TITLE.zip ConformalDecals-unbundled/*
|
||||
ls
|
||||
|
||||
- name: Publish to Spacedock
|
||||
run: |
|
||||
curl -F "username=drewcassidy" -F "password=${{ secrets.SPACEDOCK_PASS }}" \
|
||||
-c ./cookies "https://spacedock.info/api/login"
|
||||
curl -c ./cookies -b ./cookies \
|
||||
-F "version=$VERSION_TITLE" \
|
||||
-F "changelog=$(yaclog show -mb)" \
|
||||
-F "game-version=1.12.3" \
|
||||
-F "notify-followers=yes" \
|
||||
-F "zipball=@bundled/ConformalDecals-$VERSION_TITLE.zip" \
|
||||
"https://spacedock.info/api/mod/2451/update"
|
||||
|
||||
- name: Publish to Github
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
bundled/ConformalDecals-*.zip
|
||||
ConformalDecals/GameData/ConformalDecals/Versioning/ConformalDecals.version
|
||||
name: Conformal Decals ${{ env.VERSION_TITLE }}
|
||||
body_path: RELEASE.md
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -16,6 +16,9 @@ Temp/
|
||||
GameData/ConformalDecals/Resources/Resources
|
||||
GameData/ConformalDecals/Resources/*.manifest
|
||||
|
||||
# DLLs
|
||||
GameData/ConformalDecals/Plugins
|
||||
|
||||
# Unity Project Files
|
||||
PartTools.cfg
|
||||
*.meta
|
||||
@ -52,4 +55,4 @@ Source/ConformalDecals/bin
|
||||
.vs
|
||||
obj
|
||||
*.swp
|
||||
Source/.editorconfig
|
||||
@thumbs
|
||||
|
@ -16,11 +16,15 @@ dependencies: # Configure dependencies
|
||||
zip: false
|
||||
B9PartSwitch:
|
||||
location: url
|
||||
url: http://pileof.rocks/KSP/B9PartSwitch-v2.16.0.zip
|
||||
url: http://pileof.rocks/KSP/B9PartSwitch-v2.18.0.zip
|
||||
zip: true
|
||||
Shabby:
|
||||
location: url
|
||||
url: http://taniwha.org/~bill/Shabby_v0.1.2.zip
|
||||
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:
|
||||
|
25
.travis.yml
25
.travis.yml
@ -1,25 +0,0 @@
|
||||
language: python
|
||||
python:
|
||||
- 3.6
|
||||
before_install:
|
||||
- echo -e "machine github.com\n login $GITHUB_OAUTH_TOKEN" > ~/.netrc
|
||||
install:
|
||||
- pip install awscli boto3 requests
|
||||
branches:
|
||||
only:
|
||||
- release
|
||||
script:
|
||||
- git clone https://github.com/post-kerbin-mining-corporation/build-deploy.git
|
||||
- cd build-deploy
|
||||
- git checkout master
|
||||
- cd ..
|
||||
- pytest -s --testpath "GameData/" build-deploy/src/tests/ # run the deploy tests
|
||||
- python build-deploy/src/package.py --f ".mod_data.yml" # Build package
|
||||
before_deploy:
|
||||
- python build-deploy/src/stage.py --f ".mod_data.yml" # Run the staging script
|
||||
deploy:
|
||||
- provider: script
|
||||
script: python build-deploy/src/deploy.py --f ".mod_data.yml" # Deploy package to spacedock, curse, github
|
||||
skip_cleanup: true
|
||||
on:
|
||||
branch: release
|
BIN
Assets/Textures/Decal-Back.afdesign
Normal file
BIN
Assets/Textures/Decal-Back.afdesign
Normal file
Binary file not shown.
BIN
Assets/Textures/Icons Generic.afdesign
Normal file
BIN
Assets/Textures/Icons Generic.afdesign
Normal file
Binary file not shown.
BIN
Assets/Textures/Munar.afdesign
Normal file
BIN
Assets/Textures/Munar.afdesign
Normal file
Binary file not shown.
BIN
Assets/Textures/Semiotic.afdesign
Normal file
BIN
Assets/Textures/Semiotic.afdesign
Normal file
Binary file not shown.
193
CHANGELOG.md
Normal file
193
CHANGELOG.md
Normal file
@ -0,0 +1,193 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file
|
||||
|
||||
| modName | Conformal Decals |
|
||||
| ------- |:-------------------------------------------------------------------------------------|
|
||||
| license | CC-By-SA & GPL3 |
|
||||
| website | https://forum.kerbalspaceprogram.com/index.php?/topic/194802-18-111-conformal-decals |
|
||||
| author | Andrew Cassidy |
|
||||
|
||||
## 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
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed text decals breaking when used in symmetry
|
||||
- Fixed decals projecting onto the TransparentFX layer, such as Waterfall plumes
|
||||
|
||||
|
||||
## 0.2.8
|
||||
|
||||
- Update bundled Shabby to support Harmony 2 for compatibility with other mods
|
||||
- Update bundled B9PartSwitch to 2.18.0
|
||||
|
||||
|
||||
## 0.2.7
|
||||
|
||||
- Supported KSP versions: 1.8.x to 1.11.x
|
||||
|
||||
### Notes:
|
||||
|
||||
- Attaching decal parts in flight using engineer kerbals is not supported.
|
||||
|
||||
### Fixed:
|
||||
|
||||
- Fixed certain non-ascii strings not rendering correctly under certain circumstances.
|
||||
- Yet another attempted fix for the planet text glitch.
|
||||
|
||||
|
||||
## 0.2.6
|
||||
|
||||
### Fixed:
|
||||
|
||||
- Fixed stock flags appearing stretched by forcing their aspect ratio to be correct.
|
||||
- Another attempted fix for the planet text glitch.
|
||||
|
||||
|
||||
## 0.2.5
|
||||
|
||||
### Fixed:
|
||||
|
||||
- Fixed line spacing, character spacing, and vertical settings not applying to symmetry counterparts
|
||||
|
||||
|
||||
## 0.2.4
|
||||
|
||||
### Fixed:
|
||||
|
||||
- Fixed red text appearing on planets due to KSP bug by clearing render textures afterwards.
|
||||
- Fixed fonts not saving correctly.
|
||||
|
||||
### Changed:
|
||||
|
||||
- Lowered step size for decal size and depth to 1cm.
|
||||
- Changed default max size to 5m.
|
||||
- Changed default text decal size to 0.2m
|
||||
- Text decals now show as a circle if they contain only whitespace.
|
||||
|
||||
|
||||
## 0.2.3
|
||||
|
||||
### Fixed:
|
||||
|
||||
- Fixed TMP subobjects being deleted, causing fallback fonts to fail in some situations.
|
||||
- Started using URL-style encoding for text decals behind the scenes to prevent issues with certain characters.
|
||||
- Fixed text decals having zero size when they had only whitespace or an empty string.
|
||||
- Fixed decals having drag and causing issues when using FAR.
|
||||
- Fixed broken saving of text decals in certain circumstances.
|
||||
|
||||
|
||||
## 0.2.2
|
||||
|
||||
### Fixed:
|
||||
|
||||
- Fixed corrupted text rendering when a vessel loads during a scene change.
|
||||
|
||||
|
||||
## 0.2.1
|
||||
|
||||
### Changed:
|
||||
|
||||
- Pressing enter in the text entry window now types a newline.
|
||||
|
||||
### Fixed:
|
||||
|
||||
- Renamed font assetbundle. The old extension was causing the game to try to load it twice on Windows due to legacy compatability features.
|
||||
- Fixed text rendering on DirectX resulting in black boxes by using ARGB32 instead of RG16 for the render texture in DirectX.
|
||||
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### New Parts:
|
||||
|
||||
- CDL-3 Surface Base Decal: A set of conformal decals based on the symbols from the movie Moon (2009) designed by Gavin Rothery
|
||||
- CDL-T Custom Text Decal: A customizable text decal with a variety of fonts
|
||||
|
||||
### Changed:
|
||||
|
||||
- New ModuleConformalText module for customizable text
|
||||
- Text, font, and style can all be customized, as well as text fill and outline colors and widths
|
||||
- Same projection and opacity options as other conformal decals
|
||||
- New StandardText decal shader supporting the text module
|
||||
- Unified all decal shaders into a single "StandardDecal" shader with variants supporting any combination of bump, specular and emissive maps, plus SDF alphas.
|
||||
- Old shaders are remapped to Standard shader plus keywords automatically.
|
||||
- New SDF-based antialiasing for when decals extend to their borders, e.g. on opaque flags.
|
||||
- New "KEYWORD" material modifier, allowing for shader features to be enabled and disabled.
|
||||
- Material modifiers can now be removed in variants by setting `remove = true` inside them.
|
||||
|
||||
### Fixed:
|
||||
|
||||
- Fixed WIDTH and HEIGHT scale modes being flipped
|
||||
- Removed some debug log statements
|
||||
- Dependencies:
|
||||
- Updated ModuleManager to version 4.1.4
|
||||
|
||||
|
||||
## 0.1.4
|
||||
|
||||
Supported KSP versions: 1.8.x to 1.10.x
|
||||
|
||||
### Fixed:
|
||||
|
||||
- Fixed decals rendering onto disabled B9PS part variants
|
||||
- Decals will still not update whan their parent part's B9PS variant is changed, both in flight and in the editor. This is known and awaiting a change to B9PS to be fixed.
|
||||
- Fixed decal bounds rendering as dark cubes when shadowed by EVE clouds.
|
||||
- Fixed decals being shadowed by EVE clouds, causing the part underneath to appear overly dark.
|
||||
|
||||
|
||||
## 0.1.3
|
||||
|
||||
### Fixe:
|
||||
|
||||
- Fixed decals being able to be scaled down to 0
|
||||
|
||||
### Changed:
|
||||
|
||||
- Made decal bounds no longer collide in flight, this is done by repurposing layer 31 (which is configurable in the ConformalDecals.cfg file)
|
||||
- Decals will now be unselectable in flight by default. This can be disabled with the `selectableInFlight` value in ConformalDecals.cfg, or in the module config itself.
|
||||
- Decal parts will now destroy themselves automatically when the parent part is destroyed
|
||||
- Small refactor of node parsing code
|
||||
- Colors can now be specified in hex (#RGB, #RGBA, #RRGGBB, or #RRGGBBAA) or using the colors specified in the XKCDColors class
|
||||
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Fixed:
|
||||
|
||||
- Disabled writing to the zbuffer in the decal bounds shader. Should fix any issues with Scatterer or EVE.
|
||||
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Fixed:
|
||||
|
||||
- Fixed flag decal not adjusting to new texture sizes immediately.
|
||||
- Fixed decal bounds being visible on launch.
|
||||
- Fixed decal bounds being visible in the part icon.
|
||||
|
||||
|
||||
## 0.1.0
|
||||
|
||||
Initial release!
|
||||
|
||||
### New Parts:
|
||||
|
||||
- CDL-F Flag Decal: Conformal flag decal, which uses either the mission flag or a flag of your choosing.
|
||||
- CDL-1 Generic Decal: A set of conformal generic decals for planes and rockets
|
||||
- CDL-2 Semiotic Standard Decal: A set of conformal decals based on the Semiotic Standard for All Commercial Trans-Stellar Utility Lifter and Transport Spacecraft designed by Ron Cobb for the movie Alien
|
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/.*
|
||||
}
|
||||
}
|
Binary file not shown.
@ -4,21 +4,13 @@ CONFORMALDECALS {
|
||||
|
||||
SHADERBLACKLIST {
|
||||
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/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 (Transparent)
|
||||
shader = Solid Color (Alpha)
|
||||
shaderRegex = KSP/Alpha/.*
|
||||
shaderRegex = KSP/Particles/.*
|
||||
}
|
||||
|
||||
FONT {
|
||||
|
@ -1,28 +1,24 @@
|
||||
{
|
||||
"NAME":"ConformalDecals",
|
||||
"URL":"https://raw.githubusercontent.com/drewcassidy/KSP-Conformal-Decals/release/GameData/ConformalDecals/Versioning/ConformalDecals.version",
|
||||
"DOWNLOAD":"https://github.com/drewcassidy/KSP-Conformal-Decals/releases",
|
||||
"VERSION":
|
||||
{
|
||||
"MAJOR":0,
|
||||
"MINOR":2,
|
||||
"PATCH":7,
|
||||
"BUILD":0
|
||||
"NAME": "ConformalDecals",
|
||||
"URL": "https://github.com/drewcassidy/KSP-Conformal-Decals/releases/latest/download/ConformalDecals.version",
|
||||
"DOWNLOAD": "https://github.com/drewcassidy/KSP-Conformal-Decals/releases/latest",
|
||||
"CHANGE_LOG_URL": "https://raw.githubusercontent.com/drewcassidy/KSP-Conformal-Decals/release/CHANGELOG.md",
|
||||
"VERSION": {
|
||||
"MAJOR": 9,
|
||||
"MINOR": 9,
|
||||
"PATCH": 9,
|
||||
"BUILD": 100000
|
||||
},
|
||||
"KSP_VERSION":
|
||||
{
|
||||
"MAJOR":1,
|
||||
"MINOR":11,
|
||||
"PATCH":0
|
||||
"KSP_VERSION": {
|
||||
"MAJOR": 1,
|
||||
"MINOR": 12
|
||||
},
|
||||
"KSP_VERSION_MIN":{
|
||||
"MAJOR":1,
|
||||
"MINOR":8,
|
||||
"PATCH":0
|
||||
"KSP_VERSION_MIN": {
|
||||
"MAJOR": 1,
|
||||
"MINOR": 8
|
||||
},
|
||||
"KSP_VERSION_MAX":{
|
||||
"MAJOR":1,
|
||||
"MINOR":11,
|
||||
"PATCH":99
|
||||
"KSP_VERSION_MAX": {
|
||||
"MAJOR": 1,
|
||||
"MINOR": 12
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
# Conformal Decals v0.2.7
|
||||
[](https://travis-ci.com/drewcassidy/KSP-Conformal-Decals) [](https://creativecommons.org/licenses/by-sa/4.0/) [](https://www.gnu.org/licenses/gpl-3.0)
|
||||
# Conformal Decals
|
||||
[](https://creativecommons.org/licenses/by-sa/4.0/) [](https://www.gnu.org/licenses/gpl-3.0)
|
||||
|
||||

|
||||
|
||||
@ -9,9 +9,10 @@ Conformal Decals adds a set of decal stickers to KSP, as well as providing a fra
|
||||
|
||||
Required:
|
||||
- KSP (1.8.x to 1.10.x)
|
||||
- B9 Part Switch (2.16.0). Bundled with release.
|
||||
- B9 Part Switch (2.18.0). Bundled with release.
|
||||
- ModuleManager (4.1.4). Bundled with release.
|
||||
- Shabby (0.1.2). Bundled with release.
|
||||
- Shabby (0.2.0 unofficial build). Bundled with release.
|
||||
- HarmonyKSP (2.0.4.0). Bundled with release.
|
||||
|
||||
Optional:
|
||||
- Wild Blue Tools. For custom decals category in the VAB and SPH.
|
||||
|
61
Scripts/version.py
Normal file
61
Scripts/version.py
Normal file
@ -0,0 +1,61 @@
|
||||
import yaclog
|
||||
import yaclog.version
|
||||
import git as gp
|
||||
import os
|
||||
import xml.dom.minidom as minidom
|
||||
import json
|
||||
|
||||
|
||||
def run():
|
||||
repo = gp.Repo(os.curdir)
|
||||
cl = yaclog.Changelog('CHANGELOG.md')
|
||||
version = str(cl.current_version(released=True).version)
|
||||
release = False
|
||||
|
||||
for tag in repo.tags:
|
||||
if tag.commit == repo.head.commit:
|
||||
release = True
|
||||
build = 100000
|
||||
break
|
||||
|
||||
if not release:
|
||||
build = int.from_bytes(repo.head.commit.binsha[0:2], byteorder='big')
|
||||
version = yaclog.version.increment_version(version, 2)
|
||||
|
||||
print(f'Setting up version {version} build {build}')
|
||||
|
||||
version_path = 'GameData/ConformalDecals/Versioning/ConformalDecals.version'
|
||||
with open(version_path, 'r+') as version_file:
|
||||
print('Updating version file')
|
||||
segments = version.split('.')
|
||||
# print(version_file.read())
|
||||
decoded = json.load(version_file)
|
||||
decoded['VERSION']['MAJOR'] = int(segments[0])
|
||||
decoded['VERSION']['MINOR'] = int(segments[1])
|
||||
decoded['VERSION']['PATCH'] = int(segments[2])
|
||||
decoded['VERSION']['BUILD'] = build
|
||||
|
||||
version_file.seek(0)
|
||||
json.dump(decoded, version_file, indent=4)
|
||||
version_file.truncate()
|
||||
|
||||
project_path = 'Source/ConformalDecals/ConformalDecals.csproj'
|
||||
with open(project_path, 'r+') as project_file:
|
||||
print('Updating csproj file')
|
||||
segments = version.split('.')
|
||||
decoded = minidom.parse(project_file)
|
||||
version_node = decoded.getElementsByTagName('AssemblyVersion')[0]
|
||||
if release:
|
||||
version_node.firstChild.nodeValue = f'{version}'
|
||||
else:
|
||||
version_node.firstChild.nodeValue = f'{version}.{build}'
|
||||
# version_node.value = f'{version}.{build}'
|
||||
project_file.seek(0)
|
||||
decoded.writexml(project_file)
|
||||
project_file.truncate()
|
||||
|
||||
print('Done!')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run()
|
@ -1,11 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<?xml version="1.0" encoding="utf-8"?><Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<LangVersion>8</LangVersion>
|
||||
<IsPackable>false</IsPackable>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<NoWarn>1701;1702;CS0649;CS1591</NoWarn>
|
||||
<AssemblyVersion>0.2.7</AssemblyVersion>
|
||||
<AssemblyVersion>9.9.9</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -51,8 +51,8 @@
|
||||
<None Include="..\.editorconfig" />
|
||||
</ItemGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="/bin/cp -v '$(OutDir)ConformalDecals.dll' '$(SolutionDir)../GameData/ConformalDecals/Plugins'" />
|
||||
<Exec Command="/bin/cp -v '$(OutDir)ConformalDecals.dll' '$(SolutionDir)../GameData/ConformalDecals/Plugins/ConformalDecals.dll'" IgnoreExitCode="true" />
|
||||
<!--Fuck you MSBuild stop trying to run CMD.exe on macOS-->
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using ConformalDecals.Text;
|
||||
using ConformalDecals.Util;
|
||||
using TMPro;
|
||||
@ -9,6 +10,7 @@ namespace ConformalDecals {
|
||||
public static class DecalConfig {
|
||||
private static Texture2D _blankNormal;
|
||||
private static List<string> _shaderBlacklist;
|
||||
private static List<Regex> _shaderRegexBlacklist;
|
||||
private static Dictionary<string, DecalFont> _fontList;
|
||||
private static int _decalLayer = 31;
|
||||
private static bool _selectableInFlight;
|
||||
@ -55,7 +57,17 @@ namespace ConformalDecals {
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -88,6 +100,10 @@ namespace ConformalDecals {
|
||||
foreach (var shaderName in blacklist.GetValuesList("shader")) {
|
||||
_shaderBlacklist.Add(shaderName);
|
||||
}
|
||||
|
||||
foreach (var shaderRegex in blacklist.GetValuesList("shaderRegex")) {
|
||||
_shaderRegexBlacklist.Add(new Regex(shaderRegex));
|
||||
}
|
||||
}
|
||||
|
||||
var allFonts = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
|
||||
@ -121,13 +137,14 @@ namespace ConformalDecals {
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public static void ModuleManagerPostLoad() {
|
||||
_shaderBlacklist = new List<string>();
|
||||
_shaderRegexBlacklist = new List<Regex>();
|
||||
_fontList = new Dictionary<string, DecalFont>();
|
||||
|
||||
var configs = GameDatabase.Instance.GetConfigs("CONFORMALDECALS");
|
||||
|
||||
if (configs.Length > 0) {
|
||||
Logging.Log("Loading config");
|
||||
foreach (var config in configs) {
|
||||
Logging.Log($"loading config node '{config.url}'");
|
||||
ParseConfig(config.config);
|
||||
}
|
||||
}
|
||||
@ -143,4 +160,4 @@ namespace ConformalDecals {
|
||||
_blankNormal = MakeBlankNormal();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -280,20 +280,6 @@ namespace ConformalDecals.MaterialProperties {
|
||||
UpdateTile(tile);
|
||||
}
|
||||
|
||||
public void SetOpacity(float opacity) {
|
||||
DecalMaterial.SetFloat(DecalPropertyIDs._DecalOpacity, opacity);
|
||||
PreviewMaterial.SetFloat(DecalPropertyIDs._DecalOpacity, opacity);
|
||||
}
|
||||
|
||||
public void SetCutoff(float cutoff) {
|
||||
DecalMaterial.SetFloat(DecalPropertyIDs._Cutoff, cutoff);
|
||||
PreviewMaterial.SetFloat(DecalPropertyIDs._Cutoff, cutoff);
|
||||
}
|
||||
|
||||
public void SetWear(float wear) {
|
||||
DecalMaterial.SetFloat(DecalPropertyIDs._EdgeWearStrength, wear);
|
||||
}
|
||||
|
||||
public void UpdateMaterials() {
|
||||
foreach (var material in Materials) {
|
||||
UpdateMaterial(material);
|
||||
|
@ -27,6 +27,7 @@ namespace ConformalDecals.MaterialProperties {
|
||||
public string TextureUrl {
|
||||
get => _textureUrl;
|
||||
set {
|
||||
if (_textureUrl == value) return; // URL hasnt changed
|
||||
_texture = LoadTexture(value, isNormal);
|
||||
_textureUrl = value;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ConformalDecals.MaterialProperties;
|
||||
using ConformalDecals.Targets;
|
||||
using ConformalDecals.Util;
|
||||
using UniLinq;
|
||||
using UnityEngine;
|
||||
@ -72,14 +73,20 @@ namespace ConformalDecals {
|
||||
UI_FloatRange()]
|
||||
public float opacity = 1.0f;
|
||||
|
||||
private MaterialFloatProperty _opacityProperty;
|
||||
|
||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-cutoff", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "P0"),
|
||||
UI_FloatRange()]
|
||||
public float cutoff = 0.5f;
|
||||
|
||||
private MaterialFloatProperty _cutoffProperty;
|
||||
|
||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-wear", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F0"),
|
||||
UI_FloatRange()]
|
||||
public float wear = 100;
|
||||
|
||||
private MaterialFloatProperty _wearProperty;
|
||||
|
||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-multiproject", guiActive = false, guiActiveEditor = true, isPersistant = true),
|
||||
UI_Toggle()]
|
||||
public bool projectMultiple = true;
|
||||
@ -127,10 +134,13 @@ namespace ConformalDecals {
|
||||
|
||||
if (materialProperties == null) {
|
||||
materialProperties = ScriptableObject.CreateInstance<MaterialPropertyCollection>();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
materialProperties = ScriptableObject.Instantiate(materialProperties);
|
||||
}
|
||||
|
||||
_opacityProperty = materialProperties.AddOrGetProperty<MaterialFloatProperty>("_DecalOpacity");
|
||||
_cutoffProperty = materialProperties.AddOrGetProperty<MaterialFloatProperty>("_Cutoff");
|
||||
_wearProperty = materialProperties.AddOrGetProperty<MaterialFloatProperty>("_EdgeWearStrength");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -138,24 +148,21 @@ namespace ConformalDecals {
|
||||
// Load
|
||||
try {
|
||||
LoadDecal(node);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
this.LogException("Error loading decal", e);
|
||||
}
|
||||
|
||||
// Setup
|
||||
try {
|
||||
SetupDecal();
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
this.LogException("Error setting up decal", e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnIconCreate() {
|
||||
UpdateTextures();
|
||||
UpdateProjection();
|
||||
UpdateAll();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -181,8 +188,7 @@ namespace ConformalDecals {
|
||||
// set initial attachment state
|
||||
if (part.parent == null) {
|
||||
OnDetach();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
OnAttach();
|
||||
}
|
||||
}
|
||||
@ -203,7 +209,7 @@ namespace ConformalDecals {
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when the decal is destroyed
|
||||
/// Called by Unity when the decal is destroyed
|
||||
public virtual void OnDestroy() {
|
||||
// remove GameEvents
|
||||
if (HighLogic.LoadedSceneIsEditor) {
|
||||
@ -227,42 +233,32 @@ namespace ConformalDecals {
|
||||
// scale or depth values have been changed, so update scale
|
||||
// and update projection matrices if attached
|
||||
UpdateProjection();
|
||||
UpdateTargets();
|
||||
|
||||
foreach (var counterpart in part.symmetryCounterparts) {
|
||||
var decal = counterpart.GetComponent<ModuleConformalDecal>();
|
||||
decal.UpdateProjection();
|
||||
decal.UpdateTargets();
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when the decal's material is modified through a tweakable
|
||||
protected void OnMaterialTweakEvent(BaseField field, object obj) {
|
||||
materialProperties.SetOpacity(opacity);
|
||||
materialProperties.SetCutoff(cutoff);
|
||||
if (useBaseNormal) {
|
||||
materialProperties.SetWear(wear);
|
||||
}
|
||||
UpdateMaterials();
|
||||
|
||||
foreach (var counterpart in part.symmetryCounterparts) {
|
||||
var decal = counterpart.GetComponent<ModuleConformalDecal>();
|
||||
decal.materialProperties.SetOpacity(opacity);
|
||||
decal.materialProperties.SetCutoff(cutoff);
|
||||
if (useBaseNormal) {
|
||||
decal.materialProperties.SetWear(wear);
|
||||
}
|
||||
decal.UpdateMaterials();
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when a new variant is applied in the editor
|
||||
/// Called by KSP when a new variant is applied in the editor
|
||||
protected void OnVariantApplied(Part eventPart, PartVariant variant) {
|
||||
if (_isAttached && eventPart != null && (!projectMultiple || eventPart == part.parent)) {
|
||||
if (_isAttached && eventPart != null && (projectMultiple || eventPart == part.parent)) {
|
||||
_targets.Remove(eventPart);
|
||||
UpdateTargets();
|
||||
UpdateProjection();
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when an editor event occurs
|
||||
/// Called by KSP when an editor event occurs
|
||||
protected void OnEditorEvent(ConstructionEventType eventType, Part eventPart) {
|
||||
switch (eventType) {
|
||||
case ConstructionEventType.PartAttached:
|
||||
@ -279,61 +275,60 @@ namespace ConformalDecals {
|
||||
}
|
||||
|
||||
/// Called when a part is transformed in the editor
|
||||
protected void OnPartTransformed(Part eventPart) {
|
||||
if (this.part == eventPart) {
|
||||
protected void OnPartTransformed(Part eventPart, bool firstcall = true) {
|
||||
if (part == eventPart || (firstcall && part.symmetryCounterparts.Contains(eventPart))) {
|
||||
// if this is the top-level call (original event part is a decal) then update symmetry counterparts, otherwise just update this
|
||||
UpdateProjection();
|
||||
UpdateTargets();
|
||||
}
|
||||
else if (_isAttached && projectMultiple) {
|
||||
} else if (_isAttached) {
|
||||
UpdatePartTarget(eventPart, _boundsRenderer.bounds);
|
||||
// recursively call for child parts
|
||||
foreach (var child in eventPart.children) {
|
||||
OnPartTransformed(child);
|
||||
OnPartTransformed(child, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when a part is attached in the editor
|
||||
protected void OnPartAttached(Part eventPart) {
|
||||
if (this.part == eventPart) {
|
||||
protected void OnPartAttached(Part eventPart, bool firstcall = true) {
|
||||
if (part == eventPart || (firstcall && part.symmetryCounterparts.Contains(eventPart))) {
|
||||
// if this is the top-level call (original event part is a decal) then update symmetry counterparts, otherwise just update this
|
||||
OnAttach();
|
||||
}
|
||||
else if (_isAttached && projectMultiple) {
|
||||
} else {
|
||||
UpdatePartTarget(eventPart, _boundsRenderer.bounds);
|
||||
// recursively call for child parts
|
||||
foreach (var child in eventPart.children) {
|
||||
OnPartAttached(child);
|
||||
OnPartAttached(child, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when a part is detached in the editor
|
||||
protected void OnPartDetached(Part eventPart) {
|
||||
if (this.part == eventPart) {
|
||||
protected void OnPartDetached(Part eventPart, bool firstcall = true) {
|
||||
if (part == eventPart || (firstcall && part.symmetryCounterparts.Contains(eventPart))) {
|
||||
// if this is the top-level call (original event part is a decal) then update symmetry counterparts, otherwise just update this
|
||||
OnDetach();
|
||||
}
|
||||
else if (_isAttached && projectMultiple) {
|
||||
} else if (_isAttached) {
|
||||
_targets.Remove(eventPart);
|
||||
// recursively call for child parts
|
||||
foreach (var child in eventPart.children) {
|
||||
OnPartDetached(child);
|
||||
OnPartDetached(child, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when part `willDie` will be destroyed
|
||||
protected void OnPartWillDie(Part willDie) {
|
||||
if (willDie == part.parent) {
|
||||
if (willDie == part.parent && willDie != null) {
|
||||
this.Log("Parent part about to be destroyed! Killing decal part.");
|
||||
part.Die();
|
||||
}
|
||||
else if (_isAttached && projectMultiple) {
|
||||
} else if (_isAttached && projectMultiple) {
|
||||
_targets.Remove(willDie);
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when decal is attached to a new part
|
||||
protected virtual void OnAttach() {
|
||||
if (_isAttached) return;
|
||||
if (part.parent == null) {
|
||||
this.LogError("Attach function called but part has no parent!");
|
||||
_isAttached = false;
|
||||
@ -354,11 +349,11 @@ namespace ConformalDecals {
|
||||
|
||||
UpdateMaterials();
|
||||
UpdateProjection();
|
||||
UpdateTargets();
|
||||
}
|
||||
|
||||
/// Called when decal is detached from its parent part
|
||||
protected virtual void OnDetach() {
|
||||
if (!_isAttached) return;
|
||||
_isAttached = false;
|
||||
|
||||
// unhide model
|
||||
@ -379,36 +374,36 @@ namespace ConformalDecals {
|
||||
/// Load any settings from the decal config
|
||||
protected virtual void LoadDecal(ConfigNode node) {
|
||||
// PARSE TRANSFORMS
|
||||
decalFrontTransform = part.FindModelTransform(decalFront);
|
||||
if (decalFrontTransform == null) throw new FormatException($"Could not find decalFront transform: '{decalFront}'.");
|
||||
if (!HighLogic.LoadedSceneIsGame) {
|
||||
decalFrontTransform = part.FindModelTransform(decalFront);
|
||||
if (decalFrontTransform == null) throw new FormatException($"Could not find decalFront transform: '{decalFront}'.");
|
||||
|
||||
decalBackTransform = part.FindModelTransform(decalBack);
|
||||
if (decalBackTransform == null) throw new FormatException($"Could not find decalBack transform: '{decalBack}'.");
|
||||
decalBackTransform = part.FindModelTransform(decalBack);
|
||||
if (decalBackTransform == null) throw new FormatException($"Could not find decalBack transform: '{decalBack}'.");
|
||||
|
||||
decalModelTransform = part.FindModelTransform(decalModel);
|
||||
if (decalModelTransform == null) throw new FormatException($"Could not find decalModel transform: '{decalModel}'.");
|
||||
decalModelTransform = part.FindModelTransform(decalModel);
|
||||
if (decalModelTransform == null) throw new FormatException($"Could not find decalModel transform: '{decalModel}'.");
|
||||
|
||||
decalProjectorTransform = part.FindModelTransform(decalProjector);
|
||||
if (decalProjectorTransform == null) throw new FormatException($"Could not find decalProjector transform: '{decalProjector}'.");
|
||||
decalProjectorTransform = part.FindModelTransform(decalProjector);
|
||||
if (decalProjectorTransform == null) throw new FormatException($"Could not find decalProjector transform: '{decalProjector}'.");
|
||||
|
||||
decalColliderTransform = part.FindModelTransform(decalCollider);
|
||||
if (decalColliderTransform == null) throw new FormatException($"Could not find decalCollider transform: '{decalCollider}'.");
|
||||
decalColliderTransform = part.FindModelTransform(decalCollider);
|
||||
if (decalColliderTransform == null) throw new FormatException($"Could not find decalCollider transform: '{decalCollider}'.");
|
||||
|
||||
// SETUP BACK MATERIAL
|
||||
if (updateBackScale) {
|
||||
var backRenderer = decalBackTransform.GetComponent<MeshRenderer>();
|
||||
if (backRenderer == null) {
|
||||
this.LogError($"Specified decalBack transform {decalBack} has no renderer attached! Setting updateBackScale to false.");
|
||||
updateBackScale = false;
|
||||
}
|
||||
else {
|
||||
backMaterial = backRenderer.material;
|
||||
if (backMaterial == null) {
|
||||
this.LogError($"Specified decalBack transform {decalBack} has a renderer but no material! Setting updateBackScale to false.");
|
||||
// SETUP BACK MATERIAL
|
||||
if (updateBackScale) {
|
||||
var backRenderer = decalBackTransform.GetComponent<MeshRenderer>();
|
||||
if (backRenderer == null) {
|
||||
this.LogError($"Specified decalBack transform {decalBack} has no renderer attached! Setting updateBackScale to false.");
|
||||
updateBackScale = false;
|
||||
}
|
||||
else {
|
||||
if (backTextureBaseScale == default) backTextureBaseScale = backMaterial.GetTextureScale(PropertyIDs._MainTex);
|
||||
} else {
|
||||
backMaterial = backRenderer.material;
|
||||
if (backMaterial == null) {
|
||||
this.LogError($"Specified decalBack transform {decalBack} has a renderer but no material! Setting updateBackScale to false.");
|
||||
updateBackScale = false;
|
||||
} else {
|
||||
if (backTextureBaseScale == default) backTextureBaseScale = backMaterial.GetTextureScale(PropertyIDs._MainTex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -428,8 +423,7 @@ namespace ConformalDecals {
|
||||
|
||||
if (tileRect.x >= 0) {
|
||||
materialProperties.UpdateTile(tileRect);
|
||||
}
|
||||
else if (tileIndex >= 0) {
|
||||
} else if (tileIndex >= 0) {
|
||||
materialProperties.UpdateTile(tileIndex, tileSize);
|
||||
}
|
||||
}
|
||||
@ -443,8 +437,7 @@ namespace ConformalDecals {
|
||||
|
||||
if (HighLogic.LoadedSceneIsGame) {
|
||||
UpdateAll();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
scale = defaultScale;
|
||||
depth = defaultDepth;
|
||||
opacity = defaultOpacity;
|
||||
@ -537,25 +530,19 @@ namespace ConformalDecals {
|
||||
multiprojectEditor.onFieldChanged = OnProjectionTweakEvent;
|
||||
}
|
||||
|
||||
/// Updates textures, materials, scale and targets
|
||||
/// Updates materials, scale and targets
|
||||
protected virtual void UpdateAll() {
|
||||
UpdateTextures();
|
||||
UpdateMaterials();
|
||||
UpdateProjection();
|
||||
UpdateTargets();
|
||||
}
|
||||
|
||||
/// Update decal textures
|
||||
protected virtual void UpdateTextures() { }
|
||||
|
||||
/// Update decal materials
|
||||
protected virtual void UpdateMaterials() {
|
||||
_opacityProperty.value = opacity;
|
||||
_cutoffProperty.value = cutoff;
|
||||
_wearProperty.value = wear;
|
||||
|
||||
materialProperties.UpdateMaterials();
|
||||
materialProperties.SetOpacity(opacity);
|
||||
materialProperties.SetCutoff(cutoff);
|
||||
if (useBaseNormal) {
|
||||
materialProperties.SetWear(wear);
|
||||
}
|
||||
|
||||
_decalMaterial = materialProperties.DecalMaterial;
|
||||
_previewMaterial = materialProperties.PreviewMaterial;
|
||||
@ -599,15 +586,33 @@ namespace ConformalDecals {
|
||||
// update material scale
|
||||
materialProperties.UpdateScale(size);
|
||||
|
||||
decalProjectorTransform.localScale = new Vector3(size.x, size.y, depth);
|
||||
|
||||
if (_isAttached) {
|
||||
// update orthogonal matrix
|
||||
_orthoMatrix = Matrix4x4.identity;
|
||||
_orthoMatrix[0, 3] = 0.5f;
|
||||
_orthoMatrix[1, 3] = 0.5f;
|
||||
|
||||
decalProjectorTransform.localScale = new Vector3(size.x, size.y, depth);
|
||||
}
|
||||
else {
|
||||
var projectionBounds = _boundsRenderer.bounds;
|
||||
|
||||
// disable all targets
|
||||
foreach (var target in _targets.Values) {
|
||||
target.enabled = false;
|
||||
}
|
||||
|
||||
// collect list of potential targets
|
||||
IEnumerable<Part> targetParts;
|
||||
if (projectMultiple) {
|
||||
targetParts = HighLogic.LoadedSceneIsFlight ? part.vessel.parts : EditorLogic.fetch.ship.parts;
|
||||
} else {
|
||||
targetParts = new[] {part.parent};
|
||||
}
|
||||
|
||||
foreach (var targetPart in targetParts) {
|
||||
UpdatePartTarget(targetPart, projectionBounds);
|
||||
}
|
||||
} else {
|
||||
// rescale preview model
|
||||
decalModelTransform.localScale = new Vector3(size.x, size.y, (size.x + size.y) / 2);
|
||||
|
||||
@ -618,49 +623,20 @@ namespace ConformalDecals {
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when updating decal targets
|
||||
protected void UpdateTargets() {
|
||||
if (!_isAttached) return;
|
||||
var projectionBounds = _boundsRenderer.bounds;
|
||||
|
||||
// disable all targets
|
||||
foreach (var target in _targets.Values) {
|
||||
target.enabled = false;
|
||||
}
|
||||
|
||||
// collect list of potential targets
|
||||
IEnumerable<Part> targetParts;
|
||||
if (projectMultiple) {
|
||||
targetParts = HighLogic.LoadedSceneIsFlight ? part.vessel.parts : EditorLogic.fetch.ship.parts;
|
||||
}
|
||||
else {
|
||||
targetParts = new[] {part.parent};
|
||||
}
|
||||
|
||||
foreach (var targetPart in targetParts) {
|
||||
UpdatePartTarget(targetPart, projectionBounds);
|
||||
}
|
||||
}
|
||||
|
||||
protected void UpdatePartTarget(Part targetPart, Bounds projectionBounds) {
|
||||
if (targetPart.GetComponent<ModuleConformalDecal>() != null) return; // skip other decals
|
||||
|
||||
this.Log($"Updating projection onto part {targetPart.name}");
|
||||
|
||||
if (!_targets.TryGetValue(targetPart, out var target)) {
|
||||
var rendererList = targetPart.FindModelComponents<MeshRenderer>();
|
||||
|
||||
if (rendererList.Any(o => projectionBounds.Intersects(o.bounds))) {
|
||||
target = new ProjectionPartTarget(targetPart, useBaseNormal);
|
||||
_targets.Add(targetPart, target);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.Log($"valid target: {targetPart.name}");
|
||||
|
||||
target.Project(_orthoMatrix, decalProjectorTransform, projectionBounds);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
using ConformalDecals.MaterialProperties;
|
||||
using UniLinq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ConformalDecals {
|
||||
@ -10,8 +8,6 @@ namespace ConformalDecals {
|
||||
|
||||
[KSPField(isPersistant = true)] public bool useCustomFlag;
|
||||
|
||||
private MaterialTextureProperty _flagTextureProperty;
|
||||
|
||||
public string MissionFlagUrl {
|
||||
get {
|
||||
if (HighLogic.LoadedSceneIsEditor) {
|
||||
@ -22,75 +18,103 @@ namespace ConformalDecals {
|
||||
return string.IsNullOrEmpty(part.flagURL) ? HighLogic.CurrentGame.flagURL : part.flagURL;
|
||||
}
|
||||
|
||||
// If we are not in game, use the default flag (for icon rendering)
|
||||
return DefaultFlag;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStart(StartState state) {
|
||||
base.OnStart(state);
|
||||
|
||||
if (HighLogic.LoadedSceneIsGame) {
|
||||
GameEvents.onMissionFlagSelect.Add(OnEditorFlagSelected);
|
||||
}
|
||||
|
||||
if (HighLogic.LoadedSceneIsEditor) {
|
||||
Events[nameof(ResetFlag)].guiActiveEditor = useCustomFlag;
|
||||
// Register flag change event
|
||||
GameEvents.onMissionFlagSelect.Add(OnEditorFlagSelected);
|
||||
|
||||
// Register reset button event
|
||||
Events[nameof(ResetFlagButton)].guiActiveEditor = useCustomFlag;
|
||||
}
|
||||
|
||||
base.OnStart(state);
|
||||
}
|
||||
|
||||
public override void OnDestroy() {
|
||||
GameEvents.onMissionFlagSelect.Remove(OnEditorFlagSelected);
|
||||
if (HighLogic.LoadedSceneIsEditor) {
|
||||
// Unregister flag change event
|
||||
GameEvents.onMissionFlagSelect.Remove(OnEditorFlagSelected);
|
||||
}
|
||||
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
[KSPEvent(guiActive = false, guiActiveEditor = true, guiName = "#LOC_ConformalDecals_gui-select-flag")]
|
||||
public void SelectFlag() {
|
||||
var flagBrowser = (Instantiate((Object) (new FlagBrowserGUIButton(null, null, null, null)).FlagBrowserPrefab) as GameObject)?.GetComponent<FlagBrowser>();
|
||||
if (flagBrowser is { }) flagBrowser.OnFlagSelected = OnCustomFlagSelected;
|
||||
public void SelectFlagButton() {
|
||||
// Button for selecting a flag
|
||||
// This is a bit of a hack to bring up the stock flag selection menu
|
||||
// When its done, it calls OnCustomFlagSelected()
|
||||
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
var flagBrowser = (Instantiate((Object) (new FlagBrowserGUIButton(null, null, null, null)).FlagBrowserPrefab) as GameObject).GetComponent<FlagBrowser>();
|
||||
flagBrowser.OnFlagSelected = OnCustomFlagSelected;
|
||||
}
|
||||
|
||||
[KSPEvent(guiActive = false, guiActiveEditor = true, guiName = "#LOC_ConformalDecals_gui-reset-flag")]
|
||||
public void ResetFlag() {
|
||||
Events[nameof(ResetFlag)].guiActiveEditor = false;
|
||||
flagUrl = MissionFlagUrl;
|
||||
useCustomFlag = false;
|
||||
UpdateAll();
|
||||
foreach (var decal in part.symmetryCounterparts.Select(o => o.GetComponent<ModuleConformalFlag>())) {
|
||||
decal.Events[nameof(ResetFlag)].guiActiveEditor = false;
|
||||
decal.flagUrl = flagUrl;
|
||||
decal.useCustomFlag = false;
|
||||
decal.UpdateAll();
|
||||
}
|
||||
public void ResetFlagButton() {
|
||||
// we are no longer using a custom flag, so instead use the mission or agency flag
|
||||
SetFlag("Mission", false, true);
|
||||
|
||||
// disable the reset button, since it no longer makes sense
|
||||
Events[nameof(ResetFlagButton)].guiActiveEditor = false;
|
||||
}
|
||||
|
||||
private void OnCustomFlagSelected(FlagBrowser.FlagEntry newFlagEntry) {
|
||||
Events[nameof(ResetFlag)].guiActiveEditor = true;
|
||||
flagUrl = newFlagEntry.textureInfo.name;
|
||||
useCustomFlag = true;
|
||||
UpdateAll();
|
||||
// Callback for when a flag is selected in the menu spawned by SelectFlag()
|
||||
|
||||
foreach (var decal in part.symmetryCounterparts.Select(o => o.GetComponent<ModuleConformalFlag>())) {
|
||||
decal.Events[nameof(ResetFlag)].guiActiveEditor = true;
|
||||
decal.flagUrl = flagUrl;
|
||||
decal.useCustomFlag = true;
|
||||
decal.UpdateAll();
|
||||
}
|
||||
// we are now using a custom flag with the URL of the new flag entry
|
||||
SetFlag(newFlagEntry.textureInfo.name, true, true);
|
||||
|
||||
// make sure the reset button is now available
|
||||
Events[nameof(ResetFlagButton)].guiActiveEditor = true;
|
||||
}
|
||||
|
||||
private void OnEditorFlagSelected(string newFlagUrl) {
|
||||
if (!useCustomFlag) UpdateAll();
|
||||
// Callback for when a new mission flag is selected in the editor
|
||||
// Since this callback is called for all modules, we only need to update this module
|
||||
// Updating symmetry counterparts would be redundent
|
||||
|
||||
// if we are using the mission flag, update it. otherwise ignore the call
|
||||
if (!useCustomFlag) {
|
||||
SetFlag(newFlagUrl, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateTextures() {
|
||||
_flagTextureProperty ??= materialProperties.AddOrGetTextureProperty("_Decal", true);
|
||||
private void SetFlag(string newFlagUrl, bool isCustom, bool recursive) {
|
||||
// Function to set the flag URL, the custom flag
|
||||
|
||||
// Set values
|
||||
flagUrl = newFlagUrl;
|
||||
useCustomFlag = isCustom;
|
||||
|
||||
// Update material and projection
|
||||
UpdateAll();
|
||||
|
||||
// Update symmetry counterparts if called to
|
||||
if (recursive) {
|
||||
foreach (var counterpart in part.symmetryCounterparts) {
|
||||
var decal = counterpart.GetComponent<ModuleConformalFlag>();
|
||||
decal.SetFlag(newFlagUrl, isCustom, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base.UpdateTextures();
|
||||
if (useCustomFlag) {
|
||||
_flagTextureProperty.TextureUrl = flagUrl;
|
||||
}
|
||||
else {
|
||||
_flagTextureProperty.TextureUrl = MissionFlagUrl;
|
||||
protected override void UpdateMaterials() {
|
||||
// get the decal material property for the decal texture
|
||||
var textureProperty = materialProperties.AddOrGetTextureProperty("_Decal", true);
|
||||
|
||||
if (useCustomFlag) { // set the texture to the custom flag
|
||||
textureProperty.TextureUrl = flagUrl;
|
||||
} else { // set the texture to the mission flag
|
||||
textureProperty.TextureUrl = MissionFlagUrl;
|
||||
}
|
||||
|
||||
base.UpdateMaterials();
|
||||
}
|
||||
}
|
||||
}
|
@ -29,8 +29,7 @@ namespace ConformalDecals {
|
||||
public void SetText() {
|
||||
if (_textEntryController == null) {
|
||||
_textEntryController = TextEntryController.Create(text, font, style, vertical, lineSpacing, charSpacing, lineSpacingRange, charSpacingRange, OnTextUpdate);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
_textEntryController.Close();
|
||||
}
|
||||
}
|
||||
@ -47,8 +46,7 @@ namespace ConformalDecals {
|
||||
public void SetFillColor() {
|
||||
if (_fillColorPickerController == null) {
|
||||
_fillColorPickerController = ColorPickerController.Create(fillColor, OnFillColorUpdate);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
_fillColorPickerController.Close();
|
||||
}
|
||||
}
|
||||
@ -70,8 +68,7 @@ namespace ConformalDecals {
|
||||
public void SetOutlineColor() {
|
||||
if (_outlineColorPickerController == null) {
|
||||
_outlineColorPickerController = ColorPickerController.Create(outlineColor, OnOutlineColorUpdate);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
_outlineColorPickerController.Close();
|
||||
}
|
||||
}
|
||||
@ -234,8 +231,7 @@ namespace ConformalDecals {
|
||||
string fontName = "";
|
||||
if (ParseUtil.ParseStringIndirect(ref fontName, node, "fontName")) {
|
||||
font = DecalConfig.GetFont(fontName);
|
||||
}
|
||||
else if (font == null) font = DecalConfig.GetFont("Calibri SDF");
|
||||
} else if (font == null) font = DecalConfig.GetFont("Calibri SDF");
|
||||
|
||||
int styleInt = 0;
|
||||
if (ParseUtil.ParseIntIndirect(ref styleInt, node, "style")) {
|
||||
@ -247,28 +243,11 @@ namespace ConformalDecals {
|
||||
}
|
||||
|
||||
protected override void SetupDecal() {
|
||||
if (HighLogic.LoadedSceneIsEditor) {
|
||||
// Update tweakables in editor mode
|
||||
UpdateTweakables();
|
||||
}
|
||||
|
||||
if (HighLogic.LoadedSceneIsGame) {
|
||||
// For some reason text rendering fails on the first frame of a scene, so this is my workaround
|
||||
StartCoroutine(UpdateTextLate());
|
||||
}
|
||||
else {
|
||||
scale = defaultScale;
|
||||
depth = defaultDepth;
|
||||
opacity = defaultOpacity;
|
||||
cutoff = defaultCutoff;
|
||||
wear = defaultWear;
|
||||
|
||||
UpdateTextures();
|
||||
UpdateMaterials();
|
||||
UpdateProjection();
|
||||
|
||||
// QUEUE PART FOR ICON FIXING IN VAB
|
||||
DecalIconFixer.QueuePart(part.name);
|
||||
} else {
|
||||
base.SetupDecal();
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,17 +256,20 @@ namespace ConformalDecals {
|
||||
UpdateAll();
|
||||
}
|
||||
|
||||
protected override void UpdateTextures() {
|
||||
protected override void UpdateMaterials() {
|
||||
// Render text
|
||||
var newText = new DecalText(text, font, style, vertical, lineSpacing, charSpacing);
|
||||
var output = TextRenderer.UpdateText(_currentText, newText);
|
||||
_currentText = newText;
|
||||
if (newText != _currentText) {
|
||||
var output = TextRenderer.UpdateText(_currentText, newText);
|
||||
|
||||
_decalTextureProperty.Texture = output.Texture;
|
||||
_decalTextureProperty.SetTile(output.Window);
|
||||
}
|
||||
// update the _currentText state variable
|
||||
// this is the ONLY place this variable should be set! otherwise the current state is lost
|
||||
_currentText = newText;
|
||||
|
||||
protected override void UpdateMaterials() {
|
||||
_decalTextureProperty.Texture = output.Texture;
|
||||
_decalTextureProperty.SetTile(output.Window);
|
||||
}
|
||||
|
||||
_fillEnabledProperty.value = fillEnabled;
|
||||
_fillColorProperty.color = fillColor;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace ConformalDecals {
|
||||
namespace ConformalDecals.Targets {
|
||||
public interface IProjectionTarget {
|
||||
bool Project(Matrix4x4 orthoMatrix, Transform projector, Bounds projectionBounds);
|
||||
void Render(Material decalMaterial, MaterialPropertyBlock partMPB, Camera camera);
|
@ -1,7 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace ConformalDecals {
|
||||
namespace ConformalDecals.Targets {
|
||||
public class ProjectionMeshTarget : IProjectionTarget {
|
||||
public const string NodeName = "MESH_TARGET";
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ConformalDecals {
|
||||
namespace ConformalDecals.Targets {
|
||||
public class ProjectionPartTarget : IProjectionTarget {
|
||||
public const string NodeName = "PART_TARGET";
|
||||
|
33
Source/ConformalDecals/Tweakables/TweakableData.cs
Normal file
33
Source/ConformalDecals/Tweakables/TweakableData.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using ConformalDecals.Util;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ConformalDecals.Tweakables {
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public abstract class TweakableData : System.Attribute, ISerializationCallbackReceiver {
|
||||
public string name;
|
||||
|
||||
public bool adjustable = true;
|
||||
public string adjustableKey;
|
||||
|
||||
// public string fieldChangedCallback;
|
||||
public bool useSymmetry = true;
|
||||
|
||||
protected TweakableData(string name) {
|
||||
this.name = name;
|
||||
adjustableKey = name + "Adjustable";
|
||||
}
|
||||
|
||||
public virtual void Load(ConfigNode node) {
|
||||
ParseUtil.ParseBoolIndirect(ref adjustable, node, adjustableKey);
|
||||
}
|
||||
|
||||
public virtual void Apply(BaseField baseField, PartModule module) {
|
||||
baseField.guiActiveEditor = adjustable;
|
||||
}
|
||||
|
||||
public void OnBeforeSerialize() { }
|
||||
|
||||
public void OnAfterDeserialize() { }
|
||||
}
|
||||
}
|
30
Source/ConformalDecals/Tweakables/TweakableDataCollection.cs
Normal file
30
Source/ConformalDecals/Tweakables/TweakableDataCollection.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UniLinq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ConformalDecals.Tweakables {
|
||||
public class TweakableDataCollection : IEnumerable<TweakableData>, ISerializationCallbackReceiver {
|
||||
public readonly Dictionary<string, TweakableData> tweakables = new Dictionary<string, TweakableData>();
|
||||
|
||||
[SerializeField] private TweakableData[] _serializedTweakables;
|
||||
|
||||
public IEnumerator<TweakableData> GetEnumerator() {
|
||||
return tweakables.Values.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() {
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public void OnBeforeSerialize() {
|
||||
_serializedTweakables = tweakables.Values.ToArray();
|
||||
}
|
||||
|
||||
public void OnAfterDeserialize() {
|
||||
foreach (var tweakable in _serializedTweakables) {
|
||||
tweakables.Add(tweakable.name, tweakable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
Source/ConformalDecals/Tweakables/TweakableSlider.cs
Normal file
56
Source/ConformalDecals/Tweakables/TweakableSlider.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using ConformalDecals.Util;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ConformalDecals.Tweakables {
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class TweakableSlider : TweakableData {
|
||||
// The default value for the slider
|
||||
public float defaultValue;
|
||||
public string defaultValueKey;
|
||||
|
||||
// The range of the slider as a vector of <min, max>
|
||||
public float min = 0;
|
||||
public float max = 1;
|
||||
public string rangeKey;
|
||||
|
||||
// The step size of the slider
|
||||
public float step;
|
||||
public string stepKey;
|
||||
|
||||
public TweakableSlider(string name) : base(name) {
|
||||
defaultValueKey = name + "Default";
|
||||
rangeKey = name + "Range";
|
||||
stepKey = name + "Step";
|
||||
}
|
||||
|
||||
public override void Load(ConfigNode node) {
|
||||
base.Load(node);
|
||||
|
||||
var range = new Vector2(min, max);
|
||||
ParseUtil.ParseVector2Indirect(ref range, node, rangeKey);
|
||||
min = Mathf.Max(Mathf.Epsilon, range.x);
|
||||
max = Mathf.Max(min, range.y);
|
||||
|
||||
ParseUtil.ParseFloatIndirect(ref step, node, stepKey);
|
||||
|
||||
if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) {
|
||||
ParseUtil.ParseFloatIndirect(ref defaultValue, node, defaultValueKey);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Apply(BaseField baseField, PartModule module) {
|
||||
base.Apply(baseField, module);
|
||||
var uiControlEditor = (UI_FloatRange) baseField.uiControlEditor;
|
||||
|
||||
uiControlEditor.minValue = min;
|
||||
uiControlEditor.maxValue = max;
|
||||
uiControlEditor.stepIncrement = step;
|
||||
|
||||
// Set the default value on first load
|
||||
if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) {
|
||||
baseField.FieldInfo.SetValue(module, defaultValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
34
Source/ConformalDecals/Tweakables/TweakableToggle.cs
Normal file
34
Source/ConformalDecals/Tweakables/TweakableToggle.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using ConformalDecals.Util;
|
||||
|
||||
namespace ConformalDecals.Tweakables {
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class TweakableToggle : TweakableData {
|
||||
// The default value for the toggle
|
||||
public bool defaultValue;
|
||||
public string defaultValueKey;
|
||||
|
||||
public TweakableToggle(string name) : base(name) {
|
||||
defaultValueKey = name + "Default";
|
||||
}
|
||||
|
||||
public override void Load(ConfigNode node) {
|
||||
base.Load(node);
|
||||
|
||||
// Set the default value on first load
|
||||
if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) {
|
||||
ParseUtil.ParseBoolIndirect(ref defaultValue, node, defaultValueKey);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Apply(BaseField baseField, PartModule module) {
|
||||
base.Apply(baseField, module);
|
||||
|
||||
// Set the default value on first load
|
||||
if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) {
|
||||
baseField.FieldInfo.SetValue(module, defaultValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UniLinq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ConformalDecals.Util {
|
||||
@ -32,7 +31,7 @@ namespace ConformalDecals.Util {
|
||||
|
||||
public static string ParseString(ConfigNode node, string valueName, bool isOptional = false, string defaultValue = "") {
|
||||
if (node.HasValue(valueName)) return node.GetValue(valueName);
|
||||
|
||||
|
||||
if (isOptional) {
|
||||
return defaultValue;
|
||||
}
|
||||
@ -121,7 +120,6 @@ namespace ConformalDecals.Util {
|
||||
|
||||
public static bool ParseMatrix4x4Indirect(ref Matrix4x4 value, ConfigNode node, string valueName) {
|
||||
return ParseValueIndirect(ref value, node, valueName, ParseUtil.TryParseMatrix4x4);
|
||||
|
||||
}
|
||||
|
||||
public static T ParseValue<T>(ConfigNode node, string valueName, TryParseDelegate<T> tryParse, bool isOptional = false, T defaultValue = default) {
|
||||
|
115
changelog.txt
115
changelog.txt
@ -1,115 +0,0 @@
|
||||
v0.2.7
|
||||
------
|
||||
- Supported KSP versions: 1.8.x to 1.11.x
|
||||
- Notes:
|
||||
- Attaching decal parts in flight using engineer kerbals is not supported.
|
||||
- Fixes:
|
||||
- Fixed certain non-ascii strings not rendering correctly under certain circumstances.
|
||||
- Yet another attempted fix for the planet text glitch.
|
||||
|
||||
v0.2.6
|
||||
------
|
||||
- Fixes:
|
||||
- Fixed stock flags appearing stretched by forcing their aspect ratio to be correct.
|
||||
- Another attempted fix for the planet text glitch.
|
||||
|
||||
v0.2.5
|
||||
------
|
||||
- Fixes:
|
||||
- Fixed line spacing, character spacing, and vertical settings not applying to symmetry counterparts
|
||||
|
||||
v0.2.4
|
||||
------
|
||||
- Fixes:
|
||||
- Fixed red text appearing on planets due to KSP bug by clearing render textures afterwards.
|
||||
- Fixed fonts not saving correctly.
|
||||
- Changes:
|
||||
- Lowered step size for decal size and depth to 1cm.
|
||||
- Changed default max size to 5m.
|
||||
- Changed default text decal size to 0.2m
|
||||
- Text decals now show as a circle if they contain only whitespace.
|
||||
|
||||
v0.2.3
|
||||
------
|
||||
- Fixes:
|
||||
- Fixed TMP subobjects being deleted, causing fallback fonts to fail in some situations.
|
||||
- Started using URL-style encoding for text decals behind the scenes to prevent issues with certain characters.
|
||||
- Fixed text decals having zero size when they had only whitespace or an empty string.
|
||||
- Fixed decals having drag and causing issues when using FAR.
|
||||
- Fixed broken saving of text decals in certain circumstances.
|
||||
|
||||
v0.2.2
|
||||
------
|
||||
- Fixes:
|
||||
- Fixed corrupted text rendering when a vessel loads during a scene change.
|
||||
|
||||
v0.2.1
|
||||
------
|
||||
- Changes:
|
||||
- Pressing enter in the text entry window now types a newline.
|
||||
- Fixes:
|
||||
- Renamed font assetbundle. The old extension was causing the game to try to load it twice on Windows due to legacy compatability features.
|
||||
- Fixed text rendering on DirectX resulting in black boxes by using ARGB32 instead of RG16 for the render texture in DirectX.
|
||||
|
||||
v0.2.0
|
||||
------
|
||||
- New Parts:
|
||||
- CDL-3 Surface Base Decal: A set of conformal decals based on the symbols from the movie Moon (2009) designed by Gavin Rothery
|
||||
- CDL-T Custom Text Decal: A customizable text decal with a variety of fonts
|
||||
- Changes:
|
||||
- New ModuleConformalText module for customizable text
|
||||
- Text, font, and style can all be customized, as well as text fill and outline colors and widths
|
||||
- Same projection and opacity options as other conformal decals
|
||||
- New StandardText decal shader supporting the text module
|
||||
- Unified all decal shaders into a single "StandardDecal" shader with variants supporting any combination of bump, specular and emissive maps, plus SDF alphas.
|
||||
- Old shaders are remapped to Standard shader plus keywords automatically.
|
||||
- New SDF-based antialiasing for when decals extend to their borders, e.g. on opaque flags.
|
||||
- New "KEYWORD" material modifier, allowing for shader features to be enabled and disabled.
|
||||
- Material modifiers can now be removed in variants by setting `remove = true` inside them.
|
||||
- Fixes:
|
||||
- Fixed WIDTH and HEIGHT scale modes being flipped
|
||||
- Removed some debug log statements
|
||||
- Dependencies:
|
||||
- Updated ModuleManager to version 4.1.4
|
||||
|
||||
v0.1.4
|
||||
------
|
||||
- Supported KSP versions: 1.8.x to 1.10.x
|
||||
- Fixes:
|
||||
- Fixed decals rendering onto disabled B9PS part variants
|
||||
- Decals will still not update whan their parent part's B9PS variant is changed, both in flight and in the editor. This is known and awaiting a change to B9PS to be fixed.
|
||||
- Fixed decal bounds rendering as dark cubes when shadowed by EVE clouds.
|
||||
- Fixed decals being shadowed by EVE clouds, causing the part underneath to appear overly dark.
|
||||
|
||||
v0.1.3
|
||||
------
|
||||
Fixes:
|
||||
- Fixed decals being able to be scaled down to 0
|
||||
|
||||
Changes:
|
||||
- Made decal bounds no longer collide in flight, this is done by repurposing layer 31 (which is configurable in the ConformalDecals.cfg file)
|
||||
- Decals will now be unselectable in flight by default. This can be disabled with the `selectableInFlight` value in ConformalDecals.cfg, or in the module config itself.
|
||||
- Decal parts will now destroy themselves automatically when the parent part is destroyed
|
||||
- Small refactor of node parsing code
|
||||
- Colors can now be specified in hex (#RGB, #RGBA, #RRGGBB, or #RRGGBBAA) or using the colors specified in the XKCDColors class
|
||||
|
||||
v0.1.2
|
||||
------
|
||||
Fixes:
|
||||
- Disabled writing to the zbuffer in the decal bounds shader. Should fix any issues with Scatterer or EVE.
|
||||
|
||||
v0.1.1
|
||||
------
|
||||
Fixes:
|
||||
- Fixed flag decal not adjusting to new texture sizes immediately.
|
||||
- Fixed decal bounds being visible on launch.
|
||||
- Fixed decal bounds being visible in the part icon.
|
||||
|
||||
v0.1.0
|
||||
------
|
||||
Initial release!
|
||||
|
||||
New parts:
|
||||
- CDL-F Flag Decal: Conformal flag decal, which uses either the mission flag or a flag of your choosing.
|
||||
- CDL-1 Generic Decal: A set of conformal generic decals for planes and rockets
|
||||
- CDL-2 Semiotic Standard Decal: A set of conformal decals based on the Semiotic Standard for All Commercial Trans-Stellar Utility Lifter and Transport Spacecraft designed by Ron Cobb for the movie Alien
|
Reference in New Issue
Block a user