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

ScriptName = "SZ_PointInspector"

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

SZ_PointInspector = {}


function SZ_PointInspector:Name()
	return "Point Inspector"
end

function SZ_PointInspector:Version()
	return "1.0"
end

function SZ_PointInspector:Description()
	return "Show the selected point's info"
end

function SZ_PointInspector:Creator()
	return "Stan from 2danimator.ru"
end

function SZ_PointInspector:UILabel()
	return "Point Inspector"
end

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

function SZ_PointInspector:IsEnabled(moho)
	if (moho:CountSelectedPoints() > 0) then
		return true
	end
	return false
end

function SZ_PointInspector:IsRelevant(moho)
	local mesh = moho:Mesh()
	if (mesh == nil) then
		return false
	end
	return true
end

function SZ_PointInspector:Run(moho)
	local mesh = moho:Mesh()
	if (mesh == nil) then
		return
	end
	
	-- local layerID = moho.document:LayerAbsoluteID(moho.layer)
	local layerName = moho.layer:Name()
	
	for i=0, mesh:CountPoints()-1 do
		local point = mesh:Point(i)
		if point.fSelected then
			print("________________")
			print("Point id: " .. i)
			print("Width: " .. point.fWidth:GetValue(moho.layerFrame) )
			print("fPos: "..point.fPos.x.. ", ".. point.fPos.y)
			print("fAnimPos: "..point.fAnimPos:GetValue(moho.layerFrame).x.. ", ".. point.fAnimPos:GetValue(moho.layerFrame).y)
			print("fTempPos: "..point.fTempPos.x.. ", ".. point.fTempPos.y)
			print("CountCurves: "..point:CountCurves())
			print("IsEndpoint: "..tostring(point:IsEndpoint()))
			print("fParent: " .. point.fParent)
			local where = -1
			local curve, where = point:Curve (0, where)
			print("Curve length: " .. curve:CurveLength())
			break
		end
	end
end

Icon
Point Inspector
Listed

Author: Stan View Script
Script type: Button/Menu

Uploaded: Dec 27 2020, 10:27

Shows the selected point's info. Useful for those who writes scripts for Moho.
Image

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