Bug fixes.
This commit is contained in:
parent
7710cfba59
commit
4a360e4033
@ -328,23 +328,8 @@ namespace RobloxFiles.BinaryFormat.Chunks
|
||||
{
|
||||
// Make sure this value is in a safe range.
|
||||
int orientId = (rawOrientId - 1) % 36;
|
||||
|
||||
NormalId xColumn = (NormalId)(orientId / 6);
|
||||
Vector3 R0 = Vector3.FromNormalId(xColumn);
|
||||
|
||||
NormalId yColumn = (NormalId)(orientId % 6);
|
||||
Vector3 R1 = Vector3.FromNormalId(yColumn);
|
||||
|
||||
// Compute R2 using the cross product of R0 and R1.
|
||||
Vector3 R2 = R0.Cross(R1);
|
||||
|
||||
// Generate the rotation matrix.
|
||||
matrices[i] = new float[9]
|
||||
{
|
||||
R0.X, R0.Y, R0.Z,
|
||||
R1.X, R1.Y, R1.Z,
|
||||
R2.X, R2.Y, R2.Z,
|
||||
};
|
||||
var cf = CFrame.FromOrientId(orientId);
|
||||
matrices[i] = cf.GetComponents();
|
||||
}
|
||||
else if (Type == PropertyType.Quaternion)
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using RobloxFiles.Enums;
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace RobloxFiles.DataTypes
|
||||
@ -447,5 +448,25 @@ namespace RobloxFiles.DataTypes
|
||||
|
||||
return orientId;
|
||||
}
|
||||
|
||||
internal static CFrame FromOrientId(int orientId)
|
||||
{
|
||||
var xColumn = (NormalId)(orientId / 6);
|
||||
var yColumn = (NormalId)(orientId % 6);
|
||||
|
||||
var R0 = Vector3.FromNormalId(xColumn);
|
||||
var R1 = Vector3.FromNormalId(yColumn);
|
||||
var R2 = R0.Cross(R1);
|
||||
|
||||
var matrix = new float[12]
|
||||
{
|
||||
0, 0, 0,
|
||||
R0.X, R0.Y, R0.Z,
|
||||
R1.X, R1.Y, R1.Z,
|
||||
R2.X, R2.Y, R2.Z
|
||||
};
|
||||
|
||||
return new CFrame(matrix);
|
||||
}
|
||||
}
|
||||
}
|
@ -4318,6 +4318,24 @@ namespace RobloxFiles
|
||||
{
|
||||
}
|
||||
|
||||
public class BubbleChatConfiguration : TextChatConfigurations
|
||||
{
|
||||
public string AdorneeName = "HumanoidRootPart";
|
||||
public Color3 BackgroundColor3 = Color3.FromRGB(250, 250, 250);
|
||||
public double BackgroundTransparency = 0.1;
|
||||
public float BubbleDuration = 15;
|
||||
public float BubblesSpacing = 6;
|
||||
public bool Enabled = true;
|
||||
public Font Font = Font.GothamMedium;
|
||||
public FontFace FontFace = FontFace.FromEnum(Enums.Font.GothamMedium);
|
||||
public Vector3 LocalPlayerStudsOffset = Vector3.zero;
|
||||
public float MaxDistance = 100;
|
||||
public float MinimizeDistance = 40;
|
||||
public Color3 TextColor3 = Color3.FromRGB(57, 59, 61);
|
||||
public long TextSize = 16;
|
||||
public float VerticalStudsOffset = 0;
|
||||
}
|
||||
|
||||
public class ChatInputBarConfiguration : TextChatConfigurations
|
||||
{
|
||||
public Color3 BackgroundColor3 = Color3.FromRGB(25, 27, 29);
|
||||
|
28
Plugins/.vscode/tasks.json
vendored
28
Plugins/.vscode/tasks.json
vendored
@ -1,28 +0,0 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
|
||||
"tasks":
|
||||
[
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "Build Plugin",
|
||||
"command": "rojo build --output GenerateApiDump.rbxm",
|
||||
|
||||
"group": "build"
|
||||
},
|
||||
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "Build and Test Plugin",
|
||||
|
||||
"command": "powershell -ExecutionPolicy ByPass -File DeployToStudio.ps1",
|
||||
"dependsOn": ["Build Plugin"],
|
||||
|
||||
"group":
|
||||
{
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
$pluginName = "GenerateApiDump.rbxm"
|
||||
$destPath = "$env:localappdata\Roblox\Plugins\" + $pluginName
|
||||
|
||||
Copy-Item -Path $pluginName -Destination $destPath
|
Binary file not shown.
@ -14,6 +14,7 @@ local singletons = {
|
||||
ParabolaAdornment = Instance.new("BoxHandleAdornment"), -- close enough
|
||||
StarterPlayerScripts = StarterPlayer:WaitForChild("StarterPlayerScripts"),
|
||||
StarterCharacterScripts = StarterPlayer:WaitForChild("StarterCharacterScripts"),
|
||||
BubbleChatConfiguration = TextChatService:WaitForChild("BubbleChatConfiguration", 10),
|
||||
ChatWindowConfiguration = TextChatService:WaitForChild("ChatWindowConfiguration", 10),
|
||||
ChatInputBarConfiguration = TextChatService:WaitForChild("ChatInputBarConfiguration", 10),
|
||||
}
|
||||
|
2
Plugins/make
Normal file
2
Plugins/make
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
rojo build --output $LOCALAPPDATA/Roblox/Plugins/GenerateApiDump.rbxm
|
Binary file not shown.
@ -1,12 +1,23 @@
|
||||
using System.Xml;
|
||||
using System;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Xml;
|
||||
using RobloxFiles.DataTypes;
|
||||
using RobloxFiles.Enums;
|
||||
|
||||
namespace RobloxFiles.Tokens
|
||||
{
|
||||
public class CFrameToken : IXmlPropertyToken
|
||||
public class CFrameToken : IXmlPropertyToken, IAttributeToken<CFrame>
|
||||
{
|
||||
public string XmlPropertyToken => "CoordinateFrame; CFrame";
|
||||
private static readonly string[] Coords = new string[12] { "X", "Y", "Z", "R00", "R01", "R02", "R10", "R11", "R12", "R20", "R21", "R22"};
|
||||
public AttributeType AttributeType => AttributeType.CFrame;
|
||||
|
||||
private static readonly string[] Coords = new string[12]
|
||||
{
|
||||
"X", "Y", "Z",
|
||||
"R00", "R01", "R02",
|
||||
"R10", "R11", "R12",
|
||||
"R20", "R21", "R22"
|
||||
};
|
||||
|
||||
public static CFrame ReadCFrame(XmlNode token)
|
||||
{
|
||||
@ -65,5 +76,52 @@ namespace RobloxFiles.Tokens
|
||||
CFrame value = prop.Value as CFrame;
|
||||
WriteCFrame(value, doc, node);
|
||||
}
|
||||
|
||||
public CFrame ReadAttribute(RbxAttribute attribute)
|
||||
{
|
||||
float x = attribute.ReadFloat(),
|
||||
y = attribute.ReadFloat(),
|
||||
z = attribute.ReadFloat();
|
||||
|
||||
var rawOrientId = attribute.ReadByte();
|
||||
var pos = new Vector3(x, y, z);
|
||||
|
||||
if (rawOrientId > 0)
|
||||
{
|
||||
int orientId = (rawOrientId - 1) % 36;
|
||||
return CFrame.FromOrientId(orientId) + pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
float[] matrix = new float[12];
|
||||
|
||||
for (int i = 3; i < 12; i++)
|
||||
matrix[i] = attribute.ReadFloat();
|
||||
|
||||
return new CFrame(matrix) + pos;
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteAttribute(RbxAttribute attribute, CFrame value)
|
||||
{
|
||||
Vector3 pos = value.Position;
|
||||
attribute.WriteFloat(pos.X);
|
||||
attribute.WriteFloat(pos.Y);
|
||||
attribute.WriteFloat(pos.Z);
|
||||
|
||||
int orientId = value.GetOrientId();
|
||||
attribute.WriteByte((byte)(orientId + 1));
|
||||
|
||||
if (orientId == -1)
|
||||
{
|
||||
float[] components = value.GetComponents();
|
||||
|
||||
for (int i = 3; i < 12; i++)
|
||||
{
|
||||
float component = components[i];
|
||||
attribute.WriteFloat(component);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
|
||||
using RobloxFiles.Utility;
|
||||
using RobloxFiles.XmlFormat;
|
||||
|
||||
namespace RobloxFiles.Tokens
|
||||
@ -19,12 +19,11 @@ namespace RobloxFiles.Tokens
|
||||
{
|
||||
Instance inst = prop.Instance;
|
||||
Type instType = inst?.GetType();
|
||||
|
||||
FieldInfo info = instType.GetField(prop.Name, Property.BindingFlags);
|
||||
var info = ImplicitMember.Get(instType, prop.Name);
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
Type enumType = info.FieldType;
|
||||
Type enumType = info.MemberType;
|
||||
string item = value.ToInvariantString();
|
||||
|
||||
prop.Type = PropertyType.Enum;
|
||||
|
@ -42,16 +42,19 @@ namespace RobloxFiles.Tokens
|
||||
var weight = (uint)font.Weight;
|
||||
|
||||
string family = font.Family;
|
||||
string contentType = "null";
|
||||
string familyType = "null";
|
||||
|
||||
string cachedType = "null";
|
||||
string cachedId = font.CachedFaceId;
|
||||
|
||||
if (family.Length > 0)
|
||||
contentType = "url";
|
||||
familyType = "url";
|
||||
|
||||
var contentNode = doc.CreateElement(contentType);
|
||||
contentNode.InnerText = family;
|
||||
if (cachedId.Length > 0)
|
||||
cachedType = "url";
|
||||
|
||||
var familyNode = doc.CreateElement("Family");
|
||||
familyNode.AppendChild(contentNode);
|
||||
familyNode.InnerText = $"<{familyType}>{family}</{familyType}>";
|
||||
node.AppendChild(familyNode);
|
||||
|
||||
var weightNode = doc.CreateElement("Weight");
|
||||
@ -61,6 +64,10 @@ namespace RobloxFiles.Tokens
|
||||
var styleNode = doc.CreateElement("Style");
|
||||
styleNode.InnerText = $"{font.Style}";
|
||||
node.AppendChild(styleNode);
|
||||
|
||||
var cacheNode = doc.CreateElement("CachedFaceId");
|
||||
cacheNode.InnerText = $"<{cachedType}>{cachedId}</{cachedType}>";
|
||||
node.AppendChild(cacheNode);
|
||||
}
|
||||
|
||||
public FontFace ReadAttribute(RbxAttribute attribute)
|
||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
namespace RobloxFiles
|
||||
@ -33,7 +32,7 @@ namespace RobloxFiles
|
||||
Vector3 = 17,
|
||||
// Vector2int16 = 18,
|
||||
// Vector3int16 = 19,
|
||||
// CFrame = 20,
|
||||
CFrame = 20,
|
||||
// Enum = 21,
|
||||
NumberSequence = 23,
|
||||
// NumberSequenceKeypoint = 24,
|
||||
@ -154,6 +153,7 @@ namespace RobloxFiles
|
||||
internal string ReadString() => Reader.ReadString(true);
|
||||
|
||||
internal void WriteInt(int value) => Writer.Write(value);
|
||||
internal void WriteByte(byte value) => Writer.Write(value);
|
||||
internal void WriteBool(bool value) => Writer.Write(value);
|
||||
internal void WriteFloat(float value) => Writer.Write(value);
|
||||
internal void WriteDouble(double value) => Writer.Write(value);
|
||||
|
@ -45,6 +45,9 @@ namespace RobloxFiles
|
||||
/// <summary>The source AssetId this instance was created in.</summary>
|
||||
public long SourceAssetId = -1;
|
||||
|
||||
/// <summary>A unique identifier declared for the history of this instance.</summary>
|
||||
public UniqueId HistoryId;
|
||||
|
||||
/// <summary>A unique identifier declared for this instance.</summary>
|
||||
public UniqueId UniqueId;
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user