mirror of
https://github.com/teverse/teverse
synced 2025-08-25 23:54:46 +02:00
Compare commits
No commits in common. "7768b467e551cde25b54925514f7b695d15d678c" and "38920adfa2c1d753d0c8a5326b602ce7efacd002" have entirely different histories.
7768b467e5
...
38920adfa2
@ -192,4 +192,4 @@ keybinder:bind({
|
|||||||
|
|
||||||
controller.box = boundingBox
|
controller.box = boundingBox
|
||||||
|
|
||||||
return controller
|
return controller
|
@ -32,10 +32,11 @@ return {
|
|||||||
colour = colour(0, 1, 0),
|
colour = colour(0, 1, 0),
|
||||||
size = vector3(1, 1, 1),
|
size = vector3(1, 1, 1),
|
||||||
position = vector3(1, 0, 0),
|
position = vector3(1, 0, 0),
|
||||||
mesh = "primitive:wedge",
|
mesh = "primitive:wedge",
|
||||||
rotation = quaternion:setEuler(0, math.rad(90), 0)
|
rotation = quaternion:setEuler(0, math.rad(90), 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
local block = engine.construct("block", workspace, {
|
local block = engine.construct("block", workspace, {
|
||||||
name = "blueBlock",
|
name = "blueBlock",
|
||||||
colour = colour(0, 0, 1),
|
colour = colour(0, 0, 1),
|
||||||
@ -67,4 +68,4 @@ return {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
@ -117,7 +117,7 @@ return {
|
|||||||
doNotSerialise = true,
|
doNotSerialise = true,
|
||||||
size = vector3(0.1, 0.1, 0.1),
|
size = vector3(0.1, 0.1, 0.1),
|
||||||
colour = colour(axisNumber == 1 and 1 or 0, axisNumber == 2 and 1 or 0, axisNumber == 3 and 1 or 0),
|
colour = colour(axisNumber == 1 and 1 or 0, axisNumber == 2 and 1 or 0, axisNumber == 3 and 1 or 0),
|
||||||
--emissiveColour = colour(axisNumber == 1 and 1 or 0, axisNumber == 2 and 1 or 0, axisNumber == 3 and 1 or 0),
|
emissiveColour = colour(axisNumber == 1 and 1 or 0, axisNumber == 2 and 1 or 0, axisNumber == 3 and 1 or 0),
|
||||||
workshopLocked = true,
|
workshopLocked = true,
|
||||||
mesh = "primitive:cone"
|
mesh = "primitive:cone"
|
||||||
})
|
})
|
||||||
|
@ -95,7 +95,7 @@ return {
|
|||||||
doNotSerialise=true,
|
doNotSerialise=true,
|
||||||
size = vector3(.4, 0.1, .4),
|
size = vector3(.4, 0.1, .4),
|
||||||
colour = colour(axis == 1 and 1 or 0, axis == 2 and 1 or 0, axis == 3 and 1 or 0),
|
colour = colour(axis == 1 and 1 or 0, axis == 2 and 1 or 0, axis == 3 and 1 or 0),
|
||||||
--emissiveColour = colour(axis == 1 and 0.5 or 0, axis == 2 and 0.5 or 0, axis == 3 and 0.5 or 0),
|
emissiveColour = colour(axis == 1 and 0.5 or 0, axis == 2 and 0.5 or 0, axis == 3 and 0.5 or 0),
|
||||||
workshopLocked = true,
|
workshopLocked = true,
|
||||||
mesh = "tevurl:3d/arrowCurved.glb"
|
mesh = "tevurl:3d/arrowCurved.glb"
|
||||||
})
|
})
|
||||||
|
@ -125,7 +125,7 @@ return {
|
|||||||
doNotSerialise = true,
|
doNotSerialise = true,
|
||||||
size = vector3(0.1, 0.1, 0.1),
|
size = vector3(0.1, 0.1, 0.1),
|
||||||
colour = colour(axisNumber == 1 and 1 or 0, axisNumber == 2 and 1 or 0, axisNumber == 3 and 1 or 0),
|
colour = colour(axisNumber == 1 and 1 or 0, axisNumber == 2 and 1 or 0, axisNumber == 3 and 1 or 0),
|
||||||
--emissiveColour = colour(axisNumber == 1 and 1 or 0, axisNumber == 2 and 1 or 0, axisNumber == 3 and 1 or 0),
|
emissiveColour = colour(axisNumber == 1 and 1 or 0, axisNumber == 2 and 1 or 0, axisNumber == 3 and 1 or 0),
|
||||||
workshopLocked = true
|
workshopLocked = true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,299 +0,0 @@
|
|||||||
--[[
|
|
||||||
Requires refactoring
|
|
||||||
]]
|
|
||||||
|
|
||||||
local controller = {}
|
|
||||||
|
|
||||||
local ui = require("tevgit:workshop/controllers/ui/core/ui.lua")
|
|
||||||
local shared = require("tevgit:workshop/controllers/shared.lua")
|
|
||||||
|
|
||||||
local hues = {
|
|
||||||
colour(1,0,0),
|
|
||||||
colour(1,0,1),
|
|
||||||
colour(0,0,1),
|
|
||||||
colour(0,1,1),
|
|
||||||
colour(0,1,0),
|
|
||||||
colour(1,1,0),
|
|
||||||
colour(1,0,0),
|
|
||||||
}
|
|
||||||
|
|
||||||
local window = ui.window(shared.workshop.interface,
|
|
||||||
"Colour Picker",
|
|
||||||
guiCoord(0, 300, 0, 186),
|
|
||||||
guiCoord(0.5, -150, 0.5, -93),
|
|
||||||
false,
|
|
||||||
true)
|
|
||||||
window.zIndex = 10
|
|
||||||
window.visible = false
|
|
||||||
local callback = nil
|
|
||||||
|
|
||||||
local startColour = colour(1,0,0)
|
|
||||||
local currentColour = colour(1,0,0)
|
|
||||||
|
|
||||||
local colourPickerGradient = engine.construct("guiFrameMultiColour", window.content, {
|
|
||||||
name = "square",
|
|
||||||
size = guiCoord(0, 150, 0, 150),
|
|
||||||
position = guiCoord(0, 5, 0, 5),
|
|
||||||
topLeftColour = colour(1,1,1),
|
|
||||||
topRightColour = startColour,
|
|
||||||
bottomLeftColour = colour(1,1,1),
|
|
||||||
bottomRightColour = startColour
|
|
||||||
})
|
|
||||||
|
|
||||||
-- To have black on the bottom we need to overlay this...
|
|
||||||
engine.construct("guiFrameMultiColour", colourPickerGradient, {
|
|
||||||
name = "overlay",
|
|
||||||
size = guiCoord(1,0,1,0),
|
|
||||||
position = guiCoord(0, 0, 0, 0),
|
|
||||||
|
|
||||||
topLeftColour = colour(0,0,0),
|
|
||||||
topLeftAlpha = 0,
|
|
||||||
|
|
||||||
topRightColour = colour(0,0,0),
|
|
||||||
topRightAlpha = 0,
|
|
||||||
|
|
||||||
bottomLeftColour = colour(0,0,0),
|
|
||||||
bottomLeftAlpha = 1,
|
|
||||||
|
|
||||||
bottomRightColour = colour(0,0,0),
|
|
||||||
bottomRightAlpha = 1,
|
|
||||||
|
|
||||||
handleEvents = false
|
|
||||||
})
|
|
||||||
|
|
||||||
local marker = engine.construct("guiFrame", colourPickerGradient, {
|
|
||||||
name = "marker",
|
|
||||||
size = guiCoord(0, 6, 0, 6),
|
|
||||||
position = guiCoord(0, 0, 0, 0),
|
|
||||||
handleEvents=false,
|
|
||||||
backgroundColour = colour(1,1,1),
|
|
||||||
borderColour = colour(0,0,0),
|
|
||||||
zIndex = 10,
|
|
||||||
borderWidth = 1,
|
|
||||||
borderRadius = 6,
|
|
||||||
borderAlpha = 1
|
|
||||||
})
|
|
||||||
|
|
||||||
local hueBar = engine.construct("guiFrame", window.content, {
|
|
||||||
name = "hueBar",
|
|
||||||
size = guiCoord(0, 30, 1, -10),
|
|
||||||
position = guiCoord(0, 160, 0, 5),
|
|
||||||
backgroundAlpha = 0
|
|
||||||
})
|
|
||||||
|
|
||||||
local hueBarMARKER = engine.construct("guiFrame", hueBar, {
|
|
||||||
name = "hueBarMARKER",
|
|
||||||
size = guiCoord(1, 0, 0, 1),
|
|
||||||
position = guiCoord(0, 0, 0, 0),
|
|
||||||
handleEvents=false,
|
|
||||||
backgroundAlpha = 0,
|
|
||||||
borderColour = colour(0,0,0),
|
|
||||||
zIndex = 10,
|
|
||||||
borderWidth = 2,
|
|
||||||
borderAlpha = 1
|
|
||||||
})
|
|
||||||
|
|
||||||
for i = 1, 6 do
|
|
||||||
local colourPickerGradient = engine.construct("guiFrameMultiColour", hueBar, {
|
|
||||||
handleEvents = false,
|
|
||||||
size = guiCoord(1, 0, 1/6, 1),
|
|
||||||
position = guiCoord(0, 0, (i-1)*(1/6), 0),
|
|
||||||
topLeftColour = hues[i],
|
|
||||||
topRightColour = hues[i],
|
|
||||||
bottomLeftColour = hues[i+1],
|
|
||||||
bottomRightColour = hues[i+1],
|
|
||||||
handleEvents = false
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local rLabel = ui.create("guiTextBox", window.content, {
|
|
||||||
name = "labelR",
|
|
||||||
size = guiCoord(0, 20, 0, 16),
|
|
||||||
position = guiCoord(0,200,0,5),
|
|
||||||
fontSize = 16,
|
|
||||||
textAlpha = 0.6,
|
|
||||||
text = "R",
|
|
||||||
align = enums.align.topLeft
|
|
||||||
}, "primaryText")
|
|
||||||
|
|
||||||
local rInput = ui.create("guiTextBox", window.content, {
|
|
||||||
backgroundAlpha = 0.25,
|
|
||||||
readOnly = false,
|
|
||||||
multiline = false,
|
|
||||||
fontSize = 18,
|
|
||||||
name = "r",
|
|
||||||
size = guiCoord(1, -220, 0,16),
|
|
||||||
position = guiCoord(0, 220, 0, 5),
|
|
||||||
text = "1",
|
|
||||||
align = enums.align.middle
|
|
||||||
}, "primary")
|
|
||||||
|
|
||||||
local gLabel = rLabel:clone()
|
|
||||||
gLabel.name = "gLabel"
|
|
||||||
gLabel.text = "G"
|
|
||||||
gLabel.parent = window.content
|
|
||||||
gLabel.position = guiCoord(0, 200, 0, 22)
|
|
||||||
--themeController.add(gLabel, "primaryText")
|
|
||||||
|
|
||||||
local g = rInput:clone()
|
|
||||||
g.name = "g"
|
|
||||||
g.parent = window.content
|
|
||||||
g.position = guiCoord(0, 220, 0, 22)
|
|
||||||
-- themeController.add(g, "primary")
|
|
||||||
|
|
||||||
local bLabel = rLabel:clone()
|
|
||||||
bLabel.name = "bLabel"
|
|
||||||
bLabel.text = "B"
|
|
||||||
bLabel.parent = window.content
|
|
||||||
bLabel.position = guiCoord(0, 200, 0, 39)
|
|
||||||
--themeController.add(bLabel, "primaryText")
|
|
||||||
|
|
||||||
local b = rInput:clone()
|
|
||||||
b.name = "b"
|
|
||||||
b.parent = window.content
|
|
||||||
b.position = guiCoord(0, 220, 0, 39)
|
|
||||||
|
|
||||||
|
|
||||||
local hexLabel = rLabel:clone()
|
|
||||||
hexLabel.name = "hexLabel"
|
|
||||||
hexLabel.text = "#"
|
|
||||||
hexLabel.parent = window.content
|
|
||||||
hexLabel.position = guiCoord(0, 200, 0, 56)
|
|
||||||
--themeController.add(bLabel, "primaryText")
|
|
||||||
|
|
||||||
local HEX = rInput:clone()
|
|
||||||
HEX.name = "FFFFFF"
|
|
||||||
HEX.parent = window.content
|
|
||||||
HEX.position = guiCoord(0, 220, 0, 56)
|
|
||||||
-- themeController.add(b, "primary")
|
|
||||||
|
|
||||||
local preview = engine.construct("guiFrame", window.content, {
|
|
||||||
position = guiCoord(0, 220, 0, 73),
|
|
||||||
size = guiCoord(1, -220, 0, 16)
|
|
||||||
})
|
|
||||||
|
|
||||||
local function handler()
|
|
||||||
local newR = tonumber(rInput.text)
|
|
||||||
local newG = tonumber(g.text)
|
|
||||||
local newB = tonumber(b.text)
|
|
||||||
if not newR or not newG or not newB then return end
|
|
||||||
|
|
||||||
controller.setColour(colour:fromRGB(newR, newG, newB))
|
|
||||||
end
|
|
||||||
|
|
||||||
rInput:textInput(handler)
|
|
||||||
g:textInput(handler)
|
|
||||||
b:textInput(handler)
|
|
||||||
HEX:textInput(function()
|
|
||||||
controller.setColour(colour:fromHex(HEX.text), true)
|
|
||||||
end)
|
|
||||||
|
|
||||||
hueBar:mouseLeftPressed(function ()
|
|
||||||
while engine.input:isMouseButtonDown(enums.mouseButton.left) do
|
|
||||||
local pos = engine.input.mousePosition - hueBar.absolutePosition
|
|
||||||
local size = hueBar.absoluteSize
|
|
||||||
|
|
||||||
local y = pos.y/hueBar.absoluteSize.y
|
|
||||||
|
|
||||||
local sector = math.ceil(pos.y/(size.y * (1/6)))
|
|
||||||
local hue = hues[sector]
|
|
||||||
if hue and hues[sector+1] then
|
|
||||||
|
|
||||||
hueBarMARKER.position = guiCoord(0,0,y,0)
|
|
||||||
|
|
||||||
local selected = hue:lerp(hues[sector+1], (y - ((size.y * ((sector-1)/6))/hueBar.absoluteSize.y)) / (1/6))
|
|
||||||
startColour = selected
|
|
||||||
colourPickerGradient.topRightColour = startColour
|
|
||||||
colourPickerGradient.bottomRightColour = startColour
|
|
||||||
|
|
||||||
local x = (marker.position.offsetX)/colourPickerGradient.absoluteSize.x
|
|
||||||
local y = (marker.position.offsetY)/colourPickerGradient.absoluteSize.y
|
|
||||||
|
|
||||||
local selectedColour = startColour:lerp(colour(1,1,1), 1-x)
|
|
||||||
selectedColour = selectedColour:lerp(colour(0,0,0), y)
|
|
||||||
preview.backgroundColour = selectedColour
|
|
||||||
|
|
||||||
rInput.text = tostring(math.floor(selectedColour.r*255))
|
|
||||||
g.text = tostring(math.floor(selectedColour.g*255))
|
|
||||||
b.text = tostring(math.floor(selectedColour.b*255))
|
|
||||||
HEX.text = selectedColour:getHex()
|
|
||||||
end
|
|
||||||
|
|
||||||
wait()
|
|
||||||
end
|
|
||||||
|
|
||||||
if callback then
|
|
||||||
callback(preview.backgroundColour)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
colourPickerGradient:mouseLeftPressed(function ()
|
|
||||||
while engine.input:isMouseButtonDown(enums.mouseButton.left) do
|
|
||||||
local pos = engine.input.mousePosition - colourPickerGradient.absolutePosition
|
|
||||||
marker.position = guiCoord(0, pos.x-2, 0, pos.y-2)
|
|
||||||
|
|
||||||
local x = pos.x/colourPickerGradient.absoluteSize.x
|
|
||||||
local y = pos.y/colourPickerGradient.absoluteSize.y
|
|
||||||
|
|
||||||
local selectedColour = startColour:lerp(colour(1,1,1), 1-x)
|
|
||||||
selectedColour = selectedColour:lerp(colour(0,0,0), y)
|
|
||||||
preview.backgroundColour = selectedColour
|
|
||||||
|
|
||||||
rInput.text = tostring(math.floor(selectedColour.r*255))
|
|
||||||
g.text = tostring(math.floor(selectedColour.g*255))
|
|
||||||
b.text = tostring(math.floor(selectedColour.b*255))
|
|
||||||
HEX.text = selectedColour:getHex()
|
|
||||||
wait()
|
|
||||||
end
|
|
||||||
|
|
||||||
if callback then
|
|
||||||
callback(preview.backgroundColour)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
controller.setColour = function(c, dontUpdateHex)
|
|
||||||
local h,s,l = c:getHSV()
|
|
||||||
h=(1-h)*360
|
|
||||||
local markerh = math.ceil(h / 60)
|
|
||||||
if markerh <= 0 then markerh = 1 end
|
|
||||||
|
|
||||||
local pos = hueBar.absolutePosition
|
|
||||||
local size = hueBar.absoluteSize
|
|
||||||
|
|
||||||
local hue = hues[markerh]
|
|
||||||
|
|
||||||
local selected = hue:lerp(hues[markerh+1], ((h - (60*(markerh-1)))/60))
|
|
||||||
|
|
||||||
startColour = selected
|
|
||||||
colourPickerGradient.topRightColour = startColour
|
|
||||||
colourPickerGradient.bottomRightColour = startColour
|
|
||||||
|
|
||||||
preview.backgroundColour = c
|
|
||||||
|
|
||||||
rInput.text = tostring(math.floor(c.r*255))
|
|
||||||
g.text = tostring(math.floor(c.g*255))
|
|
||||||
b.text = tostring(math.floor(c.b*255))
|
|
||||||
if not dontUpdateHex then
|
|
||||||
HEX.text = c:getHex()
|
|
||||||
end
|
|
||||||
|
|
||||||
marker.position = guiCoord(0, (s) * colourPickerGradient.absoluteSize.x, 0, (1-l) * colourPickerGradient.absoluteSize.y)
|
|
||||||
marker.position = marker.position + guiCoord(0, -2, 0, -2)
|
|
||||||
|
|
||||||
hueBarMARKER.position = guiCoord(0,0,h/360,0)
|
|
||||||
|
|
||||||
if callback then
|
|
||||||
callback(preview.backgroundColour)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
controller.window = window
|
|
||||||
|
|
||||||
controller.prompt = function(startColour, cb)
|
|
||||||
callback = nil
|
|
||||||
controller.setColour(startColour)
|
|
||||||
callback = cb
|
|
||||||
controller.window.visible = true
|
|
||||||
end
|
|
||||||
|
|
||||||
return controller
|
|
@ -4,7 +4,6 @@ local modulePrefix = "tevgit:workshop/controllers/ui/components/propertyEditor/"
|
|||||||
|
|
||||||
local ui = require("tevgit:workshop/controllers/ui/core/ui.lua")
|
local ui = require("tevgit:workshop/controllers/ui/core/ui.lua")
|
||||||
local themer = require("tevgit:workshop/controllers/ui/core/themer.lua")
|
local themer = require("tevgit:workshop/controllers/ui/core/themer.lua")
|
||||||
local colourPicker = require("tevgit:workshop/controllers/ui/components/colourPicker.lua")
|
|
||||||
|
|
||||||
local parseInputs = require(modulePrefix .. "parseInputs.lua")
|
local parseInputs = require(modulePrefix .. "parseInputs.lua")
|
||||||
local meshShortcuts = require(modulePrefix .. "meshShortcuts.lua")
|
local meshShortcuts = require(modulePrefix .. "meshShortcuts.lua")
|
||||||
@ -16,8 +15,8 @@ createInputs = {
|
|||||||
return ui.create("guiFrame", nil, {
|
return ui.create("guiFrame", nil, {
|
||||||
backgroundAlpha = 0.25,
|
backgroundAlpha = 0.25,
|
||||||
name = "inputContainer",
|
name = "inputContainer",
|
||||||
size = guiCoord(0.45, 0, 0, 20),
|
size = guiCoord(0.4, 0, 0, 20),
|
||||||
position = guiCoord(0.55,0,0,0),
|
position = guiCoord(0.6,0,0,0),
|
||||||
cropChildren = false
|
cropChildren = false
|
||||||
}, "secondary")
|
}, "secondary")
|
||||||
end,
|
end,
|
||||||
@ -219,7 +218,7 @@ createInputs = {
|
|||||||
if property == "mesh" then
|
if property == "mesh" then
|
||||||
container.zIndex = 30 -- important because child elements need to be rendered above other properties!
|
container.zIndex = 30 -- important because child elements need to be rendered above other properties!
|
||||||
container.size = container.size + guiCoord(0,0,0,20)
|
container.size = container.size + guiCoord(0,0,0,20)
|
||||||
x.fontSize = 14
|
|
||||||
|
|
||||||
local presetSelect = ui.create("guiTextBox", container, {
|
local presetSelect = ui.create("guiTextBox", container, {
|
||||||
size = guiCoord(1, -4, 0, 16),
|
size = guiCoord(1, -4, 0, 16),
|
||||||
@ -630,11 +629,18 @@ createInputs = {
|
|||||||
borderRadius = 2,
|
borderRadius = 2,
|
||||||
})
|
})
|
||||||
|
|
||||||
col:mouseLeftReleased(function ()
|
-- col:mouseLeftReleased(function ()
|
||||||
colourPicker.prompt(value, function(c)
|
-- controller.colourPicker.window.visible = not controller.colourPicker.window.visible
|
||||||
instance[property] = c
|
-- if controller.colourPicker.window.visible and instanceEditing and instanceEditing[property] then
|
||||||
end)
|
-- controller.colourPicker.setColour(instanceEditing[property])
|
||||||
end)
|
-- controller.colourPicker.setCallback(function (c)
|
||||||
|
-- x.text = tostring(c.r)
|
||||||
|
-- g.text = tostring(c.g)
|
||||||
|
-- b.text = tostring(c.b)
|
||||||
|
-- parseInputs[type(value)](property, container)
|
||||||
|
-- end)
|
||||||
|
-- end
|
||||||
|
-- end)
|
||||||
|
|
||||||
return container
|
return container
|
||||||
end,
|
end,
|
||||||
|
@ -52,7 +52,7 @@ return {
|
|||||||
colour = function(property, gui)
|
colour = function(property, gui)
|
||||||
local r,g,b = tonumber(gui.r.text),tonumber(gui.g.text),tonumber(gui.b.text)
|
local r,g,b = tonumber(gui.r.text),tonumber(gui.g.text),tonumber(gui.b.text)
|
||||||
if r and g and b then
|
if r and g and b then
|
||||||
callbackInput(property, colour:fromRGB(r,g,b))
|
callbackInput(property, colour(r,g,b))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -8,45 +8,31 @@ return {
|
|||||||
|
|
||||||
end,
|
end,
|
||||||
boolean = function (instance, gui, value)
|
boolean = function (instance, gui, value)
|
||||||
if engine.input.keyFocusedGui == gui.input then return end
|
|
||||||
|
|
||||||
gui.input.texture = value and "fa:s-toggle-on" or "fa:s-toggle-off"
|
gui.input.texture = value and "fa:s-toggle-on" or "fa:s-toggle-off"
|
||||||
themer.registerGui(gui.input, value and "successImage" or "errorImage")
|
themer.registerGui(gui.input, value and "successImage" or "errorImage")
|
||||||
end,
|
end,
|
||||||
number = function (instance, gui, value)
|
number = function (instance, gui, value)
|
||||||
if engine.input.keyFocusedGui == gui.input then return end
|
gui.input.text = tostring(value)
|
||||||
|
|
||||||
gui.input.text = string.format("%.3f", value)
|
|
||||||
end,
|
end,
|
||||||
string = function (instance, gui, value)
|
string = function (instance, gui, value)
|
||||||
if engine.input.keyFocusedGui == gui.input then return end
|
|
||||||
|
|
||||||
gui.input.text = value
|
gui.input.text = value
|
||||||
end,
|
end,
|
||||||
vector3 = function(instance, gui, value)
|
vector3 = function(instance, gui, value)
|
||||||
if engine.input.keyFocusedGui == gui.x or engine.input.keyFocusedGui == gui.y or engine.input.keyFocusedGui == gui.z then return end
|
|
||||||
|
|
||||||
gui.x.text = string.format("%.3f", value.x)
|
gui.x.text = string.format("%.3f", value.x)
|
||||||
gui.y.text = string.format("%.3f", value.y)
|
gui.y.text = string.format("%.3f", value.y)
|
||||||
gui.z.text = string.format("%.3f", value.z)
|
gui.z.text = string.format("%.3f", value.z)
|
||||||
end,
|
end,
|
||||||
vector2 = function(instance, gui, value)
|
vector2 = function(instance, gui, value)
|
||||||
if engine.input.keyFocusedGui == gui.x or engine.input.keyFocusedGui == gui.y then return end
|
|
||||||
|
|
||||||
gui.x.text = string.format("%.3f", value.x)
|
gui.x.text = string.format("%.3f", value.x)
|
||||||
gui.y.text = string.format("%.3f", value.y)
|
gui.y.text = string.format("%.3f", value.y)
|
||||||
end,
|
end,
|
||||||
colour = function(instance, gui, value)
|
colour = function(instance, gui, value)
|
||||||
if engine.input.keyFocusedGui == gui.r or engine.input.keyFocusedGui == gui.g or engine.input.keyFocusedGui == gui.b then return end
|
gui.r.text = string.format("%.5f", value.r)
|
||||||
|
gui.g.text = string.format("%.5f", value.g)
|
||||||
gui.r.text = string.format("%.0f", value.r * 255)
|
gui.b.text = string.format("%.5f", value.b)
|
||||||
gui.g.text = string.format("%.0f", value.g * 255)
|
|
||||||
gui.b.text = string.format("%.0f", value.b * 255)
|
|
||||||
gui.col.backgroundColour = value
|
gui.col.backgroundColour = value
|
||||||
end,
|
end,
|
||||||
quaternion = function(instance, gui, value)
|
quaternion = function(instance, gui, value)
|
||||||
if engine.input.keyFocusedGui == gui.x or engine.input.keyFocusedGui == gui.y or engine.input.keyFocusedGui == gui.z or engine.input.keyFocusedGui == gui.w then return end
|
|
||||||
|
|
||||||
local euler = value:getEuler()
|
local euler = value:getEuler()
|
||||||
gui.x.text = string.format("%.3f", math.deg(euler.x))
|
gui.x.text = string.format("%.3f", math.deg(euler.x))
|
||||||
gui.y.text = string.format("%.3f", math.deg(euler.y))
|
gui.y.text = string.format("%.3f", math.deg(euler.y))
|
||||||
@ -54,8 +40,6 @@ return {
|
|||||||
--gui.w.text = tostring(value.w)
|
--gui.w.text = tostring(value.w)
|
||||||
end,
|
end,
|
||||||
guiCoord = function(instance, gui, value)
|
guiCoord = function(instance, gui, value)
|
||||||
if engine.input.keyFocusedGui == gui.scaleX or engine.input.keyFocusedGui == gui.offsetX or engine.input.keyFocusedGui == gui.scaleY or engine.input.keyFocusedGui == gui.offsetY then return end
|
|
||||||
|
|
||||||
gui.scaleX.text = tostring(value.scaleX)
|
gui.scaleX.text = tostring(value.scaleX)
|
||||||
gui.offsetX.text = tostring(value.offsetX)
|
gui.offsetX.text = tostring(value.offsetX)
|
||||||
gui.scaleY.text = tostring(value.scaleY)
|
gui.scaleY.text = tostring(value.scaleY)
|
||||||
|
@ -76,7 +76,7 @@ function controller.generateProperties()
|
|||||||
|
|
||||||
local label = ui.create("guiTextBox", container, {
|
local label = ui.create("guiTextBox", container, {
|
||||||
name = "label",
|
name = "label",
|
||||||
size = guiCoord(0.55, -15, 1, 0),
|
size = guiCoord(0.6, -15, 1, 0),
|
||||||
position = guiCoord(0, 0, 0, 0),
|
position = guiCoord(0, 0, 0, 0),
|
||||||
fontSize = 18,
|
fontSize = 18,
|
||||||
text = v.property,
|
text = v.property,
|
||||||
|
@ -3,67 +3,46 @@
|
|||||||
|
|
||||||
local ui = require("tevgit:workshop/controllers/ui/core/ui.lua")
|
local ui = require("tevgit:workshop/controllers/ui/core/ui.lua")
|
||||||
local shared = require("tevgit:workshop/controllers/shared.lua")
|
local shared = require("tevgit:workshop/controllers/shared.lua")
|
||||||
local themer = require("tevgit:workshop/controllers/ui/core/themer.lua")
|
|
||||||
local colourPicker = require("tevgit:workshop/controllers/ui/components/colourPicker.lua")
|
|
||||||
|
|
||||||
local container = ui.create("guiFrame", shared.workshop.interface, {
|
local container = ui.create("guiFrame", shared.workshop.interface, {
|
||||||
size = guiCoord(1, -10, 1, 0),
|
size = guiCoord(1, -20, 1, 0),
|
||||||
position = guiCoord(0, 10, 0, 10)
|
position = guiCoord(0, 10, 0, 10)
|
||||||
}, "background")
|
}, "background")
|
||||||
|
|
||||||
local theme = themer.getTheme()
|
ui.create("guiTextBox", container, {
|
||||||
local y = 0
|
size = guiCoord(0.25, -10, 0.5, -10),
|
||||||
for _,prop in pairs(themer.types) do
|
position = guiCoord(0, 5, 0, 5),
|
||||||
local themeProperty = engine.construct("guiFrame", container, {
|
text = "Primary"
|
||||||
size = guiCoord(1, 0, 0, 40),
|
}, "primary")
|
||||||
position = guiCoord(0, 0, 0, y),
|
|
||||||
backgroundAlpha = 0
|
|
||||||
})
|
|
||||||
|
|
||||||
ui.create("guiTextBox", themeProperty, {
|
|
||||||
size = guiCoord(1, -10, 0, 16),
|
|
||||||
position = guiCoord(0, 6, 0, 2),
|
|
||||||
text = prop,
|
|
||||||
fontSize = 16,
|
|
||||||
align = enums.align.middleLeft,
|
|
||||||
fontFile = "local:OpenSans-SemiBold.ttf"
|
|
||||||
}, "backgroundText")
|
|
||||||
|
|
||||||
local count = 0
|
ui.create("guiTextBox", container, {
|
||||||
for _,v in pairs(theme[prop]) do if type(v) == "colour" then count = count + 1 end end
|
size = guiCoord(0.25, -10, 0.5, -10),
|
||||||
|
position = guiCoord(0.25, 5, 0, 5),
|
||||||
|
text = "Primary\nVariant"
|
||||||
|
}, "primaryVariant")
|
||||||
|
|
||||||
local size = 1/count
|
ui.create("guiTextBox", container, {
|
||||||
local i = 0
|
size = guiCoord(0.25, -10, 0.5, -10),
|
||||||
|
position = guiCoord(0.5, 5, 0, 5),
|
||||||
|
text = "Secondary"
|
||||||
|
}, "secondary")
|
||||||
|
|
||||||
for k,v in pairs(theme[prop]) do
|
ui.create("guiTextBox", container, {
|
||||||
if type(v) == "colour" then
|
size = guiCoord(0.25, -10, 0.5, -10),
|
||||||
local ch,cs,cv = v:getHSV()
|
position = guiCoord(0.75, 5, 0, 5),
|
||||||
local btn = ui.create("guiTextBox", themeProperty, {
|
text = "Secondary\nVariant"
|
||||||
size = guiCoord(size, -10, 0, 20),
|
}, "secondaryVariant")
|
||||||
position = guiCoord(size*i, 5, 0, 20),
|
|
||||||
text = k,
|
|
||||||
fontSize = 16,
|
|
||||||
align = enums.align.middle,
|
|
||||||
backgroundColour = v,
|
|
||||||
textColour = cv > 0.5 and colour:black() or colour:white(),
|
|
||||||
borderRadius = 4,
|
|
||||||
borderColour = colour:black(),
|
|
||||||
borderAlpha = 0.3
|
|
||||||
}, prop)
|
|
||||||
|
|
||||||
btn:mouseLeftReleased(function()
|
ui.create("guiTextBox", container, {
|
||||||
print(theme, prop, k)
|
size = guiCoord(0.5, -10, 0.5, -10),
|
||||||
colourPicker.prompt(theme[prop][k], function(c)
|
position = guiCoord(0, 5, 0.5, 5),
|
||||||
theme[prop][k] = c
|
text = "Error"
|
||||||
themer.setTheme(theme)
|
}, "error")
|
||||||
end)
|
|
||||||
end)
|
|
||||||
i = i + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
y = y + 44
|
|
||||||
end
|
|
||||||
|
|
||||||
|
ui.create("guiTextBox", container, {
|
||||||
|
size = guiCoord(0.5, -10, 0.5, -10),
|
||||||
|
position = guiCoord(0.5, 5, 0.5, 5),
|
||||||
|
text = "background"
|
||||||
|
}, "background")
|
||||||
|
|
||||||
return container
|
return container
|
@ -63,8 +63,8 @@ controller.setupDocks = function ()
|
|||||||
}),
|
}),
|
||||||
engine.construct("guiFrame", shared.workshop.interface, {
|
engine.construct("guiFrame", shared.workshop.interface, {
|
||||||
name = "_dockRight",
|
name = "_dockRight",
|
||||||
size = guiCoord(0, 265, 1, -76),
|
size = guiCoord(0, 250, 1, -76),
|
||||||
position = guiCoord(1, -265, 0, 76),
|
position = guiCoord(1, -250, 0, 76),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
handleEvents = false,
|
handleEvents = false,
|
||||||
cropChildren = false,
|
cropChildren = false,
|
||||||
|
@ -53,10 +53,6 @@ return {
|
|||||||
for gui,v in pairs(registeredGuis) do
|
for gui,v in pairs(registeredGuis) do
|
||||||
themeriseGui(gui)
|
themeriseGui(gui)
|
||||||
end
|
end
|
||||||
end,
|
|
||||||
|
|
||||||
getTheme = function()
|
|
||||||
return currentTheme
|
|
||||||
end
|
end
|
||||||
|
|
||||||
}
|
}
|
@ -86,8 +86,6 @@ local function beginLoad(workshop)
|
|||||||
loadingScreen = nil
|
loadingScreen = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local colourPicker = require("tevgit:workshop/controllers/ui/components/colourPicker.lua")
|
|
||||||
|
|
||||||
--print("Workshop Loaded. ", #engine.workspace.children) Lets not spam the console
|
--print("Workshop Loaded. ", #engine.workspace.children) Lets not spam the console
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user