mirror of https://github.com/teverse/teverse
Compare commits
2 Commits
dc3ad175a1
...
29d3d91245
Author | SHA1 | Date |
---|---|---|
Sanjay Bhadra | 29d3d91245 | |
Sanjay Bhadra | b706eb031a |
|
@ -5,11 +5,8 @@ return {
|
||||||
dev = nil, -- Holds workshop instance and is set in main.lua
|
dev = nil, -- Holds workshop instance and is set in main.lua
|
||||||
user = nil, -- Holds user instance and is set in main.lua
|
user = nil, -- Holds user instance and is set in main.lua
|
||||||
developerMode = false, -- Holds the developer_mode boolean and is set in main.lua
|
developerMode = false, -- Holds the developer_mode boolean and is set in main.lua
|
||||||
sideBarPageDefault = nil, -- Holds the default sidebar page (view) as a string and is set in topbarInterface.lua
|
commandGroups = {}, -- Holds the command groups that have been registered (~\library\toolchain\commands.lua)
|
||||||
sideBarPageActive = nil, -- Holds the current active sidebar page (view) as a string and is set in topbarInterface.lua
|
|
||||||
commandGroups = {}, -- Holds the core command groups used internally by workshop
|
|
||||||
defaultColours = { -- Default colors used for theming UI components (~\library\ui\components)
|
defaultColours = { -- Default colors used for theming UI components (~\library\ui\components)
|
||||||
--primary = colour.rgb(112, 112, 112),
|
|
||||||
primary = colour.rgb(52, 58, 64),
|
primary = colour.rgb(52, 58, 64),
|
||||||
secondary = colour.rgb(239, 239, 239),
|
secondary = colour.rgb(239, 239, 239),
|
||||||
background = colour.rgb(33, 33, 33),
|
background = colour.rgb(33, 33, 33),
|
||||||
|
|
|
@ -3,17 +3,19 @@
|
||||||
|
|
||||||
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
||||||
|
|
||||||
--[[
|
function dump(o)
|
||||||
TEST DOCUMENT
|
if type(o) == 'table' then
|
||||||
|
local s = '{ '
|
||||||
|
for k,v in pairs(o) do
|
||||||
|
if type(k) ~= 'number' then k = '"'..k..'"' end
|
||||||
|
s = s .. '['..k..'] = ' .. dump(v) .. ','
|
||||||
|
end
|
||||||
|
return s .. '} '
|
||||||
|
else
|
||||||
|
return tostring(o)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- How to register a plugin
|
|
||||||
|
|
||||||
local commands = require("...")
|
|
||||||
local extension = commands.createGroup("Hello")
|
|
||||||
extension.command("ping", function() print("pong") end)
|
|
||||||
-- >hello: ping
|
|
||||||
---> pong!
|
|
||||||
]]
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
createGroup = function(id)
|
createGroup = function(id)
|
||||||
|
@ -21,36 +23,32 @@ return {
|
||||||
self = data
|
self = data
|
||||||
self.id = id
|
self.id = id
|
||||||
self.commands = {}
|
self.commands = {}
|
||||||
table.insert(globals.commandGroups, id)
|
globals.commandGroups[id] = {}
|
||||||
|
|
||||||
self.command = function(id, callback)
|
self.command = function(id, callback)
|
||||||
table.insert(commands, {id=callback})
|
table.insert(globals.commandGroups[data.id], {[tostring(id)]=callback})
|
||||||
end
|
|
||||||
|
|
||||||
self.invokeCommand = function(id)
|
|
||||||
for i,v in pairs(self.commands) do
|
|
||||||
for k,l in pairs(self.commands[i]) do
|
|
||||||
if l == id then return print("FOUND: "..id) end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return data
|
return data
|
||||||
end,
|
end,
|
||||||
|
|
||||||
parse = function(text)
|
parse = function(text)
|
||||||
-- Sytax
|
-- Sytax
|
||||||
---> group: name
|
---> group: name
|
||||||
local commandIndex = string.find(text, ":")
|
local commandIndex = string.find(text, ":")
|
||||||
if commandIndex == -1 then print("Failed to find command group: "..text) return end
|
if commandIndex == -1 or commandIndex == nil then print("Failed to find command group: "..text) return end
|
||||||
local commandGroup = string.sub(text, 0, (commandIndex-1))
|
local commandGroup = string.gsub(string.sub(text, 0, (commandIndex-1)), "%s+", "")
|
||||||
print("commandGroup: "..commandGroup)
|
local commandName = string.gsub(string.sub(text, (commandIndex+1), string.len(text)), "%s+", "")
|
||||||
|
|
||||||
|
for row, group in pairs(globals.commandGroups) do
|
||||||
--[[for i,v in pairs(globals.commandGroups) do
|
for column, placement in pairs(group) do
|
||||||
for k,l in pairs(self.commands[i]) do
|
for selection, trigger in pairs(placement) do
|
||||||
if l ==
|
if(commandGroup == ">"..row) and (commandName == selection) then
|
||||||
end
|
placement[selection]()
|
||||||
end]]--
|
print("COMMAND INVOKED")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
|
@ -53,7 +53,6 @@ return {
|
||||||
name = pageName,
|
name = pageName,
|
||||||
size = guiCoord(1, 0, 0, 600),
|
size = guiCoord(1, 0, 0, 600),
|
||||||
position = guiCoord(-1, 0, 0, 200),
|
position = guiCoord(-1, 0, 0, 200),
|
||||||
--backgroundColour = globals.defaultColours.red,
|
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
zIndex = 200
|
zIndex = 200
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,6 +5,10 @@ local globals = require("tevgit:workshop/library/globals.lua") -- globals; varia
|
||||||
local toolTip = require("tevgit:workshop/library/ui/components/toolTip.lua") -- UI component
|
local toolTip = require("tevgit:workshop/library/ui/components/toolTip.lua") -- UI component
|
||||||
local commands = require("tevgit:workshop/library/toolchain/commands.lua") -- Commandbar toolchain component
|
local commands = require("tevgit:workshop/library/toolchain/commands.lua") -- Commandbar toolchain component
|
||||||
|
|
||||||
|
-- Core Command Groups
|
||||||
|
local show_commandGroup = commands.createGroup("Show")
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
construct = function(idValue, nameValue)
|
construct = function(idValue, nameValue)
|
||||||
--[[
|
--[[
|
||||||
|
@ -30,8 +34,8 @@ return {
|
||||||
self.name = nameValue -- Name of scene being edited / developed on
|
self.name = nameValue -- Name of scene being edited / developed on
|
||||||
self.keys = {} -- Where item keys are stored
|
self.keys = {} -- Where item keys are stored
|
||||||
self.pages = {}
|
self.pages = {}
|
||||||
self.defaultPage = nil
|
local defaultPage = nil
|
||||||
self.currentPage = nil
|
local currentPage = nil
|
||||||
|
|
||||||
self.animate = function(page, pos)
|
self.animate = function(page, pos)
|
||||||
teverse.tween:begin(page, 0.5, { position = pos }, "inOutQuad")
|
teverse.tween:begin(page, 0.5, { position = pos }, "inOutQuad")
|
||||||
|
@ -199,13 +203,25 @@ return {
|
||||||
end
|
end
|
||||||
|
|
||||||
self.bindDefaultMenu = function(page)
|
self.bindDefaultMenu = function(page)
|
||||||
self.defaultPage = page
|
defaultPage = page
|
||||||
self.currentPage = page
|
currentPage = page
|
||||||
data.animate(page, guiCoord(0, 0, 0, 200))
|
data.animate(page, guiCoord(0, 0, 0, 200))
|
||||||
end
|
end
|
||||||
|
|
||||||
self.bindMenu = function(name, page)
|
self.bindMenu = function(name, page)
|
||||||
table.insert(data.pages, #data.pages+1, { [name] = page })
|
table.insert(data.pages, #data.pages+1, { [name] = page })
|
||||||
|
show_commandGroup.command(name, function()
|
||||||
|
if currentPage.id == page.id then
|
||||||
|
data.animate(currentPage, guiCoord(-1, 0, 0, 200))
|
||||||
|
data.animate(defaultPage, guiCoord(0, 0, 0, 200))
|
||||||
|
currentPage = defaultPage
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
data.animate(currentPage, guiCoord(-1, 0, 0, 200))
|
||||||
|
data.animate(page, guiCoord(0, 0, 0, 200))
|
||||||
|
currentPage = page
|
||||||
|
end)
|
||||||
_count = _count + 1
|
_count = _count + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
||||||
local topbarInterface = require("tevgit:workshop/library/ui/controllers/topbarInterface.lua") -- UI Controller
|
local topbarInterface = require("tevgit:workshop/library/ui/controllers/topbarInterface.lua") -- UI Controller
|
||||||
local sidebarInterface = require("tevgit:workshop/library/ui/controllers/sidebarInterface.lua") -- UI Controller
|
local sidebarInterface = require("tevgit:workshop/library/ui/controllers/sidebarInterface.lua") -- UI Controller
|
||||||
|
local commands = require("tevgit:workshop/library/toolchain/commands.lua") -- Commands Registry
|
||||||
|
|
||||||
local topBar = topbarInterface.construct("horizontalNavbar", "Test Place 1") -- Create initial topbar instance
|
local topBar = topbarInterface.construct("horizontalNavbar", "Test Place 1") -- Create initial topbar instance
|
||||||
local sideBar = sidebarInterface.construct("verticalNavbar") -- Create initial sidebar instance
|
local sideBar = sidebarInterface.construct("verticalNavbar") -- Create initial sidebar instance
|
||||||
|
@ -26,8 +27,6 @@ defaultPage.registerIcon("uploadFileIcon", "file-upload", nil)
|
||||||
defaultPage.registerIcon("downloadFileIcon", "file-download", nil)
|
defaultPage.registerIcon("downloadFileIcon", "file-download", nil)
|
||||||
defaultPage.registerIcon("importFileIcon", "file-import", nil)
|
defaultPage.registerIcon("importFileIcon", "file-import", nil)
|
||||||
defaultPage.registerIcon("exportFileIcon", "file-export", nil)
|
defaultPage.registerIcon("exportFileIcon", "file-export", nil)
|
||||||
--globals.sideBarPageDefault = defaultPage -- Set default sidebar page to default
|
|
||||||
--globals.sideBarPageActive = defaultPage -- Set default sidebar page as active
|
|
||||||
|
|
||||||
|
|
||||||
local designPage = sideBar.registerPage("Design") -- Register design page to sidebar instance
|
local designPage = sideBar.registerPage("Design") -- Register design page to sidebar instance
|
||||||
|
@ -36,7 +35,6 @@ designPage.registerIcon("guiFrameIcon", "square-full", nil)
|
||||||
designPage.registerIcon("guiTextBoxIcon", "i-cursor", nil)
|
designPage.registerIcon("guiTextBoxIcon", "i-cursor", nil)
|
||||||
designPage.registerIcon("guiImageIcon", "image", nil)
|
designPage.registerIcon("guiImageIcon", "image", nil)
|
||||||
|
|
||||||
--[[
|
|
||||||
local modelPage = sideBar.registerPage("Model") -- Register model page to sidebar instance
|
local modelPage = sideBar.registerPage("Model") -- Register model page to sidebar instance
|
||||||
modelPage.registerIcon("modelIcon", "shapes", nil)
|
modelPage.registerIcon("modelIcon", "shapes", nil)
|
||||||
|
|
||||||
|
@ -51,23 +49,10 @@ testPage.registerIcon("consoleIcon", "terminal", nil)
|
||||||
testPage.registerIcon("playIcon", "play", nil)
|
testPage.registerIcon("playIcon", "play", nil)
|
||||||
testPage.registerIcon("serverIcon", "server", nil)
|
testPage.registerIcon("serverIcon", "server", nil)
|
||||||
testPage.registerIcon("fullScreenIcon", "expand-alt", nil)
|
testPage.registerIcon("fullScreenIcon", "expand-alt", nil)
|
||||||
]]--
|
|
||||||
|
|
||||||
-- Bind pages to labels in menu
|
-- Bind pages to sidebar menu
|
||||||
topBar.bindDefaultMenu(defaultPage.getContainer())
|
topBar.bindDefaultMenu(defaultPage.getContainer())
|
||||||
topBar.bindMenu("Design", designPage.getContainer())
|
topBar.bindMenu("Design", designPage.getContainer())
|
||||||
--topBar.bindMenu("Model", modelPage.getContainer())
|
topBar.bindMenu("Model", modelPage.getContainer())
|
||||||
--topBar.bindMenu("Insert", insertPage.getContainer())
|
topBar.bindMenu("Insert", insertPage.getContainer())
|
||||||
--topBar.bindMenu("Test", testPage.getContainer())
|
topBar.bindMenu("Test", testPage.getContainer())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--[[
|
|
||||||
-- Register topbar button (name labels) to topbar instance
|
|
||||||
topBar.register("Design", "Design your guis", designPage)
|
|
||||||
topBar.register("Model", "Model your scene", modelPage)
|
|
||||||
topBar.register("Insert", "Insert an instance to your scene", insertPage)
|
|
||||||
topBar.register("Test", "Test your scene", testPage)
|
|
||||||
]]--
|
|
Loading…
Reference in New Issue