Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make 2D and 3D node names more explicit #37340

Merged
merged 3 commits into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion editor/animation_track_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ class AnimationTrackEditor : public VBoxContainer {
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);

Expand Down
16 changes: 8 additions & 8 deletions editor/animation_track_editor_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()) {
Expand All @@ -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()) {
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions editor/debugger/script_editor_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/plugins/spatial_editor_plugin.h"
#include "editor/plugins/node_3d_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"
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
58 changes: 29 additions & 29 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,43 +114,43 @@
#include "editor/plugins/asset_library_editor_plugin.h"
#include "editor/plugins/audio_stream_editor_plugin.h"
#include "editor/plugins/baked_lightmap_editor_plugin.h"
#include "editor/plugins/camera_editor_plugin.h"
#include "editor/plugins/camera_3d_editor_plugin.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/plugins/collision_polygon_2d_editor_plugin.h"
#include "editor/plugins/collision_polygon_editor_plugin.h"
#include "editor/plugins/collision_polygon_3d_editor_plugin.h"
#include "editor/plugins/collision_shape_2d_editor_plugin.h"
#include "editor/plugins/cpu_particles_2d_editor_plugin.h"
#include "editor/plugins/cpu_particles_editor_plugin.h"
#include "editor/plugins/cpu_particles_3d_editor_plugin.h"
#include "editor/plugins/curve_editor_plugin.h"
#include "editor/plugins/debugger_editor_plugin.h"
#include "editor/plugins/editor_preview_plugins.h"
#include "editor/plugins/gi_probe_editor_plugin.h"
#include "editor/plugins/gpu_particles_2d_editor_plugin.h"
#include "editor/plugins/gpu_particles_3d_editor_plugin.h"
#include "editor/plugins/gradient_editor_plugin.h"
#include "editor/plugins/item_list_editor_plugin.h"
#include "editor/plugins/light_occluder_2d_editor_plugin.h"
#include "editor/plugins/line_2d_editor_plugin.h"
#include "editor/plugins/material_editor_plugin.h"
#include "editor/plugins/mesh_editor_plugin.h"
#include "editor/plugins/mesh_instance_editor_plugin.h"
#include "editor/plugins/mesh_instance_3d_editor_plugin.h"
#include "editor/plugins/mesh_library_editor_plugin.h"
#include "editor/plugins/multimesh_editor_plugin.h"
#include "editor/plugins/navigation_polygon_editor_plugin.h"
#include "editor/plugins/particles_2d_editor_plugin.h"
#include "editor/plugins/particles_editor_plugin.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "editor/plugins/path_2d_editor_plugin.h"
#include "editor/plugins/path_editor_plugin.h"
#include "editor/plugins/physical_bone_plugin.h"
#include "editor/plugins/path_3d_editor_plugin.h"
#include "editor/plugins/physical_bone_3d_editor_plugin.h"
#include "editor/plugins/polygon_2d_editor_plugin.h"
#include "editor/plugins/resource_preloader_editor_plugin.h"
#include "editor/plugins/root_motion_editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/plugins/script_text_editor.h"
#include "editor/plugins/shader_editor_plugin.h"
#include "editor/plugins/skeleton_2d_editor_plugin.h"
#include "editor/plugins/skeleton_editor_plugin.h"
#include "editor/plugins/skeleton_ik_editor_plugin.h"
#include "editor/plugins/spatial_editor_plugin.h"
#include "editor/plugins/sprite_editor_plugin.h"
#include "editor/plugins/skeleton_3d_editor_plugin.h"
#include "editor/plugins/skeleton_ik_3d_editor_plugin.h"
#include "editor/plugins/sprite_2d_editor_plugin.h"
#include "editor/plugins/sprite_frames_editor_plugin.h"
#include "editor/plugins/style_box_editor_plugin.h"
#include "editor/plugins/text_editor.h"
Expand Down Expand Up @@ -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++)
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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>();
Expand Down Expand Up @@ -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();
Expand All @@ -6597,18 +6597,19 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(ShaderEditorPlugin(this)));
add_editor_plugin(memnew(VisualShaderEditorPlugin(this)));

add_editor_plugin(memnew(CameraEditorPlugin(this)));
add_editor_plugin(memnew(Camera3DEditorPlugin(this)));
add_editor_plugin(memnew(ThemeEditorPlugin(this)));
add_editor_plugin(memnew(MultiMeshEditorPlugin(this)));
add_editor_plugin(memnew(MeshInstanceEditorPlugin(this)));
add_editor_plugin(memnew(MeshInstance3DEditorPlugin(this)));
add_editor_plugin(memnew(AnimationTreeEditorPlugin(this)));
add_editor_plugin(memnew(MeshLibraryEditorPlugin(this)));
add_editor_plugin(memnew(StyleBoxEditorPlugin(this)));
add_editor_plugin(memnew(SpriteEditorPlugin(this)));
add_editor_plugin(memnew(Sprite2DEditorPlugin(this)));
add_editor_plugin(memnew(Skeleton2DEditorPlugin(this)));
add_editor_plugin(memnew(ParticlesEditorPlugin(this)));
add_editor_plugin(memnew(GPUParticles2DEditorPlugin(this)));
add_editor_plugin(memnew(GPUParticles3DEditorPlugin(this)));
add_editor_plugin(memnew(CPUParticles2DEditorPlugin(this)));
add_editor_plugin(memnew(CPUParticlesEditorPlugin(this)));
add_editor_plugin(memnew(CPUParticles3DEditorPlugin(this)));
add_editor_plugin(memnew(ResourcePreloaderEditorPlugin(this)));
add_editor_plugin(memnew(ItemListEditorPlugin(this)));
add_editor_plugin(memnew(Polygon3DEditorPlugin(this)));
Expand All @@ -6617,11 +6618,10 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(TileMapEditorPlugin(this)));
add_editor_plugin(memnew(SpriteFramesEditorPlugin(this)));
add_editor_plugin(memnew(TextureRegionEditorPlugin(this)));
add_editor_plugin(memnew(Particles2DEditorPlugin(this)));
add_editor_plugin(memnew(GIProbeEditorPlugin(this)));
// add_editor_plugin(memnew(BakedLightmapEditorPlugin(this)));
//add_editor_plugin(memnew(BakedLightmapEditorPlugin(this)));
add_editor_plugin(memnew(Path2DEditorPlugin(this)));
add_editor_plugin(memnew(PathEditorPlugin(this)));
add_editor_plugin(memnew(Path3DEditorPlugin(this)));
add_editor_plugin(memnew(Line2DEditorPlugin(this)));
add_editor_plugin(memnew(Polygon2DEditorPlugin(this)));
add_editor_plugin(memnew(LightOccluder2DEditorPlugin(this)));
Expand All @@ -6632,9 +6632,9 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(TextureEditorPlugin(this)));
add_editor_plugin(memnew(AudioStreamEditorPlugin(this)));
add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor)));
add_editor_plugin(memnew(SkeletonEditorPlugin(this)));
add_editor_plugin(memnew(SkeletonIKEditorPlugin(this)));
add_editor_plugin(memnew(PhysicalBonePlugin(this)));
add_editor_plugin(memnew(Skeleton3DEditorPlugin(this)));
add_editor_plugin(memnew(SkeletonIK3DEditorPlugin(this)));
add_editor_plugin(memnew(PhysicalBone3DEditorPlugin(this)));
add_editor_plugin(memnew(MeshEditorPlugin(this)));
add_editor_plugin(memnew(MaterialEditorPlugin(this)));

Expand Down Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ class EditorPluginList : public Object {
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);
Expand Down
Loading