Renamed 2D and 3D nodes to make their types explicit

Fixes #30736.
This commit is contained in:
Juan Linietsky 2020-03-26 18:49:16 -03:00
parent 9a7dbc2aca
commit eaae4b6408
260 changed files with 5328 additions and 5474 deletions

View file

@ -3554,7 +3554,7 @@ void AnimationTrackEditor::_insert_delay() {
insert_queue = false;
}
void AnimationTrackEditor::insert_transform_key(Spatial *p_node, const String &p_sub, const Transform &p_xform) {
void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Transform &p_xform) {
if (!keying)
return;
@ -4446,8 +4446,8 @@ void AnimationTrackEditor::_new_track_node_selected(NodePath p_path) {
ERR_FAIL_COND(!node);
NodePath path_to = root->get_path_to(node);
if (adding_track_type == Animation::TYPE_TRANSFORM && !node->is_class("Spatial")) {
EditorNode::get_singleton()->show_warning(TTR("Transform tracks only apply to Spatial-based nodes."));
if (adding_track_type == Animation::TYPE_TRANSFORM && !node->is_class("Node3D")) {
EditorNode::get_singleton()->show_warning(TTR("Transform tracks only apply to 3D-based nodes."));
return;
}
@ -4638,10 +4638,10 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
EditorNode::get_singleton()->show_warning(TTR("Track path is invalid, so can't add a key."));
return;
}
Spatial *base = Object::cast_to<Spatial>(root->get_node(animation->track_get_path(p_track)));
Node3D *base = Object::cast_to<Node3D>(root->get_node(animation->track_get_path(p_track)));
if (!base) {
EditorNode::get_singleton()->show_warning(TTR("Track is not of type Spatial, can't insert key"));
EditorNode::get_singleton()->show_warning(TTR("Track is not of type Node3D, can't insert key"));
return;
}

View file

@ -513,7 +513,7 @@ public:
void set_anim_pos(float p_pos);
void insert_node_value_key(Node *p_node, const String &p_property, const Variant &p_value, bool p_only_if_exists = false);
void insert_value_key(const String &p_property, const Variant &p_value, bool p_advance);
void insert_transform_key(Spatial *p_node, const String &p_sub, const Transform &p_xform);
void insert_transform_key(Node3D *p_node, const String &p_sub, const Transform &p_xform);
void show_select_node_warning(bool p_show);

View file

@ -33,8 +33,8 @@
#include "editor/audio_stream_preview.h"
#include "editor_resource_preview.h"
#include "editor_scale.h"
#include "scene/2d/animated_sprite.h"
#include "scene/2d/sprite.h"
#include "scene/2d/animated_sprite_2d.h"
#include "scene/2d/sprite_2d.h"
#include "scene/3d/sprite_3d.h"
#include "scene/animation/animation_player.h"
#include "servers/audio/audio_stream.h"
@ -357,7 +357,7 @@ Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_se
Size2 size;
if (Object::cast_to<Sprite>(object) || Object::cast_to<Sprite3D>(object)) {
if (Object::cast_to<Sprite2D>(object) || Object::cast_to<Sprite3D>(object)) {
Ref<Texture2D> texture = object->call("get_texture");
if (!texture.is_valid()) {
@ -379,7 +379,7 @@ Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_se
if (vframes > 1) {
size.y /= vframes;
}
} else if (Object::cast_to<AnimatedSprite>(object) || Object::cast_to<AnimatedSprite3D>(object)) {
} else if (Object::cast_to<AnimatedSprite2D>(object) || Object::cast_to<AnimatedSprite3D>(object)) {
Ref<SpriteFrames> sf = object->call("get_sprite_frames");
if (sf.is_null()) {
@ -436,7 +436,7 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in
Ref<Texture2D> texture;
Rect2 region;
if (Object::cast_to<Sprite>(object) || Object::cast_to<Sprite3D>(object)) {
if (Object::cast_to<Sprite2D>(object) || Object::cast_to<Sprite3D>(object)) {
texture = object->call("get_texture");
if (!texture.is_valid()) {
@ -473,7 +473,7 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in
region.position.x += region.size.x * coords.x;
region.position.y += region.size.y * coords.y;
} else if (Object::cast_to<AnimatedSprite>(object) || Object::cast_to<AnimatedSprite3D>(object)) {
} else if (Object::cast_to<AnimatedSprite2D>(object) || Object::cast_to<AnimatedSprite3D>(object)) {
Ref<SpriteFrames> sf = object->call("get_sprite_frames");
if (sf.is_null()) {
@ -1300,14 +1300,14 @@ AnimationTrackEdit *AnimationTrackEditDefaultPlugin::create_value_track_edit(Obj
return audio;
}
if (p_property == "frame" && (p_object->is_class("Sprite") || p_object->is_class("Sprite3D") || p_object->is_class("AnimatedSprite") || p_object->is_class("AnimatedSprite3D"))) {
if (p_property == "frame" && (p_object->is_class("Sprite2D") || p_object->is_class("Sprite3D") || p_object->is_class("AnimatedSprite2D") || p_object->is_class("AnimatedSprite3D"))) {
AnimationTrackEditSpriteFrame *sprite = memnew(AnimationTrackEditSpriteFrame);
sprite->set_node(p_object);
return sprite;
}
if (p_property == "frame_coords" && (p_object->is_class("Sprite") || p_object->is_class("Sprite3D"))) {
if (p_property == "frame_coords" && (p_object->is_class("Sprite2D") || p_object->is_class("Sprite3D"))) {
AnimationTrackEditSpriteFrame *sprite = memnew(AnimationTrackEditSpriteFrame);
sprite->set_as_coords();

View file

@ -45,7 +45,7 @@
#include "editor/plugins/spatial_editor_plugin.h"
#include "editor/property_editor.h"
#include "main/performance.h"
#include "scene/3d/camera.h"
#include "scene/3d/camera_3d.h"
#include "scene/debugger/scene_debugger.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/label.h"
@ -791,12 +791,12 @@ void ScriptEditorDebugger::_notification(int p_what) {
} else if (camera_override >= CameraOverride::OVERRIDE_3D_1) {
int viewport_idx = camera_override - CameraOverride::OVERRIDE_3D_1;
SpatialEditorViewport *viewport = SpatialEditor::get_singleton()->get_editor_viewport(viewport_idx);
Camera *const cam = viewport->get_camera();
Node3DEditorViewport *viewport = Node3DEditor::get_singleton()->get_editor_viewport(viewport_idx);
Camera3D *const cam = viewport->get_camera();
Array msg;
msg.push_back(cam->get_camera_transform());
if (cam->get_projection() == Camera::PROJECTION_ORTHOGONAL) {
if (cam->get_projection() == Camera3D::PROJECTION_ORTHOGONAL) {
msg.push_back(false);
msg.push_back(cam->get_size());
} else {

View file

@ -646,7 +646,7 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
emit_signal("property_keyed", property, use_keying_next());
if (use_keying_next()) {
if (property == "frame_coords" && (object->is_class("Sprite") || object->is_class("Sprite3D"))) {
if (property == "frame_coords" && (object->is_class("Sprite2D") || object->is_class("Sprite3D"))) {
Vector2 new_coords = object->get(property);
new_coords.x++;
if (new_coords.x >= object->get("hframes").operator int64_t()) {

View file

@ -1107,7 +1107,7 @@ void EditorNode::_find_node_types(Node *p_node, int &count_2d, int &count_3d) {
if (p_node->is_class("CanvasItem"))
count_2d++;
else if (p_node->is_class("Spatial"))
else if (p_node->is_class("Node3D"))
count_3d++;
for (int i = 0; i < p_node->get_child_count(); i++)
@ -1139,7 +1139,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
if (is2d) {
img = scene_root->get_texture()->get_data();
} else {
img = SpatialEditor::get_singleton()->get_editor_viewport(0)->get_viewport_node()->get_texture()->get_data();
img = Node3DEditor::get_singleton()->get_editor_viewport(0)->get_viewport_node()->get_texture()->get_data();
}
if (img.is_valid()) {
@ -3595,8 +3595,8 @@ void EditorNode::register_editor_types() {
ClassDB::register_class<EditorSelection>();
ClassDB::register_class<EditorFileDialog>();
ClassDB::register_virtual_class<EditorSettings>();
ClassDB::register_class<EditorSpatialGizmo>();
ClassDB::register_class<EditorSpatialGizmoPlugin>();
ClassDB::register_class<EditorNode3DGizmo>();
ClassDB::register_class<EditorNode3DGizmoPlugin>();
ClassDB::register_virtual_class<EditorResourcePreview>();
ClassDB::register_class<EditorResourcePreviewGenerator>();
ClassDB::register_virtual_class<EditorFileSystem>();
@ -6571,7 +6571,7 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(DebuggerEditorPlugin(this, debug_menu)));
add_editor_plugin(memnew(AnimationPlayerEditorPlugin(this)));
add_editor_plugin(memnew(CanvasItemEditorPlugin(this)));
add_editor_plugin(memnew(SpatialEditorPlugin(this)));
add_editor_plugin(memnew(Node3DEditorPlugin(this)));
add_editor_plugin(memnew(ScriptEditorPlugin(this)));
EditorAudioBuses *audio_bus_editor = EditorAudioBuses::register_editor();
@ -6851,7 +6851,7 @@ bool EditorPluginList::forward_gui_input(const Ref<InputEvent> &p_event) {
return discard;
}
bool EditorPluginList::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event, bool serve_when_force_input_enabled) {
bool EditorPluginList::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event, bool serve_when_force_input_enabled) {
bool discard = false;
for (int i = 0; i < plugins_list.size(); i++) {

View file

@ -894,7 +894,7 @@ public:
bool forward_gui_input(const Ref<InputEvent> &p_event);
void forward_canvas_draw_over_viewport(Control *p_overlay);
void forward_canvas_force_draw_over_viewport(Control *p_overlay);
bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event, bool serve_when_force_input_enabled);
bool forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event, bool serve_when_force_input_enabled);
void forward_spatial_draw_over_viewport(Control *p_overlay);
void forward_spatial_force_draw_over_viewport(Control *p_overlay);
void add_plugin(EditorPlugin *p_plugin);

View file

@ -39,7 +39,7 @@
#include "main/main.h"
#include "plugins/canvas_item_editor_plugin.h"
#include "plugins/spatial_editor_plugin.h"
#include "scene/3d/camera.h"
#include "scene/3d/camera_3d.h"
#include "scene/gui/popup_menu.h"
#include "servers/visual_server.h"
@ -371,24 +371,24 @@ void EditorPlugin::add_control_to_container(CustomControlContainer p_location, C
case CONTAINER_SPATIAL_EDITOR_MENU: {
SpatialEditor::get_singleton()->add_control_to_menu_panel(p_control);
Node3DEditor::get_singleton()->add_control_to_menu_panel(p_control);
} break;
case CONTAINER_SPATIAL_EDITOR_SIDE_LEFT: {
SpatialEditor::get_singleton()->get_palette_split()->add_child(p_control);
SpatialEditor::get_singleton()->get_palette_split()->move_child(p_control, 0);
Node3DEditor::get_singleton()->get_palette_split()->add_child(p_control);
Node3DEditor::get_singleton()->get_palette_split()->move_child(p_control, 0);
} break;
case CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT: {
SpatialEditor::get_singleton()->get_palette_split()->add_child(p_control);
SpatialEditor::get_singleton()->get_palette_split()->move_child(p_control, 1);
Node3DEditor::get_singleton()->get_palette_split()->add_child(p_control);
Node3DEditor::get_singleton()->get_palette_split()->move_child(p_control, 1);
} break;
case CONTAINER_SPATIAL_EDITOR_BOTTOM: {
SpatialEditor::get_singleton()->get_shader_split()->add_child(p_control);
Node3DEditor::get_singleton()->get_shader_split()->add_child(p_control);
} break;
case CONTAINER_CANVAS_EDITOR_MENU: {
@ -445,18 +445,18 @@ void EditorPlugin::remove_control_from_container(CustomControlContainer p_locati
case CONTAINER_SPATIAL_EDITOR_MENU: {
SpatialEditor::get_singleton()->remove_control_from_menu_panel(p_control);
Node3DEditor::get_singleton()->remove_control_from_menu_panel(p_control);
} break;
case CONTAINER_SPATIAL_EDITOR_SIDE_LEFT:
case CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT: {
SpatialEditor::get_singleton()->get_palette_split()->remove_child(p_control);
Node3DEditor::get_singleton()->get_palette_split()->remove_child(p_control);
} break;
case CONTAINER_SPATIAL_EDITOR_BOTTOM: {
SpatialEditor::get_singleton()->get_shader_split()->remove_child(p_control);
Node3DEditor::get_singleton()->get_shader_split()->remove_child(p_control);
} break;
case CONTAINER_CANVAS_EDITOR_MENU: {
@ -562,10 +562,10 @@ void EditorPlugin::forward_canvas_force_draw_over_viewport(Control *p_overlay) {
// Updates the overlays of the 2D viewport or, if in 3D mode, of every 3D viewport.
int EditorPlugin::update_overlays() const {
if (SpatialEditor::get_singleton()->is_visible()) {
if (Node3DEditor::get_singleton()->is_visible()) {
int count = 0;
for (uint32_t i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
SpatialEditorViewport *vp = SpatialEditor::get_singleton()->get_editor_viewport(i);
for (uint32_t i = 0; i < Node3DEditor::VIEWPORTS_COUNT; i++) {
Node3DEditorViewport *vp = Node3DEditor::get_singleton()->get_editor_viewport(i);
if (vp->is_visible()) {
vp->update_surface();
count++;
@ -579,7 +579,7 @@ int EditorPlugin::update_overlays() const {
}
}
bool EditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) {
bool EditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
if (get_script_instance() && get_script_instance()->has_method("forward_spatial_gui_input")) {
return get_script_instance()->call("forward_spatial_gui_input", p_camera, p_event);
@ -724,12 +724,12 @@ void EditorPlugin::remove_export_plugin(const Ref<EditorExportPlugin> &p_exporte
EditorExport::get_singleton()->remove_export_plugin(p_exporter);
}
void EditorPlugin::add_spatial_gizmo_plugin(const Ref<EditorSpatialGizmoPlugin> &p_gizmo_plugin) {
SpatialEditor::get_singleton()->add_gizmo_plugin(p_gizmo_plugin);
void EditorPlugin::add_spatial_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin) {
Node3DEditor::get_singleton()->add_gizmo_plugin(p_gizmo_plugin);
}
void EditorPlugin::remove_spatial_gizmo_plugin(const Ref<EditorSpatialGizmoPlugin> &p_gizmo_plugin) {
SpatialEditor::get_singleton()->remove_gizmo_plugin(p_gizmo_plugin);
void EditorPlugin::remove_spatial_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin) {
Node3DEditor::get_singleton()->remove_gizmo_plugin(p_gizmo_plugin);
}
void EditorPlugin::add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
@ -865,7 +865,7 @@ void EditorPlugin::_bind_methods() {
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_canvas_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_canvas_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera3D"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_plugin_name"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "get_plugin_icon"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "has_main_screen"));

View file

@ -42,14 +42,14 @@
#include "scene/resources/texture.h"
class EditorNode;
class Spatial;
class Camera;
class Node3D;
class Camera3D;
class EditorSelection;
class EditorExport;
class EditorSettings;
class EditorImportPlugin;
class EditorExportPlugin;
class EditorSpatialGizmoPlugin;
class EditorNode3DGizmoPlugin;
class EditorResourcePreview;
class EditorFileSystem;
class EditorToolAddons;
@ -185,7 +185,7 @@ public:
virtual void forward_canvas_draw_over_viewport(Control *p_overlay);
virtual void forward_canvas_force_draw_over_viewport(Control *p_overlay);
virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event);
virtual bool forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event);
virtual void forward_spatial_draw_over_viewport(Control *p_overlay);
virtual void forward_spatial_force_draw_over_viewport(Control *p_overlay);
@ -227,8 +227,8 @@ public:
void add_export_plugin(const Ref<EditorExportPlugin> &p_exporter);
void remove_export_plugin(const Ref<EditorExportPlugin> &p_exporter);
void add_spatial_gizmo_plugin(const Ref<EditorSpatialGizmoPlugin> &p_gizmo_plugin);
void remove_spatial_gizmo_plugin(const Ref<EditorSpatialGizmoPlugin> &p_gizmo_plugin);
void add_spatial_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin);
void remove_spatial_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin);
void add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
void remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);

View file

Before

Width:  |  Height:  |  Size: 708 B

After

Width:  |  Height:  |  Size: 708 B

View file

Before

Width:  |  Height:  |  Size: 226 B

After

Width:  |  Height:  |  Size: 226 B

View file

Before

Width:  |  Height:  |  Size: 613 B

After

Width:  |  Height:  |  Size: 613 B

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 347 B

View file

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 344 B

View file

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

View file

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

View file

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 604 B

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 352 B

After

Width:  |  Height:  |  Size: 352 B

View file

Before

Width:  |  Height:  |  Size: 340 B

After

Width:  |  Height:  |  Size: 340 B

View file

Before

Width:  |  Height:  |  Size: 497 B

After

Width:  |  Height:  |  Size: 497 B

View file

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 447 B

View file

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 469 B

View file

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 587 B

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 487 B

After

Width:  |  Height:  |  Size: 487 B

View file

Before

Width:  |  Height:  |  Size: 456 B

After

Width:  |  Height:  |  Size: 456 B

View file

Before

Width:  |  Height:  |  Size: 802 B

After

Width:  |  Height:  |  Size: 802 B

View file

Before

Width:  |  Height:  |  Size: 700 B

After

Width:  |  Height:  |  Size: 700 B

View file

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

View file

Before

Width:  |  Height:  |  Size: 651 B

After

Width:  |  Height:  |  Size: 651 B

View file

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

View file

Before

Width:  |  Height:  |  Size: 676 B

After

Width:  |  Height:  |  Size: 676 B

View file

Before

Width:  |  Height:  |  Size: 669 B

After

Width:  |  Height:  |  Size: 669 B

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 264 B

View file

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 305 B

View file

Before

Width:  |  Height:  |  Size: 595 B

After

Width:  |  Height:  |  Size: 595 B

View file

Before

Width:  |  Height:  |  Size: 538 B

After

Width:  |  Height:  |  Size: 538 B

View file

Before

Width:  |  Height:  |  Size: 917 B

After

Width:  |  Height:  |  Size: 917 B

View file

Before

Width:  |  Height:  |  Size: 399 B

After

Width:  |  Height:  |  Size: 399 B

View file

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 587 B

View file

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 162 B

View file

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

View file

Before

Width:  |  Height:  |  Size: 690 B

After

Width:  |  Height:  |  Size: 690 B

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 545 B

View file

Before

Width:  |  Height:  |  Size: 523 B

After

Width:  |  Height:  |  Size: 523 B

View file

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 229 B

View file

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View file

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 177 B

View file

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 387 B

View file

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

View file

Before

Width:  |  Height:  |  Size: 644 B

After

Width:  |  Height:  |  Size: 644 B

View file

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

View file

Before

Width:  |  Height:  |  Size: 577 B

After

Width:  |  Height:  |  Size: 577 B

View file

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 532 B

View file

@ -33,12 +33,12 @@
#include "core/os/os.h"
#include "editor/editor_node.h"
#include "editor/import/collada.h"
#include "scene/3d/camera.h"
#include "scene/3d/light.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/path.h"
#include "scene/3d/skeleton.h"
#include "scene/3d/spatial.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/light_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/node_3d.h"
#include "scene/3d/path_3d.h"
#include "scene/3d/skeleton_3d.h"
#include "scene/animation/animation_player.h"
#include "scene/resources/animation.h"
#include "scene/resources/packed_scene.h"
@ -47,13 +47,13 @@
struct ColladaImport {
Collada collada;
Spatial *scene;
Node3D *scene;
Vector<Ref<Animation>> animations;
struct NodeMap {
//String path;
Spatial *node;
Node3D *node;
int bone;
List<int> anim_tracks;
@ -76,17 +76,17 @@ struct ColladaImport {
Map<String, Ref<ArrayMesh>> mesh_cache;
Map<String, Ref<Curve3D>> curve_cache;
Map<String, Ref<Material>> material_cache;
Map<Collada::Node *, Skeleton *> skeleton_map;
Map<Collada::Node *, Skeleton3D *> skeleton_map;
Map<Skeleton *, Map<String, int>> skeleton_bone_map;
Map<Skeleton3D *, Map<String, int>> skeleton_bone_map;
Set<String> valid_animated_nodes;
Vector<int> valid_animated_properties;
Map<String, bool> bones_with_animation;
Error _populate_skeleton(Skeleton *p_skeleton, Collada::Node *p_node, int &r_bone, int p_parent);
Error _populate_skeleton(Skeleton3D *p_skeleton, Collada::Node *p_node, int &r_bone, int p_parent);
Error _create_scene_skeletons(Collada::Node *p_node);
Error _create_scene(Collada::Node *p_node, Spatial *p_parent);
Error _create_scene(Collada::Node *p_node, Node3D *p_parent);
Error _create_resources(Collada::Node *p_node, bool p_use_compression);
Error _create_material(const String &p_target);
Error _create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh>> p_morph_meshes = Vector<Ref<ArrayMesh>>(), bool p_use_compression = false, bool p_use_mesh_material = false);
@ -110,7 +110,7 @@ struct ColladaImport {
}
};
Error ColladaImport::_populate_skeleton(Skeleton *p_skeleton, Collada::Node *p_node, int &r_bone, int p_parent) {
Error ColladaImport::_populate_skeleton(Skeleton3D *p_skeleton, Collada::Node *p_node, int &r_bone, int p_parent) {
if (p_node->type != Collada::Node::TYPE_JOINT)
return OK;
@ -174,7 +174,7 @@ Error ColladaImport::_create_scene_skeletons(Collada::Node *p_node) {
if (p_node->type == Collada::Node::TYPE_SKELETON) {
Skeleton *sk = memnew(Skeleton);
Skeleton3D *sk = memnew(Skeleton3D);
int bone = 0;
for (int i = 0; i < p_node->children.size(); i++) {
@ -193,15 +193,15 @@ Error ColladaImport::_create_scene_skeletons(Collada::Node *p_node) {
return OK;
}
Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) {
Spatial *node = NULL;
Node3D *node = NULL;
switch (p_node->type) {
case Collada::Node::TYPE_NODE: {
node = memnew(Spatial);
node = memnew(Node3D);
} break;
case Collada::Node::TYPE_JOINT: {
@ -223,7 +223,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
if (!bool(GLOBAL_DEF("collada/use_ambient", false)))
return OK;
//well, it's an ambient light..
Light *l = memnew(DirectionalLight);
Light3D *l = memnew(DirectionalLight3D);
//l->set_color(Light::COLOR_AMBIENT,ld.color);
//l->set_color(Light::COLOR_DIFFUSE,Color(0,0,0));
//l->set_color(Light::COLOR_SPECULAR,Color(0,0,0));
@ -232,7 +232,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
} else if (ld.mode == Collada::LightData::MODE_DIRECTIONAL) {
//well, it's an ambient light..
Light *l = memnew(DirectionalLight);
Light3D *l = memnew(DirectionalLight3D);
/*
if (found_ambient) //use it here
l->set_color(Light::COLOR_AMBIENT,ambient);
@ -243,12 +243,12 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
node = l;
} else {
Light *l;
Light3D *l;
if (ld.mode == Collada::LightData::MODE_OMNI)
l = memnew(OmniLight);
l = memnew(OmniLight3D);
else {
l = memnew(SpotLight);
l = memnew(SpotLight3D);
//l->set_parameter(Light::PARAM_SPOT_ANGLE,ld.spot_angle);
//l->set_parameter(Light::PARAM_SPOT_ATTENUATION,ld.spot_exp);
}
@ -262,13 +262,13 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
} else {
node = memnew(Spatial);
node = memnew(Node3D);
}
} break;
case Collada::Node::TYPE_CAMERA: {
Collada::NodeCamera *cam = static_cast<Collada::NodeCamera *>(p_node);
Camera *camera = memnew(Camera);
Camera3D *camera = memnew(Camera3D);
if (collada.state.camera_data_map.has(cam->camera)) {
@ -280,12 +280,12 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
if (cd.orthogonal.y_mag) {
camera->set_keep_aspect_mode(Camera::KEEP_HEIGHT);
camera->set_keep_aspect_mode(Camera3D::KEEP_HEIGHT);
camera->set_orthogonal(cd.orthogonal.y_mag * 2.0, cd.z_near, cd.z_far);
} else if (!cd.orthogonal.y_mag && cd.orthogonal.x_mag) {
camera->set_keep_aspect_mode(Camera::KEEP_WIDTH);
camera->set_keep_aspect_mode(Camera3D::KEEP_WIDTH);
camera->set_orthogonal(cd.orthogonal.x_mag * 2.0, cd.z_near, cd.z_far);
}
@ -314,17 +314,17 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
if (collada.state.curve_data_map.has(ng->source)) {
node = memnew(Path);
node = memnew(Path3D);
} else {
//mesh since nothing else
node = memnew(MeshInstance);
node = memnew(MeshInstance3D);
//Object::cast_to<MeshInstance>(node)->set_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT, true);
}
} break;
case Collada::Node::TYPE_SKELETON: {
ERR_FAIL_COND_V(!skeleton_map.has(p_node), ERR_CANT_CREATE);
Skeleton *sk = skeleton_map[p_node];
Skeleton3D *sk = skeleton_map[p_node];
node = sk;
} break;
}
@ -1010,12 +1010,12 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
if (p_node->type == Collada::Node::TYPE_GEOMETRY && node_map.has(p_node->id)) {
Spatial *node = node_map[p_node->id].node;
Node3D *node = node_map[p_node->id].node;
Collada::NodeGeometry *ng = static_cast<Collada::NodeGeometry *>(p_node);
if (Object::cast_to<Path>(node)) {
if (Object::cast_to<Path3D>(node)) {
Path *path = Object::cast_to<Path>(node);
Path3D *path = Object::cast_to<Path3D>(node);
if (curve_cache.has(ng->source)) {
@ -1083,11 +1083,11 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
}
}
if (Object::cast_to<MeshInstance>(node)) {
if (Object::cast_to<MeshInstance3D>(node)) {
Collada::NodeGeometry *ng2 = static_cast<Collada::NodeGeometry *>(p_node);
MeshInstance *mi = Object::cast_to<MeshInstance>(node);
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(node);
ERR_FAIL_COND_V(!mi, ERR_BUG);
@ -1114,7 +1114,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
String skname = skeletons[0];
ERR_FAIL_COND_V(!node_map.has(skname), ERR_INVALID_DATA);
NodeMap nmsk = node_map[skname];
Skeleton *sk = Object::cast_to<Skeleton>(nmsk.node);
Skeleton3D *sk = Object::cast_to<Skeleton3D>(nmsk.node);
ERR_FAIL_COND_V(!sk, ERR_INVALID_DATA);
ERR_FAIL_COND_V(!skeleton_bone_map.has(sk), ERR_INVALID_DATA);
Map<String, int> &bone_remap_map = skeleton_bone_map[sk];
@ -1265,7 +1265,7 @@ Error ColladaImport::load(const String &p_path, int p_flags, bool p_force_make_t
ERR_FAIL_COND_V(!collada.state.visual_scene_map.has(collada.state.root_visual_scene), ERR_INVALID_DATA);
Collada::VisualScene &vs = collada.state.visual_scene_map[collada.state.root_visual_scene];
scene = memnew(Spatial); // root
scene = memnew(Node3D); // root
//determine what's going on with the lights
for (int i = 0; i < vs.root_nodes.size(); i++) {
@ -1530,7 +1530,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
String path = scene->get_path_to(nm.node);
if (nm.bone >= 0) {
Skeleton *sk = static_cast<Skeleton *>(nm.node);
Skeleton3D *sk = static_cast<Skeleton3D *>(nm.node);
String name = sk->get_bone_name(nm.bone);
path = path + ":" + name;
}
@ -1621,7 +1621,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
if (nm.bone >= 0) {
//make bone transform relative to rest (in case of skeleton)
Skeleton *sk = Object::cast_to<Skeleton>(nm.node);
Skeleton3D *sk = Object::cast_to<Skeleton3D>(nm.node);
if (sk) {
xform = sk->get_bone_rest(nm.bone).affine_inverse() * xform;
@ -1662,7 +1662,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
NodeMap &nm = node_map[E->key()];
String path = scene->get_path_to(nm.node);
ERR_CONTINUE(nm.bone < 0);
Skeleton *sk = static_cast<Skeleton *>(nm.node);
Skeleton3D *sk = static_cast<Skeleton3D *>(nm.node);
String name = sk->get_bone_name(nm.bone);
path = path + ":" + name;

View file

@ -37,9 +37,9 @@
#include "core/os/file_access.h"
#include "core/os/os.h"
#include "modules/regex/regex.h"
#include "scene/3d/bone_attachment.h"
#include "scene/3d/camera.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/bone_attachment_3d.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/animation/animation_player.h"
#include "scene/resources/surface_tool.h"
@ -2108,7 +2108,7 @@ Error EditorSceneImporterGLTF::_create_skeletons(GLTFState &state) {
GLTFSkeleton &gltf_skeleton = state.skeletons.write[skel_i];
Skeleton *skeleton = memnew(Skeleton);
Skeleton3D *skeleton = memnew(Skeleton3D);
gltf_skeleton.godot_skeleton = skeleton;
// Make a unique name, no gltf node represents this skeleton
@ -2485,12 +2485,12 @@ void EditorSceneImporterGLTF::_assign_scene_names(GLTFState &state) {
}
}
BoneAttachment *EditorSceneImporterGLTF::_generate_bone_attachment(GLTFState &state, Skeleton *skeleton, const GLTFNodeIndex node_index) {
BoneAttachment3D *EditorSceneImporterGLTF::_generate_bone_attachment(GLTFState &state, Skeleton3D *skeleton, const GLTFNodeIndex node_index) {
const GLTFNode *gltf_node = state.nodes[node_index];
const GLTFNode *bone_node = state.nodes[gltf_node->parent];
BoneAttachment *bone_attachment = memnew(BoneAttachment);
BoneAttachment3D *bone_attachment = memnew(BoneAttachment3D);
print_verbose("glTF: Creating bone attachment for: " + gltf_node->name);
ERR_FAIL_COND_V(!bone_node->joint, nullptr);
@ -2500,12 +2500,12 @@ BoneAttachment *EditorSceneImporterGLTF::_generate_bone_attachment(GLTFState &st
return bone_attachment;
}
MeshInstance *EditorSceneImporterGLTF::_generate_mesh_instance(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index) {
MeshInstance3D *EditorSceneImporterGLTF::_generate_mesh_instance(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index) {
const GLTFNode *gltf_node = state.nodes[node_index];
ERR_FAIL_INDEX_V(gltf_node->mesh, state.meshes.size(), nullptr);
MeshInstance *mi = memnew(MeshInstance);
MeshInstance3D *mi = memnew(MeshInstance3D);
print_verbose("glTF: Creating mesh for: " + gltf_node->name);
GLTFMesh &mesh = state.meshes.write[gltf_node->mesh];
@ -2522,12 +2522,12 @@ MeshInstance *EditorSceneImporterGLTF::_generate_mesh_instance(GLTFState &state,
return mi;
}
Camera *EditorSceneImporterGLTF::_generate_camera(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index) {
Camera3D *EditorSceneImporterGLTF::_generate_camera(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index) {
const GLTFNode *gltf_node = state.nodes[node_index];
ERR_FAIL_INDEX_V(gltf_node->camera, state.cameras.size(), nullptr);
Camera *camera = memnew(Camera);
Camera3D *camera = memnew(Camera3D);
print_verbose("glTF: Creating camera for: " + gltf_node->name);
const GLTFCamera &c = state.cameras[gltf_node->camera];
@ -2540,26 +2540,26 @@ Camera *EditorSceneImporterGLTF::_generate_camera(GLTFState &state, Node *scene_
return camera;
}
Spatial *EditorSceneImporterGLTF::_generate_spatial(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index) {
Node3D *EditorSceneImporterGLTF::_generate_spatial(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index) {
const GLTFNode *gltf_node = state.nodes[node_index];
Spatial *spatial = memnew(Spatial);
Node3D *spatial = memnew(Node3D);
print_verbose("glTF: Creating spatial for: " + gltf_node->name);
return spatial;
}
void EditorSceneImporterGLTF::_generate_scene_node(GLTFState &state, Node *scene_parent, Spatial *scene_root, const GLTFNodeIndex node_index) {
void EditorSceneImporterGLTF::_generate_scene_node(GLTFState &state, Node *scene_parent, Node3D *scene_root, const GLTFNodeIndex node_index) {
const GLTFNode *gltf_node = state.nodes[node_index];
Spatial *current_node = nullptr;
Node3D *current_node = nullptr;
// Is our parent a skeleton
Skeleton *active_skeleton = Object::cast_to<Skeleton>(scene_parent);
Skeleton3D *active_skeleton = Object::cast_to<Skeleton3D>(scene_parent);
if (gltf_node->skeleton >= 0) {
Skeleton *skeleton = state.skeletons[gltf_node->skeleton].godot_skeleton;
Skeleton3D *skeleton = state.skeletons[gltf_node->skeleton].godot_skeleton;
if (active_skeleton != skeleton) {
ERR_FAIL_COND_MSG(active_skeleton != nullptr, "glTF: Generating scene detected direct parented Skeletons");
@ -2577,7 +2577,7 @@ void EditorSceneImporterGLTF::_generate_scene_node(GLTFState &state, Node *scene
// If we have an active skeleton, and the node is node skinned, we need to create a bone attachment
if (current_node == nullptr && active_skeleton != nullptr && gltf_node->skin < 0) {
BoneAttachment *bone_attachment = _generate_bone_attachment(state, active_skeleton, node_index);
BoneAttachment3D *bone_attachment = _generate_bone_attachment(state, active_skeleton, node_index);
scene_parent->add_child(bone_attachment);
bone_attachment->set_owner(scene_root);
@ -2776,7 +2776,7 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
const GLTFNode *node = state.nodes[E->key()];
if (node->skeleton >= 0) {
const Skeleton *sk = Object::cast_to<Skeleton>(state.scene_nodes.find(node_index)->get());
const Skeleton3D *sk = Object::cast_to<Skeleton3D>(state.scene_nodes.find(node_index)->get());
ERR_FAIL_COND(sk == nullptr);
const String path = ap->get_parent()->get_path_to(sk);
@ -2853,7 +2853,7 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
xform.basis.set_quat_scale(rot, scale);
xform.origin = pos;
const Skeleton *skeleton = state.skeletons[node->skeleton].godot_skeleton;
const Skeleton3D *skeleton = state.skeletons[node->skeleton].godot_skeleton;
const int bone_idx = skeleton->find_bone(node->name);
xform = skeleton->get_bone_rest(bone_idx).affine_inverse() * xform;
@ -2922,7 +2922,7 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
ap->add_animation(name, animation);
}
void EditorSceneImporterGLTF::_process_mesh_instances(GLTFState &state, Spatial *scene_root) {
void EditorSceneImporterGLTF::_process_mesh_instances(GLTFState &state, Node3D *scene_root) {
for (GLTFNodeIndex node_i = 0; node_i < state.nodes.size(); ++node_i) {
const GLTFNode *node = state.nodes[node_i];
@ -2930,12 +2930,12 @@ void EditorSceneImporterGLTF::_process_mesh_instances(GLTFState &state, Spatial
const GLTFSkinIndex skin_i = node->skin;
Map<GLTFNodeIndex, Node *>::Element *mi_element = state.scene_nodes.find(node_i);
MeshInstance *mi = Object::cast_to<MeshInstance>(mi_element->get());
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(mi_element->get());
ERR_FAIL_COND(mi == nullptr);
const GLTFSkeletonIndex skel_i = state.skins[node->skin].skeleton;
const GLTFSkeleton &gltf_skeleton = state.skeletons[skel_i];
Skeleton *skeleton = gltf_skeleton.godot_skeleton;
Skeleton3D *skeleton = gltf_skeleton.godot_skeleton;
ERR_FAIL_COND(skeleton == nullptr);
mi->get_parent()->remove_child(mi);
@ -2949,9 +2949,9 @@ void EditorSceneImporterGLTF::_process_mesh_instances(GLTFState &state, Spatial
}
}
Spatial *EditorSceneImporterGLTF::_generate_scene(GLTFState &state, const int p_bake_fps) {
Node3D *EditorSceneImporterGLTF::_generate_scene(GLTFState &state, const int p_bake_fps) {
Spatial *root = memnew(Spatial);
Node3D *root = memnew(Node3D);
// scene_name is already unique
root->set_name(state.scene_name);
@ -3084,7 +3084,7 @@ Node *EditorSceneImporterGLTF::import_scene(const String &p_path, uint32_t p_fla
_assign_scene_names(state);
/* STEP 17 MAKE SCENE! */
Spatial *scene = _generate_scene(state, p_bake_fps);
Node3D *scene = _generate_scene(state, p_bake_fps);
return scene;
}

View file

@ -32,12 +32,12 @@
#define EDITOR_SCENE_IMPORTER_GLTF_H
#include "editor/import/resource_importer_scene.h"
#include "scene/3d/skeleton.h"
#include "scene/3d/spatial.h"
#include "scene/3d/node_3d.h"
#include "scene/3d/skeleton_3d.h"
class AnimationPlayer;
class BoneAttachment;
class MeshInstance;
class BoneAttachment3D;
class MeshInstance3D;
class EditorSceneImporterGLTF : public EditorSceneImporter {
@ -192,7 +192,7 @@ class EditorSceneImporterGLTF : public EditorSceneImporter {
Vector<GLTFNodeIndex> roots;
// The created Skeleton for the scene
Skeleton *godot_skeleton;
Skeleton3D *godot_skeleton;
// Set of unique bone names for the skeleton
Set<String> unique_names;
@ -395,15 +395,15 @@ class EditorSceneImporterGLTF : public EditorSceneImporter {
Error _parse_animations(GLTFState &state);
BoneAttachment *_generate_bone_attachment(GLTFState &state, Skeleton *skeleton, const GLTFNodeIndex node_index);
MeshInstance *_generate_mesh_instance(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index);
Camera *_generate_camera(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index);
Spatial *_generate_spatial(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index);
BoneAttachment3D *_generate_bone_attachment(GLTFState &state, Skeleton3D *skeleton, const GLTFNodeIndex node_index);
MeshInstance3D *_generate_mesh_instance(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index);
Camera3D *_generate_camera(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index);
Node3D *_generate_spatial(GLTFState &state, Node *scene_parent, const GLTFNodeIndex node_index);
void _generate_scene_node(GLTFState &state, Node *scene_parent, Spatial *scene_root, const GLTFNodeIndex node_index);
Spatial *_generate_scene(GLTFState &state, const int p_bake_fps);
void _generate_scene_node(GLTFState &state, Node *scene_parent, Node3D *scene_root, const GLTFNodeIndex node_index);
Node3D *_generate_scene(GLTFState &state, const int p_bake_fps);
void _process_mesh_instances(GLTFState &state, Spatial *scene_root);
void _process_mesh_instances(GLTFState &state, Node3D *scene_root);
void _assign_scene_names(GLTFState &state);

View file

@ -32,8 +32,8 @@
#include "core/io/resource_saver.h"
#include "core/os/file_access.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/spatial.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/node_3d.h"
#include "scene/resources/mesh.h"
#include "scene/resources/surface_tool.h"
@ -431,11 +431,11 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
return NULL;
}
Spatial *scene = memnew(Spatial);
Node3D *scene = memnew(Node3D);
for (List<Ref<Mesh>>::Element *E = meshes.front(); E; E = E->next()) {
MeshInstance *mi = memnew(MeshInstance);
MeshInstance3D *mi = memnew(MeshInstance3D);
mi->set_mesh(E->get());
mi->set_name(E->get()->get_name());
scene->add_child(mi);

View file

@ -32,19 +32,19 @@
#include "core/io/resource_saver.h"
#include "editor/editor_node.h"
#include "scene/3d/collision_shape.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/navigation.h"
#include "scene/3d/physics_body.h"
#include "scene/3d/collision_shape_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/navigation_3d.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/3d/vehicle_body.h"
#include "scene/animation/animation_player.h"
#include "scene/resources/animation.h"
#include "scene/resources/box_shape.h"
#include "scene/resources/box_shape_3d.h"
#include "scene/resources/packed_scene.h"
#include "scene/resources/ray_shape.h"
#include "scene/resources/resource_format_text.h"
#include "scene/resources/sphere_shape.h"
#include "scene/resources/world_margin_shape.h"
#include "scene/resources/sphere_shape_3d.h"
#include "scene/resources/world_margin_shape_3d.h"
uint32_t EditorSceneImporter::get_import_flags() const {
@ -276,15 +276,15 @@ static String _fixstr(const String &p_what, const String &p_str) {
return what;
}
static void _gen_shape_list(const Ref<Mesh> &mesh, List<Ref<Shape>> &r_shape_list, bool p_convex) {
static void _gen_shape_list(const Ref<Mesh> &mesh, List<Ref<Shape3D>> &r_shape_list, bool p_convex) {
if (!p_convex) {
Ref<Shape> shape = mesh->create_trimesh_shape();
Ref<Shape3D> shape = mesh->create_trimesh_shape();
r_shape_list.push_back(shape);
} else {
Vector<Ref<Shape>> cd = mesh->convex_decompose();
Vector<Ref<Shape3D>> cd = mesh->convex_decompose();
if (cd.size()) {
for (int i = 0; i < cd.size(); i++) {
r_shape_list.push_back(cd[i]);
@ -293,7 +293,7 @@ static void _gen_shape_list(const Ref<Mesh> &mesh, List<Ref<Shape>> &r_shape_lis
}
}
Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>, List<Ref<Shape>>> &collision_map, LightBakeMode p_light_bake_mode) {
Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>, List<Ref<Shape3D>>> &collision_map, LightBakeMode p_light_bake_mode) {
// children first
for (int i = 0; i < p_node->get_child_count(); i++) {
@ -314,9 +314,9 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
return NULL;
}
if (Object::cast_to<MeshInstance>(p_node)) {
if (Object::cast_to<MeshInstance3D>(p_node)) {
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(p_node);
Ref<ArrayMesh> m = mi->get_mesh();
@ -344,7 +344,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
if (p_light_bake_mode != LIGHT_BAKE_DISABLED) {
mi->set_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT, true);
mi->set_flag(GeometryInstance3D::FLAG_USE_BAKED_LIGHT, true);
}
}
@ -377,12 +377,12 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
if (isroot)
return p_node;
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(p_node);
if (mi) {
Ref<Mesh> mesh = mi->get_mesh();
if (mesh.is_valid()) {
List<Ref<Shape>> shapes;
List<Ref<Shape3D>> shapes;
String fixed_name;
if (collision_map.has(mesh)) {
shapes = collision_map[mesh];
@ -404,7 +404,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
if (shapes.size()) {
StaticBody *col = memnew(StaticBody);
StaticBody3D *col = memnew(StaticBody3D);
col->set_transform(mi->get_transform());
col->set_name(fixed_name);
p_node->replace_by(col);
@ -412,9 +412,9 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
p_node = col;
int idx = 0;
for (List<Ref<Shape>>::Element *E = shapes.front(); E; E = E->next()) {
for (List<Ref<Shape3D>>::Element *E = shapes.front(); E; E = E->next()) {
CollisionShape *cshape = memnew(CollisionShape);
CollisionShape3D *cshape = memnew(CollisionShape3D);
cshape->set_shape(E->get());
col->add_child(cshape);
@ -427,55 +427,55 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
} else if (p_node->has_meta("empty_draw_type")) {
String empty_draw_type = String(p_node->get_meta("empty_draw_type"));
StaticBody *sb = memnew(StaticBody);
StaticBody3D *sb = memnew(StaticBody3D);
sb->set_name(_fixstr(name, "colonly"));
Object::cast_to<Spatial>(sb)->set_transform(Object::cast_to<Spatial>(p_node)->get_transform());
Object::cast_to<Node3D>(sb)->set_transform(Object::cast_to<Node3D>(p_node)->get_transform());
p_node->replace_by(sb);
memdelete(p_node);
p_node = NULL;
CollisionShape *colshape = memnew(CollisionShape);
CollisionShape3D *colshape = memnew(CollisionShape3D);
if (empty_draw_type == "CUBE") {
BoxShape *boxShape = memnew(BoxShape);
BoxShape3D *boxShape = memnew(BoxShape3D);
boxShape->set_extents(Vector3(1, 1, 1));
colshape->set_shape(boxShape);
colshape->set_name("BoxShape");
colshape->set_name("BoxShape3D");
} else if (empty_draw_type == "SINGLE_ARROW") {
RayShape *rayShape = memnew(RayShape);
RayShape3D *rayShape = memnew(RayShape3D);
rayShape->set_length(1);
colshape->set_shape(rayShape);
colshape->set_name("RayShape");
Object::cast_to<Spatial>(sb)->rotate_x(Math_PI / 2);
colshape->set_name("RayShape3D");
Object::cast_to<Node3D>(sb)->rotate_x(Math_PI / 2);
} else if (empty_draw_type == "IMAGE") {
WorldMarginShape *world_margin_shape = memnew(WorldMarginShape);
WorldMarginShape3D *world_margin_shape = memnew(WorldMarginShape3D);
colshape->set_shape(world_margin_shape);
colshape->set_name("WorldMarginShape");
} else {
SphereShape *sphereShape = memnew(SphereShape);
SphereShape3D *sphereShape = memnew(SphereShape3D);
sphereShape->set_radius(1);
colshape->set_shape(sphereShape);
colshape->set_name("SphereShape");
colshape->set_name("SphereShape3D");
}
sb->add_child(colshape);
colshape->set_owner(sb->get_owner());
}
} else if (_teststr(name, "rigid") && Object::cast_to<MeshInstance>(p_node)) {
} else if (_teststr(name, "rigid") && Object::cast_to<MeshInstance3D>(p_node)) {
if (isroot)
return p_node;
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(p_node);
Ref<Mesh> mesh = mi->get_mesh();
if (mesh.is_valid()) {
List<Ref<Shape>> shapes;
List<Ref<Shape3D>> shapes;
if (collision_map.has(mesh)) {
shapes = collision_map[mesh];
} else {
_gen_shape_list(mesh, shapes, true);
}
RigidBody *rigid_body = memnew(RigidBody);
RigidBody3D *rigid_body = memnew(RigidBody3D);
rigid_body->set_name(_fixstr(name, "rigid"));
p_node->replace_by(rigid_body);
rigid_body->set_transform(mi->get_transform());
@ -486,9 +486,9 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
mi->set_owner(rigid_body->get_owner());
int idx = 0;
for (List<Ref<Shape>>::Element *E = shapes.front(); E; E = E->next()) {
for (List<Ref<Shape3D>>::Element *E = shapes.front(); E; E = E->next()) {
CollisionShape *cshape = memnew(CollisionShape);
CollisionShape3D *cshape = memnew(CollisionShape3D);
cshape->set_shape(E->get());
rigid_body->add_child(cshape);
@ -498,14 +498,14 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
}
}
} else if ((_teststr(name, "col") || (_teststr(name, "convcol"))) && Object::cast_to<MeshInstance>(p_node)) {
} else if ((_teststr(name, "col") || (_teststr(name, "convcol"))) && Object::cast_to<MeshInstance3D>(p_node)) {
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(p_node);
Ref<Mesh> mesh = mi->get_mesh();
if (mesh.is_valid()) {
List<Ref<Shape>> shapes;
List<Ref<Shape3D>> shapes;
String fixed_name;
if (collision_map.has(mesh)) {
shapes = collision_map[mesh];
@ -530,15 +530,15 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
}
if (shapes.size()) {
StaticBody *col = memnew(StaticBody);
StaticBody3D *col = memnew(StaticBody3D);
col->set_name("static_collision");
mi->add_child(col);
col->set_owner(mi->get_owner());
int idx = 0;
for (List<Ref<Shape>>::Element *E = shapes.front(); E; E = E->next()) {
for (List<Ref<Shape3D>>::Element *E = shapes.front(); E; E = E->next()) {
CollisionShape *cshape = memnew(CollisionShape);
CollisionShape3D *cshape = memnew(CollisionShape3D);
cshape->set_shape(E->get());
col->add_child(cshape);
@ -550,22 +550,22 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
}
}
} else if (_teststr(name, "navmesh") && Object::cast_to<MeshInstance>(p_node)) {
} else if (_teststr(name, "navmesh") && Object::cast_to<MeshInstance3D>(p_node)) {
if (isroot)
return p_node;
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(p_node);
Ref<ArrayMesh> mesh = mi->get_mesh();
ERR_FAIL_COND_V(mesh.is_null(), NULL);
NavigationRegion *nmi = memnew(NavigationRegion);
NavigationRegion3D *nmi = memnew(NavigationRegion3D);
nmi->set_name(_fixstr(name, "navmesh"));
Ref<NavigationMesh> nmesh = memnew(NavigationMesh);
nmesh->create_from_mesh(mesh);
nmi->set_navigation_mesh(nmesh);
Object::cast_to<Spatial>(nmi)->set_transform(mi->get_transform());
Object::cast_to<Node3D>(nmi)->set_transform(mi->get_transform());
p_node->replace_by(nmi);
memdelete(p_node);
p_node = nmi;
@ -575,7 +575,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
return p_node;
Node *owner = p_node->get_owner();
Spatial *s = Object::cast_to<Spatial>(p_node);
Node3D *s = Object::cast_to<Node3D>(p_node);
VehicleBody *bv = memnew(VehicleBody);
String n = _fixstr(p_node->get_name(), "vehicle");
bv->set_name(n);
@ -595,7 +595,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
return p_node;
Node *owner = p_node->get_owner();
Spatial *s = Object::cast_to<Spatial>(p_node);
Node3D *s = Object::cast_to<Node3D>(p_node);
VehicleWheel *bv = memnew(VehicleWheel);
String n = _fixstr(p_node->get_name(), "wheel");
bv->set_name(n);
@ -609,16 +609,16 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
p_node = bv;
} else if (Object::cast_to<MeshInstance>(p_node)) {
} else if (Object::cast_to<MeshInstance3D>(p_node)) {
//last attempt, maybe collision inside the mesh data
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(p_node);
Ref<ArrayMesh> mesh = mi->get_mesh();
if (!mesh.is_null()) {
List<Ref<Shape>> shapes;
List<Ref<Shape3D>> shapes;
if (collision_map.has(mesh)) {
shapes = collision_map[mesh];
} else if (_teststr(mesh->get_name(), "col")) {
@ -632,15 +632,15 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
}
if (shapes.size()) {
StaticBody *col = memnew(StaticBody);
StaticBody3D *col = memnew(StaticBody3D);
col->set_name("static_collision");
p_node->add_child(col);
col->set_owner(p_node->get_owner());
int idx = 0;
for (List<Ref<Shape>>::Element *E = shapes.front(); E; E = E->next()) {
for (List<Ref<Shape3D>>::Element *E = shapes.front(); E; E = E->next()) {
CollisionShape *cshape = memnew(CollisionShape);
CollisionShape3D *cshape = memnew(CollisionShape3D);
cshape->set_shape(E->get());
col->add_child(cshape);
@ -934,14 +934,14 @@ void ResourceImporterScene::_find_meshes(Node *p_node, Map<Ref<ArrayMesh>, Trans
List<PropertyInfo> pi;
p_node->get_property_list(&pi);
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(p_node);
if (mi) {
Ref<ArrayMesh> mesh = mi->get_mesh();
if (mesh.is_valid() && !meshes.has(mesh)) {
Spatial *s = mi;
Node3D *s = mi;
Transform transform;
while (s) {
transform = transform * s->get_transform();
@ -1141,7 +1141,7 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, int p_preset) const {
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "nodes/root_type", PROPERTY_HINT_TYPE_STRING, "Node"), "Spatial"));
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "nodes/root_type", PROPERTY_HINT_TYPE_STRING, "Node"), "Node3D"));
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "nodes/root_name"), "Scene Root"));
List<String> script_extentions;
@ -1333,7 +1333,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
root_type = ScriptServer::get_global_class_base(root_type);
}
if (root_type != "Spatial") {
if (root_type != "Node3D") {
Node *base_node = Object::cast_to<Node>(ClassDB::instance(root_type));
if (base_node) {
@ -1348,9 +1348,9 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
scene->set_script(Variant(root_script));
}
if (Object::cast_to<Spatial>(scene)) {
if (Object::cast_to<Node3D>(scene)) {
float root_scale = p_options["nodes/root_scale"];
Object::cast_to<Spatial>(scene)->scale(Vector3(root_scale, root_scale, root_scale));
Object::cast_to<Node3D>(scene)->scale(Vector3(root_scale, root_scale, root_scale));
}
if (p_options["nodes/root_name"] != "Scene Root")
@ -1368,7 +1368,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
float anim_optimizer_maxang = p_options["animation/optimizer/max_angle"];
int light_bake_mode = p_options["meshes/light_baking"];
Map<Ref<Mesh>, List<Ref<Shape>>> collision_map;
Map<Ref<Mesh>, List<Ref<Shape3D>>> collision_map;
scene = _fix_node(scene, scene, collision_map, LightBakeMode(light_bake_mode));

View file

@ -34,7 +34,7 @@
#include "core/io/resource_importer.h"
#include "scene/resources/animation.h"
#include "scene/resources/mesh.h"
#include "scene/resources/shape.h"
#include "scene/resources/shape_3d.h"
class Material;
@ -147,7 +147,7 @@ public:
void _make_external_resources(Node *p_node, const String &p_base_path, bool p_make_animations, bool p_animations_as_text, bool p_keep_animations, bool p_make_materials, bool p_materials_as_text, bool p_keep_materials, bool p_make_meshes, bool p_meshes_as_text, Map<Ref<Animation>, Ref<Animation>> &p_animations, Map<Ref<Material>, Ref<Material>> &p_materials, Map<Ref<ArrayMesh>, Ref<ArrayMesh>> &p_meshes);
Node *_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>, List<Ref<Shape>>> &collision_map, LightBakeMode p_light_bake_mode);
Node *_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>, List<Ref<Shape3D>>> &collision_map, LightBakeMode p_light_bake_mode);
void _create_clips(Node *scene, const Array &p_clips, bool p_bake_all);
void _filter_anim_tracks(Ref<Animation> anim, Set<String> &keep);

View file

@ -310,7 +310,7 @@ void InspectorDock::_property_keyed(const String &p_keyed, const Variant &p_valu
}
void InspectorDock::_transform_keyed(Object *sp, const String &p_sub, const Transform &p_key) {
Spatial *s = Object::cast_to<Spatial>(sp);
Node3D *s = Object::cast_to<Node3D>(sp);
if (!s)
return;
AnimationPlayerEditor::singleton->get_track_editor()->insert_transform_key(s, p_sub, p_key);

View file

@ -619,7 +619,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
String concat = path.get_concatenated_subnames();
Skeleton *skeleton = Object::cast_to<Skeleton>(node);
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(node);
if (skeleton && skeleton->find_bone(concat) != -1) {
//path in skeleton
const String &bone = concat;
@ -643,7 +643,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
ti->set_text(0, F->get());
ti->set_selectable(0, false);
ti->set_editable(0, false);
ti->set_icon(0, get_theme_icon("BoneAttachment", "EditorIcons"));
ti->set_icon(0, get_theme_icon("BoneAttachment3D", "EditorIcons"));
} else {
ti = parenthood[accum];
}
@ -654,7 +654,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
ti->set_text(0, concat);
ti->set_checked(0, anode->is_path_filtered(path));
ti->set_icon(0, get_theme_icon("BoneAttachment", "EditorIcons"));
ti->set_icon(0, get_theme_icon("BoneAttachment3D", "EditorIcons"));
ti->set_metadata(0, path);
} else {

View file

@ -1385,9 +1385,9 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
// Hide superfluous elements that would make the overlay unnecessary cluttered.
Dictionary canvas_edit_state;
Dictionary spatial_edit_state;
if (SpatialEditor::get_singleton()->is_visible()) {
if (Node3DEditor::get_singleton()->is_visible()) {
// 3D
spatial_edit_state = SpatialEditor::get_singleton()->get_state();
spatial_edit_state = Node3DEditor::get_singleton()->get_state();
Dictionary new_state = spatial_edit_state.duplicate();
new_state["show_grid"] = false;
new_state["show_origin"] = false;
@ -1404,7 +1404,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
}
new_state["viewports"] = vp;
// TODO: Save/restore only affected entries.
SpatialEditor::get_singleton()->set_state(new_state);
Node3DEditor::get_singleton()->set_state(new_state);
} else { // CanvasItemEditor
// 2D
canvas_edit_state = CanvasItemEditor::get_singleton()->get_state();
@ -1465,7 +1465,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
onion.captures_valid.write[cidx] = valid;
if (valid) {
player->seek(pos, true);
get_tree()->flush_transform_notifications(); // Needed for transforms of Spatials.
get_tree()->flush_transform_notifications(); // Needed for transforms of Node3Ds.
values_backup.update_skeletons(); // Needed for Skeletons (2D & 3D).
VS::get_singleton()->viewport_set_active(onion.captures[cidx], true);
@ -1489,9 +1489,9 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
player->restore_animated_values(values_backup);
// Restore state of main editors.
if (SpatialEditor::get_singleton()->is_visible()) {
if (Node3DEditor::get_singleton()->is_visible()) {
// 3D
SpatialEditor::get_singleton()->set_state(spatial_edit_state);
Node3DEditor::get_singleton()->set_state(spatial_edit_state);
} else { // CanvasItemEditor
// 2D
CanvasItemEditor::get_singleton()->set_state(canvas_edit_state);

View file

@ -36,7 +36,7 @@ void CameraEditor::_node_removed(Node *p_node) {
if (p_node == node) {
node = NULL;
SpatialEditor::get_singleton()->set_custom_camera(NULL);
Node3DEditor::get_singleton()->set_custom_camera(NULL);
hide();
}
}
@ -44,7 +44,7 @@ void CameraEditor::_node_removed(Node *p_node) {
void CameraEditor::_pressed() {
Node *sn = (node && preview->is_pressed()) ? node : NULL;
SpatialEditor::get_singleton()->set_custom_camera(sn);
Node3DEditor::get_singleton()->set_custom_camera(sn);
}
void CameraEditor::_bind_methods() {
@ -56,13 +56,13 @@ void CameraEditor::edit(Node *p_camera) {
if (!node) {
preview->set_pressed(false);
SpatialEditor::get_singleton()->set_custom_camera(NULL);
Node3DEditor::get_singleton()->set_custom_camera(NULL);
} else {
if (preview->is_pressed())
SpatialEditor::get_singleton()->set_custom_camera(p_camera);
Node3DEditor::get_singleton()->set_custom_camera(p_camera);
else
SpatialEditor::get_singleton()->set_custom_camera(NULL);
Node3DEditor::get_singleton()->set_custom_camera(NULL);
}
}
@ -84,21 +84,21 @@ CameraEditor::CameraEditor() {
void CameraEditorPlugin::edit(Object *p_object) {
SpatialEditor::get_singleton()->set_can_preview(Object::cast_to<Camera>(p_object));
Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera3D>(p_object));
//camera_editor->edit(Object::cast_to<Node>(p_object));
}
bool CameraEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("Camera");
return p_object->is_class("Camera3D");
}
void CameraEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
//SpatialEditor::get_singleton()->set_can_preview(Object::cast_to<Camera>(p_object));
//Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera>(p_object));
} else {
SpatialEditor::get_singleton()->set_can_preview(NULL);
Node3DEditor::get_singleton()->set_can_preview(NULL);
}
}

View file

@ -33,7 +33,7 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/camera.h"
#include "scene/3d/camera_3d.h"
class CameraEditor : public Control {
@ -62,7 +62,7 @@ class CameraEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
virtual String get_name() const { return "Camera"; }
virtual String get_name() const { return "Camera3D"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const;

View file

@ -44,7 +44,7 @@
#include "scene/2d/particles_2d.h"
#include "scene/2d/polygon_2d.h"
#include "scene/2d/skeleton_2d.h"
#include "scene/2d/sprite.h"
#include "scene/2d/sprite_2d.h"
#include "scene/2d/touch_screen_button.h"
#include "scene/gui/grid_container.h"
#include "scene/gui/nine_patch_rect.h"
@ -5888,7 +5888,7 @@ void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) cons
Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
if (texture != NULL || scene != NULL) {
if (texture != NULL) {
Sprite *sprite = memnew(Sprite);
Sprite2D *sprite = memnew(Sprite2D);
sprite->set_texture(texture);
sprite->set_modulate(Color(1, 1, 1, 0.7f));
preview_node->add_child(sprite);
@ -6094,7 +6094,7 @@ void CanvasItemEditorViewport::_perform_drop_data() {
else if (default_type == "NinePatchRect")
child = memnew(NinePatchRect);
else
child = memnew(Sprite); // default
child = memnew(Sprite2D); // default
_create_nodes(target_node, child, path, drop_pos);
}

View file

@ -35,7 +35,7 @@
#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "editor/editor_settings.h"
#include "scene/3d/camera.h"
#include "scene/3d/camera_3d.h"
#include "spatial_editor_plugin.h"
void Polygon3DEditor::_notification(int p_what) {
@ -109,7 +109,7 @@ void Polygon3DEditor::_wip_close() {
undo_redo->commit_action();
}
bool Polygon3DEditor::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) {
bool Polygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
if (!node)
return false;
@ -346,10 +346,10 @@ bool Polygon3DEditor::forward_spatial_gui_input(Camera *p_camera, const Ref<Inpu
snap_ignore = false;
}
if (!snap_ignore && SpatialEditor::get_singleton()->is_snap_enabled()) {
if (!snap_ignore && Node3DEditor::get_singleton()->is_snap_enabled()) {
cpoint = cpoint.snapped(Vector2(
SpatialEditor::get_singleton()->get_translate_snap(),
SpatialEditor::get_singleton()->get_translate_snap()));
Node3DEditor::get_singleton()->get_translate_snap(),
Node3DEditor::get_singleton()->get_translate_snap()));
}
edited_point_pos = cpoint;
@ -493,7 +493,7 @@ void Polygon3DEditor::edit(Node *p_collision_polygon) {
if (p_collision_polygon) {
node = Object::cast_to<Spatial>(p_collision_polygon);
node = Object::cast_to<Node3D>(p_collision_polygon);
//Enable the pencil tool if the polygon is empty
if (Vector<Vector2>(node->call("get_polygon")).size() == 0) {
_menu_option(MODE_CREATE);
@ -540,7 +540,7 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
mode = MODE_EDIT;
wip_active = false;
imgeom = memnew(ImmediateGeometry);
imgeom = memnew(ImmediateGeometry3D);
imgeom->set_transform(Transform(Basis(), Vector3(0, 0, 0.00001)));
line_material = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
@ -560,7 +560,7 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
handle_material->set_point_size(handle->get_width());
handle_material->set_texture(StandardMaterial3D::TEXTURE_ALBEDO, handle);
pointsm = memnew(MeshInstance);
pointsm = memnew(MeshInstance3D);
imgeom->add_child(pointsm);
m.instance();
pointsm->set_mesh(m);
@ -581,7 +581,7 @@ void Polygon3DEditorPlugin::edit(Object *p_object) {
bool Polygon3DEditorPlugin::handles(Object *p_object) const {
return Object::cast_to<Spatial>(p_object) && bool(p_object->call("_is_editable_3d_polygon"));
return Object::cast_to<Node3D>(p_object) && bool(p_object->call("_is_editable_3d_polygon"));
}
void Polygon3DEditorPlugin::make_visible(bool p_visible) {
@ -599,7 +599,7 @@ Polygon3DEditorPlugin::Polygon3DEditorPlugin(EditorNode *p_node) {
editor = p_node;
collision_polygon_editor = memnew(Polygon3DEditor(p_node));
SpatialEditor::get_singleton()->add_control_to_menu_panel(collision_polygon_editor);
Node3DEditor::get_singleton()->add_control_to_menu_panel(collision_polygon_editor);
collision_polygon_editor->hide();
}

View file

@ -33,9 +33,9 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/collision_polygon.h"
#include "scene/3d/immediate_geometry.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/collision_polygon_3d.h"
#include "scene/3d/immediate_geometry_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/tool_button.h"
class CanvasItemEditor;
@ -62,9 +62,9 @@ class Polygon3DEditor : public HBoxContainer {
EditorNode *editor;
Panel *panel;
Spatial *node;
ImmediateGeometry *imgeom;
MeshInstance *pointsm;
Node3D *node;
ImmediateGeometry3D *imgeom;
MeshInstance3D *pointsm;
Ref<ArrayMesh> m;
MenuButton *options;
@ -90,7 +90,7 @@ protected:
static void _bind_methods();
public:
virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event);
virtual bool forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event);
void edit(Node *p_collision_polygon);
Polygon3DEditor(EditorNode *p_editor);
~Polygon3DEditor();
@ -104,7 +104,7 @@ class Polygon3DEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_spatial_gui_input(p_camera, p_event); }
virtual bool forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_spatial_gui_input(p_camera, p_event); }
virtual String get_name() const { return "Polygon3DEditor"; }
bool has_main_screen() const { return false; }

View file

@ -65,7 +65,7 @@ void CPUParticlesEditor::_menu_option(int p_option) {
}
}
void CPUParticlesEditor::edit(CPUParticles *p_particles) {
void CPUParticlesEditor::edit(CPUParticles3D *p_particles) {
base_node = p_particles;
node = p_particles;
@ -82,10 +82,10 @@ void CPUParticlesEditor::_generate_emission_points() {
}
if (normals.size() == 0) {
node->set_emission_shape(CPUParticles::EMISSION_SHAPE_POINTS);
node->set_emission_shape(CPUParticles3D::EMISSION_SHAPE_POINTS);
node->set_emission_points(points);
} else {
node->set_emission_shape(CPUParticles::EMISSION_SHAPE_DIRECTED_POINTS);
node->set_emission_shape(CPUParticles3D::EMISSION_SHAPE_DIRECTED_POINTS);
node->set_emission_points(points);
node->set_emission_normals(normals);
}
@ -97,7 +97,7 @@ void CPUParticlesEditor::_bind_methods() {
CPUParticlesEditor::CPUParticlesEditor() {
particles_editor_hb = memnew(HBoxContainer);
SpatialEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb);
Node3DEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb);
options = memnew(MenuButton);
options->set_switch_on_hover(true);
particles_editor_hb->add_child(options);
@ -112,12 +112,12 @@ CPUParticlesEditor::CPUParticlesEditor() {
void CPUParticlesEditorPlugin::edit(Object *p_object) {
particles_editor->edit(Object::cast_to<CPUParticles>(p_object));
particles_editor->edit(Object::cast_to<CPUParticles3D>(p_object));
}
bool CPUParticlesEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("CPUParticles");
return p_object->is_class("CPUParticles3D");
}
void CPUParticlesEditorPlugin::make_visible(bool p_visible) {

View file

@ -32,7 +32,7 @@
#define CPU_PARTICLES_EDITOR_PLUGIN_H
#include "editor/plugins/particles_editor_plugin.h"
#include "scene/3d/cpu_particles.h"
#include "scene/3d/cpu_particles_3d.h"
class CPUParticlesEditor : public ParticlesEditorBase {
@ -46,7 +46,7 @@ class CPUParticlesEditor : public ParticlesEditorBase {
};
CPUParticles *node;
CPUParticles3D *node;
void _menu_option(int);
@ -60,7 +60,7 @@ protected:
static void _bind_methods();
public:
void edit(CPUParticles *p_particles);
void edit(CPUParticles3D *p_particles);
CPUParticlesEditor();
};

View file

@ -123,25 +123,25 @@ MaterialEditor::MaterialEditor() {
viewport->set_transparent_background(true);
viewport->set_msaa(Viewport::MSAA_4X);
camera = memnew(Camera);
camera = memnew(Camera3D);
camera->set_transform(Transform(Basis(), Vector3(0, 0, 3)));
camera->set_perspective(45, 0.1, 10);
camera->make_current();
viewport->add_child(camera);
light1 = memnew(DirectionalLight);
light1 = memnew(DirectionalLight3D);
light1->set_transform(Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
viewport->add_child(light1);
light2 = memnew(DirectionalLight);
light2 = memnew(DirectionalLight3D);
light2->set_transform(Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
light2->set_color(Color(0.7, 0.7, 0.7));
viewport->add_child(light2);
sphere_instance = memnew(MeshInstance);
sphere_instance = memnew(MeshInstance3D);
viewport->add_child(sphere_instance);
box_instance = memnew(MeshInstance);
box_instance = memnew(MeshInstance3D);
viewport->add_child(box_instance);
Transform box_xform;

View file

@ -36,9 +36,9 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/camera.h"
#include "scene/3d/light.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/light_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/resources/material.h"
class ViewportContainer;
@ -49,11 +49,11 @@ class MaterialEditor : public Control {
ViewportContainer *vc;
SubViewport *viewport;
MeshInstance *sphere_instance;
MeshInstance *box_instance;
DirectionalLight *light1;
DirectionalLight *light2;
Camera *camera;
MeshInstance3D *sphere_instance;
MeshInstance3D *box_instance;
DirectionalLight3D *light1;
DirectionalLight3D *light2;
Camera3D *camera;
Ref<SphereMesh> sphere_mesh;
Ref<CubeMesh> box_mesh;

View file

@ -123,23 +123,23 @@ MeshEditor::MeshEditor() {
viewport->set_disable_input(true);
viewport->set_msaa(Viewport::MSAA_2X);
set_stretch(true);
camera = memnew(Camera);
camera = memnew(Camera3D);
camera->set_transform(Transform(Basis(), Vector3(0, 0, 1.1)));
camera->set_perspective(45, 0.1, 10);
viewport->add_child(camera);
light1 = memnew(DirectionalLight);
light1 = memnew(DirectionalLight3D);
light1->set_transform(Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
viewport->add_child(light1);
light2 = memnew(DirectionalLight);
light2 = memnew(DirectionalLight3D);
light2->set_transform(Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
light2->set_color(Color(0.7, 0.7, 0.7));
viewport->add_child(light2);
rotation = memnew(Spatial);
rotation = memnew(Node3D);
viewport->add_child(rotation);
mesh_instance = memnew(MeshInstance);
mesh_instance = memnew(MeshInstance3D);
rotation->add_child(mesh_instance);
set_custom_minimum_size(Size2(1, 150) * EDSCALE);

View file

@ -33,9 +33,9 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/camera.h"
#include "scene/3d/light.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/light_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/viewport_container.h"
#include "scene/resources/material.h"
@ -47,11 +47,11 @@ class MeshEditor : public ViewportContainer {
float rot_y;
SubViewport *viewport;
MeshInstance *mesh_instance;
Spatial *rotation;
DirectionalLight *light1;
DirectionalLight *light2;
Camera *camera;
MeshInstance3D *mesh_instance;
Node3D *rotation;
DirectionalLight3D *light1;
DirectionalLight3D *light2;
Camera3D *camera;
Ref<Mesh> mesh;

View file

@ -31,9 +31,9 @@
#include "mesh_instance_editor_plugin.h"
#include "editor/editor_scale.h"
#include "scene/3d/collision_shape.h"
#include "scene/3d/navigation_region.h"
#include "scene/3d/physics_body.h"
#include "scene/3d/collision_shape_3d.h"
#include "scene/3d/navigation_region_3d.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/gui/box_container.h"
#include "spatial_editor_plugin.h"
@ -45,7 +45,7 @@ void MeshInstanceEditor::_node_removed(Node *p_node) {
}
}
void MeshInstanceEditor::edit(MeshInstance *p_mesh) {
void MeshInstanceEditor::edit(MeshInstance3D *p_mesh) {
node = p_mesh;
}
@ -68,16 +68,16 @@ void MeshInstanceEditor::_menu_option(int p_option) {
List<Node *> selection = editor_selection->get_selected_node_list();
if (selection.empty()) {
Ref<Shape> shape = mesh->create_trimesh_shape();
Ref<Shape3D> shape = mesh->create_trimesh_shape();
if (shape.is_null()) {
err_dialog->set_text(TTR("Couldn't create a Trimesh collision shape."));
err_dialog->popup_centered();
return;
}
CollisionShape *cshape = memnew(CollisionShape);
CollisionShape3D *cshape = memnew(CollisionShape3D);
cshape->set_shape(shape);
StaticBody *body = memnew(StaticBody);
StaticBody3D *body = memnew(StaticBody3D);
body->add_child(cshape);
Node *owner = node == get_tree()->get_edited_scene_root() ? node : node->get_owner();
@ -96,7 +96,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
MeshInstance *instance = Object::cast_to<MeshInstance>(E->get());
MeshInstance3D *instance = Object::cast_to<MeshInstance3D>(E->get());
if (!instance)
continue;
@ -104,13 +104,13 @@ void MeshInstanceEditor::_menu_option(int p_option) {
if (m.is_null())
continue;
Ref<Shape> shape = m->create_trimesh_shape();
Ref<Shape3D> shape = m->create_trimesh_shape();
if (shape.is_null())
continue;
CollisionShape *cshape = memnew(CollisionShape);
CollisionShape3D *cshape = memnew(CollisionShape3D);
cshape->set_shape(shape);
StaticBody *body = memnew(StaticBody);
StaticBody3D *body = memnew(StaticBody3D);
body->add_child(cshape);
Node *owner = instance == get_tree()->get_edited_scene_root() ? instance : instance->get_owner();
@ -134,11 +134,11 @@ void MeshInstanceEditor::_menu_option(int p_option) {
return;
}
Ref<Shape> shape = mesh->create_trimesh_shape();
Ref<Shape3D> shape = mesh->create_trimesh_shape();
if (shape.is_null())
return;
CollisionShape *cshape = memnew(CollisionShape);
CollisionShape3D *cshape = memnew(CollisionShape3D);
cshape->set_shape(shape);
Node *owner = node->get_owner();
@ -162,7 +162,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
return;
}
Ref<Shape> shape = mesh->create_convex_shape();
Ref<Shape3D> shape = mesh->create_convex_shape();
if (shape.is_null()) {
err_dialog->set_text(TTR("Couldn't create a single convex collision shape."));
@ -173,7 +173,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
ur->create_action(TTR("Create Single Convex Shape"));
CollisionShape *cshape = memnew(CollisionShape);
CollisionShape3D *cshape = memnew(CollisionShape3D);
cshape->set_shape(shape);
cshape->set_transform(node->get_transform());
@ -196,7 +196,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
return;
}
Vector<Ref<Shape>> shapes = mesh->convex_decompose();
Vector<Ref<Shape3D>> shapes = mesh->convex_decompose();
if (!shapes.size()) {
err_dialog->set_text(TTR("Couldn't create any collision shapes."));
@ -209,7 +209,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
for (int i = 0; i < shapes.size(); i++) {
CollisionShape *cshape = memnew(CollisionShape);
CollisionShape3D *cshape = memnew(CollisionShape3D);
cshape->set_shape(shapes[i]);
cshape->set_transform(node->get_transform());
@ -233,7 +233,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
return;
nmesh->create_from_mesh(mesh);
NavigationRegion *nmi = memnew(NavigationRegion);
NavigationRegion3D *nmi = memnew(NavigationRegion3D);
nmi->set_navigation_mesh(nmesh);
Node *owner = node == get_tree()->get_edited_scene_root() ? node : node->get_owner();
@ -415,7 +415,7 @@ void MeshInstanceEditor::_create_outline_mesh() {
return;
}
MeshInstance *mi = memnew(MeshInstance);
MeshInstance3D *mi = memnew(MeshInstance3D);
mi->set_mesh(mesho);
Node *owner = node->get_owner();
if (get_tree()->get_edited_scene_root() == node) {
@ -441,10 +441,10 @@ MeshInstanceEditor::MeshInstanceEditor() {
options = memnew(MenuButton);
options->set_switch_on_hover(true);
SpatialEditor::get_singleton()->add_control_to_menu_panel(options);
Node3DEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text(TTR("Mesh"));
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MeshInstance", "EditorIcons"));
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MeshInstance3D", "EditorIcons"));
options->get_popup()->add_item(TTR("Create Trimesh Static Body"), MENU_OPTION_CREATE_STATIC_TRIMESH_BODY);
options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a StaticBody and assigns a polygon-based collision shape to it automatically.\nThis is the most accurate (but slowest) option for collision detection."));
@ -459,7 +459,7 @@ MeshInstanceEditor::MeshInstanceEditor() {
options->get_popup()->add_item(TTR("Create Navigation Mesh"), MENU_OPTION_CREATE_NAVMESH);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Create Outline Mesh..."), MENU_OPTION_CREATE_OUTLINE_MESH);
options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a static outline mesh. The outline mesh will have its normals flipped automatically.\nThis can be used instead of the SpatialMaterial Grow property when using that property isn't possible."));
options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a static outline mesh. The outline mesh will have its normals flipped automatically.\nThis can be used instead of the StandardMaterial Grow property when using that property isn't possible."));
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("View UV1"), MENU_OPTION_DEBUG_UV1);
options->get_popup()->add_item(TTR("View UV2"), MENU_OPTION_DEBUG_UV2);
@ -499,12 +499,12 @@ MeshInstanceEditor::MeshInstanceEditor() {
void MeshInstanceEditorPlugin::edit(Object *p_object) {
mesh_editor->edit(Object::cast_to<MeshInstance>(p_object));
mesh_editor->edit(Object::cast_to<MeshInstance3D>(p_object));
}
bool MeshInstanceEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("MeshInstance");
return p_object->is_class("MeshInstance3D");
}
void MeshInstanceEditorPlugin::make_visible(bool p_visible) {

View file

@ -33,7 +33,7 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/spin_box.h"
class MeshInstanceEditor : public Control {
@ -53,7 +53,7 @@ class MeshInstanceEditor : public Control {
MENU_OPTION_DEBUG_UV2,
};
MeshInstance *node;
MeshInstance3D *node;
MenuButton *options;
@ -79,7 +79,7 @@ protected:
static void _bind_methods();
public:
void edit(MeshInstance *p_mesh);
void edit(MeshInstance3D *p_mesh);
MeshInstanceEditor();
};
@ -91,7 +91,7 @@ class MeshInstanceEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
virtual String get_name() const { return "MeshInstance"; }
virtual String get_name() const { return "MeshInstance3D"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const;

View file

@ -33,9 +33,9 @@
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "main/main.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/navigation_region.h"
#include "scene/3d/physics_body.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/navigation_region_3d.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/main/window.h"
#include "scene/resources/packed_scene.h"
#include "spatial_editor_plugin.h"
@ -71,16 +71,16 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
if (!p_merge)
p_library->clear();
Map<int, MeshInstance *> mesh_instances;
Map<int, MeshInstance3D *> mesh_instances;
for (int i = 0; i < p_scene->get_child_count(); i++) {
Node *child = p_scene->get_child(i);
if (!Object::cast_to<MeshInstance>(child)) {
if (!Object::cast_to<MeshInstance3D>(child)) {
if (child->get_child_count() > 0) {
child = child->get_child(0);
if (!Object::cast_to<MeshInstance>(child)) {
if (!Object::cast_to<MeshInstance3D>(child)) {
continue;
}
@ -88,7 +88,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
continue;
}
MeshInstance *mi = Object::cast_to<MeshInstance>(child);
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(child);
Ref<Mesh> mesh = mi->get_mesh();
if (mesh.is_null())
continue;
@ -118,10 +118,10 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
for (int j = 0; j < mi->get_child_count(); j++) {
Node *child2 = mi->get_child(j);
if (!Object::cast_to<StaticBody>(child2))
if (!Object::cast_to<StaticBody3D>(child2))
continue;
StaticBody *sb = Object::cast_to<StaticBody>(child2);
StaticBody3D *sb = Object::cast_to<StaticBody3D>(child2);
List<uint32_t> shapes;
sb->get_shape_owners(&shapes);
@ -135,7 +135,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
for (int k = 0; k < sb->shape_owner_get_shape_count(E->get()); k++) {
Ref<Shape> collision = sb->shape_owner_get_shape(E->get(), k);
Ref<Shape3D> collision = sb->shape_owner_get_shape(E->get(), k);
if (!collision.is_valid())
continue;
MeshLibrary::ShapeData shape_data;
@ -152,9 +152,9 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
Transform navmesh_transform;
for (int j = 0; j < mi->get_child_count(); j++) {
Node *child2 = mi->get_child(j);
if (!Object::cast_to<NavigationRegion>(child2))
if (!Object::cast_to<NavigationRegion3D>(child2))
continue;
NavigationRegion *sb = Object::cast_to<NavigationRegion>(child2);
NavigationRegion3D *sb = Object::cast_to<NavigationRegion3D>(child2);
navmesh = sb->get_navigation_mesh();
navmesh_transform = sb->get_transform();
if (!navmesh.is_null())
@ -267,7 +267,7 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) {
file->connect("file_selected", callable_mp(this, &MeshLibraryEditor::_import_scene_cbk));
menu = memnew(MenuButton);
SpatialEditor::get_singleton()->add_control_to_menu_panel(menu);
Node3DEditor::get_singleton()->add_control_to_menu_panel(menu);
menu->set_position(Point2(1, 1));
menu->set_text(TTR("Mesh Library"));
menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MeshLibrary", "EditorIcons"));

View file

@ -30,7 +30,7 @@
#include "multimesh_editor_plugin.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/box_container.h"
#include "spatial_editor_plugin.h"
@ -78,7 +78,7 @@ void MultiMeshEditor::_populate() {
return;
}
MeshInstance *ms_instance = Object::cast_to<MeshInstance>(ms_node);
MeshInstance3D *ms_instance = Object::cast_to<MeshInstance3D>(ms_node);
if (!ms_instance) {
@ -113,7 +113,7 @@ void MultiMeshEditor::_populate() {
return;
}
GeometryInstance *ss_instance = Object::cast_to<MeshInstance>(ss_node);
GeometryInstance3D *ss_instance = Object::cast_to<MeshInstance3D>(ss_node);
if (!ss_instance) {
@ -124,7 +124,7 @@ void MultiMeshEditor::_populate() {
Transform geom_xform = node->get_global_transform().affine_inverse() * ss_instance->get_global_transform();
Vector<Face3> geometry = ss_instance->get_faces(VisualInstance::FACES_SOLID);
Vector<Face3> geometry = ss_instance->get_faces(VisualInstance3D::FACES_SOLID);
if (geometry.size() == 0) {
@ -261,7 +261,7 @@ void MultiMeshEditor::_menu_option(int p_option) {
}
}
void MultiMeshEditor::edit(MultiMeshInstance *p_multimesh) {
void MultiMeshEditor::edit(MultiMeshInstance3D *p_multimesh) {
node = p_multimesh;
}
@ -284,7 +284,7 @@ MultiMeshEditor::MultiMeshEditor() {
options = memnew(MenuButton);
options->set_switch_on_hover(true);
SpatialEditor::get_singleton()->add_control_to_menu_panel(options);
Node3DEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text("MultiMesh");
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MultiMeshInstance", "EditorIcons"));
@ -379,12 +379,12 @@ MultiMeshEditor::MultiMeshEditor() {
void MultiMeshEditorPlugin::edit(Object *p_object) {
multimesh_editor->edit(Object::cast_to<MultiMeshInstance>(p_object));
multimesh_editor->edit(Object::cast_to<MultiMeshInstance3D>(p_object));
}
bool MultiMeshEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("MultiMeshInstance");
return p_object->is_class("MultiMeshInstance3D");
}
void MultiMeshEditorPlugin::make_visible(bool p_visible) {

View file

@ -33,7 +33,7 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/multimesh_instance.h"
#include "scene/3d/multimesh_instance_3d.h"
#include "scene/gui/spin_box.h"
class MultiMeshEditor : public Control {
@ -44,11 +44,11 @@ class MultiMeshEditor : public Control {
AcceptDialog *err_dialog;
MenuButton *options;
MultiMeshInstance *_last_pp_node;
MultiMeshInstance3D *_last_pp_node;
bool browsing_source;
Panel *panel;
MultiMeshInstance *node;
MultiMeshInstance3D *node;
LineEdit *surface_source;
LineEdit *mesh_source;
@ -78,7 +78,7 @@ protected:
static void _bind_methods();
public:
void edit(MultiMeshInstance *p_multimesh);
void edit(MultiMeshInstance3D *p_multimesh);
MultiMeshEditor();
};

View file

@ -43,7 +43,7 @@ void Particles2DEditorPlugin::edit(Object *p_object) {
bool Particles2DEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("Particles2D");
return p_object->is_class("GPUParticles2D");
}
void Particles2DEditorPlugin::make_visible(bool p_visible) {

View file

@ -32,7 +32,7 @@
#include "core/io/resource_loader.h"
#include "editor/plugins/spatial_editor_plugin.h"
#include "scene/3d/cpu_particles.h"
#include "scene/3d/cpu_particles_3d.h"
#include "scene/resources/particles_material.h"
bool ParticlesEditorBase::_generate(Vector<Vector3> &points, Vector<Vector3> &normals) {
@ -167,20 +167,20 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) {
if (!sel)
return;
if (!sel->is_class("Spatial")) {
if (!sel->is_class("Node3D")) {
EditorNode::get_singleton()->show_warning(vformat(TTR("\"%s\" doesn't inherit from Spatial."), sel->get_name()));
EditorNode::get_singleton()->show_warning(vformat(TTR("\"%s\" doesn't inherit from Node3D."), sel->get_name()));
return;
}
VisualInstance *vi = Object::cast_to<VisualInstance>(sel);
VisualInstance3D *vi = Object::cast_to<VisualInstance3D>(sel);
if (!vi) {
EditorNode::get_singleton()->show_warning(vformat(TTR("\"%s\" doesn't contain geometry."), sel->get_name()));
return;
}
geometry = vi->get_faces(VisualInstance::FACES_SOLID);
geometry = vi->get_faces(VisualInstance3D::FACES_SOLID);
if (geometry.size() == 0) {
@ -274,7 +274,7 @@ void ParticlesEditor::_menu_option(int p_option) {
} break;
case MENU_OPTION_CONVERT_TO_CPU_PARTICLES: {
CPUParticles *cpu_particles = memnew(CPUParticles);
CPUParticles3D *cpu_particles = memnew(CPUParticles3D);
cpu_particles->convert_from_particles(node);
cpu_particles->set_name(node->get_name());
cpu_particles->set_transform(node->get_transform());
@ -340,7 +340,7 @@ void ParticlesEditor::_generate_aabb() {
ur->commit_action();
}
void ParticlesEditor::edit(Particles *p_particles) {
void ParticlesEditor::edit(GPUParticles3D *p_particles) {
base_node = p_particles;
node = p_particles;
@ -426,7 +426,7 @@ ParticlesEditor::ParticlesEditor() {
node = NULL;
particles_editor_hb = memnew(HBoxContainer);
SpatialEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb);
Node3DEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb);
options = memnew(MenuButton);
options->set_switch_on_hover(true);
particles_editor_hb->add_child(options);
@ -460,12 +460,12 @@ ParticlesEditor::ParticlesEditor() {
void ParticlesEditorPlugin::edit(Object *p_object) {
particles_editor->edit(Object::cast_to<Particles>(p_object));
particles_editor->edit(Object::cast_to<GPUParticles3D>(p_object));
}
bool ParticlesEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("Particles");
return p_object->is_class("GPUParticles3D");
}
void ParticlesEditorPlugin::make_visible(bool p_visible) {

View file

@ -33,7 +33,7 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/particles.h"
#include "scene/3d/gpu_particles_3d.h"
#include "scene/gui/spin_box.h"
class ParticlesEditorBase : public Control {
@ -41,7 +41,7 @@ class ParticlesEditorBase : public Control {
GDCLASS(ParticlesEditorBase, Control);
protected:
Spatial *base_node;
Node3D *base_node;
Panel *panel;
MenuButton *options;
HBoxContainer *particles_editor_hb;
@ -70,7 +70,7 @@ class ParticlesEditor : public ParticlesEditorBase {
ConfirmationDialog *generate_aabb;
SpinBox *generate_seconds;
Particles *node;
GPUParticles3D *node;
enum Menu {
@ -96,7 +96,7 @@ protected:
static void _bind_methods();
public:
void edit(Particles *p_particles);
void edit(GPUParticles3D *p_particles);
ParticlesEditor();
};

View file

@ -34,7 +34,7 @@
#include "scene/resources/curve.h"
#include "spatial_editor_plugin.h"
String PathSpatialGizmo::get_handle_name(int p_idx) const {
String PathNode3DGizmo::get_handle_name(int p_idx) const {
Ref<Curve3D> c = path->get_curve();
if (c.is_null())
@ -57,7 +57,7 @@ String PathSpatialGizmo::get_handle_name(int p_idx) const {
return n;
}
Variant PathSpatialGizmo::get_handle_value(int p_idx) {
Variant PathNode3DGizmo::get_handle_value(int p_idx) {
Ref<Curve3D> c = path->get_curve();
if (c.is_null())
@ -84,7 +84,7 @@ Variant PathSpatialGizmo::get_handle_value(int p_idx) {
return ofs;
}
void PathSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_point) {
void PathNode3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_point) {
Ref<Curve3D> c = path->get_curve();
if (c.is_null())
@ -104,8 +104,8 @@ void PathSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_p
if (p.intersects_ray(ray_from, ray_dir, &inters)) {
if (SpatialEditor::get_singleton()->is_snap_enabled()) {
float snap = SpatialEditor::get_singleton()->get_translate_snap();
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
float snap = Node3DEditor::get_singleton()->get_translate_snap();
inters.snap(Vector3(snap, snap, snap));
}
@ -137,8 +137,8 @@ void PathSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_p
}
Vector3 local = gi.xform(inters) - base;
if (SpatialEditor::get_singleton()->is_snap_enabled()) {
float snap = SpatialEditor::get_singleton()->get_translate_snap();
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
float snap = Node3DEditor::get_singleton()->get_translate_snap();
local.snap(Vector3(snap, snap, snap));
}
@ -154,13 +154,13 @@ void PathSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_p
}
}
void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) {
void PathNode3DGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) {
Ref<Curve3D> c = path->get_curve();
if (c.is_null())
return;
UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo();
if (p_idx < c->get_point_count()) {
@ -217,7 +217,7 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
}
}
void PathSpatialGizmo::redraw() {
void PathNode3DGizmo::redraw() {
clear();
@ -286,13 +286,13 @@ void PathSpatialGizmo::redraw() {
}
}
PathSpatialGizmo::PathSpatialGizmo(Path *p_path) {
PathNode3DGizmo::PathNode3DGizmo(Path3D *p_path) {
path = p_path;
set_spatial_node(p_path);
}
bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) {
bool PathEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
if (!path)
return false;
@ -451,7 +451,7 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp
void PathEditorPlugin::edit(Object *p_object) {
if (p_object) {
path = Object::cast_to<Path>(p_object);
path = Object::cast_to<Path3D>(p_object);
if (path) {
if (path->get_curve().is_valid()) {
@ -459,7 +459,7 @@ void PathEditorPlugin::edit(Object *p_object) {
}
}
} else {
Path *pre = path;
Path3D *pre = path;
path = NULL;
if (pre) {
pre->get_curve()->emit_signal("changed");
@ -470,7 +470,7 @@ void PathEditorPlugin::edit(Object *p_object) {
bool PathEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("Path");
return p_object->is_class("Path3D");
}
void PathEditorPlugin::make_visible(bool p_visible) {
@ -493,7 +493,7 @@ void PathEditorPlugin::make_visible(bool p_visible) {
sep->hide();
{
Path *pre = path;
Path3D *pre = path;
path = NULL;
if (pre && pre->get_curve().is_valid()) {
pre->get_curve()->emit_signal("changed");
@ -563,47 +563,47 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
mirror_handle_angle = true;
mirror_handle_length = true;
Ref<PathSpatialGizmoPlugin> gizmo_plugin;
Ref<PathNode3DGizmoPlugin> gizmo_plugin;
gizmo_plugin.instance();
SpatialEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin);
Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin);
sep = memnew(VSeparator);
sep->hide();
SpatialEditor::get_singleton()->add_control_to_menu_panel(sep);
Node3DEditor::get_singleton()->add_control_to_menu_panel(sep);
curve_edit = memnew(ToolButton);
curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveEdit", "EditorIcons"));
curve_edit->set_toggle_mode(true);
curve_edit->hide();
curve_edit->set_focus_mode(Control::FOCUS_NONE);
curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point"));
SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_edit);
Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_edit);
curve_create = memnew(ToolButton);
curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveCreate", "EditorIcons"));
curve_create->set_toggle_mode(true);
curve_create->hide();
curve_create->set_focus_mode(Control::FOCUS_NONE);
curve_create->set_tooltip(TTR("Add Point (in empty space)") + "\n" + TTR("Split Segment (in curve)"));
SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_create);
Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_create);
curve_del = memnew(ToolButton);
curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveDelete", "EditorIcons"));
curve_del->set_toggle_mode(true);
curve_del->hide();
curve_del->set_focus_mode(Control::FOCUS_NONE);
curve_del->set_tooltip(TTR("Delete Point"));
SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_del);
Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_del);
curve_close = memnew(ToolButton);
curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveClose", "EditorIcons"));
curve_close->hide();
curve_close->set_focus_mode(Control::FOCUS_NONE);
curve_close->set_tooltip(TTR("Close Curve"));
SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_close);
Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_close);
PopupMenu *menu;
handle_menu = memnew(MenuButton);
handle_menu->set_text(TTR("Options"));
handle_menu->hide();
SpatialEditor::get_singleton()->add_control_to_menu_panel(handle_menu);
Node3DEditor::get_singleton()->add_control_to_menu_panel(handle_menu);
menu = handle_menu->get_popup();
menu->add_check_item(TTR("Mirror Handle Angles"));
@ -627,24 +627,24 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
PathEditorPlugin::~PathEditorPlugin() {
}
Ref<EditorSpatialGizmo> PathSpatialGizmoPlugin::create_gizmo(Spatial *p_spatial) {
Ref<PathSpatialGizmo> ref;
Ref<EditorNode3DGizmo> PathNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) {
Ref<PathNode3DGizmo> ref;
Path *path = Object::cast_to<Path>(p_spatial);
if (path) ref = Ref<PathSpatialGizmo>(memnew(PathSpatialGizmo(path)));
Path3D *path = Object::cast_to<Path3D>(p_spatial);
if (path) ref = Ref<PathNode3DGizmo>(memnew(PathNode3DGizmo(path)));
return ref;
}
String PathSpatialGizmoPlugin::get_name() const {
String PathNode3DGizmoPlugin::get_name() const {
return "Path";
}
int PathSpatialGizmoPlugin::get_priority() const {
int PathNode3DGizmoPlugin::get_priority() const {
return -1;
}
PathSpatialGizmoPlugin::PathSpatialGizmoPlugin() {
PathNode3DGizmoPlugin::PathNode3DGizmoPlugin() {
Color path_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/path", Color(0.5, 0.5, 1.0, 0.8));
create_material("path_material", path_color);

View file

@ -32,13 +32,13 @@
#define PATH_EDITOR_PLUGIN_H
#include "editor/spatial_editor_gizmos.h"
#include "scene/3d/path.h"
#include "scene/3d/path_3d.h"
class PathSpatialGizmo : public EditorSpatialGizmo {
class PathNode3DGizmo : public EditorNode3DGizmo {
GDCLASS(PathSpatialGizmo, EditorSpatialGizmo);
GDCLASS(PathNode3DGizmo, EditorNode3DGizmo);
Path *path;
Path3D *path;
mutable Vector3 original;
mutable float orig_in_length;
mutable float orig_out_length;
@ -46,24 +46,24 @@ class PathSpatialGizmo : public EditorSpatialGizmo {
public:
virtual String get_handle_name(int p_idx) const;
virtual Variant get_handle_value(int p_idx);
virtual void set_handle(int p_idx, Camera *p_camera, const Point2 &p_point);
virtual void set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_point);
virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false);
virtual void redraw();
PathSpatialGizmo(Path *p_path = NULL);
PathNode3DGizmo(Path3D *p_path = NULL);
};
class PathSpatialGizmoPlugin : public EditorSpatialGizmoPlugin {
class PathNode3DGizmoPlugin : public EditorNode3DGizmoPlugin {
GDCLASS(PathSpatialGizmoPlugin, EditorSpatialGizmoPlugin);
GDCLASS(PathNode3DGizmoPlugin, EditorNode3DGizmoPlugin);
protected:
Ref<EditorSpatialGizmo> create_gizmo(Spatial *p_spatial);
Ref<EditorNode3DGizmo> create_gizmo(Node3D *p_spatial);
public:
String get_name() const;
int get_priority() const;
PathSpatialGizmoPlugin();
PathNode3DGizmoPlugin();
};
class PathEditorPlugin : public EditorPlugin {
@ -79,7 +79,7 @@ class PathEditorPlugin : public EditorPlugin {
EditorNode *editor;
Path *path;
Path3D *path;
void _mode_changed(int p_idx);
void _close_curve();
@ -98,13 +98,13 @@ protected:
static void _bind_methods();
public:
Path *get_edited_path() { return path; }
Path3D *get_edited_path() { return path; }
static PathEditorPlugin *singleton;
virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event);
virtual bool forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event);
//virtual bool forward_gui_input(const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
//virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
//virtual Ref<Node3DEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
virtual String get_name() const { return "Path"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);

View file

@ -30,7 +30,7 @@
#include "physical_bone_plugin.h"
#include "editor/plugins/spatial_editor_plugin.h"
#include "scene/3d/physics_body.h"
#include "scene/3d/physics_body_3d.h"
void PhysicalBoneEditor::_bind_methods() {
}
@ -53,7 +53,7 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) :
spatial_editor_hb = memnew(HBoxContainer);
spatial_editor_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
spatial_editor_hb->set_alignment(BoxContainer::ALIGN_BEGIN);
SpatialEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb);
Node3DEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb);
spatial_editor_hb->add_child(memnew(VSeparator));
@ -61,7 +61,7 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) :
spatial_editor_hb->add_child(button_transform_joint);
button_transform_joint->set_text(TTR("Move Joint"));
button_transform_joint->set_icon(SpatialEditor::get_singleton()->get_theme_icon("PhysicalBone", "EditorIcons"));
button_transform_joint->set_icon(Node3DEditor::get_singleton()->get_theme_icon("PhysicalBone", "EditorIcons"));
button_transform_joint->set_toggle_mode(true);
button_transform_joint->connect("toggled", callable_mp(this, &PhysicalBoneEditor::_on_toggle_button_transform_joint));
@ -70,7 +70,7 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) :
PhysicalBoneEditor::~PhysicalBoneEditor() {}
void PhysicalBoneEditor::set_selected(PhysicalBone *p_pb) {
void PhysicalBoneEditor::set_selected(PhysicalBone3D *p_pb) {
button_transform_joint->set_pressed(false);
@ -105,7 +105,7 @@ void PhysicalBonePlugin::make_visible(bool p_visible) {
}
void PhysicalBonePlugin::edit(Object *p_node) {
selected = static_cast<PhysicalBone *>(p_node); // Trust it
selected = static_cast<PhysicalBone3D *>(p_node); // Trust it
ERR_FAIL_COND(!selected);
physical_bone_editor.set_selected(selected);

View file

@ -40,7 +40,7 @@ class PhysicalBoneEditor : public Object {
HBoxContainer *spatial_editor_hb;
ToolButton *button_transform_joint;
PhysicalBone *selected;
PhysicalBone3D *selected;
protected:
static void _bind_methods();
@ -53,7 +53,7 @@ public:
PhysicalBoneEditor(EditorNode *p_editor);
~PhysicalBoneEditor();
void set_selected(PhysicalBone *p_pb);
void set_selected(PhysicalBone3D *p_pb);
void hide();
void show();
@ -63,12 +63,12 @@ class PhysicalBonePlugin : public EditorPlugin {
GDCLASS(PhysicalBonePlugin, EditorPlugin);
EditorNode *editor;
PhysicalBone *selected;
PhysicalBone3D *selected;
PhysicalBoneEditor physical_bone_editor;
public:
virtual String get_name() const { return "PhysicalBone"; }
virtual bool handles(Object *p_object) const { return p_object->is_class("PhysicalBone"); }
virtual String get_name() const { return "PhysicalBone3D"; }
virtual bool handles(Object *p_object) const { return p_object->is_class("PhysicalBone3D"); }
virtual void make_visible(bool p_visible);
virtual void edit(Object *p_node);

View file

@ -128,7 +128,7 @@ void EditorPropertyRootMotion::_node_assign() {
String concat = path.get_concatenated_subnames();
Skeleton *skeleton = Object::cast_to<Skeleton>(node);
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(node);
if (skeleton && skeleton->find_bone(concat) != -1) {
//path in skeleton
const String &bone = concat;
@ -152,7 +152,7 @@ void EditorPropertyRootMotion::_node_assign() {
ti->set_text(0, F->get());
ti->set_selectable(0, true);
ti->set_editable(0, false);
ti->set_icon(0, get_theme_icon("BoneAttachment", "EditorIcons"));
ti->set_icon(0, get_theme_icon("BoneAttachment3D", "EditorIcons"));
ti->set_metadata(0, accum);
} else {
ti = parenthood[accum];
@ -161,7 +161,7 @@ void EditorPropertyRootMotion::_node_assign() {
ti->set_selectable(0, true);
ti->set_text(0, concat);
ti->set_icon(0, get_theme_icon("BoneAttachment", "EditorIcons"));
ti->set_icon(0, get_theme_icon("BoneAttachment3D", "EditorIcons"));
ti->set_metadata(0, path);
if (path == current) {
ti->select(0);

View file

@ -30,11 +30,11 @@
#include "skeleton_editor_plugin.h"
#include "scene/3d/collision_shape.h"
#include "scene/3d/physics_body.h"
#include "scene/3d/physics_joint.h"
#include "scene/resources/capsule_shape.h"
#include "scene/resources/sphere_shape.h"
#include "scene/3d/collision_shape_3d.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/3d/physics_joint_3d.h"
#include "scene/resources/capsule_shape_3d.h"
#include "scene/resources/sphere_shape_3d.h"
#include "spatial_editor_plugin.h"
void SkeletonEditor::_on_click_option(int p_option) {
@ -94,25 +94,25 @@ void SkeletonEditor::create_physical_skeleton() {
/// Create joint between parent of parent
if (-1 != parent_parent) {
bones_infos[parent].physical_bone->set_joint_type(PhysicalBone::JOINT_TYPE_PIN);
bones_infos[parent].physical_bone->set_joint_type(PhysicalBone3D::JOINT_TYPE_PIN);
}
}
}
}
}
PhysicalBone *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos) {
PhysicalBone3D *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos) {
const Transform child_rest = skeleton->get_bone_rest(bone_child_id);
const real_t half_height(child_rest.origin.length() * 0.5);
const real_t radius(half_height * 0.2);
CapsuleShape *bone_shape_capsule = memnew(CapsuleShape);
CapsuleShape3D *bone_shape_capsule = memnew(CapsuleShape3D);
bone_shape_capsule->set_height((half_height - radius) * 2);
bone_shape_capsule->set_radius(radius);
CollisionShape *bone_shape = memnew(CollisionShape);
CollisionShape3D *bone_shape = memnew(CollisionShape3D);
bone_shape->set_shape(bone_shape_capsule);
Transform body_transform;
@ -122,7 +122,7 @@ PhysicalBone *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_i
Transform joint_transform;
joint_transform.origin = Vector3(0, 0, half_height);
PhysicalBone *physical_bone = memnew(PhysicalBone);
PhysicalBone3D *physical_bone = memnew(PhysicalBone3D);
physical_bone->add_child(bone_shape);
physical_bone->set_name("Physical Bone " + skeleton->get_bone_name(bone_id));
physical_bone->set_body_offset(body_transform);
@ -130,7 +130,7 @@ PhysicalBone *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_i
return physical_bone;
}
void SkeletonEditor::edit(Skeleton *p_node) {
void SkeletonEditor::edit(Skeleton3D *p_node) {
skeleton = p_node;
}
@ -155,10 +155,10 @@ void SkeletonEditor::_bind_methods() {
SkeletonEditor::SkeletonEditor() {
skeleton = NULL;
options = memnew(MenuButton);
SpatialEditor::get_singleton()->add_control_to_menu_panel(options);
Node3DEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text(TTR("Skeleton"));
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Skeleton", "EditorIcons"));
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Skeleton3D", "EditorIcons"));
options->get_popup()->add_item(TTR("Create physical skeleton"), MENU_OPTION_CREATE_PHYSICAL_SKELETON);
@ -169,11 +169,11 @@ SkeletonEditor::SkeletonEditor() {
SkeletonEditor::~SkeletonEditor() {}
void SkeletonEditorPlugin::edit(Object *p_object) {
skeleton_editor->edit(Object::cast_to<Skeleton>(p_object));
skeleton_editor->edit(Object::cast_to<Skeleton3D>(p_object));
}
bool SkeletonEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("Skeleton");
return p_object->is_class("Skeleton3D");
}
void SkeletonEditorPlugin::make_visible(bool p_visible) {

View file

@ -33,10 +33,10 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/skeleton.h"
#include "scene/3d/skeleton_3d.h"
class PhysicalBone;
class Joint;
class PhysicalBone3D;
class Joint3D;
class SkeletonEditor : public Node {
GDCLASS(SkeletonEditor, Node);
@ -46,13 +46,13 @@ class SkeletonEditor : public Node {
};
struct BoneInfo {
PhysicalBone *physical_bone;
PhysicalBone3D *physical_bone;
Transform relative_rest; // Relative to skeleton node
BoneInfo() :
physical_bone(NULL) {}
};
Skeleton *skeleton;
Skeleton3D *skeleton;
MenuButton *options;
@ -66,10 +66,10 @@ protected:
static void _bind_methods();
void create_physical_skeleton();
PhysicalBone *create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos);
PhysicalBone3D *create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos);
public:
void edit(Skeleton *p_node);
void edit(Skeleton3D *p_node);
SkeletonEditor();
~SkeletonEditor();

View file

@ -57,7 +57,7 @@ void SkeletonIKEditorPlugin::edit(Object *p_object) {
}
}
SkeletonIK *s = Object::cast_to<SkeletonIK>(p_object);
SkeletonIK3D *s = Object::cast_to<SkeletonIK3D>(p_object);
if (!s)
return;
@ -66,7 +66,7 @@ void SkeletonIKEditorPlugin::edit(Object *p_object) {
bool SkeletonIKEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("SkeletonIK");
return p_object->is_class("SkeletonIK3D");
}
void SkeletonIKEditorPlugin::make_visible(bool p_visible) {

View file

@ -34,13 +34,13 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
class SkeletonIK;
class SkeletonIK3D;
class SkeletonIKEditorPlugin : public EditorPlugin {
GDCLASS(SkeletonIKEditorPlugin, EditorPlugin);
SkeletonIK *skeleton_ik;
SkeletonIK3D *skeleton_ik;
Button *play_btn;
EditorNode *editor;

File diff suppressed because it is too large Load diff

View file

@ -34,20 +34,20 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/editor_scale.h"
#include "scene/3d/immediate_geometry.h"
#include "scene/3d/light.h"
#include "scene/3d/visual_instance.h"
#include "scene/3d/immediate_geometry_3d.h"
#include "scene/3d/light_3d.h"
#include "scene/3d/visual_instance_3d.h"
#include "scene/gui/panel_container.h"
class Camera;
class SpatialEditor;
class EditorSpatialGizmoPlugin;
class SpatialEditorViewport;
class Camera3D;
class Node3DEditor;
class EditorNode3DGizmoPlugin;
class Node3DEditorViewport;
class ViewportContainer;
class EditorSpatialGizmo : public SpatialGizmo {
class EditorNode3DGizmo : public Node3DGizmo {
GDCLASS(EditorSpatialGizmo, SpatialGizmo);
GDCLASS(EditorNode3DGizmo, Node3DGizmo);
bool selected;
bool instanced;
@ -75,7 +75,7 @@ public:
extra_margin = false;
}
void create_instance(Spatial *p_base, bool p_hidden = false);
void create_instance(Node3D *p_base, bool p_hidden = false);
};
Vector<Vector3> collision_segments;
@ -93,12 +93,12 @@ public:
bool valid;
bool hidden;
Spatial *base;
Node3D *base;
Vector<Instance> instances;
Spatial *spatial_node;
EditorSpatialGizmoPlugin *gizmo_plugin;
Node3D *spatial_node;
EditorNode3DGizmoPlugin *gizmo_plugin;
void _set_spatial_node(Node *p_node) { set_spatial_node(Object::cast_to<Spatial>(p_node)); }
void _set_spatial_node(Node *p_node) { set_spatial_node(Object::cast_to<Node3D>(p_node)); }
protected:
static void _bind_methods();
@ -115,15 +115,15 @@ public:
virtual bool is_handle_highlighted(int p_idx) const;
virtual String get_handle_name(int p_idx) const;
virtual Variant get_handle_value(int p_idx);
virtual void set_handle(int p_idx, Camera *p_camera, const Point2 &p_point);
virtual void set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_point);
virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false);
void set_spatial_node(Spatial *p_node);
Spatial *get_spatial_node() const { return spatial_node; }
Ref<EditorSpatialGizmoPlugin> get_plugin() const { return gizmo_plugin; }
void set_spatial_node(Node3D *p_node);
Node3D *get_spatial_node() const { return spatial_node; }
Ref<EditorNode3DGizmoPlugin> get_plugin() const { return gizmo_plugin; }
Vector3 get_handle_pos(int p_idx) const;
bool intersect_frustum(const Camera *p_camera, const Vector<Plane> &p_frustum);
bool intersect_ray(Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false);
bool intersect_frustum(const Camera3D *p_camera, const Vector<Plane> &p_frustum);
bool intersect_ray(Camera3D *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false);
virtual void clear();
virtual void create();
@ -134,10 +134,10 @@ public:
virtual bool is_editable() const;
void set_hidden(bool p_hidden);
void set_plugin(EditorSpatialGizmoPlugin *p_plugin);
void set_plugin(EditorNode3DGizmoPlugin *p_plugin);
EditorSpatialGizmo();
~EditorSpatialGizmo();
EditorNode3DGizmo();
~EditorNode3DGizmo();
};
class ViewportRotationControl : public Control {
@ -155,7 +155,7 @@ class ViewportRotationControl : public Control {
}
};
SpatialEditorViewport *viewport = nullptr;
Node3DEditorViewport *viewport = nullptr;
Vector<Color> axis_colors;
Vector<int> axis_menu_options;
bool orbiting = false;
@ -174,13 +174,13 @@ protected:
void _on_mouse_exited();
public:
void set_viewport(SpatialEditorViewport *p_viewport);
void set_viewport(Node3DEditorViewport *p_viewport);
};
class SpatialEditorViewport : public Control {
class Node3DEditorViewport : public Control {
GDCLASS(SpatialEditorViewport, Control);
friend class SpatialEditor;
GDCLASS(Node3DEditorViewport, Control);
friend class Node3DEditor;
friend class ViewportRotationControl;
enum {
@ -242,7 +242,7 @@ private:
String name;
void _menu_option(int p_option);
void _set_auto_orthogonal();
Spatial *preview_node;
Node3D *preview_node;
AABB *preview_bounds;
Vector<String> selected_files;
AcceptDialog *accept;
@ -263,7 +263,7 @@ private:
Control *surface;
SubViewport *viewport;
Camera *camera;
Camera3D *camera;
bool transforming;
bool orthogonal;
bool auto_orthogonal;
@ -284,7 +284,7 @@ private:
struct _RayResult {
Spatial *item;
Node3D *item;
float depth;
int handle;
_FORCE_INLINE_ bool operator<(const _RayResult &p_rr) const { return depth < p_rr.depth; }
@ -366,7 +366,7 @@ private:
int edited_gizmo;
Point2 mouse_pos;
bool snap;
Ref<EditorSpatialGizmo> gizmo;
Ref<EditorNode3DGizmo> gizmo;
int gizmo_handle;
Variant gizmo_initial_value;
Vector3 gizmo_initial_pos;
@ -418,10 +418,10 @@ private:
void _sinput(const Ref<InputEvent> &p_event);
void _update_freelook(real_t delta);
SpatialEditor *spatial_editor;
Node3DEditor *spatial_editor;
Camera *previewing;
Camera *preview;
Camera3D *previewing;
Camera3D *preview;
bool previewing_cinema;
bool _is_node_locked(const Node *p_node);
@ -436,7 +436,7 @@ private:
Point2i _get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const;
Vector3 _get_instance_position(const Point2 &p_pos) const;
static AABB _calculate_spatial_bounds(const Spatial *p_parent, bool p_exclude_toplevel_transform = true);
static AABB _calculate_spatial_bounds(const Node3D *p_parent, bool p_exclude_toplevel_transform = true);
void _create_preview(const Vector<String> &files) const;
void _remove_preview();
bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node);
@ -454,7 +454,7 @@ public:
void update_surface() { surface->update(); }
void update_transform_gizmo_view();
void set_can_preview(Camera *p_preview);
void set_can_preview(Camera3D *p_preview);
void set_state(const Dictionary &p_state);
Dictionary get_state() const;
void reset();
@ -463,19 +463,19 @@ public:
void focus_selection();
void assign_pending_data_pointers(
Spatial *p_preview_node,
Node3D *p_preview_node,
AABB *p_preview_bounds,
AcceptDialog *p_accept);
SubViewport *get_viewport_node() { return viewport; }
Camera *get_camera() { return camera; } // return the default camera object.
Camera3D *get_camera() { return camera; } // return the default camera object.
SpatialEditorViewport(SpatialEditor *p_spatial_editor, EditorNode *p_editor, int p_index);
Node3DEditorViewport(Node3DEditor *p_spatial_editor, EditorNode *p_editor, int p_index);
};
class SpatialEditorSelectedItem : public Object {
class Node3DEditorSelectedItem : public Object {
GDCLASS(SpatialEditorSelectedItem, Object);
GDCLASS(Node3DEditorSelectedItem, Object);
public:
AABB aabb;
@ -483,19 +483,19 @@ public:
Transform original_local;
Transform last_xform; // last transform
bool last_xform_dirty;
Spatial *sp;
Node3D *sp;
RID sbox_instance;
SpatialEditorSelectedItem() {
Node3DEditorSelectedItem() {
sp = NULL;
last_xform_dirty = true;
}
~SpatialEditorSelectedItem();
~Node3DEditorSelectedItem();
};
class SpatialEditorViewportContainer : public Container {
class Node3DEditorViewportContainer : public Container {
GDCLASS(SpatialEditorViewportContainer, Container);
GDCLASS(Node3DEditorViewportContainer, Container);
public:
enum View {
@ -531,12 +531,12 @@ public:
void set_view(View p_view);
View get_view();
SpatialEditorViewportContainer();
Node3DEditorViewportContainer();
};
class SpatialEditor : public VBoxContainer {
class Node3DEditor : public VBoxContainer {
GDCLASS(SpatialEditor, VBoxContainer);
GDCLASS(Node3DEditor, VBoxContainer);
public:
static const unsigned int VIEWPORTS_COUNT = 4;
@ -568,8 +568,8 @@ private:
EditorNode *editor;
EditorSelection *editor_selection;
SpatialEditorViewportContainer *viewport_base;
SpatialEditorViewport *viewports[VIEWPORTS_COUNT];
Node3DEditorViewportContainer *viewport_base;
Node3DEditorViewport *viewports[VIEWPORTS_COUNT];
VSplitContainer *shader_split;
HSplitContainer *palette_split;
@ -609,7 +609,7 @@ private:
Ref<StandardMaterial3D> cursor_material;
// Scene drag and drop support
Spatial *preview_node;
Node3D *preview_node;
AABB preview_bounds;
struct Gizmo {
@ -709,19 +709,19 @@ private:
Ref<Environment> viewport_environment;
Spatial *selected;
Node3D *selected;
void _request_gizmo(Object *p_obj);
static SpatialEditor *singleton;
static Node3DEditor *singleton;
void _node_removed(Node *p_node);
Vector<Ref<EditorSpatialGizmoPlugin>> gizmo_plugins_by_priority;
Vector<Ref<EditorSpatialGizmoPlugin>> gizmo_plugins_by_name;
Vector<Ref<EditorNode3DGizmoPlugin>> gizmo_plugins_by_priority;
Vector<Ref<EditorNode3DGizmoPlugin>> gizmo_plugins_by_name;
void _register_all_gizmos();
SpatialEditor();
Node3DEditor();
bool is_any_freelook_active() const;
@ -735,7 +735,7 @@ protected:
static void _bind_methods();
public:
static SpatialEditor *get_singleton() { return singleton; }
static Node3DEditor *get_singleton() { return singleton; }
void snap_cursor_to_plane(const Plane &p_plane);
Vector3 snap_point(Vector3 p_target, Vector3 p_start = Vector3(0, 0, 0)) const;
@ -748,7 +748,7 @@ public:
bool is_gizmo_visible() const { return gizmo.visible; }
ToolMode get_tool_mode() const { return tool_mode; }
bool are_local_coords_enabled() const { return tool_option_button[SpatialEditor::TOOL_OPT_LOCAL_COORDS]->is_pressed(); }
bool are_local_coords_enabled() const { return tool_option_button[Node3DEditor::TOOL_OPT_LOCAL_COORDS]->is_pressed(); }
bool is_snap_enabled() const { return snap_enabled ^ snap_key_enabled; }
float get_translate_snap() const;
float get_rotate_snap() const;
@ -780,33 +780,33 @@ public:
VSplitContainer *get_shader_split();
HSplitContainer *get_palette_split();
Spatial *get_selected() { return selected; }
Node3D *get_selected() { return selected; }
int get_over_gizmo_handle() const { return over_gizmo_handle; }
void set_over_gizmo_handle(int idx) { over_gizmo_handle = idx; }
void set_can_preview(Camera *p_preview);
void set_can_preview(Camera3D *p_preview);
SpatialEditorViewport *get_editor_viewport(int p_idx) {
Node3DEditorViewport *get_editor_viewport(int p_idx) {
ERR_FAIL_INDEX_V(p_idx, static_cast<int>(VIEWPORTS_COUNT), NULL);
return viewports[p_idx];
}
void add_gizmo_plugin(Ref<EditorSpatialGizmoPlugin> p_plugin);
void remove_gizmo_plugin(Ref<EditorSpatialGizmoPlugin> p_plugin);
void add_gizmo_plugin(Ref<EditorNode3DGizmoPlugin> p_plugin);
void remove_gizmo_plugin(Ref<EditorNode3DGizmoPlugin> p_plugin);
void edit(Spatial *p_spatial);
void edit(Node3D *p_spatial);
void clear();
SpatialEditor(EditorNode *p_editor);
~SpatialEditor();
Node3DEditor(EditorNode *p_editor);
~Node3DEditor();
};
class SpatialEditorPlugin : public EditorPlugin {
class Node3DEditorPlugin : public EditorPlugin {
GDCLASS(SpatialEditorPlugin, EditorPlugin);
GDCLASS(Node3DEditorPlugin, EditorPlugin);
SpatialEditor *spatial_editor;
Node3DEditor *spatial_editor;
EditorNode *editor;
protected:
@ -815,7 +815,7 @@ protected:
public:
void snap_cursor_to_plane(const Plane &p_plane);
SpatialEditor *get_spatial_editor() { return spatial_editor; }
Node3DEditor *get_spatial_editor() { return spatial_editor; }
virtual String get_name() const { return "3D"; }
bool has_main_screen() const { return true; }
virtual void make_visible(bool p_visible);
@ -828,13 +828,13 @@ public:
virtual void edited_scene_changed();
SpatialEditorPlugin(EditorNode *p_node);
~SpatialEditorPlugin();
Node3DEditorPlugin(EditorNode *p_node);
~Node3DEditorPlugin();
};
class EditorSpatialGizmoPlugin : public Resource {
class EditorNode3DGizmoPlugin : public Resource {
GDCLASS(EditorSpatialGizmoPlugin, Resource);
GDCLASS(EditorNode3DGizmoPlugin, Resource);
public:
static const int VISIBLE = 0;
@ -843,13 +843,13 @@ public:
private:
int current_state;
List<EditorSpatialGizmo *> current_gizmos;
List<EditorNode3DGizmo *> current_gizmos;
HashMap<String, Vector<Ref<StandardMaterial3D>>> materials;
protected:
static void _bind_methods();
virtual bool has_gizmo(Spatial *p_spatial);
virtual Ref<EditorSpatialGizmo> create_gizmo(Spatial *p_spatial);
virtual bool has_gizmo(Node3D *p_spatial);
virtual Ref<EditorNode3DGizmo> create_gizmo(Node3D *p_spatial);
public:
void create_material(const String &p_name, const Color &p_color, bool p_billboard = false, bool p_on_top = false, bool p_use_vertex_color = false);
@ -857,27 +857,27 @@ public:
void create_handle_material(const String &p_name, bool p_billboard = false);
void add_material(const String &p_name, Ref<StandardMaterial3D> p_material);
Ref<StandardMaterial3D> get_material(const String &p_name, const Ref<EditorSpatialGizmo> &p_gizmo = Ref<EditorSpatialGizmo>());
Ref<StandardMaterial3D> get_material(const String &p_name, const Ref<EditorNode3DGizmo> &p_gizmo = Ref<EditorNode3DGizmo>());
virtual String get_name() const;
virtual int get_priority() const;
virtual bool can_be_hidden() const;
virtual bool is_selectable_when_hidden() const;
virtual void redraw(EditorSpatialGizmo *p_gizmo);
virtual String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const;
virtual Variant get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const;
virtual void set_handle(EditorSpatialGizmo *p_gizmo, int p_idx, Camera *p_camera, const Point2 &p_point);
virtual void commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false);
virtual bool is_handle_highlighted(const EditorSpatialGizmo *p_gizmo, int p_idx) const;
virtual void redraw(EditorNode3DGizmo *p_gizmo);
virtual String get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const;
virtual Variant get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const;
virtual void set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point);
virtual void commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false);
virtual bool is_handle_highlighted(const EditorNode3DGizmo *p_gizmo, int p_idx) const;
Ref<EditorSpatialGizmo> get_gizmo(Spatial *p_spatial);
Ref<EditorNode3DGizmo> get_gizmo(Node3D *p_spatial);
void set_state(int p_state);
int get_state() const;
void unregister_gizmo(EditorSpatialGizmo *p_gizmo);
void unregister_gizmo(EditorNode3DGizmo *p_gizmo);
EditorSpatialGizmoPlugin();
virtual ~EditorSpatialGizmoPlugin();
EditorNode3DGizmoPlugin();
virtual ~EditorNode3DGizmoPlugin();
};
#endif

View file

@ -47,7 +47,7 @@ void SpriteEditor::_node_removed(Node *p_node) {
}
}
void SpriteEditor::edit(Sprite *p_sprite) {
void SpriteEditor::edit(Sprite2D *p_sprite) {
node = p_sprite;
}
@ -578,12 +578,12 @@ SpriteEditor::SpriteEditor() {
void SpriteEditorPlugin::edit(Object *p_object) {
sprite_editor->edit(Object::cast_to<Sprite>(p_object));
sprite_editor->edit(Object::cast_to<Sprite2D>(p_object));
}
bool SpriteEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("Sprite");
return p_object->is_class("Sprite2D");
}
void SpriteEditorPlugin::make_visible(bool p_visible) {

View file

@ -33,7 +33,7 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/sprite.h"
#include "scene/2d/sprite_2d.h"
#include "scene/gui/spin_box.h"
class SpriteEditor : public Control {
@ -49,7 +49,7 @@ class SpriteEditor : public Control {
Menu selected_menu_item;
Sprite *node;
Sprite2D *node;
MenuButton *options;
@ -92,7 +92,7 @@ protected:
static void _bind_methods();
public:
void edit(Sprite *p_sprite);
void edit(Sprite2D *p_sprite);
SpriteEditor();
};

View file

@ -485,7 +485,7 @@ static void _find_anim_sprites(Node *p_node, List<Node *> *r_nodes, Ref<SpriteFr
return;
{
AnimatedSprite *as = Object::cast_to<AnimatedSprite>(p_node);
AnimatedSprite2D *as = Object::cast_to<AnimatedSprite2D>(p_node);
if (as && as->get_sprite_frames() == p_sfames) {
r_nodes->push_back(p_node);
}
@ -1068,11 +1068,17 @@ void SpriteFramesEditorPlugin::edit(Object *p_object) {
frames_editor->set_undo_redo(&get_undo_redo());
SpriteFrames *s;
AnimatedSprite *animated_sprite = Object::cast_to<AnimatedSprite>(p_object);
AnimatedSprite2D *animated_sprite = Object::cast_to<AnimatedSprite2D>(p_object);
if (animated_sprite) {
s = *animated_sprite->get_sprite_frames();
} else {
s = Object::cast_to<SpriteFrames>(p_object);
AnimatedSprite3D *animated_sprite_3d = Object::cast_to<AnimatedSprite3D>(p_object);
if (animated_sprite_3d) {
s = *animated_sprite_3d->get_sprite_frames();
} else {
s = Object::cast_to<SpriteFrames>(p_object);
}
}
frames_editor->edit(s);
@ -1080,9 +1086,12 @@ void SpriteFramesEditorPlugin::edit(Object *p_object) {
bool SpriteFramesEditorPlugin::handles(Object *p_object) const {
AnimatedSprite *animated_sprite = Object::cast_to<AnimatedSprite>(p_object);
AnimatedSprite2D *animated_sprite = Object::cast_to<AnimatedSprite2D>(p_object);
AnimatedSprite3D *animated_sprite_3d = Object::cast_to<AnimatedSprite3D>(p_object);
if (animated_sprite && *animated_sprite->get_sprite_frames()) {
return true;
} else if (animated_sprite_3d && *animated_sprite_3d->get_sprite_frames()) {
return true;
} else {
return p_object->is_class("SpriteFrames");
}

Some files were not shown because too many files have changed in this diff Show more