Skip to content

Commit 8f5444e

Browse files
committed
Merge remote-tracking branch 'origin/main' into test/chore-sync
# Conflicts: # packages/@dcl/inspector/src/lib/babylon/decentraland/gizmo-manager.ts
2 parents d0b0754 + c0a4156 commit 8f5444e

45 files changed

Lines changed: 917 additions & 712 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/sync-main-to-experimental.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,25 @@ jobs:
2323
run: |
2424
git config user.name "github-actions[bot]"
2525
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
26+
git config pull.rebase false # Always merge, never rebase
2627
2728
- name: Sync main into experimental branch
2829
run: |
29-
# Always use the same rolling branch
3030
BRANCH_NAME="chore/sync"
3131
git checkout -B $BRANCH_NAME origin/experimental
3232
33-
# Pull main changes into experimental branch
34-
git pull origin main
35-
36-
git checkout --theirs .
37-
git add -A .
33+
# Merge main changes into experimental, preferring main changes on conflicts
34+
git fetch origin main
35+
git merge -X theirs origin/main || echo "Merge completed (conflicts auto-resolved in favor of main)"
3836
3937
# Run required update steps
4038
make update-protocol 'experimental'
4139
make install
4240
make build
4341
make update-snapshots
4442
45-
# Add updated files
46-
git add -A .
47-
4843
# Commit if there are changes
44+
git add -A .
4945
git commit --no-edit || echo "No changes to commit"
5046
5147
# Push (force to keep PR updated)

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"bugs": "https://github.com/decentraland/js-sdk-toolchain/issues",
77
"dependencies": {
88
"@actions/core": "^1.10.0",
9-
"@dcl/protocol": "1.0.0-16564528964.commit-5630df7",
9+
"@dcl/protocol": "1.0.0-16572701298.commit-25e60c0",
1010
"@dcl/quickjs-emscripten": "^0.21.0-3680274614.commit-1808aa1",
1111
"@dcl/ts-proto": "1.153.0",
1212
"@types/fs-extra": "^9.0.12",

packages/@dcl/inspector/src/components/Hierarchy/Hierarchy.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ const Hierarchy: React.FC = () => {
8484
canDuplicate,
8585
canDrag,
8686
canReorder,
87-
centerViewOnEntity
87+
centerViewOnEntity,
88+
isRoot
8889
} = useTree()
8990
const selectedEntities = useEntitiesWith((components) => components.Selection)
9091
const [lastSelectedItem, setLastSelectedItem] = useState<Entity | undefined>(undefined)
@@ -173,7 +174,8 @@ const Hierarchy: React.FC = () => {
173174
canDuplicate: canDuplicate,
174175
canDrag: canDrag,
175176
canReorder: canReorder,
176-
onLastSelectedChange: handleLastSelectedChange
177+
onLastSelectedChange: handleLastSelectedChange,
178+
isRoot: isRoot
177179
}
178180

179181
return (

packages/@dcl/inspector/src/components/Renderer/Metrics/Metrics.css

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,32 @@
4747
.Metrics > .Overlay {
4848
display: flex;
4949
flex-direction: column;
50-
width: 250px;
50+
width: 300px;
5151
position: absolute;
5252
overflow-y: auto;
5353
left: 0;
5454
bottom: calc(var(--metrics-bottom) + var(--metrics-button-height) + 8px);
5555
background-color: var(--base-19);
5656
padding: 13px 12px;
5757
border-radius: 4px;
58-
gap: 16px;
5958
}
6059

61-
.Metrics > .Overlay h2.Header {
60+
.Metrics > .Overlay .Description {
6261
display: flex;
63-
font-size: 14px;
62+
font-size: 12px;
6463
font-weight: 500;
6564
line-height: 17px;
66-
color: var(--base-01);
65+
color: var(--base-09);
6766
margin-bottom: 0;
6867
gap: 4px;
6968
}
7069

70+
.Metrics > .Overlay .Header {
71+
font-size: 14px;
72+
font-weight: 500;
73+
margin-bottom: 8px;
74+
}
75+
7176
.Metrics > .Overlay .Item .Title,
7277
.Metrics > .Overlay .Item .Description,
7378
.Metrics > .Overlay .Item .Description .Key {
@@ -112,6 +117,18 @@
112117
line-height: 14px;
113118
}
114119

120+
.Metrics > .Overlay .WarningItem {
121+
display: flex;
122+
align-items: center;
123+
gap: 4px;
124+
font-size: 12px;
125+
font-weight: 500;
126+
line-height: 17px;
127+
color: var(--warning-main);
128+
margin-bottom: 0;
129+
gap: 4px;
130+
}
131+
115132
.Metrics > .Overlay .Item .Description .Key {
116133
display: flex;
117134
align-items: center;
@@ -125,9 +142,31 @@
125142
.Metrics .Buttons .Button.LimitExceeded svg,
126143
.Metrics > .Overlay .Item .Description.LimitExceeded,
127144
.Metrics > .Overlay .Item .Description.LimitExceeded .secondary {
128-
color: var(--error-dark);
145+
color: var(--warning-main);
129146
}
130147

131148
.Metrics .Buttons .Button.Active.LimitExceeded svg {
132-
color: var(--error-main);
149+
color: var(--warning-main);
150+
}
151+
152+
.Metrics > .Overlay .WarningsContainer {
153+
display: flex;
154+
flex-direction: column;
155+
gap: 12px;
156+
margin-top: 12px;
157+
}
158+
159+
.Metrics > .Overlay .WarningIcon {
160+
color: var(--warning-main);
161+
width: 16px;
162+
height: 16px;
163+
flex-shrink: 0;
164+
}
165+
166+
.Metrics > .Overlay .WarningText {
167+
font-size: 12px;
168+
font-weight: 400;
169+
color: var(--warning-main);
170+
line-height: 16px;
171+
margin: 0;
133172
}

packages/@dcl/inspector/src/components/Renderer/Metrics/Metrics.tsx

Lines changed: 73 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
import React, { useCallback, useEffect, useMemo } from 'react'
22
import cx from 'classnames'
3-
import { IoGridOutline as SquaresGridIcon, IoAlertCircleOutline as AlertIcon } from 'react-icons/io5'
3+
import { IoGridOutline as SquaresGridIcon } from 'react-icons/io5'
4+
import { FiAlertTriangle as WarningIcon } from 'react-icons/fi'
5+
46
import { Material } from '@babylonjs/core'
57
import { CrdtMessageType } from '@dcl/ecs'
68

79
import { withSdk, WithSdkProps } from '../../../hoc/withSdk'
810
import { useChange } from '../../../hooks/sdk/useChange'
911
import { useOutsideClick } from '../../../hooks/useOutsideClick'
1012
import { useAppDispatch, useAppSelector } from '../../../redux/hooks'
11-
import { getMetrics, getLimits, setEntitiesOutOfBoundaries, setMetrics, setLimits } from '../../../redux/scene-metrics'
13+
import {
14+
getMetrics,
15+
getLimits,
16+
getEntitiesOutOfBoundaries,
17+
setEntitiesOutOfBoundaries,
18+
setMetrics,
19+
setLimits
20+
} from '../../../redux/scene-metrics'
1221
import { SceneMetrics } from '../../../redux/scene-metrics/types'
1322
import type { Layout } from '../../../lib/utils/layout'
1423
import { GROUND_MESH_PREFIX, PARCEL_SIZE } from '../../../lib/utils/scene'
24+
import { getLayoutManager } from '../../../lib/babylon/decentraland/layout-manager'
1525
import { Button } from '../../Button'
1626
import { getSceneLimits } from './utils'
1727

@@ -55,6 +65,7 @@ const Metrics = withSdk<WithSdkProps>(({ sdk }) => {
5565
const dispatch = useAppDispatch()
5666
const metrics = useAppSelector(getMetrics)
5767
const limits = useAppSelector(getLimits)
68+
const entitiesOutOfBoundaries = useAppSelector(getEntitiesOutOfBoundaries)
5869
const [showMetrics, setShowMetrics] = React.useState(false)
5970
const [sceneLayout, setSceneLayout] = React.useState<Layout>({
6071
base: { x: 0, y: 0 },
@@ -107,12 +118,21 @@ const Metrics = withSdk<WithSdkProps>(({ sdk }) => {
107118

108119
const handleSceneChange = useCallback(() => {
109120
const nodes = getNodes()
110-
const entitiesOutOfBoundaries = nodes.reduce((count, node) => {
121+
const { isEntityOutsideLayout } = getLayoutManager(sdk.scene)
122+
123+
const entitiesOutOfBoundariesArray: number[] = []
124+
125+
nodes.forEach((node) => {
111126
const entity = sdk.sceneContext.getEntityOrNull(node.entity)
112-
return entity && entity.isOutOfBoundaries() ? count + 1 : count
113-
}, 0)
127+
if (entity && entity.boundingInfoMesh) {
128+
const isOutside = isEntityOutsideLayout(entity.boundingInfoMesh)
129+
if (isOutside) {
130+
entitiesOutOfBoundariesArray.push(node.entity)
131+
}
132+
}
133+
})
114134

115-
dispatch(setEntitiesOutOfBoundaries(entitiesOutOfBoundaries))
135+
dispatch(setEntitiesOutOfBoundaries(entitiesOutOfBoundariesArray))
116136
}, [sdk, dispatch, getNodes, setEntitiesOutOfBoundaries])
117137

118138
useEffect(() => {
@@ -155,6 +175,10 @@ const Metrics = withSdk<WithSdkProps>(({ sdk }) => {
155175
)
156176
}, [metrics, limits])
157177

178+
const isAnyLimitExceeded = (limitsExceeded: Record<string, any>): boolean => {
179+
return Object.values(limitsExceeded).length > 0 || entitiesOutOfBoundaries.length > 0
180+
}
181+
158182
const handleToggleMetricsOverlay = useCallback(
159183
(e: React.MouseEvent<HTMLButtonElement> | MouseEvent) => {
160184
e.preventDefault()
@@ -166,30 +190,49 @@ const Metrics = withSdk<WithSdkProps>(({ sdk }) => {
166190

167191
const overlayRef = useOutsideClick(handleToggleMetricsOverlay)
168192

193+
const getWarningMessages = (): string[] => {
194+
const baseMessage = 'Your scene contains too many'
195+
const warnings: string[] = []
196+
197+
Object.entries(limitsExceeded).forEach(([key, isExceeded]) => {
198+
if (isExceeded) {
199+
warnings.push(`${baseMessage} ${key}`)
200+
}
201+
})
202+
203+
if (entitiesOutOfBoundaries.length > 0) {
204+
warnings.push(
205+
`${entitiesOutOfBoundaries.length} entit${
206+
entitiesOutOfBoundaries.length === 1 ? 'y is' : 'ies are'
207+
} out of bounds and may not display correctly in-world.`
208+
)
209+
}
210+
211+
return warnings
212+
}
213+
214+
const warningMessages = getWarningMessages()
215+
169216
return (
170217
<div className="Metrics">
171218
<div className="Buttons">
172219
<Button
173-
className={cx({ Active: showMetrics, LimitExceeded: Object.values(limitsExceeded).length > 0 })}
220+
className={cx({ Active: showMetrics, LimitExceeded: isAnyLimitExceeded(limitsExceeded) })}
174221
onClick={handleToggleMetricsOverlay}
175222
>
176223
<SquaresGridIcon size={ICON_SIZE} />
177224
</Button>
178225
</div>
179-
{Object.values(limitsExceeded).length > 0 && (
180-
<div className="LimitExceeded">
181-
<AlertIcon />
182-
Too many {Object.keys(limitsExceeded)[0].toUpperCase()}
183-
</div>
184-
)}
185226
{showMetrics && (
186227
<div ref={overlayRef} className="Overlay">
187-
<h2 className="Header">
188-
{sceneLayout.parcels.length} Parcels
189-
<span className="secondary">
190-
{sceneLayout.parcels.length * PARCEL_SIZE}m<sup>2</sup>
191-
</span>
192-
</h2>
228+
<h2 className="Header">Scene Optimization</h2>
229+
<div className="Description">Suggested Specs per Parcel</div>
230+
<div className="Description">
231+
{sceneLayout.parcels.length} Parcels = {sceneLayout.parcels.length * PARCEL_SIZE}
232+
<div>
233+
m<sup>2</sup>
234+
</div>
235+
</div>
193236
<div className="Items">
194237
{Object.entries(metrics).map(([key, value]) => (
195238
<div className="Item" key={key}>
@@ -202,6 +245,17 @@ const Metrics = withSdk<WithSdkProps>(({ sdk }) => {
202245
</div>
203246
))}
204247
</div>
248+
{warningMessages.length > 0 && (
249+
<div className="WarningsContainer">
250+
<div className="Description">WARNINGS</div>
251+
{warningMessages.map((message, index) => (
252+
<div className="WarningItem" key={index}>
253+
<WarningIcon className="WarningIcon" />
254+
<span className="WarningText">{message}</span>
255+
</div>
256+
))}
257+
</div>
258+
)}
205259
</div>
206260
)}
207261
</div>

packages/@dcl/inspector/src/components/Tree/Tree.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,7 @@
9898
.Tree .contexify_item {
9999
width: 100%;
100100
}
101+
102+
.Tree .WarningIcon {
103+
color: var(--warning-main);
104+
}

0 commit comments

Comments
 (0)