mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-27 04:21:46 +08:00
Change labels of "Use as particle" and "use as default" when already enabled
Allow context menu entries to be functions
This commit is contained in:
parent
7d9e214b8c
commit
eaab6eb305
@ -313,6 +313,9 @@ class Menu {
|
||||
if (typeof s == 'string' && BarItems[s]) {
|
||||
s = BarItems[s];
|
||||
}
|
||||
if (typeof s === 'function') {
|
||||
s = s(scope_context);
|
||||
}
|
||||
if (!Condition(s.condition, scope_context)) return;
|
||||
|
||||
if (s instanceof Action) {
|
||||
|
@ -1785,9 +1785,9 @@ class Texture {
|
||||
}
|
||||
Texture.prototype.menu = new Menu([
|
||||
new MenuSeparator('apply'),
|
||||
{
|
||||
tex => ({
|
||||
icon: 'star',
|
||||
name: 'menu.texture.use_as_default',
|
||||
name: tex.use_as_default ? 'menu.texture.use_as_default.clear' : 'menu.texture.use_as_default',
|
||||
condition: {features: ['single_texture_default']},
|
||||
click(texture) {
|
||||
if (texture.use_as_default) {
|
||||
@ -1796,7 +1796,7 @@ class Texture {
|
||||
texture.setAsDefaultTexture();
|
||||
}
|
||||
}
|
||||
},
|
||||
}),
|
||||
{
|
||||
icon: 'crop_original',
|
||||
name: 'menu.texture.face',
|
||||
@ -1815,9 +1815,9 @@ class Texture {
|
||||
condition() {return !Format.single_texture && Outliner.selected.length > 0},
|
||||
click(texture) {texture.apply(true)}
|
||||
},
|
||||
{
|
||||
tex => ({
|
||||
icon: 'bubble_chart',
|
||||
name: 'menu.texture.particle',
|
||||
name: tex.particle ? 'menu.texture.particle.clear' : 'menu.texture.particle',
|
||||
condition: {features: ['select_texture_for_particles']},
|
||||
click(texture) {
|
||||
if (texture.particle) {
|
||||
@ -1826,7 +1826,7 @@ class Texture {
|
||||
texture.enableParticle()
|
||||
}
|
||||
}
|
||||
},
|
||||
}),
|
||||
new MenuSeparator('settings'),
|
||||
{
|
||||
icon: 'list',
|
||||
|
@ -1999,7 +1999,9 @@
|
||||
"menu.texture.edit_externally": "Edit Externally",
|
||||
"menu.texture.edit_in_blockbench": "Edit in Blockbench",
|
||||
"menu.texture.particle": "Use for Particles",
|
||||
"menu.texture.particle.clear": "Stop using for Particles",
|
||||
"menu.texture.use_as_default": "Set as Default",
|
||||
"menu.texture.use_as_default.clear": "Unassign as Default",
|
||||
"menu.texture.export": "Save As",
|
||||
"menu.texture.save": "Save",
|
||||
"menu.texture.properties": "Properties...",
|
||||
|
Loading…
Reference in New Issue
Block a user