Worked on buildings in lines
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#undef NDEBUG
|
||||
#include <cassert>
|
||||
#include <core/variant.h>
|
||||
#include <core/os/time.h>
|
||||
#include <scene/gui/option_button.h>
|
||||
#include <scene/main/viewport.h>
|
||||
#include <scene/3d/camera.h>
|
||||
@@ -9,6 +10,7 @@
|
||||
#include "from_string.h"
|
||||
#include "editor_event.h"
|
||||
#include "world_editor.h"
|
||||
#include "buildings_data.h"
|
||||
#include "buildings_editor.h"
|
||||
|
||||
class HandleChangeBuildingType : public Object {
|
||||
@@ -240,10 +242,15 @@ void BuildingsEditor::handle_create_building()
|
||||
->get_global_transform();
|
||||
Dictionary building_data;
|
||||
/* FIXME: calculate AABBs as in previous editor */
|
||||
String building_xform = to_string<Transform>(xform);
|
||||
building_data["id"] = item;
|
||||
String building_key = to_string<Transform>(xform);
|
||||
building_data["key"] = String::num_uint64(
|
||||
String(item + building_xform +
|
||||
itos(Time::get_singleton()->get_ticks_usec()))
|
||||
.hash64(),
|
||||
16);
|
||||
building_data["xform"] = building_xform;
|
||||
args.push_back(building_data);
|
||||
args.push_back(building_key);
|
||||
editor->editor_command("create_building", args);
|
||||
}
|
||||
}
|
||||
@@ -425,6 +432,7 @@ void BuildingsEditor::mouse_press(const Vector2 &position)
|
||||
float h = gen->get_height_full(newpos);
|
||||
newpos.y = h;
|
||||
Transform xform(Basis(), newpos);
|
||||
get_as_node<Spatial>("%building_cursor")->show();
|
||||
get_as_node<Spatial>("%building_cursor")
|
||||
->set_global_transform(xform);
|
||||
} break;
|
||||
|
||||
Reference in New Issue
Block a user