I passed view into the function, but it's still throwing an error. It says the same thing about view being a nil. This is the simple function I'm trying to run:
Code: Select all
function DR_TEST:Run(moho,view)
local points = {}
local mesh = moho:Mesh()
for i=0, mesh:CountPoints()-1 do
table.insert(points, mesh:Point(i).fPos)
end
local g = view:Graphics()
local matrix = LM.Matrix:new_local()
moho.drawingLayer:GetFullTransform(moho.frame, matrix, moho.document)
g:Push()
g:ApplyMatrix(matrix)
g:SetColor(MOHO.MohoGlobals.SelCol)
for i,k in ipairs(points) do
g:FillCircle(k, .1)
end
g:Pop()
moho.view:RefreshView()
moho.view:DrawMe()
end
Right now, I'm just trying to get it to do something, anything. I've been looking for documentation on how the viewport is organized, but all I see are functions in the api will little to no information on how it's organized or supposed to be called. For the most part, I've just been trying to copy and paste whatever I can find from other scripts, but it doesn't appear to work. I'm clearly doing something wrong, I just don't know what.