Skip to content

Commit

Permalink
Merge branch 'main' into buffer-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
memorycode authored Aug 24, 2024
2 parents 08e631f + 2604284 commit cb68c93
Show file tree
Hide file tree
Showing 10 changed files with 204 additions and 53 deletions.
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,33 @@ The format is based on [Keep a Changelog][kac], and this project adheres to
- Deprecated the return type of `World:remove()` because it can now be inaccurate.
- Deprecated `World:optimizeQueries()` because it no longer does anything.

## [0.8.4] - 2024-08-15

### Added

- Better assertions / error messages added to `World` methods that accept
variadic component arguments. At least 1 component must be provided. These
assertions have been added to `get` `insert` `replace` `remove`
- Ability to sort the world inspect table by clicking the table headers (entity
count and component name)
- Ability to disable systems in the debugger list by right clicking them.

### Changed

- The alt-hover tooltip's text is smaller and the background is slightly darker
for improved legibility.
- Component data now has syntax highlighting applied. This is present in the
**alt-hover tooltip** and the **entity inspector panel** in the debugger.

### Fixed

- The alt-hover tooltip now displays component data properly, with each
component being displayed on a new line.
- Removed extra new-lines in component data strings within the debugger entity
inspect tables.
- Fixed alt-hover erroring when hovered entity is despawned.
- Fixed flashing buttons ("View queries" and "View logs") in system inspect panel

## [0.8.3] - 2024-07-02

### Fixed
Expand Down Expand Up @@ -301,7 +328,8 @@ The format is based on [Keep a Changelog][kac], and this project adheres to

- Initial release

[unreleased]: https://github.com/matter-ecs/matter/compare/v0.8.3...HEAD
[unreleased]: https://github.com/matter-ecs/matter/compare/v0.8.4...HEAD
[0.8.4]: https://github.com/matter-ecs/matter/releases/tag/v0.8.4
[0.8.3]: https://github.com/matter-ecs/matter/releases/tag/v0.8.3
[0.8.2]: https://github.com/matter-ecs/matter/releases/tag/v0.8.2
[0.8.1]: https://github.com/matter-ecs/matter/releases/tag/v0.8.1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Matter can be installed with [Wally] by including it as a dependency in your
`wally.toml` file.

```toml
Matter = "matter-ecs/[email protected].3"
Matter = "matter-ecs/[email protected].4"
```

## Migration
Expand Down
2 changes: 1 addition & 1 deletion docs/Guides/Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Migrating from `evaera/matter` to `matter-ecs/matter` is easy! The only thing yo

```toml title="wally.toml"
[dependencies]
matter = "matter-ecs/[email protected].3"
matter = "matter-ecs/[email protected].4"
```
2 changes: 1 addition & 1 deletion docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ wally = "UpliftGames/[email protected]"

```toml title="wally.toml"
[dependencies]
matter = "matter-ecs/[email protected].3"
matter = "matter-ecs/[email protected].4"
```

6. Run `wally install`.
Expand Down
39 changes: 29 additions & 10 deletions lib/debugger/clientBindings.luau
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
local UserInputService = game:GetService("UserInputService")
local CollectionService = game:GetService("CollectionService")

local tags = {
system = "MatterDebuggerTooltip_System",
altHover = "MatterDebuggerTooltip_AltHover",
}

local function getOffset(mousePos: Vector2, tag: string): UDim2
if tag == tags.altHover then
return UDim2.fromOffset(mousePos.X + 20, mousePos.Y)
elseif tag == tags.system then
return UDim2.fromOffset(mousePos.X + 20, mousePos.Y + 10)
end

return UDim2.fromOffset(mousePos.X, mousePos.Y + 10)
end

local function clientBindings(debugger)
local connections = {}

Expand All @@ -21,20 +37,23 @@ local function clientBindings(debugger)

local mousePosition = UserInputService:GetMouseLocation()

for _, gui in CollectionService:GetTagged("MatterDebuggerTooltip") do
gui.Position = UDim2.new(0, mousePosition.X + 20, 0, mousePosition.Y)
for _, tag in tags do
for _, gui in CollectionService:GetTagged(tag) do
gui.Position = getOffset(mousePosition, tag)
end
end
end)
)

table.insert(
connections,
CollectionService:GetInstanceAddedSignal("MatterDebuggerTooltip"):Connect(function(gui)
local mousePosition = UserInputService:GetMouseLocation()

gui.Position = UDim2.new(0, mousePosition.X + 20, 0, mousePosition.Y)
end)
)
for _, tag in tags do
table.insert(
connections,
CollectionService:GetInstanceAddedSignal(tag):Connect(function(gui)
local mousePosition = UserInputService:GetMouseLocation()
gui.Position = getOffset(mousePosition, tag)
end)
)
end

return connections
end
Expand Down
84 changes: 64 additions & 20 deletions lib/debugger/ui.luau
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ end

local IS_SERVER = RunService:IsServer()
local IS_CLIENT = RunService:IsClient()
local LONG_SYSTEM_NAME = 24

local function ui(debugger, loop)
local plasma = debugger.plasma
local custom = debugger._customWidgets
local skipSystems = loop._skipSystems

plasma.setStyle({
primaryColor = Color3.fromHex("bd515c"),
Expand All @@ -48,6 +50,8 @@ local function ui(debugger, loop)
end
end

local hoveredSystem

custom.container(function()
if debugger:_isServerView() then
return
Expand Down Expand Up @@ -141,7 +145,7 @@ local function ui(debugger, loop)
})
plasma.space(5)

local items = {}
local listOfSystems = {}

for _, system in systems do
local samples = loop.profiling[system]
Expand All @@ -168,23 +172,48 @@ local function ui(debugger, loop)
icon = "\xf0\x9f\x92\xa5"
end

table.insert(items, {
text = systemName(system),
sideText = averageFrameTime,
local barWidth
if longestDuration == 0 then
barWidth = 0
else
barWidth = duration / longestDuration
end

local systemIsDisabled = skipSystems[system]
local systemName = systemName(system)
local length = string.len(systemName)

if systemIsDisabled then
length += 4
end

table.insert(listOfSystems, {
text = if systemIsDisabled then `<i><s>{systemName}</s></i>` else systemName,
sideText = if systemIsDisabled then `<b>{"(disabled)"}</b>` else averageFrameTime,
selected = debugger.debugSystem == system,
system = system,
icon = icon,
barWidth = duration / longestDuration,
barWidth = barWidth,
index = index,
})
end

local selected = custom.selectionList(items):selected()
local systemList = custom.selectionList(listOfSystems, custom)
local selected = systemList:selected()
local rightClicked = systemList:rightClicked()
hoveredSystem = systemList:hovered()

if selected then
if selected.system == debugger.debugSystem then
local selectedSystem = selected.system
if selectedSystem == debugger.debugSystem then
debugger.debugSystem = nil
else
debugger.debugSystem = selected.system
debugger.debugSystem = selectedSystem
end
elseif rightClicked then
local rightClickedSystem = rightClicked.system
if rightClickedSystem then
skipSystems[rightClickedSystem] = not skipSystems[rightClickedSystem]
end
end

Expand Down Expand Up @@ -234,28 +263,26 @@ local function ui(debugger, loop)
}, function()
plasma.useKey(name)

plasma.row(function()
if plasma.button(string.format("View queries (%d)", #debugger._queries)):clicked() then
setQueriesOpen(true)
end
if plasma.button(string.format("View queries (%d)", #debugger._queries)):clicked() then
setQueriesOpen(true)
end

if numLogs > 0 then
if plasma.button(string.format("View logs (%d)", numLogs)):clicked() then
setLogsOpen(true)
end
if numLogs > 0 then
if plasma.button(string.format("View logs (%d)", numLogs)):clicked() then
setLogsOpen(true)
end
end)
end

local currentlyDisabled = loop._skipSystems[debugger.debugSystem]
local currentlyDisabled = skipSystems[debugger.debugSystem]

if
plasma
.checkbox("Disable system", {
.checkbox("<font size='13'>Disable System</font>", {
checked = currentlyDisabled,
})
:clicked()
then
loop._skipSystems[debugger.debugSystem] = not currentlyDisabled
skipSystems[debugger.debugSystem] = not currentlyDisabled
end
end)
:closed()
Expand Down Expand Up @@ -311,6 +338,23 @@ local function ui(debugger, loop)
direction = Enum.FillDirection.Horizontal,
padding = 0,
})

if hoveredSystem and hoveredSystem.system then
local hoveredSystemName = systemName(hoveredSystem.system)
local length = string.len(hoveredSystemName)
local systemDisabled = skipSystems[hoveredSystem.system]

if systemDisabled then
length += 2
end

if length >= LONG_SYSTEM_NAME then
custom.tooltip(`<b>{hoveredSystemName}{if systemDisabled then " (disabled)" else ""}</b>`, {
tag = "MatterDebuggerTooltip_System",
backgroundTransparency = 0,
})
end
end
end

return ui
5 changes: 4 additions & 1 deletion lib/debugger/widgets/hoverInspect.luau
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ return function(plasma)
end
end

custom.tooltip(str)
custom.tooltip(str, {
tag = "MatterDebuggerTooltip_AltHover",
backgroundTransparency = 0.15,
})
end)
end
Loading

0 comments on commit cb68c93

Please sign in to comment.