Open asset in the scene object menu: the context menu of a scene object row has an Open asset entry below Select asset that does the same as a double click on the asset in the asset panel, so it selects the asset and opens its tab; kinds without an editor of their own (sprite, camera, text, collider) are only selected, just like the double click there; e2e 01 right clicks a behavior row and checks the open tab (#176)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e3ebf44593
commit
4b5b91eaaa
3 files changed
+23
-2
No files matched your search
@@ -38,7 +38,7 @@ npm run build # writes dist/ and regenerates index.html; the folder is wh
|
||||
The browser suite and the three example games need a machine with a GPU:
|
||||
|
||||
```bash
|
||||
node tools/seed-e2e.mjs && node tools/e2e.mjs # the editor, 1102 checks (GM_STEPS=20 for one step)
|
||||
node tools/seed-e2e.mjs && node tools/e2e.mjs # the editor, 1103 checks (GM_STEPS=20 for one step)
|
||||
node tools/seed-jumprun.mjs && node tools/smoke-jumprun.mjs
|
||||
node tools/seed-tetris.mjs && node tools/smoke-tetris.mjs
|
||||
node tools/seed-actor.mjs && node tools/smoke-actor.mjs
|
||||
|
||||
@@ -174,6 +174,11 @@ export class HierarchyPanel extends Panel {
|
||||
label: 'Select asset',
|
||||
onSelect: () => object && state.select({ kind: 'asset', assetId: object.assetId }),
|
||||
},
|
||||
{
|
||||
// The same as double-clicking the asset in the asset panel: selects it and opens its tab.
|
||||
label: 'Open asset',
|
||||
onSelect: () => object && state.openAsset(object.assetId),
|
||||
},
|
||||
{
|
||||
label: 'Add collider',
|
||||
disabled: !object || !source || many || !canAddCollider(state.project, source, object),
|
||||
|
||||
@@ -6,7 +6,7 @@ import { same } from '../lib/harness.mjs';
|
||||
* without touching the selection, and selecting a nested object unfolds the way down to it.
|
||||
*/
|
||||
export async function hierarchy(t) {
|
||||
const { check, evaluate, json, click, doubleClick, select, state, shot } = t;
|
||||
const { check, evaluate, json, click, clickText, doubleClick, select, state, shot } = t;
|
||||
const rowIds = () => json('__gm.hierarchyOrder()');
|
||||
const rows = async () => JSON.stringify(await rowIds());
|
||||
const selectionBefore = (await state()).selection;
|
||||
@@ -55,4 +55,20 @@ export async function hierarchy(t) {
|
||||
);
|
||||
await evaluate('__gm.state.select(null); __gm.hierarchyCollapseAll()');
|
||||
check('Collapse all folds everything back', same(await rowIds(), ['o1', 'o2', 'o3', 'o5']), await rows());
|
||||
|
||||
// Open asset in the row's menu does what a double-click in the asset panel does.
|
||||
const spawnerRow = await json(`__gm.hierarchyRow('o5')`);
|
||||
await click(spawnerRow.x, spawnerRow.y, 'right');
|
||||
await clickText('Open asset');
|
||||
const opened = await json('__gm.documents()');
|
||||
const openedSelection = (await state()).selection;
|
||||
check(
|
||||
'Open asset in the row menu selects the asset and opens its tab',
|
||||
opened.active === 'asset:spawner' &&
|
||||
opened.docs.includes('asset:spawner') &&
|
||||
openedSelection?.kind === 'asset' &&
|
||||
openedSelection.assetId === 'spawner',
|
||||
JSON.stringify({ opened, openedSelection }),
|
||||
);
|
||||
await evaluate(`__gm.closeDocument('asset:spawner'); __gm.state.select(null)`);
|
||||
}
|
||||
Reference in new issue
Block a user