Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Commit

Permalink
Update to latest Godot
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylann committed Aug 27, 2017
1 parent d17635f commit 61d3855
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions height_map_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,15 @@ Error HeightMapDataSaver::save(const String &p_path, const Ref<Resource> &p_reso
}

bool HeightMapDataSaver::recognize(const Ref<Resource> &p_resource) const {
return p_resource->cast_to<HeightMapData>() != NULL;
if(p_resource.is_null())
return false;
return Object::cast_to<HeightMapData>(*p_resource) != NULL;
}

void HeightMapDataSaver::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const {
if (p_resource->cast_to<HeightMapData>()) {
if(p_resource.is_null())
return;
if (Object::cast_to<HeightMapData>(*p_resource)) {
p_extensions->push_back(HEIGHTMAP_EXTENSION);
}
}
Expand Down
12 changes: 8 additions & 4 deletions height_map_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,19 @@ HeightMapEditorPlugin::HeightMapEditorPlugin(EditorNode *p_editor) {
_toolbar->add_child(button);
}

EditorInterface *editor_interface = get_editor_interface();
Control *base_control = editor_interface->get_base_control();

_import_confirmation_dialog = memnew(ConfirmationDialog);
get_base_control()->add_child(_import_confirmation_dialog);
base_control->add_child(_import_confirmation_dialog);
_import_confirmation_dialog->get_ok()->set_text(TTR("Import anyways"));
_import_confirmation_dialog->connect("confirmed", this, "_import_raw_file");

_accept_dialog = memnew(AcceptDialog);
get_base_control()->add_child(_accept_dialog);
base_control->add_child(_accept_dialog);

get_resource_previewer()->add_preview_generator(Ref<EditorResourcePreviewGenerator>(memnew(HeightMapPreviewGenerator())));
EditorResourcePreview *previewer = editor_interface->get_resource_previewer();
previewer->add_preview_generator(Ref<EditorResourcePreviewGenerator>(memnew(HeightMapPreviewGenerator())));
}

HeightMapEditorPlugin::~HeightMapEditorPlugin() {
Expand Down Expand Up @@ -184,7 +188,7 @@ void HeightMapEditorPlugin::paint(Camera &camera, Vector2 screen_pos, int overri
void HeightMapEditorPlugin::edit(Object *p_object) {

//printf("Edit %i\n", p_object);
HeightMap *node = p_object ? p_object->cast_to<HeightMap>() : NULL;
HeightMap *node = p_object ? Object::cast_to<HeightMap>(p_object) : NULL;

if(_height_map) {
_height_map->disconnect(SceneStringNames::get_singleton()->tree_exited, this, "_height_map_exited_scene");
Expand Down

0 comments on commit 61d3855

Please sign in to comment.