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

ScriptName = "SZ_BoneInspector"

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

SZ_BoneInspector = {}

function SZ_BoneInspector:Name()
	return "Bone Inspector"
end

function SZ_BoneInspector:Version()
	return "1.0"
end

function SZ_BoneInspector:Description()
	return "Show the selected bone's info"
end

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

function SZ_BoneInspector:UILabel()
	return "Bone Inspector"
end

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

function SZ_BoneInspector:IsEnabled(moho)
	local skel = moho:Skeleton()
	if (skel == nil) then
		return false
	end
	return true
end

function SZ_BoneInspector:IsRelevant(moho)
	local skel = moho:Skeleton()
	if (skel == nil) then
		return false
	end
	return true
end

function SZ_BoneInspector:Run(moho)
	local skel = moho:Skeleton()
	for i=0, skel:CountBones()-1 do
		local bone = skel:Bone(i)
		if bone.fSelected then
			print("_________________")
			print("Id: " .. i)
			print("Name: " ..bone:Name())
			print("Parent: " ..bone.fParent)
			print("Length: "..bone.fLength)
			print("Angle: " ..bone.fAngle)
			print("AnimAngle: " .. bone.fAnimAngle:GetValue(moho.layerFrame))
			print("Scale: " ..bone.fScale)
			local pos = bone.fPos
			print("Pos: "..pos.x..", "..pos.y)
			local animPos = bone.fAnimPos:GetValue(moho.layerFrame)
			print("AnimPos: "..animPos.x..", "..animPos.y)
			local fConstraints = bone.fConstraints
			print("Constrainted: "..tostring(fConstraints))
			-- if(fConstraints) then
				print("Min constraint: "..bone.fMinConstraint)
				print("Max constraint: "..bone.fMaxConstraint)
			-- end
			break
		end
	end	
end

Icon
Bone Inspector
Listed

Author: Stan View Script
Script type: Button/Menu

Uploaded: Dec 27 2020, 10:28

Shows the selected bone'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: 111