myspace / CommonLua /Ged /XTemplates /GedParticleEditor.lua
sirnii's picture
Upload 1816 files
b6a38d7 verified
raw
history blame
3.81 kB
-- ========== GENERATED BY XTemplate Editor (Alt-F3) DO NOT EDIT MANUALLY! ==========
PlaceObj('XTemplate', {
RequireActionSortKeys = true,
group = "GedApps",
id = "GedParticleEditor",
save_in = "Ged",
PlaceObj('XTemplateTemplate', {
'__template', "PresetEditor",
}, {
PlaceObj('XTemplateFunc', {
'name', "SetIsUIParticle",
'func', function (self, ...)
local params = pack_params(...)
local value = params and params[1]
self.is_ui_particle = value
self:ActionsUpdated()
end,
}),
PlaceObj('XTemplateAction', {
'ActionId', "NewParam",
'ActionSortKey', "2",
'ActionTranslate', false,
'ActionName', "New Param",
'ActionIcon', "CommonAssets/UI/Ged/cog.tga",
'ActionToolbar', "main",
'OnAction', function (self, host, source, ...)
if host.idPresets:GetSelection() then
host:Op("GedOpListNewItemInClass", "SelectedPreset", host.idPresetContent:GetSelection() or 0, "ParticleParam", "ParticleSystemPreset")
end
end,
'__condition', function (parent, context) return not config.ModdingToolsInUserMode end,
}),
PlaceObj('XTemplateCode', {
'run', function (self, parent, context)
local detail_levels = OptionsData.Options.Effects
local detail_level_names = {"Low", "Medium", "High", "Ultra"}
for name_idx, detail_name in ipairs(detail_level_names) do
local idx = table.find(detail_levels, "value", detail_name)
assert(idx)
XAction:new({
ActionId = "Preview" .. idx,
ActionToolbar = "main",
ActionName = "Preview " .. detail_levels[idx].value,
ActionTranslate = false,
ActionToolbarSplit = name_idx == #detail_level_names,
ActionIcon = "CommonAssets/UI/Ged/preview-level-0" .. name_idx .. ".tga",
ActionSortKey = "2",
OnAction = function(self, host, win, toggled)
host:Send("GedSetParticleEmitDetail", detail_levels[idx].value)
end,
ActionToggle = true,
ActionToggled = function (self, host)
return host.actions_toggled["Preview" .. detail_levels[idx].value]
end,
}, parent)
end
end,
}),
PlaceObj('XTemplateAction', {
'ActionId', "TestUIParticle",
'ActionSortKey', "2",
'ActionTranslate', false,
'ActionName', "Test UI Particle",
'ActionIcon', "CommonAssets/UI/Ged/play.tga",
'ActionToolbar', "main",
'ActionToggle', true,
'ActionToggled', function (self, host)
return host.actions_toggled["TestUIParticle"]
end,
'ActionState', function (self, host)
if host.is_ui_particle then
return false
end
return "hidden"
end,
'OnAction', function (self, host, source, ...)
host.actions_toggled["TestUIParticle"] = not host.actions_toggled["TestUIParticle"]
host:Send("GedTestUIParticle", host.actions_toggled["TestUIParticle"])
end,
'__condition', function (parent, context) return not config.ModdingToolsInUserMode end,
}),
PlaceObj('XTemplateAction', {
'ActionId', "GedResetAllParticleSystemInstances",
'ActionSortKey', "2",
'ActionTranslate', false,
'ActionName', "Reset all particles",
'ActionIcon', "CommonAssets/UI/Ged/view.tga",
'ActionToolbar', "main",
'OnAction', function (self, host, source, ...)
host:Send("GedResetAllParticleSystemInstances")
end,
'__condition', function (parent, context) return not config.ModdingToolsInUserMode end,
}),
PlaceObj('XTemplateAction', {
'ActionId', "Commit",
'ActionSortKey', "2",
'ActionTranslate', false,
'ActionName', "Commit",
'ActionIcon', "CommonAssets/UI/Ged/commit.tga",
'ActionMenubar', "File",
'ActionToolbar', "main",
'OnAction', function (self, host, source, ...)
host:Send("GedParticleSystemPresetCommit")
end,
'__condition', function (parent, context) return not config.ModdingToolsInUserMode end,
}),
}),
})