diff --git a/App/Roblox Figma Importer Assistant/code.js b/App/Roblox Figma Importer Assistant/code.js index 2752c72..60be85a 100644 --- a/App/Roblox Figma Importer Assistant/code.js +++ b/App/Roblox Figma Importer Assistant/code.js @@ -20,7 +20,7 @@ figma.ui.onmessage = msg => { type: node.type, name: node.name, - //visible: node.visible, + visible: node.visible, width: node.width, height: node.height, @@ -29,11 +29,10 @@ figma.ui.onmessage = msg => { strokeWeight: node.strokeWeight, opacity: node.opacity, - //rotation: node.rotation, + rotation: node.rotation, clipsContent: node.clipsContent, fills: node.fills, - // cornerRadius: node.cornerRadius, - // strokeWeight: node.strokeWeight, + cornerRadius: node.cornerRadius, // strokes: node.strokes, children: [] diff --git a/sourcemap.json b/sourcemap.json new file mode 100644 index 0000000..0f6734b --- /dev/null +++ b/sourcemap.json @@ -0,0 +1 @@ +{"name":"Figma-Import-Assistant","className":"DataModel","filePaths":["default.project.json"],"children":[{"name":"ServerStorage","className":"ServerStorage","children":[{"name":"Plugins","className":"Folder","children":[{"name":"FigmaImportAssistant","className":"Folder","children":[{"name":"Main","className":"LocalScript","filePaths":["src/FigmaImportAssistant\\Main\\init.client.lua"],"children":[{"name":"Component","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Component.lua"]},{"name":"CorrectionHandler","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\CorrectionHandler\\init.lua"],"children":[{"name":"AppImportInterpreter","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\CorrectionHandler\\AppImportInterpreter.lua"]},{"name":"Applicator","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\CorrectionHandler\\Applicator.lua"]},{"name":"Creator","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\CorrectionHandler\\Creator.lua"]}]},{"name":"Interface","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\init.lua"],"children":[{"name":"Build","className":"Folder","children":[{"name":"AlignmentInputs","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\Build\\AlignmentInputs.json"]},{"name":"ImportInputs","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\Build\\ImportInputs.json"]},{"name":"InstanceCreationButtons","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\Build\\InstanceCreationButtons.json"]},{"name":"Sections","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\Build\\Sections.json"]},{"name":"TextInputBuildData","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\Build\\TextInputBuildData.json"]}]},{"name":"InstanceCreationButton","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\InstanceCreationButton.lua"]},{"name":"Keybinds","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\Keybinds\\init.lua"],"children":[{"name":"BuildCommands","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\Keybinds\\BuildCommands.lua"]},{"name":"Keybind","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\Keybinds\\Keybind.lua"]}]},{"name":"SearchWidget","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\SearchWidget.lua"]},{"name":"SectionFrame","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\SectionFrame.lua"]},{"name":"TextInputSection","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Interface\\TextInputSection.lua"]}]},{"name":"Utility","className":"ModuleScript","filePaths":["src/FigmaImportAssistant\\Main\\Utility.lua"]}]},{"name":"Packages","className":"Folder","children":[{"name":"Fusion","className":"ModuleScript","filePaths":["Packages\\Fusion.lua"]},{"name":"PluginEssentials","className":"ModuleScript","filePaths":["Packages\\PluginEssentials.lua"]},{"name":"_Index","className":"Folder","children":[{"name":"aloroid_pluginessentials@0.1.2","className":"Folder","children":[{"name":"pluginessentials","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\init.lua","Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\default.project.json"],"children":[{"name":"PluginComponents","className":"Folder","children":[{"name":"Toolbar","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\PluginComponents\\Toolbar.lua"]},{"name":"ToolbarButton","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\PluginComponents\\ToolbarButton.lua"]},{"name":"Widget","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\PluginComponents\\Widget.lua"]}]},{"name":"StudioComponents","className":"Folder","children":[{"name":"Background","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Background.lua"]},{"name":"BaseButton","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\BaseButton.lua"]},{"name":"BaseScrollFrame","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\BaseScrollFrame\\init.lua"],"children":[{"name":"ScrollArrow","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\BaseScrollFrame\\ScrollArrow.lua"]},{"name":"ScrollBar","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\BaseScrollFrame\\ScrollBar.lua"]}]},{"name":"BoxBorder","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\BoxBorder.lua"]},{"name":"Button","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Button.lua"]},{"name":"Checkbox","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Checkbox.lua"]},{"name":"ClassIcon","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\ClassIcon.lua"]},{"name":"ColorPicker","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\ColorPicker.lua"]},{"name":"Dropdown","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Dropdown\\init.lua"],"children":[{"name":"Constants","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Dropdown\\Constants.lua"]},{"name":"DropdownItem","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Dropdown\\DropdownItem.lua"]}]},{"name":"IconButton","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\IconButton.lua"]},{"name":"Label","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Label.lua"]},{"name":"Licenses","className":"Folder","children":[{"name":"StudioComponents","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Licenses\\StudioComponents.lua"]}]},{"name":"LimitedTextInput","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\LimitedTextInput.lua"]},{"name":"Loading","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Loading.lua"]},{"name":"MainButton","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\MainButton.lua"]},{"name":"ProgressBar","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\ProgressBar.lua"]},{"name":"ScrollFrame","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\ScrollFrame.lua"]},{"name":"Shadow","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Shadow.lua"]},{"name":"Slider","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Slider.lua"]},{"name":"TextInput","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\TextInput.lua"]},{"name":"Title","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Title.lua"]},{"name":"Util","className":"Folder","children":[{"name":"constants","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Util\\constants.lua"]},{"name":"getDragInput","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Util\\getDragInput.lua"]},{"name":"getModifier","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Util\\getModifier.lua"]},{"name":"getMotionState","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Util\\getMotionState.lua"]},{"name":"getSelectedState","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Util\\getSelectedState.lua"]},{"name":"getState","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Util\\getState.lua"]},{"name":"stripProps","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Util\\stripProps.lua"]},{"name":"themeProvider","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Util\\themeProvider.lua"]},{"name":"types","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Util\\types.lua"]},{"name":"unwrap","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\Util\\unwrap.lua"]}]},{"name":"VerticalCollapsibleSection","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\VerticalCollapsibleSection.lua"]},{"name":"VerticalExpandingList","className":"ModuleScript","filePaths":["Packages\\_Index\\aloroid_pluginessentials@0.1.2\\pluginessentials\\src\\StudioComponents\\VerticalExpandingList.lua"]}]}]}]},{"name":"elttob_fusion@0.2.0","className":"Folder","children":[{"name":"fusion","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\init.lua","Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\default.project.json"],"children":[{"name":"Animation","className":"Folder","children":[{"name":"Spring","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Animation\\Spring.lua"]},{"name":"SpringScheduler","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Animation\\SpringScheduler.lua"]},{"name":"Tween","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Animation\\Tween.lua"]},{"name":"TweenScheduler","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Animation\\TweenScheduler.lua"]},{"name":"getTweenRatio","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Animation\\getTweenRatio.lua"]},{"name":"lerpType","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Animation\\lerpType.lua"]},{"name":"packType","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Animation\\packType.lua"]},{"name":"springCoefficients","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Animation\\springCoefficients.lua"]},{"name":"unpackType","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Animation\\unpackType.lua"]}]},{"name":"Colour","className":"Folder","children":[{"name":"Oklab","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Colour\\Oklab.lua"]}]},{"name":"Dependencies","className":"Folder","children":[{"name":"captureDependencies","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Dependencies\\captureDependencies.lua"]},{"name":"initDependency","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Dependencies\\initDependency.lua"]},{"name":"sharedState","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Dependencies\\sharedState.lua"]},{"name":"updateAll","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Dependencies\\updateAll.lua"]},{"name":"useDependency","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Dependencies\\useDependency.lua"]}]},{"name":"Instances","className":"Folder","children":[{"name":"Children","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Instances\\Children.lua"]},{"name":"Cleanup","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Instances\\Cleanup.lua"]},{"name":"Hydrate","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Instances\\Hydrate.lua"]},{"name":"New","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Instances\\New.lua"]},{"name":"OnChange","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Instances\\OnChange.lua"]},{"name":"OnEvent","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Instances\\OnEvent.lua"]},{"name":"Out","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Instances\\Out.lua"]},{"name":"Ref","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Instances\\Ref.lua"]},{"name":"applyInstanceProps","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Instances\\applyInstanceProps.lua"]},{"name":"defaultProps","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Instances\\defaultProps.lua"]}]},{"name":"Logging","className":"Folder","children":[{"name":"logError","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Logging\\logError.lua"]},{"name":"logErrorNonFatal","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Logging\\logErrorNonFatal.lua"]},{"name":"logWarn","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Logging\\logWarn.lua"]},{"name":"messages","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Logging\\messages.lua"]},{"name":"parseError","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Logging\\parseError.lua"]}]},{"name":"PubTypes","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\PubTypes.lua"]},{"name":"State","className":"Folder","children":[{"name":"Computed","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\State\\Computed.lua"]},{"name":"ForKeys","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\State\\ForKeys.lua"]},{"name":"ForPairs","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\State\\ForPairs.lua"]},{"name":"ForValues","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\State\\ForValues.lua"]},{"name":"Observer","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\State\\Observer.lua"]},{"name":"Value","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\State\\Value.lua"]},{"name":"unwrap","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\State\\unwrap.lua"]}]},{"name":"Types","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Types.lua"]},{"name":"Utility","className":"Folder","children":[{"name":"None","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Utility\\None.lua"]},{"name":"cleanup","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Utility\\cleanup.lua"]},{"name":"doNothing","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Utility\\doNothing.lua"]},{"name":"isSimilar","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Utility\\isSimilar.lua"]},{"name":"needsDestruction","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Utility\\needsDestruction.lua"]},{"name":"restrictRead","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Utility\\restrictRead.lua"]},{"name":"xtypeof","className":"ModuleScript","filePaths":["Packages\\_Index\\elttob_fusion@0.2.0\\fusion\\src\\Utility\\xtypeof.lua"]}]}]}]}]}]}]}]}]}]} \ No newline at end of file diff --git a/src/FigmaImportAssistant/Main/CorrectionHandler/AppImportInterpreter.lua b/src/FigmaImportAssistant/Main/CorrectionHandler/AppImportInterpreter.lua index 6d68903..8c19619 100644 --- a/src/FigmaImportAssistant/Main/CorrectionHandler/AppImportInterpreter.lua +++ b/src/FigmaImportAssistant/Main/CorrectionHandler/AppImportInterpreter.lua @@ -37,9 +37,10 @@ local function ReadRecursive(ParentTable) Image = "", Stroke = Child.strokeWeight or 0, Oblique = 0, + IsGroup = Child.type == "GROUP", -- Unique data from import - Type = if Child.opacity == 0 and Child.strokeWeight == 0 then "Frame" else "ImageLabel" + Type = if Child.type == "GROUP" then "Frame" elseif Child.opacity == 0 and Child.strokeWeight == 0 then "Frame" else "ImageLabel" } if Child.children then diff --git a/src/FigmaImportAssistant/Main/CorrectionHandler/Applicator.lua b/src/FigmaImportAssistant/Main/CorrectionHandler/Applicator.lua index 4acb236..19af25d 100644 --- a/src/FigmaImportAssistant/Main/CorrectionHandler/Applicator.lua +++ b/src/FigmaImportAssistant/Main/CorrectionHandler/Applicator.lua @@ -9,65 +9,69 @@ local Children = Fusion.Children function Applicator:ApplyChangesFromData(SelectedInstance : Instance, Data : {}) local Size = Vector2.new(Data.Size.X, Data.Size.Y) - local Position = Vector2.new(Data.Position.X, Data.Position.Y) + local Position = Vector2.new(Data.Position.X, Data.Position.Y) - Utility.CreateUndoMarkerStart() + Utility.CreateUndoMarkerStart() - if SelectedInstance:IsA("ScreenGui") then - SelectedInstance:SetAttribute("FigmaSize", Size) - SelectedInstance:SetAttribute("FigmaPosition", Position) - SelectedInstance.Name = Data.Name - return - end + if SelectedInstance:IsA("ScreenGui") then + SelectedInstance:SetAttribute("FigmaSize", Size) + SelectedInstance:SetAttribute("FigmaPosition", Position) + SelectedInstance.Name = Data.Name + Utility.CreateUndoMarkerEnd() + return + end - local AnchorPoint = Vector2.new(Data.AnchorPoint.X or 0, Data.AnchorPoint.Y or 0) - local Stroke = Data.Stroke - local Oblique = Data.Oblique - local CorrectedSize = Size + Vector2.new(Stroke * 2, Stroke * 2) + Vector2.new(0, Oblique) - local CorrectedPosition = Position - Vector2.new(Stroke, Stroke) - Vector2.new(0, Oblique) - local FinalSize = CorrectedSize - local FinalPosition = CorrectedPosition + local AnchorPoint = Vector2.new(Data.AnchorPoint.X or 0, Data.AnchorPoint.Y or 0) + local Stroke = Data.Stroke + local Oblique = Data.Oblique + local CorrectedSize = Size + Vector2.new(Stroke * 2, Stroke * 2) + Vector2.new(0, Oblique) + local CorrectedPosition = Position - Vector2.new(Stroke, Stroke) - Vector2.new(0, Oblique) + local FinalSize = CorrectedSize + local FinalPosition = CorrectedPosition - SelectedInstance:SetAttribute("FigmaSize", Size) - SelectedInstance:SetAttribute("FigmaPosition", Position) + SelectedInstance:SetAttribute("FigmaSize", Size) + SelectedInstance:SetAttribute("FigmaPosition", Position) - if SelectedInstance.Parent:GetAttribute("FigmaStrokeThickness") then - local Stroke = SelectedInstance.Parent:GetAttribute("FigmaStrokeThickness") - Stroke - FinalSize -= Vector2.new(Stroke, Stroke) * 2 - FinalPosition += Vector2.new(Stroke, Stroke) - end + if SelectedInstance.Parent:GetAttribute("FigmaStrokeThickness") then + local Stroke = SelectedInstance.Parent:GetAttribute("FigmaStrokeThickness") - Stroke + FinalSize -= Vector2.new(Stroke, Stroke) * 2 + FinalPosition += Vector2.new(Stroke, Stroke) + end - if SelectedInstance.Parent:GetAttribute("FigmaObliqueSize") then - local Oblique = SelectedInstance.Parent:GetAttribute("FigmaObliqueSize") - Oblique - FinalSize -= Vector2.new(0, Oblique) - end + if SelectedInstance.Parent:GetAttribute("FigmaObliqueSize") then + local Oblique = SelectedInstance.Parent:GetAttribute("FigmaObliqueSize") - Oblique + FinalSize -= Vector2.new(0, Oblique) + end - local ScaledSize = Utility.ConvertToContextualScale(SelectedInstance, FinalSize) - local ScaledPosition = Utility.ConvertToContextualScale(SelectedInstance, FinalPosition) + if SelectedInstance.Parent:GetAttribute("IsFigmaImportGroup") then + FinalPosition -= SelectedInstance.Parent:GetAttribute("FigmaPosition") + end + + local ScaledSize = Utility.ConvertToContextualScale(SelectedInstance, FinalSize) + local ScaledPosition = Utility.ConvertToContextualScale(SelectedInstance, FinalPosition) - ScaledPosition += UDim2.fromScale(ScaledSize.X.Scale * AnchorPoint.X, ScaledSize.Y.Scale * AnchorPoint.Y) + ScaledPosition += UDim2.fromScale(ScaledSize.X.Scale * AnchorPoint.X, ScaledSize.Y.Scale * AnchorPoint.Y) - if SelectedInstance:FindFirstChildOfClass("UIAspectRatioConstraint") then - SelectedInstance:FindFirstChildOfClass("UIAspectRatioConstraint"):Destroy() - end - - Hydrate(SelectedInstance) { - Size = ScaledSize, - Position = ScaledPosition, - Name = Data.Name, - AnchorPoint = AnchorPoint, + if SelectedInstance:FindFirstChildOfClass("UIAspectRatioConstraint") then + SelectedInstance:FindFirstChildOfClass("UIAspectRatioConstraint"):Destroy() + end - [Children] = New "UIAspectRatioConstraint" { - AspectRatio = CorrectedSize.X / CorrectedSize.Y, - } - } + Hydrate(SelectedInstance) { + Size = ScaledSize, + Position = ScaledPosition, + Name = Data.Name, + AnchorPoint = AnchorPoint, + [Children] = New "UIAspectRatioConstraint" { + AspectRatio = CorrectedSize.X / CorrectedSize.Y, + } + } - Utility.ApplyImage(SelectedInstance, Data.Image) + Utility.ApplyImage(SelectedInstance, Data.Image) - SelectedInstance:SetAttribute("FigmaStrokeThickness", Stroke) - SelectedInstance:SetAttribute("FigmaObliqueSize", Oblique) + SelectedInstance:SetAttribute("FigmaStrokeThickness", Stroke) + SelectedInstance:SetAttribute("FigmaObliqueSize", Oblique) - Utility.CreateUndoMarkerEnd() + Utility.CreateUndoMarkerEnd() end return Applicator \ No newline at end of file diff --git a/src/FigmaImportAssistant/Main/CorrectionHandler/Creator.lua b/src/FigmaImportAssistant/Main/CorrectionHandler/Creator.lua index b8c0b7c..c622ba0 100644 --- a/src/FigmaImportAssistant/Main/CorrectionHandler/Creator.lua +++ b/src/FigmaImportAssistant/Main/CorrectionHandler/Creator.lua @@ -31,9 +31,10 @@ local function CreateRecursive(Parent, Data : {}) Object = Instance.new(Child.Type) end - Object.ClipsDescendants = Child.clipsContent or true + Object.ClipsDescendants = if Child.clipsContent ~= nil then Child.clipsContent else true Object.BackgroundTransparency = 1 Object.Parent = Parent + Object:SetAttribute("IsFigmaImportGroup", Child.IsGroup) Child.Name = Name Applicator:ApplyChangesFromData(Object, Child)