Compare commits

..

No commits in common. "29d3d912451be369b0e3fd66ad116360da5a3f44" and "dc3ad175a14b20faa9dbeedd86cf2140b4743908" have entirely different histories.

5 changed files with 61 additions and 56 deletions

View File

@ -5,8 +5,11 @@ 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
commandGroups = {}, -- Holds the command groups that have been registered (~\library\toolchain\commands.lua) sideBarPageDefault = nil, -- Holds the default sidebar page (view) as a string and is set in topbarInterface.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),

View File

@ -3,19 +3,17 @@
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) --[[
if type(o) == 'table' then TEST DOCUMENT
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)
@ -23,32 +21,36 @@ return {
self = data self = data
self.id = id self.id = id
self.commands = {} self.commands = {}
globals.commandGroups[id] = {} table.insert(globals.commandGroups, id)
self.command = function(id, callback) self.command = function(id, callback)
table.insert(globals.commandGroups[data.id], {[tostring(id)]=callback}) table.insert(commands, {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 or commandIndex == nil then print("Failed to find command group: "..text) return end if commandIndex == -1 then print("Failed to find command group: "..text) return end
local commandGroup = string.gsub(string.sub(text, 0, (commandIndex-1)), "%s+", "") local commandGroup = string.sub(text, 0, (commandIndex-1))
local commandName = string.gsub(string.sub(text, (commandIndex+1), string.len(text)), "%s+", "") print("commandGroup: "..commandGroup)
for row, group in pairs(globals.commandGroups) do
for column, placement in pairs(group) do --[[for i,v in pairs(globals.commandGroups) do
for selection, trigger in pairs(placement) do for k,l in pairs(self.commands[i]) do
if(commandGroup == ">"..row) and (commandName == selection) then if l ==
placement[selection]()
print("COMMAND INVOKED")
end
end
end end
end end]]--
end end
} }

View File

@ -53,6 +53,7 @@ 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
}) })

View File

@ -5,10 +5,6 @@ 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)
--[[ --[[
@ -34,8 +30,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 = {}
local defaultPage = nil self.defaultPage = nil
local currentPage = nil self.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")
@ -203,25 +199,13 @@ return {
end end
self.bindDefaultMenu = function(page) self.bindDefaultMenu = function(page)
defaultPage = page self.defaultPage = page
currentPage = page self.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

View File

@ -4,7 +4,6 @@
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
@ -27,6 +26,8 @@ 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
@ -35,6 +36,7 @@ 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)
@ -49,10 +51,23 @@ 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 sidebar menu -- Bind pages to labels in 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)
]]--