diff --git a/src/electron.renderer/EditorTypes.hx b/src/electron.renderer/EditorTypes.hx index 035f2ff2b..8d4025352 100644 --- a/src/electron.renderer/EditorTypes.hx +++ b/src/electron.renderer/EditorTypes.hx @@ -49,7 +49,7 @@ enum GlobalEvent { LayerInstanceChangedGlobally(li:data.inst.LayerInstance); LayerInstanceVisiblityChanged(li:data.inst.LayerInstance); LayerInstancesRestoredFromHistory(lis:Array); - AutoLayerRenderingChanged; + AutoLayerRenderingChanged(lis:Array); LayerInstanceTilesetChanged(li:data.inst.LayerInstance); TilesetImageLoaded(td:data.def.TilesetDef, isInitial:Bool); diff --git a/src/electron.renderer/display/LevelRender.hx b/src/electron.renderer/display/LevelRender.hx index 08049a564..3592df238 100644 --- a/src/electron.renderer/display/LevelRender.hx +++ b/src/electron.renderer/display/LevelRender.hx @@ -144,8 +144,8 @@ class LevelRender extends dn.Process { case LayerInstanceVisiblityChanged(li): applyLayerVisibility(li); - case AutoLayerRenderingChanged: - for(li in editor.curLevel.layerInstances) + case AutoLayerRenderingChanged(lis): + for(li in lis) if( li.def.isAutoLayer() ) invalidateLayer(li); @@ -303,7 +303,7 @@ class LevelRender extends dn.Process { public function setAutoLayerRendering(v:Bool) { autoLayerRendering = v; - editor.ge.emit( AutoLayerRenderingChanged ); + editor.ge.emit( AutoLayerRenderingChanged(editor.curLevel.layerInstances) ); } public inline function toggleAutoLayerRendering() { diff --git a/src/electron.renderer/page/Editor.hx b/src/electron.renderer/page/Editor.hx index 02f41094c..7b3b67a27 100644 --- a/src/electron.renderer/page/Editor.hx +++ b/src/electron.renderer/page/Editor.hx @@ -1911,7 +1911,7 @@ class Editor extends Page { for(li in lis) extra+=li.layerDefUid; case LayerInstanceTilesetChanged(li): extra = li.layerDefUid; - case AutoLayerRenderingChanged: + case AutoLayerRenderingChanged(lis): extra = lis.map( li->li.def.identifier ).join(","); case TilesetDefChanged(td): extra = td.uid; case TilesetDefAdded(td): extra = td.uid; case TilesetDefRemoved(td): extra = td.uid; @@ -2027,7 +2027,7 @@ class Editor extends Page { case LayerInstancesRestoredFromHistory(lis): for(li in lis) invalidateLevelCache(li.level); - case AutoLayerRenderingChanged: + case AutoLayerRenderingChanged(lis): case LayerInstanceTilesetChanged(li): invalidateLevelCache(li.level); case TilesetDefChanged(td): invalidateAllLevelsCache(); case TilesetImageLoaded(td, init): @@ -2080,7 +2080,7 @@ class Editor extends Page { case LayerInstanceSelected: case LevelSelected(_): case WorldSelected(_): - case AutoLayerRenderingChanged: + case AutoLayerRenderingChanged(lis): case ToolOptionChanged: case ToolValueSelected: case BeforeProjectSaving: @@ -2164,7 +2164,7 @@ class Editor extends Page { updateLayerList(); updateGuide(); - case AutoLayerRenderingChanged: + case AutoLayerRenderingChanged(lis): case LayerInstanceVisiblityChanged(li): selectionTool.clear(); diff --git a/src/electron.renderer/ui/LevelInstanceForm.hx b/src/electron.renderer/ui/LevelInstanceForm.hx index 44c49051c..752441950 100644 --- a/src/electron.renderer/ui/LevelInstanceForm.hx +++ b/src/electron.renderer/ui/LevelInstanceForm.hx @@ -98,14 +98,14 @@ class LevelInstanceForm { updateFieldsForm(); // Biome field changed - var anyAutoLayerInvalidated = false; + var invalidatedLis = []; for( ld in project.defs.layers ) if( ld.biomeFieldUid==fi.defUid ) { - l.getLayerInstance(ld).autoTilesCache = null; - anyAutoLayerInvalidated = true; + var li = l.getLayerInstance(ld); + invalidatedLis.push(li); } - if( anyAutoLayerInvalidated ) - editor.ge.emit(AutoLayerRenderingChanged); + if( invalidatedLis.length>0 ) + editor.ge.emit( AutoLayerRenderingChanged(invalidatedLis) ); case _: }