in MREUnityRuntimeLib/Core/Actor.cs [441:564]
internal ActorPatch GeneratePatch(ActorPatch output = null, TargetPath path = null)
{
if (output == null)
{
output = new ActorPatch(Id);
}
var generateAll = path == null;
if (!generateAll)
{
if (path.AnimatibleType != "actor") return output;
output.Restore(path, 0);
}
else
{
output.RestoreAll();
}
if (generateAll || path.PathParts[0] == "transform")
{
if (generateAll || path.PathParts[1] == "local")
{
LocalTransform.ToLocalTransform(transform);
if (generateAll || path.PathParts[2] == "position")
{
var localPos = transform.localPosition;
if (generateAll || path.PathParts.Length == 3 || path.PathParts[3] == "x")
{
output.Transform.Local.Position.X = localPos.x;
}
if (generateAll || path.PathParts.Length == 3 || path.PathParts[3] == "y")
{
output.Transform.Local.Position.Y = localPos.y;
}
if (generateAll || path.PathParts.Length == 3 || path.PathParts[3] == "z")
{
output.Transform.Local.Position.Z = localPos.z;
}
}
if (generateAll || path.PathParts[2] == "rotation")
{
var localRot = transform.localRotation;
output.Transform.Local.Rotation.X = localRot.x;
output.Transform.Local.Rotation.Y = localRot.y;
output.Transform.Local.Rotation.Z = localRot.z;
output.Transform.Local.Rotation.W = localRot.w;
}
if (generateAll || path.PathParts[2] == "scale")
{
var localScale = transform.localScale;
if (generateAll || path.PathParts.Length == 3 || path.PathParts[3] == "x")
{
output.Transform.Local.Scale.X = localScale.x;
}
if (generateAll || path.PathParts.Length == 3 || path.PathParts[3] == "y")
{
output.Transform.Local.Scale.Y = localScale.y;
}
if (generateAll || path.PathParts.Length == 3 || path.PathParts[3] == "z")
{
output.Transform.Local.Scale.Z = localScale.z;
}
}
}
if (generateAll || path.PathParts[1] == "app")
{
AppTransform.ToAppTransform(transform, App.SceneRoot.transform);
if (generateAll || path.PathParts[2] == "position")
{
if (generateAll || path.PathParts.Length == 3 || path.PathParts[3] == "x")
{
output.Transform.App.Position.X = AppTransform.Position.X;
}
if (generateAll || path.PathParts.Length == 3 || path.PathParts[3] == "y")
{
output.Transform.App.Position.Y = AppTransform.Position.Y;
}
if (generateAll || path.PathParts.Length == 3 || path.PathParts[3] == "z")
{
output.Transform.App.Position.Z = AppTransform.Position.Z;
}
}
if (generateAll || path.PathParts[2] == "rotation")
{
var localRot = transform.localRotation;
output.Transform.App.Rotation.X = AppTransform.Rotation.X;
output.Transform.App.Rotation.Y = AppTransform.Rotation.Y;
output.Transform.App.Rotation.Z = AppTransform.Rotation.Z;
output.Transform.App.Rotation.W = AppTransform.Rotation.W;
}
}
}
if (generateAll)
{
var rigidBody = PatchingUtilMethods.GeneratePatch(RigidBody, (Rigidbody)null,
App.SceneRoot.transform, !App.UsePhysicsBridge);
ColliderPatch collider = null;
_collider = gameObject.GetComponent<UnityCollider>();
if (_collider != null)
{
if (Collider == null)
{
Collider = gameObject.AddComponent<Collider>();
}
Collider.Initialize(_collider);
collider = Collider.GenerateInitialPatch();
}
output.ParentId = ParentId;
output.Name = Name;
output.RigidBody = rigidBody;
output.Collider = collider;
output.Appearance = new AppearancePatch()
{
Enabled = appearanceEnabled,
MaterialId = MaterialId,
MeshId = MeshId
};
}
return output;
}