File tree Expand file tree Collapse file tree 4 files changed +26
-9
lines changed Expand file tree Collapse file tree 4 files changed +26
-9
lines changed Original file line number Diff line number Diff line change 137
137
{item .value .displayName }
138
138
</div >
139
139
<div class =" spacer" />
140
- <i
141
- class =" material-icons icon in_list_button"
142
- title ={translate (' panel.variants.tool.edit_variant' )}
143
- on:click ={() => openVariantConfigDialog (item .value )}>edit</i
144
- >
140
+ {#if item .value .isDefault }
141
+ <i
142
+ class =" material-icons icon in_list_button in_list_button_disabled"
143
+ title ={translate (' panel.variants.tool.edit_variant' )}
144
+ on:click ={() => openVariantConfigDialog (item .value )}>edit</i
145
+ >
146
+ {:else }
147
+ <i
148
+ class =" material-icons icon in_list_button"
149
+ title ={translate (' panel.variants.tool.cannot_edit_default_variant' )}
150
+ on:click ={() => openVariantConfigDialog (item .value )}>edit</i
151
+ >
152
+ {/if }
145
153
{#if Variant .selected === item .value }
146
154
<i
147
155
class =" material-icons icon in_list_button"
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export const DELETE_VARIANT_ACTION = createAction(`${PACKAGE.name}:deleteVariant
38
38
export const OPEN_VARIANT_CONFIG_ACTION = createAction ( `${ PACKAGE . name } :openVariantConfig` , {
39
39
name : translate ( 'action.variants.open_config' ) ,
40
40
icon : 'settings' ,
41
- condition : ( ) => ! ! Variant . selected ,
41
+ condition : ( ) => ! ! Variant . selected && ! Variant . selected . isDefault ,
42
42
click ( ) {
43
43
if ( ! Variant . selected ) return
44
44
openVariantConfigDialog ( Variant . selected )
@@ -47,9 +47,10 @@ export const OPEN_VARIANT_CONFIG_ACTION = createAction(`${PACKAGE.name}:openVari
47
47
48
48
export const VARIANT_PANEL_CONTEXT_MENU = createMenu (
49
49
[
50
+ OPEN_VARIANT_CONFIG_ACTION . id ,
51
+ new MenuSeparator ( ) ,
50
52
CREATE_VARIANT_ACTION . id ,
51
53
DUPLICATE_VARIANT_ACTION . id ,
52
- OPEN_VARIANT_CONFIG_ACTION . id ,
53
54
new MenuSeparator ( ) ,
54
55
DELETE_VARIANT_ACTION . id ,
55
56
] ,
Original file line number Diff line number Diff line change @@ -440,6 +440,7 @@ animated_java.panel.variants.tool.delete_selected_variant: Delete Selected Varia
440
440
animated_java.panel.variants.tool.variant_visible : Variant Selected
441
441
animated_java.panel.variants.tool.variant_not_visible : Variant Not Selected
442
442
animated_java.panel.variants.tool.cannot_delete_default_variant : Cannot delete the default variant!
443
+ animated_java.panel.variants.tool.cannot_edit_default_variant : Cannot edit the default variant!
443
444
444
445
animated_java.action.variants.create : Create Variant
445
446
animated_java.action.variants.duplicate : Duplicate Variant
Original file line number Diff line number Diff line change @@ -106,12 +106,16 @@ export class Variant {
106
106
constructor ( displayName : string , isDefault = false ) {
107
107
this . displayName = Variant . makeDisplayNameUnique ( this , displayName )
108
108
this . name = Variant . makeNameUnique ( this , this . displayName )
109
- this . uuid = guid ( )
110
109
this . isDefault = isDefault
110
+ this . uuid = guid ( )
111
111
this . textureMap = new TextureMap ( )
112
112
this . id = Variant . all . length
113
+ if ( this . isDefault ) {
114
+ this . displayName = 'Default'
115
+ this . name = 'default'
116
+ }
113
117
Variant . all . push ( this )
114
- this . select ( )
118
+ // this.select()
115
119
events . CREATE_VARIANT . dispatch ( this )
116
120
}
117
121
@@ -173,6 +177,9 @@ export class Variant {
173
177
174
178
public static fromJSON ( json : IBlueprintVariantJSON , isDefault = false ) : Variant {
175
179
const variant = new Variant ( json . display_name , isDefault )
180
+ if ( json . is_default ) {
181
+ return variant
182
+ }
176
183
variant . uuid = json . uuid
177
184
for ( const [ key , value ] of Object . entries ( json . texture_map ) ) {
178
185
variant . textureMap . add ( key , value )
You can’t perform that action at this time.
0 commit comments