Tips
A working knowledge of Fullmoon Lua scripting plugin is assumed.
Be careful of possible word wrap on code samples.
Texture
function Sample:init()
self.mytexture="" -- initialize 'mytexture' as an
empty string
end
function Sample:load(stream)
self.mytexture=stream:readString()
end
function Sample:save(stream)
stream:writeString(self.mytexture)
end
function Sample:getDialog(dialog)
self.mytextureID=dialog:addTexture(self.mytexture)
end
function Sample:valueChanged(id,value)
if id==self.mytextureID then --
if the texture name has changed
self.mytexture=value
-- save it
end
scene:invalidate()
-- tell Moray the scene needs saving
>
end
function Sample:toPOV(pov)
if self.mytexture ~= "" then -- if mytexture is 'not equal'
to an empty string
pov:texture(gsub(self.mytexture,"%s","%_")) --
replace any space (%s) with underline (%_) in the texture name
end
end
or if you want to use something other than a material statement.
pov:write("normal {"..gsub(self.mytexture,"%s","%_").."}"
In this example the user of the plugin will have to make sure they select
entries from the Material Editor which contain only a "normal" statement. These
can be made with the 'Direct Code' option in the Material Editor.