Netcode Bootstrap

This commit is contained in:
Luis Gonzalez
2026-05-31 14:27:52 -07:00
parent 99d8d2d2a9
commit 7fa77ce821
1813 changed files with 2921554 additions and 84 deletions
@@ -0,0 +1,7 @@
# Rukhanka Animation System
* Documentation: [https://docs.rukhanka.com](https://docs.rukhanka.com)
* Youtube channel: [https://www.youtube.com/@rukhankaanimation](https://www.youtube.com/@rukhankaanimation)
* Discord Support Server: [https://discord.gg/AwzFjWdHfq](https://discord.com/invite/utdMamGbR8)
* Support e-mail: [support@rukhanka.com](mailto:support@rukhanka.com)
@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 45e49eed75d9d7f47b605c85d225c6e5
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/README.md
uploadId: 897522
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b0ae226541db4914a81bcc1588700ea7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,974 @@
using System;
using System.Runtime.InteropServices.ComTypes;
using Rukhanka.Toolbox;
using Unity.Burst;
using Unity.Mathematics;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using UnityEngine;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace Rukhanka.DebugDrawer
{
[BurstCompile]
public struct Drawer: IComponentData
{
[NativeDisableParallelForRestriction]
internal NativeArray<DrawerManagedSingleton.LineData> lineData;
[NativeDisableParallelForRestriction]
internal NativeArray<DrawerManagedSingleton.TriangleData> triData;
[NativeDisableParallelForRestriction]
internal NativeArray<DrawerManagedSingleton.ThickLineData> thickLineData;
[NativeDisableParallelForRestriction]
internal NativeArray<DrawerManagedSingleton.BoneData> boneData;
[NativeDisableUnsafePtrRestriction]
internal UnsafeAtomicCounter32 lineCounter;
[NativeDisableUnsafePtrRestriction]
internal UnsafeAtomicCounter32 triCounter;
[NativeDisableUnsafePtrRestriction]
internal UnsafeAtomicCounter32 thickLineCounter;
[NativeDisableUnsafePtrRestriction]
internal UnsafeAtomicCounter32 boneMeshCounter;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public static Drawer Create(DrawerManagedSingleton ds)
{
var rv = new Drawer()
{
lineCounter = ds.linesBuf.counterAtomic,
lineData = ds.lineData,
triCounter = ds.trianglesBuf.counterAtomic,
triData = ds.triData,
thickLineCounter = ds.thickLinesBuf.counterAtomic,
thickLineData = ds.thickLineData,
boneMeshCounter = ds.bonesBuf.counterAtomic,
boneData = ds.boneData
};
return rv;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int GetTriangleWriteIndex(int numTrianglesToDraw) => GetWriteIndex(numTrianglesToDraw, triCounter, triData.Length);
int GetLineWriteIndex(int numLinesToDraw) => GetWriteIndex(numLinesToDraw, lineCounter, lineData.Length);
int GetThickLineWriteIndex(int numLinesToDraw) => GetWriteIndex(numLinesToDraw, thickLineCounter, thickLineData.Length);
int GetBoneMeshWriteIndex(int numBonesToDraw) => GetWriteIndex(numBonesToDraw, boneMeshCounter, boneData.Length);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int GetWriteIndex(int numPrimitivesToDraw, UnsafeAtomicCounter32 counter, int maxCount)
{
var writeIndex = counter.Add(numPrimitivesToDraw);
if (writeIndex + numPrimitivesToDraw >= maxCount)
return -1;
return writeIndex;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawThickLine(float3 p0, float3 p1, uint color, float thickness)
{
// Make line as two triangles
var writeIndex = GetThickLineWriteIndex(1);
if (writeIndex < 0)
return;
var tlc = new DrawerManagedSingleton.ThickLineData()
{
p0 = p0,
p1 = p1,
thickness = thickness,
color = color
};
thickLineData[writeIndex] = tlc;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public unsafe void DrawWireFrustum(float4x4 cullingMatrix, uint color)
{
var writeIndex = GetLineWriteIndex(12);
if (writeIndex < 0)
return;
// Frustum corners in NDC
Span<float4> frustumCorners = stackalloc float4[]
{
new float4(-1, -1, -1, 1),
new float4(+1, -1, -1, 1),
new float4(+1, +1, -1, 1),
new float4(-1, +1, -1, 1),
new float4(-1, -1, +1, 1),
new float4(+1, -1, +1, 1),
new float4(+1, +1, +1, 1),
new float4(-1, +1, +1, 1),
};
cullingMatrix = math.inverse(cullingMatrix);
for (int i = 0; i < frustumCorners.Length; ++i)
{
frustumCorners[i] = math.mul(cullingMatrix, frustumCorners[i]);
frustumCorners[i] /= frustumCorners[i].w;
}
var nearPlaneSlice = frustumCorners.Slice(0, 4);
var farPlaneSlice = frustumCorners.Slice(4, 4);
for (var i = 0; i < nearPlaneSlice.Length; ++i)
{
// Near plane line
var nl = new DrawerManagedSingleton.LineData()
{
color = color,
p0 = nearPlaneSlice[i].xyz,
p1 = nearPlaneSlice[(i + 1) % 4].xyz
};
lineData[writeIndex + i] = nl;
// Far plane line
var fl = new DrawerManagedSingleton.LineData()
{
color = color,
p0 = farPlaneSlice[i].xyz,
p1 = farPlaneSlice[(i + 1) % 4].xyz
};
lineData[writeIndex + 4 + i] = fl;
// Near to far plane line
var nfl = new DrawerManagedSingleton.LineData()
{
color = color,
p0 = nearPlaneSlice[i].xyz,
p1 = farPlaneSlice[i].xyz
};
lineData[writeIndex + 8 + i] = nfl;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawRectangle(float2 xySize, uint color, in RigidTransform xform)
{
var writeIndex = GetTriangleWriteIndex(2);
if (writeIndex < 0)
return;
var p0 = new float3(xySize, 0) * 0.5f;
var p1 = new float3(xySize.x, -xySize.y, 0) * 0.5f;
var p2 = new float3(-xySize, 0) * 0.5f;
var p3 = new float3(-xySize.x, xySize.y, 0) * 0.5f;
p0 = math.transform(xform, p0);
p1 = math.transform(xform, p1);
p2 = math.transform(xform, p2);
p3 = math.transform(xform, p3);
var t0 = new DrawerManagedSingleton.TriangleData()
{
p0 = p0,
p1 = p1,
p2 = p2,
color = color
};
var t1 = new DrawerManagedSingleton.TriangleData()
{
p0 = p2,
p1 = p3,
p2 = p0,
color = color
};
triData[writeIndex + 0] = t0;
triData[writeIndex + 1] = t1;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawCuboid(float3 size, uint color, in RigidTransform xform)
{
var halfSize = size * 0.5f;
var f0c = math.transform(xform, new float3(halfSize.x, 0, 0));
var f0s = size.yz;
var r0 = quaternion.RotateY(math.PI * 0.5f);
r0 = math.mul(quaternion.RotateX(math.PI * 0.5f), r0);
r0 = math.mul(xform.rot, r0);
DrawRectangle(f0s, color, new RigidTransform(r0, f0c));
var f1c = math.transform(xform, new float3(-halfSize.x, 0, 0));
var f1s = size.yz;
var r1 = quaternion.RotateY(-math.PI * 0.5f);
r1 = math.mul(quaternion.RotateX(math.PI * 0.5f), r1);
r1 = math.mul(xform.rot, r1);
DrawRectangle(f1s, color, new RigidTransform(r1, f1c));
var f2c = math.transform(xform, new float3(0, halfSize.y, 0));
var f2s = size.xz;
var r2 = quaternion.RotateX(-math.PI * 0.5f);
r2 = math.mul(xform.rot, r2);
DrawRectangle(f2s, color, new RigidTransform(r2, f2c));
var f3c = math.transform(xform, new float3(0, -halfSize.y, 0));
var f3s = size.xz;
var r3 = quaternion.RotateX(math.PI * 0.5f);
r3 = math.mul(xform.rot, r3);
DrawRectangle(f3s, color, new RigidTransform(r3, f3c));
var f4c = math.transform(xform, new float3(0, 0, halfSize.z));
var f4s = size.xy;
DrawRectangle(f4s, color, new RigidTransform(xform.rot, f4c));
var f5c = math.transform(xform, new float3(0, 0, -halfSize.z));
var f5s = size.xy;
var r5 = quaternion.RotateX(math.PI);
r5 = math.mul(xform.rot, r5);
DrawRectangle(f5s, color, new RigidTransform(r5, f5c));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawWireCuboid(float3 size, uint color, in RigidTransform xform)
{
var writeIndex = GetLineWriteIndex(12);
if (writeIndex < 0)
return;
Span<float3> corners = stackalloc float3[8];
var halfSize = size * 0.5f;
corners[0] = halfSize.xyz;
corners[1] = new float3(halfSize.x, -halfSize.y, halfSize.z);
corners[2] = new float3(-halfSize.x, -halfSize.y, halfSize.z);
corners[3] = new float3(-halfSize.x, halfSize.y, halfSize.z);
corners[4] = new float3(halfSize.x, halfSize.y, -halfSize.z);
corners[5] = new float3(halfSize.x, -halfSize.y, -halfSize.z);
corners[6] = new float3(-halfSize.x, -halfSize.y, -halfSize.z);
corners[7] = new float3(-halfSize.x, halfSize.y, -halfSize.z);
for (var i = 0; i < corners.Length; ++i)
{
corners[i] = math.transform(xform, corners[i]);
}
var l0 = new DrawerManagedSingleton.LineData() { p0 = corners[0], p1 = corners[1], color = color };
lineData[writeIndex + 0] = l0;
var l1 = new DrawerManagedSingleton.LineData() { p0 = corners[1], p1 = corners[2], color = color };
lineData[writeIndex + 1] = l1;
var l2 = new DrawerManagedSingleton.LineData() { p0 = corners[2], p1 = corners[3], color = color };
lineData[writeIndex + 2] = l2;
var l3 = new DrawerManagedSingleton.LineData() { p0 = corners[3], p1 = corners[0], color = color };
lineData[writeIndex + 3] = l3;
var l4 = new DrawerManagedSingleton.LineData() { p0 = corners[4], p1 = corners[5], color = color };
lineData[writeIndex + 4] = l4;
var l5 = new DrawerManagedSingleton.LineData() { p0 = corners[5], p1 = corners[6], color = color };
lineData[writeIndex + 5] = l5;
var l6 = new DrawerManagedSingleton.LineData() { p0 = corners[6], p1 = corners[7], color = color };
lineData[writeIndex + 6] = l6;
var l7 = new DrawerManagedSingleton.LineData() { p0 = corners[7], p1 = corners[4], color = color };
lineData[writeIndex + 7] = l7;
var l8 = new DrawerManagedSingleton.LineData() { p0 = corners[0], p1 = corners[4], color = color };
lineData[writeIndex + 8] = l8;
var l9 = new DrawerManagedSingleton.LineData() { p0 = corners[1], p1 = corners[5], color = color };
lineData[writeIndex + 9] = l9;
var l10 = new DrawerManagedSingleton.LineData() { p0 = corners[2], p1 = corners[6], color = color };
lineData[writeIndex + 10] = l10;
var l11 = new DrawerManagedSingleton.LineData() { p0 = corners[3], p1 = corners[7], color = color };
lineData[writeIndex + 11] = l11;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawWireTriangle(float3 p0, float3 p1, float3 p2, uint color)
{
var writeIndex = GetLineWriteIndex(3);
if (writeIndex < 0)
return;
var l0 = new DrawerManagedSingleton.LineData()
{
p0 = p0,
p1 = p1,
color = color,
};
var l1 = new DrawerManagedSingleton.LineData()
{
p0 = p1,
p1 = p2,
color = color,
};
var l2 = new DrawerManagedSingleton.LineData()
{
p0 = p2,
p1 = p0,
color = color,
};
lineData[writeIndex + 0] = l0;
lineData[writeIndex + 1] = l1;
lineData[writeIndex + 2] = l2;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawWirePyramid(float baseRadius, float apexHeight, int numBaseEdges, uint color, in RigidTransform xform)
{
if (numBaseEdges < 3)
return;
var writeIndex = GetLineWriteIndex(numBaseEdges * 2);
if (writeIndex < 0)
return;
Span<float3> basePoints = stackalloc float3[numBaseEdges];
CreateCircleEdgePointsXY(ref basePoints, baseRadius);
DrawWireCircleInternal(basePoints, color, xform, writeIndex);
var apex = math.transform(xform, new float3(0, 0, apexHeight));
for (var i = 0; i < basePoints.Length; ++i)
{
var l = new DrawerManagedSingleton.LineData()
{
p0 = basePoints[i],
p1 = apex,
color = color
};
lineData[writeIndex + numBaseEdges + i] = l;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawPyramid(float baseRadius, float height, int numBaseEdges, uint color, in RigidTransform xform)
{
if (numBaseEdges < 3)
return;
var writeIndex = GetTriangleWriteIndex(numBaseEdges * 2);
if (writeIndex < 0)
return;
Span<float3> basePoints = stackalloc float3[numBaseEdges];
CreateCircleEdgePointsXY(ref basePoints, baseRadius);
DrawCircleInternal(basePoints, color, xform, false, writeIndex);
var apex = math.transform(xform, new float3(0, 0, height));
for (var i = 0; i < basePoints.Length; ++i)
{
var t = new DrawerManagedSingleton.TriangleData()
{
p0 = basePoints[i],
p1 = basePoints[(i + 1) % basePoints.Length],
p2 = apex,
color = color
};
triData[writeIndex + numBaseEdges + i] = t;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawFreeFormOctahedron(float radius, float height, float topBottomProportion, uint color, in RigidTransform xform)
{
var writeIndex = GetTriangleWriteIndex(8);
if (writeIndex < 0)
return;
var heightVec = new float3(0, 0, height);
var fwdVec = heightVec * topBottomProportion;
var backVec = -heightVec * (1 - topBottomProportion);
Span<float3> middlePoints = stackalloc float3[4];
CreateCircleEdgePointsXY(ref middlePoints, radius);
for (int i = 0; i < middlePoints.Length; ++i)
{
middlePoints[i] = math.transform(xform, middlePoints[i]);
}
fwdVec = math.transform(xform, fwdVec);
backVec = math.transform(xform, backVec);
for (var i = 0; i < middlePoints.Length; ++i)
{
var t0 = new DrawerManagedSingleton.TriangleData()
{
p0 = middlePoints[i],
p1 = middlePoints[(i + 1) & 3],
p2 = fwdVec,
color = color
};
triData[writeIndex + i * 2] = t0;
var t1 = new DrawerManagedSingleton.TriangleData()
{
p0 = middlePoints[(i + 1) & 3],
p1 = middlePoints[i],
p2 = backVec,
color = color
};
triData[writeIndex + i * 2 + 1] = t1;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawBoneMesh(float3 pos0, float3 pos1, uint bodyColor, uint outlineColor)
{
var writeIndex = GetBoneMeshWriteIndex(1);
if (writeIndex < 0)
return;
var bd = new DrawerManagedSingleton.BoneData()
{
pos0 = pos0,
pos1 = pos1,
colorLines = outlineColor,
colorTri = bodyColor
};
boneData[writeIndex] = bd;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawSolidArrow(float3 from, float3 to, uint color)
{
var v = to - from;
var vlen = math.length(v);
var vnrm = vlen > 0 ? v / vlen : 0;
var xform = new RigidTransform(MathUtils.FromToRotationForNormalizedVectors(math.forward(), vnrm), from);
DrawSolidCylinder(0.02f * vlen, math.length(v), 12, color, xform);
xform.pos = to;
DrawPyramid(0.04f * vlen, 0.08f * vlen, 12, color, xform);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CreateCircleEdgePointsXY(ref Span<float3> pts, float radius)
{
var angleStep = math.PI * 2 / pts.Length;
for (var i = 0; i < pts.Length; ++i)
{
math.sincos(i * angleStep, out var s, out var c);
pts[i] = new float3(s, c, 0) * radius;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void DrawCircleInternal(Span<float3> pts, uint color, in RigidTransform xform, bool ccw, int writeIndex)
{
var center = xform.pos;
for (var i = 0; i < pts.Length; ++i)
pts[i] = math.transform(xform, pts[i]);
for (var i = 0; i < pts.Length; ++i)
{
var p0 = pts[(i + 1) % pts.Length];
var p1 = pts[i];
var t = new DrawerManagedSingleton.TriangleData()
{
p0 = math.select(p0, p1, ccw),
p1 = math.select(p0, p1, !ccw),
p2 = center,
color = color
};
triData[writeIndex + i] = t;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawCircle(float radius, int numEdges, uint color, in RigidTransform xform)
{
if (numEdges < 3)
return;
var writeIndex = GetTriangleWriteIndex(numEdges);
if (writeIndex < 0)
return;
Span<float3> edgePoints = stackalloc float3[numEdges];
CreateCircleEdgePointsXY(ref edgePoints, radius);
DrawCircleInternal(edgePoints, color, xform, false, writeIndex);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void DrawWireCircleInternal(Span<float3> pts, uint color, in RigidTransform xform, int writeIndex)
{
for (var i = 0; i < pts.Length; ++i)
pts[i] = math.transform(xform, pts[i]);
for (var i = 0; i < pts.Length; ++i)
{
var l = new DrawerManagedSingleton.LineData()
{
p0 = pts[i],
p1 = pts[(i + 1) % pts.Length],
color = color
};
lineData[writeIndex + i] = l;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawWireCircle(float radius, int numEdges, uint color, in RigidTransform xform)
{
if (numEdges < 3)
return;
var writeIndex = GetLineWriteIndex(numEdges);
if (writeIndex < 0)
return;
Span<float3> edgePoints = stackalloc float3[numEdges];
CreateCircleEdgePointsXY(ref edgePoints, radius);
DrawWireCircleInternal(edgePoints, color, xform, writeIndex);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static NativeList<float3> MakeIcosahedronVertices()
{
var rv = new NativeList<float3>(12, Allocator.Temp);
rv.Resize(12, NativeArrayOptions.UninitializedMemory);
var sqrt5 = 2.23606797749f;
var phi = (1.0f + sqrt5) * 0.5f;
var a = 1.0f;
var b = 1 / phi;
rv[0] = new float3(0, b, -a);
rv[1] = new float3(b, a, 0);
rv[2] = new float3(-b, a, 0);
rv[3] = new float3(0, b, a);
rv[4] = new float3(0, -b, a);
rv[5] = new float3(-a, 0, b);
rv[6] = new float3(0, -b, -a);
rv[7] = new float3(a, 0, -b);
rv[8] = new float3(a, 0, b);
rv[9] = new float3(-a, 0, -b);
rv[10] = new float3(b, -a, 0);
rv[11] = new float3(-b, -a, 0);
return rv;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static void ProjectVerticesToUnitSphere(NativeArray<float3> v)
{
for (var i = 0; i < v.Length; ++i)
{
v[i] = math.normalize(v[i]);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MakeWireIcosahedron(out NativeList<float3> vertices, out NativeList<int2> lines)
{
vertices = MakeIcosahedronVertices();
ProjectVerticesToUnitSphere(vertices.AsArray());
lines = new (30, Allocator.Temp);
lines.Add(new int2(0, 1));
lines.Add(new int2(0, 2));
lines.Add(new int2(0, 6));
lines.Add(new int2(0, 7));
lines.Add(new int2(0, 9));
lines.Add(new int2(1, 2));
lines.Add(new int2(1, 3));
lines.Add(new int2(1, 7));
lines.Add(new int2(1, 8));
lines.Add(new int2(2, 3));
lines.Add(new int2(2, 5));
lines.Add(new int2(2, 9));
lines.Add(new int2(3, 4));
lines.Add(new int2(3, 5));
lines.Add(new int2(3, 8));
lines.Add(new int2(4, 5));
lines.Add(new int2(4, 8));
lines.Add(new int2(4, 10));
lines.Add(new int2(4, 11));
lines.Add(new int2(5, 9));
lines.Add(new int2(5, 11));
lines.Add(new int2(6, 7));
lines.Add(new int2(6, 9));
lines.Add(new int2(6, 10));
lines.Add(new int2(6, 11));
lines.Add(new int2(7, 8));
lines.Add(new int2(7, 10));
lines.Add(new int2(8, 10));
lines.Add(new int2(9, 11));
lines.Add(new int2(10, 11));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static void MakeSolidIcosahedron(out NativeList<float3> vertices, out NativeList<int3> triangles)
{
vertices = MakeIcosahedronVertices();
ProjectVerticesToUnitSphere(vertices.AsArray());
triangles = new (20, Allocator.Temp);
triangles.Resize(20, NativeArrayOptions.UninitializedMemory);
triangles[0] = new int3(2, 1, 0);
triangles[1] = new int3(1, 2, 3);
triangles[2] = new int3(5, 4, 3);
triangles[3] = new int3(4, 8, 3);
triangles[4] = new int3(7, 6, 0);
triangles[5] = new int3(6, 9, 0);
triangles[6] = new int3(11, 10, 4);
triangles[7] = new int3(10, 11, 6);
triangles[8] = new int3(9, 5, 2);
triangles[9] = new int3(5, 9, 11);
triangles[10] = new int3(8, 7, 1);
triangles[11] = new int3(7, 8, 10);
triangles[12] = new int3(2, 5, 3);
triangles[13] = new int3(8, 1, 3);
triangles[14] = new int3(9, 2, 0);
triangles[15] = new int3(1, 7, 0);
triangles[16] = new int3(11, 9, 6);
triangles[17] = new int3(7, 10, 6);
triangles[18] = new int3(5, 11, 4);
triangles[19] = new int3(10, 8, 4);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawSolidIcosahedron(float radius, uint color, in RigidTransform xform)
{
var writeIndex = GetTriangleWriteIndex(20);
if (writeIndex < 0)
return;
MakeSolidIcosahedron(out var v, out var triIndices);
for (var i = 0; i < v.Length; ++i)
{
var vm = v[i] * radius;
v[i] = math.mul(xform, new float4(vm, 1)).xyz;
}
for (int i = 0; i < triIndices.Length; ++i)
{
var ti = triIndices[i];
var t = new DrawerManagedSingleton.TriangleData()
{
color = color,
p0 = v[ti.y],
p1 = v[ti.x],
p2 = v[ti.z],
};
triData[writeIndex + i] = t;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawWireIcosahedron(float radius, uint color, in RigidTransform xform)
{
var writeIndex = GetLineWriteIndex(30);
if (writeIndex < 0)
return;
MakeWireIcosahedron(out var v, out var lineIndices);
for (var i = 0; i < v.Length; ++i)
{
var vm = v[i] * radius;
v[i] = math.mul(xform, new float4(vm, 1)).xyz;
}
for (int i = 0; i < lineIndices.Length; ++i)
{
var li = lineIndices[i];
var t = new DrawerManagedSingleton.LineData()
{
color = color,
p0 = v[li.x],
p1 = v[li.y],
};
lineData[writeIndex + i] = t;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static void MakeSolidUnitSphere(uint numSubdivisions, out NativeList<float3> vertices, out NativeList<int3> triIndices)
{
MakeSolidIcosahedron(out vertices, out triIndices);
var newVerticesMap = new NativeHashMap<float3, int>(128, Allocator.Temp);
for (var i = 0; i < numSubdivisions; ++i)
{
newVerticesMap.Clear();
var triCount = triIndices.Length;
for (var l = 0; l < triCount; ++l)
{
var t = triIndices[0];
// Split each edge by half
var i0 = t.x;
var i1 = t.y;
var i2 = t.z;
var v0 = vertices[i0];
var v1 = vertices[i1];
var v2 = vertices[i2];
var v01 = math.normalize((v1 + v0) * 0.5f);
var v02 = math.normalize((v2 + v0) * 0.5f);
var v12 = math.normalize((v2 + v1) * 0.5f);
if (!newVerticesMap.TryGetValue(v01, out var i01))
{
i01 = vertices.Length;
vertices.Add(v01);
newVerticesMap.Add(v01, i01);
}
if (!newVerticesMap.TryGetValue(v02, out var i02))
{
i02 = vertices.Length;
vertices.Add(v02);
newVerticesMap.Add(v02, i02);
}
if (!newVerticesMap.TryGetValue(v12, out var i12))
{
i12 = vertices.Length;
vertices.Add(v12);
newVerticesMap.Add(v12, i12);
}
var t0 = new int3(i0, i01, i02);
var t1 = new int3(i01, i1, i12);
var t2 = new int3(i02, i12, i2);
var t3 = new int3(i01, i12, i02);
triIndices.RemoveAt(0);
triIndices.Add(t0);
triIndices.Add(t1);
triIndices.Add(t2);
triIndices.Add(t3);
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawSolidSphere(float radius, uint color, uint numSubdivisions, in RigidTransform xform)
{
MakeSolidUnitSphere(numSubdivisions, out var v, out var triIndices);
var writeIndex = GetTriangleWriteIndex(triIndices.Length);
if (writeIndex < 0)
return;
for (var i = 0; i < v.Length; ++i)
{
var vm = v[i] * radius;
v[i] = math.mul(xform, new float4(vm, 1)).xyz;
}
for (var i = 0; i < triIndices.Length; ++i)
{
var ti = triIndices[i];
var td = new DrawerManagedSingleton.TriangleData()
{
color = color,
p0 = v[ti.y],
p1 = v[ti.x],
p2 = v[ti.z]
};
triData[writeIndex + i] = td;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawWireSphere(float radius, uint color, uint numSubdivisions, in RigidTransform xform)
{
MakeSolidUnitSphere(numSubdivisions, out var v, out var triIndices);
var linesSet = new NativeHashSet<int2>(128, Allocator.Temp);
for (var i = 0; i < triIndices.Length; ++i)
{
var t = triIndices[i];
var l0 = new int2(math.min(t.x, t.y), math.max(t.x, t.y));
var l1 = new int2(math.min(t.y, t.z), math.max(t.y, t.z));
var l2 = new int2(math.min(t.x, t.z), math.max(t.x, t.z));
linesSet.Add(l0);
linesSet.Add(l1);
linesSet.Add(l2);
}
var writeIndex = GetLineWriteIndex(linesSet.Count);
if (writeIndex < 0)
return;
for (var i = 0; i < v.Length; ++i)
{
var vm = v[i] * radius;
v[i] = math.mul(xform, new float4(vm, 1)).xyz;
}
var le = linesSet.GetEnumerator();
var k = 0;
while (le.MoveNext())
{
var li = le.Current;
var ld = new DrawerManagedSingleton.LineData()
{
color = color,
p0 = v[li.x],
p1 = v[li.y],
};
lineData[writeIndex + k] = ld;
++k;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawWireCylinder(float radius, float height, int numEdges, uint color, in RigidTransform xform)
{
if (numEdges < 3)
return;
var writeIndex = GetLineWriteIndex(numEdges * 3);
if (writeIndex < 0)
return;
Span<float3> base0Points = stackalloc float3[numEdges];
Span<float3> base1Points = stackalloc float3[numEdges];
CreateCircleEdgePointsXY(ref base0Points, radius);
base0Points.CopyTo(base1Points);
var base1Offset = new float3(0, 0, height);
var base1XForm = new RigidTransform(quaternion.identity, base1Offset);
base1XForm = math.mul(xform, base1XForm);
DrawWireCircleInternal(base0Points, color, xform, writeIndex);
DrawWireCircleInternal(base1Points, color, base1XForm, writeIndex + numEdges);
for (var i = 0; i < base0Points.Length; ++i)
{
var l = new DrawerManagedSingleton.LineData()
{
p0 = base0Points[i],
p1 = base1Points[i],
color = color
};
lineData[writeIndex + numEdges * 2 + i] = l;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawSolidCylinder(float radius, float height, int numEdges, uint color, in RigidTransform xform)
{
if (numEdges < 3)
return;
var writeIndex = GetTriangleWriteIndex(numEdges * 4);
Span<float3> base0Points = stackalloc float3[numEdges];
Span<float3> base1Points = stackalloc float3[numEdges];
CreateCircleEdgePointsXY(ref base0Points, radius);
base0Points.CopyTo(base1Points);
var base1Offset = new float3(0, 0, height);
var base1XForm = new RigidTransform(quaternion.identity, base1Offset);
base1XForm = math.mul(xform, base1XForm);
DrawCircleInternal(base0Points, color, xform, false, writeIndex);
DrawCircleInternal(base1Points, color, base1XForm, true, writeIndex + numEdges);
for (var i = 0; i < base0Points.Length; ++i)
{
var t0 = new DrawerManagedSingleton.TriangleData()
{
p0 = base0Points[i],
p1 = base0Points[(i + 1) % base0Points.Length],
p2 = base1Points[(i + 1) % base0Points.Length],
color = color
};
triData[writeIndex + numEdges * 2 + i * 2 + 0] = t0;
var t1 = new DrawerManagedSingleton.TriangleData()
{
p0 = base1Points[(i + 1) % base0Points.Length],
p1 = base1Points[i],
p2 = base0Points[i],
color = color
};
triData[writeIndex + numEdges * 2 + i * 2 + 1] = t1;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawTriangle(float3 p0, float3 p1, float3 p2, uint color)
{
var t = new DrawerManagedSingleton.TriangleData()
{
p0 = p0,
p1 = p1,
p2 = p2,
color = color
};
var writeIndex = GetTriangleWriteIndex(1);
if (writeIndex < 0)
return;
triData[writeIndex] = t;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void DrawLine(float3 p0, float3 p1, uint color)
{
var l = new DrawerManagedSingleton.LineData()
{
p0 = p0,
p1 = p1,
color = color
};
var writeIndex = GetLineWriteIndex(1);
if (writeIndex < 0)
return;
lineData[writeIndex] = l;
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 62b71091c702d104496838a7805dd03f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/DebugDrawer.cs
uploadId: 897522
@@ -0,0 +1,58 @@
using Unity.Collections;
using Unity.Entities;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace Rukhanka.DebugDrawer
{
[UpdateInGroup(typeof(SimulationSystemGroup), OrderFirst = true)]
[WorldSystemFilter(WorldSystemFilterFlags.LocalSimulation | WorldSystemFilterFlags.ClientSimulation)]
public partial class RukhankaDebugDrawerFrameStartSystem : SystemBase
{
private DrawerManagedSingleton ds;
protected override void OnCreate()
{
ds = new DrawerManagedSingleton();
if (ds.IsValid())
{
var e = EntityManager.CreateSingleton(ds, new FixedString64Bytes("Rukhanka.DebugDrawer.Singleton"));
var dw = Drawer.Create(ds);
EntityManager.AddComponentData(e, dw);
}
}
protected override void OnUpdate()
{
if (!SystemAPI.ManagedAPI.TryGetSingleton<DrawerManagedSingleton>(out var ds))
return;
ds.BeginFrame();
var dw = Drawer.Create(ds);
SystemAPI.SetSingleton(dw);
}
protected override void OnDestroy()
{
if (SystemAPI.ManagedAPI.TryGetSingleton<DrawerManagedSingleton>(out var ds))
ds.Dispose();
}
}
///===============================================================================================================///
[UpdateInGroup(typeof(PresentationSystemGroup), OrderLast = true)]
[WorldSystemFilter(WorldSystemFilterFlags.LocalSimulation | WorldSystemFilterFlags.ClientSimulation)]
public partial class RukhankaDebugDrawerFrameEndSystem : SystemBase
{
protected override void OnUpdate()
{
Dependency.Complete();
if (SystemAPI.ManagedAPI.TryGetSingleton<DrawerManagedSingleton>(out var ds))
{
ds.EndFrame();
SystemAPI.SetSingleton(new Drawer());
}
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 57782ab314705df45b28d92a822f418b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/DebugDrawerSystems.cs
uploadId: 897522
@@ -0,0 +1,91 @@
using System;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
/////////////////////////////////////////////////////////////////////////////////
namespace Rukhanka.DebugDrawer
{
public class DrawBuffer<T>: IDisposable where T: unmanaged
{
internal GraphicsBuffer gpuBuffer;
internal int counter;
internal UnsafeAtomicCounter32 counterAtomic;
NativeList<T> bufferData;
/////////////////////////////////////////////////////////////////////////////////
public DrawBuffer()
{
unsafe
{
fixed (void* counterPtr = &counter)
{
counterAtomic = new UnsafeAtomicCounter32(counterPtr);
}
}
}
/////////////////////////////////////////////////////////////////////////////////
internal NativeArray<T> BeginFrame()
{
ResizeBuffer();
counterAtomic.Reset();
var rv = bufferData.AsArray();
return rv;
}
/////////////////////////////////////////////////////////////////////////////////
internal int EndFrame()
{
if (counter == 0)
return 0;
ResizeGPUBuffer();
var cnt = math.min(bufferData.Length, counter);
gpuBuffer.SetData(bufferData.AsArray(), 0, 0, cnt);
return cnt;
}
/////////////////////////////////////////////////////////////////////////////////
void ResizeGPUBuffer()
{
if (gpuBuffer == null || gpuBuffer.count < counter)
{
if (gpuBuffer != null)
gpuBuffer.Dispose();
var cnt = math.max(counter, 0xffff);
gpuBuffer = new GraphicsBuffer(GraphicsBuffer.Target.Structured, GraphicsBuffer.UsageFlags.LockBufferForWrite, cnt, UnsafeUtility.SizeOf<T>());
}
}
/////////////////////////////////////////////////////////////////////////////////
void ResizeBuffer()
{
if (!bufferData.IsCreated)
{
bufferData = new (counter, Allocator.Persistent);
}
var cnt = math.max(counter, 0xffff);
bufferData.Resize(cnt, NativeArrayOptions.ClearMemory);
}
/////////////////////////////////////////////////////////////////////////////////
public void Dispose()
{
if (gpuBuffer != null)
gpuBuffer.Dispose();
gpuBuffer = null;
bufferData.Dispose();
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 9d22adb32c09903459d5122edec1d5b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/DrawBuffer.cs
uploadId: 897522
@@ -0,0 +1,240 @@
using Unity.Mathematics;
using Unity.Collections;
using Unity.Entities;
using UnityEngine;
using UnityEngine.Rendering;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace Rukhanka.DebugDrawer
{
public class DrawerManagedSingleton: IComponentData
{
internal DrawBuffer<LineData> linesBuf;
internal DrawBuffer<ThickLineData> thickLinesBuf;
internal DrawBuffer<TriangleData> trianglesBuf;
internal DrawBuffer<BoneData> bonesBuf;
internal NativeArray<LineData> lineData;
internal NativeArray<TriangleData> triData;
internal NativeArray<ThickLineData> thickLineData;
internal NativeArray<BoneData> boneData;
Material lineDrawMat;
Material thickLinesDrawMat;
Material trianglesDrawMat;
Material boneTriDrawMat;
Material boneOutlineDrawMat;
Mesh boneMesh;
internal struct LineData
{
public float3 p0, p1;
public uint color;
}
internal struct ThickLineData
{
public float3 p0, p1;
public float thickness;
public uint color;
}
internal struct TriangleData
{
public float3 p0, p1, p2;
public uint color;
}
public struct BoneData
{
public float3 pos0, pos1;
public uint colorTri, colorLines;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void Dispose()
{
linesBuf.Dispose();
thickLinesBuf.Dispose();
trianglesBuf.Dispose();
bonesBuf.Dispose();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public DrawerManagedSingleton()
{
if (!SystemInfo.supportsComputeShaders)
{
Debug.LogError("System does not support compute shaders and/or graphics buffers. DebugDrawer will be disabled.");
return;
}
linesBuf = new ();
thickLinesBuf = new ();
trianglesBuf = new ();
bonesBuf = new ();
CreateMaterials();
boneMesh = CreateBoneMesh();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public bool IsValid()
{
var rv =
linesBuf != null &&
thickLinesBuf != null &&
trianglesBuf != null &&
bonesBuf != null &&
lineDrawMat != null &&
thickLinesDrawMat != null &&
trianglesDrawMat != null &&
boneOutlineDrawMat != null &&
boneTriDrawMat != null;
return rv;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CreateMaterials()
{
lineDrawMat = new Material(Shader.Find($"RukhankaDebugLineDrawer"));
thickLinesDrawMat = new Material(Shader.Find($"RukhankaDebugThickLineDrawer"));
trianglesDrawMat = new Material(Shader.Find($"RukhankaDebugTriangleDrawer"));
boneTriDrawMat = new Material(Shader.Find($"RukhankaBoneTriangleRenderer"));
boneOutlineDrawMat = new Material(Shader.Find($"RukhankaBoneOutlineRenderer"));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public static Mesh CreateBoneMesh()
{
var boneMesh = new Mesh();
boneMesh.subMeshCount = 2;
var vtx = new Vector3[6];
vtx[0] = new Vector3(0, 1, 0);
vtx[5] = new Vector3(0, -1, 0);
vtx[1] = new Vector3(-1, 0, 0);
vtx[2] = new Vector3(1, 0, 0);
vtx[3] = new Vector3(0, 0, -1);
vtx[4] = new Vector3(0, 0, 1);
for (int i = 0; i < vtx.Length; ++i)
vtx[i] *= 0.1f;
var triIdx = new int[]
{
0, 1, 4,
0, 4, 2,
0, 2, 3,
0, 3, 1,
5, 4, 1,
5, 2, 4,
5, 3, 2,
5, 1, 3,
};
var lineIdx = new int[]
{
0, 1,
0, 2,
0, 3,
0, 4,
5, 1,
5, 2,
5, 3,
5, 4,
2, 4,
1, 4,
1, 3,
2, 3,
};
boneMesh.SetVertices(vtx);
boneMesh.SetIndices(triIdx, MeshTopology.Triangles, 0);
boneMesh.SetIndices(lineIdx, MeshTopology.Lines, 1);
return boneMesh;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void BeginFrame()
{
lineData = linesBuf.BeginFrame();
thickLineData = thickLinesBuf.BeginFrame();
triData = trianglesBuf.BeginFrame();
boneData = bonesBuf.BeginFrame();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Render primitives
public void EndFrame()
{
var numLines = linesBuf.EndFrame();
lineData = default;
var numThickLines = thickLinesBuf.EndFrame();
thickLineData = default;
var numTriangles = trianglesBuf.EndFrame();
triData = default;
var numBones = bonesBuf.EndFrame();
boneData = default;
var rp = new RenderParams();
rp.camera = null;
rp.layer = 0;
rp.lightProbeProxyVolume = null;
rp.lightProbeUsage = LightProbeUsage.Off;
rp.matProps = null;
rp.motionVectorMode = MotionVectorGenerationMode.ForceNoMotion;
rp.receiveShadows = false;
rp.reflectionProbeUsage = ReflectionProbeUsage.Off;
rp.rendererPriority = 0;
rp.renderingLayerMask = 0xffffffff;
rp.shadowCastingMode = ShadowCastingMode.Off;
rp.worldBounds = new Bounds(Vector3.zero, Vector3.one * 100000);
if (numLines > 0)
{
rp.material = lineDrawMat;
rp.material.SetBuffer("lineDataBuf", linesBuf.gpuBuffer);
Graphics.RenderPrimitives(rp, MeshTopology.Lines, linesBuf.counter * 2);
}
if (numThickLines > 0)
{
rp.material = thickLinesDrawMat;
rp.material.SetBuffer("thickLineDataBuf", thickLinesBuf.gpuBuffer);
Graphics.RenderPrimitives(rp, MeshTopology.Triangles, thickLinesBuf.counter * 6);
}
if (numTriangles > 0)
{
rp.material = trianglesDrawMat;
rp.material.SetBuffer("triDataBuf", trianglesBuf.gpuBuffer);
Graphics.RenderPrimitives(rp, MeshTopology.Triangles, trianglesBuf.counter * 3);
}
if (numBones > 0)
{
rp.material = boneTriDrawMat;
rp.material.SetBuffer("boneDataBuf", bonesBuf.gpuBuffer);
Graphics.RenderMeshPrimitives(rp, boneMesh, 0, bonesBuf.counter);
rp.material = boneOutlineDrawMat;
rp.material.SetBuffer("boneDataBuf", bonesBuf.gpuBuffer);
Graphics.RenderMeshPrimitives(rp, boneMesh, 1, bonesBuf.counter);
}
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: b19bee19b241d0c478f938eb54695008
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/DrawerManagedSingleton.cs
uploadId: 897522
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7901406cd8ae49a4cba4e5914cd4eb8a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,77 @@
Shader "RukhankaBoneOutlineRenderer"
{
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.high-definition": "1.0.0"
}
Tags
{
"RenderPipeline" = "HDRenderPipeline"
"RenderType" = "HDUnlitShader"
"Queue" = "Transparent+0"
}
Pass
{
Name "ForwardOnly"
Tags
{
"LightMode" = "ForwardOnly"
}
Blend SrcAlpha OneMinusSrcAlpha
ZTest off
HLSLPROGRAM
#pragma target 3.0
#pragma vertex VS
#pragma fragment PS
#define BONE_OUTLINE
#define IS_HDRP
#include "RukhankaBoneRenderer.hlsl"
ENDHLSL
}
}
/////////////////////////////////////////////////////////////////////////////////
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.universal": "1.0.0"
}
Tags
{
"RenderPipeline"="UniversalPipeline"
"Queue" = "Transparent+0"
}
Pass
{
Tags
{
"LightMode" = "UniversalForward"
}
Blend SrcAlpha OneMinusSrcAlpha
ZTest off
HLSLPROGRAM
#pragma target 3.0
#pragma vertex VS
#pragma fragment PS
#define BONE_OUTLINE
#include "RukhankaBoneRenderer.hlsl"
ENDHLSL
}
}
}
@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: 740a4e84dd61c564fbfc15932a58081f
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/Resources/RukhankaBoneOutlineRenderer.shader
uploadId: 897522
@@ -0,0 +1,100 @@
#ifndef RUKHANKA_BONE_RENDERER_HLSL_
#define RUKHANKA_BONE_RENDERER_HLSL_
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "RukhankaDebugDrawerCommon.hlsl"
/////////////////////////////////////////////////////////////////////////////////
struct VertexInput
{
float3 pos: POSITION;
uint vertexID: SV_VertexID;
uint instanceID: SV_InstanceID;
};
struct VertexToPixel
{
float4 pos: SV_Position;
float4 color: COLOR0;
};
struct BoneData
{
float3 pos0, pos1;
uint colorTri, colorLines;
};
StructuredBuffer<BoneData> boneDataBuf;
float4x4 unity_MatrixVP;
/////////////////////////////////////////////////////////////////////////////////
float3 GetStableTangent(float3 v)
{
float3 aV = abs(v);
float3 rv = float3(-v.y, v.z, 0);
if (aV.x <= aV.y && aV.x <= aV.z) rv = float3(0, -v.z, v.y);
else if (aV.y <= aV.y && aV.y <= aV.z) rv = float3(-v.z, 0, v.x);
return rv;
}
/////////////////////////////////////////////////////////////////////////////////
float3 ComputeVertexWorldPos(BoneData bd, float3 vertexPos, int vertexID)
{
float3 worldPos = 0;
switch (vertexID)
{
case 0: worldPos = bd.pos0; break;
case 5: worldPos = bd.pos1; break;
default:
{
float3 boneVec = bd.pos0 - bd.pos1;
float l = length(boneVec);
if (l != 0)
{
float3 boneVecNrm = boneVec / l;
float3 tangent = GetStableTangent(boneVecNrm);
float3 t = normalize(cross(boneVecNrm, tangent));
float3 n = normalize(cross(boneVecNrm, t));
float3 offsetVec = t * vertexPos.x - n * vertexPos.z;
worldPos = bd.pos1 + boneVec * 0.3f + offsetVec * l;
}
}
break;
}
return worldPos;
}
/////////////////////////////////////////////////////////////////////////////////
VertexToPixel VS(VertexInput i)
{
VertexToPixel o = (VertexToPixel)0;
BoneData bd = boneDataBuf[i.instanceID];
float3 worldPos = ComputeVertexWorldPos(bd, i.pos, i.vertexID);
worldPos = GetCameraRelativePositionWS(worldPos);
o.pos = mul(unity_MatrixVP, float4(worldPos, 1));
#ifdef BONE_OUTLINE
o.color = UnpackColor(bd.colorLines);
#else
o.color = UnpackColor(bd.colorTri);
#endif
return o;
}
/////////////////////////////////////////////////////////////////////////////////
float4 PS(VertexToPixel i): SV_Target0
{
return i.color;
}
#endif
@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 9ad43a2adc0e63f4b9e27f8ef82924c4
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/Resources/RukhankaBoneRenderer.hlsl
uploadId: 897522
@@ -0,0 +1,75 @@
Shader "RukhankaBoneTriangleRenderer"
{
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.high-definition": "1.0.0"
}
Tags
{
"RenderPipeline" = "HDRenderPipeline"
"RenderType" = "HDUnlitShader"
"Queue" = "Transparent+0"
}
Pass
{
Name "ForwardOnly"
Tags
{
"LightMode" = "ForwardOnly"
}
Blend SrcAlpha OneMinusSrcAlpha
ZTest off
HLSLPROGRAM
#pragma target 3.0
#pragma vertex VS
#pragma fragment PS
#define IS_HDRP
#include "RukhankaBoneRenderer.hlsl"
ENDHLSL
}
}
/////////////////////////////////////////////////////////////////////////////////
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.universal": "1.0.0"
}
Tags
{
"RenderPipeline"="UniversalPipeline"
"Queue" = "Transparent+0"
}
Pass
{
Tags
{
"LightMode" = "UniversalForward"
}
Blend SrcAlpha OneMinusSrcAlpha
ZTest off
HLSLPROGRAM
#pragma target 3.0
#pragma vertex VS
#pragma fragment PS
#include "RukhankaBoneRenderer.hlsl"
ENDHLSL
}
}
}
@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: 2b3326df71f53a44188448c6506106e4
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/Resources/RukhankaBoneTriangleRenderer.shader
uploadId: 897522
@@ -0,0 +1,180 @@
#ifndef RUKHANKA_DEBUG_DRAWER_HLSL_
#define RUKHANKA_DEBUG_DRAWER_HLSL_
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#ifdef IS_HDRP
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs.hlsl"
#endif
#include "RukhankaDebugDrawerCommon.hlsl"
/////////////////////////////////////////////////////////////////////////////////
struct VertexInput
{
uint vertexID: SV_VertexID;
};
struct VertexToPixel
{
float4 pos: SV_Position;
float3 normal: NORMAL;
float2 uv: TEXCOORD0;
float4 color: COLOR0;
};
struct LineData
{
float3 pos[2];
uint color;
};
struct ThickLineData
{
float3 pos[2];
float thickness;
uint color;
};
struct TriData
{
float3 pos[3];
uint color;
};
StructuredBuffer<LineData> lineDataBuf;
StructuredBuffer<ThickLineData> thickLineDataBuf;
StructuredBuffer<TriData> triDataBuf;
float4x4 unity_MatrixVP;
float4x4 unity_MatrixV;
#ifdef IS_HDRP
StructuredBuffer<DirectionalLightData> _DirectionalLightDatas;
#else
float4 _MainLightPosition;
float4 _MainLightColor;
#endif
/////////////////////////////////////////////////////////////////////////////////
VertexToPixel VSLines(VertexInput i)
{
VertexToPixel o = (VertexToPixel)0;
uint lineID = i.vertexID >> 1;
uint vertexID = i.vertexID & 1;
LineData ln = lineDataBuf[lineID];
float3 worldPos = ln.pos[vertexID];
worldPos = GetCameraRelativePositionWS(worldPos);
o.pos = mul(unity_MatrixVP, float4(worldPos, 1));
o.color = UnpackColor(ln.color);
return o;
}
/////////////////////////////////////////////////////////////////////////////////
VertexToPixel VSThickLines(VertexInput i)
{
VertexToPixel o = (VertexToPixel)0;
uint instanceID = i.vertexID / 6;
uint triangleID = (i.vertexID - instanceID * 6) / 3;
uint vertexID = i.vertexID - instanceID * 6 - triangleID * 3;
uint posID = (vertexID + triangleID) >> 1;
uint leftRightID = (vertexID + triangleID) & 1;
ThickLineData tld = thickLineDataBuf[instanceID];
float3 worldPos = tld.pos[posID];
float3 dp = tld.pos[0] - tld.pos[1];
float3 viewVec = unity_MatrixV[2].xyz;
float3 c = cross(viewVec, dp);
c = normalize(c) * (leftRightID * 2.0f - 1) * tld.thickness;
worldPos += c;
o.uv = float2(leftRightID, posID);
worldPos = GetCameraRelativePositionWS(worldPos);
o.pos = mul(unity_MatrixVP, float4(worldPos, 1));
o.color = UnpackColor(tld.color);
o.color.a = 1;
return o;
}
/////////////////////////////////////////////////////////////////////////////////
VertexToPixel VSTriangle(VertexInput i)
{
VertexToPixel o = (VertexToPixel)0;
uint triangleID = i.vertexID / 3;
uint vertexID = i.vertexID - triangleID * 3;
TriData td = triDataBuf[triangleID];
const uint2 neighbourIndices[] =
{
uint2(2, 1),
uint2(0, 2),
uint2(1, 0),
};
float3 p0p2 = td.pos[neighbourIndices[vertexID].x] - td.pos[vertexID];
float3 p0p1 = td.pos[neighbourIndices[vertexID].y] - td.pos[vertexID];
float3 normal = 0;
float eps = 0.00001f;
if (length(p0p1) > eps && length(p0p2) > eps)
{
normal = cross(p0p2, p0p1);
normal = normalize(normal);
}
float3 worldPos = td.pos[vertexID];
worldPos = GetCameraRelativePositionWS(worldPos);
o.pos = mul(unity_MatrixVP, float4(worldPos, 1));
o.normal = normal;
o.color = UnpackColor(td.color);
return o;
}
/////////////////////////////////////////////////////////////////////////////////
void GetMainLight(out float3 lightDir, out float3 color)
{
#ifdef IS_HDRP
if (_DirectionalLightCount > 0)
{
DirectionalLightData light = _DirectionalLightDatas[0];
lightDir = -light.forward.xyz;
color = light.color;
}
else
{
lightDir = float3(1, 0, 0);
color = 0;
}
#else
lightDir = _MainLightPosition.rgb;
color = _MainLightColor.rgb;
#endif
}
/////////////////////////////////////////////////////////////////////////////////
float4 PS(VertexToPixel i): SV_Target0
{
float4 rv = i.color;//float4(0, 0, 0, 1);
if (length(i.normal) > 0.1f)
{
float3 mainLightDir, mainLightColor;
GetMainLight(mainLightDir, mainLightColor);
float df = dot(mainLightDir, i.normal) * 0.5f + 0.5f;
rv.rgb *= df;
}
return rv;
}
#endif
@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: b2600e13e03c73d4dbd65c4462783350
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/Resources/RukhankaDebugDrawer.hlsl
uploadId: 897522
@@ -0,0 +1,27 @@
#ifndef RUKHANKA_DEBUG_DRAWER_COMMON_HLSL_
#define RUKHANKA_DEBUG_DRAWER_COMMON_HLSL_
float3 GetCameraRelativePositionWS(float3 positionWS)
{
#if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0)
positionWS -= _WorldSpaceCameraPos.xyz;
#endif
return positionWS;
}
/////////////////////////////////////////////////////////////////////////////////
float4 UnpackColor(uint color)
{
float4 rv = float4
(
color >> 24,
color >> 16 & 0xff,
color >> 8 & 0xff,
color & 0xff
);
rv = rv / 255.0f;
return rv;
}
#endif
@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 1df1990c6dd59af4284e0a4cd18d791e
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/Resources/RukhankaDebugDrawerCommon.hlsl
uploadId: 897522
@@ -0,0 +1,75 @@
Shader "RukhankaDebugLineDrawer"
{
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.high-definition": "1.0.0"
}
Tags
{
"RenderPipeline" = "HDRenderPipeline"
"RenderType" = "HDUnlitShader"
"Queue" = "Transparent+0"
}
Pass
{
Name "ForwardOnly"
Tags
{
"LightMode" = "ForwardOnly"
}
Blend SrcAlpha OneMinusSrcAlpha
ZTest off
HLSLPROGRAM
#pragma target 3.0
#pragma vertex VSLines
#pragma fragment PS
#define IS_HDRP
#include "RukhankaDebugDrawer.hlsl"
ENDHLSL
}
}
/////////////////////////////////////////////////////////////////////////////////
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.universal": "1.0.0"
}
Tags
{
"RenderPipeline"="UniversalPipeline"
"Queue" = "Transparent+0"
}
Pass
{
Tags
{
"LightMode" = "UniversalForward"
}
Blend SrcAlpha OneMinusSrcAlpha
ZTest off
HLSLPROGRAM
#pragma target 3.0
#pragma vertex VSLines
#pragma fragment PS
#include "RukhankaDebugDrawer.hlsl"
ENDHLSL
}
}
}
@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: bf9e89bd9ebe67449a5cf05c583a337b
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/Resources/RukhankaDebugLineDrawer.shader
uploadId: 897522
@@ -0,0 +1,77 @@
Shader "RukhankaDebugThickLineDrawer"
{
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.high-definition": "1.0.0"
}
Tags
{
"RenderPipeline" = "HDRenderPipeline"
"RenderType" = "HDUnlitShader"
"Queue" = "Transparent+0"
}
Pass
{
Name "ForwardOnly"
Tags
{
"LightMode" = "ForwardOnly"
}
Blend SrcAlpha OneMinusSrcAlpha
ZTest off
Cull off
HLSLPROGRAM
#pragma target 3.0
#pragma vertex VSThickLines
#pragma fragment PS
#define IS_HDRP
#include "RukhankaDebugDrawer.hlsl"
ENDHLSL
}
}
/////////////////////////////////////////////////////////////////////////////////
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.universal": "1.0.0"
}
Tags
{
"RenderPipeline"="UniversalPipeline"
"Queue" = "Transparent+0"
}
Pass
{
Tags
{
"LightMode" = "UniversalForward"
}
Blend SrcAlpha OneMinusSrcAlpha
ZTest off
Cull off
HLSLPROGRAM
#pragma target 3.0
#pragma vertex VSThickLines
#pragma fragment PS
#include "RukhankaDebugDrawer.hlsl"
ENDHLSL
}
}
}
@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: 5a6fef881541c584eac17bcb9bef86c9
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/Resources/RukhankaDebugThickLineDrawer.shader
uploadId: 897522
@@ -0,0 +1,75 @@
Shader "RukhankaDebugTriangleDrawer"
{
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.high-definition": "1.0.0"
}
Tags
{
"RenderPipeline" = "HDRenderPipeline"
"RenderType" = "HDUnlitShader"
"Queue" = "Transparent+0"
}
Pass
{
Name "ForwardOnly"
Tags
{
"LightMode" = "ForwardOnly"
}
Blend SrcAlpha OneMinusSrcAlpha
Cull Front
HLSLPROGRAM
#pragma target 3.0
#pragma vertex VSTriangle
#pragma fragment PS
#define IS_HDRP
#include "RukhankaDebugDrawer.hlsl"
ENDHLSL
}
}
/////////////////////////////////////////////////////////////////////////////////
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.universal": "1.0.0"
}
Tags
{
"RenderPipeline"="UniversalPipeline"
"Queue" = "Transparent+0"
}
Pass
{
Tags
{
"LightMode" = "UniversalForward"
}
Blend SrcAlpha OneMinusSrcAlpha
Cull front
HLSLPROGRAM
#pragma target 3.0
#pragma vertex VSTriangle
#pragma fragment PS
#include "RukhankaDebugDrawer.hlsl"
ENDHLSL
}
}
}
@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: eed38dd879f9ccb48945c1bf4d062a2b
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/Resources/RukhankaDebugTriangleDrawer.shader
uploadId: 897522
@@ -0,0 +1,33 @@
{
"name": "Rukhanka.DebugDrawer",
"rootNamespace": "",
"references": [
"GUID:01e5f7c036964124aa192bf5e2d021ba",
"GUID:734d92eba21c94caba915361bd5ac177",
"GUID:e0cd26848372d4e5c891c569017e11f1",
"GUID:d8b63aba1907145bea998dd612889d6b",
"GUID:2665a8d13d1b3f18800f46e256720795"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": true,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"!RUKHANKA_NO_DEBUG_DRAWER"
],
"versionDefines": [
{
"name": "com.unity.render-pipelines.high-definition",
"expression": "9.9.9",
"define": "HDRP_10_0_0_OR_NEWER"
},
{
"name": "com.unity.render-pipelines.universal",
"expression": "9.9.9",
"define": "URP_10_0_0_OR_NEWER"
}
],
"noEngineReferences": false
}
@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: e6d74d5932d072f42b5113af70b1424c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/Rukhanka.DebugDrawer.asmdef
uploadId: 897522
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 693a00209a66b3b41b89acb8dc1db140
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,30 @@
using System;
using Rukhanka.Hybrid;
using UnityEditor;
using UnityEngine.UIElements;
////////////////////////////////////////////////////////////////////////////////////////
namespace Rukhanka.Editor
{
[CustomEditor(typeof(AimIKAuthoring))]
public class AimIKAuthoringEditor : UnityEditor.Editor
{
public VisualTreeAsset inpectorXML;
////////////////////////////////////////////////////////////////////////////////////////
public override VisualElement CreateInspectorGUI()
{
var myInspector = new VisualElement();
inpectorXML.CloneTree(myInspector);
var t = (AimIKAuthoring)target;
var angleLimitMinSlider = (Slider)myInspector.Q("minAngleSlider");
var angleLimitMaxSlider = (Slider)myInspector.Q("maxAngleSlider");
angleLimitMinSlider.RegisterValueChangedCallback((newVal) => { t.angleLimitMax = Math.Max(t.angleLimitMax, newVal.newValue); });
angleLimitMaxSlider.RegisterValueChangedCallback((newVal) => { t.angleLimitMin = Math.Min(newVal.newValue, t.angleLimitMin); });
return myInspector;
}
}
}
@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: ea4a0d834e497c144bce3d577268dc42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- inpectorXML: {fileID: 9197481963319205126, guid: cf4d33380a26ecf4ea08af1e93763d81, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/AimIKAuthoringEditor.cs
uploadId: 897522
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5a08108865024ae459733ffbdaa4e617
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
#pragma once
///////////////////////////////////////////////////////////////////////////////////////////
#ifdef DOTS_INSTANCING_ON
UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata)
UNITY_DOTS_INSTANCED_PROP(float, _DeformedMeshIndex)
UNITY_DOTS_INSTANCED_PROP(float4, _DeformationParamsForMotionVectors)
UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata)
#endif
@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: fcd50cc09e4fac945bbdabe59f0c6e08
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/AmplifyShaderEditor/RukhankaDeformationPropertyDefines.hlsl
uploadId: 897522
@@ -0,0 +1,68 @@
%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: 78b2425a2284af743826c689403a4924, type: 3}
m_Name: RukhankaMeshDeformation
m_EditorClassIdentifier:
m_functionInfo: "// Made with Amplify Shader Editor v1.9.8.1\n// Available at the
Unity Asset Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=19801\nNode;AmplifyShaderEditor.PosVertexDataNode;2;-512,-336;Inherit;False;0;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.NormalVertexDataNode;3;-512,-192;Inherit;False;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.TangentVertexDataNode;4;-512,-48;Inherit;False;0;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.VertexIdVariableNode;5;-480,-416;Inherit;False;0;1;INT;0\nNode;AmplifyShaderEditor.CustomExpressionNode;1;-208,-208;Inherit;False;ComputeDeformedVertex_float(vertexID,
meshVertex, meshNormal, meshTangent, deformedVertex, deformedNormal, deformedTangent)@$;7;Call;7;True;vertexID;INT;0;In;;Inherit;False;True;meshVertex;FLOAT3;0,0,0;In;;Inherit;False;True;meshNormal;FLOAT3;0,0,0;In;;Inherit;False;True;meshTangent;FLOAT3;0,0,0;In;;Inherit;False;True;deformedVertex;FLOAT3;0,0,0;Out;;Inherit;False;True;deformedNormal;FLOAT3;0,0,0;Out;;Inherit;False;True;deformedTangent;FLOAT3;0,0,0;Out;;Inherit;False;Rukhanka
Mesh Deformation;False;False;0;;False;8;0;FLOAT;0;False;1;INT;0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT3;0,0,0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;4;FLOAT;0;FLOAT3;6;FLOAT3;7;FLOAT3;8\nNode;AmplifyShaderEditor.RangedFloatNode;8;-208,96;Inherit;False;Property;_DeformedMeshIndex;_DeformedMeshIndex;0;1;[HideInInspector];Create;True;0;0;0;True;0;False;0;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.Vector4Node;10;-208,192;Inherit;False;Property;_DeformationParamsForMotionVectors;_DeformationParamsForMotionVectors;1;0;Create;True;0;0;0;True;0;False;0,0,0,0;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionOutput;7;192,-80;Inherit;False;False;-1;Deformed
Tangent;2;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;6;192,-160;Inherit;False;False;-1;Deformed
Normal;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;192,-240;Inherit;False;True;-1;Deformed
Vertex;0;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;1;1;5;0\nWireConnection;1;2;2;0\nWireConnection;1;3;3;0\nWireConnection;1;4;4;0\nWireConnection;7;0;1;8\nWireConnection;6;0;1;7\nWireConnection;0;0;1;6\nASEEND*/\n//CHKSM=93F12AB0D3C8468E37E48D03D4AFB0922FB79856"
m_functionName:
m_description: Rukhanka Mesh Deformation Node
m_additionalIncludes:
m_additionalIncludes: []
m_outsideIncludes: []
m_additionalPragmas:
m_additionalPragmas: []
m_outsidePragmas: []
m_additionalDirectives:
m_validData: 0
m_isDirty: 1
m_moduleName: ' Additional Directives'
m_independentModule: 1
m_customEdited: 0
m_additionalDirectives:
- {fileID: 0}
- {fileID: 0}
m_shaderFunctionDirectives: []
m_nativeDirectives: []
m_nativeDirectivesIndex: -1
m_nativeDirectivesFoldout: 0
m_directivesSaveItems:
- LineType: 0
LineValue: Packages/com.rukhanka.animation/Rukhanka.Editor/AmplifyShaderEditor/RukhankaDeformationPropertyDefines.hlsl
GUIDToggle: 0
GUIDValue:
ShowConditionals: 0
VersionMin: 0
VersionMax: 0
Passes:
Origin: 2
- LineType: 0
LineValue: Packages/com.rukhanka.animation/Rukhanka.Runtime/Deformation/Resources/ComputeDeformedVertex.hlsl
GUIDToggle: 0
GUIDValue:
ShowConditionals: 0
VersionMin: 0
VersionMax: 0
Passes:
Origin: 2
m_nodeCategory: 3
m_headerStyle: 0
m_headerColor: {r: 1, g: 0.4, b: 0, a: 1}
m_customNodeCategory:
m_previewPosition: 0
m_hidden: 0
m_url:
@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 39064ff186f064e41ba30cef48c769b5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/AmplifyShaderEditor/RukhankaMeshDeformation.asset
uploadId: 897522
@@ -0,0 +1,42 @@
using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
////////////////////////////////////////////////////////////////////////////////////////
namespace Rukhanka.Editor
{
[CustomEditor(typeof(AnimationCullingConfig))]
public class AnimationCullingConfigEditor : UnityEditor.Editor
{
public VisualTreeAsset inpectorXML;
////////////////////////////////////////////////////////////////////////////////////////
public override VisualElement CreateInspectorGUI()
{
var myInspector = new VisualElement();
inpectorXML.CloneTree(myInspector);
var t = (AnimationCullingConfig)target;
#if !RUKHANKA_DEBUG_INFO
var debugAndVisualization = myInspector.Q<Foldout>("debugAndVisualization");
debugAndVisualization.text += " (available only with 'RUKHANKA_DEBUG_INFO' defined)";
debugAndVisualization.SetEnabled(false);
#endif
var drawCullingVolumesToggle = myInspector.Q<PropertyField>("drawCullingVolumes");
var drawCullingVolumesChildren = myInspector.Q("drawCullingVolumesChildren");
drawCullingVolumesToggle.RegisterValueChangeCallback((newVal) => { drawCullingVolumesChildren.SetEnabled(newVal.changedProperty.boolValue); });
drawCullingVolumesChildren.SetEnabled(t.drawCullingVolumes);
var drawBBTogle = myInspector.Q<PropertyField>("drawSceneBoundingBoxes");
var drawBBChildren = myInspector.Q("drawSceneBoundingBoxesChildren");
drawBBTogle.RegisterValueChangeCallback((newVal) => { drawBBChildren.SetEnabled(newVal.changedProperty.boolValue); });
drawBBChildren.SetEnabled(t.drawSceneBoundingBoxes);
return myInspector;
}
}
}
@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 432ca46b2437f4b4a8572a4b3b6be432
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- inpectorXML: {fileID: 9197481963319205126, guid: bfd1c56abbcf01e4dbf64f0298fd6d78, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/AnimationCullingConfigEditor.cs
uploadId: 897522
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a90160f1d300fcf4ca5d14bdd6c70c4d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,48 @@
BEGIN_OPTIONS
Stackable "False"
ShaderName "Hidden/Rukhanka Animation/Deformation"
END_OPTIONS
BEGIN_PROPERTIES
[HideInInspector]_DeformedMeshIndex("Deformed Mesh Buffer Index Offset", Float) = 0
[HideInInspector]_DeformationParamsForMotionVectors("Deformation Parameters", Float) = 0
END_PROPERTIES
BEGIN_CBUFFER
float _DeformedMeshIndex;
float _DeformationParamsForMotionVectors;
END_CBUFFER
BEGIN_CODE
#if defined(DOTS_INSTANCING_ON)
// DOTS instancing definitions
UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata)
UNITY_DOTS_INSTANCED_PROP(float, _DeformedMeshIndex)
UNITY_DOTS_INSTANCED_PROP(float4, _DeformationParamsForMotionVectors)
UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata)
// DOTS instancing usage macros
#define UNITY_ACCESS_HYBRID_INSTANCED_PROP(var, type) UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(type, var)
#elif defined(UNITY_INSTANCING_ENABLED)
// Unity instancing definitions
UNITY_INSTANCING_BUFFER_START(SGPerInstanceData)
UNITY_DEFINE_INSTANCED_PROP(float, _DeformedMeshIndex)
UNITY_DEFINE_INSTANCED_PROP(float4, _DeformationParamsForMotionVectors)
UNITY_INSTANCING_BUFFER_END(SGPerInstanceData)
// Unity instancing usage macros
#define UNITY_ACCESS_HYBRID_INSTANCED_PROP(var, type) UNITY_ACCESS_INSTANCED_PROP(SGPerInstanceData, var)
#else
#define UNITY_ACCESS_HYBRID_INSTANCED_PROP(var, type) var
#endif
#include "Packages/com.rukhanka.animation/Rukhanka.Runtime/Deformation/Resources/ComputeDeformedVertex.hlsl"
void ModifyVertex(inout VertexData v, inout ExtraV2F d)
{
ComputeDeformedVertex_float(v.vertexID, v.vertex.xyz, v.normal.xyz, v.tangent.xyz, v.vertex.xyz, v.normal.xyz, v.tangent.xyz);
}
END_CODE
@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 145a0cbd410390b49ae2e8aa2611c197
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BetterShaders/StackableRukhankaDeformation.surfshader
uploadId: 897522
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 784f41e04c4d8cb4fa42ed7a8b9fbe35
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3b6240afa69eff44a936c1102da7f5f9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<ui:VisualElement style="flex-grow: 1; flex-direction: row;">
<ui:Label tabindex="-1" text="Hash" parse-escape-sequences="true" display-tooltip-when-elided="true" name="hashLabel" style="width: 75px; border-right-width: 1px; border-right-color: rgb(127, 127, 127);" />
<ui:Label tabindex="-1" text="Name" parse-escape-sequences="true" display-tooltip-when-elided="true" name="nameLabel" style="flex-grow: 1; border-right-width: 1px; border-right-color: rgb(127, 127, 127);" />
<ui:Label tabindex="-1" text="Time" parse-escape-sequences="true" display-tooltip-when-elided="true" name="timeLabel" style="width: 120px; border-right-width: 1px; border-right-color: rgb(127, 127, 127);" />
<ui:Label tabindex="-1" text="Float" parse-escape-sequences="true" display-tooltip-when-elided="true" name="floatParamLabel" style="width: 120px; border-right-width: 1px; border-right-color: rgb(127, 127, 127);" />
<ui:Label tabindex="-1" text="Int" parse-escape-sequences="true" display-tooltip-when-elided="true" name="intParamLabel" style="width: 120px; border-right-width: 1px; border-right-color: rgb(127, 127, 127);" />
<ui:Label tabindex="-1" text="String" parse-escape-sequences="true" display-tooltip-when-elided="true" name="stringParamLabel" style="width: 120px; border-right-width: 1px; border-right-color: rgb(127, 127, 127);" />
<ui:Label tabindex="-1" text="String Hash" parse-escape-sequences="true" display-tooltip-when-elided="true" name="stringHashParamLabel" style="width: 120px;" />
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: d48924796ce90364db884e5b7593aa47
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimationClipBlobInfoWindow/AnimationEventBlobInfo.uxml
uploadId: 897522
@@ -0,0 +1,192 @@
using System.Collections.Generic;
using Rukhanka.Toolbox;
using Unity.Entities;
using Unity.Mathematics;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace Rukhanka.Editor
{
public class AnimatorClipBlobInfoWindow : EditorWindow
{
[SerializeField]
private VisualTreeAsset visualTreeAsset = default;
[SerializeField]
private VisualTreeAsset trackGroupBlobInfoAsset = default;
[SerializeField]
private VisualTreeAsset trackBlobInfoAsset = default;
[SerializeField]
private VisualTreeAsset animationEventInfoAsset = default;
[SerializeField]
private VisualTreeAsset entityRefAsset = default;
internal static BlobInspector.BlobAssetInfo<AnimationClipBlob> animationClipBlob;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void CreateGUI()
{
var root = rootVisualElement;
var doc = visualTreeAsset.Instantiate();
root.Add(doc);
titleContent = new GUIContent("Rukhanka.Animation Clip Blob Info");
FillBlobInfo();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
unsafe void FillBlobInfo()
{
ref var b = ref animationClipBlob.blobAsset.Value;
var hashLabel = rootVisualElement.Q<Label>("hashLabel");
hashLabel.text = b.hash.ToString();
var nameLabel = rootVisualElement.Q<Label>("nameLabel");
var bakingTimeLabel = rootVisualElement.Q<Label>("bakingTimeLabel");
#if RUKHANKA_DEBUG_INFO
nameLabel.text = b.name.ToString();
bakingTimeLabel.text = $"{b.bakingTime:F3} sec";
#else
nameLabel.text = "-";
bakingTimeLabel.text = "-";
#endif
var lengthLabel = rootVisualElement.Q<Label>("lengthLabel");
lengthLabel.text = $"{b.length:F3} sec";
var cycleOffsetLabel = rootVisualElement.Q<Label>("cycleOffsetLabel");
cycleOffsetLabel.text = $"{b.cycleOffset}";
var loopedCheckBox = rootVisualElement.Q<Toggle>("loopedCheckBox");
loopedCheckBox.SetEnabled(false);
loopedCheckBox.value = b.looped;
var loopPoseBlendCheckBox = rootVisualElement.Q<Toggle>("loopPoseBlendCheckBox");
loopPoseBlendCheckBox.SetEnabled(false);
loopPoseBlendCheckBox.value = b.loopPoseBlend;
var sizeLabel = rootVisualElement.Q<Label>("sizeLabel");
sizeLabel.text = CommonTools.FormatMemory(animationClipBlob.blobAsset.m_data.Header->Length);
FillTrackSetFoldout("clipTracksInfoFoldout", "Clip Tracks", ref b.clipTracks);
FillTrackSetFoldout("additiveRefPoseTrackSetInfoFoldout", "Additive Ref Pose Tracks", ref b.additiveReferencePoseFrame);
ref var events = ref b.events;
var animationEventsInfoFoldout = rootVisualElement.Q<Foldout>("animationEventsInfoFoldout");
animationEventsInfoFoldout.text = $"{events.Length} Animation Events";
animationEventsInfoFoldout.Add(animationEventInfoAsset.Instantiate());
for (var i = 0; i < events.Length; ++i)
{
var eventInfo = animationEventInfoAsset.Instantiate();
if (i % 2 == 0)
eventInfo.style.backgroundColor = new StyleColor(new Color(0.3f, 0.3f, 0.3f, 1));
ref var evt = ref events[i];
var hashLabelE = eventInfo.Q<Label>("hashLabel");
var nameLabelE = eventInfo.Q<Label>("nameLabel");
var timeLabelE = eventInfo.Q<Label>("timeLabel");
var floatParamLabelE = eventInfo.Q<Label>("floatParamLabel");
var intParamLabelE = eventInfo.Q<Label>("intParamLabel");
var stringParamTabelE = eventInfo.Q<Label>("stringParamLabel");
var stringHashParamTabelE = eventInfo.Q<Label>("stringHashParamLabel");
#if RUKHANKA_DEBUG_INFO
nameLabelE.text = evt.name.ToString();
stringParamTabelE.text = evt.stringParam.ToString();
#else
nameLabelE.text = "-";
stringParamTabelE.text = "-";
#endif
hashLabelE.text = evt.nameHash.ToString();
timeLabelE.text = evt.time.ToString();
floatParamLabelE.text = evt.floatParam.ToString();
intParamLabelE.text = evt.intParam.ToString();
stringHashParamTabelE.text = evt.stringParamHash.ToString();
animationEventsInfoFoldout.Add(eventInfo);
}
var relatedEntitiesView = rootVisualElement.Q("relatedEntitiesView");
var relatedEntitieLabel = rootVisualElement.Q<Label>("relatedEntitiesLabel");
PopulateReferencedEntities(relatedEntitiesView, relatedEntitieLabel, animationClipBlob.refEntities, entityRefAsset);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
internal static void PopulateReferencedEntities(VisualElement container, Label containerLabel, List<Entity> entities, VisualTreeAsset entryAsset)
{
containerLabel.text = $"{entities.Count} Related Entities";
for (var i = 0; i < entities.Count; ++i)
{
var e = entities[i];
var element = entryAsset.Instantiate();
var entityIDLabel = element.Q<Label>("entityIDLabel");
var nameLabel = element.Q<Label>("nameLabel");
entityIDLabel.text = e.ToString();
if (BlobInspector.currentWorld != null)
nameLabel.text = BlobInspector.currentWorld.EntityManager.GetName(e);
container.Add(element);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void FillTrackSetFoldout(string foldoutName, string caption, ref TrackSet ts)
{
var trackSetInfoFoldout = rootVisualElement.Q<Foldout>(foldoutName);
trackSetInfoFoldout.text = $"{ts.trackGroups.Length} {caption}";
for (int i = 0; i < ts.trackGroups.Length - 1; ++i)
{
var tgRange = new int2(ts.trackGroups[i], ts.trackGroups[i + 1]);
var trackGroupInfo = trackGroupBlobInfoAsset.Instantiate();
if (i % 2 == 0)
trackGroupInfo.style.backgroundColor = new StyleColor(new Color(0.3f, 0.3f, 0.3f, 1));
var trackListFoldout = trackGroupInfo.Q<Foldout>("trackList");
#if RUKHANKA_DEBUG_INFO
var tgDebugInfo = ts.trackGroupDebugInfo[i];
trackListFoldout.text = $"[{i} {tgDebugInfo.name} Hash: {tgDebugInfo.hash:X}] Track Group Start:Length [{tgRange.x}:{tgRange.y - tgRange.x}]";
#else
trackListFoldout.text = $"[{i}] Track Group Start:Length [{tgRange.x}:{tgRange.y - tgRange.x}]";
#endif
var trackInfoHeader = trackBlobInfoAsset.Instantiate();
trackListFoldout.Add(trackInfoHeader);
for (var l = tgRange.x; l < tgRange.y; ++l)
{
Track t = ts.tracks[l];
var trackInfo = trackBlobInfoAsset.Instantiate();
var hashLabel = trackInfo.Q<Label>("hashLabel");
var nameLabel = trackInfo.Q<Label>("nameLabel");
var bindingTypeLabel = trackInfo.Q<Label>("bindingTypeLabel");
var channelIndexLabel = trackInfo.Q<Label>("channelIndexLabel");
var keyFrameInfoLabel = trackInfo.Q<Label>("keyFrameInfoLabel");
#if RUKHANKA_DEBUG_INFO
nameLabel.text = $"{t.name.ToString()}";
#else
nameLabel.text = "-";
#endif
hashLabel.text = t.props.ToString("X");
bindingTypeLabel.text = t.bindingType.ToString();
channelIndexLabel.text = t.channelIndex.ToString();
keyFrameInfoLabel.text = $"Start:Length [{t.keyFrameRange.x}:{t.keyFrameRange.y}]";
trackListFoldout.Add(trackInfo);
}
trackSetInfoFoldout.Add(trackGroupInfo);
}
}
}
}
@@ -0,0 +1,24 @@
fileFormatVersion: 2
guid: 28a266621693c00469972be15f47a2d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- m_ViewDataDictionary: {instanceID: 0}
- visualTreeAsset: {fileID: 9197481963319205126, guid: 547be161a75c99a418c17010dda0234c, type: 3}
- trackGroupBlobInfoAsset: {fileID: 9197481963319205126, guid: 07660a014a4d1f24abec619013960db9, type: 3}
- trackBlobInfoAsset: {fileID: 9197481963319205126, guid: 63bc41214c99e734aa5adc4a69340137, type: 3}
- animationEventInfoAsset: {fileID: 9197481963319205126, guid: d48924796ce90364db884e5b7593aa47, type: 3}
- entityRefAsset: {fileID: 9197481963319205126, guid: dba65a86cda2861448a7ae7891041b16, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimationClipBlobInfoWindow/AnimatorClipBlobInfoWindow.cs
uploadId: 897522
@@ -0,0 +1,5 @@
.custom-label {
font-size: 20px;
-unity-font-style: bold;
color: rgb(68, 138, 255);
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: a257fa72e71cbc9458084aa8141bc9e2
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimationClipBlobInfoWindow/AnimatorClipBlobInfoWindow.uss
uploadId: 897522
@@ -0,0 +1,34 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<Style src="project://database/Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimationClipBlobInfoWindow/AnimatorClipBlobInfoWindow.uss?fileID=7433441132597879392&amp;guid=a257fa72e71cbc9458084aa8141bc9e2&amp;type=3#AnimatorClipBlobInfoWindow" />
<ui:VisualElement style="flex-grow: 1; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; flex-shrink: 1;">
<ui:VisualElement style="flex-grow: 0; flex-direction: row; flex-shrink: 0;">
<ui:VisualElement style="flex-grow: 0; width: 143px; flex-shrink: 0;">
<ui:Label tabindex="-1" text="Hash128:" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" text="Name:" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" text="Length:" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" text="Cycle Offset:" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" text="Looped:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Loop Pose Blend:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Baking TIme:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Size:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
</ui:VisualElement>
<ui:VisualElement style="flex-grow: 1;">
<ui:Label tabindex="-1" text="LabelLabelLabelLabelLabelLabelLabelLabelLabel" parse-escape-sequences="true" display-tooltip-when-elided="true" name="hashLabel" />
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="nameLabel" />
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="lengthLabel" />
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="cycleOffsetLabel" />
<ui:Toggle focusable="false" name="loopedCheckBox" style="margin-top: 0; margin-bottom: 0; margin-right: 0; margin-left: 0;" />
<ui:Toggle focusable="false" name="loopPoseBlendCheckBox" style="visibility: visible; display: flex; margin-top: 0; margin-bottom: 0; margin-right: 0; margin-left: 0;" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="bakingTimeLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="sizeLabel" />
</ui:VisualElement>
</ui:VisualElement>
<ui:ScrollView scroll-deceleration-rate="0,135" elasticity="0,1" style="flex-grow: 1; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin-top: 5px;">
<ui:Foldout text="Foldout" name="clipTracksInfoFoldout" value="false" style="align-items: stretch;" />
<ui:Foldout text="Foldout" value="false" name="additiveRefPoseTrackSetInfoFoldout" />
<ui:Foldout text="Foldout" value="false" name="animationEventsInfoFoldout" />
</ui:ScrollView>
<ui:Label tabindex="-1" text="Related Entities" parse-escape-sequences="true" display-tooltip-when-elided="true" name="relatedEntitiesLabel" style="padding-top: 10px;" />
<ui:ScrollView scroll-deceleration-rate="0,135" elasticity="0,1" name="relatedEntitiesView" style="flex-grow: 1; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127); border-top-width: 0; border-right-width: 0; border-bottom-width: 0; border-left-width: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px;" />
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 547be161a75c99a418c17010dda0234c
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimationClipBlobInfoWindow/AnimatorClipBlobInfoWindow.uxml
uploadId: 897522
@@ -0,0 +1,9 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<ui:VisualElement style="flex-grow: 1; flex-direction: row;">
<ui:Label tabindex="-1" text="Hash (properties)" parse-escape-sequences="true" display-tooltip-when-elided="true" name="hashLabel" style="flex-grow: 0; border-right-color: rgb(127, 127, 127); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; align-self: auto; width: 282px;" />
<ui:Label tabindex="-1" text="Name" parse-escape-sequences="true" display-tooltip-when-elided="true" name="nameLabel" style="flex-grow: 1; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127); border-right-width: 1px; width: 260px;" />
<ui:Label tabindex="-1" text="Binding Type" parse-escape-sequences="true" display-tooltip-when-elided="true" name="bindingTypeLabel" style="flex-grow: 0; align-self: auto; width: 210px; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127); border-right-width: 1px;" />
<ui:Label tabindex="-1" text="Channel Index" parse-escape-sequences="true" display-tooltip-when-elided="true" name="channelIndexLabel" style="flex-grow: 0; align-self: auto; width: 210px; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127);" />
<ui:Label tabindex="-1" text="KeyFrame Info" parse-escape-sequences="true" display-tooltip-when-elided="true" name="keyFrameInfoLabel" style="flex-grow: 0; align-self: auto; width: 210px;" />
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 63bc41214c99e734aa5adc4a69340137
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimationClipBlobInfoWindow/TrackBlobInfo.uxml
uploadId: 897522
@@ -0,0 +1,3 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<ui:Foldout text="Foldout" name="trackList" value="false" />
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 07660a014a4d1f24abec619013960db9
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimationClipBlobInfoWindow/TrackGroupBlobInfo.uxml
uploadId: 897522
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6c504c21fed20414bb9b185131c8359b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,325 @@
using System.Collections.Generic;
using Rukhanka;
using Rukhanka.Editor;
using Rukhanka.Toolbox;
using Unity.Entities;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace Rukhanka.Editor
{
public class AnimatorControllerBlobInfoWindow : EditorWindow
{
[SerializeField]
private VisualTreeAsset visualTreeAsset = default;
[SerializeField]
private VisualTreeAsset entityRefAsset = default;
[SerializeField]
private VisualTreeAsset layerBlobInfoAsset = default;
[SerializeField]
private VisualTreeAsset stateBlobInfoAsset = default;
[SerializeField]
private VisualTreeAsset transitionBlobInfoAsset = default;
[SerializeField]
private VisualTreeAsset conditionBlobInfoAsset = default;
[SerializeField]
private VisualTreeAsset listViewLabelAsset = default;
internal static BlobInspector.BlobAssetInfo<ControllerBlob> controllerBlob;
readonly string nameColumnName = "name";
readonly string hashColumnName = "hash";
readonly string defValColumnName = "defaultValue";
readonly string typeColumnName = "type";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class ParameterListItem
{
public string name;
public uint hash;
public string paramValue;
public ControllerParameterType paramType;
public ParameterListItem(ref ParameterBlob pb)
{
name = "-";
#if RUKHANKA_DEBUG_INFO
name = pb.name.ToString();
#endif
hash = pb.hash;
paramValue = GetParameterValueAsString(ref pb);
paramType = pb.type;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void CreateGUI()
{
var root = rootVisualElement;
var doc = visualTreeAsset.Instantiate();
root.Add(doc);
titleContent = new GUIContent("Rukhanka.Animation Controller Blob Info");
FillBlobInfo();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void InitMultiListView(VisualElement root, List<ParameterListItem> srcData)
{
var paramListView = root.Q<MultiColumnListView>("parametersList");
paramListView.itemsSource = srcData;
paramListView.columns[nameColumnName].makeCell = () => listViewLabelAsset.Instantiate().Q<Label>("label");
paramListView.columns[nameColumnName].bindCell = (VisualElement ve, int index) => (ve as Label).text = srcData[index].name;
paramListView.columns[hashColumnName].makeCell = () => listViewLabelAsset.Instantiate().Q<Label>("label");
paramListView.columns[hashColumnName].bindCell = (VisualElement ve, int index) => (ve as Label).text = srcData[index].hash.ToString("X");
paramListView.columns[defValColumnName].makeCell = () => listViewLabelAsset.Instantiate().Q<Label>("label");
paramListView.columns[defValColumnName].bindCell = (VisualElement ve, int index) => (ve as Label).text = srcData[index].paramValue;
paramListView.columns[typeColumnName].makeCell = () => listViewLabelAsset.Instantiate().Q<Label>("label");
paramListView.columns[typeColumnName].bindCell = (VisualElement ve, int index) => (ve as Label).text = srcData[index].paramType.ToString();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
unsafe void FillBlobInfo()
{
ref var b = ref controllerBlob.blobAsset.Value;
var hashLabel = rootVisualElement.Q<Label>("hashLabel");
hashLabel.text = b.hash.ToString();
var nameLabel = rootVisualElement.Q<Label>("nameLabel");
var bakingTimeLabel = rootVisualElement.Q<Label>("bakingTimeLabel");
#if RUKHANKA_DEBUG_INFO
nameLabel.text = b.name.ToString();
bakingTimeLabel.text = $"{b.bakingTime:F3} sec";
#else
nameLabel.text = "-";
bakingTimeLabel.text = "-";
#endif
var sizeLabel = rootVisualElement.Q<Label>("sizeLabel");
sizeLabel.text = CommonTools.FormatMemory(controllerBlob.blobAsset.m_data.Header->Length);
ref var blobParameters = ref b.parameters;
var srcData = new List<ParameterListItem>();
for (int i = 0; i < blobParameters.Length; ++i)
{
ref var p = ref blobParameters[i];
var li = new ParameterListItem(ref p);
srcData.Add(li);
}
InitMultiListView(rootVisualElement, srcData);
// Referenced entities view
var relatedEntitiesView = rootVisualElement.Q("relatedEntitiesView");
var relatedEntitieLabel = rootVisualElement.Q<Label>("relatedEntitiesLabel");
AnimatorClipBlobInfoWindow.PopulateReferencedEntities(relatedEntitiesView, relatedEntitieLabel, controllerBlob.refEntities, entityRefAsset);
FillControllerLayersList(ref b);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void FillControllerLayersList(ref ControllerBlob cb)
{
var layersFoldout = rootVisualElement.Q<Foldout>("layersFoldout");
layersFoldout.text = $"{cb.layers.Length} Layers";
for (var i = 0; i < cb.layers.Length; ++i)
{
ref var layer = ref cb.layers[i];
var uiEntry = layerBlobInfoAsset.Instantiate();
var rootFoldout = uiEntry.Q<Foldout>("layerInfoFoldout");
var blendModeLabel = uiEntry.Q<Label>("blendModeLabel");
var defaultStateLabel = uiEntry.Q<Label>("defaultStateLabel");
var initialWeightLabel = uiEntry.Q<Label>("initialWeightLabel");
var avatarMaskHashLabel = uiEntry.Q<Label>("avatarMaskHashLabel");
rootFoldout.text = $"[{i}]";
#if RUKHAHKA_DEBUG_INFO
rootFoldout.text += $"' {layer.name.ToString()}'";
if (layer.defaultStateIndex >= 0)
defaultStateLabel.text = layer.states[layer.defaultStateIndex].name.ToString();
#else
defaultStateLabel.text = $"[{layer.defaultStateIndex.ToString()}]";
#endif
blendModeLabel.text = layer.blendingMode.ToString();
initialWeightLabel.text = layer.initialWeight.ToString();
avatarMaskHashLabel.text = layer.avatarMaskBlobHash.ToString();
FillLayerStatesInfo(ref layer, ref cb, uiEntry);
layersFoldout.Add(uiEntry);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void FillLayerStatesInfo(ref LayerBlob lb, ref ControllerBlob cb, VisualElement root)
{
var foldout = root.Q<Foldout>("statesFoldout");
foldout.text = $"{lb.states.Length} States";
for (var i = 0; i < lb.states.Length; ++i)
{
ref var state = ref lb.states[i];
var uiEntry = stateBlobInfoAsset.Instantiate();
var rootFoldout = uiEntry.Q<Foldout>("stateInfoFoldout");
var nameHashLabel = uiEntry.Q<Label>("nameHashLabel");
var tagLabel = uiEntry.Q<Label>("tagLabel");
var tagHashLabel = uiEntry.Q<Label>("tagHashLabel");
var speedLabel = uiEntry.Q<Label>("speedLabel");
var speedParamIdxLabel = uiEntry.Q<Label>("speedParamIdxLabel");
var timeParamIdxLabel = uiEntry.Q<Label>("timeParamIdxLabel");
var cycleOffsetLabel = uiEntry.Q<Label>("cycleOffsetLabel");
var cycleOffsetParamIdxLabel = uiEntry.Q<Label>("cycleOffsetParamIdxLabel");
rootFoldout.text = $"[{i}]";
nameHashLabel.text = state.hash.ToString();
#if RUKHANKA_DEBUG_INFO
rootFoldout.text += $" '{state.name.ToString()}'";
tagLabel.text = state.tag.ToString();
#else
tagLabel.text = "-";
#endif
tagHashLabel.text = state.tagHash.ToString();
speedLabel.text = state.speed.ToString();
speedParamIdxLabel.text = $"[{state.speedMultiplierParameterIndex}]";
#if RUKHANKA_DEBUG_INFO
if (state.speedMultiplierParameterIndex >= 0)
speedParamIdxLabel.text += $" '{cb.parameters[state.speedMultiplierParameterIndex].name.ToString()}'";
#endif
timeParamIdxLabel.text = $"[{state.timeParameterIndex}]";
#if RUKHANKA_DEBUG_INFO
if (state.timeParameterIndex >= 0)
timeParamIdxLabel.text += $" '{cb.parameters[state.timeParameterIndex].name.ToString()}'";
#endif
cycleOffsetLabel.text = state.cycleOffset.ToString();
cycleOffsetParamIdxLabel.text = $"[{state.cycleOffsetParameterIndex}]";
#if RUKHANKA_DEBUG_INFO
if (state.cycleOffsetParameterIndex >= 0)
cycleOffsetParamIdxLabel.text = $" '{cb.parameters[state.cycleOffsetParameterIndex].name.ToString()}'";
#endif
FillTransitionsInfo(ref state, ref lb, ref cb, uiEntry);
foldout.Add(uiEntry);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void FillTransitionsInfo(ref StateBlob sb, ref LayerBlob lb, ref ControllerBlob cb, VisualElement root)
{
var foldout = root.Q<Foldout>("transitionsFoldout");
foldout.text = $"{sb.transitions.Length} Transitions";
for (var i = 0; i < sb.transitions.Length; ++i)
{
ref var tr = ref sb.transitions[i];
var uiEntry = transitionBlobInfoAsset.Instantiate();
var rootFoldout = uiEntry.Q<Foldout>("transitionInfoFoldout");
var nameHashLabel = uiEntry.Q<Label>("nameHashLabel");
var targetStateIDLabel = uiEntry.Q<Label>("targetStateIDLabel");
var durationLabel = uiEntry.Q<Label>("durationLabel");
var exitTimeLabel = uiEntry.Q<Label>("exitTimeLabel");
var offsetLabel = uiEntry.Q<Label>("offsetLabel");
var hasExitTimeCheckbox = uiEntry.Q<Toggle>("hasExitTimeCheckbox");
var hasFixedDurationCheckbox = uiEntry.Q<Toggle>("hasFixedDurationCheckbox");
nameHashLabel.text = tr.hash.ToString();
targetStateIDLabel.text = $"[{tr.targetStateId.ToString()}]";
rootFoldout.text = $"[{i}]";
#if RUKHANKA_DEBUG_INFO
rootFoldout.text += $" '{tr.name.ToString()}'";
if (tr.targetStateId >= 0)
targetStateIDLabel.text += $" '{lb.states[tr.targetStateId].name.ToString()}'";
#endif
durationLabel.text = tr.duration.ToString();
exitTimeLabel.text = tr.exitTime.ToString();
offsetLabel.text = tr.offset.ToString();
hasExitTimeCheckbox.value = tr.hasExitTime;
hasExitTimeCheckbox.SetEnabled(false);
hasFixedDurationCheckbox.value = tr.hasFixedDuration;
hasFixedDurationCheckbox.SetEnabled(false);
FillConditionsInfo(ref tr, ref cb, uiEntry);
foldout.Add(uiEntry);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void FillConditionsInfo(ref TransitionBlob tb, ref ControllerBlob cb, VisualElement root)
{
var foldout = root.Q<Foldout>("conditionsFoldout");
foldout.text = $"{tb.conditions.Length} Conditions";
for (var i = 0; i < tb.conditions.Length; ++i)
{
ref var conditionBlob = ref tb.conditions[i];
var uiEntry = conditionBlobInfoAsset.Instantiate();
var conditionLabel = uiEntry.Q<Label>("conditionLabel");
conditionLabel.text = BuildConditionString(ref conditionBlob, ref cb.parameters);
foldout.Add(uiEntry);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
string BuildConditionString(ref ConditionBlob cb, ref BlobArray<ParameterBlob> pb)
{
ref var param = ref pb[cb.paramIdx];
#if RUKHANKA_DEBUG_INFO
var paramString = $"'{param.name.ToString()}'";
#else
var paramString = $"'{param.hash.ToString()}'";
#endif
var opString = "";
switch (cb.conditionMode)
{
case AnimatorConditionMode.Equals: opString = " =="; break;
case AnimatorConditionMode.Greater: opString = " >"; break;
case AnimatorConditionMode.If: opString = " == true"; break;
case AnimatorConditionMode.Less: opString = " <"; break;
case AnimatorConditionMode.IfNot: opString = " == false"; break;
case AnimatorConditionMode.NotEqual: opString = " !="; break;
}
var thresholdString = "";
switch (param.type)
{
case ControllerParameterType.Float: thresholdString = " " + cb.threshold.floatValue; break;
case ControllerParameterType.Int: thresholdString = " " + cb.threshold.intValue; break;
}
var rv = paramString + opString + thresholdString;
return rv;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static string GetParameterValueAsString(ref ParameterBlob pb) => pb.type switch
{
ControllerParameterType.Bool => pb.defaultValue.boolValue ? "true" : "false",
ControllerParameterType.Trigger => pb.defaultValue.boolValue ? "true" : "false",
ControllerParameterType.Float => pb.defaultValue.floatValue.ToString(),
ControllerParameterType.Int => pb.defaultValue.intValue.ToString(),
_ => ""
};
}
}
@@ -0,0 +1,27 @@
fileFormatVersion: 2
guid: 8c3c09e83942e314cbdad5486d3edde7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- m_ViewDataDictionary: {instanceID: 0}
- visualTreeAsset: {fileID: 9197481963319205126, guid: 021574c1f4ac2d84893abf85ab6abf69, type: 3}
- controllerParameterBlobInfoAsset: {fileID: 9197481963319205126, guid: 105507b7bae5e594298939c9040e9947, type: 3}
- entityRefAsset: {fileID: 9197481963319205126, guid: dba65a86cda2861448a7ae7891041b16, type: 3}
- layerBlobInfoAsset: {fileID: 9197481963319205126, guid: 20cf45a045031f0449037db6abab3240, type: 3}
- stateBlobInfoAsset: {fileID: 9197481963319205126, guid: aaab1c8abd35b8d458d1d9b52e28065a, type: 3}
- transitionBlobInfoAsset: {fileID: 9197481963319205126, guid: c3451fa4841d2604c955112ea35a0456, type: 3}
- conditionBlobInfoAsset: {fileID: 9197481963319205126, guid: f3041ef93fd36cc42a5e9f6b1bb2cb3c, type: 3}
- listViewLabelAsset: {fileID: 9197481963319205126, guid: 5460ee29626c92b47a703070f7c106ba, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimatorControllerBlobInfoWindow/AnimatorControllerBlobInfoWindow.cs
uploadId: 897522
@@ -0,0 +1,5 @@
.custom-label {
font-size: 20px;
-unity-font-style: bold;
color: rgb(68, 138, 255);
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: d13a537d15bd7bc4c8f28adebfcf734d
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimatorControllerBlobInfoWindow/AnimatorControllerBlobInfoWindow.uss
uploadId: 897522
@@ -0,0 +1,32 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<Style src="project://database/Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimatorControllerBlobInfoWindow/AnimatorControllerBlobInfoWindow.uss?fileID=7433441132597879392&amp;guid=d13a537d15bd7bc4c8f28adebfcf734d&amp;type=3#AnimatorControllerBlobInfoWindow" />
<ui:VisualElement style="flex-grow: 1; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px;">
<ui:VisualElement style="flex-grow: 0; flex-direction: row; flex-shrink: 0;">
<ui:VisualElement style="flex-grow: 0; width: 143px; flex-shrink: 0;">
<ui:Label tabindex="-1" text="Hash128:" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" text="Name:" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" text="Baking TIme:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Size:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
</ui:VisualElement>
<ui:VisualElement style="flex-grow: 1;">
<ui:Label tabindex="-1" text="LabelLabelLabelLabelLabelLabelLabelLabelLabel" parse-escape-sequences="true" display-tooltip-when-elided="true" name="hashLabel" />
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="nameLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="bakingTimeLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="sizeLabel" />
</ui:VisualElement>
</ui:VisualElement>
<ui:ScrollView scroll-deceleration-rate="0,135" elasticity="0,1" style="flex-grow: 1; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin-top: 5px; padding-top: 3px; padding-right: 0; padding-bottom: 3px; padding-left: 0;">
<ui:MultiColumnListView name="parametersList" show-alternating-row-backgrounds="ContentOnly" show-foldout-header="true" header-title="Controller Parameters" allow-add="false" allow-remove="false" show-border="true" selection-type="None" show-bound-collection-size="true" virtualization-method="FixedHeight" style="margin-top: 4px; margin-right: 4px; margin-bottom: 4px; margin-left: 4px;">
<ui:Columns stretch-mode="GrowAndFill" resize-preview="false">
<ui:Column stretchable="true" title="Hash" name="hash" />
<ui:Column title="Name" stretchable="true" name="name" />
<ui:Column title="Type" stretchable="true" name="type" />
<ui:Column title="Default Value" stretchable="true" name="defaultValue" />
</ui:Columns>
</ui:MultiColumnListView>
<ui:Foldout text="Foldout" value="false" name="layersFoldout" />
</ui:ScrollView>
<ui:Label tabindex="-1" text="Related Entities" parse-escape-sequences="true" display-tooltip-when-elided="true" name="relatedEntitiesLabel" style="padding-top: 10px;" />
<ui:ScrollView scroll-deceleration-rate="0,135" elasticity="0,1" name="relatedEntitiesView" style="flex-grow: 1; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127); border-top-width: 0; border-right-width: 0; border-bottom-width: 0; border-left-width: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px;" />
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 021574c1f4ac2d84893abf85ab6abf69
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimatorControllerBlobInfoWindow/AnimatorControllerBlobInfoWindow.uxml
uploadId: 897522
@@ -0,0 +1,10 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:VisualElement style="flex-grow: 0; flex-direction: row;">
<ui:VisualElement style="flex-grow: 0; width: 106px; flex-shrink: 0;">
<ui:Label tabindex="-1" text="Condition:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
</ui:VisualElement>
<ui:VisualElement style="flex-grow: 1;">
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="conditionLabel" />
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: f3041ef93fd36cc42a5e9f6b1bb2cb3c
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimatorControllerBlobInfoWindow/AnimatorControllerConditionBlobEntry.uxml
uploadId: 897522
@@ -0,0 +1,19 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:Foldout text="Layers" name="layerInfoFoldout" value="false" style="border-top-width: 1px; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127);">
<ui:VisualElement style="flex-grow: 0; flex-direction: row;">
<ui:VisualElement style="flex-grow: 0; width: 143px; flex-shrink: 0;">
<ui:Label tabindex="-1" text="Blend Mode:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Default State:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Initial Weight:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Avatar Mask Hash:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
</ui:VisualElement>
<ui:VisualElement style="flex-grow: 1;">
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="blendModeLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="defaultStateLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="initialWeightLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="avatarMaskHashLabel" />
</ui:VisualElement>
</ui:VisualElement>
<ui:Foldout text="Transitions" name="statesFoldout" value="false" />
</ui:Foldout>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 20cf45a045031f0449037db6abab3240
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimatorControllerBlobInfoWindow/AnimatorControllerLayerBlobEntry.uxml
uploadId: 897522
@@ -0,0 +1,8 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:VisualElement style="flex-grow: 1; flex-direction: row;">
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="hashLabel" style="width: 141px; border-right-color: rgb(127, 127, 127); border-right-width: 1px; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;" />
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="nameLabel" style="flex-grow: 1; border-right-color: rgb(127, 127, 127); border-right-width: 1px;" />
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="typeLabel" style="flex-grow: 1; border-right-color: rgb(127, 127, 127); border-right-width: 1px;" />
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="defaultValueLabel" style="width: 104px;" />
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 105507b7bae5e594298939c9040e9947
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimatorControllerBlobInfoWindow/AnimatorControllerParameterBlobEntry.uxml
uploadId: 897522
@@ -0,0 +1,27 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:Foldout text="Foldout" name="stateInfoFoldout" value="false" style="border-top-width: 1px; border-top-color: rgb(127, 127, 127);">
<ui:VisualElement style="flex-grow: 0; flex-direction: row;">
<ui:VisualElement style="flex-grow: 0; width: 184px; flex-shrink: 0;">
<ui:Label tabindex="-1" text="Name Hash:" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" text="Tag:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Tag Hash:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Speed:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Speed Param Index:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Time Param Index:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Cycle Offset:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Cycle Offset Param Index:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
</ui:VisualElement>
<ui:VisualElement style="flex-grow: 1;">
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="nameHashLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="tagLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="tagHashLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="speedLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="speedParamIdxLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="timeParamIdxLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="cycleOffsetLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="cycleOffsetParamIdxLabel" />
</ui:VisualElement>
</ui:VisualElement>
<ui:Foldout text="Transitions" name="transitionsFoldout" value="false" />
</ui:Foldout>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: aaab1c8abd35b8d458d1d9b52e28065a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimatorControllerBlobInfoWindow/AnimatorControllerStateBlobEntry.uxml
uploadId: 897522
@@ -0,0 +1,25 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:Foldout text="Foldout" name="transitionInfoFoldout" value="false" style="border-top-width: 1px; border-top-color: rgb(127, 127, 127);">
<ui:VisualElement style="flex-grow: 0; flex-direction: row;">
<ui:VisualElement style="flex-grow: 0; width: 184px; flex-shrink: 0;">
<ui:Label tabindex="-1" text="Name Hash:" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" text="Target State ID:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Duration:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Exit Time:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Offset:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Has Exit Time:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Has Fixed Duration:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
</ui:VisualElement>
<ui:VisualElement style="flex-grow: 1;">
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="nameHashLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="targetStateIDLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="durationLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="exitTimeLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="offsetLabel" />
<ui:Toggle name="hasExitTimeCheckbox" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;" />
<ui:Toggle name="hasFixedDurationCheckbox" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;" />
</ui:VisualElement>
</ui:VisualElement>
<ui:Foldout text="Conditions" name="conditionsFoldout" value="false" />
</ui:Foldout>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: c3451fa4841d2604c955112ea35a0456
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AnimatorControllerBlobInfoWindow/AnimatorControllerTransitionBlobEntry.uxml
uploadId: 897522
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9fde67a8740cb08419e256a8ff77bb69
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,106 @@
using Rukhanka.Toolbox;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace Rukhanka.Editor
{
public class AvatarMaskInfoWindow : EditorWindow
{
[SerializeField]
private VisualTreeAsset visualTreeAsset = default;
[SerializeField]
private VisualTreeAsset includedBoneNameInfoAsset = default;
[SerializeField]
private VisualTreeAsset entityRefAsset = default;
internal static BlobInspector.BlobAssetInfo<AvatarMaskBlob> avatarMaskBlob;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void CreateGUI()
{
var root = rootVisualElement;
var doc = visualTreeAsset.Instantiate();
root.Add(doc);
titleContent = new GUIContent("Rukhanka.Animation Avatar Mask Blob Info");
FillAvatarMaskInfo();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
unsafe void FillAvatarMaskInfo()
{
ref var b = ref avatarMaskBlob.blobAsset.Value;
var hashLabel = rootVisualElement.Q<Label>("hashLabel");
hashLabel.text = b.hash.ToString();
var nameLabel = rootVisualElement.Q<Label>("nameLabel");
var bakingTimeLabel = rootVisualElement.Q<Label>("bakingTimeLabel");
#if RUKHANKA_DEBUG_INFO
nameLabel.text = b.name.ToString();
bakingTimeLabel.text = $"{b.bakingTime:F3} sec";
#else
nameLabel.text = "-";
bakingTimeLabel.text = "-";
#endif
var sizeLabel = rootVisualElement.Q<Label>("sizeLabel");
sizeLabel.text = CommonTools.FormatMemory(avatarMaskBlob.blobAsset.m_data.Header->Length);
// Fill included bone names
#if RUKHANKA_DEBUG_INFO
ref var boneNames = ref b.includedBoneNames;
var includedBonesFoldout = rootVisualElement.Q<Foldout>("includedBonesFoldout");
includedBonesFoldout.text = $"{boneNames.Length} Included Bones";
for (var i = 0; i < boneNames.Length; ++i)
{
ref var bn = ref boneNames[i];
var includeBodyPartUIEntry = includedBoneNameInfoAsset.Instantiate();
if (i % 2 == 0)
includeBodyPartUIEntry.style.backgroundColor = new StyleColor(new Color(0.3f, 0.3f, 0.3f, 1));
var nameLabelP = includeBodyPartUIEntry.Q<Label>("nameLabel");
nameLabelP.text = bn.ToString();
includedBonesFoldout.Add(includeBodyPartUIEntry);
}
#endif
// Fill included human body parts names
var humanBodyPartsFoldout = rootVisualElement.Q<Foldout>("humanBodyPartsFoldout");
var totalPartsCount = 0;
var humanBodyPartsCount = (int)AvatarMaskBodyPart.LastBodyPart;
for (int i = 0; i < humanBodyPartsCount; ++i)
{
var ambp = (AvatarMaskBodyPart)i;
if ((b.humanBodyPartsAvatarMask & 1 << i) != 0)
{
var humanBodyPartUIEntry = includedBoneNameInfoAsset.Instantiate();
if (i % 2 == 0)
humanBodyPartUIEntry.style.backgroundColor = new StyleColor(new Color(0.3f, 0.3f, 0.3f, 1));
var nameLabelP = humanBodyPartUIEntry.Q<Label>("nameLabel");
var hashLabelP = humanBodyPartUIEntry.Q<Label>("hashLabel");
nameLabelP.text = ambp.ToString();
hashLabelP.text = i.ToString();
humanBodyPartsFoldout.Add(humanBodyPartUIEntry);
totalPartsCount++;
}
}
humanBodyPartsFoldout.text = $"{totalPartsCount} Included Human Body Parts";
// Referenced entities view
var relatedEntitiesView = rootVisualElement.Q("relatedEntitiesView");
var relatedEntitieLabel = rootVisualElement.Q<Label>("relatedEntitiesLabel");
AnimatorClipBlobInfoWindow.PopulateReferencedEntities(relatedEntitiesView, relatedEntitieLabel, avatarMaskBlob.refEntities, entityRefAsset);
}
}
}
@@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 294ab3a893cd38640a0012da8d97c839
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- m_ViewDataDictionary: {instanceID: 0}
- visualTreeAsset: {fileID: 9197481963319205126, guid: 6ca489fd9028a3142bff9e42f2868ae3, type: 3}
- includedBoneNameInfoAsset: {fileID: 9197481963319205126, guid: 6359bcda08d7e544f9f48ab95859de29, type: 3}
- entityRefAsset: {fileID: 9197481963319205126, guid: dba65a86cda2861448a7ae7891041b16, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AvatarMaskInfoWindow/AvatarMaskInfoWindow.cs
uploadId: 897522
@@ -0,0 +1,5 @@
.custom-label {
font-size: 20px;
-unity-font-style: bold;
color: rgb(68, 138, 255);
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 16713f8956625e44fad249eca2490acd
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AvatarMaskInfoWindow/AvatarMaskInfoWindow.uss
uploadId: 897522
@@ -0,0 +1,25 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<Style src="project://database/Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AvatarMaskInfoWindow/AvatarMaskInfoWindow.uss?fileID=7433441132597879392&amp;guid=16713f8956625e44fad249eca2490acd&amp;type=3#AvatarMaskInfoWindow" />
<ui:VisualElement style="flex-grow: 1; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px;">
<ui:VisualElement style="flex-grow: 0; flex-direction: row; flex-shrink: 0;">
<ui:VisualElement style="flex-grow: 0; width: 143px; flex-shrink: 0;">
<ui:Label tabindex="-1" text="Hash128:" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" text="Name:" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" text="Baking TIme:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
<ui:Label tabindex="-1" text="Size:" parse-escape-sequences="true" display-tooltip-when-elided="true" enable-rich-text="true" />
</ui:VisualElement>
<ui:VisualElement style="flex-grow: 1;">
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="hashLabel" />
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="nameLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="bakingTimeLabel" />
<ui:Label tabindex="-1" text="asda" parse-escape-sequences="true" display-tooltip-when-elided="true" name="sizeLabel" />
</ui:VisualElement>
</ui:VisualElement>
<ui:ScrollView scroll-deceleration-rate="0,135" elasticity="0,1" style="flex-grow: 1; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin-top: 5px; padding-top: 3px; padding-right: 0; padding-bottom: 3px; padding-left: 0;">
<ui:Foldout text="Foldout" name="includedBonesFoldout" value="false" style="align-items: stretch;" />
<ui:Foldout text="Foldout" value="false" name="humanBodyPartsFoldout" />
</ui:ScrollView>
<ui:Label tabindex="-1" text="Related Entities" parse-escape-sequences="true" display-tooltip-when-elided="true" name="relatedEntitiesLabel" style="padding-top: 10px;" />
<ui:ScrollView scroll-deceleration-rate="0,135" elasticity="0,1" name="relatedEntitiesView" style="flex-grow: 1; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127); border-top-width: 0; border-right-width: 0; border-bottom-width: 0; border-left-width: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px;" />
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 6ca489fd9028a3142bff9e42f2868ae3
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AvatarMaskInfoWindow/AvatarMaskInfoWindow.uxml
uploadId: 897522
@@ -0,0 +1,6 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:VisualElement style="flex-grow: 1; flex-direction: row;">
<ui:Label tabindex="-1" parse-escape-sequences="true" display-tooltip-when-elided="true" name="hashLabel" style="width: 332px; border-right-color: rgb(127, 127, 127); border-right-width: 1px;" />
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="nameLabel" style="flex-grow: 1;" />
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 6359bcda08d7e544f9f48ab95859de29
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/AvatarMaskInfoWindow/IncludedBoneNameInfoAsset.uxml
uploadId: 897522
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9a8b46e6832e8e64b9ec5480be87849f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,6 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:VisualElement style="flex-grow: 1; flex-direction: row;">
<ui:Label tabindex="-1" text="Path" parse-escape-sequences="true" display-tooltip-when-elided="true" name="pathLabel" style="flex-grow: 1; border-right-color: rgb(127, 127, 127); border-right-width: 1px;" />
<ui:Label tabindex="-1" text="Size" parse-escape-sequences="true" display-tooltip-when-elided="true" name="sizeLabel" style="width: 100px;" />
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 61a006cdc2118e0479cd93bf6e8fe271
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/BlobCachePane/BlobCacheEntry.uxml
uploadId: 897522
@@ -0,0 +1,20 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<ui:VisualElement style="margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border-left-color: rgb(123, 122, 122); border-right-color: rgb(123, 122, 122); border-top-color: rgb(123, 122, 122); border-bottom-color: rgb(123, 122, 122); flex-grow: 1;">
<ui:Label tabindex="-1" text="Blob Asset Cache" parse-escape-sequences="true" display-tooltip-when-elided="true" name="header" style="font-size: 16px; padding-right: 4px; padding-bottom: 8px; padding-left: 1px;" />
<ui:VisualElement name="blobCacheDisabledLabel" style="flex-grow: 0; flex-direction: row; align-items: center; margin-bottom: 3px;">
<ui:Label tabindex="-1" text="⚠" parse-escape-sequences="true" display-tooltip-when-elided="true" style="font-size: 18px; color: rgb(255, 255, 0);" />
<ui:Label tabindex="-1" text="Blob cache is disabled. Animation clips and animator controllers will be rebaked on every subscene bake." parse-escape-sequences="true" display-tooltip-when-elided="true" />
</ui:VisualElement>
<ui:Label tabindex="-1" text="LabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabel" parse-escape-sequences="true" display-tooltip-when-elided="true" name="blobCachePathLabel" />
<ui:Label tabindex="-1" text="LabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabel" parse-escape-sequences="true" display-tooltip-when-elided="true" name="totalAnimationsMemLabel" />
<ui:Label tabindex="-1" text="LabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabel" parse-escape-sequences="true" display-tooltip-when-elided="true" name="totalControllerMemLabel" />
<ui:VisualElement style="flex-grow: 0; flex-direction: row; height: 40px; flex-shrink: 0;">
<ui:Button text="Clear Cache" parse-escape-sequences="true" display-tooltip-when-elided="true" name="clearCacheBtn" style="flex-grow: 1;" />
<ui:Button text="Disable Cache" parse-escape-sequences="true" display-tooltip-when-elided="true" name="disableEnableCacheBtn" style="flex-grow: 1;" />
</ui:VisualElement>
<ui:ScrollView scroll-deceleration-rate="0,135" elasticity="0,1" style="margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-left-radius: 6px; border-top-right-radius: 6px; border-bottom-right-radius: 6px; border-bottom-left-radius: 6px; border-left-color: rgb(127, 127, 127); border-right-color: rgb(127, 127, 127); border-top-color: rgb(127, 127, 127); border-bottom-color: rgb(127, 127, 127);">
<ui:Foldout text="Animation Blobs" value="false" name="animationBlobsFoldout" />
<ui:Foldout text="Animator Controller Blobs" value="false" name="animatorControllerBlobsFoldout" />
</ui:ScrollView>
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 202b212f6ad9b4047a8ac662c7e74ce5
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/BlobCachePane/BlobInspectorBlobCache.uxml
uploadId: 897522
@@ -0,0 +1,3 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:Button text="Info" name="btn" style="flex-grow: 1;" />
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: cc67005ecd9cc2d4fa5acf24bb390f45
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/BlobInfoDefaultInfoBtn.uxml
uploadId: 897522
@@ -0,0 +1,3 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:Label text="Label" name="label" style="margin-left: 6px; flex-grow: 1; -unity-text-align: middle-left;" />
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 5460ee29626c92b47a703070f7c106ba
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/BlobInfoDefaultListViewLabel.uxml
uploadId: 897522
@@ -0,0 +1,644 @@
using System;
using System.Collections.Generic;
using System.IO;
using Rukhanka.Hybrid;
using Rukhanka.Toolbox;
using Unity.Collections;
using Unity.Entities;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Compilation;
using UnityEngine;
using UnityEngine.UIElements;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace Rukhanka.Editor
{
public class BlobInspector : EditorWindow
{
[SerializeField]
private VisualTreeAsset menuAsset = default;
[SerializeField]
private VisualTreeAsset blobDBPaneAsset = default;
[SerializeField]
private VisualTreeAsset blobCachePaneAsset = default;
[SerializeField]
private VisualTreeAsset blobCacheEntryAsset = default;
[SerializeField]
private VisualTreeAsset listViewLabelAsset = default;
[SerializeField]
private VisualTreeAsset listViewInfoBtnAsset = default;
VisualElement
menuElem,
blobCachePane,
blobDBPane
;
TwoPaneSplitView splitView;
internal enum BlobType
{
AnimatorController,
AnimationClip,
RigInfo,
SkinnedMeshInfo,
AvatarMask,
Total
}
internal class BlobAssetInfo<T> where T: unmanaged
{
public BlobAssetReference<T> blobAsset;
public List<Entity> refEntities;
}
class BlobAssetsSummary
{
public int sizeInBytes;
public int totalCount;
}
List<BlobAssetInfo<ControllerBlob>> allControllerBlobAssets = new ();
List<BlobAssetInfo<AnimationClipBlob>> allAnimationClipBlobAssets = new ();
List<BlobAssetInfo<RigDefinitionBlob>> allRigBlobAssets = new ();
List<BlobAssetInfo<SkinnedMeshInfoBlob>> allSkinnedMeshBlobAssets = new ();
List<BlobAssetInfo<AvatarMaskBlob>> allAvatarMaskBlobAssets = new ();
BlobAssetsSummary blobAssetsSummary;
readonly string nameColumnName = "name";
readonly string hashColumnName = "hash";
readonly string referencesColumnName = "references";
readonly string sizeColumnName = "size";
readonly string bakingTimeColumnName = "bakingTime";
readonly string infoColumnName = "info";
internal static World currentWorld;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[MenuItem("Window/Rukhanka Animation/Blob Inspector")]
public static void ShowWindow()
{
var wnd = GetWindow<BlobInspector>();
wnd.minSize = new Vector2(1000, 400);
wnd.titleContent = new GUIContent("Rukhanka.Animation Blob Inspector");
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void CreateGUI()
{
// Each editor window contains a root VisualElement object
var root = rootVisualElement;
splitView = new TwoPaneSplitView(0, 250, TwoPaneSplitViewOrientation.Horizontal);
root.Add(splitView);
menuElem = menuAsset.Instantiate();
menuElem.Query<Button>().ForEach((btn) => {btn.RegisterCallback<ClickEvent>(ev => MenuButtonClick(btn));});
splitView.Add(menuElem);
blobDBPane = blobDBPaneAsset.Instantiate()[0];
blobCachePane = blobCachePaneAsset.Instantiate()[0];
splitView.Add(blobDBPane);
MenuButtonClick(menuElem.Q("blobDBBtn") as Button);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MenuButtonClick(Button btn)
{
menuElem.Query<Button>().ForEach((btn) => {btn.style.backgroundColor = new StyleColor(Color.clear);});
btn.style.backgroundColor = new StyleColor(new Color(0.4f, 0.4f, 0.4f, 1));
splitView.RemoveAt(1);
switch (btn.name)
{
case "blobDBBtn":
SwitchToBlobDBPane();
break;
case "blobCacheBtn":
SwitchToBlobCachePane();
break;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void FillBlobDBInifo()
{
FillWorldList();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void FillWorldList()
{
var worldSelector = blobDBPane.Q<DropdownField>("worldSelector");
worldSelector.RegisterValueChangedCallback((worldName) => { ChangeWorld(worldName.newValue); });
worldSelector.choices.Clear();
foreach (var world in World.All)
{
worldSelector.choices.Add(world.Name);
}
if (worldSelector.index < 0 || worldSelector.index > worldSelector.choices.Count)
worldSelector.index = 0;
worldSelector.value = worldSelector.choices[worldSelector.index];
var worldReloadBtn = worldSelector.Q<Button>("worldReloadBtn");
Action clickLambda = () => { SwitchToBlobDBPane(); ChangeWorld(worldSelector.choices[worldSelector.index]); };
var clk = new Clickable(clickLambda);
worldReloadBtn.clickable = clk;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ChangeWorld(string worldName)
{
World world = null;
for (var i = 0; i < World.All.Count && world == null; ++i)
{
if (World.All[i].Name == worldName)
world = World.All[i];
}
if (world != null)
{
GatherAllBlobAssets(world);
var totalInfoLabel = blobDBPane.Q<Label>("blobInfoTotal");
totalInfoLabel.text = GatherBlobDBInfo();
CreateBlobAssetList();
}
currentWorld = world;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
unsafe BlobAssetInfo<T> RegisterBlobAsset<T>(BlobAssetReference<T> bar, List<BlobAssetInfo<T>> allBlobs) where T: unmanaged, GenericAssetBlob
{
blobAssetsSummary.totalCount += 1;
blobAssetsSummary.sizeInBytes += bar.m_data.Header->Length;
var alreadyExistIndex = allBlobs.FindIndex(x => x.blobAsset.Value.Hash() == bar.Value.Hash());
if (alreadyExistIndex >= 0)
return allBlobs[alreadyExistIndex];
var rv = new BlobAssetInfo<T>()
{
blobAsset = bar,
refEntities = new ()
};
allBlobs.Add(rv);
return rv;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void GatherAllBlobAssets(World world)
{
blobAssetsSummary = new ();
// Gather blob assets from database
var dbQ = new EntityQueryBuilder(Allocator.Temp)
.WithAll<BlobDatabaseSingleton>()
.Build(world.EntityManager);
if (dbQ.TryGetSingleton<BlobDatabaseSingleton>(out var db))
{
allAnimationClipBlobAssets.Clear();
foreach (var kv in db.animations)
{
if (!kv.Value.IsCreated)
continue;
RegisterBlobAsset(kv.Value, allAnimationClipBlobAssets);
}
allAvatarMaskBlobAssets.Clear();
foreach (var kv in db.avatarMasks)
{
if (!kv.Value.IsCreated)
continue;
RegisterBlobAsset(kv.Value, allAvatarMaskBlobAssets);
}
}
// Gather animator, animation and avatar mask blob assets from entities
allControllerBlobAssets.Clear();
var eQ = new EntityQueryBuilder(Allocator.Temp)
.WithAll<AnimatorControllerLayerComponent>()
.Build(world.EntityManager);
var animControllersChunks = eQ.ToArchetypeChunkArray(Allocator.Temp);
var controllerLayerBufHandle = world.EntityManager.GetBufferTypeHandle<AnimatorControllerLayerComponent>(true);
var entityHandle = world.EntityManager.GetEntityTypeHandle();
for (var i = 0; i < animControllersChunks.Length; ++i)
{
var chunk = animControllersChunks[i];
var bufAcc = chunk.GetBufferAccessor(ref controllerLayerBufHandle);
var entities = chunk.GetNativeArray(entityHandle);
for (var k = 0; k < chunk.Count; ++k)
{
var lb = bufAcc[k];
var e = entities[k];
for (var l = 0; l < lb.Length; ++l)
{
var acl = lb[l];
var controllerBlobInfo = RegisterBlobAsset(acl.controller, allControllerBlobAssets);
controllerBlobInfo.refEntities.Add(e);
ref var layers = ref acl.controller.Value.layers;
for (var m = 0; m < layers.Length; ++m)
{
ref var layer = ref layers[m];
foreach (var amb in allAvatarMaskBlobAssets)
{
if (amb.blobAsset.Value.Hash() == layer.avatarMaskBlobHash)
amb.refEntities.Add(e);
}
}
ref var anims = ref acl.animations.Value.animations;
for (var m = 0; m < anims.Length; ++m)
{
var anmHash = anims[m];
foreach (var acb in allAnimationClipBlobAssets)
{
if (acb.blobAsset.Value.Hash() == anmHash)
acb.refEntities.Add(e);
}
}
}
}
}
// Gather skinned mesh blob assets from entities
allSkinnedMeshBlobAssets.Clear();
var eSMR = new EntityQueryBuilder(Allocator.Temp)
.WithAll<SkinnedMeshRendererComponent>()
.Build(world.EntityManager);
var smrChunks = eSMR.ToArchetypeChunkArray(Allocator.Temp);
var smrTypeHandle = world.EntityManager.GetComponentTypeHandle<SkinnedMeshRendererComponent>(true);
for (var i = 0; i < smrChunks.Length; ++i)
{
var chunk = smrChunks[i];
var smrs = chunk.GetNativeArray(ref smrTypeHandle);
var entities = chunk.GetNativeArray(entityHandle);
for (var k = 0; k < chunk.Count; ++k)
{
var smr = smrs[k];
var e = entities[k];
var skinnedMeshBlobInfo = RegisterBlobAsset(smr.smrInfoBlob, allSkinnedMeshBlobAssets);
skinnedMeshBlobInfo.refEntities.Add(e);
}
}
// Gather rig definition blob assets from entities
allRigBlobAssets.Clear();
var eRig = new EntityQueryBuilder(Allocator.Temp)
.WithAll<RigDefinitionComponent>()
.Build(world.EntityManager);
var rigChunks = eRig.ToArchetypeChunkArray(Allocator.Temp);
var rigDefTypeHandle = world.EntityManager.GetComponentTypeHandle<RigDefinitionComponent>(true);
for (var i = 0; i < rigChunks.Length; ++i)
{
var chunk = rigChunks[i];
var rigs = chunk.GetNativeArray(ref rigDefTypeHandle);
var entities = chunk.GetNativeArray(entityHandle);
for (var k = 0; k < chunk.Count; ++k)
{
var rigDef = rigs[k];
var e = entities[k];
var rigBlobInfo = RegisterBlobAsset(rigDef.rigBlob, allRigBlobAssets);
rigBlobInfo.refEntities.Add(e);
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
string GatherBlobDBInfo()
{
var rv = $"Summary: {blobAssetsSummary.totalCount} blob assets, total memory {CommonTools.FormatMemory(blobAssetsSummary.sizeInBytes)}";
return rv;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SwitchToBlobCachePane()
{
splitView.Add(blobCachePane);
var clearCacheBtn = rootVisualElement.Q<Button>("clearCacheBtn");
var disableEnableCacheBtn = rootVisualElement.Q<Button>("disableEnableCacheBtn");
Action clearCacheLambda = () =>
{
Directory.Delete(BlobCache.GetControllerBlobCacheDirPath(), true);
Directory.Delete(BlobCache.GetAnimationBlobCacheDirPath(), true);
FillBlobCacheInfo();
};
clearCacheBtn.clickable = new Clickable(clearCacheLambda);
Action disableEnableCacheLambda = () =>
{
var bt = EditorUserBuildSettings.activeBuildTarget;
var btg = BuildPipeline.GetBuildTargetGroup(bt);
var target = NamedBuildTarget.FromBuildTargetGroup(btg);
PlayerSettings.GetScriptingDefineSymbols(target, out var defines);
#if RUKHANKA_NO_BLOB_CACHE
var l = new List<string>(defines);
l.Remove("RUKHANKA_NO_BLOB_CACHE");
defines = l.ToArray();
#else
var newDefines = new string[defines.Length + 1];
Array.Copy(defines, newDefines, defines.Length);
newDefines[^1] = "RUKHANKA_NO_BLOB_CACHE";
defines = newDefines;
#endif
PlayerSettings.SetScriptingDefineSymbols(target, defines);
CompilationPipeline.RequestScriptCompilation();
};
disableEnableCacheBtn.clickable = new Clickable(disableEnableCacheLambda);
#if RUKHANKA_NO_BLOB_CACHE
disableEnableCacheBtn.text = "Enable Cache";
#else
disableEnableCacheBtn.text = "Disable Cache";
var blobCacheDisabledLabel = rootVisualElement.Q<VisualElement>("blobCacheDisabledLabel");
blobCacheDisabledLabel.style.display = DisplayStyle.None;
#endif
FillBlobCacheInfo();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SwitchToBlobDBPane()
{
splitView.Add(blobDBPane);
#if RUKHANKA_DEBUG_INFO
var noDebugInfoWarning = blobDBPane.Q("noRukhankaDebugInfoWarning");
noDebugInfoWarning.style.display = DisplayStyle.None;
#endif
FillBlobDBInifo();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
unsafe void FillMultiColumnViewList<T>(MultiColumnListView lv, List<BlobAssetInfo<T>> allBlobAssets, Action<int> infoBtnClickAction) where T: unmanaged, GenericAssetBlob
{
lv.itemsSource = allBlobAssets;
lv.columns[infoColumnName].makeCell = () => listViewInfoBtnAsset.Instantiate().Q<Button>("btn");
lv.columns[nameColumnName].makeCell = () => listViewLabelAsset.Instantiate().Q<Label>("label");
lv.columns[hashColumnName].makeCell = () => listViewLabelAsset.Instantiate().Q<Label>("label");
lv.columns[referencesColumnName].makeCell = () => listViewLabelAsset.Instantiate().Q<Label>("label");
lv.columns[bakingTimeColumnName].makeCell = () => listViewLabelAsset.Instantiate().Q<Label>("label");
lv.columns[sizeColumnName].makeCell = () => listViewLabelAsset.Instantiate().Q<Label>("label");
lv.columns[infoColumnName].bindCell = (VisualElement ve, int index) =>
(ve as Button).clicked += () => infoBtnClickAction(index);
lv.columns[referencesColumnName].bindCell = (VisualElement ve, int index) =>
(ve as Label).text = allBlobAssets[index].refEntities.Count.ToString();
lv.columns[nameColumnName].bindCell = (VisualElement ve, int index) =>
#if RUKHANKA_DEBUG_INFO
(ve as Label).text = allBlobAssets[index].blobAsset.Value.Name();
#else
(ve as Label).text = "-";
#endif
lv.columns[hashColumnName].bindCell = (VisualElement ve, int index) =>
(ve as Label).text = allBlobAssets[index].blobAsset.Value.Hash().ToString();
lv.columns[bakingTimeColumnName].bindCell = (VisualElement ve, int index) =>
{
var bt = -1.0f;
#if RUKHANKA_DEBUG_INFO
bt = allBlobAssets[index].blobAsset.Value.BakingTime();
#endif
(ve as Label).text = bt < 0 ? "-" : $"{bt:F3} sec";
};
lv.columns[sizeColumnName].bindCell = (VisualElement ve, int index) =>
(ve as Label).text = CommonTools.FormatMemory(allBlobAssets[index].blobAsset.m_data.Header->Length);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CreateBlobAssetList()
{
var animationClipsList = blobDBPane.Q<MultiColumnListView>("animationClipList");
Action<int> infoCallback = (idx) =>
{
AnimatorClipBlobInfoWindow.animationClipBlob = allAnimationClipBlobAssets[idx];
var wnd = GetWindow<AnimatorClipBlobInfoWindow>();
wnd.Show();
};
FillMultiColumnViewList(animationClipsList, allAnimationClipBlobAssets, infoCallback);
var animatorControllersList = blobDBPane.Q<MultiColumnListView>("controllerList");
infoCallback = (idx) =>
{
AnimatorControllerBlobInfoWindow.controllerBlob = allControllerBlobAssets[idx];
var wnd = GetWindow<AnimatorControllerBlobInfoWindow>();
wnd.Show();
};
FillMultiColumnViewList(animatorControllersList, allControllerBlobAssets, infoCallback);
var rigList = blobDBPane.Q<MultiColumnListView>("rigList");
infoCallback = (idx) =>
{
RigBlobInfoWindow.rigBlob = allRigBlobAssets[idx];
var wnd = GetWindow<RigBlobInfoWindow>();
wnd.Show();
};
FillMultiColumnViewList(rigList, allRigBlobAssets, infoCallback);
var avatarMaskList = blobDBPane.Q<MultiColumnListView>("avatarMaskList");
infoCallback = (idx) =>
{
AvatarMaskInfoWindow.avatarMaskBlob = allAvatarMaskBlobAssets[idx];
var wnd = GetWindow<AvatarMaskInfoWindow>();
wnd.Show();
};
FillMultiColumnViewList(avatarMaskList, allAvatarMaskBlobAssets, infoCallback);
var smrList = blobDBPane.Q<MultiColumnListView>("smrList");
infoCallback = (idx) =>
{
SkinnedMeshBlobInfoWindow.skinnedMeshBlob = allSkinnedMeshBlobAssets[idx];
var wnd = GetWindow<SkinnedMeshBlobInfoWindow>();
wnd.Show();
};
FillMultiColumnViewList(smrList, allSkinnedMeshBlobAssets, infoCallback);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
unsafe void FillBlobAssetInfoText(BlobAssetListInfo li, BlobAssetInfo ba)
{
switch (ba.blobType)
{
case BlobType.AnimationClip:
{
var acb = ba.blobAsset.Reinterpret<AnimationClipBlob>();
li.name = "-";
#if RUKHANKA_DEBUG_INFO
li.name = acb.Value.name.ToString();
#endif
li.references = ba.refEntities.Count;
li.size = ba.blobAsset.m_data.Header->Length;
li.bakingTime = -1;
#if RUKHANKA_DEBUG_INFO
li.bakingTime = acb.Value.bakingTime;
#endif
break;
}
case BlobType.AnimatorController:
{
var acb = ba.blobAsset.Reinterpret<ControllerBlob>();
var nameText = $"[{acb.Value.hash}]";
#if RUKHANKA_DEBUG_INFO
nameText += $" '{acb.Value.name.ToString()}'";
#endif
var infoText = $"References: {ba.refEntities.Count}, Size: { CommonTools.FormatMemory(ba.blobAsset.m_data.Header->Length) }";
#if RUKHANKA_DEBUG_INFO
infoText += $" Baking time: {acb.Value.bakingTime:F3} sec";
#endif
infoLabel.text = infoText;
nameLabel.text = nameText;
infoBtn.clicked += () =>
{
AnimatorControllerBlobInfoWindow.controllerBlob = ba;
var wnd = GetWindow<AnimatorControllerBlobInfoWindow>();
wnd.Show();
};
break;
}
case BlobType.RigInfo:
{
var acb = ba.blobAsset.Reinterpret<RigDefinitionBlob>();
var nameText = $"[{acb.Value.hash}]";
#if RUKHANKA_DEBUG_INFO
nameText = $" '{acb.Value.name.ToString()}'";
#endif
var infoText = $"References: {ba.refEntities.Count}, Size: {CommonTools.FormatMemory(ba.blobAsset.m_data.Header->Length)}";
#if RUKHANKA_DEBUG_INFO
infoText += $" Baking time: {acb.Value.bakingTime:F3} sec";
#endif
infoLabel.text = infoText;
nameLabel.text = nameText;
infoBtn.clicked += () =>
{
RigBlobInfoWindow.rigBlob = ba;
var wnd = GetWindow<RigBlobInfoWindow>();
wnd.Show();
};
break;
}
case BlobType.AvatarMask:
{
var acb = ba.blobAsset.Reinterpret<AvatarMaskBlob>();
var nameText = $"[{acb.Value.hash}]";
#if RUKHANKA_DEBUG_INFO
nameText += $" '{acb.Value.name.ToString()}'";
#endif
var infoText = $"References: {ba.refEntities.Count}, Size: { CommonTools.FormatMemory(ba.blobAsset.m_data.Header->Length) }";
#if RUKHANKA_DEBUG_INFO
infoText += $" Baking time: {acb.Value.bakingTime:F3} sec";
#endif
infoLabel.text = infoText;
nameLabel.text = nameText;
infoBtn.clicked += () =>
{
AvatarMaskInfoWindow.avatarMaskBlob = ba;
var wnd = GetWindow<AvatarMaskInfoWindow>();
wnd.Show();
};
break;
}
case BlobType.SkinnedMeshInfo:
{
var acb = ba.blobAsset.Reinterpret<SkinnedMeshInfoBlob>();
var nameText = $"[{acb.Value.hash}]";
#if RUKHANKA_DEBUG_INFO
nameText += $" '{acb.Value.skeletonName.ToString()}'";
#endif
var infoText = $"References: {ba.refEntities.Count}, Size: {CommonTools.FormatMemory(ba.blobAsset.m_data.Header->Length)}";
#if RUKHANKA_DEBUG_INFO
infoText += $" Baking time: {acb.Value.bakingTime:F3} sec";
#endif
infoLabel.text = infoText;
nameLabel.text = nameText;
infoBtn.clicked += () =>
{
SkinnedMeshBlobInfoWindow.skinnedMeshBlob = ba;
var wnd = GetWindow<SkinnedMeshBlobInfoWindow>();
wnd.Show();
};
break;
}
}
}
*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void FillBlobCacheInfo()
{
var cachePathLabel = rootVisualElement.Q<Label>("blobCachePathLabel");
cachePathLabel.text = $"Cache Path: '{BlobCache.GetBlobCacheDirPath()}'";
var controllerMem = FillBlobList("animatorControllerBlobsFoldout", "Animator Controller Blobs", BlobCache.GetControllerBlobCacheDirPath());
var animationsMem = FillBlobList("animationBlobsFoldout", "Animation Clip Blobs", BlobCache.GetAnimationBlobCacheDirPath());
var animMemLabel = rootVisualElement.Q<Label>("totalAnimationsMemLabel");
var controllerMemLabel = rootVisualElement.Q<Label>("totalControllerMemLabel");
animMemLabel.text = $"Total animation blob cache size: {CommonTools.FormatMemory(animationsMem)}";
controllerMemLabel.text = $"Total animator controller blob cache size: {CommonTools.FormatMemory(controllerMem)}";
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
long FillBlobList(string foldoutName, string foldoutCaption, string cachePath)
{
var foldout = rootVisualElement.Q<Foldout>(foldoutName);
foldout.Clear();
var numCachedBlobs = 0;
var rv = 0L;
if (Directory.Exists(cachePath))
{
var files = Directory.GetFiles(cachePath);
for (var i = 0; i < files.Length; ++i)
{
var entry = blobCacheEntryAsset.Instantiate();
var file = files[i].Replace('\\', '/');
if (i % 2 == 0)
entry.style.backgroundColor = new StyleColor(new Color(0.3f, 0.3f, 0.3f, 1));
var entryPath = entry.Q<Label>("pathLabel");
var sizeLabel = entry.Q<Label>("sizeLabel");
entryPath.text = file.Replace(BlobCache.GetBlobCacheDirPath(), "");
var fs = new FileInfo(file).Length;
sizeLabel.text = CommonTools.FormatMemory(fs);
rv += fs;
foldout.Add(entry);
}
numCachedBlobs += files.Length;
}
foldout.text = $"{numCachedBlobs} {foldoutCaption}";
return rv;
}
}
}
@@ -0,0 +1,26 @@
fileFormatVersion: 2
guid: aa076ec4336df4f46947f60ce8404cf9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- m_ViewDataDictionary: {instanceID: 0}
- menuAsset: {fileID: 9197481963319205126, guid: 3e3246b4cd78cb84da58702492c804d9, type: 3}
- blobDBPaneAsset: {fileID: 9197481963319205126, guid: 55574cc96c16a36439b8b5868bda3802, type: 3}
- blobCachePaneAsset: {fileID: 9197481963319205126, guid: 202b212f6ad9b4047a8ac662c7e74ce5, type: 3}
- blobEntryAsset: {fileID: 9197481963319205126, guid: 22a82583551fa7a4bbb99ebbde09a9ec, type: 3}
- blobCacheEntryAsset: {fileID: 9197481963319205126, guid: 61a006cdc2118e0479cd93bf6e8fe271, type: 3}
- listViewLabelAsset: {fileID: 9197481963319205126, guid: 5460ee29626c92b47a703070f7c106ba, type: 3}
- listViewInfoBtnAsset: {fileID: 9197481963319205126, guid: cc67005ecd9cc2d4fa5acf24bb390f45, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/BlobInspector.cs
uploadId: 897522
@@ -0,0 +1,5 @@
.custom-label {
font-size: 20px;
-unity-font-style: bold;
color: rgb(68, 138, 255);
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 1bf0fc2bfc0154a4bb8547a45c588659
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/BlobInspector.uss
uploadId: 897522
@@ -0,0 +1,3 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<Style src="project://database/Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/BlobInspector.uss?fileID=7433441132597879392&amp;guid=1bf0fc2bfc0154a4bb8547a45c588659&amp;type=3#BlobInspector" />
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 8d1b63d7ef2f32d41bbba873160e8aa9
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/BlobInspector.uxml
uploadId: 897522
@@ -0,0 +1,65 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<ui:VisualElement name="VisualElement" style="border-left-color: rgb(123, 122, 122); border-right-color: rgb(123, 122, 122); border-top-color: rgb(123, 122, 122); border-bottom-color: rgb(123, 122, 122); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px;">
<ui:Label tabindex="-1" text="Blob Asset Runtime Database" parse-escape-sequences="true" display-tooltip-when-elided="true" name="blobAssetRuntimeDBHeader" style="font-size: 16px; padding-right: 4px; padding-bottom: 8px; padding-left: 1px;" />
<ui:VisualElement name="noRukhankaDebugInfoWarning" style="flex-grow: 0; flex-direction: row; -unity-text-align: middle-left;">
<ui:Label tabindex="-1" text="⚠" parse-escape-sequences="true" display-tooltip-when-elided="true" style="color: rgb(255, 255, 0); font-size: 18px;" />
<ui:Label tabindex="-1" text="No &apos;RUKHANKA_DEBUG_INFO&apos; defined. Asset names and baking times will be unavailable." parse-escape-sequences="true" display-tooltip-when-elided="true" />
</ui:VisualElement>
<ui:DropdownField label="World:" name="worldSelector" style="padding-top: 4px; padding-right: 2px; padding-bottom: 4px; padding-left: 1px;">
<ui:Button text="Reload" parse-escape-sequences="true" display-tooltip-when-elided="true" name="worldReloadBtn" />
</ui:DropdownField>
<ui:Label tabindex="-1" parse-escape-sequences="true" display-tooltip-when-elided="true" text="Skinned mesh blob assets:" name="blobInfoTotal" style="padding-left: 1px; padding-right: 2px; padding-top: 4px; padding-bottom: 4px;" />
<ui:ScrollView scroll-deceleration-rate="0,135" elasticity="0,1" vertical-scroller-visibility="AlwaysVisible" style="margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-left-color: rgb(123, 122, 122); border-right-color: rgb(123, 122, 122); border-top-color: rgb(123, 122, 122); border-bottom-color: rgb(123, 122, 122); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px;">
<ui:MultiColumnListView name="animationClipList" show-alternating-row-backgrounds="ContentOnly" show-foldout-header="true" header-title="Animation Clip Blobs" allow-add="false" allow-remove="false" show-border="true" selection-type="Single" show-bound-collection-size="true" virtualization-method="FixedHeight" style="margin-top: 4px; margin-right: 4px; margin-bottom: 4px; margin-left: 4px;">
<ui:Columns stretch-mode="GrowAndFill" resize-preview="false" reorderable="false">
<ui:Column name="info" width="40px" resizable="false" />
<ui:Column stretchable="true" title="Hash" name="hash" />
<ui:Column title="Name" stretchable="true" name="name" />
<ui:Column title="References" stretchable="true" name="references" />
<ui:Column title="Size" stretchable="true" name="size" />
<ui:Column name="bakingTime" title="Baking Time" stretchable="true" />
</ui:Columns>
</ui:MultiColumnListView>
<ui:MultiColumnListView name="controllerList" show-alternating-row-backgrounds="ContentOnly" show-foldout-header="true" header-title="Animator Controllers" allow-add="false" allow-remove="false" show-border="true" selection-type="Single" show-bound-collection-size="true" virtualization-method="FixedHeight" style="margin-top: 4px; margin-right: 4px; margin-bottom: 4px; margin-left: 4px;">
<ui:Columns stretch-mode="GrowAndFill" resize-preview="false">
<ui:Column stretchable="true" title="Hash" name="hash" />
<ui:Column title="Name" stretchable="true" name="name" />
<ui:Column title="References" stretchable="true" name="references" />
<ui:Column title="Size" stretchable="true" name="size" />
<ui:Column name="bakingTime" title="Baking Time" stretchable="true" />
<ui:Column name="info" width="40px" resizable="false" />
</ui:Columns>
</ui:MultiColumnListView>
<ui:MultiColumnListView name="rigList" show-alternating-row-backgrounds="ContentOnly" show-foldout-header="true" header-title="Rigs" allow-add="false" allow-remove="false" show-border="true" selection-type="Single" show-bound-collection-size="true" virtualization-method="FixedHeight" style="margin-top: 4px; margin-right: 4px; margin-bottom: 4px; margin-left: 4px;">
<ui:Columns stretch-mode="GrowAndFill" resize-preview="false">
<ui:Column stretchable="true" title="Hash" name="hash" />
<ui:Column title="Name" stretchable="true" name="name" />
<ui:Column title="References" stretchable="true" name="references" />
<ui:Column title="Size" stretchable="true" name="size" />
<ui:Column name="bakingTime" title="Baking Time" stretchable="true" />
<ui:Column name="info" resizable="false" width="40px" />
</ui:Columns>
</ui:MultiColumnListView>
<ui:MultiColumnListView name="avatarMaskList" show-alternating-row-backgrounds="ContentOnly" show-foldout-header="true" header-title="Avatar Masks" allow-add="false" allow-remove="false" show-border="true" selection-type="Single" show-bound-collection-size="true" virtualization-method="FixedHeight" style="margin-top: 4px; margin-right: 4px; margin-bottom: 4px; margin-left: 4px;">
<ui:Columns stretch-mode="GrowAndFill" resize-preview="false">
<ui:Column stretchable="true" title="Hash" name="hash" />
<ui:Column title="Name" stretchable="true" name="name" />
<ui:Column title="References" stretchable="true" name="references" />
<ui:Column title="Size" stretchable="true" name="size" />
<ui:Column name="bakingTime" title="Baking Time" stretchable="true" />
<ui:Column name="info" resizable="false" width="40px" />
</ui:Columns>
</ui:MultiColumnListView>
<ui:MultiColumnListView name="smrList" show-alternating-row-backgrounds="ContentOnly" show-foldout-header="true" header-title="Skinned Meshes" allow-add="false" allow-remove="false" show-border="true" selection-type="Single" show-bound-collection-size="true" virtualization-method="FixedHeight" style="margin-top: 4px; margin-right: 4px; margin-bottom: 4px; margin-left: 4px;">
<ui:Columns stretch-mode="GrowAndFill" resize-preview="false">
<ui:Column stretchable="true" title="Hash" name="hash" />
<ui:Column title="Name" stretchable="true" name="name" />
<ui:Column title="References" stretchable="true" name="references" />
<ui:Column title="Size" stretchable="true" name="size" />
<ui:Column name="bakingTime" title="Baking Time" stretchable="true" />
<ui:Column name="info" width="40px" resizable="false" />
</ui:Columns>
</ui:MultiColumnListView>
</ui:ScrollView>
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 55574cc96c16a36439b8b5868bda3802
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
AssetOrigin:
serializedVersion: 1
productId: 298480
packageName: Rukhanka Animation System 2
packageVersion: 2.9.0
assetPath: Packages/com.rukhanka.animation/Rukhanka.Editor/BlobInspector/BlobInspectorBlobDB.uxml
uploadId: 897522

Some files were not shown because too many files have changed in this diff Show More