Jump to content

Recommended Posts

Posted

Today is not a great time but we can work this out over the next week. It will probably require some additions in the editor to expose more things to Lua.

  • Thanks 1

Let's build cool stuff and have fun. :)

Posted

Okay, you now have access to the terrain material layer list:

listbox = program.terraineditor.materiallist

So you could listen for a WIDGETMENU event and make a popup menu appear when the user right-clicks on an item. That could show a menu that says "Load Splat map" and you could open a file open dialog, load a pixmap, and then apply it to all the selected objects with this:

local sel = program:GetSelection()
for n = 1, #sel do
    local terrain = Terrain(sel[n].entity)
    if terrain ~= nil then
        -- apply splat map here...
    end
end

Maybe you would want to have some menu items like this:

  • Load Red Channel...
  • Load Green Channel...
  • Load Blue Channel...
  • Load Alpha Channel...

I'm just thinking of ways to make it handle more than four layers.

On the other hand maybe you want to add a button to just load a splat map onto the first four layers:

local panel = program.terraineditor.panel
local savebutton = panel:FindChild("Save")
local button = CreateButton("Splat", savebutton.position.x + savebutton.size.x, savebutton.position.y, savebutton.size.x, savebutton.size.y, panel)

 

  • Thanks 1

Let's build cool stuff and have fun. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...