Initial Commit
This commit is contained in:
8
VRCProcessor/Editor.meta
Normal file
8
VRCProcessor/Editor.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 798fe290eaca0044a8c81780dc601bee
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
85
VRCProcessor/Editor/VRCProcessor.cs
Normal file
85
VRCProcessor/Editor/VRCProcessor.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Linq;
|
||||
|
||||
namespace DreadScripts.VRCProcessor
|
||||
{
|
||||
public class VRCProcessor : AssetPostprocessor
|
||||
{
|
||||
private static ModelImporter importer;
|
||||
private static bool willProcess;
|
||||
private static bool isHuman;
|
||||
private void OnPreprocessModel()
|
||||
{
|
||||
importer = assetImporter as ModelImporter;
|
||||
willProcess = isHuman = false;
|
||||
string guid = AssetDatabase.AssetPathToGUID(importer.assetPath);
|
||||
if (importer && !SessionState.GetBool(guid, false))
|
||||
{
|
||||
SessionState.SetBool(guid, true);
|
||||
willProcess = true;
|
||||
importer.isReadable = true;
|
||||
importer.importBlendShapeNormals = ModelImporterNormals.Import;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPostprocessMeshHierarchy(GameObject g)
|
||||
{
|
||||
if (willProcess && !isHuman)
|
||||
{
|
||||
|
||||
Transform[] allTransforms = g.GetComponentsInChildren<Transform>();
|
||||
if (allTransforms.Length < 15) return;
|
||||
|
||||
int hits = allTransforms.Count(t => t.name.IndexOf("Armature", System.StringComparison.OrdinalIgnoreCase) >= 0
|
||||
|| t.name.IndexOf("Hand", System.StringComparison.OrdinalIgnoreCase) >= 0
|
||||
|| t.name.IndexOf("Head", System.StringComparison.OrdinalIgnoreCase) >= 0);
|
||||
|
||||
if (hits >= 2)
|
||||
{
|
||||
importer.animationType = ModelImporterAnimationType.Human;
|
||||
isHuman = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPostprocessModel(GameObject g)
|
||||
{
|
||||
if (willProcess && isHuman)
|
||||
{
|
||||
var description = importer.humanDescription;
|
||||
var human = description.human.ToList();
|
||||
for (int i = human.Count - 1; i >= 0; i--)
|
||||
{
|
||||
switch (human[i].humanName)
|
||||
{
|
||||
case "Jaw" when human[i].boneName.IndexOf("jaw", System.StringComparison.OrdinalIgnoreCase) < 0:
|
||||
case "Upper Chest":
|
||||
human.RemoveAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
description.human = human.ToArray();
|
||||
importer.humanDescription = description;
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnPostprocessAllAssets(string[] ignored, string[] deletedAssets, string[] ignored2, string[] ignored3)
|
||||
{
|
||||
foreach (string s in deletedAssets)
|
||||
SessionState.EraseBool(AssetDatabase.AssetPathToGUID(s));
|
||||
}
|
||||
|
||||
|
||||
[UnityEditor.Callbacks.DidReloadScripts]
|
||||
private static void CollectExistingModels()
|
||||
{
|
||||
foreach (var g in AssetDatabase.FindAssets("t:model"))
|
||||
SessionState.SetBool(g, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
VRCProcessor/Editor/VRCProcessor.cs.meta
Normal file
11
VRCProcessor/Editor/VRCProcessor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28fcf192f7ea2804f894905f2c7eef40
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "com.dreadscripts.vrcprocessor.Editor",
|
||||
"references": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39834511362d90349b6f26e02d1856db
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
21
VRCProcessor/LICENSE
Normal file
21
VRCProcessor/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Dreadrith
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
7
VRCProcessor/LICENSE.meta
Normal file
7
VRCProcessor/LICENSE.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a645fb62fbc16a740bd762f167aa73cd
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
12
VRCProcessor/README.md
Normal file
12
VRCProcessor/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# VRCProcessor
|
||||
Automatically sets valid models to Humanoid and other usual settings upon import.
|
||||
|
||||
## Features
|
||||
- Sets Normals to import
|
||||
- Enables Read/Write
|
||||
- Sets Humanoid Rig for Humanoid models
|
||||
- Removes Upper Chest bone
|
||||
- Removes Jaw bone if invalid
|
||||
|
||||
### Thank you
|
||||
If you enjoy VRCProcessor, please consider [supporting me ♡](https://ko-fi.com/Dreadrith)!
|
7
VRCProcessor/README.md.meta
Normal file
7
VRCProcessor/README.md.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19dc3bb10c750f74bbbefa4050967433
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
17
VRCProcessor/package.json
Normal file
17
VRCProcessor/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "com.dreadscripts.vrcprocessor",
|
||||
"displayName": "DreadScripts - VRCProcessor",
|
||||
"version": "1.0.1",
|
||||
"description": "Automatically sets valid models to Humanoid and other usual settings upon import.",
|
||||
"gitDependencies": {},
|
||||
"vpmDependencies": {},
|
||||
"author": {
|
||||
"name": "Dreadrith",
|
||||
"email": "dreadscripts@gmail.com",
|
||||
"url": "https://www.dreadrith.com"
|
||||
},
|
||||
"legacyFolders": {},
|
||||
"legacyFiles": {},
|
||||
"type": "tool",
|
||||
"unity": "2019.4"
|
||||
}
|
7
VRCProcessor/package.json.meta
Normal file
7
VRCProcessor/package.json.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7129faa5e8587d408e73764f3b3a886
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user