mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Code refactor
This commit is contained in:
parent
e14a12f2ab
commit
af4dab5546
278 changed files with 468 additions and 668 deletions
130
Assets/Editor/FindMissingScriptsRecursively.cs
Normal file
130
Assets/Editor/FindMissingScriptsRecursively.cs
Normal file
|
@ -0,0 +1,130 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AndroidUltimatePlugin.Helpers.Editor
|
||||
{
|
||||
public class FindMissingScriptsRecursively : EditorWindow
|
||||
{
|
||||
static int _goCount = 0, _componentsCount = 0, _missingCount = 0;
|
||||
|
||||
[MenuItem("Window/FindMissingScriptsRecursively")]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
GetWindow(typeof(FindMissingScriptsRecursively));
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
if (GUILayout.Button("Find Missing Scripts in selected GameObjects"))
|
||||
{
|
||||
FindInSelected();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Find Missing Scripts"))
|
||||
{
|
||||
FindAll();
|
||||
}
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
{
|
||||
EditorGUILayout.LabelField("Component Scanned:");
|
||||
EditorGUILayout.LabelField("" + (_componentsCount == -1 ? "---" : _componentsCount.ToString()));
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
{
|
||||
EditorGUILayout.LabelField("Object Scanned:");
|
||||
EditorGUILayout.LabelField("" + (_goCount == -1 ? "---" : _goCount.ToString()));
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
{
|
||||
EditorGUILayout.LabelField("Possible Missing Scripts:");
|
||||
EditorGUILayout.LabelField("" + (_missingCount == -1 ? "---" : _missingCount.ToString()));
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
private static void FindAll()
|
||||
{
|
||||
_componentsCount = 0;
|
||||
_goCount = 0;
|
||||
_missingCount = 0;
|
||||
|
||||
string[] assetsPaths = AssetDatabase.GetAllAssetPaths();
|
||||
|
||||
foreach (string assetPath in assetsPaths)
|
||||
{
|
||||
Object[] data = LoadAllAssetsAtPath(assetPath);
|
||||
foreach (Object o in data)
|
||||
{
|
||||
if (o != null)
|
||||
{
|
||||
if (o is GameObject)
|
||||
{
|
||||
FindInGO((GameObject) o);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"Searched {_goCount} GameObjects, {_componentsCount} components, found {_missingCount} missing");
|
||||
}
|
||||
|
||||
public static Object[] LoadAllAssetsAtPath(string assetPath)
|
||||
{
|
||||
return typeof(SceneAsset).Equals(AssetDatabase.GetMainAssetTypeAtPath(assetPath))
|
||||
?
|
||||
// prevent error "Do not use readobjectthreaded on scene objects!"
|
||||
new[] {AssetDatabase.LoadMainAssetAtPath(assetPath)}
|
||||
: AssetDatabase.LoadAllAssetsAtPath(assetPath);
|
||||
}
|
||||
|
||||
private static void FindInSelected()
|
||||
{
|
||||
GameObject[] go = Selection.gameObjects;
|
||||
_goCount = 0;
|
||||
_componentsCount = 0;
|
||||
_missingCount = 0;
|
||||
foreach (GameObject g in go)
|
||||
{
|
||||
|
||||
FindInGO(g);
|
||||
}
|
||||
|
||||
Debug.Log($"Searched {_goCount} GameObjects, {_componentsCount} components, found {_missingCount} missing");
|
||||
}
|
||||
|
||||
private static void FindInGO(GameObject g)
|
||||
{
|
||||
_goCount++;
|
||||
Component[] components = g.GetComponents<Component>();
|
||||
for (int i = 0; i < components.Length; i++)
|
||||
{
|
||||
_componentsCount++;
|
||||
if (components[i] == null)
|
||||
{
|
||||
_missingCount++;
|
||||
string s = g.name;
|
||||
Transform t = g.transform;
|
||||
while (t.parent != null)
|
||||
{
|
||||
var parent = t.parent;
|
||||
s = parent.name + "/" + s;
|
||||
t = parent;
|
||||
}
|
||||
|
||||
Debug.Log(s + " has an empty script attached in position: " + i, g);
|
||||
}
|
||||
}
|
||||
|
||||
// Now recurse through each child GO (if there are any):
|
||||
foreach (Transform childT in g.transform)
|
||||
{
|
||||
//Debug.Log("Searching " + childT.name + " " );
|
||||
FindInGO(childT.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Editor/FindMissingScriptsRecursively.cs.meta
Normal file
11
Assets/Editor/FindMissingScriptsRecursively.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f991f27152653b841901199172a12809
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,344 +1,5 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &111030959124096607
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 523924871185930481}
|
||||
- component: {fileID: 3345967395353432914}
|
||||
- component: {fileID: 7181959437973434010}
|
||||
- component: {fileID: 8578366366517098866}
|
||||
- component: {fileID: 2696481706634536602}
|
||||
m_Layer: 0
|
||||
m_Name: ActorHandRight
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!4 &523924871185930481
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 111030959124096607}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7929422520673851209}
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &3345967395353432914
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 111030959124096607}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: -2115984483
|
||||
m_SortingLayer: 22
|
||||
m_SortingOrder: 3
|
||||
m_Sprite: {fileID: 21300000, guid: 68b94fce550ad52498142c9433df954b, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1.3837838, y: 1.3837838}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!60 &7181959437973434010
|
||||
PolygonCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 111030959124096607}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 1.0039216, y: 1.0039216}
|
||||
newSize: {x: 1.3837838, y: 1.3837838}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
m_Points:
|
||||
m_Paths:
|
||||
- - {x: -0.013513514, y: -0.035135135}
|
||||
- {x: 0.029729731, y: -0.029729731}
|
||||
- {x: 0.040540542, y: -0.0027027028}
|
||||
- {x: 0.045945946, y: 0.12162162}
|
||||
- {x: 0.013513514, y: 0.15945946}
|
||||
- {x: -0.024324324, y: 0.14864865}
|
||||
- {x: -0.040540542, y: 0.12162162}
|
||||
- {x: -0.024324324, y: -0.029729731}
|
||||
- - {x: -0.056756757, y: 0.008108108}
|
||||
- {x: -0.051351354, y: 0.072972976}
|
||||
- {x: -0.056756757, y: 0.029729731}
|
||||
- - {x: 0.056756757, y: 0.008108108}
|
||||
- {x: 0.056756757, y: 0.01891892}
|
||||
- - {x: 0.056756757, y: 0.07837838}
|
||||
- {x: 0.062162165, y: 0.1}
|
||||
- {x: 0.056756757, y: 0.089189194}
|
||||
--- !u!114 &8578366366517098866
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 111030959124096607}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8c55c83d4c4dd1145ad5fbbab3c3df36, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
AlphaTolerance: 50
|
||||
DistanceThreshold: 2
|
||||
Scale: 1
|
||||
Decompose: 0
|
||||
RunInPlayMode: 1
|
||||
UseCache: 0
|
||||
lastAlphaTolerance: 20
|
||||
lastScale: 1
|
||||
lastDistanceThreshold: 2
|
||||
lastDecompose: 0
|
||||
lastSprite: {fileID: 21300000, guid: 38c0bc38c0d71b04cb11a1eb610990e1, type: 3}
|
||||
lastRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 256
|
||||
height: 256
|
||||
lastOffset: {x: 128, y: 128}
|
||||
lastPixelsPerUnit: 185
|
||||
lastFlipX: 0
|
||||
lastFlipY: 0
|
||||
editorCache: []
|
||||
--- !u!114 &2696481706634536602
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 111030959124096607}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b23e33f312d52c642b86f5f2138f4030, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
bodyPartRenderer: {fileID: 3345967395353432914}
|
||||
parent: {fileID: -4411442180840688308}
|
||||
bodyPart: right hand
|
||||
--- !u!1 &2846713953308910856
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7268521810611446429}
|
||||
- component: {fileID: 4070361490379091543}
|
||||
- component: {fileID: 2766569757332877970}
|
||||
- component: {fileID: 1056544768350913866}
|
||||
- component: {fileID: 8546380208971044199}
|
||||
m_Layer: 0
|
||||
m_Name: ActorHandLeft
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!4 &7268521810611446429
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2846713953308910856}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7929422520673851209}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &4070361490379091543
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2846713953308910856}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: -2115984483
|
||||
m_SortingLayer: 22
|
||||
m_SortingOrder: 3
|
||||
m_Sprite: {fileID: 21300000, guid: 68b94fce550ad52498142c9433df954b, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1.3837838, y: 1.3837838}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!60 &2766569757332877970
|
||||
PolygonCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2846713953308910856}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 1.0039216, y: 1.0039216}
|
||||
newSize: {x: 1.3837838, y: 1.3837838}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
m_Points:
|
||||
m_Paths:
|
||||
- - {x: -0.013513514, y: -0.035135135}
|
||||
- {x: 0.035135135, y: -0.01891892}
|
||||
- {x: 0.040540542, y: 0.13243243}
|
||||
- {x: 0.01891892, y: 0.15405406}
|
||||
- {x: -0.013513514, y: 0.15405406}
|
||||
- {x: -0.035135135, y: 0.13243243}
|
||||
- {x: -0.024324324, y: -0.024324324}
|
||||
--- !u!114 &1056544768350913866
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2846713953308910856}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8c55c83d4c4dd1145ad5fbbab3c3df36, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
AlphaTolerance: 50
|
||||
DistanceThreshold: 2
|
||||
Scale: 1
|
||||
Decompose: 0
|
||||
RunInPlayMode: 1
|
||||
UseCache: 0
|
||||
lastAlphaTolerance: 50
|
||||
lastScale: 1
|
||||
lastDistanceThreshold: 2
|
||||
lastDecompose: 0
|
||||
lastSprite: {fileID: 21300000, guid: 38c0bc38c0d71b04cb11a1eb610990e1, type: 3}
|
||||
lastRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 256
|
||||
height: 256
|
||||
lastOffset: {x: 128, y: 128}
|
||||
lastPixelsPerUnit: 185
|
||||
lastFlipX: 0
|
||||
lastFlipY: 0
|
||||
editorCache: []
|
||||
--- !u!114 &8546380208971044199
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2846713953308910856}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b23e33f312d52c642b86f5f2138f4030, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
bodyPartRenderer: {fileID: 4070361490379091543}
|
||||
parent: {fileID: -4411442180840688308}
|
||||
bodyPart: left hand
|
||||
--- !u!1 &3158459618386162366
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -670,9 +331,6 @@ Transform:
|
|||
- {fileID: 7516402502875270591}
|
||||
- {fileID: 7929422519883802245}
|
||||
- {fileID: 4090857286061458930}
|
||||
- {fileID: 366978152691480472}
|
||||
- {fileID: 7268521810611446429}
|
||||
- {fileID: 523924871185930481}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -690,6 +348,8 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
actorID: 0
|
||||
bodyRenderer: {fileID: 5996161745621340017}
|
||||
actorBodyPartPrefab: {fileID: 6079743031150361545, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
--- !u!1 &9122292209377678227
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -864,114 +524,3 @@ MonoBehaviour:
|
|||
bodyPartRenderer: {fileID: 4251726083449519904}
|
||||
parent: {fileID: -4411442180840688308}
|
||||
bodyPart: appendage
|
||||
--- !u!1001 &8747398589072214225
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 7929422520673851209}
|
||||
m_Modifications:
|
||||
- target: {fileID: 2259458396607883071, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_Size.x
|
||||
value: 1.5058824
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2259458396607883071, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_Size.y
|
||||
value: 1.5058824
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2259458396607883071, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_Sprite
|
||||
value:
|
||||
objectReference: {fileID: 21300000, guid: c8db866783ad2a3498006437fd914bc4,
|
||||
type: 3}
|
||||
- target: {fileID: 2259458396607883071, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_WasSpriteAssigned
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3972152003096792844, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: ActorSexToy
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4800170110735377442, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_SpriteTilingProperty.newSize.x
|
||||
value: 1.5058824
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4800170110735377442, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_SpriteTilingProperty.newSize.y
|
||||
value: 1.5058824
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6079743031150361545, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: parent
|
||||
value:
|
||||
objectReference: {fileID: -4411442180840688308}
|
||||
- target: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: ffbd7531e8f98f94dba0fddefcae2441, type: 3}
|
||||
--- !u!4 &366978152691480472 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 8967445332558757705, guid: ffbd7531e8f98f94dba0fddefcae2441,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8747398589072214225}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
|
|
@ -14,7 +14,7 @@ GameObject:
|
|||
- component: {fileID: 2544842580858030677}
|
||||
- component: {fileID: 6079743031150361545}
|
||||
m_Layer: 0
|
||||
m_Name: ActorSexToy
|
||||
m_Name: ActorBodyPArt
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -173,4 +173,4 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
bodyPartRenderer: {fileID: 2259458396607883071}
|
||||
parent: {fileID: 0}
|
||||
bodyPart: dildo
|
||||
bodyPart:
|
||||
|
|
|
@ -1696,8 +1696,9 @@ RectTransform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1179107127}
|
||||
- {fileID: 681903173}
|
||||
m_Father: {fileID: 1552819969}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
|
@ -12633,14 +12634,14 @@ RectTransform:
|
|||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1552819969}
|
||||
m_Father: {fileID: 121643454}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 145.19, y: 0}
|
||||
m_SizeDelta: {x: 30, y: 30}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 5, y: 0}
|
||||
m_SizeDelta: {x: 25, y: 25}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!114 &681903174
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -17847,12 +17848,12 @@ RectTransform:
|
|||
- {fileID: 225041961}
|
||||
- {fileID: 593007063}
|
||||
m_Father: {fileID: 1216651060}
|
||||
m_RootOrder: 5
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -10, y: -60}
|
||||
m_SizeDelta: {x: 120, y: 30}
|
||||
m_AnchoredPosition: {x: -9, y: -60}
|
||||
m_SizeDelta: {x: 145, y: 30}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!114 &1001419736
|
||||
MonoBehaviour:
|
||||
|
@ -20173,8 +20174,8 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -7.5, y: -0.5}
|
||||
m_SizeDelta: {x: -35, y: -13}
|
||||
m_AnchoredPosition: {x: 5.13, y: -0.5}
|
||||
m_SizeDelta: {x: -60.255554, y: -13}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1151323894
|
||||
MonoBehaviour:
|
||||
|
@ -20298,7 +20299,7 @@ MonoBehaviour:
|
|||
m_TargetGraphic: {fileID: 922060210}
|
||||
m_HandleRect: {fileID: 922060209}
|
||||
m_Direction: 2
|
||||
m_Value: 0
|
||||
m_Value: 1
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
|
@ -21086,8 +21087,8 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 16.48, y: 0}
|
||||
m_SizeDelta: {x: -32.94964, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1179107128
|
||||
MonoBehaviour:
|
||||
|
@ -21115,7 +21116,7 @@ MonoBehaviour:
|
|||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_Alignment: 3
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
|
@ -21692,8 +21693,8 @@ RectTransform:
|
|||
- {fileID: 4300837137793644386}
|
||||
- {fileID: 4070467796814498374}
|
||||
- {fileID: 6085830301866471447}
|
||||
- {fileID: 1470937577}
|
||||
- {fileID: 1001419735}
|
||||
- {fileID: 1470937577}
|
||||
- {fileID: 935483303288600285}
|
||||
- {fileID: 1012383901}
|
||||
- {fileID: 11575766}
|
||||
|
@ -22461,7 +22462,7 @@ PrefabInstance:
|
|||
- target: {fileID: 7715503544296011585, guid: 8b89f6c9e5f696c4997760829c45a505,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 12
|
||||
value: 11
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7715503544296011585, guid: 8b89f6c9e5f696c4997760829c45a505,
|
||||
type: 3}
|
||||
|
@ -23039,7 +23040,7 @@ MonoBehaviour:
|
|||
m_GameObject: {fileID: 1289465653}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9b19816966eab6a4eba748f04532fb61, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 09b43781ddbab9c49b81b88c7a8b4076, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1293104865
|
||||
|
@ -27076,11 +27077,11 @@ RectTransform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1216651060}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -141, y: -63}
|
||||
m_AnchoredPosition: {x: -137, y: -63}
|
||||
m_SizeDelta: {x: 24, y: 24}
|
||||
m_Pivot: {x: 0.5, y: 1}
|
||||
--- !u!114 &1470937578
|
||||
|
@ -28694,7 +28695,6 @@ RectTransform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1190554011}
|
||||
- {fileID: 681903173}
|
||||
- {fileID: 121643454}
|
||||
m_Father: {fileID: 1257725762}
|
||||
m_RootOrder: 0
|
||||
|
@ -30103,18 +30103,7 @@ MonoBehaviour:
|
|||
m_CharacterLimit: 0
|
||||
m_OnEndEdit:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 629081417}
|
||||
m_MethodName: OnValueChanged
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
m_Calls: []
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ff71352a02fb53440a35dbeabb9ebc87
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -15,13 +15,12 @@ namespace RimWorldAnimationStudio
|
|||
public int? anchoringActor;
|
||||
public string anchorName;
|
||||
public string layer = "Pawn";
|
||||
public float? scale;
|
||||
public GraphicData graphicData;
|
||||
public bool? render;
|
||||
|
||||
// Data serialization control
|
||||
public bool ShouldSerializeanchorName() { return string.IsNullOrEmpty(anchorName) == false && anchorName.ToLower() != "none"; }
|
||||
public bool ShouldSerializeanchoringActor() { return anchoringActor.HasValue; }
|
||||
public bool ShouldSerializescale() { return scale.HasValue; }
|
||||
public bool ShouldSerializerender() { return render == true; }
|
||||
|
||||
// Data helper functions
|
||||
|
@ -49,10 +48,11 @@ namespace RimWorldAnimationStudio
|
|||
set { layer = value; }
|
||||
}
|
||||
|
||||
[XmlIgnore] public float Scale
|
||||
[XmlIgnore]
|
||||
public GraphicData GraphicData
|
||||
{
|
||||
get { return scale.HasValue ? scale.Value : 0f; }
|
||||
set { scale = value; }
|
||||
get { return graphicData; }
|
||||
set { graphicData = value; }
|
||||
}
|
||||
|
||||
[XmlIgnore] public bool Render
|
||||
|
@ -69,10 +69,10 @@ namespace RimWorldAnimationStudio
|
|||
// Constructors
|
||||
public ActorAddon() { }
|
||||
|
||||
public ActorAddon(string addonName, float scale = 1f)
|
||||
public ActorAddon(ActorAddonDef actorAddonDef)
|
||||
{
|
||||
this.AddonName = addonName;
|
||||
this.Scale = scale;
|
||||
this.AddonName = actorAddonDef.addonName;
|
||||
this.GraphicData = actorAddonDef.graphicData.Copy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,5 +11,7 @@ namespace RimWorldAnimationStudio
|
|||
public string addonName;
|
||||
public string label;
|
||||
public float scale = 1f;
|
||||
|
||||
public GraphicData graphicData;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,10 @@ namespace RimWorldAnimationStudio
|
|||
// Methods
|
||||
public void BuildSimpleCurves()
|
||||
{
|
||||
// Add addon data (if missing)
|
||||
foreach (ActorAddonDef actorAddonDef in ActorAddonDefs.allDefs)
|
||||
{ AddActorAddon(actorAddonDef); }
|
||||
|
||||
// Clear simple curve data
|
||||
BodyAngle.Clear();
|
||||
HeadAngle.Clear();
|
||||
|
@ -72,10 +76,6 @@ namespace RimWorldAnimationStudio
|
|||
HeadBob.Clear();
|
||||
GenitalAngle.Clear();
|
||||
|
||||
AddActorAddon("left hand", 0.667f);
|
||||
AddActorAddon("right hand", 0.667f);
|
||||
AddActorAddon("dildo");
|
||||
|
||||
foreach (ActorAddon addon in Addons)
|
||||
{
|
||||
addon.PosX.Clear();
|
||||
|
@ -83,7 +83,7 @@ namespace RimWorldAnimationStudio
|
|||
addon.Rotation.Clear();
|
||||
}
|
||||
|
||||
// Start
|
||||
// Start building simple curves
|
||||
int keyframePosition = 0;
|
||||
int duration = 0;
|
||||
|
||||
|
@ -151,17 +151,15 @@ namespace RimWorldAnimationStudio
|
|||
}
|
||||
}
|
||||
|
||||
public void AddActorAddon(string addonName, float scale = 1f)
|
||||
public void AddActorAddon(ActorAddonDef actorAddonDef)
|
||||
{
|
||||
if (Addons.Any(x => x.AddonName == addonName) == false)
|
||||
{
|
||||
Addons.Add(new ActorAddon(addonName, scale));
|
||||
}
|
||||
if (Addons.Any(x => x.AddonName == actorAddonDef.addonName) == false)
|
||||
{ Addons.Add(new ActorAddon(actorAddonDef)); }
|
||||
|
||||
foreach (PawnKeyframe keyframe in Keyframes)
|
||||
{
|
||||
if (keyframe.AddonKeyframes.Any(x => x.AddonName == addonName) == false)
|
||||
{ keyframe.AddonKeyframes.Add(new AddonKeyframe(addonName)); }
|
||||
if (keyframe.AddonKeyframes.Any(x => x.AddonName == actorAddonDef.addonName) == false)
|
||||
{ keyframe.AddonKeyframes.Add(new AddonKeyframe(actorAddonDef.addonName)); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public int actorID;
|
||||
public SpriteRenderer bodyRenderer;
|
||||
public ActorBodyPart actorBodyPartPrefab;
|
||||
|
||||
private Vector3 dragDelta = new Vector3();
|
||||
|
||||
|
@ -20,6 +21,12 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
if (Workspace.ActorID == actorID)
|
||||
{ Activate(); }
|
||||
|
||||
foreach (ActorAddonDef actorAddonDef in ActorAddonDefs.allDefs)
|
||||
{
|
||||
ActorBodyPart actorBodyPart = Instantiate(actorBodyPartPrefab, transform);
|
||||
actorBodyPart.Initialize(this, actorAddonDef);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnActorBodySelected(ActorBody actorBody)
|
||||
|
|
|
@ -14,8 +14,10 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
private Vector3 dragDelta = new Vector3();
|
||||
|
||||
public void Start()
|
||||
private void Start()
|
||||
{
|
||||
if (parent == null) return;
|
||||
|
||||
EventsManager.onActorBodyPartSelected.AddListener(delegate (ActorBodyPart bodyPart) { OnActorBodyPartSelected(bodyPart); });
|
||||
EventsManager.onActorBodySelected.AddListener(delegate (ActorBody actorBody) { OnActorBodySelected(actorBody); });
|
||||
|
||||
|
@ -23,6 +25,17 @@ namespace RimWorldAnimationStudio
|
|||
{ parent.Activate(); }
|
||||
}
|
||||
|
||||
public void Initialize(ActorBody parent, ActorAddonDef actorAddonDef)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.bodyPart = actorAddonDef.addonName;
|
||||
|
||||
bodyPartRenderer.sprite = actorAddonDef.graphicData.GetSprite();
|
||||
bodyPartRenderer.transform.localScale = (Vector3)actorAddonDef.graphicData.GetDrawSize();
|
||||
|
||||
Start();
|
||||
}
|
||||
|
||||
public void OnActorAddonChange(ActorAddon actorAddon)
|
||||
{
|
||||
if (actorAddon.AddonName == bodyPart)
|
||||
|
|
|
@ -52,6 +52,8 @@ namespace RimWorldAnimationStudio
|
|||
layerDropdown.SetValueWithoutNotify(layerDropdown.options.IndexOf(layerDropdown.options.First(x => x.text == clip.GetActorAddon(addonName).Layer)));
|
||||
anchoringPawnField.SetTextWithoutNotify(clip.GetActorAddon(addonName).AnchoringActor.ToString());
|
||||
toggle.SetIsOnWithoutNotify(clip.IsActorAddonVisible(addonName));
|
||||
|
||||
anchoringPawnField.interactable = anchorDropdown.value != 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 96cc86ae315a7c34c91b9af2499fa23c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9b19816966eab6a4eba748f04532fb61
|
||||
guid: 09b43781ddbab9c49b81b88c7a8b4076
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
60
Assets/Scripts/Graphics/GraphicData.cs
Normal file
60
Assets/Scripts/Graphics/GraphicData.cs
Normal file
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
[Serializable]
|
||||
public class GraphicData
|
||||
{
|
||||
public string texPath;
|
||||
public string graphicClass;
|
||||
public string shaderType;
|
||||
public string drawSize;
|
||||
|
||||
private Sprite sprite;
|
||||
|
||||
public void SetDrawSize(Vector2 drawSize)
|
||||
{
|
||||
this.drawSize = "(" + drawSize.x + ", " + drawSize.y + ")";
|
||||
}
|
||||
|
||||
public Vector3 GetDrawSize()
|
||||
{
|
||||
string drawSizeString = drawSize;
|
||||
|
||||
drawSizeString = drawSizeString.Trim();
|
||||
drawSizeString = drawSizeString.Replace("(", "");
|
||||
drawSizeString = drawSizeString.Replace(")", "");
|
||||
var drawSizeStrings = drawSizeString.Split(',');
|
||||
|
||||
return new Vector3(float.Parse(drawSizeStrings[0]), float.Parse(drawSizeStrings[1]));
|
||||
}
|
||||
|
||||
public Sprite GetSprite()
|
||||
{
|
||||
if (sprite != null) return sprite;
|
||||
|
||||
if (string.IsNullOrEmpty(texPath)) return null;
|
||||
|
||||
string fullPath = Path.GetFullPath(Path.Combine(Application.streamingAssetsPath, texPath)) + ".png";
|
||||
|
||||
if (File.Exists(fullPath) == false) return null;
|
||||
|
||||
byte[] pngBytes = File.ReadAllBytes(fullPath);
|
||||
|
||||
Texture2D texture = new Texture2D(2, 2);
|
||||
texture.LoadImage(pngBytes);
|
||||
|
||||
float scale = Mathf.Min(texture.width, texture.height) / 128f;
|
||||
sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 85.0f * scale);
|
||||
|
||||
return sprite;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Graphics/GraphicData.cs.meta
Normal file
11
Assets/Scripts/Graphics/GraphicData.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6e8b46532a4e0ce42b40b1a1fd03935a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
@ -45,7 +45,7 @@ TextureImporter:
|
|||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 510
|
||||
spritePixelsToUnits: 85
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e8128ddbd38f5c441b417b0318819eca
|
||||
guid: 43f10c9566894a04d9e5774d580927d2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
@ -45,7 +45,7 @@ TextureImporter:
|
|||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 170
|
||||
spritePixelsToUnits: 85
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
|
@ -4,19 +4,35 @@
|
|||
<ActorAddonDef>
|
||||
<addonName>left hand</addonName>
|
||||
<label>Hand (left)</label>
|
||||
<scale>0.6667</scale>
|
||||
<graphicData>
|
||||
<texPath>Textures/Humanlike/Hands/HandClean</texPath>
|
||||
<graphicClass>Graphic_Single</graphicClass>
|
||||
<shaderType>Cutout</shaderType>
|
||||
<drawSize>(0.6,0.6)</drawSize>
|
||||
</graphicData>
|
||||
|
||||
</ActorAddonDef>
|
||||
|
||||
<ActorAddonDef>
|
||||
<addonName>right hand</addonName>
|
||||
<label>Hand (right)</label>
|
||||
<scale>0.6667</scale>
|
||||
<graphicData>
|
||||
<texPath>Textures/Humanlike/Hands/HandClean</texPath>
|
||||
<graphicClass>Graphic_Single</graphicClass>
|
||||
<shaderType>Cutout</shaderType>
|
||||
<drawSize>(0.6,0.6)</drawSize>
|
||||
</graphicData>
|
||||
</ActorAddonDef>
|
||||
|
||||
<ActorAddonDef>
|
||||
<addonName>dildo</addonName>
|
||||
<label>Sex toy</label>
|
||||
<scale>1</scale>
|
||||
<graphicData>
|
||||
<texPath>Textures/SexToys/Dildo</texPath>
|
||||
<graphicClass>Graphic_Single</graphicClass>
|
||||
<shaderType>Cutout</shaderType>
|
||||
<drawSize>(1,1)</drawSize>
|
||||
</graphicData>
|
||||
</ActorAddonDef>
|
||||
|
||||
</ArrayOfActorAddonDef>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue