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 137137 {item .value .displayName }
138138 </div >
139139 <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 }
145153 {#if Variant .selected === item .value }
146154 <i
147155 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
3838export const OPEN_VARIANT_CONFIG_ACTION = createAction ( `${ PACKAGE . name } :openVariantConfig` , {
3939 name : translate ( 'action.variants.open_config' ) ,
4040 icon : 'settings' ,
41- condition : ( ) => ! ! Variant . selected ,
41+ condition : ( ) => ! ! Variant . selected && ! Variant . selected . isDefault ,
4242 click ( ) {
4343 if ( ! Variant . selected ) return
4444 openVariantConfigDialog ( Variant . selected )
@@ -47,9 +47,10 @@ export const OPEN_VARIANT_CONFIG_ACTION = createAction(`${PACKAGE.name}:openVari
4747
4848export const VARIANT_PANEL_CONTEXT_MENU = createMenu (
4949 [
50+ OPEN_VARIANT_CONFIG_ACTION . id ,
51+ new MenuSeparator ( ) ,
5052 CREATE_VARIANT_ACTION . id ,
5153 DUPLICATE_VARIANT_ACTION . id ,
52- OPEN_VARIANT_CONFIG_ACTION . id ,
5354 new MenuSeparator ( ) ,
5455 DELETE_VARIANT_ACTION . id ,
5556 ] ,
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
440440animated_java.panel.variants.tool.variant_visible : Variant Selected
441441animated_java.panel.variants.tool.variant_not_visible : Variant Not Selected
442442animated_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!
443444
444445animated_java.action.variants.create : Create Variant
445446animated_java.action.variants.duplicate : Duplicate Variant
Original file line number Diff line number Diff line change @@ -106,12 +106,16 @@ export class Variant {
106106 constructor ( displayName : string , isDefault = false ) {
107107 this . displayName = Variant . makeDisplayNameUnique ( this , displayName )
108108 this . name = Variant . makeNameUnique ( this , this . displayName )
109- this . uuid = guid ( )
110109 this . isDefault = isDefault
110+ this . uuid = guid ( )
111111 this . textureMap = new TextureMap ( )
112112 this . id = Variant . all . length
113+ if ( this . isDefault ) {
114+ this . displayName = 'Default'
115+ this . name = 'default'
116+ }
113117 Variant . all . push ( this )
114- this . select ( )
118+ // this.select()
115119 events . CREATE_VARIANT . dispatch ( this )
116120 }
117121
@@ -173,6 +177,9 @@ export class Variant {
173177
174178 public static fromJSON ( json : IBlueprintVariantJSON , isDefault = false ) : Variant {
175179 const variant = new Variant ( json . display_name , isDefault )
180+ if ( json . is_default ) {
181+ return variant
182+ }
176183 variant . uuid = json . uuid
177184 for ( const [ key , value ] of Object . entries ( json . texture_map ) ) {
178185 variant . textureMap . add ( key , value )
You can’t perform that action at this time.
0 commit comments