2020-11-17 07:20:24 +00:00
|
|
|
package doodle
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2021-06-13 21:53:21 +00:00
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
2020-11-17 07:20:24 +00:00
|
|
|
|
2021-06-13 23:03:32 +00:00
|
|
|
"git.kirsle.net/apps/doodle/pkg/balance"
|
2020-11-17 07:20:24 +00:00
|
|
|
"git.kirsle.net/apps/doodle/pkg/doodads"
|
|
|
|
"git.kirsle.net/apps/doodle/pkg/level"
|
2021-06-17 05:35:01 +00:00
|
|
|
"git.kirsle.net/apps/doodle/pkg/license"
|
2020-11-17 07:20:24 +00:00
|
|
|
"git.kirsle.net/apps/doodle/pkg/log"
|
WIP Publish Dialog + UI Improvements
* File->Publish Level in the Level Editor opens the Publish window,
where you can embed custom doodads into your level and export a
portable .level file you can share with others.
* Currently does not actually export a level file yet.
* The dialog lists all unique doodad names in use in your level, and
designates which are built-ins and which are custom (paginated).
* A checkbox would let the user embed built-in doodads into their level,
as well, locking it in to those versions and not using updated
versions from future game releases.
UI Improvements:
* Added styling for a "Primary" UI button, rendered in deep blue.
* Pop-up modals (Alert, Confirm) color their Ok button as Primary.
* The Enter key pressed during an Alert or Confirm modal will invoke its
default button and close the modal, corresponding to its Primary
button.
* The developer console is now opened with the tilde/grave key ` instead
of the Enter key, so that the Enter key is free to click through
modals.
* In the "Open/Edit Drawing" window, a "Browse..." button is added to
the level and doodad sections, spawning a native File Open dialog to
pick a .level or .doodad outside the config root.
2021-06-11 05:31:30 +00:00
|
|
|
"git.kirsle.net/apps/doodle/pkg/modal"
|
2020-11-17 07:20:24 +00:00
|
|
|
"git.kirsle.net/apps/doodle/pkg/windows"
|
|
|
|
"git.kirsle.net/go/render"
|
|
|
|
"git.kirsle.net/go/ui"
|
|
|
|
)
|
|
|
|
|
|
|
|
/*
|
|
|
|
Functions to manage popup windows in the Editor Mode, such as:
|
|
|
|
|
|
|
|
* The Palette Editor
|
|
|
|
* The Layers Window
|
|
|
|
* etc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Opens the "Layers" window (for editing doodads)
|
|
|
|
func (u *EditorUI) OpenLayersWindow() {
|
|
|
|
u.layersWindow.Hide()
|
|
|
|
u.layersWindow = nil
|
|
|
|
u.SetupPopups(u.d)
|
|
|
|
u.layersWindow.Show()
|
|
|
|
}
|
|
|
|
|
|
|
|
// OpenPaletteWindow opens the Palette Editor window.
|
|
|
|
func (u *EditorUI) OpenPaletteWindow() {
|
|
|
|
// TODO: recompute the window so the actual loaded level palette gets in
|
|
|
|
u.paletteEditor.Hide()
|
|
|
|
u.paletteEditor = nil
|
|
|
|
u.SetupPopups(u.d)
|
|
|
|
u.paletteEditor.Show()
|
|
|
|
}
|
|
|
|
|
|
|
|
// OpenDoodadDropper opens the Doodad Dropper window.
|
|
|
|
func (u *EditorUI) OpenDoodadDropper() {
|
|
|
|
// NOTE: most places in the code call this directly, nice
|
|
|
|
// and simple window :) but OpenDoodadDropper() added for consistency.
|
|
|
|
u.doodadWindow.Show()
|
2022-02-20 04:20:58 +00:00
|
|
|
u.Supervisor.FocusWindow(u.doodadWindow)
|
2020-11-17 07:20:24 +00:00
|
|
|
}
|
|
|
|
|
WIP Publish Dialog + UI Improvements
* File->Publish Level in the Level Editor opens the Publish window,
where you can embed custom doodads into your level and export a
portable .level file you can share with others.
* Currently does not actually export a level file yet.
* The dialog lists all unique doodad names in use in your level, and
designates which are built-ins and which are custom (paginated).
* A checkbox would let the user embed built-in doodads into their level,
as well, locking it in to those versions and not using updated
versions from future game releases.
UI Improvements:
* Added styling for a "Primary" UI button, rendered in deep blue.
* Pop-up modals (Alert, Confirm) color their Ok button as Primary.
* The Enter key pressed during an Alert or Confirm modal will invoke its
default button and close the modal, corresponding to its Primary
button.
* The developer console is now opened with the tilde/grave key ` instead
of the Enter key, so that the Enter key is free to click through
modals.
* In the "Open/Edit Drawing" window, a "Browse..." button is added to
the level and doodad sections, spawning a native File Open dialog to
pick a .level or .doodad outside the config root.
2021-06-11 05:31:30 +00:00
|
|
|
// OpenPublishWindow opens the Publisher window.
|
|
|
|
func (u *EditorUI) OpenPublishWindow() {
|
2022-01-18 02:51:11 +00:00
|
|
|
scene, _ := u.d.Scene.(*EditorScene)
|
|
|
|
|
|
|
|
u.publishWindow = windows.NewPublishWindow(windows.Publish{
|
|
|
|
Supervisor: u.Supervisor,
|
|
|
|
Engine: u.d.Engine,
|
|
|
|
Level: scene.Level,
|
|
|
|
|
|
|
|
OnPublish: func(includeBuiltins bool) {
|
|
|
|
u.d.FlashError("OnPublish Called")
|
|
|
|
// XXX: Paid Version Only.
|
|
|
|
if !license.IsRegistered() {
|
|
|
|
if u.licenseWindow != nil {
|
|
|
|
u.licenseWindow.Show()
|
|
|
|
u.Supervisor.FocusWindow(u.licenseWindow)
|
|
|
|
}
|
|
|
|
u.d.FlashError("Level Publishing is only available in the full version of the game.")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: this function just saves the level. SaveDoodads and SaveBuiltins
|
|
|
|
// are toggled in the publish window and the save handler does publishing.
|
|
|
|
u.Scene.SaveLevel(u.Scene.filename)
|
|
|
|
u.d.Flash("Saved level: %s", u.Scene.filename)
|
|
|
|
},
|
|
|
|
OnCancel: func() {
|
|
|
|
u.publishWindow.Hide()
|
|
|
|
},
|
|
|
|
})
|
|
|
|
u.ConfigureWindow(u.d, u.publishWindow)
|
|
|
|
|
WIP Publish Dialog + UI Improvements
* File->Publish Level in the Level Editor opens the Publish window,
where you can embed custom doodads into your level and export a
portable .level file you can share with others.
* Currently does not actually export a level file yet.
* The dialog lists all unique doodad names in use in your level, and
designates which are built-ins and which are custom (paginated).
* A checkbox would let the user embed built-in doodads into their level,
as well, locking it in to those versions and not using updated
versions from future game releases.
UI Improvements:
* Added styling for a "Primary" UI button, rendered in deep blue.
* Pop-up modals (Alert, Confirm) color their Ok button as Primary.
* The Enter key pressed during an Alert or Confirm modal will invoke its
default button and close the modal, corresponding to its Primary
button.
* The developer console is now opened with the tilde/grave key ` instead
of the Enter key, so that the Enter key is free to click through
modals.
* In the "Open/Edit Drawing" window, a "Browse..." button is added to
the level and doodad sections, spawning a native File Open dialog to
pick a .level or .doodad outside the config root.
2021-06-11 05:31:30 +00:00
|
|
|
u.publishWindow.Hide()
|
2022-01-18 02:51:11 +00:00
|
|
|
// u.publishWindow = nil
|
WIP Publish Dialog + UI Improvements
* File->Publish Level in the Level Editor opens the Publish window,
where you can embed custom doodads into your level and export a
portable .level file you can share with others.
* Currently does not actually export a level file yet.
* The dialog lists all unique doodad names in use in your level, and
designates which are built-ins and which are custom (paginated).
* A checkbox would let the user embed built-in doodads into their level,
as well, locking it in to those versions and not using updated
versions from future game releases.
UI Improvements:
* Added styling for a "Primary" UI button, rendered in deep blue.
* Pop-up modals (Alert, Confirm) color their Ok button as Primary.
* The Enter key pressed during an Alert or Confirm modal will invoke its
default button and close the modal, corresponding to its Primary
button.
* The developer console is now opened with the tilde/grave key ` instead
of the Enter key, so that the Enter key is free to click through
modals.
* In the "Open/Edit Drawing" window, a "Browse..." button is added to
the level and doodad sections, spawning a native File Open dialog to
pick a .level or .doodad outside the config root.
2021-06-11 05:31:30 +00:00
|
|
|
u.SetupPopups(u.d)
|
|
|
|
u.publishWindow.Show()
|
|
|
|
}
|
|
|
|
|
2021-06-13 23:03:32 +00:00
|
|
|
// OpenPublishWindow opens the FileSystem window.
|
|
|
|
func (u *EditorUI) OpenFileSystemWindow() {
|
|
|
|
u.filesystemWindow.Hide()
|
|
|
|
u.filesystemWindow = nil
|
|
|
|
u.SetupPopups(u.d)
|
|
|
|
u.filesystemWindow.Show()
|
|
|
|
}
|
|
|
|
|
2022-01-18 02:51:11 +00:00
|
|
|
// ConfigureWindow sets default window config functions, like
|
|
|
|
// centering them on screen.
|
|
|
|
func (u *EditorUI) ConfigureWindow(d *Doodle, window *ui.Window) {
|
|
|
|
var size = window.Size()
|
|
|
|
window.Compute(d.Engine)
|
|
|
|
window.Supervise(u.Supervisor)
|
WIP Publish Dialog + UI Improvements
* File->Publish Level in the Level Editor opens the Publish window,
where you can embed custom doodads into your level and export a
portable .level file you can share with others.
* Currently does not actually export a level file yet.
* The dialog lists all unique doodad names in use in your level, and
designates which are built-ins and which are custom (paginated).
* A checkbox would let the user embed built-in doodads into their level,
as well, locking it in to those versions and not using updated
versions from future game releases.
UI Improvements:
* Added styling for a "Primary" UI button, rendered in deep blue.
* Pop-up modals (Alert, Confirm) color their Ok button as Primary.
* The Enter key pressed during an Alert or Confirm modal will invoke its
default button and close the modal, corresponding to its Primary
button.
* The developer console is now opened with the tilde/grave key ` instead
of the Enter key, so that the Enter key is free to click through
modals.
* In the "Open/Edit Drawing" window, a "Browse..." button is added to
the level and doodad sections, spawning a native File Open dialog to
pick a .level or .doodad outside the config root.
2021-06-11 05:31:30 +00:00
|
|
|
|
2022-01-18 02:51:11 +00:00
|
|
|
// Center the window.
|
|
|
|
window.MoveTo(render.Point{
|
|
|
|
X: (d.width / 2) - (size.W / 2),
|
|
|
|
Y: (d.height / 2) - (size.H / 2),
|
|
|
|
})
|
2020-11-17 07:20:24 +00:00
|
|
|
|
2022-01-18 02:51:11 +00:00
|
|
|
window.Hide()
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetupPopups preloads popup windows like the DoodadDropper.
|
|
|
|
func (u *EditorUI) SetupPopups(d *Doodle) {
|
2021-06-17 05:35:01 +00:00
|
|
|
// License Registration Window.
|
|
|
|
if u.licenseWindow == nil {
|
|
|
|
cfg := windows.License{
|
|
|
|
Supervisor: u.Supervisor,
|
|
|
|
Engine: d.Engine,
|
|
|
|
OnCancel: func() {
|
|
|
|
u.licenseWindow.Hide()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
cfg.OnLicensed = func() {
|
|
|
|
// License status has changed, reload the window!
|
|
|
|
if u.licenseWindow != nil {
|
|
|
|
u.licenseWindow.Hide()
|
|
|
|
}
|
|
|
|
u.licenseWindow = windows.MakeLicenseWindow(d.width, d.height, cfg)
|
|
|
|
}
|
|
|
|
|
|
|
|
cfg.OnLicensed()
|
|
|
|
u.licenseWindow.Hide()
|
|
|
|
}
|
|
|
|
|
2020-11-17 07:20:24 +00:00
|
|
|
// Doodad Dropper.
|
|
|
|
if u.doodadWindow == nil {
|
|
|
|
u.doodadWindow = windows.NewDoodadDropper(windows.DoodadDropper{
|
|
|
|
Supervisor: u.Supervisor,
|
|
|
|
Engine: d.Engine,
|
|
|
|
|
|
|
|
OnStartDragActor: u.startDragActor,
|
|
|
|
OnCancel: func() {
|
|
|
|
u.doodadWindow.Hide()
|
|
|
|
},
|
|
|
|
})
|
2022-01-18 02:51:11 +00:00
|
|
|
u.ConfigureWindow(d, u.doodadWindow)
|
2020-11-17 07:20:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Page Settings
|
|
|
|
if u.levelSettingsWindow == nil {
|
|
|
|
scene, _ := d.Scene.(*EditorScene)
|
|
|
|
|
|
|
|
u.levelSettingsWindow = windows.NewAddEditLevel(windows.AddEditLevel{
|
|
|
|
Supervisor: u.Supervisor,
|
|
|
|
Engine: d.Engine,
|
|
|
|
EditLevel: scene.Level,
|
|
|
|
|
|
|
|
OnChangePageTypeAndWallpaper: func(pageType level.PageType, wallpaper string) {
|
|
|
|
log.Info("OnChangePageTypeAndWallpaper called: %+v, %+v", pageType, wallpaper)
|
|
|
|
scene.Level.PageType = pageType
|
|
|
|
scene.Level.Wallpaper = wallpaper
|
2021-07-20 00:14:00 +00:00
|
|
|
u.Canvas.LoadLevel(scene.Level)
|
2020-11-17 07:20:24 +00:00
|
|
|
},
|
2021-09-12 04:18:22 +00:00
|
|
|
OnReload: func() {
|
|
|
|
log.Warn("RELOAD LEVEL")
|
|
|
|
scene.Reset()
|
|
|
|
},
|
2020-11-17 07:20:24 +00:00
|
|
|
OnCancel: func() {
|
|
|
|
u.levelSettingsWindow.Hide()
|
|
|
|
},
|
|
|
|
})
|
2022-01-18 02:51:11 +00:00
|
|
|
u.ConfigureWindow(d, u.levelSettingsWindow)
|
2020-11-17 07:20:24 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 04:26:55 +00:00
|
|
|
// Doodad Properties
|
|
|
|
if u.doodadPropertiesWindow == nil {
|
|
|
|
scene, _ := d.Scene.(*EditorScene)
|
|
|
|
|
|
|
|
cfg := &windows.DoodadProperties{
|
|
|
|
Supervisor: u.Supervisor,
|
|
|
|
Engine: d.Engine,
|
|
|
|
EditDoodad: scene.Doodad,
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rebuild the window. TODO: hacky af.
|
|
|
|
cfg.OnRefresh = func() {
|
|
|
|
u.doodadPropertiesWindow.Hide()
|
|
|
|
u.doodadPropertiesWindow = nil
|
|
|
|
u.SetupPopups(u.d)
|
|
|
|
u.doodadPropertiesWindow.Show()
|
|
|
|
}
|
|
|
|
|
|
|
|
u.doodadPropertiesWindow = windows.NewDoodadPropertiesWindow(cfg)
|
2022-01-18 02:51:11 +00:00
|
|
|
u.ConfigureWindow(d, u.doodadPropertiesWindow)
|
WIP Publish Dialog + UI Improvements
* File->Publish Level in the Level Editor opens the Publish window,
where you can embed custom doodads into your level and export a
portable .level file you can share with others.
* Currently does not actually export a level file yet.
* The dialog lists all unique doodad names in use in your level, and
designates which are built-ins and which are custom (paginated).
* A checkbox would let the user embed built-in doodads into their level,
as well, locking it in to those versions and not using updated
versions from future game releases.
UI Improvements:
* Added styling for a "Primary" UI button, rendered in deep blue.
* Pop-up modals (Alert, Confirm) color their Ok button as Primary.
* The Enter key pressed during an Alert or Confirm modal will invoke its
default button and close the modal, corresponding to its Primary
button.
* The developer console is now opened with the tilde/grave key ` instead
of the Enter key, so that the Enter key is free to click through
modals.
* In the "Open/Edit Drawing" window, a "Browse..." button is added to
the level and doodad sections, spawning a native File Open dialog to
pick a .level or .doodad outside the config root.
2021-06-11 05:31:30 +00:00
|
|
|
}
|
|
|
|
|
2021-06-13 23:03:32 +00:00
|
|
|
// Level FileSystem Viewer.
|
|
|
|
if u.filesystemWindow == nil {
|
|
|
|
scene, _ := d.Scene.(*EditorScene)
|
|
|
|
|
|
|
|
u.filesystemWindow = windows.NewFileSystemWindow(windows.FileSystem{
|
|
|
|
Supervisor: u.Supervisor,
|
|
|
|
Engine: d.Engine,
|
|
|
|
Level: scene.Level,
|
|
|
|
|
|
|
|
OnDelete: func(filename string) bool {
|
|
|
|
// Check if it is an embedded doodad.
|
|
|
|
if strings.HasPrefix(filename, balance.EmbeddedDoodadsBasePath) {
|
|
|
|
// Check if we have the doodad installed locally.
|
|
|
|
if _, err := doodads.LoadFile(filepath.Base(filename)); err != nil {
|
|
|
|
modal.Alert(
|
|
|
|
"Cannot remove %s:\n\n"+
|
|
|
|
"This doodad is still in use by the level and does not\n"+
|
|
|
|
"exist on your local device, so can not be deleted.",
|
|
|
|
filepath.Base(filename),
|
|
|
|
).WithTitle("Cannot Remove Custom Doodad")
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Can't delete the current wallpaper.
|
|
|
|
if filepath.Base(filename) == scene.Level.Wallpaper {
|
|
|
|
modal.Alert(
|
|
|
|
"This wallpaper is still in use as the level background, so can\n" +
|
|
|
|
"not be deleted. Change the wallpaper in the Page Settings window\n" +
|
|
|
|
"to one of the defaults and then you may remove this file from the level.",
|
|
|
|
).WithTitle("Cannot Remove Current Wallpaper")
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
if ok := scene.Level.DeleteFile(filename); !ok {
|
|
|
|
modal.Alert("Failed to remove file from level data!")
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
},
|
|
|
|
OnCancel: func() {
|
|
|
|
u.filesystemWindow.Hide()
|
|
|
|
},
|
|
|
|
})
|
2022-01-18 02:51:11 +00:00
|
|
|
u.ConfigureWindow(d, u.filesystemWindow)
|
2021-06-13 23:03:32 +00:00
|
|
|
}
|
|
|
|
|
2020-11-17 07:20:24 +00:00
|
|
|
// Palette Editor.
|
|
|
|
if u.paletteEditor == nil {
|
|
|
|
scene, _ := d.Scene.(*EditorScene)
|
|
|
|
|
|
|
|
// Which palette?
|
|
|
|
var pal *level.Palette
|
|
|
|
if scene.Level != nil {
|
|
|
|
pal = scene.Level.Palette
|
|
|
|
} else if scene.Doodad != nil {
|
|
|
|
pal = scene.Doodad.Palette
|
|
|
|
}
|
|
|
|
|
|
|
|
u.paletteEditor = windows.NewPaletteEditor(windows.PaletteEditor{
|
|
|
|
Supervisor: u.Supervisor,
|
|
|
|
Engine: d.Engine,
|
|
|
|
IsDoodad: scene.Doodad != nil,
|
|
|
|
EditPalette: pal,
|
|
|
|
|
|
|
|
OnChange: func() {
|
|
|
|
// Reload the level.
|
|
|
|
if scene.Level != nil {
|
|
|
|
log.Warn("RELOAD LEVEL")
|
2021-07-20 00:14:00 +00:00
|
|
|
u.Canvas.LoadLevel(scene.Level)
|
2020-11-17 07:20:24 +00:00
|
|
|
scene.Level.Chunker.Redraw()
|
|
|
|
} else if scene.Doodad != nil {
|
|
|
|
log.Warn("RELOAD DOODAD")
|
|
|
|
u.Canvas.LoadDoodadToLayer(u.Scene.Doodad, u.Scene.ActiveLayer)
|
|
|
|
u.Scene.Doodad.Layers[u.Scene.ActiveLayer].Chunker.Redraw()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reload the palette frame to reflect the changed data.
|
|
|
|
u.Palette.Hide()
|
|
|
|
u.Palette = u.SetupPalette(d)
|
|
|
|
u.Resized(d)
|
|
|
|
},
|
|
|
|
OnAddColor: func() {
|
|
|
|
// Adding a new color to the palette.
|
|
|
|
sw := pal.AddSwatch()
|
|
|
|
log.Info("Added new palette color: %+v", sw)
|
|
|
|
|
|
|
|
// Awkward but... reload this very same window.
|
|
|
|
u.paletteEditor.Hide()
|
|
|
|
u.paletteEditor = nil
|
|
|
|
u.SetupPopups(d)
|
|
|
|
u.paletteEditor.Show()
|
|
|
|
},
|
|
|
|
OnCancel: func() {
|
|
|
|
u.paletteEditor.Hide()
|
|
|
|
},
|
|
|
|
})
|
2022-01-18 02:51:11 +00:00
|
|
|
u.ConfigureWindow(d, u.paletteEditor)
|
2020-11-17 07:20:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Layers window (doodad editor)
|
|
|
|
if u.layersWindow == nil {
|
|
|
|
scene, _ := d.Scene.(*EditorScene)
|
|
|
|
|
|
|
|
u.layersWindow = windows.NewLayerWindow(windows.Layers{
|
|
|
|
Supervisor: u.Supervisor,
|
|
|
|
Engine: d.Engine,
|
|
|
|
EditDoodad: scene.Doodad,
|
|
|
|
ActiveLayer: scene.ActiveLayer,
|
|
|
|
|
|
|
|
OnChange: func(self *doodads.Doodad) {
|
|
|
|
// Reload the level.
|
|
|
|
log.Warn("RELOAD LEVEL")
|
|
|
|
u.Canvas.LoadDoodad(u.Scene.Doodad)
|
|
|
|
|
|
|
|
for i := range self.Layers {
|
|
|
|
scene.Doodad.Layers[i] = self.Layers[i]
|
|
|
|
}
|
|
|
|
|
|
|
|
// Awkward but... reload this very same window.
|
|
|
|
// Otherwise, the window doesn't update to show the new
|
|
|
|
// layer having been added.
|
|
|
|
u.layersWindow.Hide()
|
|
|
|
u.layersWindow = nil
|
|
|
|
u.SetupPopups(d)
|
|
|
|
u.layersWindow.Show()
|
|
|
|
},
|
|
|
|
OnAddLayer: func() {
|
|
|
|
layer := doodads.Layer{
|
|
|
|
Name: fmt.Sprintf("layer %d", len(scene.Doodad.Layers)),
|
|
|
|
Chunker: level.NewChunker(scene.DoodadSize),
|
|
|
|
}
|
|
|
|
scene.Doodad.Layers = append(scene.Doodad.Layers, layer)
|
|
|
|
log.Info("Added new layer: %d %s",
|
|
|
|
len(scene.Doodad.Layers), layer.Name)
|
|
|
|
|
|
|
|
// Awkward but... reload this very same window.
|
|
|
|
// Otherwise, the window doesn't update to show the new
|
|
|
|
// layer having been added.
|
|
|
|
u.layersWindow.Hide()
|
|
|
|
u.layersWindow = nil
|
|
|
|
u.SetupPopups(d)
|
|
|
|
u.layersWindow.Show()
|
|
|
|
},
|
|
|
|
OnChangeLayer: func(index int) {
|
|
|
|
if index < 0 || index >= len(scene.Doodad.Layers) {
|
2021-10-08 01:24:18 +00:00
|
|
|
d.FlashError("OnChangeLayer: layer %d out of range", index)
|
2020-11-17 07:20:24 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Info("CHANGE DOODAD LAYER TO %d", index)
|
|
|
|
u.Canvas.LoadDoodadToLayer(u.Scene.Doodad, index)
|
|
|
|
u.Scene.ActiveLayer = index
|
|
|
|
},
|
|
|
|
OnCancel: func() {
|
|
|
|
u.layersWindow.Hide()
|
|
|
|
},
|
|
|
|
})
|
2022-01-18 02:51:11 +00:00
|
|
|
u.ConfigureWindow(d, u.layersWindow)
|
2020-11-17 07:20:24 +00:00
|
|
|
}
|
|
|
|
}
|