GroupLayer:GetLayerOrdering()

Version added: before 9.5

This accesses the layer ordering animation channel which is an AnimString

Return type (AnimString): The return types are as from the AnimString and AnimChannel classes

For this method, AnimString is a list of layer UUID (MohoLayer:UUID) separated by the "|" character.

See the AnimString and AnimChannel classes for the operations available.

The following example gives the basic Get and Set Value for the channel. An example of one operation from AnimChannel is also given.

local i
local layer = moho.layer
if not layer:IsGroupType() then
return
end
local groupLayer = moho:LayerAsGroup(layer)
local layersSet = ""

-- Print layer UUIDs in a group and build a string in a format usable
-- to set the order at the given frame

for i = 0, groupLayer:CountLayers()-1 do
Print (groupLayer:Layer(i):Name() .. has UUID .. groupLayer:Layer(i):UUID())
layersSet = layersSet ..groupLayer:Layer(i):UUID() .. "|"
end
groupLayer:GetLayerOrdering():SetValue(moho.frame,layersSet)


-- Get the layer order (i.e. string of delineated UUIDs) at the current frame
local testSort = groupLayer:GetLayerOrdering():GetValue(moho.frame)


--See if there's a key at a given frame - print it if so or set one if not
if groupLayer:GetLayerOrdering():HasKey(moho.frame) then
testSort = groupLayer:GetLayerOrdering():GetValue(moho.frame)
Print ("frame " .. tostring(moho.layerFrame) .. " Has a key: " .. testSort)
else
groupLayer:GetLayerOrdering():SetValue(moho.frame, layersSet)
end



String "GetLayerOrdering" is found in the following scripts:

AE Action tools (by A.Evseeva)