mirror of
https://github.com/teverse/teverse
synced 2025-08-26 08:04:46 +02:00
Compare commits
7 Commits
713233288a
...
c66a2e37d6
Author | SHA1 | Date | |
---|---|---|---|
c66a2e37d6 | |||
![]() |
9889a3f19f | ||
![]() |
d398e1f7ff | ||
![]() |
f4b85012ae | ||
![]() |
415a69992e | ||
c1f074d0b3 | |||
![]() |
e4e30ca154 |
@ -117,6 +117,8 @@ local function endAction()
|
|||||||
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
|
pointer = pointer + 1
|
||||||
if pointer >= limit then
|
if pointer >= limit then
|
||||||
actions[pointer - limit] = nil
|
actions[pointer - limit] = nil
|
||||||
@ -127,13 +129,14 @@ local function endAction()
|
|||||||
destroyedObjects = {}
|
destroyedObjects = {}
|
||||||
newObjects = {}
|
newObjects = {}
|
||||||
|
|
||||||
actionInProgress = false
|
|
||||||
|
|
||||||
if type(callback) == "function" then
|
if type(callback) == "function" then
|
||||||
callback()
|
callback()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
actionInProgress = false
|
||||||
|
end
|
||||||
|
|
||||||
local function undo()
|
local function undo()
|
||||||
if actions[pointer] ~= nil then
|
if actions[pointer] ~= nil then
|
||||||
for object, properties in pairs(actions[pointer][3]) do
|
for object, properties in pairs(actions[pointer][3]) do
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
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
|
||||||
@ -56,7 +57,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)
|
cameraPos = cameraPos + (cameraController.camera.rotation * vector * cameraController.moveStep) * (engine.input:isKeyDown(enums.key.leftShift) and cameraController.slow or 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ 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,6 +44,9 @@ return {
|
|||||||
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.
|
||||||
local hits, didExclude = engine.physics:rayTestScreenAllHits(engine.input.mousePosition, selection.selection)
|
local hits, didExclude = engine.physics:rayTestScreenAllHits(engine.input.mousePosition, selection.selection)
|
||||||
@ -57,7 +61,8 @@ return {
|
|||||||
wait()
|
wait()
|
||||||
end
|
end
|
||||||
|
|
||||||
print("Centre:", centre, "MouseOffset:", mouseOffset)
|
history.endAction()
|
||||||
|
|
||||||
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, 5, 0, currentY),
|
position = guiCoord(0, 4, 0, currentY),
|
||||||
size = guiCoord(0, 22, 0, 22),
|
size = guiCoord(0, 24, 0, 24),
|
||||||
hoverCursor = "fa:s-hand-pointer"
|
hoverCursor = "fa:s-hand-pointer"
|
||||||
}, "primaryText")
|
}, "primaryText")
|
||||||
|
|
||||||
|
@ -16,12 +16,16 @@ 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},
|
||||||
{"Settings", "fa:s-cog", function ()
|
{"Hierarchy", "fa:s-align-left", function ()
|
||||||
shared.windows.settings.visible = not shared.windows.settings.visible
|
shared.windows.hierarchy.visible = not shared.windows.hierarchy.visible
|
||||||
end},
|
end},
|
||||||
{"History", "fa:s-history", function ()
|
{"History", "fa:s-history", function ()
|
||||||
shared.windows.history.visible = not shared.windows.history.visible
|
shared.windows.history.visible = not shared.windows.history.visible
|
||||||
end}
|
end},
|
||||||
|
{"Seperator"},
|
||||||
|
{"Settings", "fa:s-cog", function ()
|
||||||
|
shared.windows.settings.visible = not shared.windows.settings.visible
|
||||||
|
end},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,31 +39,35 @@ 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 - 72),
|
size = guiCoord(1, -500, 0, 250 - 76),
|
||||||
position = guiCoord(250, 0, 0, 72),
|
position = guiCoord(250, 0, 0, 76),
|
||||||
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, -72),
|
size = guiCoord(0, 250, 1, -76),
|
||||||
position = guiCoord(0, 0, 0, 72),
|
position = guiCoord(0, 0, 0, 76),
|
||||||
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, -72),
|
size = guiCoord(0, 250, 1, -76),
|
||||||
position = guiCoord(1, -250, 0, 72),
|
position = guiCoord(1, -250, 0, 76),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
handleEvents = false
|
handleEvents = false,
|
||||||
|
cropChildren = false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -81,7 +81,10 @@ 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)
|
||||||
@ -138,7 +141,7 @@ return {
|
|||||||
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
|
||||||
|
@ -84,5 +84,5 @@ return function( workshop )
|
|||||||
loadingScreen = nil
|
loadingScreen = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
print("Workshop Loaded. ", #engine.workspace.children)
|
--print("Workshop Loaded. ", #engine.workspace.children) Lets not spam the console
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user