Removed script from editor
This commit is contained in:
@@ -144,6 +144,7 @@ static std::vector<Object *> ui_handlers;
|
||||
BuildingsEditor::BuildingsEditor(WorldEditor *editor)
|
||||
: editor(editor)
|
||||
, selected_building(-1)
|
||||
, active(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -156,6 +157,9 @@ void BuildingsEditor::exit()
|
||||
void BuildingsEditor::activate()
|
||||
{
|
||||
assert(!active);
|
||||
ConfigFile config;
|
||||
Error result = config.load("res://config/stream.conf");
|
||||
ERR_FAIL_COND_MSG(result != OK, "Failed to load config");
|
||||
print_line("BuildingsEditor ACTIVE");
|
||||
Array args;
|
||||
ui_handlers.push_back(memnew(HandleButton(
|
||||
@@ -165,9 +169,24 @@ void BuildingsEditor::activate()
|
||||
int i;
|
||||
for (i = 0; i < (int)ui_handlers.size(); i++)
|
||||
assert(ui_handlers[i]);
|
||||
active = true;
|
||||
/* TODO: make separate function for this */
|
||||
EditorEvent::get_singleton()->event.add_listener(
|
||||
this, &BuildingsEditor::event_handler);
|
||||
Dictionary buildings_data =
|
||||
config.get_value("buildings", "building_data");
|
||||
OptionButton *building_type =
|
||||
get_as_node<OptionButton>("%building_type");
|
||||
building_type->clear();
|
||||
List<Variant> keys;
|
||||
buildings_data.get_key_list(&keys);
|
||||
List<Variant>::Element *e = keys.front();
|
||||
while (e) {
|
||||
const String &key = e->get();
|
||||
print_line("EE::" + key);
|
||||
building_type->add_item(key);
|
||||
e = e->next();
|
||||
}
|
||||
active = true;
|
||||
}
|
||||
|
||||
void BuildingsEditor::deactivate()
|
||||
@@ -200,6 +219,8 @@ void BuildingsEditor::event_handler(const String &event, const Array &args)
|
||||
get_as_node<Spatial>("%building_rot_cursor")
|
||||
->set_global_transform(selected_building_xform);
|
||||
}
|
||||
} else if (event == "result:get_building_types") {
|
||||
/* TODO: replace with direct data access */
|
||||
}
|
||||
print_line("buildings::" + event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user