Image
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************

ScriptName = "SS_AddWarpLayer"

-- **************************************************
-- "Add & Assign an empty Warp Layer"
-- --------------------------------------------------
-- version:	01.00 MH12+ #5312
-- by: Sam Cogheil (SimplSam)
-- Licence & Warranty: None
--   Use/Reuse/Adapt Freely. Attribution appreciated
-- **************************************************

-- **************************************************
-- General information about this script
-- **************************************************

SS_AddWarpLayer = {}

function SS_AddWarpLayer:Name()
    return 'Add Warp Layer'
end

function SS_AddWarpLayer:Version()
    return '1.0 #5312'
end

function SS_AddWarpLayer:UILabel()
    return 'Add Warp Layer'
end

function SS_AddWarpLayer:Creator()
    return 'Sam Cogheil (SimplSam)'
end

function SS_AddWarpLayer:Description()
    return 'Add & Assign an empty Warp Layer'
end

-- **************************************************
-- Is Relevant / Is Enabled
-- **************************************************

function SS_AddWarpLayer:IsRelevant(moho)
    return true
end

function SS_AddWarpLayer:IsEnabled(moho)
    return (moho.layer:LayerType() == MOHO.LT_IMAGE) or (moho.layer:LayerType() == MOHO.LT_VECTOR)
end

-- **************************************************
-- The guts of this script
-- **************************************************

function SS_AddWarpLayer:Run(moho)
    moho.document:SetDirty()
    moho.document:PrepUndo(nil)

    local imgLayer = moho.layer
    local warpLayer = moho:LayerAsVector(moho:CreateNewLayer(MOHO.LT_VECTOR))
    warpLayer:SetName(("%s (warp)"):format(imgLayer:Name()))
    if (imgLayer.SetWarpLayer) then
        imgLayer:SetWarpLayer(warpLayer)
    else
        imgLayer:SetDistortionMeshLayer(warpLayer)
    end
    warpLayer:SetContinuousTriangulation(true)
end

Icon
SS - Add Warp Layer
Listed

Script type: Button/Menu

Uploaded: Dec 18 2023, 03:54

Add & Assign an empty Mesh Warp Layer
Add and Assign an empty Mesh Warp Layer to an existing Image or Vector layer - ready for manual Mesh Warp creation.

Installation Options:

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: 292