-- ************************************************** -- Provide Moho with the name of this script object -- ************************************************** ScriptName = "AE_PushParenting" -- ************************************************** -- General information about this script -- ************************************************** AE_PushParenting = {} function AE_PushParenting:Name() return 'Push parenting' end function AE_PushParenting:Version() return '1.0' end function AE_PushParenting:UILabel() return 'Push parenting' end function AE_PushParenting:Creator() return 'Alexandra Evseeva' end function AE_PushParenting:Description() return 'Move parent bone link from group layer to its children' end function AE_PushParenting:ColorizeIcon() return true end -- ************************************************** -- Is Relevant / Is Enabled -- ************************************************** function AE_PushParenting:IsRelevant(moho) return true end function AE_PushParenting:IsEnabled(moho) return true end -- ************************************************** -- The guts of this script -- ************************************************** function AE_PushParenting:Recursive(moho, nextGroup, parentBone) for i=0, nextGroup:CountLayers()-1 do local childGroup = moho:LayerAsGroup(nextGroup:Layer(i)) if childGroup and not moho:LayerAsBone(nextGroup:Layer(i)) then self:Recursive(moho, childGroup, parentBone) else nextGroup:Layer(i):SetLayerParentBone(parentBone) end end end function AE_PushParenting:Run(moho) moho.document:SetDirty() moho.document:PrepUndo(nil) local parentBone = moho.layer:LayerParentBone() if parentBone < 0 then return LM.GUI.Alert(LM.GUI.ALERT_WARNING, "Selected layer is not linked to a bone") end local groupLayer = moho:LayerAsGroup(moho.layer) if not groupLayer then return LM.GUI.Alert(LM.GUI.ALERT_WARNING, "Selected layer is not a group") end local queryResult = LM.GUI.Alert( LM.GUI.ALERT_INFO, "Select push level", "", "", "One level", "Till the end", "Cancel" ) if queryResult == 2 then return end groupLayer:SetLayerParentBone(-1) if queryResult == 0 then for i = 0, groupLayer:CountLayers() - 1 do groupLayer:Layer(i):SetLayerParentBone(parentBone) end elseif queryResult == 1 then self:Recursive(moho, groupLayer, parentBone) end end
Push parenting
Listed
Author: A.Evseeva
View Script
Script type: Button/Menu
Uploaded: Jun 11 2022, 04:19
Script Version: 1.0
Move layer-to-bone link into group layer's child layers
This script, and all other scripts on this site are distributed as free software under the GNU General Public License 3.0 or later.
Downloads count: 745
Push parenting
Listed
Author: A.Evseeva
View Script
Script type: Button/Menu
Uploaded: Jun 11 2022, 04:19
Script Version: 1.0
Move layer-to-bone link into group layer's child layers
This script, and all other scripts on this site are distributed as free software under the GNU General Public License 3.0 or later.
Downloads count: 745