mirror of
https://github.com/teverse/teverse
synced 2025-08-25 23:54:46 +02:00
Compare commits
No commits in common. "9fdca05465d6130f08b744a370575ad5e2045c77" and "89bf079b703254ed573dcad1ed53ce08f2a520ab" have entirely different histories.
9fdca05465
...
89bf079b70
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
notes.txt
|
|
BIN
workshop/.DS_Store
vendored
Normal file
BIN
workshop/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
workshop/controllers/.DS_Store
vendored
Normal file
BIN
workshop/controllers/.DS_Store
vendored
Normal file
Binary file not shown.
@ -128,23 +128,12 @@ 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
|
||||||
-- We dont want to raytest with create mode objects1
|
local newCentre = hits[1].hitPosition - mouseOffset
|
||||||
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 = hit.hitPosition.y
|
local minY = hits[1].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])
|
||||||
@ -157,8 +146,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 < hit.hitPosition.y then
|
if minY < hits[1].hitPosition.y then
|
||||||
local offsetBy = vector3(0, hit.hitPosition.y - minY, 0)
|
local offsetBy = vector3(0, hits[1].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
Normal file
BIN
workshop/controllers/ui/.DS_Store
vendored
Normal file
Binary file not shown.
@ -132,9 +132,7 @@ 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
|
||||||
if child.name ~= "_CreateMode_" then
|
createHierarchyButton(child, btn)
|
||||||
createHierarchyButton(child, btn)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
controller.scrollView.canvasSize =
|
controller.scrollView.canvasSize =
|
||||||
guiCoord(1, 0, 0, updatePositions())
|
guiCoord(1, 0, 0, updatePositions())
|
||||||
|
@ -29,24 +29,11 @@ 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
|
||||||
|
|
||||||
history.beginAction(workspace, "Inserter")
|
return engine.construct("block", workspace, {
|
||||||
local block;
|
mesh = mesh,
|
||||||
|
colour = colour(0.8, 0.8, 0.8),
|
||||||
if mesh ~= "light" then
|
position = insertPos
|
||||||
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 = {
|
||||||
@ -63,13 +50,6 @@ 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