From a3ea079fd233d9c5e34a8f621437585bd995f385 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Wed, 23 Mar 2022 19:30:32 -0700 Subject: [PATCH 1/4] Add property copying shortcut to material tool. --- Tools/Material.lua | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/Tools/Material.lua b/Tools/Material.lua index e010b69..7966517 100644 --- a/Tools/Material.lua +++ b/Tools/Material.lua @@ -29,7 +29,10 @@ local MaterialTool = { } MaterialTool.ManualText = [[Material Tool 🛠 -Lets you change the material, transparency, and reflectance of parts.]] +Lets you change the material, transparency, and reflectance of parts. + +TIP: Press R while hovering over a part to copy its material properties.]] + -- Container for temporary connections (disconnected automatically) local Connections = {}; @@ -39,6 +42,7 @@ function MaterialTool:Equip() -- Start up our interface self:ShowUI() + BindShortcutKeys() end; @@ -180,6 +184,42 @@ function SyncInputToProperty(Property, Input) end; +function BindShortcutKeys() + -- Enables useful shortcut keys for this tool + + -- Track user input while this tool is equipped + table.insert(Connections, UserInputService.InputBegan:Connect(function (InputInfo, GameProcessedEvent) + -- Make sure this is an intentional event + if GameProcessedEvent then + return; + end; + + -- Make sure this input is a key press + if InputInfo.UserInputType ~= Enum.UserInputType.Keyboard then + return; + end; + + -- Make sure it wasn't pressed while typing + if UserInputService:GetFocusedTextBox() then + return; + end; + + -- Check if the enter key was pressed + if InputInfo.KeyCode == Enum.KeyCode.R then + + -- Set selection's properties to that of the target (if any) + if Core.Mouse.Target then + SetProperty('Material', Core.Mouse.Target.Material) + SetProperty('Transparency', Core.Mouse.Target.Transparency) + SetProperty('Reflectance', Core.Mouse.Target.Reflectance) + end; + + end; + + end)); + +end; + function SetProperty(Property, Value) -- Make sure the given value is valid @@ -379,4 +419,4 @@ function RegisterChange() end; -- Return the tool -return MaterialTool; \ No newline at end of file +return MaterialTool; From ea625423d3f4eb97494cc5f94f18c3e59b573268 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Fri, 25 Mar 2022 09:17:17 -0700 Subject: [PATCH 2/4] Remove unnecessary joint search. Parts are connected to themselves, so GetConnectedParts(Part) will return Part, which we will search through. --- Core/init.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Core/init.lua b/Core/init.lua index 25a2763..c78956c 100644 --- a/Core/init.lua +++ b/Core/init.lua @@ -969,11 +969,6 @@ function GetPartJoints(Part, Whitelist) local Joints = {}; - -- Get joints stored inside `Part` - for Joint, JointParent in pairs(SearchJoints(Part, Part, Whitelist)) do - Joints[Joint] = JointParent; - end; - -- Get joints stored inside connected parts for _, ConnectedPart in pairs(GetConnectedParts(Part)) do for Joint, JointParent in pairs(SearchJoints(ConnectedPart, Part, Whitelist)) do @@ -1043,4 +1038,4 @@ end; InitializeUI(); -- Return core -return getfenv(0); \ No newline at end of file +return getfenv(0); From da1959050e289355919030aea1c084cb7d6833f4 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Fri, 25 Mar 2022 09:35:20 -0700 Subject: [PATCH 3/4] Revert "Remove unnecessary joint search." This reverts commit ea625423d3f4eb97494cc5f94f18c3e59b573268. --- Core/init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Core/init.lua b/Core/init.lua index c78956c..25a2763 100644 --- a/Core/init.lua +++ b/Core/init.lua @@ -969,6 +969,11 @@ function GetPartJoints(Part, Whitelist) local Joints = {}; + -- Get joints stored inside `Part` + for Joint, JointParent in pairs(SearchJoints(Part, Part, Whitelist)) do + Joints[Joint] = JointParent; + end; + -- Get joints stored inside connected parts for _, ConnectedPart in pairs(GetConnectedParts(Part)) do for Joint, JointParent in pairs(SearchJoints(ConnectedPart, Part, Whitelist)) do @@ -1038,4 +1043,4 @@ end; InitializeUI(); -- Return core -return getfenv(0); +return getfenv(0); \ No newline at end of file From cf9c8118997601cdb12d5c4dc071dc1ba525db6a Mon Sep 17 00:00:00 2001 From: TTHHKKYY Date: Thu, 9 Feb 2023 21:43:52 -0700 Subject: [PATCH 4/4] Add new materials to material tool. --- Tools/Material.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Tools/Material.lua b/Tools/Material.lua index e010b69..35f244f 100644 --- a/Tools/Material.lua +++ b/Tools/Material.lua @@ -85,6 +85,19 @@ local Materials = { [Enum.Material.Wood] = 'Wood'; [Enum.Material.WoodPlanks] = 'Wood Planks'; [Enum.Material.Glass] = 'Glass'; + [Enum.Material.Asphalt] = 'Asphalt'; + [Enum.Material.Basalt] = 'Basalt'; + [Enum.Material.CrackedLava] = 'Cracked Lava'; + [Enum.Material.Glacier] = 'Glacier'; + [Enum.Material.Ground] = 'Ground'; + [Enum.Material.LeafyGrass] = 'Leafy Grass'; + [Enum.Material.Limestone] = 'Limestone'; + [Enum.Material.Mud] = 'Mud'; + [Enum.Material.Pavement] = 'Pavement'; + [Enum.Material.Rock] = 'Rock'; + [Enum.Material.Salt] = 'Salt'; + [Enum.Material.Sandstone] = 'Sandstone'; + [Enum.Material.Snow] = 'Snow'; }; function MaterialTool:ShowUI() @@ -379,4 +392,4 @@ function RegisterChange() end; -- Return the tool -return MaterialTool; \ No newline at end of file +return MaterialTool;