Page 1 of 1

[Lua][ImageManager] getSingleton is nil

Posted: Tue Jul 09, 2013 09:20
by Baarnus
Hi!

My problem is, that I want to load an imageset from lua:

Code: Select all

CEGUI.ImageManager:getSingleton():loadImageset("EditorIcons.imageset")

And the error is that the getSingeton function doesn't exist. I get the error:

Code: Select all

terminate called after throwing an instance of 'CEGUI::ScriptException'
  what():  CEGUI::ScriptException in function 'void CEGUI::LuaScriptModule::executeScriptFile_impl(const CEGUI::String&, const CEGUI::String&, int, int)' (/home/baarnus/Dokumentumok/Install/cegui-0.8.2/cegui/src/ScriptModules/Lua/ScriptModule.cpp:590) : Unable to execute Lua script file: 'init_editor.lua'

[string "init_editor.lua"]:10: attempt to call method 'getSingleton' (a nil value)

From C++ the loading works correctly, and other singletons like Logger and AnimationManager are working correctly. The question is, that getSingleton is really missing, or I'm doing something wrong?

My whole lua script:

Code: Select all

-- CEGUI singletons
local logger = CEGUI.Logger:getSingleton()
-- Begin Editor Init
logger:logEvent("++++ Editor init started ++++")
-- Load layout
local layout = CEGUI.WindowManager:getSingleton():loadLayoutFromFile("editor.layout")
-- Set layout
CEGUI.System:getSingleton():getDefaultGUIContext():setRootWindow(layout)
-- Load icons
CEGUI.ImageManager:getSingleton():loadImageset("EditorIcons.imageset")
-- Load animations
CEGUI.AnimationManager:getSingleton():loadAnimationsFromXML("EditorAnimations.anim")
--[[
Setup the tab control
@param tabControlName
]]
function setupTabControl(tabControlName, iconSet)
   -- Get the tab control for name
   local tabControl = CEGUI.toTabControl(layout:getChild(tabControlName))
   -- Tab buttons
   local tabButtons = tabControl:getChild("__auto_TabPane__Buttons")
   -- For all children
   for i=1,math.min(tabControl:getTabCount(),table.getn(iconSet)) do
      -- Get tab button
      local tabButton = tabButtons:getChildAtIdx(i-1)
      -- Animation
--      tabButton:setProperty("Icon", "EditorIcons/"..iconSet[i])
      logger:logEvent("TabButton: "..tabButton:getText())
      -- Add icon
      logger:logEvent("Button: "..tabButton:getName()..", Icon: "..iconSet[i]..", Anim: "..iconSet[i].."IconAnim")
   end
end
-- Setup Tab controls
--setupTabControl("View/Tabs", {"Drill","Drill","Drill"})
--setupTabControl("Inventory/Tabs", {"Drill","Engine","Track"})
-- End Editor Init
logger:logEvent("++++ Editor init ended ++++")


Thx!