Compare commits

...

2 Commits

Author SHA1 Message Date
Sanjay 9fdca05465 Delete rogue .DS_Store files (#57)
* Delete .DS_Store

* Delete .DS_Store

* Delete .DS_Store

* Ignore notes.txt
2020-01-15 21:03:44 +00:00
teverse e99f16a6ae fixed lighting drag bug, hidden _createmode_ objs from hierarchy, added light inserter 2020-01-15 21:03:03 +00:00
7 changed files with 45 additions and 11 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
.DS_Store
.DS_Store
notes.txt

BIN
workshop/.DS_Store vendored

Binary file not shown.

Binary file not shown.

View File

@ -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.

View File

@ -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())

View File

@ -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
}
}