protected override void OnNewSettingsLoaded() { _sections.Clear(); _sections.AddRange(EmitterSettings.TextureSections ?? Array.Empty <TextureSectionCoords>()); if (string.IsNullOrWhiteSpace(EmitterSettings.TextureFileName)) { if (_imguiTextureId != null) { MonoGameImGuiRenderer.UnbindTexture(_imguiTextureId.Value); } _texture = null; _imguiTextureId = null; } else { _texture = TextureFileLoader.LoadTexture2D(EmitterSettings.TextureFileName); _imguiTextureId = MonoGameImGuiRenderer.BindTexture(_texture); } if (_texture != null) { // Since we have no texture, there's no point to the section editor existing, so don't bother // doing anything until we actually have a texture loaded _textureSectionEditor.ApplicationState = ApplicationState; _textureSectionEditor.CommandHandler = CommandHandler; _textureSectionEditor.MonoGameImGuiRenderer = MonoGameImGuiRenderer; _textureSectionEditor.AppOperationQueue = AppOperationQueue; _textureSectionEditor.TextureFileLoader = TextureFileLoader; _textureSectionEditor.EmitterSettings = EmitterSettings; } }
protected override void OnNewSettingsLoaded() { _texture = TextureFileLoader.LoadTexture2D(EmitterSettings.TextureFileName); _imguiTextureId = MonoGameImGuiRenderer.BindTexture(_texture); _textureSections.Clear(); _textureSections.AddRange(EmitterSettings.TextureSections); if (_currentSection != null) { if (_currentSection.Index >= _textureSections.Count) { _currentSection = null; } else { var section = _textureSections[_currentSection.Index]; _currentSection = new TextureSection(_currentSection.Index, section); } } }