node cloner

This commit is contained in:
milek7
2019-02-23 01:03:18 +01:00
parent 939aa73384
commit 5fe4e1213e
12 changed files with 205 additions and 18 deletions

View File

@@ -23,7 +23,16 @@ namespace scene {
void
basic_editor::translate( scene::basic_node *Node, glm::dvec3 const &Location, bool const Snaptoground ) {
auto const initiallocation { Node->location() };
auto &initiallocation { Node->location() };
// fixup NaNs
if (std::isnan(initiallocation.x))
initiallocation.x = Location.x;
if (std::isnan(initiallocation.y))
initiallocation.y = Location.y;
if (std::isnan(initiallocation.z))
initiallocation.z = Location.z;
auto targetlocation { Location };
if( false == Snaptoground ) {
targetlocation.y = initiallocation.y;