diff --git a/README.md b/README.md index 023c19d..ce4cacf 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,6 @@ If you don't, then the samples won't be visible to the `Minecraft Bedrock Previe | Farm Generator | Adds a dialog that allows you to place a selection of randomized farms containing different combinations of crops and animals, as well as adding irrigation to help grow plants.

This extension demonstrates the use of UI components, block placement and mouse input.

**Notes**: Activate using CTRL+SHIFT+F or from the tool rail.
**Author**: Molly | | Goto Mark | Adds a dialog that allows you to modify the players current position in the world by directly typing coordinates. In addition, you can set the players default spawn position (and jump to it at any time during editing).
The extension also allows you to set up to 9 custom world locations as named bookmarks, and jump to them at any time during editing.

This extension demonstrates dynamic UI component updates, text input, and persistent storage using entity dynamic properties.

**Notes**: No input required, activated from tool rail.
**Author**: Chloe, Eser & Dave | | Portal Generator | Adds a dialog that allows you to place either Nether or End portals (in various states of completion).

This extension demonstrates dynamic UI component updates, and block placement.

**Notes**: Activated using CTRL+SHIFT+P or from tool rail.
**Author**: Andrew. | -| Simple Empty | Adds an extension which as a very basic set of barely functional components designed to demonstrate setting up a new Editor tool using the Simple Tool wrapper. The extension demonstrates how to set up the data definitions that will ultimately direct how the tool registers itself with the Editor, and sets up the visual layouts - ready for the creator to fill in the functionality.
**Author**: Dave | -| Simple Locate Biome | Adds an extension which demonstrates the use of sub-panes to group together UI controls, and uses the visibility of those sub-panes to create different views of data. The extension also demonstrates the use of the mutually exclusive visibility properties of sub-panes, and some use of the Biome API.
**Author**: Dave & Mitch | | Tree Generator | Adds a dialog that allows you to place a selection of randomized trees of certain types wherever you click in the world.

This extension demonstrates the use of UI components, block placement and mouse input.

**Notes**: Activated using CTRL+SHIFT+T or through the tool rail.
**Author**: Jake || | | diff --git a/camera-grapple/en_US.lang b/camera-grapple/en_US.lang index beb9c28..064f2fa 100644 --- a/camera-grapple/en_US.lang +++ b/camera-grapple/en_US.lang @@ -2,6 +2,14 @@ ## ## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a ## comment on the same line, use TABs. -sample.cameragrapple.title=Camera Base Grapple -sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor -sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection \ No newline at end of file +sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000} +sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000} +sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000} +sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000} \ No newline at end of file diff --git a/dye-brush/dye-brush.ts b/dye-brush/dye-brush.ts index 2fb8f62..3743b0f 100644 --- a/dye-brush/dye-brush.ts +++ b/dye-brush/dye-brush.ts @@ -9,6 +9,7 @@ import { IModalTool, IObservable, IPlayerUISession, + LogChannel, makeObservable, ModalToolLifecycleEventPayload, MouseActionType, @@ -278,6 +279,7 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) { title: 'sample.dyeBrush.pane.title', infoTooltip: { description: ['sample.dyebrush.tool.tooltip'] }, }); + pane.beginConstruct(); const entityBrush = makeObservable(EntityColor.White); @@ -311,11 +313,13 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) { }, }); + pane.endConstruct(); + tool.bindPropertyPane(pane); const onExecuteBrush = () => { if (uiSession.scratchStorage === undefined) { - uiSession.log.error('Storage was not initialized.'); + uiSession.log.error('Storage was not initialized.', { channelMask: LogChannel.All }); return; } @@ -365,7 +369,7 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) { actionType: ActionTypes.MouseRayCastAction, onExecute: (_, mouseProps: MouseProps) => { if (uiSession.scratchStorage === undefined) { - uiSession.log.error('Storage was not initialized.'); + uiSession.log.error('Storage was not initialized.', { channelMask: LogChannel.All }); return; } @@ -407,7 +411,7 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) { const executeBrushSizeAction = uiSession.actionManager.createAction({ actionType: ActionTypes.MouseRayCastAction, onExecute: (_, mouseProps: MouseProps) => { - if (mouseProps.mouseAction === MouseActionType.Wheel) { + if (mouseProps.mouseAction === MouseActionType.Wheel && mouseProps.modifiers.shift) { if (mouseProps.inputType === MouseInputType.WheelOut) { if (entityBrush.value > 0) { entityBrush.set(entityBrush.value - 1); @@ -437,8 +441,6 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) { } uiSession.scratchStorage?.previewSelection?.clearVolume(); }); - - pane.hide(); } export function addDyeBrushTool(uiSession: DyeBrushSession) { diff --git a/dye-brush/en_US.lang b/dye-brush/en_US.lang index b7f94b8..c7cb7b3 100644 --- a/dye-brush/en_US.lang +++ b/dye-brush/en_US.lang @@ -2,6 +2,16 @@ ## ## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a ## comment on the same line, use TABs. -sample.dyebrush.tool.title=Dye Brush +sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000} +sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000} +sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000} sample.dyebrush.tool.tooltip=Change the color of entity color components. The updated color is applied when entity simulation resumes. -sample.dyebrush.pane.colordropdown.title=Color \ No newline at end of file +sample.dyebrush.pane.colordropdown.title=Color +sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000} \ No newline at end of file diff --git a/editor-samples.mceditoraddon b/editor-samples.mceditoraddon index 33f9136..03459fe 100644 Binary files a/editor-samples.mceditoraddon and b/editor-samples.mceditoraddon differ diff --git a/empty/en_US.lang b/empty/en_US.lang index 7643074..a7cf3e0 100644 --- a/empty/en_US.lang +++ b/empty/en_US.lang @@ -2,4 +2,15 @@ ## ## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a ## comment on the same line, use TABs. -sample.empty.title=Empty Template \ No newline at end of file +sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000} +sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000} +sample.empty.title=Empty Template +sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000} +sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000} \ No newline at end of file diff --git a/farm-generator/en_US.lang b/farm-generator/en_US.lang index ea3a5a8..044b4e5 100644 --- a/farm-generator/en_US.lang +++ b/farm-generator/en_US.lang @@ -2,7 +2,12 @@ ## ## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a ## comment on the same line, use TABs. -sample.farmgenerator.tool.title=Farm Generator +sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000} +sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000} +sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000} +sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000} sample.farmgenerator.tool.tooltip=Quickly create a custom farm sample.farmgenerator.pane.title=Farm Generator sample.farmgenerator.pane.length=Length @@ -20,5 +25,9 @@ sample.farmgenerator.pane.animals.title=Animals sample.farmgenerator.pane.animals.cow=Cow sample.farmgenerator.pane.animals.sheep=Sheep sample.farmgenerator.pane.animals.pig=Pig -sample.farmgenerator.keyBinding.toggleTool=Toggle Farm Generator Tool -sample.farmgenerator.keyBinding.place=Place Farm At Cursor \ No newline at end of file +sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.farmgenerator.keyBinding.place=Place Farm At Cursor +sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000} \ No newline at end of file diff --git a/farm-generator/farm-generator.ts b/farm-generator/farm-generator.ts index 1e35c90..1bd9d30 100644 --- a/farm-generator/farm-generator.ts +++ b/farm-generator/farm-generator.ts @@ -9,6 +9,7 @@ import { IPlayerUISession, InputModifier, KeyboardKey, + LogChannel, MouseActionType, MouseInputType, MouseProps, @@ -178,7 +179,7 @@ function addFarmGeneratorSettingsPane(uiSession: IPlayerUISession, tool: IModalT : player.getBlockFromViewDirection(); if (!raycastResult) { - uiSession.log.error('No block from view vector'); + uiSession.log.error('No block from view vector', { channelMask: LogChannel.All }); return; } const targetBlock = raycastResult.block; @@ -398,7 +399,7 @@ function addFarmGeneratorTool(uiSession: IPlayerUISession) { uiSession.inputManager.registerKeyBinding( EditorInputContext.GlobalToolMode, toolToggleAction, - { key: KeyboardKey.KEY_F, modifier: InputModifier.Control | InputModifier.Shift }, + { key: KeyboardKey.KEY_F, modifier: InputModifier.Control | InputModifier.Shift | InputModifier.Alt }, { uniqueId: 'editorSamples:farmGenerator:toggleTool', label: 'sample.farmgenerator.keyBinding.toggleTool', diff --git a/goto-mark/en_US.lang b/goto-mark/en_US.lang index 0628847..4b61ddc 100644 --- a/goto-mark/en_US.lang +++ b/goto-mark/en_US.lang @@ -2,7 +2,7 @@ ## ## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a ## comment on the same line, use TABs. -sample.gotomark.tool.title=Goto Mark +sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000} sample.gotomark.tool.tooltip=Set or Jump to a stored location sample.gotomark.pane.title=Goto Mark sample.gotomark.pane.location=Player Location @@ -14,4 +14,14 @@ sample.gotomark.pane.locationpane.button.teleport=Teleport to Stored Location %1 sample.gotomark.pane.locationpane.button.delete=Delete Stored Location sample.gotomark.pane.locationpane.input.name=New Name sample.gotomark.pane.locationpane.button.store=Store Current Location As... -sample.gotomark.pane.locationpane.dropdownLabel=Stored Location \ No newline at end of file +sample.gotomark.pane.locationpane.dropdownLabel=Stored Location +sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000} +sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000} +sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000} \ No newline at end of file diff --git a/goto-mark/goto-mark.ts b/goto-mark/goto-mark.ts index 73d460f..9970b30 100644 --- a/goto-mark/goto-mark.ts +++ b/goto-mark/goto-mark.ts @@ -122,6 +122,7 @@ function addExtensionTool(uiSession: IPlayerUISession): IModal function buildParentPane(uiSession: IPlayerUISession, storage: ExtensionStorage): IRootPropertyPane { const parentPane = uiSession.createPropertyPane({ title: 'sample.gotomark.pane.title', + uniqueId: 'editorSamples:pane:goToMark', }); const playerLocation = makeObservable(vector3Truncate(uiSession.extensionContext.player.location)); @@ -420,7 +421,7 @@ export function registerGotoMarkExtension() { `Found ${storage.storedLocations.length} stored locations during initialization` ); } - } catch (e) { + } catch (_e) { uiSession.log.info('No stored locations found during initialization'); } diff --git a/minimal/en_US.lang b/minimal/en_US.lang index d5f4a97..59f0253 100644 --- a/minimal/en_US.lang +++ b/minimal/en_US.lang @@ -2,7 +2,18 @@ ## ## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a ## comment on the same line, use TABs. +sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000} +sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000} +sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000} +sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000} sample.minimal.pane.title=Minimal Extension Pane sample.minimal.pane.button.clickme=Click Me! sample.minimal.menu.title=Minimal Extension -sample.minimal.menu.showpane=Show my property pane \ No newline at end of file +sample.minimal.menu.showpane=Show my property pane +sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000} \ No newline at end of file diff --git a/minimal/minimal.ts b/minimal/minimal.ts index e08a24a..046560d 100644 --- a/minimal/minimal.ts +++ b/minimal/minimal.ts @@ -5,6 +5,7 @@ import { CoreMenuType, IMenu, IPlayerUISession, + LogChannel, registerEditorExtension, } from '@minecraft/server-editor'; @@ -22,7 +23,9 @@ type PerPlayerStorage = { // the button has been clicked function showPlayerMessage(uiSession: IPlayerUISession) { if (!uiSession.scratchStorage) { - uiSession.log.error("We're missing scratch storage - this shouldn't happen!"); + uiSession.log.error("We're missing scratch storage - this shouldn't happen!", { + channelMask: LogChannel.All, + }); return; } const clickCount = uiSession.scratchStorage.NUM_TIMES_PLAYER_CLICKED; @@ -66,6 +69,7 @@ export function registerMinimalExtension() { // when you adjust the slider, you can inspect the binding object property 'mySlider' for the current value. const extensionPane = uiSession.createPropertyPane({ title: 'sample.minimal.pane.title', + uniqueId: 'editorSamples:pane:minimal', }); // Creating UI elements like buttons and sliders require a couple of simple steps. @@ -116,7 +120,9 @@ export function registerMinimalExtension() { ); }) .catch((error: Error) => { - uiSession.log.error(error.message); + uiSession.log.error(error.message, { + channelMask: LogChannel.All, + }); }); // Normally we return a collection of IDisposable objects that the extension system will clean diff --git a/portal-generator/en_US.lang b/portal-generator/en_US.lang index 7d486db..c54e7a9 100644 --- a/portal-generator/en_US.lang +++ b/portal-generator/en_US.lang @@ -2,7 +2,14 @@ ## ## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a ## comment on the same line, use TABs. -sample.portalgenerator.title=Portal Generator +sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000} +sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000} +sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000} +sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000} sample.portalgenerator.tooltip=Create Portals with a single click sample.portalgenerator.pane.title=Portal Generator sample.portalgenerator.pane.replacefloor=Replace Floor @@ -20,4 +27,6 @@ sample.portalgenerator.pane.nether.pane.corners.tooltip=Adds corner blocks to th sample.portalgenerator.pane.nether.pane.percentage=Percentage Complete sample.portalgenerator.pane.end.pane.title=End Portal sample.portalgenerator.pane.end.pane.filledcount=Filled 'Eye of Ender' count -sample.portalgenerator.keyBinding.toggleTool=Toggle Portal Generator Tool \ No newline at end of file +sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000} \ No newline at end of file diff --git a/portal-generator/portal-generator.ts b/portal-generator/portal-generator.ts index 7470a6b..4b40b9a 100644 --- a/portal-generator/portal-generator.ts +++ b/portal-generator/portal-generator.ts @@ -7,6 +7,7 @@ import { ImageResourceType, IObservable, IRootPropertyPane, + LogChannel, makeObservable, NumberPropertyItemVariant, Ray, @@ -77,7 +78,7 @@ class PortalGenerator implements IDisposable { public toolPane(uiSession: PortalGeneratorSession): IRootPropertyPane | undefined { if (!this._pane) { - uiSession.log.error('Tool pane not initialized'); + uiSession.log.error('Tool pane not initialized', { channelMask: LogChannel.All }); return undefined; } return this._pane; @@ -104,7 +105,7 @@ class PortalGenerator implements IDisposable { uiSession.inputManager.registerKeyBinding( EditorInputContext.GlobalToolMode, toolToggleAction, - { key: KeyboardKey.KEY_P, modifier: InputModifier.Control | InputModifier.Shift }, + { key: KeyboardKey.KEY_P, modifier: InputModifier.Control | InputModifier.Shift | InputModifier.Alt }, { uniqueId: 'editorSamples:portalGenerator:toggleTool', label: 'sample.portalgenerator.keyBinding.toggleTool', @@ -178,8 +179,6 @@ class PortalGenerator implements IDisposable { } activatePortalGenerator(uiSession: PortalGeneratorSession, portalType: PortalType): void { - this._pane?.hide(); - if (this._activePortal) { this._activePortal.deactivatePane(); } @@ -191,8 +190,6 @@ class PortalGenerator implements IDisposable { } this._activePortal.activatePane(uiSession); - - this._pane?.show(); } } @@ -211,7 +208,7 @@ class NetherPortal implements IPortalGenerator { public subPane(uiSession: PortalGeneratorSession): IPropertyPane | undefined { if (!this._pane) { - uiSession.log.error('Sub pane not initialized'); + uiSession.log.error('Sub pane not initialized', { channelMask: LogChannel.All }); return undefined; } return this._pane; @@ -227,22 +224,19 @@ class NetherPortal implements IPortalGenerator { } this._pane = this.buildSubPane(uiSession); - this._pane?.show(); } deactivatePane(): void { if (this._pane) { - this._pane.hide(); this._parentPane?.removeSubPane(this._pane); } - this._pane = undefined; } buildSubPane(uiSession: PortalGeneratorSession): IPropertyPane | undefined { const windowPane = this._parentPane; if (!windowPane) { - uiSession.log.error('Failed to find window binding'); + uiSession.log.error('Failed to find window binding', { channelMask: LogChannel.All }); return undefined; } @@ -250,6 +244,8 @@ class NetherPortal implements IPortalGenerator { title: 'sample.portalgenerator.pane.nether.pane.title', }); + subPane.beginConstruct(); + subPane.addDropdown(this._orientation, { title: 'sample.portalgenerator.pane.nether.pane.orientation', entries: [ @@ -290,6 +286,8 @@ class NetherPortal implements IPortalGenerator { variant: NumberPropertyItemVariant.InputFieldAndSlider, }); + subPane.endConstruct(); + return subPane; } @@ -330,7 +328,7 @@ class NetherPortal implements IPortalGenerator { z: location.z + this._sizeX.value, }; } else { - uiSession.log.error('Failed to get valid orientation'); + uiSession.log.error('Failed to get valid orientation', { channelMask: LogChannel.All }); uiSession.extensionContext.transactionManager.discardOpenTransaction(); return; } @@ -415,7 +413,7 @@ class EndPortal implements IPortalGenerator { public subPane(uiSession: PortalGeneratorSession): IPropertyPane | undefined { if (!this._pane) { - uiSession.log.error('Sub pane not initialized'); + uiSession.log.error('Sub pane not initialized', { channelMask: LogChannel.All }); return undefined; } return this._pane; @@ -429,24 +427,20 @@ class EndPortal implements IPortalGenerator { if (this._pane) { this.deactivatePane(); } - this._pane = this.buildSubPane(uiSession); - this._pane?.show(); } deactivatePane(): void { if (this._pane) { - this._pane.hide(); this._parentPane?.removeSubPane(this._pane); } - this._pane = undefined; } buildSubPane(uiSession: PortalGeneratorSession): IPropertyPane | undefined { const windowPane = this._parentPane; if (!windowPane) { - uiSession.log.error('Failed to find window pane'); + uiSession.log.error('Failed to find window pane', { channelMask: LogChannel.All }); return undefined; } @@ -454,6 +448,8 @@ class EndPortal implements IPortalGenerator { title: 'sample.portalgenerator.pane.end.pane.title', }); + subPane.beginConstruct(); + subPane.addNumber(this._filledEyeCount, { title: 'sample.portalgenerator.pane.end.pane.filledcount', min: 0, @@ -462,6 +458,8 @@ class EndPortal implements IPortalGenerator { isInteger: true, }); + subPane.endConstruct(); + return subPane; } @@ -471,7 +469,7 @@ class EndPortal implements IPortalGenerator { const targetBlock = me.dimension.getBlock(location); if (targetBlock === undefined) { - uiSession.log.error('No block selected'); + uiSession.log.error('No block selected', { channelMask: LogChannel.All }); return; } @@ -534,7 +532,7 @@ class EndPortal implements IPortalGenerator { i += 1; } } else { - uiSession.log.error('Failed to get block'); + uiSession.log.error('Failed to get block', { channelMask: LogChannel.All }); } } } diff --git a/tree-generator/en_US.lang b/tree-generator/en_US.lang index 2a14b53..6ede9a7 100644 --- a/tree-generator/en_US.lang +++ b/tree-generator/en_US.lang @@ -2,11 +2,20 @@ ## ## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a ## comment on the same line, use TABs. -sample.treegenerator.tool.title=Tree Generator +sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000} +sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000} +sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000} +sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000} +sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000} +sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000} sample.treegenerator.tool.tooltip=Single Click to place whole trees sample.treegenerator.pane.title=Tree Generator sample.treegenerator.pane.type=Tree Type sample.treegenerator.pane.height=Tree Height sample.treegenerator.pane.variance=Tree Height Random Variance sample.treegenerator.keyBinding.place=Place Tree At Cursor -sample.treegenerator.keyBinding.toggleTool=Toggle Tree Generator Tool \ No newline at end of file +sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000} \ No newline at end of file diff --git a/tree-generator/tree-generator.ts b/tree-generator/tree-generator.ts index 3b2e37a..ebb9cef 100644 --- a/tree-generator/tree-generator.ts +++ b/tree-generator/tree-generator.ts @@ -339,6 +339,8 @@ function addToolSettingsPane(uiSession: IPlayerUISession, tool: IModalTool) { uiSession.extensionContext.transactionManager.commitOpenTransaction(); }; + pane.beginConstruct(); + // Add a dropdown for available tree types pane.addDropdown(settings.treeType, { title: 'sample.treegenerator.pane.type', @@ -381,7 +383,8 @@ function addToolSettingsPane(uiSession: IPlayerUISession, tool: IModalTool) { ); tool.bindPropertyPane(pane); - pane.hide(); + pane.endConstruct(); + // Create an action that will be executed on left mouse click const executeMouseAction = uiSession.actionManager.createAction({ actionType: ActionTypes.MouseRayCastAction, @@ -423,7 +426,7 @@ function addTool(uiSession: IPlayerUISession) { uiSession.inputManager.registerKeyBinding( EditorInputContext.GlobalToolMode, toolToggleAction, - { key: KeyboardKey.KEY_T, modifier: InputModifier.Control | InputModifier.Shift }, + { key: KeyboardKey.KEY_T, modifier: InputModifier.Control | InputModifier.Shift | InputModifier.Alt }, { uniqueId: 'editorSamples:treeGenerator:toggleTool', label: 'sample.treegenerator.keyBinding.toggleTool' } );