mirror of https://github.com/teverse/teverse
Compare commits
2 Commits
89bf079b70
...
9fdca05465
Author | SHA1 | Date |
---|---|---|
Sanjay | 9fdca05465 | |
teverse | e99f16a6ae |
|
@ -1 +1,2 @@
|
|||
.DS_Store
|
||||
.DS_Store
|
||||
notes.txt
|
Binary file not shown.
Binary file not shown.
|
@ -128,12 +128,23 @@ return {
|
|||
-- fire a ray, exclude selected items.
|
||||
local hits, didExclude = engine.physics:rayTestScreenAllHits(engine.input.mousePosition, selection.selection)
|
||||
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
|
||||
newCentre = shared.roundVector3(newCentre, gridStep)
|
||||
end
|
||||
|
||||
local avgPos = vector3(0,0,0)
|
||||
local minY = hits[1].hitPosition.y
|
||||
local minY = hit.hitPosition.y
|
||||
for _,v in pairs(selection.selection) do
|
||||
if offsets[v] then
|
||||
v.position = newCentre + (offsets[v][2] * offsets[v][1])
|
||||
|
@ -146,8 +157,8 @@ return {
|
|||
end
|
||||
|
||||
-- If the lowest object is less than the mouse's position
|
||||
if minY < hits[1].hitPosition.y then
|
||||
local offsetBy = vector3(0, hits[1].hitPosition.y - minY, 0)
|
||||
if minY < hit.hitPosition.y then
|
||||
local offsetBy = vector3(0, hit.hitPosition.y - minY, 0)
|
||||
|
||||
-- increase height of each selected object so they're above the hovered position.
|
||||
for _,v in pairs(selection.selection) do
|
||||
|
|
Binary file not shown.
|
@ -132,7 +132,9 @@ local function createHierarchyButton(object, guiParent)
|
|||
expanded = not expanded
|
||||
if expanded then
|
||||
for _, child in pairs(object.children) do
|
||||
createHierarchyButton(child, btn)
|
||||
if child.name ~= "_CreateMode_" then
|
||||
createHierarchyButton(child, btn)
|
||||
end
|
||||
end
|
||||
controller.scrollView.canvasSize =
|
||||
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))
|
||||
end
|
||||
|
||||
return engine.construct("block", workspace, {
|
||||
mesh = mesh,
|
||||
colour = colour(0.8, 0.8, 0.8),
|
||||
position = insertPos
|
||||
})
|
||||
history.beginAction(workspace, "Inserter")
|
||||
local block;
|
||||
|
||||
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
|
||||
|
||||
local adders = {
|
||||
|
@ -50,6 +63,13 @@ local adders = {
|
|||
callback = function()
|
||||
insert("primitive:sphere")
|
||||
end
|
||||
},
|
||||
{
|
||||
name = "Light",
|
||||
icon = "fa:s-lightbulb",
|
||||
callback = function()
|
||||
insert("light")
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue