This happens when creating any layer type except for vector.
Code: Select all
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************
ScriptName = "Syn_TestDialog"
-- **************************************************
-- General information about this script
-- **************************************************
Syn_TestDialog = {}
Syn_TestDialog.BASE_STR = 2355
function Syn_TestDialog:Name()
return "Test Dialog"
end
function Syn_TestDialog:Version()
return "1.0"
end
function Syn_TestDialog:Description()
return "Test Dialog"
end
function Syn_TestDialog:Creator()
return "(c)2022 J.Wesley Fowler (synthsin75)"
end
function Syn_TestDialog:UILabel()
return "SYN: Test Dialog"
end
-- **************************************************
-- The guts of this script
-- **************************************************
function Syn_TestDialog:OnMouseDown(moho, mouseEvent)
end
-- **************************************************
-- Options dialog
-- **************************************************
local Syn_TestDialogDialog = {}
function Syn_TestDialogDialog:new(moho)
local d = LM.GUI.SimpleDialog("", Syn_TestDialogDialog)
local l = d:GetLayout()
l:AddChild(LM.GUI.StaticText("Text", LM.GUI.ALIGN_Left))
return d
end
function Syn_TestDialogDialog:UpdateWidgets()
end
function Syn_TestDialogDialog:HandleMessage(msg)
end
-- **************************************************
-- Tool options - create and respond to tool's UI
-- **************************************************
Syn_TestDialog.NEWLAYER = MOHO.MSG_BASE
Syn_TestDialog.DLOG_END = MOHO.MSG_BASE + 1
function Syn_TestDialog:DoLayout(moho, layout)
self.dlog = Syn_TestDialogDialog:new(moho)
self.opt = LM.GUI.PopupDialog("Options", false, self.DLOG_END)
self.opt:SetDialog(self.dlog)
layout:AddChild(self.opt, LM.GUI.ALIGN_CENTER)
self.newButton = LM.GUI.ShortButton("New layer", self.NEWLAYER)
layout:AddChild(self.newButton)
end
function Syn_TestDialog:HandleMessage(moho, view, msg)
if (msg == self.DLOG_END) then --update enabled/disabled camera tools
local frame = moho.frame
if (frame == 0) then
moho:SetCurFrame(1)
else
moho:SetCurFrame(0)
end
moho:SetCurFrame(frame)
elseif (msg == self.NEWLAYER) then
moho.document:PrepUndo()
moho.document:SetDirty()
local layer = moho:CreateNewLayer(MOHO.LT_SWITCH, true)
--local layer = moho:CreateNewLayer(MOHO.LT_VECTOR, true)
--local layer = moho:CreateNewLayer(MOHO.LT_TEXT, true)
--local layer = moho:CreateNewLayer(MOHO.LT_AUDIO, true)
--local layer = moho:CreateNewLayer(MOHO.LT_IMAGE, true)
--local layer = moho:CreateNewLayer(MOHO.LT_PARTICLE, true)
--local layer = moho:CreateNewLayer(MOHO.LT_PATCH, true)
--local layer = moho:CreateNewLayer(MOHO.LT_TEXT, true)
--local layer = moho:CreateNewLayer(MOHO.LT_GROUP, true)
--local layer = moho:CreateNewLayer(MOHO.LT_BONE, true)
--local layer = moho:CreateNewLayer(MOHO.LT_3D, true)
moho:UpdateUI()
end
MOHO.Redraw()
end
I haven't been able to come up with a way around this.