mirror of
https://github.com/teverse/teverse
synced 2025-08-26 08:04:46 +02:00
Compare commits
No commits in common. "c66a2e37d62e0559b2de121f2b6ee4cfe8702c0f" and "713233288a0f454fe3bde3b8d36d2103c7804112" have entirely different histories.
c66a2e37d6
...
713233288a
@ -116,25 +116,22 @@ local function endAction()
|
|||||||
v:disconnect()
|
v:disconnect()
|
||||||
end
|
end
|
||||||
eventListeners = {}
|
eventListeners = {}
|
||||||
|
|
||||||
-- if nothing changed dont create an action
|
|
||||||
if count(changes) > 0 or #destroyedObjects > 0 or #newObjects > 0 then
|
|
||||||
pointer = pointer + 1
|
|
||||||
if pointer >= limit then
|
|
||||||
actions[pointer - limit] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
actions[pointer] = {os.time(), actionName, changes, destroyedObjects, newObjects}
|
pointer = pointer + 1
|
||||||
changes = {}
|
if pointer >= limit then
|
||||||
destroyedObjects = {}
|
actions[pointer - limit] = nil
|
||||||
newObjects = {}
|
|
||||||
|
|
||||||
if type(callback) == "function" then
|
|
||||||
callback()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
actions[pointer] = {os.time(), actionName, changes, destroyedObjects, newObjects}
|
||||||
|
changes = {}
|
||||||
|
destroyedObjects = {}
|
||||||
|
newObjects = {}
|
||||||
|
|
||||||
actionInProgress = false
|
actionInProgress = false
|
||||||
|
|
||||||
|
if type(callback) == "function" then
|
||||||
|
callback()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function undo()
|
local function undo()
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
local cameraController = {
|
local cameraController = {
|
||||||
zoomStep = 3,
|
zoomStep = 3,
|
||||||
rotateStep = 0.003,
|
rotateStep = 0.003,
|
||||||
moveStep = 0.5,
|
moveStep = 0.5
|
||||||
slow = 0.3
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cameraController.camera = workspace.camera
|
cameraController.camera = workspace.camera
|
||||||
@ -57,7 +56,7 @@ engine.input:keyPressed(function( inputObj )
|
|||||||
for key, vector in pairs(cameraController.cameraKeyArray) do
|
for key, vector in pairs(cameraController.cameraKeyArray) do
|
||||||
-- check this key is pressed (still)
|
-- check this key is pressed (still)
|
||||||
if engine.input:isKeyDown(key) then
|
if engine.input:isKeyDown(key) then
|
||||||
cameraPos = cameraPos + (cameraController.camera.rotation * vector * cameraController.moveStep) * (engine.input:isKeyDown(enums.key.leftShift) and cameraController.slow or 1)
|
cameraPos = cameraPos + (cameraController.camera.rotation * vector * cameraController.moveStep)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ local toolDesc = ""
|
|||||||
local toolIcon = "fa:s-hand-pointer"
|
local toolIcon = "fa:s-hand-pointer"
|
||||||
|
|
||||||
local selection = require("tevgit:workshop/controllers/core/selection.lua")
|
local selection = require("tevgit:workshop/controllers/core/selection.lua")
|
||||||
local history = require("tevgit:workshop/controllers/core/history.lua")
|
|
||||||
|
|
||||||
local clickEvent = nil
|
local clickEvent = nil
|
||||||
|
|
||||||
@ -43,9 +42,6 @@ return {
|
|||||||
for _,v in pairs(selection.selection) do
|
for _,v in pairs(selection.selection) do
|
||||||
offsets[v] = v.position - centre
|
offsets[v] = v.position - centre
|
||||||
end
|
end
|
||||||
|
|
||||||
-- tell history to monitor changes we make to selected items
|
|
||||||
history.beginAction(selection.selection, "Hand tool drag")
|
|
||||||
|
|
||||||
while engine.input:isMouseButtonDown(enums.mouseButton.left) do
|
while engine.input:isMouseButtonDown(enums.mouseButton.left) do
|
||||||
-- fire a ray, exclude selected items.
|
-- fire a ray, exclude selected items.
|
||||||
@ -60,9 +56,8 @@ return {
|
|||||||
end
|
end
|
||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
|
|
||||||
history.endAction()
|
|
||||||
|
|
||||||
|
print("Centre:", centre, "MouseOffset:", mouseOffset)
|
||||||
else
|
else
|
||||||
-- user clicked an unselected object, let's select it
|
-- user clicked an unselected object, let's select it
|
||||||
if engine.input:isKeyDown(enums.key.leftShift) then
|
if engine.input:isKeyDown(enums.key.leftShift) then
|
||||||
|
@ -45,8 +45,8 @@ for toolName, options in pairs(tools) do
|
|||||||
|
|
||||||
local newTabBtn = ui.create("guiTextBox", toolBar, {
|
local newTabBtn = ui.create("guiTextBox", toolBar, {
|
||||||
text = toolName,
|
text = toolName,
|
||||||
position = guiCoord(0, 4, 0, currentY),
|
position = guiCoord(0, 5, 0, currentY),
|
||||||
size = guiCoord(0, 24, 0, 24),
|
size = guiCoord(0, 22, 0, 22),
|
||||||
hoverCursor = "fa:s-hand-pointer"
|
hoverCursor = "fa:s-hand-pointer"
|
||||||
}, "primaryText")
|
}, "primaryText")
|
||||||
|
|
||||||
|
@ -16,16 +16,12 @@ local tabs = {
|
|||||||
{"Properties", "fa:s-clipboard-list", function ()
|
{"Properties", "fa:s-clipboard-list", function ()
|
||||||
shared.windows.propertyEditor.visible = not shared.windows.propertyEditor.visible
|
shared.windows.propertyEditor.visible = not shared.windows.propertyEditor.visible
|
||||||
end},
|
end},
|
||||||
{"Hierarchy", "fa:s-align-left", function ()
|
|
||||||
shared.windows.hierarchy.visible = not shared.windows.hierarchy.visible
|
|
||||||
end},
|
|
||||||
{"History", "fa:s-history", function ()
|
|
||||||
shared.windows.history.visible = not shared.windows.history.visible
|
|
||||||
end},
|
|
||||||
{"Seperator"},
|
|
||||||
{"Settings", "fa:s-cog", function ()
|
{"Settings", "fa:s-cog", function ()
|
||||||
shared.windows.settings.visible = not shared.windows.settings.visible
|
shared.windows.settings.visible = not shared.windows.settings.visible
|
||||||
end},
|
end},
|
||||||
|
{"History", "fa:s-history", function ()
|
||||||
|
shared.windows.history.visible = not shared.windows.history.visible
|
||||||
|
end}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@ local themer = require("tevgit:workshop/controllers/ui/core/themer.lua")
|
|||||||
local controller = {}
|
local controller = {}
|
||||||
|
|
||||||
function roundToMultiple(number, multiple)
|
function roundToMultiple(number, multiple)
|
||||||
if multiple == 0 then
|
if multiple == 0 then
|
||||||
return number
|
return number
|
||||||
end
|
end
|
||||||
|
|
||||||
return ((number % multiple) > multiple/2) and number + multiple - number%multiple or number - number%multiple
|
return ((number % multiple) > multiple/2) and number + multiple - number%multiple or number - number%multiple
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -39,35 +39,31 @@ controller.setupDocks = function ()
|
|||||||
controller.docks = {
|
controller.docks = {
|
||||||
engine.construct("guiFrame", shared.workshop.interface, {
|
engine.construct("guiFrame", shared.workshop.interface, {
|
||||||
name = "_dockTop",
|
name = "_dockTop",
|
||||||
size = guiCoord(1, -500, 0, 250 - 76),
|
size = guiCoord(1, -500, 0, 250 - 72),
|
||||||
position = guiCoord(250, 0, 0, 76),
|
position = guiCoord(250, 0, 0, 72),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
handleEvents = false,
|
handleEvents = false
|
||||||
cropChildren = false,
|
|
||||||
}),
|
}),
|
||||||
engine.construct("guiFrame", shared.workshop.interface, {
|
engine.construct("guiFrame", shared.workshop.interface, {
|
||||||
name = "_dockLeft",
|
name = "_dockLeft",
|
||||||
size = guiCoord(0, 250, 1, -76),
|
size = guiCoord(0, 250, 1, -72),
|
||||||
position = guiCoord(0, 0, 0, 76),
|
position = guiCoord(0, 0, 0, 72),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
handleEvents = false,
|
handleEvents = false
|
||||||
cropChildren = false,
|
|
||||||
}),
|
}),
|
||||||
engine.construct("guiFrame", shared.workshop.interface, {
|
engine.construct("guiFrame", shared.workshop.interface, {
|
||||||
name = "_dockBottom",
|
name = "_dockBottom",
|
||||||
size = guiCoord(1, -500, 0, 250),
|
size = guiCoord(1, -500, 0, 250),
|
||||||
position = guiCoord(0, 250, 1, -250),
|
position = guiCoord(0, 250, 1, -250),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
handleEvents = false,
|
handleEvents = false
|
||||||
cropChildren = false,
|
|
||||||
}),
|
}),
|
||||||
engine.construct("guiFrame", shared.workshop.interface, {
|
engine.construct("guiFrame", shared.workshop.interface, {
|
||||||
name = "_dockRight",
|
name = "_dockRight",
|
||||||
size = guiCoord(0, 250, 1, -76),
|
size = guiCoord(0, 250, 1, -72),
|
||||||
position = guiCoord(1, -250, 0, 76),
|
position = guiCoord(1, -250, 0, 72),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
handleEvents = false,
|
handleEvents = false
|
||||||
cropChildren = false,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -246,11 +242,11 @@ controller.beginWindowDrag = function(window, dontDock)
|
|||||||
if not dontDock then
|
if not dontDock then
|
||||||
for _,dock in pairs(controller.docks) do
|
for _,dock in pairs(controller.docks) do
|
||||||
-- the user's cursor is in this dock.
|
-- the user's cursor is in this dock.
|
||||||
if mPos.x > dock.absolutePosition.x and
|
if mPos.x > dock.absolutePosition.x and
|
||||||
mPos.x < dock.absolutePosition.x + dock.absoluteSize.x and
|
mPos.x < dock.absolutePosition.x + dock.absoluteSize.x and
|
||||||
mPos.y > dock.absolutePosition.y and
|
mPos.y > dock.absolutePosition.y and
|
||||||
mPos.y < dock.absolutePosition.y + dock.absoluteSize.y then
|
mPos.y < dock.absolutePosition.y + dock.absoluteSize.y then
|
||||||
|
|
||||||
local perWindow = 1 / (#dock.children + 1)
|
local perWindow = 1 / (#dock.children + 1)
|
||||||
local perWindowSize = perWindow * dock.absoluteSize
|
local perWindowSize = perWindow * dock.absoluteSize
|
||||||
local isVertical = dock.absoluteSize.y > dock.absoluteSize.x
|
local isVertical = dock.absoluteSize.y > dock.absoluteSize.x
|
||||||
|
@ -7,8 +7,8 @@ local dock = require("tevgit:workshop/controllers/ui/core/dock.lua")
|
|||||||
local shared = require("tevgit:workshop/controllers/shared.lua")
|
local shared = require("tevgit:workshop/controllers/shared.lua")
|
||||||
|
|
||||||
local create = function(className, parent, properties, style)
|
local create = function(className, parent, properties, style)
|
||||||
if not parent then
|
if not parent then
|
||||||
parent = shared.workshop.interface
|
parent = shared.workshop.interface
|
||||||
end
|
end
|
||||||
|
|
||||||
local gui = engine.construct(className, parent, properties)
|
local gui = engine.construct(className, parent, properties)
|
||||||
@ -43,7 +43,7 @@ return {
|
|||||||
tooltip:destroy()
|
tooltip:destroy()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
wait(delay)
|
wait(delay)
|
||||||
if tooltip and tooltip.alive then
|
if tooltip and tooltip.alive then
|
||||||
tooltip.visible = true
|
tooltip.visible = true
|
||||||
end
|
end
|
||||||
@ -73,7 +73,7 @@ return {
|
|||||||
|
|
||||||
return btn
|
return btn
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- if closable is true OR a function, a close button will appear in the title bar.
|
-- if closable is true OR a function, a close button will appear in the title bar.
|
||||||
-- when clicked, if closable is a function, it is fired after hiding the window.
|
-- when clicked, if closable is a function, it is fired after hiding the window.
|
||||||
window = function(parent, title, size, position, dockable, closable)
|
window = function(parent, title, size, position, dockable, closable)
|
||||||
@ -81,10 +81,7 @@ return {
|
|||||||
size = size,
|
size = size,
|
||||||
name = title,
|
name = title,
|
||||||
position = position,
|
position = position,
|
||||||
cropChildren = false,
|
cropChildren = false
|
||||||
borderColour = colour:fromRGB(55, 59, 64),
|
|
||||||
borderWidth = 2,
|
|
||||||
borderAlpha = 1,
|
|
||||||
}, themer.types.background)
|
}, themer.types.background)
|
||||||
|
|
||||||
container:on("changed", function (property, value)
|
container:on("changed", function (property, value)
|
||||||
@ -92,7 +89,7 @@ return {
|
|||||||
dock.undock(container) -- just in case
|
dock.undock(container) -- just in case
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local titleBar = create("guiFrame", container, {
|
local titleBar = create("guiFrame", container, {
|
||||||
name = "titleBar",
|
name = "titleBar",
|
||||||
position = guiCoord(0, 0, 0, -4),
|
position = guiCoord(0, 0, 0, -4),
|
||||||
@ -104,7 +101,7 @@ return {
|
|||||||
titleBar:mouseLeftPressed(function ()
|
titleBar:mouseLeftPressed(function ()
|
||||||
dock.beginWindowDrag(container, not dockable)
|
dock.beginWindowDrag(container, not dockable)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- create this to hide radius on bottom of titlebar
|
-- create this to hide radius on bottom of titlebar
|
||||||
create("guiFrame", titleBar, {
|
create("guiFrame", titleBar, {
|
||||||
size = guiCoord(1, 0, 0, 3),
|
size = guiCoord(1, 0, 0, 3),
|
||||||
@ -135,15 +132,15 @@ return {
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
local content = engine.construct("guiFrame", container, {
|
local content = engine.construct("guiFrame", container, {
|
||||||
name = "content",
|
name = "content",
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
size = guiCoord(1, -12, 1, -27),
|
size = guiCoord(1, -12, 1, -27),
|
||||||
position = guiCoord(0, 3, 0, 24),
|
position = guiCoord(0, 3, 0, 24),
|
||||||
cropChildren = false,
|
cropChildren = false
|
||||||
})
|
})
|
||||||
|
|
||||||
return container
|
return container
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -197,7 +194,7 @@ return {
|
|||||||
local textDimensions = text.textDimensions
|
local textDimensions = text.textDimensions
|
||||||
container.size = guiCoord(0, textDimensions.x + 20, 0, textDimensions.y + 20)
|
container.size = guiCoord(0, textDimensions.x + 20, 0, textDimensions.y + 20)
|
||||||
container.position = guiCoord(0.5, -(textDimensions.x + 20)/2, 0.5, -(textDimensions.y + 20)/2)
|
container.position = guiCoord(0.5, -(textDimensions.x + 20)/2, 0.5, -(textDimensions.y + 20)/2)
|
||||||
|
|
||||||
local continue = create("guiTextBox", content, {
|
local continue = create("guiTextBox", content, {
|
||||||
size = guiCoord(0, textDimensions.x + 20, 0, 40),
|
size = guiCoord(0, textDimensions.x + 20, 0, 40),
|
||||||
position = guiCoord(0.5, -(textDimensions.x + 20)/2, 0.5, (textDimensions.y/2 + 5)),
|
position = guiCoord(0.5, -(textDimensions.x + 20)/2, 0.5, (textDimensions.y/2 + 5)),
|
||||||
@ -215,7 +212,7 @@ return {
|
|||||||
content:destroy()
|
content:destroy()
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
continue:once("mouseLeftPressed", function()
|
continue:once("mouseLeftPressed", function()
|
||||||
if type(callback) == "function" then
|
if type(callback) == "function" then
|
||||||
callback()
|
callback()
|
||||||
end
|
end
|
||||||
@ -223,4 +220,4 @@ return {
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
@ -46,7 +46,7 @@ return function( workshop )
|
|||||||
})
|
})
|
||||||
|
|
||||||
emergencyReload:mouseLeftPressed(function()
|
emergencyReload:mouseLeftPressed(function()
|
||||||
shared.workshop:reloadCreate()
|
shared.workshop:reloadCreate()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ return function( workshop )
|
|||||||
|
|
||||||
-- Okay now we can load remote files whilst the user is looking at a loading screen.
|
-- Okay now we can load remote files whilst the user is looking at a loading screen.
|
||||||
shared.controllers.env = require("tevgit:workshop/controllers/environment/main.lua")
|
shared.controllers.env = require("tevgit:workshop/controllers/environment/main.lua")
|
||||||
|
|
||||||
shared.controllers.history = require("tevgit:workshop/controllers/core/history.lua")
|
shared.controllers.history = require("tevgit:workshop/controllers/core/history.lua")
|
||||||
|
|
||||||
-- Create the Teverse interface
|
-- Create the Teverse interface
|
||||||
@ -84,5 +84,5 @@ return function( workshop )
|
|||||||
loadingScreen = nil
|
loadingScreen = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--print("Workshop Loaded. ", #engine.workspace.children) Lets not spam the console
|
print("Workshop Loaded. ", #engine.workspace.children)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user