I dont even know what happened -_-

This commit is contained in:
2021-12-13 22:14:55 +05:30
parent 3560ff1ef7
commit 2b318387cf
333 changed files with 163323 additions and 37740 deletions

View File

@@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using EasyButtons;
public class BulkMeshBoneSwapper : MonoBehaviour
{
public Transform srcRootBone;
[Button]
void Recalculate()
{
SkinnedMeshRenderer[] meshes = GetComponentsInChildren<SkinnedMeshRenderer>();
for (int x = 0; x < meshes.Length; x++)
{
if(meshes[x]==null){Debug.Log("Ignoring null object : " + meshes[x].name);continue;}
// meshes[x].rootBone = srcRootBone;
//target.bones = src.bones;
Transform[] bonesT = new Transform[meshes[x].bones.Length];
for (int i = 0; i < meshes[x].bones.Length; i++)
{
Transform targetBone = meshes[x].bones[i];
if(targetBone==null){continue;}
string targetBoneName = targetBone.name;
foreach (Transform sourceBone in srcRootBone.GetComponentsInChildren<Transform>())
{
if (targetBoneName == sourceBone.name)
{
Debug.Log("Switching bone : " + targetBoneName);
bonesT[i] = sourceBone;
break;
}
}
}
meshes[x].bones = bonesT;
if(meshes[x].sharedMesh==null){Debug.Log("Ignoring null mesh : " + meshes[x].name);continue;}
//meshes[x].sharedMesh.RecalculateNormals();
//meshes[x].sharedMesh.RecalculateBounds();
}
}
}

View File

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

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Data", menuName = "ScriptableObjects/CharacterPreset", order = 1)]
public class Characters : ScriptableObject
{
[SerializeField]
public CharacterPreset[] characters;
}
[Serializable]
public class CharacterPreset
{
public string name ;
public int characterId ;
}
[Serializable]
public class CharacterObjects
{
[SerializeField]public string name ;
public int id;
public GameObject[] body;
public GameObject[] hair;
public GameObject[] eyeWears;
public GameObject[] tops;
public GameObject[] gloves;
public GameObject[] bottoms;
public GameObject[] shoes;
public CharacterObjects(int _id,string _characterName){
id=_id;
name = _characterName;
}
}

View File

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

View File

@@ -0,0 +1,46 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class EnumSelect : MonoBehaviour
{
public EventTrigger prevBtn;
public EventTrigger nextBtn;
public Text label;
public string[] choices;
public int curIndex;
public string value => choices[curIndex];
public UnityEvent OnValueChanged;
void Start()
{
update();
EventTrigger.Entry entry = new EventTrigger.Entry();
entry.eventID = EventTriggerType.PointerDown;
entry.callback.AddListener(OnSelectNext);
nextBtn.triggers.Add(entry);
EventTrigger.Entry entry2 = new EventTrigger.Entry();
entry2.eventID = EventTriggerType.PointerDown;
entry2.callback.AddListener(OnSelectPrev);
prevBtn.triggers.Add(entry2);
}
void OnSelectNext(BaseEventData e){
curIndex = (curIndex < choices.Length-1) ? curIndex+1 : 0;
update();
}
void OnSelectPrev(BaseEventData e){
curIndex = (curIndex > 0) ? curIndex-1 : choices.Length;
update();
}
void update(){
label.text = choices[curIndex];
}
}

View File

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

View File

@@ -5,11 +5,32 @@ using EasyButtons;
public class MeshCombine : MonoBehaviour
{
public SkinnedMeshRenderer target;
public SkinnedMeshRenderer src;
public Transform sourceRootBone;
public Transform[] bones;
[Button]
void Recalculate(){
target.rootBone = src.rootBone;
target.bones = src.bones;
target.rootBone = sourceRootBone;
//target.bones = src.bones;
Transform[] bonesT = new Transform[target.bones.Length];
for(int i = 0; i < target.bones.Length; i++){
Transform targetBone = target.bones[i];
string targetBoneName = targetBone.name;
foreach(Transform sourceBone in sourceRootBone.GetComponentsInChildren<Transform>()){
if(targetBoneName == sourceBone.name){
Debug.Log("Switching bone : " + targetBoneName );
bonesT[i] = sourceBone;
break;
}
}
}
target.bones= bonesT;
bones= target.bones;
target.sharedMesh.RecalculateNormals();
target.sharedMesh.RecalculateBounds();
}
[Button]
void GetSelfRenderer(){
target = GetComponent<SkinnedMeshRenderer>();
}
}