diff --git "a/.github/ISSUE_TEMPLATE/bug-report---bug\345\217\215\351\246\210.md" "b/.github/ISSUE_TEMPLATE/bug-report---bug\345\217\215\351\246\210.md" deleted file mode 100644 index 74c38e2..0000000 --- "a/.github/ISSUE_TEMPLATE/bug-report---bug\345\217\215\351\246\210.md" +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: Bug report / Bug反馈 -about: Create a report to help us improve -title: '' -labels: bug -assignees: '' - ---- - -**Describe the bug / 描述你遇到的Bug** -A clear and concise description of what the bug is. / 清晰描述你遇到的问题。 - -**To Reproduce / 复现步骤** -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Screenshots / 截图** - - -**Unity Version / Unity版本** - - 2021.3.29 diff --git a/.github/workflows/auto_gen_toc.yml b/.github/workflows/auto_gen_toc.yml deleted file mode 100644 index ef2ca6a..0000000 --- a/.github/workflows/auto_gen_toc.yml +++ /dev/null @@ -1,25 +0,0 @@ -on: - push: - paths: ['README.md', 'README_CN.md'] - pull_request: - paths: ['README.md', 'README_CN.md'] - -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v2 - - run: | - curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc - chmod a+x gh-md-toc - ./gh-md-toc --insert --no-backup --hide-footer README.md - rm -f ./gh-md-toc - - run: | - curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc - chmod a+x gh-md-toc - ./gh-md-toc --insert --no-backup --hide-footer README_CN.md - rm -f ./gh-md-toc - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Auto update markdown TOC diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..39a192d --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,9 @@ +name: Publish on Tag +on: + release: + types: [published] +jobs: + call-publish: + if: github.actor != 'perotoolsbot[bot]' + uses: peroperogames/ToolsWorkflow/.github/workflows/publish-npm.yml@main + secrets: inherit diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml new file mode 100644 index 0000000..c7881be --- /dev/null +++ b/.github/workflows/review.yml @@ -0,0 +1,13 @@ +name: AI Code Review +on: + pull_request: + types: [opened, synchronize, reopened, closed] + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] +jobs: + review: + if: github.actor != 'perotoolsbot[bot]' + uses: peroperogames/ToolsWorkflow/.github/workflows/code-review.yml@main + secrets: inherit diff --git a/Editor/Helper/PresetHelper.cs b/Editor/Helper/PresetHelper.cs index 1d69378..4d3ce63 100644 --- a/Editor/Helper/PresetHelper.cs +++ b/Editor/Helper/PresetHelper.cs @@ -1,4 +1,5 @@ // Copyright (c) Jason Ma +using System; using System.Collections.Generic; using UnityEditor; using UnityEngine; @@ -9,10 +10,20 @@ public class PresetHelper { private static Dictionary _loadedPresets = new Dictionary(); + private static readonly string _domainKey = "ShaderPropertyPresetStorageDomainHash"; private static bool _isInitComplete; public static bool IsInitComplete { get { return _isInitComplete; } } + [InitializeOnLoadMethod] + private static void StorageDomainHash() + { + EditorApplication.delayCall += () => + { + SessionState.SetString(_domainKey, AppDomain.CurrentDomain.GetHashCode().ToString()); + }; + } + public static void Init() { if (!_isInitComplete) @@ -52,6 +63,14 @@ public static LwguiShaderPropertyPreset GetPresetAsset(string presetFileName) if (string.IsNullOrEmpty(presetFileName)) return null; + // 在某些域下,静态变量的缓存会有问题,而且无法找到Packages下的Preset,所以忽略 + var domainHash = AppDomain.CurrentDomain.GetHashCode().ToString(); + var expectedDomainHash = SessionState.GetString(_domainKey, string.Empty); + if (string.IsNullOrEmpty(expectedDomainHash) || !domainHash.Equals(expectedDomainHash)) + { + return null; + } + if (!_loadedPresets.ContainsKey(presetFileName) || !_loadedPresets[presetFileName]) ForceInit(); diff --git a/ShaderPropertyPreset.meta b/ShaderPropertyPreset.meta new file mode 100644 index 0000000..2ec1861 --- /dev/null +++ b/ShaderPropertyPreset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2732ce7ca2f09b440957af5191383873 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ShaderPropertyPreset/SPP_BlendModePreset.asset b/ShaderPropertyPreset/SPP_BlendModePreset.asset new file mode 100644 index 0000000..dc6a903 --- /dev/null +++ b/ShaderPropertyPreset/SPP_BlendModePreset.asset @@ -0,0 +1,239 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 28fbcbca3fb14507af6ed5c104c40b84, type: 3} + m_Name: SPP_BlendModePreset + m_EditorClassIdentifier: + presets: + - presetName: "\u9ED8\u8BA4" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 10 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _BlendOp + propertyType: 2 + floatValue: 0 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u7C7B\u6EE4\u955C" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 5 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _BlendOp + propertyType: 2 + floatValue: 0 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u7C7B\u6B63\u7247\u53E0\u5E95" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 2 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 10 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _BlendOp + propertyType: 2 + floatValue: 0 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u7C7B\u7EBF\u6027\u51CF\u6DE1" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _BlendOp + propertyType: 2 + floatValue: 0 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u7C7B\u53D8\u6697" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _BlendOp + propertyType: 2 + floatValue: 3 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u7C7B\u53D8\u4EAE" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _BlendOp + propertyType: 2 + floatValue: 4 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u51CF\u6CD5" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _BlendOp + propertyType: 2 + floatValue: 2 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u666E\u901A\u900F\u660E" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 5 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 10 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _BlendOp + propertyType: 2 + floatValue: 0 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 diff --git a/ShaderPropertyPreset/SPP_BlendModePreset.asset.meta b/ShaderPropertyPreset/SPP_BlendModePreset.asset.meta new file mode 100644 index 0000000..ee74f9b --- /dev/null +++ b/ShaderPropertyPreset/SPP_BlendModePreset.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5b41b4ebdbdd1184190dcba90721c4ee +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/ShaderPropertyPreset/SPP_CullSwitch.asset b/ShaderPropertyPreset/SPP_CullSwitch.asset new file mode 100644 index 0000000..c8e3d0a --- /dev/null +++ b/ShaderPropertyPreset/SPP_CullSwitch.asset @@ -0,0 +1,57 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 28fbcbca3fb14507af6ed5c104c40b84, type: 3} + m_Name: SPP_CullSwitch + m_EditorClassIdentifier: + presets: + - presetName: "\u53CC\u9762\u663E\u793A" + propertyValues: + - propertyName: _CullMode + propertyType: 2 + floatValue: 0 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u5254\u9664\u6B63\u9762" + propertyValues: + - propertyName: _CullMode + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u5254\u9664\u80CC\u9762" + propertyValues: + - propertyName: _CullMode + propertyType: 2 + floatValue: 2 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 diff --git a/ShaderPropertyPreset/SPP_CullSwitch.asset.meta b/ShaderPropertyPreset/SPP_CullSwitch.asset.meta new file mode 100644 index 0000000..cc12528 --- /dev/null +++ b/ShaderPropertyPreset/SPP_CullSwitch.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e534d436ce9ff7240989972adea26bd8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/ShaderPropertyPreset/SPP_SpineBlendModePreset.asset b/ShaderPropertyPreset/SPP_SpineBlendModePreset.asset new file mode 100644 index 0000000..2de9caf --- /dev/null +++ b/ShaderPropertyPreset/SPP_SpineBlendModePreset.asset @@ -0,0 +1,120 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 28fbcbca3fb14507af6ed5c104c40b84, type: 3} + m_Name: SPP_SpineBlendModePreset + m_EditorClassIdentifier: + presets: + - presetName: "\u9ED8\u8BA4" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 10 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _BlendOp + propertyType: 2 + floatValue: 0 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u76F8\u4E58" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 2 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 10 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _BlendOp + propertyType: 2 + floatValue: 0 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u76F8\u52A0" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _BlendOp + propertyType: 2 + floatValue: 0 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 + - presetName: "\u6EE4\u8272" + propertyValues: + - propertyName: _SrcBlend + propertyType: 2 + floatValue: 1 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + - propertyName: _DstBlend + propertyType: 2 + floatValue: 6 + intValue: 0 + colorValue: {r: 0, g: 0, b: 0, a: 0} + vectorValue: {x: 0, y: 0, z: 0, w: 0} + textureValue: {fileID: 0} + enabledKeywords: [] + disabledKeywords: [] + enabledPasses: [] + disabledPasses: [] + renderQueue: -1 diff --git a/ShaderPropertyPreset/SPP_SpineBlendModePreset.asset.meta b/ShaderPropertyPreset/SPP_SpineBlendModePreset.asset.meta new file mode 100644 index 0000000..2d68ef5 --- /dev/null +++ b/ShaderPropertyPreset/SPP_SpineBlendModePreset.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d832dd930aa360843b7e8da65dc85cd0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: