Custom windows can't get toolbar icons
lpgagnon opened this issue ยท 2 comments
MechJeb Version
Dev build 949
KSP Version
1.8.1
Description
Introduced by #1241 : MechJebModuleCustomInfoWindow doesn't implement IconName() (only MechJebModuleCustomWindowEditor does, in that file). Base class version is used, returning "Display_Module_icon", which of course fails to load.
It looks like IconName() should return this.title
(there also seems to be something causing the "built-in" custom windows (like Delta-V Stats) not to get offered as toolbar options at all - but that's probably unrelated to this issue; a "real" custom window works fine (like "lpg1" in log snippet below)
KSP.log
[LOG 22:51:44.099] Create button for module Warp Helper
[LOG 22:51:44.100] Create button for module Delta-V Stats
[LOG 22:51:44.102] [MechJeb2] No icon for Display_Module_Icon
[LOG 22:51:44.102] Create button for module Orbit Info
[LOG 22:51:44.103] [MechJeb2] No icon for Display_Module_Icon
[LOG 22:51:44.103] Create button for module Surface Info
[LOG 22:51:44.103] [MechJeb2] No icon for Display_Module_Icon
[LOG 22:51:44.103] Create button for module Vessel Info
[LOG 22:51:44.103] [MechJeb2] No icon for Display_Module_Icon
[LOG 22:51:44.103] Create button for module lpg1
[LOG 22:51:44.104] [MechJeb2] No icon for Display_Module_Icon
but that's probably unrelated to this issue; a "real" custom window works fine
I think I'm wrong on that; I added a 2nd custom window, and the first one disappeared from the list.
ToolbarManager.Instance.add("MechJeb2", name)
'name' is the IconName, so looks like ToolbarManager is being given several items with the same name for every custom window, and last one wins
fixed by #1405