mirror of
https://github.com/teverse/teverse
synced 2025-08-25 07:34:46 +02:00
Compare commits
2 Commits
89bf079b70
...
9fdca05465
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9fdca05465 | ||
![]() |
e99f16a6ae |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
notes.txt
|
BIN
workshop/.DS_Store
vendored
BIN
workshop/.DS_Store
vendored
Binary file not shown.
BIN
workshop/controllers/.DS_Store
vendored
BIN
workshop/controllers/.DS_Store
vendored
Binary file not shown.
@ -128,12 +128,23 @@ return {
|
|||||||
-- 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)
|
||||||
if (#hits > 0) then
|
if (#hits > 0) then
|
||||||
local newCentre = hits[1].hitPosition - mouseOffset
|
-- We dont want to raytest with create mode objects1
|
||||||
|
local hit = hits[1]
|
||||||
|
for _,v in pairs(hits) do
|
||||||
|
if v.object.name ~= "_CreateMode_" then
|
||||||
|
hit = v
|
||||||
|
goto skip
|
||||||
|
end
|
||||||
|
end
|
||||||
|
::skip::
|
||||||
|
|
||||||
|
local newCentre = hit.hitPosition - mouseOffset
|
||||||
if gridStep ~= 0 then
|
if gridStep ~= 0 then
|
||||||
newCentre = shared.roundVector3(newCentre, gridStep)
|
newCentre = shared.roundVector3(newCentre, gridStep)
|
||||||
end
|
end
|
||||||
|
|
||||||
local avgPos = vector3(0,0,0)
|
local avgPos = vector3(0,0,0)
|
||||||
local minY = hits[1].hitPosition.y
|
local minY = hit.hitPosition.y
|
||||||
for _,v in pairs(selection.selection) do
|
for _,v in pairs(selection.selection) do
|
||||||
if offsets[v] then
|
if offsets[v] then
|
||||||
v.position = newCentre + (offsets[v][2] * offsets[v][1])
|
v.position = newCentre + (offsets[v][2] * offsets[v][1])
|
||||||
@ -146,8 +157,8 @@ return {
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- If the lowest object is less than the mouse's position
|
-- If the lowest object is less than the mouse's position
|
||||||
if minY < hits[1].hitPosition.y then
|
if minY < hit.hitPosition.y then
|
||||||
local offsetBy = vector3(0, hits[1].hitPosition.y - minY, 0)
|
local offsetBy = vector3(0, hit.hitPosition.y - minY, 0)
|
||||||
|
|
||||||
-- increase height of each selected object so they're above the hovered position.
|
-- increase height of each selected object so they're above the hovered position.
|
||||||
for _,v in pairs(selection.selection) do
|
for _,v in pairs(selection.selection) do
|
||||||
|
BIN
workshop/controllers/ui/.DS_Store
vendored
BIN
workshop/controllers/ui/.DS_Store
vendored
Binary file not shown.
@ -132,7 +132,9 @@ local function createHierarchyButton(object, guiParent)
|
|||||||
expanded = not expanded
|
expanded = not expanded
|
||||||
if expanded then
|
if expanded then
|
||||||
for _, child in pairs(object.children) do
|
for _, child in pairs(object.children) do
|
||||||
createHierarchyButton(child, btn)
|
if child.name ~= "_CreateMode_" then
|
||||||
|
createHierarchyButton(child, btn)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
controller.scrollView.canvasSize =
|
controller.scrollView.canvasSize =
|
||||||
guiCoord(1, 0, 0, updatePositions())
|
guiCoord(1, 0, 0, updatePositions())
|
||||||
|
@ -29,11 +29,24 @@ local function insert(mesh)
|
|||||||
insertPos = shared.controllers.env.camera.camera.position + (shared.controllers.env.camera.camera.rotation * vector3(0, 0, 10))
|
insertPos = shared.controllers.env.camera.camera.position + (shared.controllers.env.camera.camera.rotation * vector3(0, 0, 10))
|
||||||
end
|
end
|
||||||
|
|
||||||
return engine.construct("block", workspace, {
|
history.beginAction(workspace, "Inserter")
|
||||||
mesh = mesh,
|
local block;
|
||||||
colour = colour(0.8, 0.8, 0.8),
|
|
||||||
position = insertPos
|
if mesh ~= "light" then
|
||||||
})
|
block = engine.construct("block", workspace, {
|
||||||
|
mesh = mesh,
|
||||||
|
colour = colour(0.8, 0.8, 0.8),
|
||||||
|
position = insertPos
|
||||||
|
})
|
||||||
|
else
|
||||||
|
block = engine.construct("light", workspace, {
|
||||||
|
position = insertPos
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
history.endAction()
|
||||||
|
|
||||||
|
return block
|
||||||
end
|
end
|
||||||
|
|
||||||
local adders = {
|
local adders = {
|
||||||
@ -50,6 +63,13 @@ local adders = {
|
|||||||
callback = function()
|
callback = function()
|
||||||
insert("primitive:sphere")
|
insert("primitive:sphere")
|
||||||
end
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "Light",
|
||||||
|
icon = "fa:s-lightbulb",
|
||||||
|
callback = function()
|
||||||
|
insert("light")
|
||||||
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user