Initial Commit

This commit is contained in:
jellejurre
2025-07-19 01:03:02 +02:00
commit e7904e3140
304 changed files with 22521 additions and 0 deletions

8
VRCProcessor/Editor.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 798fe290eaca0044a8c81780dc601bee
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28fcf192f7ea2804f894905f2c7eef40
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
{
"name": "com.dreadscripts.vrcprocessor.Editor",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 39834511362d90349b6f26e02d1856db
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

21
VRCProcessor/LICENSE Normal file
View 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.

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a645fb62fbc16a740bd762f167aa73cd
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

12
VRCProcessor/README.md Normal file
View 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)!

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 19dc3bb10c750f74bbbefa4050967433
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

17
VRCProcessor/package.json Normal file
View 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"
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b7129faa5e8587d408e73764f3b3a886
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: