updated item creation code

This commit is contained in:
Bitl 2021-07-27 21:09:29 -07:00
parent 7d7a7da8e2
commit 14611940b0
7 changed files with 624 additions and 58 deletions

View File

@ -13,6 +13,7 @@ public class IconLoader
public bool CopyToItemDir = false;
public string ItemDir = "";
public string ItemName = "";
public string ItemPath = "";
public IconLoader()
{
@ -36,7 +37,8 @@ public class IconLoader
public void LoadImage()
{
string dir = CopyToItemDir ? ItemDir + "\\" + ItemName : GlobalPaths.extradir + "\\icons\\" + GlobalVars.UserConfiguration.PlayerName;
string ItemNameFixed = ItemName.Replace(" ", "");
string dir = CopyToItemDir ? ItemDir + "\\" + ItemNameFixed : GlobalPaths.extradir + "\\icons\\" + GlobalVars.UserConfiguration.PlayerName;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
@ -58,6 +60,11 @@ public class IconLoader
str.Close();
}
if (CopyToItemDir)
{
ItemPath = openFileDialog1.FileName;
}
installOutcome = "Icon " + openFileDialog1.SafeFileName + " installed!";
}
catch (Exception ex)

View File

@ -15,6 +15,7 @@ public class GlobalPaths
public static readonly string DataPath = BasePath + @"\\shareddata";
public static readonly string ConfigDir = BasePath + @"\\config";
public static readonly string ConfigDirClients = ConfigDir + @"\\clients";
public static readonly string ConfigDirTemplates = ConfigDir + @"\\itemtemplates";
public static readonly string ConfigDirData = BasePathLauncher + @"\\data";
public static readonly string ClientDir = BasePath + @"\\clients";
public static readonly string MapsDir = BasePath + @"\\maps";

View File

@ -13,12 +13,13 @@ enum SDKApps
{
ClientSDK = 0,
AssetSDK = 1,
ClientScriptDoc = 2,
SplashTester = 3,
ScriptGenerator = 4,
LegacyPlaceConverter = 5,
DiogenesEditor = 6,
ClientScriptTester = 7
ItemCreationSDK = 2,
ClientScriptDoc = 3,
SplashTester = 4,
ScriptGenerator = 5,
LegacyPlaceConverter = 6,
DiogenesEditor = 7,
ClientScriptTester = 8
}
#endregion
@ -802,13 +803,12 @@ class SDKFuncs
#endregion
#region Item Creation SDK
public static void SetItemFontVals(XDocument doc, VarStorage.AssetCacheDef assetdef, int idIndex, int outputPathIndex, int inGameDirIndex, string assetfilename)
public static void SetItemFontVals(XDocument doc, VarStorage.AssetCacheDef assetdef, int idIndex, int outputPathIndex, int inGameDirIndex, string assetpath, string assetfilename)
{
SetItemFontVals(doc, assetdef.Class, assetdef.Id[idIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], assetfilename);
SetItemFontVals(doc, assetdef.Class, assetdef.Id[idIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], assetpath, assetfilename);
}
public static void SetItemFontVals(XDocument doc, string itemClassValue, string itemIdValue, string outputPath, string inGameDir, string assetfilename)
public static void SetItemFontVals(XDocument doc, string itemClassValue, string itemIdValue, string outputPath, string inGameDir, string assetpath, string assetfilename)
{
var v = from nodes in doc.Descendants("Item")
where nodes.Attribute("class").Value == itemClassValue
@ -827,8 +827,8 @@ class SDKFuncs
foreach (var item3 in v3)
{
GlobalFuncs.FixedFileCopy(assetfilename, outputPath, true);
string fixedfilename = Path.GetFileName(assetfilename);
GlobalFuncs.FixedFileCopy(assetpath, outputPath, true);
string fixedfilename = assetfilename;
item3.Value = inGameDir + fixedfilename;
}
}
@ -881,7 +881,7 @@ class SDKFuncs
}
}
public static void SetHeadBevel(XDocument doc, float bevel, float bevelRoundness, float bulge)
public static void SetHeadBevel(XDocument doc, double bevel, double bevelRoundness, double bulge)
{
var v = from nodes in doc.Descendants("Item")
select nodes;
@ -917,49 +917,88 @@ class SDKFuncs
}
}
public static void CreateItem(string filepath, RobloxFileType type, string itemname, string[] assetfilenames, double[] coordoptions, float[] headoptions)
public static string GetPathForType(RobloxFileType type)
{
switch (type)
{
case RobloxFileType.Hat:
return GlobalPaths.hatdir;
case RobloxFileType.HeadNoCustomMesh:
case RobloxFileType.Head:
return GlobalPaths.headdir;
case RobloxFileType.Face:
return GlobalPaths.facedir;
case RobloxFileType.TShirt:
return GlobalPaths.tshirtdir;
case RobloxFileType.Shirt:
return GlobalPaths.shirtdir;
case RobloxFileType.Pants:
return GlobalPaths.pantsdir;
default:
return "";
}
}
public static RobloxFileType GetTypeForInt(int type)
{
switch (type)
{
case 0:
return RobloxFileType.Hat;
case 1:
return RobloxFileType.Head;
case 2:
return RobloxFileType.HeadNoCustomMesh;
case 3:
return RobloxFileType.Face;
case 4:
return RobloxFileType.TShirt;
case 5:
return RobloxFileType.Shirt;
case 6:
return RobloxFileType.Pants;
default:
return RobloxFileType.RBXM;
}
}
public static void CreateItem(string filepath, RobloxFileType type, string itemname, string[] assetfilenames, double[] coordoptions, double[] headoptions, string desctext = "")
{
string oldfile = File.ReadAllText(filepath);
string fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile));
XDocument doc = XDocument.Parse(fixedfile);
string savDocPath = "";
string savDocPath = GetPathForType(type);
try
{
switch (type)
{
case RobloxFileType.Hat:
SetItemFontVals(doc, RobloxDefs.ItemHatFonts, 0, 0, 0, assetfilenames[0]);
SetItemFontVals(doc, RobloxDefs.ItemHatFonts, 1, 1, 1, assetfilenames[1]);
SetItemFontVals(doc, RobloxDefs.ItemHatFonts, 0, 0, 0, assetfilenames[0], assetfilenames[2]);
SetItemFontVals(doc, RobloxDefs.ItemHatFonts, 1, 1, 1, assetfilenames[1], assetfilenames[3]);
SetItemCoordVals(doc, RobloxDefs.ItemHatFonts, coordoptions[0], coordoptions[1], coordoptions[2], "CoordinateFrame", "AttachmentPoint");
savDocPath = GlobalPaths.hatdir;
break;
case RobloxFileType.Head:
SetItemFontVals(doc, RobloxDefs.ItemHeadFonts, 0, 0, 0, assetfilenames[0]);
SetItemFontVals(doc, RobloxDefs.ItemHeadFonts, 1, 1, 1, assetfilenames[1]);
SetItemFontVals(doc, RobloxDefs.ItemHeadFonts, 0, 0, 0, assetfilenames[0], assetfilenames[2]);
SetItemFontVals(doc, RobloxDefs.ItemHeadFonts, 1, 1, 1, assetfilenames[1], assetfilenames[3]);
SetItemCoordVals(doc, RobloxDefs.ItemHatFonts, coordoptions[0], coordoptions[1], coordoptions[2], "Vector3", "Scale");
savDocPath = GlobalPaths.headdir;
break;
case RobloxFileType.Face:
SetItemFontVals(doc, RobloxDefs.ItemFaceTexture, 0, 0, 0, assetfilenames[0]);
savDocPath = GlobalPaths.facedir;
SetItemFontVals(doc, RobloxDefs.ItemFaceTexture, 0, 0, 0, assetfilenames[0], assetfilenames[2]);
break;
case RobloxFileType.TShirt:
SetItemFontVals(doc, RobloxDefs.ItemTShirtTexture, 0, 0, 0, assetfilenames[0]);
savDocPath = GlobalPaths.tshirtdir;
SetItemFontVals(doc, RobloxDefs.ItemTShirtTexture, 0, 0, 0, assetfilenames[0], assetfilenames[2]);
break;
case RobloxFileType.Shirt:
SetItemFontVals(doc, RobloxDefs.ItemShirtTexture, 0, 0, 0, assetfilenames[0]);
SetItemFontVals(doc, RobloxDefs.ItemShirtTexture, 0, 0, 0, assetfilenames[0], assetfilenames[2]);
savDocPath = GlobalPaths.shirtdir;
break;
case RobloxFileType.Pants:
SetItemFontVals(doc, RobloxDefs.ItemPantsTexture, 0, 0, 0, assetfilenames[0]);
savDocPath = GlobalPaths.pantsdir;
SetItemFontVals(doc, RobloxDefs.ItemPantsTexture, 0, 0, 0, assetfilenames[0], assetfilenames[2]);
break;
case RobloxFileType.HeadNoCustomMesh:
SetHeadBevel(doc, headoptions[0], headoptions[1], headoptions[2]);
SetItemCoordVals(doc, RobloxDefs.ItemHatFonts, coordoptions[0], coordoptions[1], coordoptions[2], "Vector3", "Scale");
savDocPath = GlobalPaths.headdir;
break;
default:
break;
@ -967,11 +1006,15 @@ class SDKFuncs
}
catch (Exception ex)
{
MessageBox.Show("The Item Creation SDK has experienced an error: " + ex.Message, "Novetus Item Creation SDK", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show("The Item Creation SDK has experienced an error: " + ex.Message + ex.StackTrace, "Novetus Item Creation SDK", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally
{
doc.Save(savDocPath + "\\" + itemname + ".rbxm");
if (!string.IsNullOrWhiteSpace(desctext))
{
File.WriteAllText(savDocPath + "\\" + itemname + "_desc.txt", desctext);
}
}
}
#endregion
@ -1065,16 +1108,18 @@ class SDKFuncs
case 1:
return SDKApps.AssetSDK;
case 2:
return SDKApps.ClientScriptDoc;
return SDKApps.ItemCreationSDK;
case 3:
return SDKApps.SplashTester;
return SDKApps.ClientScriptDoc;
case 4:
return SDKApps.ScriptGenerator;
return SDKApps.SplashTester;
case 5:
return SDKApps.LegacyPlaceConverter;
return SDKApps.ScriptGenerator;
case 6:
return SDKApps.DiogenesEditor;
return SDKApps.LegacyPlaceConverter;
case 7:
return SDKApps.DiogenesEditor;
case 8:
return SDKApps.ClientScriptTester;
default:
return SDKApps.ClientSDK;

View File

@ -36,10 +36,39 @@ partial class ItemCreationSDK
this.CreateItemButton = new System.Windows.Forms.Button();
this.ItemIcon = new System.Windows.Forms.PictureBox();
this.ItemDescLabel = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.DescBox = new System.Windows.Forms.TextBox();
this.ItemNameLabel = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.ItemNameBox = new System.Windows.Forms.TextBox();
this.Option1Label = new System.Windows.Forms.Label();
this.Option1TextBox = new System.Windows.Forms.TextBox();
this.Option1BrowseButton = new System.Windows.Forms.Button();
this.Option2BrowseButton = new System.Windows.Forms.Button();
this.Option2TextBox = new System.Windows.Forms.TextBox();
this.Option2Label = new System.Windows.Forms.Label();
this.CoordGroup = new System.Windows.Forms.GroupBox();
this.XLabel = new System.Windows.Forms.Label();
this.YLabel = new System.Windows.Forms.Label();
this.ZLabel = new System.Windows.Forms.Label();
this.XBox = new System.Windows.Forms.NumericUpDown();
this.YBox = new System.Windows.Forms.NumericUpDown();
this.ZBox = new System.Windows.Forms.NumericUpDown();
this.MeshOptionsGroup = new System.Windows.Forms.GroupBox();
this.BulgeBox = new System.Windows.Forms.NumericUpDown();
this.RoundnessBox = new System.Windows.Forms.NumericUpDown();
this.BevelBox = new System.Windows.Forms.NumericUpDown();
this.BulgeLabel = new System.Windows.Forms.Label();
this.RoundnessLabel = new System.Windows.Forms.Label();
this.BevelLabel = new System.Windows.Forms.Label();
this.ItemSettingsGroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ItemIcon)).BeginInit();
this.CoordGroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.XBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.YBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ZBox)).BeginInit();
this.MeshOptionsGroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.BulgeBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RoundnessBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.BevelBox)).BeginInit();
this.SuspendLayout();
//
// ItemTypeListBox
@ -48,7 +77,8 @@ partial class ItemCreationSDK
this.ItemTypeListBox.FormattingEnabled = true;
this.ItemTypeListBox.Items.AddRange(new object[] {
"Hat",
"Head",
"Head (Custom Mesh)",
"Head (Mesh Shape)",
"Face",
"T-Shirt",
"Shirt",
@ -57,6 +87,7 @@ partial class ItemCreationSDK
this.ItemTypeListBox.Name = "ItemTypeListBox";
this.ItemTypeListBox.Size = new System.Drawing.Size(132, 21);
this.ItemTypeListBox.TabIndex = 0;
this.ItemTypeListBox.SelectedIndexChanged += new System.EventHandler(this.ItemTypeListBox_SelectedIndexChanged);
//
// ItemTypeLabel
//
@ -85,30 +116,42 @@ partial class ItemCreationSDK
this.BrowseImageButton.TabIndex = 4;
this.BrowseImageButton.Text = "Browse...";
this.BrowseImageButton.UseVisualStyleBackColor = true;
this.BrowseImageButton.Click += new System.EventHandler(this.BrowseImageButton_Click);
//
// ItemSettingsGroup
//
this.ItemSettingsGroup.Controls.Add(this.MeshOptionsGroup);
this.ItemSettingsGroup.Controls.Add(this.CoordGroup);
this.ItemSettingsGroup.Controls.Add(this.Option2BrowseButton);
this.ItemSettingsGroup.Controls.Add(this.Option2TextBox);
this.ItemSettingsGroup.Controls.Add(this.Option2Label);
this.ItemSettingsGroup.Controls.Add(this.Option1BrowseButton);
this.ItemSettingsGroup.Controls.Add(this.Option1TextBox);
this.ItemSettingsGroup.Controls.Add(this.Option1Label);
this.ItemSettingsGroup.Location = new System.Drawing.Point(12, 194);
this.ItemSettingsGroup.Name = "ItemSettingsGroup";
this.ItemSettingsGroup.Size = new System.Drawing.Size(255, 275);
this.ItemSettingsGroup.Size = new System.Drawing.Size(255, 301);
this.ItemSettingsGroup.TabIndex = 5;
this.ItemSettingsGroup.TabStop = false;
this.ItemSettingsGroup.Text = "Item Settings";
//
// CreateItemButton
//
this.CreateItemButton.Location = new System.Drawing.Point(12, 475);
this.CreateItemButton.Location = new System.Drawing.Point(12, 501);
this.CreateItemButton.Name = "CreateItemButton";
this.CreateItemButton.Size = new System.Drawing.Size(255, 23);
this.CreateItemButton.TabIndex = 6;
this.CreateItemButton.Text = "Create Item";
this.CreateItemButton.UseVisualStyleBackColor = true;
this.CreateItemButton.Click += new System.EventHandler(this.CreateItemButton_Click);
//
// ItemIcon
//
this.ItemIcon.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ItemIcon.Location = new System.Drawing.Point(203, 12);
this.ItemIcon.Name = "ItemIcon";
this.ItemIcon.Size = new System.Drawing.Size(64, 64);
this.ItemIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.ItemIcon.TabIndex = 2;
this.ItemIcon.TabStop = false;
//
@ -121,13 +164,13 @@ partial class ItemCreationSDK
this.ItemDescLabel.TabIndex = 7;
this.ItemDescLabel.Text = "Item Description (Optional)";
//
// textBox1
// DescBox
//
this.textBox1.Location = new System.Drawing.Point(12, 101);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(255, 60);
this.textBox1.TabIndex = 8;
this.DescBox.Location = new System.Drawing.Point(12, 101);
this.DescBox.Multiline = true;
this.DescBox.Name = "DescBox";
this.DescBox.Size = new System.Drawing.Size(255, 60);
this.DescBox.TabIndex = 8;
//
// ItemNameLabel
//
@ -138,22 +181,274 @@ partial class ItemCreationSDK
this.ItemNameLabel.TabIndex = 9;
this.ItemNameLabel.Text = "Item Name";
//
// textBox2
// ItemNameBox
//
this.textBox2.Location = new System.Drawing.Point(12, 42);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(124, 20);
this.textBox2.TabIndex = 10;
this.ItemNameBox.Location = new System.Drawing.Point(12, 42);
this.ItemNameBox.Name = "ItemNameBox";
this.ItemNameBox.Size = new System.Drawing.Size(124, 20);
this.ItemNameBox.TabIndex = 10;
//
// Option1Label
//
this.Option1Label.AutoSize = true;
this.Option1Label.Location = new System.Drawing.Point(7, 20);
this.Option1Label.Name = "Option1Label";
this.Option1Label.Size = new System.Drawing.Size(114, 13);
this.Option1Label.TabIndex = 0;
this.Option1Label.Text = "This option is disabled.";
//
// Option1TextBox
//
this.Option1TextBox.Location = new System.Drawing.Point(7, 37);
this.Option1TextBox.Name = "Option1TextBox";
this.Option1TextBox.ReadOnly = true;
this.Option1TextBox.Size = new System.Drawing.Size(180, 20);
this.Option1TextBox.TabIndex = 1;
//
// Option1BrowseButton
//
this.Option1BrowseButton.Enabled = false;
this.Option1BrowseButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Option1BrowseButton.Location = new System.Drawing.Point(193, 37);
this.Option1BrowseButton.Name = "Option1BrowseButton";
this.Option1BrowseButton.Size = new System.Drawing.Size(56, 20);
this.Option1BrowseButton.TabIndex = 2;
this.Option1BrowseButton.Text = "Browse...";
this.Option1BrowseButton.UseVisualStyleBackColor = true;
this.Option1BrowseButton.Click += new System.EventHandler(this.Option1BrowseButton_Click);
//
// Option2BrowseButton
//
this.Option2BrowseButton.Enabled = false;
this.Option2BrowseButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Option2BrowseButton.Location = new System.Drawing.Point(193, 79);
this.Option2BrowseButton.Name = "Option2BrowseButton";
this.Option2BrowseButton.Size = new System.Drawing.Size(56, 20);
this.Option2BrowseButton.TabIndex = 5;
this.Option2BrowseButton.Text = "Browse...";
this.Option2BrowseButton.UseVisualStyleBackColor = true;
this.Option2BrowseButton.Click += new System.EventHandler(this.Option2BrowseButton_Click);
//
// Option2TextBox
//
this.Option2TextBox.Location = new System.Drawing.Point(7, 79);
this.Option2TextBox.Name = "Option2TextBox";
this.Option2TextBox.ReadOnly = true;
this.Option2TextBox.Size = new System.Drawing.Size(180, 20);
this.Option2TextBox.TabIndex = 4;
//
// Option2Label
//
this.Option2Label.AutoSize = true;
this.Option2Label.Location = new System.Drawing.Point(7, 62);
this.Option2Label.Name = "Option2Label";
this.Option2Label.Size = new System.Drawing.Size(114, 13);
this.Option2Label.TabIndex = 3;
this.Option2Label.Text = "This option is disabled.";
//
// CoordGroup
//
this.CoordGroup.Controls.Add(this.ZBox);
this.CoordGroup.Controls.Add(this.YBox);
this.CoordGroup.Controls.Add(this.XBox);
this.CoordGroup.Controls.Add(this.ZLabel);
this.CoordGroup.Controls.Add(this.YLabel);
this.CoordGroup.Controls.Add(this.XLabel);
this.CoordGroup.Enabled = false;
this.CoordGroup.Location = new System.Drawing.Point(7, 106);
this.CoordGroup.Name = "CoordGroup";
this.CoordGroup.Size = new System.Drawing.Size(242, 90);
this.CoordGroup.TabIndex = 6;
this.CoordGroup.TabStop = false;
this.CoordGroup.Text = "This option is disabled.";
//
// XLabel
//
this.XLabel.AutoSize = true;
this.XLabel.Location = new System.Drawing.Point(7, 16);
this.XLabel.Name = "XLabel";
this.XLabel.Size = new System.Drawing.Size(14, 13);
this.XLabel.TabIndex = 0;
this.XLabel.Text = "X";
//
// YLabel
//
this.YLabel.AutoSize = true;
this.YLabel.Location = new System.Drawing.Point(7, 41);
this.YLabel.Name = "YLabel";
this.YLabel.Size = new System.Drawing.Size(14, 13);
this.YLabel.TabIndex = 1;
this.YLabel.Text = "Y";
//
// ZLabel
//
this.ZLabel.AutoSize = true;
this.ZLabel.Location = new System.Drawing.Point(6, 67);
this.ZLabel.Name = "ZLabel";
this.ZLabel.Size = new System.Drawing.Size(14, 13);
this.ZLabel.TabIndex = 2;
this.ZLabel.Text = "Z";
//
// XBox
//
this.XBox.DecimalPlaces = 6;
this.XBox.Location = new System.Drawing.Point(27, 14);
this.XBox.Maximum = new decimal(new int[] {
1661992959,
1808227885,
5,
0});
this.XBox.Minimum = new decimal(new int[] {
1661992959,
1808227885,
5,
-2147483648});
this.XBox.Name = "XBox";
this.XBox.Size = new System.Drawing.Size(209, 20);
this.XBox.TabIndex = 3;
//
// YBox
//
this.YBox.DecimalPlaces = 6;
this.YBox.Location = new System.Drawing.Point(27, 39);
this.YBox.Maximum = new decimal(new int[] {
1661992959,
1808227885,
5,
0});
this.YBox.Minimum = new decimal(new int[] {
1661992959,
1808227885,
5,
-2147483648});
this.YBox.Name = "YBox";
this.YBox.Size = new System.Drawing.Size(209, 20);
this.YBox.TabIndex = 4;
//
// ZBox
//
this.ZBox.DecimalPlaces = 6;
this.ZBox.Location = new System.Drawing.Point(27, 65);
this.ZBox.Maximum = new decimal(new int[] {
1661992959,
1808227885,
5,
0});
this.ZBox.Minimum = new decimal(new int[] {
1661992959,
1808227885,
5,
-2147483648});
this.ZBox.Name = "ZBox";
this.ZBox.Size = new System.Drawing.Size(209, 20);
this.ZBox.TabIndex = 5;
//
// MeshOptionsGroup
//
this.MeshOptionsGroup.Controls.Add(this.BulgeBox);
this.MeshOptionsGroup.Controls.Add(this.RoundnessBox);
this.MeshOptionsGroup.Controls.Add(this.BevelBox);
this.MeshOptionsGroup.Controls.Add(this.BulgeLabel);
this.MeshOptionsGroup.Controls.Add(this.RoundnessLabel);
this.MeshOptionsGroup.Controls.Add(this.BevelLabel);
this.MeshOptionsGroup.Enabled = false;
this.MeshOptionsGroup.Location = new System.Drawing.Point(7, 202);
this.MeshOptionsGroup.Name = "MeshOptionsGroup";
this.MeshOptionsGroup.Size = new System.Drawing.Size(242, 90);
this.MeshOptionsGroup.TabIndex = 7;
this.MeshOptionsGroup.TabStop = false;
this.MeshOptionsGroup.Text = "This option is disabled.";
//
// BulgeBox
//
this.BulgeBox.DecimalPlaces = 6;
this.BulgeBox.Location = new System.Drawing.Point(104, 63);
this.BulgeBox.Maximum = new decimal(new int[] {
1661992959,
1808227885,
5,
0});
this.BulgeBox.Minimum = new decimal(new int[] {
1661992959,
1808227885,
5,
-2147483648});
this.BulgeBox.Name = "BulgeBox";
this.BulgeBox.Size = new System.Drawing.Size(132, 20);
this.BulgeBox.TabIndex = 5;
//
// RoundnessBox
//
this.RoundnessBox.DecimalPlaces = 6;
this.RoundnessBox.Location = new System.Drawing.Point(104, 38);
this.RoundnessBox.Maximum = new decimal(new int[] {
1661992959,
1808227885,
5,
0});
this.RoundnessBox.Minimum = new decimal(new int[] {
1661992959,
1808227885,
5,
-2147483648});
this.RoundnessBox.Name = "RoundnessBox";
this.RoundnessBox.Size = new System.Drawing.Size(132, 20);
this.RoundnessBox.TabIndex = 4;
//
// BevelBox
//
this.BevelBox.DecimalPlaces = 6;
this.BevelBox.Location = new System.Drawing.Point(104, 14);
this.BevelBox.Maximum = new decimal(new int[] {
1661992959,
1808227885,
5,
0});
this.BevelBox.Minimum = new decimal(new int[] {
1661992959,
1808227885,
5,
-2147483648});
this.BevelBox.Name = "BevelBox";
this.BevelBox.Size = new System.Drawing.Size(132, 20);
this.BevelBox.TabIndex = 3;
//
// BulgeLabel
//
this.BulgeLabel.AutoSize = true;
this.BulgeLabel.Location = new System.Drawing.Point(7, 65);
this.BulgeLabel.Name = "BulgeLabel";
this.BulgeLabel.Size = new System.Drawing.Size(34, 13);
this.BulgeLabel.TabIndex = 2;
this.BulgeLabel.Text = "Bulge";
//
// RoundnessLabel
//
this.RoundnessLabel.AutoSize = true;
this.RoundnessLabel.Location = new System.Drawing.Point(7, 41);
this.RoundnessLabel.Name = "RoundnessLabel";
this.RoundnessLabel.Size = new System.Drawing.Size(91, 13);
this.RoundnessLabel.TabIndex = 1;
this.RoundnessLabel.Text = "Bevel Roundness";
//
// BevelLabel
//
this.BevelLabel.AutoSize = true;
this.BevelLabel.Location = new System.Drawing.Point(7, 16);
this.BevelLabel.Name = "BevelLabel";
this.BevelLabel.Size = new System.Drawing.Size(34, 13);
this.BevelLabel.TabIndex = 0;
this.BevelLabel.Text = "Bevel";
//
// ItemCreationSDK
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.ClientSize = new System.Drawing.Size(279, 510);
this.Controls.Add(this.textBox2);
this.ClientSize = new System.Drawing.Size(279, 536);
this.Controls.Add(this.ItemNameBox);
this.Controls.Add(this.ItemNameLabel);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.DescBox);
this.Controls.Add(this.ItemDescLabel);
this.Controls.Add(this.CreateItemButton);
this.Controls.Add(this.ItemSettingsGroup);
@ -165,7 +460,20 @@ partial class ItemCreationSDK
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "ItemCreationSDK";
this.Text = "Novetus Item Creation SDK";
this.Load += new System.EventHandler(this.ItemCreationSDK_Load);
this.ItemSettingsGroup.ResumeLayout(false);
this.ItemSettingsGroup.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.ItemIcon)).EndInit();
this.CoordGroup.ResumeLayout(false);
this.CoordGroup.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.XBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.YBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ZBox)).EndInit();
this.MeshOptionsGroup.ResumeLayout(false);
this.MeshOptionsGroup.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.BulgeBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RoundnessBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.BevelBox)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -181,7 +489,27 @@ partial class ItemCreationSDK
private System.Windows.Forms.GroupBox ItemSettingsGroup;
private System.Windows.Forms.Button CreateItemButton;
private System.Windows.Forms.Label ItemDescLabel;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox DescBox;
private System.Windows.Forms.Label ItemNameLabel;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox ItemNameBox;
private System.Windows.Forms.Button Option2BrowseButton;
private System.Windows.Forms.TextBox Option2TextBox;
private System.Windows.Forms.Label Option2Label;
private System.Windows.Forms.Button Option1BrowseButton;
private System.Windows.Forms.TextBox Option1TextBox;
private System.Windows.Forms.Label Option1Label;
private System.Windows.Forms.GroupBox MeshOptionsGroup;
private System.Windows.Forms.NumericUpDown BulgeBox;
private System.Windows.Forms.NumericUpDown RoundnessBox;
private System.Windows.Forms.NumericUpDown BevelBox;
private System.Windows.Forms.Label BulgeLabel;
private System.Windows.Forms.Label RoundnessLabel;
private System.Windows.Forms.Label BevelLabel;
private System.Windows.Forms.GroupBox CoordGroup;
private System.Windows.Forms.NumericUpDown ZBox;
private System.Windows.Forms.NumericUpDown YBox;
private System.Windows.Forms.NumericUpDown XBox;
private System.Windows.Forms.Label ZLabel;
private System.Windows.Forms.Label YLabel;
private System.Windows.Forms.Label XLabel;
}

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
@ -13,7 +14,15 @@ using System.Windows.Forms;
public partial class ItemCreationSDK : Form
{
#region Variables
public static readonly string ItemCreationTypesName = "SDKItemCreationTypes.xml";
private static RobloxFileType type;
private static string Template = "";
private static string Option1Path = "";
private static string Option2Path = "";
private OpenFileDialog openFileDialog1;
private static string FileDialogFilter1 = "";
private static string FileDialogName1 = "";
private static string FileDialogFilter2 = "";
private static string FileDialogName2 = "";
#endregion
#region Constructor
@ -24,6 +33,177 @@ public partial class ItemCreationSDK : Form
#endregion
#region Form Events
private void ItemCreationSDK_Load(object sender, EventArgs e)
{
ItemTypeListBox.SelectedItem = "Hat";
}
private void BrowseImageButton_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(ItemNameBox.Text))
{
//message box here.
return;
}
else
{
IconLoader icon = new IconLoader();
icon.CopyToItemDir = true;
icon.ItemDir = SDKFuncs.GetPathForType(type);
icon.ItemName = ItemNameBox.Text;
try
{
icon.LoadImage();
}
catch (Exception)
{
}
if (!string.IsNullOrWhiteSpace(icon.getInstallOutcome()))
{
MessageBox.Show(icon.getInstallOutcome());
}
Image icon1 = CustomizationFuncs.LoadImage(icon.ItemDir + "\\" + icon.ItemName.Replace(" ", "") + ".png", GlobalPaths.extradir + "\\NoExtra.png");
ItemIcon.Image = icon1;
if (type == RobloxFileType.TShirt || type == RobloxFileType.Face)
{
Option1Path = icon.ItemPath;
Option1TextBox.Text = Path.GetFileName(Option1Path);
}
}
}
private void ItemTypeListBox_SelectedIndexChanged(object sender, EventArgs e)
{
type = SDKFuncs.GetTypeForInt(ItemTypeListBox.SelectedIndex);
switch (type)
{
case RobloxFileType.Hat:
ToggleOptionSet(Option1Label, Option1TextBox, Option1BrowseButton, "Hat Mesh", Option1Path, true);
ToggleOptionSet(Option2Label, Option2TextBox, Option2BrowseButton, "Hat Texture", Option2Path, true);
ToggleGroup(CoordGroup, "Hat Attachment Point");
ToggleGroup(MeshOptionsGroup, "", false);
Template = GlobalPaths.ConfigDirTemplates + "\\HatTemplate.rbxm";
FileDialogFilter1 = "*.mesh";
FileDialogName1 = "Hat Mesh";
FileDialogFilter2 = "*.png";
FileDialogName2 = "Hat Texture";
break;
case RobloxFileType.HeadNoCustomMesh:
ToggleOptionSet(Option1Label, Option1TextBox, Option1BrowseButton, "", Option1Path, false, false);
ToggleOptionSet(Option2Label, Option2TextBox, Option2BrowseButton, "", Option2Path, false, false);
ToggleGroup(CoordGroup, "Head Mesh Scale");
ToggleGroup(MeshOptionsGroup, "Head Mesh Options");
Template = GlobalPaths.ConfigDirTemplates + "\\HeadNoCustomMeshTemplate.rbxm";
break;
case RobloxFileType.Head:
ToggleOptionSet(Option1Label, Option1TextBox, Option1BrowseButton, "Head Mesh", Option1Path, true);
ToggleOptionSet(Option2Label, Option2TextBox, Option2BrowseButton, "Head Texture", Option2Path, true);
ToggleGroup(CoordGroup, "Head Mesh Scale");
ToggleGroup(MeshOptionsGroup, "", false);
Template = GlobalPaths.ConfigDirTemplates + "\\HeadTemplate.rbxm";
break;
case RobloxFileType.Face:
ToggleOptionSet(Option1Label, Option1TextBox, Option1BrowseButton, "Load the Item Icon to load a T-Shirt Template.", Option1Path, false, false);
ToggleOptionSet(Option2Label, Option2TextBox, Option2BrowseButton, "", Option2Path, false, false);
ToggleGroup(CoordGroup, "", false);
ToggleGroup(MeshOptionsGroup, "", false);
Template = GlobalPaths.ConfigDirTemplates + "\\FaceTemplate.rbxm";
break;
case RobloxFileType.TShirt:
ToggleOptionSet(Option1Label, Option1TextBox, Option1BrowseButton, "Load the Item Icon to load a T-Shirt Template.", Option1Path, false, false);
ToggleOptionSet(Option2Label, Option2TextBox, Option2BrowseButton, "", Option2Path, false, false);
ToggleGroup(CoordGroup, "", false);
ToggleGroup(MeshOptionsGroup, "", false);
Template = GlobalPaths.ConfigDirTemplates + "\\TShirtTemplate.rbxm";
break;
case RobloxFileType.Shirt:
ToggleOptionSet(Option1Label, Option1TextBox, Option1BrowseButton, "Shirt Template", Option1Path, true);
ToggleOptionSet(Option2Label, Option2TextBox, Option2BrowseButton, "", Option2Path, false, false);
ToggleGroup(CoordGroup, "", false);
ToggleGroup(MeshOptionsGroup, "", false);
Template = GlobalPaths.ConfigDirTemplates + "\\ShirtTemplate.rbxm";
break;
case RobloxFileType.Pants:
ToggleOptionSet(Option1Label, Option1TextBox, Option1BrowseButton, "Pants Template", Option1Path, true);
ToggleOptionSet(Option2Label, Option2TextBox, Option2BrowseButton, "", Option2Path, false, false);
ToggleGroup(CoordGroup, "", false);
ToggleGroup(MeshOptionsGroup, "", false);
Template = GlobalPaths.ConfigDirTemplates + "\\PantsTemplate.rbxm";
break;
default:
break;
}
}
private void CreateItemButton_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(ItemNameBox.Text) && ItemIcon.Image == null || string.IsNullOrWhiteSpace(ItemNameBox.Text) || ItemIcon.Image == null)
{
//message box here.
return;
}
else
{
ItemNameBox.Text = ItemNameBox.Text.Replace(" ", "");
SDKFuncs.CreateItem(Template,
type,
ItemNameBox.Text,
new string[] { Option1Path, Option2Path, Option1TextBox.Text, Option2TextBox.Text },
new double[] { Convert.ToDouble(XBox.Value), Convert.ToDouble(YBox.Value), Convert.ToDouble(ZBox.Value) },
new double[] { Convert.ToDouble(BevelBox.Value), Convert.ToDouble(RoundnessBox.Value), Convert.ToDouble(BulgeBox.Value) },
DescBox.Text
);
}
}
private void Option1BrowseButton_Click(object sender, EventArgs e)
{
LoadAsset(FileDialogName1, FileDialogFilter1, Option1Path, Option1TextBox);
}
private void Option2BrowseButton_Click(object sender, EventArgs e)
{
LoadAsset(FileDialogName2, FileDialogFilter2, Option2Path, Option2TextBox);
}
#endregion
#region Functions
private void ToggleOptionSet(Label label, TextBox textbox, Button button, string labelText, string Path, bool browseButton, bool enable = true)
{
label.Text = enable ? labelText : (string.IsNullOrWhiteSpace(labelText) ? "This option is disabled." : labelText);
textbox.ReadOnly = !enable;
textbox.Text = "";
button.Enabled = browseButton;
ItemIcon.Image = null;
Path = "";
}
private void ToggleGroup(GroupBox groupbox, string labelText, bool enable = true)
{
groupbox.Text = enable ? labelText : (string.IsNullOrWhiteSpace(labelText) ? "This option is disabled." : labelText);
groupbox.Enabled = enable;
ItemIcon.Image = null;
}
private void LoadAsset(string assetName, string assetFilter, string optionPath, TextBox optionTextBox)
{
openFileDialog1 = new OpenFileDialog()
{
FileName = "Select a " + assetName + " file",
Filter = assetName + " (" + assetFilter + ")|" + assetFilter,
Title = "Open " + assetName
};
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
MessageBox.Show(openFileDialog1.FileName);
optionPath = openFileDialog1.FileName;
optionTextBox.Text = Path.GetFileName(optionPath);
}
}
#endregion
}
#endregion

View File

@ -48,6 +48,7 @@
this.listBox1.Items.AddRange(new object[] {
"Client SDK",
"Asset SDK",
"Item Creation SDK",
"ClientScript Documentation",
"Splash Tester",
"ROBLOX Script Generator",

View File

@ -49,6 +49,10 @@ public partial class NovetusSDK : Form
AssetSDK asset = new AssetSDK();
asset.Show();
break;
case SDKApps.ItemCreationSDK:
ItemCreationSDK icsdk = new ItemCreationSDK();
icsdk.Show();
break;
case SDKApps.ClientScriptDoc:
ClientScriptDocumentation csd = new ClientScriptDocumentation();
csd.Show();