diff --git a/BinaryFormat/Chunks/PROP.cs b/BinaryFormat/Chunks/PROP.cs index 4aa0102..fbcf33e 100644 --- a/BinaryFormat/Chunks/PROP.cs +++ b/BinaryFormat/Chunks/PROP.cs @@ -6,7 +6,6 @@ using System.Text; using RobloxFiles.Enums; using RobloxFiles.DataTypes; -using RobloxFiles.Utility; namespace RobloxFiles.BinaryFormat.Chunks { diff --git a/DataTypes/CFrame.cs b/DataTypes/CFrame.cs index 74903f2..9e9eb41 100644 --- a/DataTypes/CFrame.cs +++ b/DataTypes/CFrame.cs @@ -1,5 +1,4 @@ using System; -using RobloxFiles.Utility; namespace RobloxFiles.DataTypes { diff --git a/DataTypes/Quaternion.cs b/DataTypes/Quaternion.cs index 608027c..a6f9cce 100644 --- a/DataTypes/Quaternion.cs +++ b/DataTypes/Quaternion.cs @@ -1,7 +1,6 @@ using System; -using RobloxFiles.DataTypes; -namespace RobloxFiles.Utility +namespace RobloxFiles.DataTypes { /// /// Quaternion is a utility used by the CFrame DataType to handle rotation interpolation. diff --git a/Generated/Classes.cs b/Generated/Classes.cs index d6ae6be..e73a65e 100644 --- a/Generated/Classes.cs +++ b/Generated/Classes.cs @@ -644,7 +644,6 @@ namespace RobloxFiles { IsService = true; } - } public class ContextActionService : Instance @@ -723,6 +722,9 @@ namespace RobloxFiles public abstract class BevelMesh : DataModelMesh { + public float Bevel = 0; + public float Bevel_Roundness = 0; + public float Bulge = 0; } public class BlockMesh : BevelMesh @@ -1758,7 +1760,6 @@ namespace RobloxFiles { IsService = true; } - } public class LocalizationTable : Instance @@ -1866,7 +1867,6 @@ namespace RobloxFiles { IsService = true; } - } public abstract class PVInstance : Instance @@ -2065,6 +2065,7 @@ namespace RobloxFiles { public Content AssetId = ""; public byte[] ChildData = new byte[0]; + public FormFactor FormFactor = FormFactor.Custom; public byte[] MeshData = new byte[0]; public RenderFidelity RenderFidelity = RenderFidelity.Precise; public bool UsePartColor = false; @@ -2728,7 +2729,6 @@ namespace RobloxFiles { IsService = true; } - } public class StudioData : Instance @@ -2748,7 +2748,6 @@ namespace RobloxFiles { IsService = true; } - } public class Team : Instance @@ -2983,7 +2982,6 @@ namespace RobloxFiles { IsService = true; } - } public abstract class ValueBase : Instance diff --git a/Plugins/GenerateApiDump.rbxm b/Plugins/GenerateApiDump.rbxm index 8f53365..1c77ae3 100644 Binary files a/Plugins/GenerateApiDump.rbxm and b/Plugins/GenerateApiDump.rbxm differ diff --git a/Plugins/GenerateApiDump/ApiPlugin.server.lua b/Plugins/GenerateApiDump/ApiPlugin.server.lua index cbc3efd..9f45ea1 100644 --- a/Plugins/GenerateApiDump/ApiPlugin.server.lua +++ b/Plugins/GenerateApiDump/ApiPlugin.server.lua @@ -391,7 +391,6 @@ local function generateClasses() local firstLine = true table.sort(propNames) - if classTags.Service then writeLine("public %s()", className) openStack() @@ -399,8 +398,14 @@ local function generateClasses() writeLine("IsService = true;") closeStack() - if #propNames > 0 then - writeLine() + for i, propName in ipairs(propNames) do + local prop = propMap[propName] + local serial = prop.Serialization + + if serial.CanLoad then + writeLine() + break + end end end diff --git a/Plugins/GenerateApiDump/PropertyPatches.lua b/Plugins/GenerateApiDump/PropertyPatches.lua index 1f6ee6f..8448786 100644 --- a/Plugins/GenerateApiDump/PropertyPatches.lua +++ b/Plugins/GenerateApiDump/PropertyPatches.lua @@ -84,6 +84,23 @@ return } }; + BevelMesh = + { + Add = + { + Bevel = "float"; + Bevel_Roundness = "float"; + Bulge = "float"; + }; + + Defaults = + { + Bevel = 0; + Bevel_Roundness = 0; + Bulge = 0; + } + }; + BinaryStringValue = { Add = @@ -387,6 +404,7 @@ return AssetId = "Content"; ChildData = "BinaryString"; MeshData = "BinaryString"; + FormFactor = "Enum:FormFactor"; }; Defaults = @@ -394,6 +412,7 @@ return AssetId = ""; ChildData = ""; MeshData = ""; + FormFactor = Enum.FormFactor.Custom; }; }; diff --git a/Tree/Instance.cs b/Tree/Instance.cs index 1eb3ddf..0f05af7 100644 --- a/Tree/Instance.cs +++ b/Tree/Instance.cs @@ -21,7 +21,7 @@ namespace RobloxFiles /// The ClassName of this Instance. public string ClassName => GetType().Name; - /// Internal list of Properties that are under this Instance. + /// Internal list of properties that are under this Instance. private Dictionary props = new Dictionary(); /// A list of properties that are defined under this Instance. @@ -30,7 +30,7 @@ namespace RobloxFiles /// The raw list of children for this Instance. internal List Children = new List(); - /// Raw value of the Instance's parent. + /// The raw value of the Instance's parent. private Instance RawParent; /// The name of this Instance. diff --git a/Tree/Property.cs b/Tree/Property.cs index 01398c9..718ddde 100644 --- a/Tree/Property.cs +++ b/Tree/Property.cs @@ -6,7 +6,6 @@ using RobloxFiles.BinaryFormat; using RobloxFiles.BinaryFormat.Chunks; using RobloxFiles.DataTypes; -using RobloxFiles.Utility; namespace RobloxFiles { @@ -140,6 +139,12 @@ namespace RobloxFiles } } + if (Name.Contains(" ")) + { + var implicitName = Name.Replace(' ', '_'); + return implicitName; + } + return Name; } } @@ -188,13 +193,42 @@ namespace RobloxFiles FieldInfo field = Instance.GetType() .GetField(ImplicitName, BindingFlags); - try + if (field != null) { - field?.SetValue(Instance, value); - } - catch - { - Console.WriteLine($"RobloxFiles.Property - Failed to cast value {value} into property {Instance.ClassName}.{Name}"); + Type fieldType = field.FieldType; + Type valueType = value?.GetType(); + + if (fieldType == valueType || value == null) + { + try + { + field.SetValue(Instance, value); + } + catch + { + Console.WriteLine($"RobloxFiles.Property - Failed to cast value {value} into property {Instance.ClassName}.{Name}"); + } + } + else if (valueType != null) + { + var typeWrapper = new Type[] { valueType }; + MethodInfo implicitCast = fieldType.GetMethod("op_Implicit", typeWrapper); + + if (implicitCast != null) + { + var valueWrapper = new object[] { value }; + + try + { + object castedValue = implicitCast.Invoke(null, valueWrapper); + field.SetValue(Instance, castedValue); + } + catch + { + Console.WriteLine($"RobloxFiles.Property - Failed to implicitly cast value {value} into property {Instance.ClassName}.{Name}"); + } + } + } } } }