Rename more 2D and 3D nodes to follow convention

Rename editor plugins to match the new node names.
This commit is contained in:
Rémi Verschelde 2020-03-27 08:44:44 +01:00
parent c3a760c507
commit d1acbbce7f
91 changed files with 850 additions and 861 deletions

View file

@ -42,7 +42,7 @@
#include "editor/editor_scale.h" #include "editor/editor_scale.h"
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
#include "editor/plugins/canvas_item_editor_plugin.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 "editor/property_editor.h"
#include "main/performance.h" #include "main/performance.h"
#include "scene/3d/camera_3d.h" #include "scene/3d/camera_3d.h"

View file

@ -114,32 +114,33 @@
#include "editor/plugins/asset_library_editor_plugin.h" #include "editor/plugins/asset_library_editor_plugin.h"
#include "editor/plugins/audio_stream_editor_plugin.h" #include "editor/plugins/audio_stream_editor_plugin.h"
#include "editor/plugins/baked_lightmap_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/canvas_item_editor_plugin.h"
#include "editor/plugins/collision_polygon_2d_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/collision_shape_2d_editor_plugin.h"
#include "editor/plugins/cpu_particles_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/curve_editor_plugin.h"
#include "editor/plugins/debugger_editor_plugin.h" #include "editor/plugins/debugger_editor_plugin.h"
#include "editor/plugins/editor_preview_plugins.h" #include "editor/plugins/editor_preview_plugins.h"
#include "editor/plugins/gi_probe_editor_plugin.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/gradient_editor_plugin.h"
#include "editor/plugins/item_list_editor_plugin.h" #include "editor/plugins/item_list_editor_plugin.h"
#include "editor/plugins/light_occluder_2d_editor_plugin.h" #include "editor/plugins/light_occluder_2d_editor_plugin.h"
#include "editor/plugins/line_2d_editor_plugin.h" #include "editor/plugins/line_2d_editor_plugin.h"
#include "editor/plugins/material_editor_plugin.h" #include "editor/plugins/material_editor_plugin.h"
#include "editor/plugins/mesh_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/mesh_library_editor_plugin.h"
#include "editor/plugins/multimesh_editor_plugin.h" #include "editor/plugins/multimesh_editor_plugin.h"
#include "editor/plugins/navigation_polygon_editor_plugin.h" #include "editor/plugins/navigation_polygon_editor_plugin.h"
#include "editor/plugins/particles_2d_editor_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h"
#include "editor/plugins/particles_editor_plugin.h"
#include "editor/plugins/path_2d_editor_plugin.h" #include "editor/plugins/path_2d_editor_plugin.h"
#include "editor/plugins/path_editor_plugin.h" #include "editor/plugins/path_3d_editor_plugin.h"
#include "editor/plugins/physical_bone_plugin.h" #include "editor/plugins/physical_bone_3d_editor_plugin.h"
#include "editor/plugins/polygon_2d_editor_plugin.h" #include "editor/plugins/polygon_2d_editor_plugin.h"
#include "editor/plugins/resource_preloader_editor_plugin.h" #include "editor/plugins/resource_preloader_editor_plugin.h"
#include "editor/plugins/root_motion_editor_plugin.h" #include "editor/plugins/root_motion_editor_plugin.h"
@ -147,10 +148,9 @@
#include "editor/plugins/script_text_editor.h" #include "editor/plugins/script_text_editor.h"
#include "editor/plugins/shader_editor_plugin.h" #include "editor/plugins/shader_editor_plugin.h"
#include "editor/plugins/skeleton_2d_editor_plugin.h" #include "editor/plugins/skeleton_2d_editor_plugin.h"
#include "editor/plugins/skeleton_editor_plugin.h" #include "editor/plugins/skeleton_3d_editor_plugin.h"
#include "editor/plugins/skeleton_ik_editor_plugin.h" #include "editor/plugins/skeleton_ik_3d_editor_plugin.h"
#include "editor/plugins/spatial_editor_plugin.h" #include "editor/plugins/sprite_2d_editor_plugin.h"
#include "editor/plugins/sprite_editor_plugin.h"
#include "editor/plugins/sprite_frames_editor_plugin.h" #include "editor/plugins/sprite_frames_editor_plugin.h"
#include "editor/plugins/style_box_editor_plugin.h" #include "editor/plugins/style_box_editor_plugin.h"
#include "editor/plugins/text_editor.h" #include "editor/plugins/text_editor.h"
@ -6597,18 +6597,19 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(ShaderEditorPlugin(this))); add_editor_plugin(memnew(ShaderEditorPlugin(this)));
add_editor_plugin(memnew(VisualShaderEditorPlugin(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(ThemeEditorPlugin(this)));
add_editor_plugin(memnew(MultiMeshEditorPlugin(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(AnimationTreeEditorPlugin(this)));
add_editor_plugin(memnew(MeshLibraryEditorPlugin(this))); add_editor_plugin(memnew(MeshLibraryEditorPlugin(this)));
add_editor_plugin(memnew(StyleBoxEditorPlugin(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(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(CPUParticles2DEditorPlugin(this)));
add_editor_plugin(memnew(CPUParticlesEditorPlugin(this))); add_editor_plugin(memnew(CPUParticles3DEditorPlugin(this)));
add_editor_plugin(memnew(ResourcePreloaderEditorPlugin(this))); add_editor_plugin(memnew(ResourcePreloaderEditorPlugin(this)));
add_editor_plugin(memnew(ItemListEditorPlugin(this))); add_editor_plugin(memnew(ItemListEditorPlugin(this)));
add_editor_plugin(memnew(Polygon3DEditorPlugin(this))); add_editor_plugin(memnew(Polygon3DEditorPlugin(this)));
@ -6617,11 +6618,10 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(TileMapEditorPlugin(this))); add_editor_plugin(memnew(TileMapEditorPlugin(this)));
add_editor_plugin(memnew(SpriteFramesEditorPlugin(this))); add_editor_plugin(memnew(SpriteFramesEditorPlugin(this)));
add_editor_plugin(memnew(TextureRegionEditorPlugin(this))); add_editor_plugin(memnew(TextureRegionEditorPlugin(this)));
add_editor_plugin(memnew(Particles2DEditorPlugin(this)));
add_editor_plugin(memnew(GIProbeEditorPlugin(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(Path2DEditorPlugin(this)));
add_editor_plugin(memnew(PathEditorPlugin(this))); add_editor_plugin(memnew(Path3DEditorPlugin(this)));
add_editor_plugin(memnew(Line2DEditorPlugin(this))); add_editor_plugin(memnew(Line2DEditorPlugin(this)));
add_editor_plugin(memnew(Polygon2DEditorPlugin(this))); add_editor_plugin(memnew(Polygon2DEditorPlugin(this)));
add_editor_plugin(memnew(LightOccluder2DEditorPlugin(this))); add_editor_plugin(memnew(LightOccluder2DEditorPlugin(this)));
@ -6632,9 +6632,9 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(TextureEditorPlugin(this))); add_editor_plugin(memnew(TextureEditorPlugin(this)));
add_editor_plugin(memnew(AudioStreamEditorPlugin(this))); add_editor_plugin(memnew(AudioStreamEditorPlugin(this)));
add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor))); add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor)));
add_editor_plugin(memnew(SkeletonEditorPlugin(this))); add_editor_plugin(memnew(Skeleton3DEditorPlugin(this)));
add_editor_plugin(memnew(SkeletonIKEditorPlugin(this))); add_editor_plugin(memnew(SkeletonIK3DEditorPlugin(this)));
add_editor_plugin(memnew(PhysicalBonePlugin(this))); add_editor_plugin(memnew(PhysicalBone3DEditorPlugin(this)));
add_editor_plugin(memnew(MeshEditorPlugin(this))); add_editor_plugin(memnew(MeshEditorPlugin(this)));
add_editor_plugin(memnew(MaterialEditorPlugin(this))); add_editor_plugin(memnew(MaterialEditorPlugin(this)));

View file

@ -38,7 +38,7 @@
#include "editor_resource_preview.h" #include "editor_resource_preview.h"
#include "main/main.h" #include "main/main.h"
#include "plugins/canvas_item_editor_plugin.h" #include "plugins/canvas_item_editor_plugin.h"
#include "plugins/spatial_editor_plugin.h" #include "plugins/node_3d_editor_plugin.h"
#include "scene/3d/camera_3d.h" #include "scene/3d/camera_3d.h"
#include "scene/gui/popup_menu.h" #include "scene/gui/popup_menu.h"
#include "servers/visual_server.h" #include "servers/visual_server.h"

View file

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 327 B

View file

Before

Width:  |  Height:  |  Size: 558 B

After

Width:  |  Height:  |  Size: 558 B

View file

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 516 B

View file

@ -1 +0,0 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m7.9629 1.002a1.0001 1.0001 0 0 0 -.41016.10352l-3.7891 1.8945h8.4727l-3.7891-1.8945a1.0001 1.0001 0 0 0 -.48438-.10352z" fill="#ff7070"/><path d="m3.7637 3-2.2109 1.1055a1.0001 1.0001 0 0 0 -.55273.89453h3.2363l3.7637-1.8809 3.7637 1.8809h3.2363a1.0001 1.0001 0 0 0 -.55273-.89453l-2.2109-1.1055h-8.4727z" fill="#ffeb70"/><path d="m1 5v2h2v-.38086l.76172.38086h8.4766l.76172-.38086v.38086h2v-2h-3.2363l-3.7637 1.8828-3.7637-1.8828h-3.2363z" fill="#9dff70"/><path d="m1 7v2h2v-2zm2.7617 0 3.2383 1.6191v.38086h2v-.38086l3.2383-1.6191zm9.2383 0v2h2v-2z" fill="#70ffb9"/><path d="m1 9v2h3.2344l-1.2344-.61719v-1.3828h-2zm6 0v2h2v-2zm6 0v1.3828l-1.2344.61719h3.2344v-2h-2z" fill="#70deff"/><path d="m3.7637 13 3.7891 1.8945a1.0001 1.0001 0 0 0 .48438.10547 1.0001 1.0001 0 0 0 .41016-.10547l3.7891-1.8945h-8.4727z" fill="#ff70ac"/><path d="m1 11a1.0001 1.0001 0 0 0 .55273.89453l2.2109 1.1055h8.4727l2.2109-1.1055a1.0001 1.0001 0 0 0 .55273-.89453h-3.2344l-2.7656 1.3828v-1.3828h-2v1.3828l-2.7656-1.3828h-3.2344z" fill="#9f70ff"/></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 511 B

After

Width:  |  Height:  |  Size: 511 B

View file

Before

Width:  |  Height:  |  Size: 581 B

After

Width:  |  Height:  |  Size: 581 B

View file

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 244 B

View file

@ -1 +0,0 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1044.4 7 3 7-3-7-3z" fill="#a2d2ff" fill-rule="evenodd" transform="translate(0 -1036.4)"/></svg>

Before

Width:  |  Height:  |  Size: 191 B

View file

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 191 B

View file

@ -36,12 +36,12 @@
#include "scene/3d/mesh_instance_3d.h" #include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/navigation_3d.h" #include "scene/3d/navigation_3d.h"
#include "scene/3d/physics_body_3d.h" #include "scene/3d/physics_body_3d.h"
#include "scene/3d/vehicle_body.h" #include "scene/3d/vehicle_body_3d.h"
#include "scene/animation/animation_player.h" #include "scene/animation/animation_player.h"
#include "scene/resources/animation.h" #include "scene/resources/animation.h"
#include "scene/resources/box_shape_3d.h" #include "scene/resources/box_shape_3d.h"
#include "scene/resources/packed_scene.h" #include "scene/resources/packed_scene.h"
#include "scene/resources/ray_shape.h" #include "scene/resources/ray_shape_3d.h"
#include "scene/resources/resource_format_text.h" #include "scene/resources/resource_format_text.h"
#include "scene/resources/sphere_shape_3d.h" #include "scene/resources/sphere_shape_3d.h"
#include "scene/resources/world_margin_shape_3d.h" #include "scene/resources/world_margin_shape_3d.h"
@ -576,7 +576,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
Node *owner = p_node->get_owner(); Node *owner = p_node->get_owner();
Node3D *s = Object::cast_to<Node3D>(p_node); Node3D *s = Object::cast_to<Node3D>(p_node);
VehicleBody *bv = memnew(VehicleBody); VehicleBody3D *bv = memnew(VehicleBody3D);
String n = _fixstr(p_node->get_name(), "vehicle"); String n = _fixstr(p_node->get_name(), "vehicle");
bv->set_name(n); bv->set_name(n);
p_node->replace_by(bv); p_node->replace_by(bv);
@ -596,7 +596,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
Node *owner = p_node->get_owner(); Node *owner = p_node->get_owner();
Node3D *s = Object::cast_to<Node3D>(p_node); Node3D *s = Object::cast_to<Node3D>(p_node);
VehicleWheel *bv = memnew(VehicleWheel); VehicleWheel3D *bv = memnew(VehicleWheel3D);
String n = _fixstr(p_node->get_name(), "wheel"); String n = _fixstr(p_node->get_name(), "wheel");
bv->set_name(n); bv->set_name(n);
p_node->replace_by(bv); p_node->replace_by(bv);

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* spatial_editor_gizmos.cpp */ /* node_3d_editor_gizmos.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "spatial_editor_gizmos.h" #include "node_3d_editor_gizmos.h"
#include "core/math/geometry.h" #include "core/math/geometry.h"
#include "core/math/quick_hull.h" #include "core/math/quick_hull.h"
@ -50,16 +50,16 @@
#include "scene/3d/soft_body_3d.h" #include "scene/3d/soft_body_3d.h"
#include "scene/3d/spring_arm_3d.h" #include "scene/3d/spring_arm_3d.h"
#include "scene/3d/sprite_3d.h" #include "scene/3d/sprite_3d.h"
#include "scene/3d/vehicle_body.h" #include "scene/3d/vehicle_body_3d.h"
#include "scene/3d/visibility_notifier_3d.h" #include "scene/3d/visibility_notifier_3d.h"
#include "scene/resources/box_shape_3d.h" #include "scene/resources/box_shape_3d.h"
#include "scene/resources/capsule_shape_3d.h" #include "scene/resources/capsule_shape_3d.h"
#include "scene/resources/concave_polygon_shape_3d.h" #include "scene/resources/concave_polygon_shape_3d.h"
#include "scene/resources/convex_polygon_shape_3d.h" #include "scene/resources/convex_polygon_shape_3d.h"
#include "scene/resources/cylinder_shape_3d.h" #include "scene/resources/cylinder_shape_3d.h"
#include "scene/resources/height_map_shape.h" #include "scene/resources/height_map_shape_3d.h"
#include "scene/resources/primitive_meshes.h" #include "scene/resources/primitive_meshes.h"
#include "scene/resources/ray_shape.h" #include "scene/resources/ray_shape_3d.h"
#include "scene/resources/sphere_shape_3d.h" #include "scene/resources/sphere_shape_3d.h"
#include "scene/resources/surface_tool.h" #include "scene/resources/surface_tool.h"
#include "scene/resources/world_margin_shape_3d.h" #include "scene/resources/world_margin_shape_3d.h"
@ -1445,7 +1445,7 @@ void CameraNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->add_lines(lines, material); p_gizmo->add_lines(lines, material);
p_gizmo->add_handles(handles, get_material("handles")); p_gizmo->add_handles(handles, get_material("handles"));
ClippedCamera *clipcam = Object::cast_to<ClippedCamera>(camera); ClippedCamera3D *clipcam = Object::cast_to<ClippedCamera3D>(camera);
if (clipcam) { if (clipcam) {
Node3D *parent = Object::cast_to<Node3D>(camera->get_parent()); Node3D *parent = Object::cast_to<Node3D>(camera->get_parent());
if (!parent) { if (!parent) {
@ -2041,7 +2041,7 @@ VehicleWheelNode3DGizmoPlugin::VehicleWheelNode3DGizmoPlugin() {
} }
bool VehicleWheelNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { bool VehicleWheelNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
return Object::cast_to<VehicleWheel>(p_spatial) != NULL; return Object::cast_to<VehicleWheel3D>(p_spatial) != NULL;
} }
String VehicleWheelNode3DGizmoPlugin::get_name() const { String VehicleWheelNode3DGizmoPlugin::get_name() const {
@ -2054,7 +2054,7 @@ int VehicleWheelNode3DGizmoPlugin::get_priority() const {
void VehicleWheelNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { void VehicleWheelNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
VehicleWheel *car_wheel = Object::cast_to<VehicleWheel>(p_gizmo->get_spatial_node()); VehicleWheel3D *car_wheel = Object::cast_to<VehicleWheel3D>(p_gizmo->get_spatial_node());
p_gizmo->clear(); p_gizmo->clear();
@ -3652,9 +3652,9 @@ void CollisionShapeNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->add_handles(handles, handles_material); p_gizmo->add_handles(handles, handles_material);
} }
if (Object::cast_to<HeightMapShape>(*s)) { if (Object::cast_to<HeightMapShape3D>(*s)) {
Ref<HeightMapShape> hms = s; Ref<HeightMapShape3D> hms = s;
Ref<ArrayMesh> mesh = hms->get_debug_mesh(); Ref<ArrayMesh> mesh = hms->get_debug_mesh();
p_gizmo->add_mesh(mesh, false, Ref<SkinReference>(), material); p_gizmo->add_mesh(mesh, false, Ref<SkinReference>(), material);

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* spatial_editor_gizmos.h */ /* node_3d_editor_gizmos.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -31,7 +31,7 @@
#ifndef SPATIAL_EDITOR_GIZMOS_H #ifndef SPATIAL_EDITOR_GIZMOS_H
#define SPATIAL_EDITOR_GIZMOS_H #define SPATIAL_EDITOR_GIZMOS_H
#include "editor/plugins/spatial_editor_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/camera_3d.h" #include "scene/3d/camera_3d.h"
class Camera3D; class Camera3D;

View file

@ -39,7 +39,7 @@
#include "editor/editor_scale.h" #include "editor/editor_scale.h"
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
#include "editor/plugins/canvas_item_editor_plugin.h" // For onion skinning. #include "editor/plugins/canvas_item_editor_plugin.h" // For onion skinning.
#include "editor/plugins/spatial_editor_plugin.h" // For onion skinning. #include "editor/plugins/node_3d_editor_plugin.h" // For onion skinning.
#include "scene/main/window.h" #include "scene/main/window.h"
#include "servers/visual_server.h" #include "servers/visual_server.h"

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* camera_editor_plugin.cpp */ /* camera_3d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "camera_editor_plugin.h" #include "camera_3d_editor_plugin.h"
#include "spatial_editor_plugin.h" #include "node_3d_editor_plugin.h"
void CameraEditor::_node_removed(Node *p_node) { void Camera3DEditor::_node_removed(Node *p_node) {
if (p_node == node) { if (p_node == node) {
node = NULL; node = NULL;
@ -41,16 +41,16 @@ void CameraEditor::_node_removed(Node *p_node) {
} }
} }
void CameraEditor::_pressed() { void Camera3DEditor::_pressed() {
Node *sn = (node && preview->is_pressed()) ? node : NULL; Node *sn = (node && preview->is_pressed()) ? node : NULL;
Node3DEditor::get_singleton()->set_custom_camera(sn); Node3DEditor::get_singleton()->set_custom_camera(sn);
} }
void CameraEditor::_bind_methods() { void Camera3DEditor::_bind_methods() {
} }
void CameraEditor::edit(Node *p_camera) { void Camera3DEditor::edit(Node *p_camera) {
node = p_camera; node = p_camera;
@ -66,7 +66,7 @@ void CameraEditor::edit(Node *p_camera) {
} }
} }
CameraEditor::CameraEditor() { Camera3DEditor::Camera3DEditor() {
preview = memnew(Button); preview = memnew(Button);
add_child(preview); add_child(preview);
@ -79,21 +79,21 @@ CameraEditor::CameraEditor() {
preview->set_margin(MARGIN_RIGHT, 0); preview->set_margin(MARGIN_RIGHT, 0);
preview->set_margin(MARGIN_TOP, 0); preview->set_margin(MARGIN_TOP, 0);
preview->set_margin(MARGIN_BOTTOM, 10); preview->set_margin(MARGIN_BOTTOM, 10);
preview->connect("pressed", callable_mp(this, &CameraEditor::_pressed)); preview->connect("pressed", callable_mp(this, &Camera3DEditor::_pressed));
} }
void CameraEditorPlugin::edit(Object *p_object) { void Camera3DEditorPlugin::edit(Object *p_object) {
Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera3D>(p_object)); Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera3D>(p_object));
//camera_editor->edit(Object::cast_to<Node>(p_object)); //camera_editor->edit(Object::cast_to<Node>(p_object));
} }
bool CameraEditorPlugin::handles(Object *p_object) const { bool Camera3DEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("Camera3D"); return p_object->is_class("Camera3D");
} }
void CameraEditorPlugin::make_visible(bool p_visible) { void Camera3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
//Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera>(p_object)); //Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera>(p_object));
@ -102,7 +102,7 @@ void CameraEditorPlugin::make_visible(bool p_visible) {
} }
} }
CameraEditorPlugin::CameraEditorPlugin(EditorNode *p_node) { Camera3DEditorPlugin::Camera3DEditorPlugin(EditorNode *p_node) {
editor = p_node; editor = p_node;
/* camera_editor = memnew( CameraEditor ); /* camera_editor = memnew( CameraEditor );
@ -120,5 +120,5 @@ CameraEditorPlugin::CameraEditorPlugin(EditorNode *p_node) {
*/ */
} }
CameraEditorPlugin::~CameraEditorPlugin() { Camera3DEditorPlugin::~Camera3DEditorPlugin() {
} }

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* camera_editor_plugin.h */ /* camera_3d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -35,9 +35,9 @@
#include "editor/editor_plugin.h" #include "editor/editor_plugin.h"
#include "scene/3d/camera_3d.h" #include "scene/3d/camera_3d.h"
class CameraEditor : public Control { class Camera3DEditor : public Control {
GDCLASS(CameraEditor, Control); GDCLASS(Camera3DEditor, Control);
Panel *panel; Panel *panel;
Button *preview; Button *preview;
@ -51,12 +51,12 @@ protected:
public: public:
void edit(Node *p_camera); void edit(Node *p_camera);
CameraEditor(); Camera3DEditor();
}; };
class CameraEditorPlugin : public EditorPlugin { class Camera3DEditorPlugin : public EditorPlugin {
GDCLASS(CameraEditorPlugin, EditorPlugin); GDCLASS(Camera3DEditorPlugin, EditorPlugin);
//CameraEditor *camera_editor; //CameraEditor *camera_editor;
EditorNode *editor; EditorNode *editor;
@ -68,8 +68,8 @@ public:
virtual bool handles(Object *p_object) const; virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible); virtual void make_visible(bool p_visible);
CameraEditorPlugin(EditorNode *p_node); Camera3DEditorPlugin(EditorNode *p_node);
~CameraEditorPlugin(); ~Camera3DEditorPlugin();
}; };
#endif // CAMERA_EDITOR_PLUGIN_H #endif // CAMERA_EDITOR_PLUGIN_H

View file

@ -40,8 +40,8 @@
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
#include "editor/plugins/animation_player_editor_plugin.h" #include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h" #include "editor/plugins/script_editor_plugin.h"
#include "scene/2d/gpu_particles_2d.h"
#include "scene/2d/light_2d.h" #include "scene/2d/light_2d.h"
#include "scene/2d/particles_2d.h"
#include "scene/2d/polygon_2d.h" #include "scene/2d/polygon_2d.h"
#include "scene/2d/skeleton_2d.h" #include "scene/2d/skeleton_2d.h"
#include "scene/2d/sprite_2d.h" #include "scene/2d/sprite_2d.h"
@ -6083,8 +6083,8 @@ void CanvasItemEditorViewport::_perform_drop_data() {
Node *child; Node *child;
if (default_type == "Light2D") if (default_type == "Light2D")
child = memnew(Light2D); child = memnew(Light2D);
else if (default_type == "Particles2D") else if (default_type == "GPUParticles2D")
child = memnew(Particles2D); child = memnew(GPUParticles2D);
else if (default_type == "Polygon2D") else if (default_type == "Polygon2D")
child = memnew(Polygon2D); child = memnew(Polygon2D);
else if (default_type == "TouchScreenButton") else if (default_type == "TouchScreenButton")
@ -6247,11 +6247,11 @@ void CanvasItemEditorViewport::_bind_methods() {
} }
CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasItemEditor *p_canvas_item_editor) { CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasItemEditor *p_canvas_item_editor) {
default_type = "Sprite"; default_type = "Sprite2D";
// Node2D // Node2D
types.push_back("Sprite"); types.push_back("Sprite2D");
types.push_back("Light2D"); types.push_back("Light2D");
types.push_back("Particles2D"); types.push_back("GPUParticles2D");
types.push_back("Polygon2D"); types.push_back("Polygon2D");
types.push_back("TouchScreenButton"); types.push_back("TouchScreenButton");
// Control // Control

View file

@ -33,12 +33,12 @@
#include "editor/editor_node.h" #include "editor/editor_node.h"
#include "editor/editor_plugin.h" #include "editor/editor_plugin.h"
#include "scene/2d/canvas_item.h"
#include "scene/gui/box_container.h" #include "scene/gui/box_container.h"
#include "scene/gui/check_box.h" #include "scene/gui/check_box.h"
#include "scene/gui/label.h" #include "scene/gui/label.h"
#include "scene/gui/panel_container.h" #include "scene/gui/panel_container.h"
#include "scene/gui/spin_box.h" #include "scene/gui/spin_box.h"
#include "scene/main/canvas_item.h"
class CanvasItemEditorViewport; class CanvasItemEditorViewport;

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* collision_polygon_editor_plugin.cpp */ /* collision_polygon_3d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,17 +28,17 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "collision_polygon_editor_plugin.h" #include "collision_polygon_3d_editor_plugin.h"
#include "canvas_item_editor_plugin.h" #include "canvas_item_editor_plugin.h"
#include "core/input/input_filter.h" #include "core/input/input_filter.h"
#include "core/os/file_access.h" #include "core/os/file_access.h"
#include "core/os/keyboard.h" #include "core/os/keyboard.h"
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
#include "node_3d_editor_plugin.h"
#include "scene/3d/camera_3d.h" #include "scene/3d/camera_3d.h"
#include "spatial_editor_plugin.h"
void Polygon3DEditor::_notification(int p_what) { void CollisionPolygon3DEditor::_notification(int p_what) {
switch (p_what) { switch (p_what) {
@ -47,7 +47,7 @@ void Polygon3DEditor::_notification(int p_what) {
button_create->set_icon(get_theme_icon("Edit", "EditorIcons")); button_create->set_icon(get_theme_icon("Edit", "EditorIcons"));
button_edit->set_icon(get_theme_icon("MovePoint", "EditorIcons")); button_edit->set_icon(get_theme_icon("MovePoint", "EditorIcons"));
button_edit->set_pressed(true); button_edit->set_pressed(true);
get_tree()->connect("node_removed", callable_mp(this, &Polygon3DEditor::_node_removed)); get_tree()->connect("node_removed", callable_mp(this, &CollisionPolygon3DEditor::_node_removed));
} break; } break;
case NOTIFICATION_PROCESS: { case NOTIFICATION_PROCESS: {
@ -63,7 +63,7 @@ void Polygon3DEditor::_notification(int p_what) {
} break; } break;
} }
} }
void Polygon3DEditor::_node_removed(Node *p_node) { void CollisionPolygon3DEditor::_node_removed(Node *p_node) {
if (p_node == node) { if (p_node == node) {
node = NULL; node = NULL;
@ -74,7 +74,7 @@ void Polygon3DEditor::_node_removed(Node *p_node) {
} }
} }
void Polygon3DEditor::_menu_option(int p_option) { void CollisionPolygon3DEditor::_menu_option(int p_option) {
switch (p_option) { switch (p_option) {
@ -93,7 +93,7 @@ void Polygon3DEditor::_menu_option(int p_option) {
} }
} }
void Polygon3DEditor::_wip_close() { void CollisionPolygon3DEditor::_wip_close() {
undo_redo->create_action(TTR("Create Polygon3D")); undo_redo->create_action(TTR("Create Polygon3D"));
undo_redo->add_undo_method(node, "set_polygon", node->call("get_polygon")); undo_redo->add_undo_method(node, "set_polygon", node->call("get_polygon"));
@ -109,7 +109,7 @@ void Polygon3DEditor::_wip_close() {
undo_redo->commit_action(); undo_redo->commit_action();
} }
bool Polygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) { bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
if (!node) if (!node)
return false; return false;
@ -360,7 +360,7 @@ bool Polygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, const Ref<In
return false; return false;
} }
float Polygon3DEditor::_get_depth() { float CollisionPolygon3DEditor::_get_depth() {
if (bool(node->call("_has_editable_3d_polygon_no_depth"))) if (bool(node->call("_has_editable_3d_polygon_no_depth")))
return 0; return 0;
@ -368,7 +368,7 @@ float Polygon3DEditor::_get_depth() {
return float(node->call("get_depth")); return float(node->call("get_depth"));
} }
void Polygon3DEditor::_polygon_draw() { void CollisionPolygon3DEditor::_polygon_draw() {
if (!node) if (!node)
return; return;
@ -489,7 +489,7 @@ void Polygon3DEditor::_polygon_draw() {
m->surface_set_material(0, handle_material); m->surface_set_material(0, handle_material);
} }
void Polygon3DEditor::edit(Node *p_collision_polygon) { void CollisionPolygon3DEditor::edit(Node *p_collision_polygon) {
if (p_collision_polygon) { if (p_collision_polygon) {
@ -516,12 +516,12 @@ void Polygon3DEditor::edit(Node *p_collision_polygon) {
} }
} }
void Polygon3DEditor::_bind_methods() { void CollisionPolygon3DEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_polygon_draw"), &Polygon3DEditor::_polygon_draw); ClassDB::bind_method(D_METHOD("_polygon_draw"), &CollisionPolygon3DEditor::_polygon_draw);
} }
Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) { CollisionPolygon3DEditor::CollisionPolygon3DEditor(EditorNode *p_editor) {
node = NULL; node = NULL;
editor = p_editor; editor = p_editor;
@ -530,12 +530,12 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
add_child(memnew(VSeparator)); add_child(memnew(VSeparator));
button_create = memnew(ToolButton); button_create = memnew(ToolButton);
add_child(button_create); add_child(button_create);
button_create->connect("pressed", callable_mp(this, &Polygon3DEditor::_menu_option), varray(MODE_CREATE)); button_create->connect("pressed", callable_mp(this, &CollisionPolygon3DEditor::_menu_option), varray(MODE_CREATE));
button_create->set_toggle_mode(true); button_create->set_toggle_mode(true);
button_edit = memnew(ToolButton); button_edit = memnew(ToolButton);
add_child(button_edit); add_child(button_edit);
button_edit->connect("pressed", callable_mp(this, &Polygon3DEditor::_menu_option), varray(MODE_EDIT)); button_edit->connect("pressed", callable_mp(this, &CollisionPolygon3DEditor::_menu_option), varray(MODE_EDIT));
button_edit->set_toggle_mode(true); button_edit->set_toggle_mode(true);
mode = MODE_EDIT; mode = MODE_EDIT;
@ -569,7 +569,7 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
snap_ignore = false; snap_ignore = false;
} }
Polygon3DEditor::~Polygon3DEditor() { CollisionPolygon3DEditor::~CollisionPolygon3DEditor() {
memdelete(imgeom); memdelete(imgeom);
} }
@ -598,7 +598,7 @@ void Polygon3DEditorPlugin::make_visible(bool p_visible) {
Polygon3DEditorPlugin::Polygon3DEditorPlugin(EditorNode *p_node) { Polygon3DEditorPlugin::Polygon3DEditorPlugin(EditorNode *p_node) {
editor = p_node; editor = p_node;
collision_polygon_editor = memnew(Polygon3DEditor(p_node)); collision_polygon_editor = memnew(CollisionPolygon3DEditor(p_node));
Node3DEditor::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(); collision_polygon_editor->hide();

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* collision_polygon_editor_plugin.h */ /* collision_polygon_3d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -40,9 +40,9 @@
class CanvasItemEditor; class CanvasItemEditor;
class Polygon3DEditor : public HBoxContainer { class CollisionPolygon3DEditor : public HBoxContainer {
GDCLASS(Polygon3DEditor, HBoxContainer); GDCLASS(CollisionPolygon3DEditor, HBoxContainer);
UndoRedo *undo_redo; UndoRedo *undo_redo;
enum Mode { enum Mode {
@ -92,15 +92,15 @@ protected:
public: public:
virtual bool forward_spatial_gui_input(Camera3D *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); void edit(Node *p_collision_polygon);
Polygon3DEditor(EditorNode *p_editor); CollisionPolygon3DEditor(EditorNode *p_editor);
~Polygon3DEditor(); ~CollisionPolygon3DEditor();
}; };
class Polygon3DEditorPlugin : public EditorPlugin { class Polygon3DEditorPlugin : public EditorPlugin {
GDCLASS(Polygon3DEditorPlugin, EditorPlugin); GDCLASS(Polygon3DEditorPlugin, EditorPlugin);
Polygon3DEditor *collision_polygon_editor; CollisionPolygon3DEditor *collision_polygon_editor;
EditorNode *editor; EditorNode *editor;
public: public:

View file

@ -241,7 +241,7 @@ void CPUParticles2DEditorPlugin::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) { if (p_what == NOTIFICATION_ENTER_TREE) {
menu->get_popup()->connect("id_pressed", callable_mp(this, &CPUParticles2DEditorPlugin::_menu_callback)); menu->get_popup()->connect("id_pressed", callable_mp(this, &CPUParticles2DEditorPlugin::_menu_callback));
menu->set_icon(epoints->get_theme_icon("Particles2D", "EditorIcons")); menu->set_icon(epoints->get_theme_icon("CPUParticles2D", "EditorIcons"));
file->connect("file_selected", callable_mp(this, &CPUParticles2DEditorPlugin::_file_selected)); file->connect("file_selected", callable_mp(this, &CPUParticles2DEditorPlugin::_file_selected));
} }
} }
@ -265,8 +265,7 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) {
menu->get_popup()->add_item(TTR("Load Emission Mask"), MENU_LOAD_EMISSION_MASK); menu->get_popup()->add_item(TTR("Load Emission Mask"), MENU_LOAD_EMISSION_MASK);
menu->get_popup()->add_separator(); menu->get_popup()->add_separator();
menu->get_popup()->add_item(TTR("Restart"), MENU_RESTART); menu->get_popup()->add_item(TTR("Restart"), MENU_RESTART);
// menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK); menu->set_text(TTR("CPUParticles2D"));
menu->set_text(TTR("Particles"));
menu->set_switch_on_hover(true); menu->set_switch_on_hover(true);
toolbar->add_child(menu); toolbar->add_child(menu);

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* cpu_particles_editor_plugin.cpp */ /* cpu_particles_3d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "cpu_particles_editor_plugin.h" #include "cpu_particles_3d_editor_plugin.h"
#include "editor/plugins/spatial_editor_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h"
void CPUParticlesEditor::_node_removed(Node *p_node) { void CPUParticles3DEditor::_node_removed(Node *p_node) {
if (p_node == node) { if (p_node == node) {
node = NULL; node = NULL;
@ -40,14 +40,14 @@ void CPUParticlesEditor::_node_removed(Node *p_node) {
} }
} }
void CPUParticlesEditor::_notification(int p_notification) { void CPUParticles3DEditor::_notification(int p_notification) {
if (p_notification == NOTIFICATION_ENTER_TREE) { if (p_notification == NOTIFICATION_ENTER_TREE) {
options->set_icon(get_theme_icon("CPUParticles", "EditorIcons")); options->set_icon(get_theme_icon("CPUParticles3D", "EditorIcons"));
} }
} }
void CPUParticlesEditor::_menu_option(int p_option) { void CPUParticles3DEditor::_menu_option(int p_option) {
switch (p_option) { switch (p_option) {
@ -65,13 +65,13 @@ void CPUParticlesEditor::_menu_option(int p_option) {
} }
} }
void CPUParticlesEditor::edit(CPUParticles3D *p_particles) { void CPUParticles3DEditor::edit(CPUParticles3D *p_particles) {
base_node = p_particles; base_node = p_particles;
node = p_particles; node = p_particles;
} }
void CPUParticlesEditor::_generate_emission_points() { void CPUParticles3DEditor::_generate_emission_points() {
/// hacer codigo aca /// hacer codigo aca
Vector<Vector3> points; Vector<Vector3> points;
@ -91,10 +91,10 @@ void CPUParticlesEditor::_generate_emission_points() {
} }
} }
void CPUParticlesEditor::_bind_methods() { void CPUParticles3DEditor::_bind_methods() {
} }
CPUParticlesEditor::CPUParticlesEditor() { CPUParticles3DEditor::CPUParticles3DEditor() {
particles_editor_hb = memnew(HBoxContainer); particles_editor_hb = memnew(HBoxContainer);
Node3DEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb); Node3DEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb);
@ -103,24 +103,24 @@ CPUParticlesEditor::CPUParticlesEditor() {
particles_editor_hb->add_child(options); particles_editor_hb->add_child(options);
particles_editor_hb->hide(); particles_editor_hb->hide();
options->set_text(TTR("CPUParticles")); options->set_text(TTR("CPUParticles3D"));
options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE); options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE);
options->get_popup()->add_separator(); options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART); options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART);
options->get_popup()->connect("id_pressed", callable_mp(this, &CPUParticlesEditor::_menu_option)); options->get_popup()->connect("id_pressed", callable_mp(this, &CPUParticles3DEditor::_menu_option));
} }
void CPUParticlesEditorPlugin::edit(Object *p_object) { void CPUParticles3DEditorPlugin::edit(Object *p_object) {
particles_editor->edit(Object::cast_to<CPUParticles3D>(p_object)); particles_editor->edit(Object::cast_to<CPUParticles3D>(p_object));
} }
bool CPUParticlesEditorPlugin::handles(Object *p_object) const { bool CPUParticles3DEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("CPUParticles3D"); return p_object->is_class("CPUParticles3D");
} }
void CPUParticlesEditorPlugin::make_visible(bool p_visible) { void CPUParticles3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
particles_editor->show(); particles_editor->show();
@ -132,14 +132,14 @@ void CPUParticlesEditorPlugin::make_visible(bool p_visible) {
} }
} }
CPUParticlesEditorPlugin::CPUParticlesEditorPlugin(EditorNode *p_node) { CPUParticles3DEditorPlugin::CPUParticles3DEditorPlugin(EditorNode *p_node) {
editor = p_node; editor = p_node;
particles_editor = memnew(CPUParticlesEditor); particles_editor = memnew(CPUParticles3DEditor);
editor->get_viewport()->add_child(particles_editor); editor->get_viewport()->add_child(particles_editor);
particles_editor->hide(); particles_editor->hide();
} }
CPUParticlesEditorPlugin::~CPUParticlesEditorPlugin() { CPUParticles3DEditorPlugin::~CPUParticles3DEditorPlugin() {
} }

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* cpu_particles_editor_plugin.h */ /* cpu_particles_3d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -31,12 +31,12 @@
#ifndef CPU_PARTICLES_EDITOR_PLUGIN_H #ifndef CPU_PARTICLES_EDITOR_PLUGIN_H
#define CPU_PARTICLES_EDITOR_PLUGIN_H #define CPU_PARTICLES_EDITOR_PLUGIN_H
#include "editor/plugins/particles_editor_plugin.h" #include "editor/plugins/gpu_particles_3d_editor_plugin.h"
#include "scene/3d/cpu_particles_3d.h" #include "scene/3d/cpu_particles_3d.h"
class CPUParticlesEditor : public ParticlesEditorBase { class CPUParticles3DEditor : public GPUParticles3DEditorBase {
GDCLASS(CPUParticlesEditor, ParticlesEditorBase); GDCLASS(CPUParticles3DEditor, GPUParticles3DEditorBase);
enum Menu { enum Menu {
@ -50,7 +50,7 @@ class CPUParticlesEditor : public ParticlesEditorBase {
void _menu_option(int); void _menu_option(int);
friend class CPUParticlesEditorPlugin; friend class CPUParticles3DEditorPlugin;
virtual void _generate_emission_points(); virtual void _generate_emission_points();
@ -61,14 +61,14 @@ protected:
public: public:
void edit(CPUParticles3D *p_particles); void edit(CPUParticles3D *p_particles);
CPUParticlesEditor(); CPUParticles3DEditor();
}; };
class CPUParticlesEditorPlugin : public EditorPlugin { class CPUParticles3DEditorPlugin : public EditorPlugin {
GDCLASS(CPUParticlesEditorPlugin, EditorPlugin); GDCLASS(CPUParticles3DEditorPlugin, EditorPlugin);
CPUParticlesEditor *particles_editor; CPUParticles3DEditor *particles_editor;
EditorNode *editor; EditorNode *editor;
public: public:
@ -78,8 +78,8 @@ public:
virtual bool handles(Object *p_object) const; virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible); virtual void make_visible(bool p_visible);
CPUParticlesEditorPlugin(EditorNode *p_node); CPUParticles3DEditorPlugin(EditorNode *p_node);
~CPUParticlesEditorPlugin(); ~CPUParticles3DEditorPlugin();
}; };
#endif // CPU_PARTICLES_EDITOR_PLUGIN_H #endif // CPU_PARTICLES_EDITOR_PLUGIN_H

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* particles_2d_editor_plugin.cpp */ /* gpu_particles_2d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "particles_2d_editor_plugin.h" #include "gpu_particles_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h" #include "canvas_item_editor_plugin.h"
#include "core/io/image_loader.h" #include "core/io/image_loader.h"
@ -36,17 +36,17 @@
#include "scene/gui/separator.h" #include "scene/gui/separator.h"
#include "scene/resources/particles_material.h" #include "scene/resources/particles_material.h"
void Particles2DEditorPlugin::edit(Object *p_object) { void GPUParticles2DEditorPlugin::edit(Object *p_object) {
particles = Object::cast_to<Particles2D>(p_object); particles = Object::cast_to<GPUParticles2D>(p_object);
} }
bool Particles2DEditorPlugin::handles(Object *p_object) const { bool GPUParticles2DEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("GPUParticles2D"); return p_object->is_class("GPUParticles2D");
} }
void Particles2DEditorPlugin::make_visible(bool p_visible) { void GPUParticles2DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
@ -57,13 +57,13 @@ void Particles2DEditorPlugin::make_visible(bool p_visible) {
} }
} }
void Particles2DEditorPlugin::_file_selected(const String &p_file) { void GPUParticles2DEditorPlugin::_file_selected(const String &p_file) {
source_emission_file = p_file; source_emission_file = p_file;
emission_mask->popup_centered(); emission_mask->popup_centered();
} }
void Particles2DEditorPlugin::_menu_callback(int p_idx) { void GPUParticles2DEditorPlugin::_menu_callback(int p_idx) {
switch (p_idx) { switch (p_idx) {
case MENU_GENERATE_VISIBILITY_RECT: { case MENU_GENERATE_VISIBILITY_RECT: {
@ -94,7 +94,7 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
cpu_particles->set_z_index(particles->get_z_index()); cpu_particles->set_z_index(particles->get_z_index());
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("Convert to CPUParticles")); ur->create_action(TTR("Convert to CPUParticles2D"));
ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", particles, cpu_particles, true, false); ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", particles, cpu_particles, true, false);
ur->add_do_reference(cpu_particles); ur->add_do_reference(cpu_particles);
ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, particles, false, false); ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, particles, false, false);
@ -109,7 +109,7 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
} }
} }
void Particles2DEditorPlugin::_generate_visibility_rect() { void GPUParticles2DEditorPlugin::_generate_visibility_rect() {
float time = generate_seconds->get_value(); float time = generate_seconds->get_value();
@ -149,7 +149,7 @@ void Particles2DEditorPlugin::_generate_visibility_rect() {
undo_redo->commit_action(); undo_redo->commit_action();
} }
void Particles2DEditorPlugin::_generate_emission_mask() { void GPUParticles2DEditorPlugin::_generate_emission_mask() {
Ref<ParticlesMaterial> pm = particles->get_process_material(); Ref<ParticlesMaterial> pm = particles->get_process_material();
if (!pm.is_valid()) { if (!pm.is_valid()) {
@ -345,20 +345,20 @@ void Particles2DEditorPlugin::_generate_emission_mask() {
} }
} }
void Particles2DEditorPlugin::_notification(int p_what) { void GPUParticles2DEditorPlugin::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) { if (p_what == NOTIFICATION_ENTER_TREE) {
menu->get_popup()->connect("id_pressed", callable_mp(this, &Particles2DEditorPlugin::_menu_callback)); menu->get_popup()->connect("id_pressed", callable_mp(this, &GPUParticles2DEditorPlugin::_menu_callback));
menu->set_icon(menu->get_theme_icon("Particles2D", "EditorIcons")); menu->set_icon(menu->get_theme_icon("GPUParticles2D", "EditorIcons"));
file->connect("file_selected", callable_mp(this, &Particles2DEditorPlugin::_file_selected)); file->connect("file_selected", callable_mp(this, &GPUParticles2DEditorPlugin::_file_selected));
} }
} }
void Particles2DEditorPlugin::_bind_methods() { void GPUParticles2DEditorPlugin::_bind_methods() {
} }
Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { GPUParticles2DEditorPlugin::GPUParticles2DEditorPlugin(EditorNode *p_node) {
particles = NULL; particles = NULL;
editor = p_node; editor = p_node;
@ -376,10 +376,10 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
menu->get_popup()->add_item(TTR("Load Emission Mask"), MENU_LOAD_EMISSION_MASK); menu->get_popup()->add_item(TTR("Load Emission Mask"), MENU_LOAD_EMISSION_MASK);
// menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK); // menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK);
menu->get_popup()->add_separator(); menu->get_popup()->add_separator();
menu->get_popup()->add_item(TTR("Convert to CPUParticles"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES); menu->get_popup()->add_item(TTR("Convert to CPUParticles2D"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES);
menu->get_popup()->add_separator(); menu->get_popup()->add_separator();
menu->get_popup()->add_item(TTR("Restart"), MENU_RESTART); menu->get_popup()->add_item(TTR("Restart"), MENU_RESTART);
menu->set_text(TTR("Particles")); menu->set_text(TTR("GPUParticles2D"));
menu->set_switch_on_hover(true); menu->set_switch_on_hover(true);
toolbar->add_child(menu); toolbar->add_child(menu);
@ -411,7 +411,7 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
toolbar->add_child(generate_visibility_rect); toolbar->add_child(generate_visibility_rect);
generate_visibility_rect->connect("confirmed", callable_mp(this, &Particles2DEditorPlugin::_generate_visibility_rect)); generate_visibility_rect->connect("confirmed", callable_mp(this, &GPUParticles2DEditorPlugin::_generate_visibility_rect));
emission_mask = memnew(ConfirmationDialog); emission_mask = memnew(ConfirmationDialog);
emission_mask->set_title(TTR("Load Emission Mask")); emission_mask->set_title(TTR("Load Emission Mask"));
@ -428,8 +428,8 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
toolbar->add_child(emission_mask); toolbar->add_child(emission_mask);
emission_mask->connect("confirmed", callable_mp(this, &Particles2DEditorPlugin::_generate_emission_mask)); emission_mask->connect("confirmed", callable_mp(this, &GPUParticles2DEditorPlugin::_generate_emission_mask));
} }
Particles2DEditorPlugin::~Particles2DEditorPlugin() { GPUParticles2DEditorPlugin::~GPUParticles2DEditorPlugin() {
} }

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* particles_2d_editor_plugin.h */ /* gpu_particles_2d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -34,13 +34,13 @@
#include "editor/editor_node.h" #include "editor/editor_node.h"
#include "editor/editor_plugin.h" #include "editor/editor_plugin.h"
#include "scene/2d/collision_polygon_2d.h" #include "scene/2d/collision_polygon_2d.h"
#include "scene/2d/particles_2d.h" #include "scene/2d/gpu_particles_2d.h"
#include "scene/gui/box_container.h" #include "scene/gui/box_container.h"
#include "scene/gui/file_dialog.h" #include "scene/gui/file_dialog.h"
class Particles2DEditorPlugin : public EditorPlugin { class GPUParticles2DEditorPlugin : public EditorPlugin {
GDCLASS(Particles2DEditorPlugin, EditorPlugin); GDCLASS(GPUParticles2DEditorPlugin, EditorPlugin);
enum { enum {
@ -57,7 +57,7 @@ class Particles2DEditorPlugin : public EditorPlugin {
EMISSION_MODE_BORDER_DIRECTED EMISSION_MODE_BORDER_DIRECTED
}; };
Particles2D *particles; GPUParticles2D *particles;
EditorFileDialog *file; EditorFileDialog *file;
EditorNode *editor; EditorNode *editor;
@ -93,8 +93,8 @@ public:
virtual bool handles(Object *p_object) const; virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible); virtual void make_visible(bool p_visible);
Particles2DEditorPlugin(EditorNode *p_node); GPUParticles2DEditorPlugin(EditorNode *p_node);
~Particles2DEditorPlugin(); ~GPUParticles2DEditorPlugin();
}; };
#endif // PARTICLES_2D_EDITOR_PLUGIN_H #endif // PARTICLES_2D_EDITOR_PLUGIN_H

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* particles_editor_plugin.cpp */ /* gpu_particles_3d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,14 +28,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "particles_editor_plugin.h" #include "gpu_particles_3d_editor_plugin.h"
#include "core/io/resource_loader.h" #include "core/io/resource_loader.h"
#include "editor/plugins/spatial_editor_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/cpu_particles_3d.h" #include "scene/3d/cpu_particles_3d.h"
#include "scene/resources/particles_material.h" #include "scene/resources/particles_material.h"
bool ParticlesEditorBase::_generate(Vector<Vector3> &points, Vector<Vector3> &normals) { bool GPUParticles3DEditorBase::_generate(Vector<Vector3> &points, Vector<Vector3> &normals) {
bool use_normals = emission_fill->get_selected() == 1; bool use_normals = emission_fill->get_selected() == 1;
@ -161,7 +161,7 @@ bool ParticlesEditorBase::_generate(Vector<Vector3> &points, Vector<Vector3> &no
return true; return true;
} }
void ParticlesEditorBase::_node_selected(const NodePath &p_path) { void GPUParticles3DEditorBase::_node_selected(const NodePath &p_path) {
Node *sel = get_node(p_path); Node *sel = get_node(p_path);
if (!sel) if (!sel)
@ -202,10 +202,10 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) {
emission_dialog->popup_centered(Size2(300, 130)); emission_dialog->popup_centered(Size2(300, 130));
} }
void ParticlesEditorBase::_bind_methods() { void GPUParticles3DEditorBase::_bind_methods() {
} }
ParticlesEditorBase::ParticlesEditorBase() { GPUParticles3DEditorBase::GPUParticles3DEditorBase() {
emission_dialog = memnew(ConfirmationDialog); emission_dialog = memnew(ConfirmationDialog);
emission_dialog->set_title(TTR("Create Emitter")); emission_dialog->set_title(TTR("Create Emitter"));
@ -226,14 +226,14 @@ ParticlesEditorBase::ParticlesEditorBase() {
emd_vb->add_margin_child(TTR("Emission Source: "), emission_fill); emd_vb->add_margin_child(TTR("Emission Source: "), emission_fill);
emission_dialog->get_ok()->set_text(TTR("Create")); emission_dialog->get_ok()->set_text(TTR("Create"));
emission_dialog->connect("confirmed", callable_mp(this, &ParticlesEditorBase::_generate_emission_points)); emission_dialog->connect("confirmed", callable_mp(this, &GPUParticles3DEditorBase::_generate_emission_points));
emission_tree_dialog = memnew(SceneTreeDialog); emission_tree_dialog = memnew(SceneTreeDialog);
add_child(emission_tree_dialog); add_child(emission_tree_dialog);
emission_tree_dialog->connect("selected", callable_mp(this, &ParticlesEditorBase::_node_selected)); emission_tree_dialog->connect("selected", callable_mp(this, &GPUParticles3DEditorBase::_node_selected));
} }
void ParticlesEditor::_node_removed(Node *p_node) { void GPUParticles3DEditor::_node_removed(Node *p_node) {
if (p_node == node) { if (p_node == node) {
node = NULL; node = NULL;
@ -241,15 +241,15 @@ void ParticlesEditor::_node_removed(Node *p_node) {
} }
} }
void ParticlesEditor::_notification(int p_notification) { void GPUParticles3DEditor::_notification(int p_notification) {
if (p_notification == NOTIFICATION_ENTER_TREE) { if (p_notification == NOTIFICATION_ENTER_TREE) {
options->set_icon(options->get_popup()->get_theme_icon("Particles", "EditorIcons")); options->set_icon(options->get_popup()->get_theme_icon("GPUParticles3D", "EditorIcons"));
get_tree()->connect("node_removed", callable_mp(this, &ParticlesEditor::_node_removed)); get_tree()->connect("node_removed", callable_mp(this, &GPUParticles3DEditor::_node_removed));
} }
} }
void ParticlesEditor::_menu_option(int p_option) { void GPUParticles3DEditor::_menu_option(int p_option) {
switch (p_option) { switch (p_option) {
@ -282,7 +282,7 @@ void ParticlesEditor::_menu_option(int p_option) {
cpu_particles->set_pause_mode(node->get_pause_mode()); cpu_particles->set_pause_mode(node->get_pause_mode());
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("Convert to CPUParticles")); ur->create_action(TTR("Convert to CPUParticles3D"));
ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", node, cpu_particles, true, false); ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", node, cpu_particles, true, false);
ur->add_do_reference(cpu_particles); ur->add_do_reference(cpu_particles);
ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, node, false, false); ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, node, false, false);
@ -298,7 +298,7 @@ void ParticlesEditor::_menu_option(int p_option) {
} }
} }
void ParticlesEditor::_generate_aabb() { void GPUParticles3DEditor::_generate_aabb() {
float time = generate_seconds->get_value(); float time = generate_seconds->get_value();
@ -340,13 +340,13 @@ void ParticlesEditor::_generate_aabb() {
ur->commit_action(); ur->commit_action();
} }
void ParticlesEditor::edit(GPUParticles3D *p_particles) { void GPUParticles3DEditor::edit(GPUParticles3D *p_particles) {
base_node = p_particles; base_node = p_particles;
node = p_particles; node = p_particles;
} }
void ParticlesEditor::_generate_emission_points() { void GPUParticles3DEditor::_generate_emission_points() {
/// hacer codigo aca /// hacer codigo aca
Vector<Vector3> points; Vector<Vector3> points;
@ -419,10 +419,10 @@ void ParticlesEditor::_generate_emission_points() {
} }
} }
void ParticlesEditor::_bind_methods() { void GPUParticles3DEditor::_bind_methods() {
} }
ParticlesEditor::ParticlesEditor() { GPUParticles3DEditor::GPUParticles3DEditor() {
node = NULL; node = NULL;
particles_editor_hb = memnew(HBoxContainer); particles_editor_hb = memnew(HBoxContainer);
@ -432,16 +432,16 @@ ParticlesEditor::ParticlesEditor() {
particles_editor_hb->add_child(options); particles_editor_hb->add_child(options);
particles_editor_hb->hide(); particles_editor_hb->hide();
options->set_text(TTR("Particles")); options->set_text(TTR("GPUParticles3D"));
options->get_popup()->add_item(TTR("Generate AABB"), MENU_OPTION_GENERATE_AABB); options->get_popup()->add_item(TTR("Generate AABB"), MENU_OPTION_GENERATE_AABB);
options->get_popup()->add_separator(); options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE); options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE);
options->get_popup()->add_separator(); options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Convert to CPUParticles"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES); options->get_popup()->add_item(TTR("Convert to CPUParticles3D"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES);
options->get_popup()->add_separator(); options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART); options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART);
options->get_popup()->connect("id_pressed", callable_mp(this, &ParticlesEditor::_menu_option)); options->get_popup()->connect("id_pressed", callable_mp(this, &GPUParticles3DEditor::_menu_option));
generate_aabb = memnew(ConfirmationDialog); generate_aabb = memnew(ConfirmationDialog);
generate_aabb->set_title(TTR("Generate Visibility AABB")); generate_aabb->set_title(TTR("Generate Visibility AABB"));
@ -455,20 +455,20 @@ ParticlesEditor::ParticlesEditor() {
add_child(generate_aabb); add_child(generate_aabb);
generate_aabb->connect("confirmed", callable_mp(this, &ParticlesEditor::_generate_aabb)); generate_aabb->connect("confirmed", callable_mp(this, &GPUParticles3DEditor::_generate_aabb));
} }
void ParticlesEditorPlugin::edit(Object *p_object) { void GPUParticles3DEditorPlugin::edit(Object *p_object) {
particles_editor->edit(Object::cast_to<GPUParticles3D>(p_object)); particles_editor->edit(Object::cast_to<GPUParticles3D>(p_object));
} }
bool ParticlesEditorPlugin::handles(Object *p_object) const { bool GPUParticles3DEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("GPUParticles3D"); return p_object->is_class("GPUParticles3D");
} }
void ParticlesEditorPlugin::make_visible(bool p_visible) { void GPUParticles3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
particles_editor->show(); particles_editor->show();
@ -480,14 +480,14 @@ void ParticlesEditorPlugin::make_visible(bool p_visible) {
} }
} }
ParticlesEditorPlugin::ParticlesEditorPlugin(EditorNode *p_node) { GPUParticles3DEditorPlugin::GPUParticles3DEditorPlugin(EditorNode *p_node) {
editor = p_node; editor = p_node;
particles_editor = memnew(ParticlesEditor); particles_editor = memnew(GPUParticles3DEditor);
editor->get_viewport()->add_child(particles_editor); editor->get_viewport()->add_child(particles_editor);
particles_editor->hide(); particles_editor->hide();
} }
ParticlesEditorPlugin::~ParticlesEditorPlugin() { GPUParticles3DEditorPlugin::~GPUParticles3DEditorPlugin() {
} }

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* particles_editor_plugin.h */ /* gpu_particles_3d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -36,9 +36,9 @@
#include "scene/3d/gpu_particles_3d.h" #include "scene/3d/gpu_particles_3d.h"
#include "scene/gui/spin_box.h" #include "scene/gui/spin_box.h"
class ParticlesEditorBase : public Control { class GPUParticles3DEditorBase : public Control {
GDCLASS(ParticlesEditorBase, Control); GDCLASS(GPUParticles3DEditorBase, Control);
protected: protected:
Node3D *base_node; Node3D *base_node;
@ -61,12 +61,12 @@ protected:
static void _bind_methods(); static void _bind_methods();
public: public:
ParticlesEditorBase(); GPUParticles3DEditorBase();
}; };
class ParticlesEditor : public ParticlesEditorBase { class GPUParticles3DEditor : public GPUParticles3DEditorBase {
GDCLASS(ParticlesEditor, ParticlesEditorBase); GDCLASS(GPUParticles3DEditor, GPUParticles3DEditorBase);
ConfirmationDialog *generate_aabb; ConfirmationDialog *generate_aabb;
SpinBox *generate_seconds; SpinBox *generate_seconds;
@ -86,7 +86,7 @@ class ParticlesEditor : public ParticlesEditorBase {
void _menu_option(int); void _menu_option(int);
friend class ParticlesEditorPlugin; friend class GPUParticles3DEditorPlugin;
virtual void _generate_emission_points(); virtual void _generate_emission_points();
@ -97,14 +97,14 @@ protected:
public: public:
void edit(GPUParticles3D *p_particles); void edit(GPUParticles3D *p_particles);
ParticlesEditor(); GPUParticles3DEditor();
}; };
class ParticlesEditorPlugin : public EditorPlugin { class GPUParticles3DEditorPlugin : public EditorPlugin {
GDCLASS(ParticlesEditorPlugin, EditorPlugin); GDCLASS(GPUParticles3DEditorPlugin, EditorPlugin);
ParticlesEditor *particles_editor; GPUParticles3DEditor *particles_editor;
EditorNode *editor; EditorNode *editor;
public: public:
@ -114,8 +114,8 @@ public:
virtual bool handles(Object *p_object) const; virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible); virtual void make_visible(bool p_visible);
ParticlesEditorPlugin(EditorNode *p_node); GPUParticles3DEditorPlugin(EditorNode *p_node);
~ParticlesEditorPlugin(); ~GPUParticles3DEditorPlugin();
}; };
#endif // PARTICLES_EDITOR_PLUGIN_H #endif // PARTICLES_EDITOR_PLUGIN_H

View file

@ -32,7 +32,7 @@
#include "canvas_item_editor_plugin.h" #include "canvas_item_editor_plugin.h"
#include "editor/editor_scale.h" #include "editor/editor_scale.h"
#include "spatial_editor_plugin.h" #include "node_3d_editor_plugin.h"
Size2 GradientEditor::get_minimum_size() const { Size2 GradientEditor::get_minimum_size() const {
return Size2(0, 60) * EDSCALE; return Size2(0, 60) * EDSCALE;

View file

@ -115,7 +115,7 @@ MaterialEditor::MaterialEditor() {
add_child(vc); add_child(vc);
vc->set_anchors_and_margins_preset(PRESET_WIDE); vc->set_anchors_and_margins_preset(PRESET_WIDE);
viewport = memnew(SubViewport); viewport = memnew(SubViewport);
Ref<World> world; Ref<World3D> world;
world.instance(); world.instance();
viewport->set_world(world); //use own world viewport->set_world(world); //use own world
vc->add_child(viewport); vc->add_child(viewport);

View file

@ -116,7 +116,7 @@ void MeshEditor::_bind_methods() {
MeshEditor::MeshEditor() { MeshEditor::MeshEditor() {
viewport = memnew(SubViewport); viewport = memnew(SubViewport);
Ref<World> world; Ref<World3D> world;
world.instance(); world.instance();
viewport->set_world(world); //use own world viewport->set_world(world); //use own world
add_child(viewport); add_child(viewport);

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* mesh_instance_editor_plugin.cpp */ /* mesh_instance_3d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,16 +28,16 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "mesh_instance_editor_plugin.h" #include "mesh_instance_3d_editor_plugin.h"
#include "editor/editor_scale.h" #include "editor/editor_scale.h"
#include "node_3d_editor_plugin.h"
#include "scene/3d/collision_shape_3d.h" #include "scene/3d/collision_shape_3d.h"
#include "scene/3d/navigation_region_3d.h" #include "scene/3d/navigation_region_3d.h"
#include "scene/3d/physics_body_3d.h" #include "scene/3d/physics_body_3d.h"
#include "scene/gui/box_container.h" #include "scene/gui/box_container.h"
#include "spatial_editor_plugin.h"
void MeshInstanceEditor::_node_removed(Node *p_node) { void MeshInstance3DEditor::_node_removed(Node *p_node) {
if (p_node == node) { if (p_node == node) {
node = NULL; node = NULL;
@ -45,12 +45,12 @@ void MeshInstanceEditor::_node_removed(Node *p_node) {
} }
} }
void MeshInstanceEditor::edit(MeshInstance3D *p_mesh) { void MeshInstance3DEditor::edit(MeshInstance3D *p_mesh) {
node = p_mesh; node = p_mesh;
} }
void MeshInstanceEditor::_menu_option(int p_option) { void MeshInstance3DEditor::_menu_option(int p_option) {
Ref<Mesh> mesh = node->get_mesh(); Ref<Mesh> mesh = node->get_mesh();
if (mesh.is_null()) { if (mesh.is_null()) {
@ -291,20 +291,20 @@ void MeshInstanceEditor::_menu_option(int p_option) {
} }
} }
struct MeshInstanceEditorEdgeSort { struct MeshInstance3DEditorEdgeSort {
Vector2 a; Vector2 a;
Vector2 b; Vector2 b;
bool operator<(const MeshInstanceEditorEdgeSort &p_b) const { bool operator<(const MeshInstance3DEditorEdgeSort &p_b) const {
if (a == p_b.a) if (a == p_b.a)
return b < p_b.b; return b < p_b.b;
else else
return a < p_b.a; return a < p_b.a;
} }
MeshInstanceEditorEdgeSort() {} MeshInstance3DEditorEdgeSort() {}
MeshInstanceEditorEdgeSort(const Vector2 &p_a, const Vector2 &p_b) { MeshInstance3DEditorEdgeSort(const Vector2 &p_a, const Vector2 &p_b) {
if (p_a < p_b) { if (p_a < p_b) {
a = p_a; a = p_a;
b = p_b; b = p_b;
@ -315,12 +315,12 @@ struct MeshInstanceEditorEdgeSort {
} }
}; };
void MeshInstanceEditor::_create_uv_lines(int p_layer) { void MeshInstance3DEditor::_create_uv_lines(int p_layer) {
Ref<Mesh> mesh = node->get_mesh(); Ref<Mesh> mesh = node->get_mesh();
ERR_FAIL_COND(!mesh.is_valid()); ERR_FAIL_COND(!mesh.is_valid());
Set<MeshInstanceEditorEdgeSort> edges; Set<MeshInstance3DEditorEdgeSort> edges;
uv_lines.clear(); uv_lines.clear();
for (int i = 0; i < mesh->get_surface_count(); i++) { for (int i = 0; i < mesh->get_surface_count(); i++) {
if (mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) if (mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES)
@ -355,7 +355,7 @@ void MeshInstanceEditor::_create_uv_lines(int p_layer) {
for (int k = 0; k < 3; k++) { for (int k = 0; k < 3; k++) {
MeshInstanceEditorEdgeSort edge; MeshInstance3DEditorEdgeSort edge;
if (use_indices) { if (use_indices) {
edge.a = r[ri[j + k]]; edge.a = r[ri[j + k]];
edge.b = r[ri[j + ((k + 1) % 3)]]; edge.b = r[ri[j + ((k + 1) % 3)]];
@ -377,7 +377,7 @@ void MeshInstanceEditor::_create_uv_lines(int p_layer) {
debug_uv_dialog->popup_centered(); debug_uv_dialog->popup_centered();
} }
void MeshInstanceEditor::_debug_uv_draw() { void MeshInstance3DEditor::_debug_uv_draw() {
if (uv_lines.size() == 0) if (uv_lines.size() == 0)
return; return;
@ -388,7 +388,7 @@ void MeshInstanceEditor::_debug_uv_draw() {
debug_uv->draw_multiline(uv_lines, Color(1.0, 0.8, 0.7)); debug_uv->draw_multiline(uv_lines, Color(1.0, 0.8, 0.7));
} }
void MeshInstanceEditor::_create_outline_mesh() { void MeshInstance3DEditor::_create_outline_mesh() {
Ref<Mesh> mesh = node->get_mesh(); Ref<Mesh> mesh = node->get_mesh();
if (mesh.is_null()) { if (mesh.is_null()) {
@ -434,10 +434,10 @@ void MeshInstanceEditor::_create_outline_mesh() {
ur->commit_action(); ur->commit_action();
} }
void MeshInstanceEditor::_bind_methods() { void MeshInstance3DEditor::_bind_methods() {
} }
MeshInstanceEditor::MeshInstanceEditor() { MeshInstance3DEditor::MeshInstance3DEditor() {
options = memnew(MenuButton); options = memnew(MenuButton);
options->set_switch_on_hover(true); options->set_switch_on_hover(true);
@ -465,7 +465,7 @@ MeshInstanceEditor::MeshInstanceEditor() {
options->get_popup()->add_item(TTR("View UV2"), MENU_OPTION_DEBUG_UV2); options->get_popup()->add_item(TTR("View UV2"), MENU_OPTION_DEBUG_UV2);
options->get_popup()->add_item(TTR("Unwrap UV2 for Lightmap/AO"), MENU_OPTION_CREATE_UV2); options->get_popup()->add_item(TTR("Unwrap UV2 for Lightmap/AO"), MENU_OPTION_CREATE_UV2);
options->get_popup()->connect("id_pressed", callable_mp(this, &MeshInstanceEditor::_menu_option)); options->get_popup()->connect("id_pressed", callable_mp(this, &MeshInstance3DEditor::_menu_option));
outline_dialog = memnew(ConfirmationDialog); outline_dialog = memnew(ConfirmationDialog);
outline_dialog->set_title(TTR("Create Outline Mesh")); outline_dialog->set_title(TTR("Create Outline Mesh"));
@ -483,7 +483,7 @@ MeshInstanceEditor::MeshInstanceEditor() {
outline_dialog_vbc->add_margin_child(TTR("Outline Size:"), outline_size); outline_dialog_vbc->add_margin_child(TTR("Outline Size:"), outline_size);
add_child(outline_dialog); add_child(outline_dialog);
outline_dialog->connect("confirmed", callable_mp(this, &MeshInstanceEditor::_create_outline_mesh)); outline_dialog->connect("confirmed", callable_mp(this, &MeshInstance3DEditor::_create_outline_mesh));
err_dialog = memnew(AcceptDialog); err_dialog = memnew(AcceptDialog);
add_child(err_dialog); add_child(err_dialog);
@ -493,21 +493,21 @@ MeshInstanceEditor::MeshInstanceEditor() {
add_child(debug_uv_dialog); add_child(debug_uv_dialog);
debug_uv = memnew(Control); debug_uv = memnew(Control);
debug_uv->set_custom_minimum_size(Size2(600, 600) * EDSCALE); debug_uv->set_custom_minimum_size(Size2(600, 600) * EDSCALE);
debug_uv->connect("draw", callable_mp(this, &MeshInstanceEditor::_debug_uv_draw)); debug_uv->connect("draw", callable_mp(this, &MeshInstance3DEditor::_debug_uv_draw));
debug_uv_dialog->add_child(debug_uv); debug_uv_dialog->add_child(debug_uv);
} }
void MeshInstanceEditorPlugin::edit(Object *p_object) { void MeshInstance3DEditorPlugin::edit(Object *p_object) {
mesh_editor->edit(Object::cast_to<MeshInstance3D>(p_object)); mesh_editor->edit(Object::cast_to<MeshInstance3D>(p_object));
} }
bool MeshInstanceEditorPlugin::handles(Object *p_object) const { bool MeshInstance3DEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("MeshInstance3D"); return p_object->is_class("MeshInstance3D");
} }
void MeshInstanceEditorPlugin::make_visible(bool p_visible) { void MeshInstance3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
mesh_editor->options->show(); mesh_editor->options->show();
@ -518,14 +518,14 @@ void MeshInstanceEditorPlugin::make_visible(bool p_visible) {
} }
} }
MeshInstanceEditorPlugin::MeshInstanceEditorPlugin(EditorNode *p_node) { MeshInstance3DEditorPlugin::MeshInstance3DEditorPlugin(EditorNode *p_node) {
editor = p_node; editor = p_node;
mesh_editor = memnew(MeshInstanceEditor); mesh_editor = memnew(MeshInstance3DEditor);
editor->get_viewport()->add_child(mesh_editor); editor->get_viewport()->add_child(mesh_editor);
mesh_editor->options->hide(); mesh_editor->options->hide();
} }
MeshInstanceEditorPlugin::~MeshInstanceEditorPlugin() { MeshInstance3DEditorPlugin::~MeshInstance3DEditorPlugin() {
} }

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* mesh_instance_editor_plugin.h */ /* mesh_instance_3d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -36,9 +36,9 @@
#include "scene/3d/mesh_instance_3d.h" #include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/spin_box.h" #include "scene/gui/spin_box.h"
class MeshInstanceEditor : public Control { class MeshInstance3DEditor : public Control {
GDCLASS(MeshInstanceEditor, Control); GDCLASS(MeshInstance3DEditor, Control);
enum Menu { enum Menu {
@ -70,7 +70,7 @@ class MeshInstanceEditor : public Control {
void _create_outline_mesh(); void _create_outline_mesh();
void _create_uv_lines(int p_layer); void _create_uv_lines(int p_layer);
friend class MeshInstanceEditorPlugin; friend class MeshInstance3DEditorPlugin;
void _debug_uv_draw(); void _debug_uv_draw();
@ -80,14 +80,14 @@ protected:
public: public:
void edit(MeshInstance3D *p_mesh); void edit(MeshInstance3D *p_mesh);
MeshInstanceEditor(); MeshInstance3DEditor();
}; };
class MeshInstanceEditorPlugin : public EditorPlugin { class MeshInstance3DEditorPlugin : public EditorPlugin {
GDCLASS(MeshInstanceEditorPlugin, EditorPlugin); GDCLASS(MeshInstance3DEditorPlugin, EditorPlugin);
MeshInstanceEditor *mesh_editor; MeshInstance3DEditor *mesh_editor;
EditorNode *editor; EditorNode *editor;
public: public:
@ -97,8 +97,8 @@ public:
virtual bool handles(Object *p_object) const; virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible); virtual void make_visible(bool p_visible);
MeshInstanceEditorPlugin(EditorNode *p_node); MeshInstance3DEditorPlugin(EditorNode *p_node);
~MeshInstanceEditorPlugin(); ~MeshInstance3DEditorPlugin();
}; };
#endif // MESH_EDITOR_PLUGIN_H #endif // MESH_EDITOR_PLUGIN_H

View file

@ -33,12 +33,12 @@
#include "editor/editor_node.h" #include "editor/editor_node.h"
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
#include "main/main.h" #include "main/main.h"
#include "node_3d_editor_plugin.h"
#include "scene/3d/mesh_instance_3d.h" #include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/navigation_region_3d.h" #include "scene/3d/navigation_region_3d.h"
#include "scene/3d/physics_body_3d.h" #include "scene/3d/physics_body_3d.h"
#include "scene/main/window.h" #include "scene/main/window.h"
#include "scene/resources/packed_scene.h" #include "scene/resources/packed_scene.h"
#include "spatial_editor_plugin.h"
void MeshLibraryEditor::edit(const Ref<MeshLibrary> &p_mesh_library) { void MeshLibraryEditor::edit(const Ref<MeshLibrary> &p_mesh_library) {

View file

@ -30,9 +30,9 @@
#include "multimesh_editor_plugin.h" #include "multimesh_editor_plugin.h"
#include "node_3d_editor_plugin.h"
#include "scene/3d/mesh_instance_3d.h" #include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/box_container.h" #include "scene/gui/box_container.h"
#include "spatial_editor_plugin.h"
void MultiMeshEditor::_node_removed(Node *p_node) { void MultiMeshEditor::_node_removed(Node *p_node) {
@ -287,7 +287,7 @@ MultiMeshEditor::MultiMeshEditor() {
Node3DEditor::get_singleton()->add_control_to_menu_panel(options); Node3DEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text("MultiMesh"); options->set_text("MultiMesh");
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MultiMeshInstance", "EditorIcons")); options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MultiMeshInstance3D", "EditorIcons"));
options->get_popup()->add_item(TTR("Populate Surface")); options->get_popup()->add_item(TTR("Populate Surface"));
options->get_popup()->connect("id_pressed", callable_mp(this, &MultiMeshEditor::_menu_option)); options->get_popup()->connect("id_pressed", callable_mp(this, &MultiMeshEditor::_menu_option));

View file

@ -32,7 +32,7 @@
#define NAVIGATIONPOLYGONEDITORPLUGIN_H #define NAVIGATIONPOLYGONEDITORPLUGIN_H
#include "editor/plugins/abstract_polygon_2d_editor.h" #include "editor/plugins/abstract_polygon_2d_editor.h"
#include "scene/2d/navigation_polygon.h" #include "scene/2d/navigation_region_2d.h"
class NavigationPolygonEditor : public AbstractPolygon2DEditor { class NavigationPolygonEditor : public AbstractPolygon2DEditor {

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* spatial_editor_plugin.cpp */ /* node_3d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "spatial_editor_plugin.h" #include "node_3d_editor_plugin.h"
#include "core/input/input_filter.h" #include "core/input/input_filter.h"
#include "core/math/camera_matrix.h" #include "core/math/camera_matrix.h"
@ -40,9 +40,9 @@
#include "editor/editor_node.h" #include "editor/editor_node.h"
#include "editor/editor_scale.h" #include "editor/editor_scale.h"
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
#include "editor/node_3d_editor_gizmos.h"
#include "editor/plugins/animation_player_editor_plugin.h" #include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h" #include "editor/plugins/script_editor_plugin.h"
#include "editor/spatial_editor_gizmos.h"
#include "scene/3d/camera_3d.h" #include "scene/3d/camera_3d.h"
#include "scene/3d/collision_shape_3d.h" #include "scene/3d/collision_shape_3d.h"
#include "scene/3d/mesh_instance_3d.h" #include "scene/3d/mesh_instance_3d.h"

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* spatial_editor_plugin.h */ /* node_3d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* path_editor_plugin.cpp */ /* path_3d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "path_editor_plugin.h" #include "path_3d_editor_plugin.h"
#include "core/os/keyboard.h" #include "core/os/keyboard.h"
#include "node_3d_editor_plugin.h"
#include "scene/resources/curve.h" #include "scene/resources/curve.h"
#include "spatial_editor_plugin.h"
String PathNode3DGizmo::get_handle_name(int p_idx) const { String PathNode3DGizmo::get_handle_name(int p_idx) const {
@ -130,10 +130,10 @@ void PathNode3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_
// Setting curve in/out positions // Setting curve in/out positions
if (p.intersects_ray(ray_from, ray_dir, &inters)) { if (p.intersects_ray(ray_from, ray_dir, &inters)) {
if (!PathEditorPlugin::singleton->is_handle_clicked()) { if (!Path3DEditorPlugin::singleton->is_handle_clicked()) {
orig_in_length = c->get_point_in(idx).length(); orig_in_length = c->get_point_in(idx).length();
orig_out_length = c->get_point_out(idx).length(); orig_out_length = c->get_point_out(idx).length();
PathEditorPlugin::singleton->set_handle_clicked(true); Path3DEditorPlugin::singleton->set_handle_clicked(true);
} }
Vector3 local = gi.xform(inters) - base; Vector3 local = gi.xform(inters) - base;
@ -144,12 +144,12 @@ void PathNode3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_
if (t == 0) { if (t == 0) {
c->set_point_in(idx, local); c->set_point_in(idx, local);
if (PathEditorPlugin::singleton->mirror_angle_enabled()) if (Path3DEditorPlugin::singleton->mirror_angle_enabled())
c->set_point_out(idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -local : (-local.normalized() * orig_out_length)); c->set_point_out(idx, Path3DEditorPlugin::singleton->mirror_length_enabled() ? -local : (-local.normalized() * orig_out_length));
} else { } else {
c->set_point_out(idx, local); c->set_point_out(idx, local);
if (PathEditorPlugin::singleton->mirror_angle_enabled()) if (Path3DEditorPlugin::singleton->mirror_angle_enabled())
c->set_point_in(idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -local : (-local.normalized() * orig_in_length)); c->set_point_in(idx, Path3DEditorPlugin::singleton->mirror_length_enabled() ? -local : (-local.normalized() * orig_in_length));
} }
} }
} }
@ -192,9 +192,9 @@ void PathNode3DGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_
ur->add_do_method(c.ptr(), "set_point_in", idx, c->get_point_in(idx)); ur->add_do_method(c.ptr(), "set_point_in", idx, c->get_point_in(idx));
ur->add_undo_method(c.ptr(), "set_point_in", idx, p_restore); ur->add_undo_method(c.ptr(), "set_point_in", idx, p_restore);
if (PathEditorPlugin::singleton->mirror_angle_enabled()) { if (Path3DEditorPlugin::singleton->mirror_angle_enabled()) {
ur->add_do_method(c.ptr(), "set_point_out", idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -c->get_point_in(idx) : (-c->get_point_in(idx).normalized() * orig_out_length)); ur->add_do_method(c.ptr(), "set_point_out", idx, Path3DEditorPlugin::singleton->mirror_length_enabled() ? -c->get_point_in(idx) : (-c->get_point_in(idx).normalized() * orig_out_length));
ur->add_undo_method(c.ptr(), "set_point_out", idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -static_cast<Vector3>(p_restore) : (-static_cast<Vector3>(p_restore).normalized() * orig_out_length)); ur->add_undo_method(c.ptr(), "set_point_out", idx, Path3DEditorPlugin::singleton->mirror_length_enabled() ? -static_cast<Vector3>(p_restore) : (-static_cast<Vector3>(p_restore).normalized() * orig_out_length));
} }
ur->commit_action(); ur->commit_action();
@ -209,9 +209,9 @@ void PathNode3DGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_
ur->add_do_method(c.ptr(), "set_point_out", idx, c->get_point_out(idx)); ur->add_do_method(c.ptr(), "set_point_out", idx, c->get_point_out(idx));
ur->add_undo_method(c.ptr(), "set_point_out", idx, p_restore); ur->add_undo_method(c.ptr(), "set_point_out", idx, p_restore);
if (PathEditorPlugin::singleton->mirror_angle_enabled()) { if (Path3DEditorPlugin::singleton->mirror_angle_enabled()) {
ur->add_do_method(c.ptr(), "set_point_in", idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -c->get_point_out(idx) : (-c->get_point_out(idx).normalized() * orig_in_length)); ur->add_do_method(c.ptr(), "set_point_in", idx, Path3DEditorPlugin::singleton->mirror_length_enabled() ? -c->get_point_out(idx) : (-c->get_point_out(idx).normalized() * orig_in_length));
ur->add_undo_method(c.ptr(), "set_point_in", idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -static_cast<Vector3>(p_restore) : (-static_cast<Vector3>(p_restore).normalized() * orig_in_length)); ur->add_undo_method(c.ptr(), "set_point_in", idx, Path3DEditorPlugin::singleton->mirror_length_enabled() ? -static_cast<Vector3>(p_restore) : (-static_cast<Vector3>(p_restore).normalized() * orig_in_length));
} }
ur->commit_action(); ur->commit_action();
} }
@ -252,7 +252,7 @@ void PathNode3DGizmo::redraw() {
add_collision_segments(v3p); add_collision_segments(v3p);
} }
if (PathEditorPlugin::singleton->get_edited_path() == path) { if (Path3DEditorPlugin::singleton->get_edited_path() == path) {
v3p.clear(); v3p.clear();
Vector<Vector3> handles; Vector<Vector3> handles;
Vector<Vector3> sec_handles; Vector<Vector3> sec_handles;
@ -292,7 +292,7 @@ PathNode3DGizmo::PathNode3DGizmo(Path3D *p_path) {
set_spatial_node(p_path); set_spatial_node(p_path);
} }
bool PathEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) { bool Path3DEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
if (!path) if (!path)
return false; return false;
@ -448,7 +448,7 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref<I
return false; return false;
} }
void PathEditorPlugin::edit(Object *p_object) { void Path3DEditorPlugin::edit(Object *p_object) {
if (p_object) { if (p_object) {
path = Object::cast_to<Path3D>(p_object); path = Object::cast_to<Path3D>(p_object);
@ -468,12 +468,12 @@ void PathEditorPlugin::edit(Object *p_object) {
//collision_polygon_editor->edit(Object::cast_to<Node>(p_object)); //collision_polygon_editor->edit(Object::cast_to<Node>(p_object));
} }
bool PathEditorPlugin::handles(Object *p_object) const { bool Path3DEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("Path3D"); return p_object->is_class("Path3D");
} }
void PathEditorPlugin::make_visible(bool p_visible) { void Path3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
@ -502,14 +502,14 @@ void PathEditorPlugin::make_visible(bool p_visible) {
} }
} }
void PathEditorPlugin::_mode_changed(int p_idx) { void Path3DEditorPlugin::_mode_changed(int p_idx) {
curve_create->set_pressed(p_idx == 0); curve_create->set_pressed(p_idx == 0);
curve_edit->set_pressed(p_idx == 1); curve_edit->set_pressed(p_idx == 1);
curve_del->set_pressed(p_idx == 2); curve_del->set_pressed(p_idx == 2);
} }
void PathEditorPlugin::_close_curve() { void Path3DEditorPlugin::_close_curve() {
Ref<Curve3D> c = path->get_curve(); Ref<Curve3D> c = path->get_curve();
if (c.is_null()) if (c.is_null())
@ -519,7 +519,7 @@ void PathEditorPlugin::_close_curve() {
c->add_point(c->get_point_position(0), c->get_point_in(0), c->get_point_out(0)); c->add_point(c->get_point_position(0), c->get_point_in(0), c->get_point_out(0));
} }
void PathEditorPlugin::_handle_option_pressed(int p_option) { void Path3DEditorPlugin::_handle_option_pressed(int p_option) {
PopupMenu *pm; PopupMenu *pm;
pm = handle_menu->get_popup(); pm = handle_menu->get_popup();
@ -539,23 +539,23 @@ void PathEditorPlugin::_handle_option_pressed(int p_option) {
} }
} }
void PathEditorPlugin::_notification(int p_what) { void Path3DEditorPlugin::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) { if (p_what == NOTIFICATION_ENTER_TREE) {
curve_create->connect("pressed", callable_mp(this, &PathEditorPlugin::_mode_changed), make_binds(0)); curve_create->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(0));
curve_edit->connect("pressed", callable_mp(this, &PathEditorPlugin::_mode_changed), make_binds(1)); curve_edit->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(1));
curve_del->connect("pressed", callable_mp(this, &PathEditorPlugin::_mode_changed), make_binds(2)); curve_del->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(2));
curve_close->connect("pressed", callable_mp(this, &PathEditorPlugin::_close_curve)); curve_close->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_close_curve));
} }
} }
void PathEditorPlugin::_bind_methods() { void Path3DEditorPlugin::_bind_methods() {
} }
PathEditorPlugin *PathEditorPlugin::singleton = NULL; Path3DEditorPlugin *Path3DEditorPlugin::singleton = NULL;
PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) { Path3DEditorPlugin::Path3DEditorPlugin(EditorNode *p_node) {
path = NULL; path = NULL;
editor = p_node; editor = p_node;
@ -610,7 +610,7 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
menu->set_item_checked(HANDLE_OPTION_ANGLE, mirror_handle_angle); menu->set_item_checked(HANDLE_OPTION_ANGLE, mirror_handle_angle);
menu->add_check_item(TTR("Mirror Handle Lengths")); menu->add_check_item(TTR("Mirror Handle Lengths"));
menu->set_item_checked(HANDLE_OPTION_LENGTH, mirror_handle_length); menu->set_item_checked(HANDLE_OPTION_LENGTH, mirror_handle_length);
menu->connect("id_pressed", callable_mp(this, &PathEditorPlugin::_handle_option_pressed)); menu->connect("id_pressed", callable_mp(this, &Path3DEditorPlugin::_handle_option_pressed));
curve_edit->set_pressed(true); curve_edit->set_pressed(true);
/* /*
@ -624,7 +624,7 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
*/ */
} }
PathEditorPlugin::~PathEditorPlugin() { Path3DEditorPlugin::~Path3DEditorPlugin() {
} }
Ref<EditorNode3DGizmo> PathNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) { Ref<EditorNode3DGizmo> PathNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) {

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* path_editor_plugin.h */ /* path_3d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -31,7 +31,7 @@
#ifndef PATH_EDITOR_PLUGIN_H #ifndef PATH_EDITOR_PLUGIN_H
#define PATH_EDITOR_PLUGIN_H #define PATH_EDITOR_PLUGIN_H
#include "editor/spatial_editor_gizmos.h" #include "editor/node_3d_editor_gizmos.h"
#include "scene/3d/path_3d.h" #include "scene/3d/path_3d.h"
class PathNode3DGizmo : public EditorNode3DGizmo { class PathNode3DGizmo : public EditorNode3DGizmo {
@ -66,9 +66,9 @@ public:
PathNode3DGizmoPlugin(); PathNode3DGizmoPlugin();
}; };
class PathEditorPlugin : public EditorPlugin { class Path3DEditorPlugin : public EditorPlugin {
GDCLASS(PathEditorPlugin, EditorPlugin); GDCLASS(Path3DEditorPlugin, EditorPlugin);
Separator *sep; Separator *sep;
ToolButton *curve_create; ToolButton *curve_create;
@ -100,7 +100,7 @@ protected:
public: public:
Path3D *get_edited_path() { return path; } Path3D *get_edited_path() { return path; }
static PathEditorPlugin *singleton; static Path3DEditorPlugin *singleton;
virtual bool forward_spatial_gui_input(Camera3D *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 bool forward_gui_input(const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
@ -116,8 +116,8 @@ public:
bool is_handle_clicked() { return handle_clicked; } bool is_handle_clicked() { return handle_clicked; }
void set_handle_clicked(bool clicked) { handle_clicked = clicked; } void set_handle_clicked(bool clicked) { handle_clicked = clicked; }
PathEditorPlugin(EditorNode *p_node); Path3DEditorPlugin(EditorNode *p_node);
~PathEditorPlugin(); ~Path3DEditorPlugin();
}; };
#endif // PATH_EDITOR_PLUGIN_H #endif // PATH_EDITOR_PLUGIN_H

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* physical_bone_plugin.cpp */ /* physical_bone_3d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,25 +28,26 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "physical_bone_plugin.h" #include "physical_bone_3d_editor_plugin.h"
#include "editor/plugins/spatial_editor_plugin.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/physics_body_3d.h" #include "scene/3d/physics_body_3d.h"
void PhysicalBoneEditor::_bind_methods() { void PhysicalBone3DEditor::_bind_methods() {
} }
void PhysicalBoneEditor::_on_toggle_button_transform_joint(bool p_is_pressed) { void PhysicalBone3DEditor::_on_toggle_button_transform_joint(bool p_is_pressed) {
_set_move_joint(); _set_move_joint();
} }
void PhysicalBoneEditor::_set_move_joint() { void PhysicalBone3DEditor::_set_move_joint() {
if (selected) { if (selected) {
selected->_set_gizmo_move_joint(button_transform_joint->is_pressed()); selected->_set_gizmo_move_joint(button_transform_joint->is_pressed());
} }
} }
PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) : PhysicalBone3DEditor::PhysicalBone3DEditor(EditorNode *p_editor) :
editor(p_editor), editor(p_editor),
selected(NULL) { selected(NULL) {
@ -61,16 +62,16 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) :
spatial_editor_hb->add_child(button_transform_joint); spatial_editor_hb->add_child(button_transform_joint);
button_transform_joint->set_text(TTR("Move Joint")); button_transform_joint->set_text(TTR("Move Joint"));
button_transform_joint->set_icon(Node3DEditor::get_singleton()->get_theme_icon("PhysicalBone", "EditorIcons")); button_transform_joint->set_icon(Node3DEditor::get_singleton()->get_theme_icon("PhysicalBone3D", "EditorIcons"));
button_transform_joint->set_toggle_mode(true); button_transform_joint->set_toggle_mode(true);
button_transform_joint->connect("toggled", callable_mp(this, &PhysicalBoneEditor::_on_toggle_button_transform_joint)); button_transform_joint->connect("toggled", callable_mp(this, &PhysicalBone3DEditor::_on_toggle_button_transform_joint));
hide(); hide();
} }
PhysicalBoneEditor::~PhysicalBoneEditor() {} PhysicalBone3DEditor::~PhysicalBone3DEditor() {}
void PhysicalBoneEditor::set_selected(PhysicalBone3D *p_pb) { void PhysicalBone3DEditor::set_selected(PhysicalBone3D *p_pb) {
button_transform_joint->set_pressed(false); button_transform_joint->set_pressed(false);
@ -79,20 +80,20 @@ void PhysicalBoneEditor::set_selected(PhysicalBone3D *p_pb) {
_set_move_joint(); _set_move_joint();
} }
void PhysicalBoneEditor::hide() { void PhysicalBone3DEditor::hide() {
spatial_editor_hb->hide(); spatial_editor_hb->hide();
} }
void PhysicalBoneEditor::show() { void PhysicalBone3DEditor::show() {
spatial_editor_hb->show(); spatial_editor_hb->show();
} }
PhysicalBonePlugin::PhysicalBonePlugin(EditorNode *p_editor) : PhysicalBone3DEditorPlugin::PhysicalBone3DEditorPlugin(EditorNode *p_editor) :
editor(p_editor), editor(p_editor),
selected(NULL), selected(NULL),
physical_bone_editor(editor) {} physical_bone_editor(editor) {}
void PhysicalBonePlugin::make_visible(bool p_visible) { void PhysicalBone3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
physical_bone_editor.show(); physical_bone_editor.show();
@ -104,7 +105,7 @@ void PhysicalBonePlugin::make_visible(bool p_visible) {
} }
} }
void PhysicalBonePlugin::edit(Object *p_node) { void PhysicalBone3DEditorPlugin::edit(Object *p_node) {
selected = static_cast<PhysicalBone3D *>(p_node); // Trust it selected = static_cast<PhysicalBone3D *>(p_node); // Trust it
ERR_FAIL_COND(!selected); ERR_FAIL_COND(!selected);

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* physical_bone_plugin.h */ /* physical_bone_3d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -33,8 +33,8 @@
#include "editor/editor_node.h" #include "editor/editor_node.h"
class PhysicalBoneEditor : public Object { class PhysicalBone3DEditor : public Object {
GDCLASS(PhysicalBoneEditor, Object); GDCLASS(PhysicalBone3DEditor, Object);
EditorNode *editor; EditorNode *editor;
HBoxContainer *spatial_editor_hb; HBoxContainer *spatial_editor_hb;
@ -50,8 +50,8 @@ private:
void _set_move_joint(); void _set_move_joint();
public: public:
PhysicalBoneEditor(EditorNode *p_editor); PhysicalBone3DEditor(EditorNode *p_editor);
~PhysicalBoneEditor(); ~PhysicalBone3DEditor();
void set_selected(PhysicalBone3D *p_pb); void set_selected(PhysicalBone3D *p_pb);
@ -59,12 +59,12 @@ public:
void show(); void show();
}; };
class PhysicalBonePlugin : public EditorPlugin { class PhysicalBone3DEditorPlugin : public EditorPlugin {
GDCLASS(PhysicalBonePlugin, EditorPlugin); GDCLASS(PhysicalBone3DEditorPlugin, EditorPlugin);
EditorNode *editor; EditorNode *editor;
PhysicalBone3D *selected; PhysicalBone3D *selected;
PhysicalBoneEditor physical_bone_editor; PhysicalBone3DEditor physical_bone_editor;
public: public:
virtual String get_name() const { return "PhysicalBone3D"; } virtual String get_name() const { return "PhysicalBone3D"; }
@ -72,7 +72,7 @@ public:
virtual void make_visible(bool p_visible); virtual void make_visible(bool p_visible);
virtual void edit(Object *p_node); virtual void edit(Object *p_node);
PhysicalBonePlugin(EditorNode *p_editor); PhysicalBone3DEditorPlugin(EditorNode *p_editor);
}; };
#endif #endif

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* skeleton_editor_plugin.cpp */ /* skeleton_3d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,16 +28,16 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "skeleton_editor_plugin.h" #include "skeleton_3d_editor_plugin.h"
#include "node_3d_editor_plugin.h"
#include "scene/3d/collision_shape_3d.h" #include "scene/3d/collision_shape_3d.h"
#include "scene/3d/physics_body_3d.h" #include "scene/3d/physics_body_3d.h"
#include "scene/3d/physics_joint_3d.h" #include "scene/3d/physics_joint_3d.h"
#include "scene/resources/capsule_shape_3d.h" #include "scene/resources/capsule_shape_3d.h"
#include "scene/resources/sphere_shape_3d.h" #include "scene/resources/sphere_shape_3d.h"
#include "spatial_editor_plugin.h"
void SkeletonEditor::_on_click_option(int p_option) { void Skeleton3DEditor::_on_click_option(int p_option) {
if (!skeleton) { if (!skeleton) {
return; return;
} }
@ -49,7 +49,7 @@ void SkeletonEditor::_on_click_option(int p_option) {
} }
} }
void SkeletonEditor::create_physical_skeleton() { void Skeleton3DEditor::create_physical_skeleton() {
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
Node *owner = skeleton == get_tree()->get_edited_scene_root() ? skeleton : skeleton->get_owner(); Node *owner = skeleton == get_tree()->get_edited_scene_root() ? skeleton : skeleton->get_owner();
@ -101,7 +101,7 @@ void SkeletonEditor::create_physical_skeleton() {
} }
} }
PhysicalBone3D *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos) { PhysicalBone3D *Skeleton3DEditor::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 Transform child_rest = skeleton->get_bone_rest(bone_child_id);
@ -130,18 +130,18 @@ PhysicalBone3D *SkeletonEditor::create_physical_bone(int bone_id, int bone_child
return physical_bone; return physical_bone;
} }
void SkeletonEditor::edit(Skeleton3D *p_node) { void Skeleton3DEditor::edit(Skeleton3D *p_node) {
skeleton = p_node; skeleton = p_node;
} }
void SkeletonEditor::_notification(int p_what) { void Skeleton3DEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) { if (p_what == NOTIFICATION_ENTER_TREE) {
get_tree()->connect("node_removed", callable_mp(this, &SkeletonEditor::_node_removed)); get_tree()->connect("node_removed", callable_mp(this, &Skeleton3DEditor::_node_removed));
} }
} }
void SkeletonEditor::_node_removed(Node *p_node) { void Skeleton3DEditor::_node_removed(Node *p_node) {
if (p_node == skeleton) { if (p_node == skeleton) {
skeleton = NULL; skeleton = NULL;
@ -149,34 +149,34 @@ void SkeletonEditor::_node_removed(Node *p_node) {
} }
} }
void SkeletonEditor::_bind_methods() { void Skeleton3DEditor::_bind_methods() {
} }
SkeletonEditor::SkeletonEditor() { Skeleton3DEditor::Skeleton3DEditor() {
skeleton = NULL; skeleton = NULL;
options = memnew(MenuButton); options = memnew(MenuButton);
Node3DEditor::get_singleton()->add_control_to_menu_panel(options); Node3DEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text(TTR("Skeleton")); options->set_text(TTR("Skeleton3D"));
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Skeleton3D", "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); options->get_popup()->add_item(TTR("Create physical skeleton"), MENU_OPTION_CREATE_PHYSICAL_SKELETON);
options->get_popup()->connect("id_pressed", callable_mp(this, &SkeletonEditor::_on_click_option)); options->get_popup()->connect("id_pressed", callable_mp(this, &Skeleton3DEditor::_on_click_option));
options->hide(); options->hide();
} }
SkeletonEditor::~SkeletonEditor() {} Skeleton3DEditor::~Skeleton3DEditor() {}
void SkeletonEditorPlugin::edit(Object *p_object) { void Skeleton3DEditorPlugin::edit(Object *p_object) {
skeleton_editor->edit(Object::cast_to<Skeleton3D>(p_object)); skeleton_editor->edit(Object::cast_to<Skeleton3D>(p_object));
} }
bool SkeletonEditorPlugin::handles(Object *p_object) const { bool Skeleton3DEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("Skeleton3D"); return p_object->is_class("Skeleton3D");
} }
void SkeletonEditorPlugin::make_visible(bool p_visible) { void Skeleton3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
skeleton_editor->options->show(); skeleton_editor->options->show();
} else { } else {
@ -186,10 +186,10 @@ void SkeletonEditorPlugin::make_visible(bool p_visible) {
} }
} }
SkeletonEditorPlugin::SkeletonEditorPlugin(EditorNode *p_node) { Skeleton3DEditorPlugin::Skeleton3DEditorPlugin(EditorNode *p_node) {
editor = p_node; editor = p_node;
skeleton_editor = memnew(SkeletonEditor); skeleton_editor = memnew(Skeleton3DEditor);
editor->get_viewport()->add_child(skeleton_editor); editor->get_viewport()->add_child(skeleton_editor);
} }
SkeletonEditorPlugin::~SkeletonEditorPlugin() {} Skeleton3DEditorPlugin::~Skeleton3DEditorPlugin() {}

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* skeleton_editor_plugin.h */ /* skeleton_3d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#ifndef SKELETON_EDITOR_PLUGIN_H #ifndef SKELETON_3D_EDITOR_PLUGIN_H
#define SKELETON_EDITOR_PLUGIN_H #define SKELETON_3D_EDITOR_PLUGIN_H
#include "editor/editor_node.h" #include "editor/editor_node.h"
#include "editor/editor_plugin.h" #include "editor/editor_plugin.h"
@ -38,8 +38,8 @@
class PhysicalBone3D; class PhysicalBone3D;
class Joint3D; class Joint3D;
class SkeletonEditor : public Node { class Skeleton3DEditor : public Node {
GDCLASS(SkeletonEditor, Node); GDCLASS(Skeleton3DEditor, Node);
enum Menu { enum Menu {
MENU_OPTION_CREATE_PHYSICAL_SKELETON MENU_OPTION_CREATE_PHYSICAL_SKELETON
@ -58,7 +58,7 @@ class SkeletonEditor : public Node {
void _on_click_option(int p_option); void _on_click_option(int p_option);
friend class SkeletonEditorPlugin; friend class Skeleton3DEditorPlugin;
protected: protected:
void _notification(int p_what); void _notification(int p_what);
@ -71,26 +71,26 @@ protected:
public: public:
void edit(Skeleton3D *p_node); void edit(Skeleton3D *p_node);
SkeletonEditor(); Skeleton3DEditor();
~SkeletonEditor(); ~Skeleton3DEditor();
}; };
class SkeletonEditorPlugin : public EditorPlugin { class Skeleton3DEditorPlugin : public EditorPlugin {
GDCLASS(SkeletonEditorPlugin, EditorPlugin); GDCLASS(Skeleton3DEditorPlugin, EditorPlugin);
EditorNode *editor; EditorNode *editor;
SkeletonEditor *skeleton_editor; Skeleton3DEditor *skeleton_editor;
public: public:
virtual String get_name() const { return "Skeleton"; } virtual String get_name() const { return "Skeleton3D"; }
virtual bool has_main_screen() const { return false; } virtual bool has_main_screen() const { return false; }
virtual void edit(Object *p_object); virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const; virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible); virtual void make_visible(bool p_visible);
SkeletonEditorPlugin(EditorNode *p_node); Skeleton3DEditorPlugin(EditorNode *p_node);
~SkeletonEditorPlugin(); ~Skeleton3DEditorPlugin();
}; };
#endif // SKELETON_EDITOR_PLUGIN_H #endif // SKELETON_3D_EDITOR_PLUGIN_H

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* skeleton_ik_editor_plugin.cpp */ /* skeleton_ik_3d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "skeleton_ik_editor_plugin.h" #include "skeleton_ik_3d_editor_plugin.h"
#include "scene/animation/skeleton_ik.h" #include "scene/3d/skeleton_ik_3d.h"
void SkeletonIKEditorPlugin::_play() { void SkeletonIK3DEditorPlugin::_play() {
if (!skeleton_ik) if (!skeleton_ik)
return; return;
@ -48,7 +48,7 @@ void SkeletonIKEditorPlugin::_play() {
} }
} }
void SkeletonIKEditorPlugin::edit(Object *p_object) { void SkeletonIK3DEditorPlugin::edit(Object *p_object) {
if (p_object != skeleton_ik) { if (p_object != skeleton_ik) {
if (skeleton_ik) { if (skeleton_ik) {
@ -64,12 +64,12 @@ void SkeletonIKEditorPlugin::edit(Object *p_object) {
skeleton_ik = s; skeleton_ik = s;
} }
bool SkeletonIKEditorPlugin::handles(Object *p_object) const { bool SkeletonIK3DEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("SkeletonIK3D"); return p_object->is_class("SkeletonIK3D");
} }
void SkeletonIKEditorPlugin::make_visible(bool p_visible) { void SkeletonIK3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) if (p_visible)
play_btn->show(); play_btn->show();
@ -77,10 +77,10 @@ void SkeletonIKEditorPlugin::make_visible(bool p_visible) {
play_btn->hide(); play_btn->hide();
} }
void SkeletonIKEditorPlugin::_bind_methods() { void SkeletonIK3DEditorPlugin::_bind_methods() {
} }
SkeletonIKEditorPlugin::SkeletonIKEditorPlugin(EditorNode *p_node) { SkeletonIK3DEditorPlugin::SkeletonIK3DEditorPlugin(EditorNode *p_node) {
editor = p_node; editor = p_node;
play_btn = memnew(Button); play_btn = memnew(Button);
@ -88,9 +88,9 @@ SkeletonIKEditorPlugin::SkeletonIKEditorPlugin(EditorNode *p_node) {
play_btn->set_text(TTR("Play IK")); play_btn->set_text(TTR("Play IK"));
play_btn->set_toggle_mode(true); play_btn->set_toggle_mode(true);
play_btn->hide(); play_btn->hide();
play_btn->connect("pressed", callable_mp(this, &SkeletonIKEditorPlugin::_play)); play_btn->connect("pressed", callable_mp(this, &SkeletonIK3DEditorPlugin::_play));
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, play_btn); add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, play_btn);
skeleton_ik = NULL; skeleton_ik = NULL;
} }
SkeletonIKEditorPlugin::~SkeletonIKEditorPlugin() {} SkeletonIK3DEditorPlugin::~SkeletonIK3DEditorPlugin() {}

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* skeleton_ik_editor_plugin.h */ /* skeleton_ik_3d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,17 +28,17 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#ifndef SKELETON_IK_EDITOR_PLUGIN_H #ifndef SKELETON_IK_3D_EDITOR_PLUGIN_H
#define SKELETON_IK_EDITOR_PLUGIN_H #define SKELETON_IK_3D_EDITOR_PLUGIN_H
#include "editor/editor_node.h" #include "editor/editor_node.h"
#include "editor/editor_plugin.h" #include "editor/editor_plugin.h"
class SkeletonIK3D; class SkeletonIK3D;
class SkeletonIKEditorPlugin : public EditorPlugin { class SkeletonIK3DEditorPlugin : public EditorPlugin {
GDCLASS(SkeletonIKEditorPlugin, EditorPlugin); GDCLASS(SkeletonIK3DEditorPlugin, EditorPlugin);
SkeletonIK3D *skeleton_ik; SkeletonIK3D *skeleton_ik;
@ -57,8 +57,8 @@ public:
virtual bool handles(Object *p_object) const; virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible); virtual void make_visible(bool p_visible);
SkeletonIKEditorPlugin(EditorNode *p_node); SkeletonIK3DEditorPlugin(EditorNode *p_node);
~SkeletonIKEditorPlugin(); ~SkeletonIK3DEditorPlugin();
}; };
#endif // SKELETON_IK_EDITOR_PLUGIN_H #endif // SKELETON_IK_3D_EDITOR_PLUGIN_H

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* sprite_editor_plugin.cpp */ /* sprite_2d_editor_plugin.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "sprite_editor_plugin.h" #include "sprite_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h" #include "canvas_item_editor_plugin.h"
#include "editor/editor_scale.h" #include "editor/editor_scale.h"
@ -39,7 +39,7 @@
#include "scene/gui/box_container.h" #include "scene/gui/box_container.h"
#include "thirdparty/misc/clipper.hpp" #include "thirdparty/misc/clipper.hpp"
void SpriteEditor::_node_removed(Node *p_node) { void Sprite2DEditor::_node_removed(Node *p_node) {
if (p_node == node) { if (p_node == node) {
node = NULL; node = NULL;
@ -47,7 +47,7 @@ void SpriteEditor::_node_removed(Node *p_node) {
} }
} }
void SpriteEditor::edit(Sprite2D *p_sprite) { void Sprite2DEditor::edit(Sprite2D *p_sprite) {
node = p_sprite; node = p_sprite;
} }
@ -114,7 +114,7 @@ Vector<Vector2> expand(const Vector<Vector2> &points, const Rect2i &rect, float
return outPoints; return outPoints;
} }
void SpriteEditor::_menu_option(int p_option) { void Sprite2DEditor::_menu_option(int p_option) {
if (!node) { if (!node) {
return; return;
@ -165,11 +165,11 @@ void SpriteEditor::_menu_option(int p_option) {
} }
} }
void SpriteEditor::_update_mesh_data() { void Sprite2DEditor::_update_mesh_data() {
Ref<Texture2D> texture = node->get_texture(); Ref<Texture2D> texture = node->get_texture();
if (texture.is_null()) { if (texture.is_null()) {
err_dialog->set_text(TTR("Sprite is empty!")); err_dialog->set_text(TTR("Sprite2D is empty!"));
err_dialog->popup_centered(); err_dialog->popup_centered();
return; return;
} }
@ -296,7 +296,7 @@ void SpriteEditor::_update_mesh_data() {
debug_uv->update(); debug_uv->update();
} }
void SpriteEditor::_create_node() { void Sprite2DEditor::_create_node() {
switch (selected_menu_item) { switch (selected_menu_item) {
case MENU_OPTION_CONVERT_TO_MESH_2D: { case MENU_OPTION_CONVERT_TO_MESH_2D: {
_convert_to_mesh_2d_node(); _convert_to_mesh_2d_node();
@ -313,7 +313,7 @@ void SpriteEditor::_create_node() {
} }
} }
void SpriteEditor::_convert_to_mesh_2d_node() { void Sprite2DEditor::_convert_to_mesh_2d_node() {
if (computed_vertices.size() < 3) { if (computed_vertices.size() < 3) {
err_dialog->set_text(TTR("Invalid geometry, can't replace by mesh.")); err_dialog->set_text(TTR("Invalid geometry, can't replace by mesh."));
@ -344,7 +344,7 @@ void SpriteEditor::_convert_to_mesh_2d_node() {
ur->commit_action(); ur->commit_action();
} }
void SpriteEditor::_convert_to_polygon_2d_node() { void Sprite2DEditor::_convert_to_polygon_2d_node() {
if (computed_outline_lines.empty()) { if (computed_outline_lines.empty()) {
err_dialog->set_text(TTR("Invalid geometry, can't create polygon.")); err_dialog->set_text(TTR("Invalid geometry, can't create polygon."));
@ -403,7 +403,7 @@ void SpriteEditor::_convert_to_polygon_2d_node() {
ur->commit_action(); ur->commit_action();
} }
void SpriteEditor::_create_collision_polygon_2d_node() { void Sprite2DEditor::_create_collision_polygon_2d_node() {
if (computed_outline_lines.empty()) { if (computed_outline_lines.empty()) {
err_dialog->set_text(TTR("Invalid geometry, can't create collision polygon.")); err_dialog->set_text(TTR("Invalid geometry, can't create collision polygon."));
@ -427,7 +427,7 @@ void SpriteEditor::_create_collision_polygon_2d_node() {
} }
} }
void SpriteEditor::_create_light_occluder_2d_node() { void Sprite2DEditor::_create_light_occluder_2d_node() {
if (computed_outline_lines.empty()) { if (computed_outline_lines.empty()) {
err_dialog->set_text(TTR("Invalid geometry, can't create light occluder.")); err_dialog->set_text(TTR("Invalid geometry, can't create light occluder."));
@ -462,7 +462,7 @@ void SpriteEditor::_create_light_occluder_2d_node() {
} }
} }
void SpriteEditor::_add_as_sibling_or_child(Node *p_own_node, Node *p_new_node) { void Sprite2DEditor::_add_as_sibling_or_child(Node *p_own_node, Node *p_new_node) {
// Can't make sibling if own node is scene root // Can't make sibling if own node is scene root
if (p_own_node != this->get_tree()->get_edited_scene_root()) { if (p_own_node != this->get_tree()->get_edited_scene_root()) {
p_own_node->get_parent()->add_child(p_new_node, true); p_own_node->get_parent()->add_child(p_new_node, true);
@ -474,7 +474,7 @@ void SpriteEditor::_add_as_sibling_or_child(Node *p_own_node, Node *p_new_node)
p_new_node->set_owner(this->get_tree()->get_edited_scene_root()); p_new_node->set_owner(this->get_tree()->get_edited_scene_root());
} }
void SpriteEditor::_debug_uv_draw() { void Sprite2DEditor::_debug_uv_draw() {
Ref<Texture2D> tex = node->get_texture(); Ref<Texture2D> tex = node->get_texture();
ERR_FAIL_COND(!tex.is_valid()); ERR_FAIL_COND(!tex.is_valid());
@ -502,19 +502,19 @@ void SpriteEditor::_debug_uv_draw() {
} }
} }
void SpriteEditor::_bind_methods() { void Sprite2DEditor::_bind_methods() {
ClassDB::bind_method("_add_as_sibling_or_child", &SpriteEditor::_add_as_sibling_or_child); ClassDB::bind_method("_add_as_sibling_or_child", &Sprite2DEditor::_add_as_sibling_or_child);
} }
SpriteEditor::SpriteEditor() { Sprite2DEditor::Sprite2DEditor() {
options = memnew(MenuButton); options = memnew(MenuButton);
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options); CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text(TTR("Sprite")); options->set_text(TTR("Sprite2D"));
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Sprite", "EditorIcons")); options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Sprite2D", "EditorIcons"));
options->get_popup()->add_item(TTR("Convert to Mesh2D"), MENU_OPTION_CONVERT_TO_MESH_2D); options->get_popup()->add_item(TTR("Convert to Mesh2D"), MENU_OPTION_CONVERT_TO_MESH_2D);
options->get_popup()->add_item(TTR("Convert to Polygon2D"), MENU_OPTION_CONVERT_TO_POLYGON_2D); options->get_popup()->add_item(TTR("Convert to Polygon2D"), MENU_OPTION_CONVERT_TO_POLYGON_2D);
@ -522,7 +522,7 @@ SpriteEditor::SpriteEditor() {
options->get_popup()->add_item(TTR("Create LightOccluder2D Sibling"), MENU_OPTION_CREATE_LIGHT_OCCLUDER_2D); options->get_popup()->add_item(TTR("Create LightOccluder2D Sibling"), MENU_OPTION_CREATE_LIGHT_OCCLUDER_2D);
options->set_switch_on_hover(true); options->set_switch_on_hover(true);
options->get_popup()->connect("id_pressed", callable_mp(this, &SpriteEditor::_menu_option)); options->get_popup()->connect("id_pressed", callable_mp(this, &Sprite2DEditor::_menu_option));
err_dialog = memnew(AcceptDialog); err_dialog = memnew(AcceptDialog);
add_child(err_dialog); add_child(err_dialog);
@ -538,9 +538,9 @@ SpriteEditor::SpriteEditor() {
scroll->set_enable_v_scroll(true); scroll->set_enable_v_scroll(true);
vb->add_margin_child(TTR("Preview:"), scroll, true); vb->add_margin_child(TTR("Preview:"), scroll, true);
debug_uv = memnew(Control); debug_uv = memnew(Control);
debug_uv->connect("draw", callable_mp(this, &SpriteEditor::_debug_uv_draw)); debug_uv->connect("draw", callable_mp(this, &Sprite2DEditor::_debug_uv_draw));
scroll->add_child(debug_uv); scroll->add_child(debug_uv);
debug_uv_dialog->connect("confirmed", callable_mp(this, &SpriteEditor::_create_node)); debug_uv_dialog->connect("confirmed", callable_mp(this, &Sprite2DEditor::_create_node));
HBoxContainer *hb = memnew(HBoxContainer); HBoxContainer *hb = memnew(HBoxContainer);
hb->add_child(memnew(Label(TTR("Simplification: ")))); hb->add_child(memnew(Label(TTR("Simplification: "))));
@ -569,24 +569,24 @@ SpriteEditor::SpriteEditor() {
hb->add_spacer(); hb->add_spacer();
update_preview = memnew(Button); update_preview = memnew(Button);
update_preview->set_text(TTR("Update Preview")); update_preview->set_text(TTR("Update Preview"));
update_preview->connect("pressed", callable_mp(this, &SpriteEditor::_update_mesh_data)); update_preview->connect("pressed", callable_mp(this, &Sprite2DEditor::_update_mesh_data));
hb->add_child(update_preview); hb->add_child(update_preview);
vb->add_margin_child(TTR("Settings:"), hb); vb->add_margin_child(TTR("Settings:"), hb);
add_child(debug_uv_dialog); add_child(debug_uv_dialog);
} }
void SpriteEditorPlugin::edit(Object *p_object) { void Sprite2DEditorPlugin::edit(Object *p_object) {
sprite_editor->edit(Object::cast_to<Sprite2D>(p_object)); sprite_editor->edit(Object::cast_to<Sprite2D>(p_object));
} }
bool SpriteEditorPlugin::handles(Object *p_object) const { bool Sprite2DEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("Sprite2D"); return p_object->is_class("Sprite2D");
} }
void SpriteEditorPlugin::make_visible(bool p_visible) { void Sprite2DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
sprite_editor->options->show(); sprite_editor->options->show();
@ -597,15 +597,15 @@ void SpriteEditorPlugin::make_visible(bool p_visible) {
} }
} }
SpriteEditorPlugin::SpriteEditorPlugin(EditorNode *p_node) { Sprite2DEditorPlugin::Sprite2DEditorPlugin(EditorNode *p_node) {
editor = p_node; editor = p_node;
sprite_editor = memnew(SpriteEditor); sprite_editor = memnew(Sprite2DEditor);
editor->get_viewport()->add_child(sprite_editor); editor->get_viewport()->add_child(sprite_editor);
make_visible(false); make_visible(false);
//sprite_editor->options->hide(); //sprite_editor->options->hide();
} }
SpriteEditorPlugin::~SpriteEditorPlugin() { Sprite2DEditorPlugin::~Sprite2DEditorPlugin() {
} }

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* sprite_editor_plugin.h */ /* sprite_2d_editor_plugin.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -36,9 +36,9 @@
#include "scene/2d/sprite_2d.h" #include "scene/2d/sprite_2d.h"
#include "scene/gui/spin_box.h" #include "scene/gui/spin_box.h"
class SpriteEditor : public Control { class Sprite2DEditor : public Control {
GDCLASS(SpriteEditor, Control); GDCLASS(Sprite2DEditor, Control);
enum Menu { enum Menu {
MENU_OPTION_CONVERT_TO_MESH_2D, MENU_OPTION_CONVERT_TO_MESH_2D,
@ -74,7 +74,7 @@ class SpriteEditor : public Control {
void _menu_option(int p_option); void _menu_option(int p_option);
//void _create_uv_lines(); //void _create_uv_lines();
friend class SpriteEditorPlugin; friend class Sprite2DEditorPlugin;
void _debug_uv_draw(); void _debug_uv_draw();
void _update_mesh_data(); void _update_mesh_data();
@ -93,14 +93,14 @@ protected:
public: public:
void edit(Sprite2D *p_sprite); void edit(Sprite2D *p_sprite);
SpriteEditor(); Sprite2DEditor();
}; };
class SpriteEditorPlugin : public EditorPlugin { class Sprite2DEditorPlugin : public EditorPlugin {
GDCLASS(SpriteEditorPlugin, EditorPlugin); GDCLASS(Sprite2DEditorPlugin, EditorPlugin);
SpriteEditor *sprite_editor; Sprite2DEditor *sprite_editor;
EditorNode *editor; EditorNode *editor;
public: public:
@ -110,8 +110,8 @@ public:
virtual bool handles(Object *p_object) const; virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible); virtual void make_visible(bool p_visible);
SpriteEditorPlugin(EditorNode *p_node); Sprite2DEditorPlugin(EditorNode *p_node);
~SpriteEditorPlugin(); ~Sprite2DEditorPlugin();
}; };
#endif // SPRITE_EDITOR_PLUGIN_H #endif // SPRITE_EDITOR_PLUGIN_H

View file

@ -42,8 +42,8 @@
#include "editor/multi_node_edit.h" #include "editor/multi_node_edit.h"
#include "editor/plugins/animation_player_editor_plugin.h" #include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/canvas_item_editor_plugin.h" #include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h" #include "editor/plugins/script_editor_plugin.h"
#include "editor/plugins/spatial_editor_plugin.h"
#include "scene/main/window.h" #include "scene/main/window.h"
#include "scene/resources/packed_scene.h" #include "scene/resources/packed_scene.h"
#include "servers/display_server.h" #include "servers/display_server.h"

View file

@ -33,7 +33,7 @@
#include "csg_shape.h" #include "csg_shape.h"
#include "editor/editor_plugin.h" #include "editor/editor_plugin.h"
#include "editor/spatial_editor_gizmos.h" #include "editor/node_3d_editor_gizmos.h"
class CSGShapeNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { class CSGShapeNode3DGizmoPlugin : public EditorNode3DGizmoPlugin {

View file

@ -32,7 +32,7 @@
#include "core/input/input_filter.h" #include "core/input/input_filter.h"
#include "editor/editor_scale.h" #include "editor/editor_scale.h"
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
#include "editor/plugins/spatial_editor_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/camera_3d.h" #include "scene/3d/camera_3d.h"
#include "core/math/geometry.h" #include "core/math/geometry.h"

View file

@ -31,8 +31,8 @@
#include "cpu_particles_2d.h" #include "cpu_particles_2d.h"
#include "core/core_string_names.h" #include "core/core_string_names.h"
#include "scene/2d/canvas_item.h" #include "scene/2d/gpu_particles_2d.h"
#include "scene/2d/particles_2d.h" #include "scene/main/canvas_item.h"
#include "scene/resources/particles_material.h" #include "scene/resources/particles_material.h"
#include "servers/visual_server.h" #include "servers/visual_server.h"
@ -1144,7 +1144,7 @@ void CPUParticles2D::_notification(int p_what) {
void CPUParticles2D::convert_from_particles(Node *p_particles) { void CPUParticles2D::convert_from_particles(Node *p_particles) {
Particles2D *particles = Object::cast_to<Particles2D>(p_particles); GPUParticles2D *particles = Object::cast_to<GPUParticles2D>(p_particles);
ERR_FAIL_COND_MSG(!particles, "Only Particles2D nodes can be converted to CPUParticles2D."); ERR_FAIL_COND_MSG(!particles, "Only Particles2D nodes can be converted to CPUParticles2D.");
set_emitting(particles->is_emitting()); set_emitting(particles->is_emitting());

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* particles_2d.cpp */ /* gpu_particles_2d.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "particles_2d.h" #include "gpu_particles_2d.h"
#include "core/os/os.h" #include "core/os/os.h"
#include "scene/resources/particles_material.h" #include "scene/resources/particles_material.h"
@ -38,7 +38,7 @@
#include "core/engine.h" #include "core/engine.h"
#endif #endif
void Particles2D::set_emitting(bool p_emitting) { void GPUParticles2D::set_emitting(bool p_emitting) {
VS::get_singleton()->particles_set_emitting(particles, p_emitting); VS::get_singleton()->particles_set_emitting(particles, p_emitting);
@ -49,20 +49,20 @@ void Particles2D::set_emitting(bool p_emitting) {
} }
} }
void Particles2D::set_amount(int p_amount) { void GPUParticles2D::set_amount(int p_amount) {
ERR_FAIL_COND_MSG(p_amount < 1, "Amount of particles cannot be smaller than 1."); ERR_FAIL_COND_MSG(p_amount < 1, "Amount of particles cannot be smaller than 1.");
amount = p_amount; amount = p_amount;
VS::get_singleton()->particles_set_amount(particles, amount); VS::get_singleton()->particles_set_amount(particles, amount);
} }
void Particles2D::set_lifetime(float p_lifetime) { void GPUParticles2D::set_lifetime(float p_lifetime) {
ERR_FAIL_COND_MSG(p_lifetime <= 0, "Particles lifetime must be greater than 0."); ERR_FAIL_COND_MSG(p_lifetime <= 0, "Particles lifetime must be greater than 0.");
lifetime = p_lifetime; lifetime = p_lifetime;
VS::get_singleton()->particles_set_lifetime(particles, lifetime); VS::get_singleton()->particles_set_lifetime(particles, lifetime);
} }
void Particles2D::set_one_shot(bool p_enable) { void GPUParticles2D::set_one_shot(bool p_enable) {
one_shot = p_enable; one_shot = p_enable;
VS::get_singleton()->particles_set_one_shot(particles, one_shot); VS::get_singleton()->particles_set_one_shot(particles, one_shot);
@ -77,22 +77,22 @@ void Particles2D::set_one_shot(bool p_enable) {
if (!one_shot) if (!one_shot)
set_process_internal(false); set_process_internal(false);
} }
void Particles2D::set_pre_process_time(float p_time) { void GPUParticles2D::set_pre_process_time(float p_time) {
pre_process_time = p_time; pre_process_time = p_time;
VS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time); VS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time);
} }
void Particles2D::set_explosiveness_ratio(float p_ratio) { void GPUParticles2D::set_explosiveness_ratio(float p_ratio) {
explosiveness_ratio = p_ratio; explosiveness_ratio = p_ratio;
VS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio); VS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio);
} }
void Particles2D::set_randomness_ratio(float p_ratio) { void GPUParticles2D::set_randomness_ratio(float p_ratio) {
randomness_ratio = p_ratio; randomness_ratio = p_ratio;
VS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio); VS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
} }
void Particles2D::set_visibility_rect(const Rect2 &p_visibility_rect) { void GPUParticles2D::set_visibility_rect(const Rect2 &p_visibility_rect) {
visibility_rect = p_visibility_rect; visibility_rect = p_visibility_rect;
AABB aabb; AABB aabb;
@ -106,7 +106,7 @@ void Particles2D::set_visibility_rect(const Rect2 &p_visibility_rect) {
_change_notify("visibility_rect"); _change_notify("visibility_rect");
update(); update();
} }
void Particles2D::set_use_local_coordinates(bool p_enable) { void GPUParticles2D::set_use_local_coordinates(bool p_enable) {
local_coords = p_enable; local_coords = p_enable;
VS::get_singleton()->particles_set_use_local_coordinates(particles, local_coords); VS::get_singleton()->particles_set_use_local_coordinates(particles, local_coords);
@ -116,7 +116,7 @@ void Particles2D::set_use_local_coordinates(bool p_enable) {
} }
} }
void Particles2D::_update_particle_emission_transform() { void GPUParticles2D::_update_particle_emission_transform() {
Transform2D xf2d = get_global_transform(); Transform2D xf2d = get_global_transform();
Transform xf; Transform xf;
@ -127,7 +127,7 @@ void Particles2D::_update_particle_emission_transform() {
VS::get_singleton()->particles_set_emission_transform(particles, xf); VS::get_singleton()->particles_set_emission_transform(particles, xf);
} }
void Particles2D::set_process_material(const Ref<Material> &p_material) { void GPUParticles2D::set_process_material(const Ref<Material> &p_material) {
process_material = p_material; process_material = p_material;
Ref<ParticlesMaterial> pm = p_material; Ref<ParticlesMaterial> pm = p_material;
@ -144,89 +144,89 @@ void Particles2D::set_process_material(const Ref<Material> &p_material) {
update_configuration_warning(); update_configuration_warning();
} }
void Particles2D::set_speed_scale(float p_scale) { void GPUParticles2D::set_speed_scale(float p_scale) {
speed_scale = p_scale; speed_scale = p_scale;
VS::get_singleton()->particles_set_speed_scale(particles, p_scale); VS::get_singleton()->particles_set_speed_scale(particles, p_scale);
} }
bool Particles2D::is_emitting() const { bool GPUParticles2D::is_emitting() const {
return VS::get_singleton()->particles_get_emitting(particles); return VS::get_singleton()->particles_get_emitting(particles);
} }
int Particles2D::get_amount() const { int GPUParticles2D::get_amount() const {
return amount; return amount;
} }
float Particles2D::get_lifetime() const { float GPUParticles2D::get_lifetime() const {
return lifetime; return lifetime;
} }
bool Particles2D::get_one_shot() const { bool GPUParticles2D::get_one_shot() const {
return one_shot; return one_shot;
} }
float Particles2D::get_pre_process_time() const { float GPUParticles2D::get_pre_process_time() const {
return pre_process_time; return pre_process_time;
} }
float Particles2D::get_explosiveness_ratio() const { float GPUParticles2D::get_explosiveness_ratio() const {
return explosiveness_ratio; return explosiveness_ratio;
} }
float Particles2D::get_randomness_ratio() const { float GPUParticles2D::get_randomness_ratio() const {
return randomness_ratio; return randomness_ratio;
} }
Rect2 Particles2D::get_visibility_rect() const { Rect2 GPUParticles2D::get_visibility_rect() const {
return visibility_rect; return visibility_rect;
} }
bool Particles2D::get_use_local_coordinates() const { bool GPUParticles2D::get_use_local_coordinates() const {
return local_coords; return local_coords;
} }
Ref<Material> Particles2D::get_process_material() const { Ref<Material> GPUParticles2D::get_process_material() const {
return process_material; return process_material;
} }
float Particles2D::get_speed_scale() const { float GPUParticles2D::get_speed_scale() const {
return speed_scale; return speed_scale;
} }
void Particles2D::set_draw_order(DrawOrder p_order) { void GPUParticles2D::set_draw_order(DrawOrder p_order) {
draw_order = p_order; draw_order = p_order;
VS::get_singleton()->particles_set_draw_order(particles, VS::ParticlesDrawOrder(p_order)); VS::get_singleton()->particles_set_draw_order(particles, VS::ParticlesDrawOrder(p_order));
} }
Particles2D::DrawOrder Particles2D::get_draw_order() const { GPUParticles2D::DrawOrder GPUParticles2D::get_draw_order() const {
return draw_order; return draw_order;
} }
void Particles2D::set_fixed_fps(int p_count) { void GPUParticles2D::set_fixed_fps(int p_count) {
fixed_fps = p_count; fixed_fps = p_count;
VS::get_singleton()->particles_set_fixed_fps(particles, p_count); VS::get_singleton()->particles_set_fixed_fps(particles, p_count);
} }
int Particles2D::get_fixed_fps() const { int GPUParticles2D::get_fixed_fps() const {
return fixed_fps; return fixed_fps;
} }
void Particles2D::set_fractional_delta(bool p_enable) { void GPUParticles2D::set_fractional_delta(bool p_enable) {
fractional_delta = p_enable; fractional_delta = p_enable;
VS::get_singleton()->particles_set_fractional_delta(particles, p_enable); VS::get_singleton()->particles_set_fractional_delta(particles, p_enable);
} }
bool Particles2D::get_fractional_delta() const { bool GPUParticles2D::get_fractional_delta() const {
return fractional_delta; return fractional_delta;
} }
String Particles2D::get_configuration_warning() const { String GPUParticles2D::get_configuration_warning() const {
if (VisualServer::get_singleton()->is_low_end()) { if (VisualServer::get_singleton()->is_low_end()) {
return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles\" option for this purpose."); return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles\" option for this purpose.");
@ -257,7 +257,7 @@ String Particles2D::get_configuration_warning() const {
return warnings; return warnings;
} }
Rect2 Particles2D::capture_rect() const { Rect2 GPUParticles2D::capture_rect() const {
AABB aabb = VS::get_singleton()->particles_get_current_aabb(particles); AABB aabb = VS::get_singleton()->particles_get_current_aabb(particles);
Rect2 r; Rect2 r;
@ -268,34 +268,34 @@ Rect2 Particles2D::capture_rect() const {
return r; return r;
} }
void Particles2D::set_texture(const Ref<Texture2D> &p_texture) { void GPUParticles2D::set_texture(const Ref<Texture2D> &p_texture) {
texture = p_texture; texture = p_texture;
update(); update();
} }
Ref<Texture2D> Particles2D::get_texture() const { Ref<Texture2D> GPUParticles2D::get_texture() const {
return texture; return texture;
} }
void Particles2D::set_normal_map(const Ref<Texture2D> &p_normal_map) { void GPUParticles2D::set_normal_map(const Ref<Texture2D> &p_normal_map) {
normal_map = p_normal_map; normal_map = p_normal_map;
update(); update();
} }
Ref<Texture2D> Particles2D::get_normal_map() const { Ref<Texture2D> GPUParticles2D::get_normal_map() const {
return normal_map; return normal_map;
} }
void Particles2D::_validate_property(PropertyInfo &property) const { void GPUParticles2D::_validate_property(PropertyInfo &property) const {
} }
void Particles2D::restart() { void GPUParticles2D::restart() {
VS::get_singleton()->particles_restart(particles); VS::get_singleton()->particles_restart(particles);
VS::get_singleton()->particles_set_emitting(particles, true); VS::get_singleton()->particles_set_emitting(particles, true);
} }
void Particles2D::_notification(int p_what) { void GPUParticles2D::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) { if (p_what == NOTIFICATION_DRAW) {
@ -338,48 +338,48 @@ void Particles2D::_notification(int p_what) {
} }
} }
void Particles2D::_bind_methods() { void GPUParticles2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_emitting", "emitting"), &Particles2D::set_emitting); ClassDB::bind_method(D_METHOD("set_emitting", "emitting"), &GPUParticles2D::set_emitting);
ClassDB::bind_method(D_METHOD("set_amount", "amount"), &Particles2D::set_amount); ClassDB::bind_method(D_METHOD("set_amount", "amount"), &GPUParticles2D::set_amount);
ClassDB::bind_method(D_METHOD("set_lifetime", "secs"), &Particles2D::set_lifetime); ClassDB::bind_method(D_METHOD("set_lifetime", "secs"), &GPUParticles2D::set_lifetime);
ClassDB::bind_method(D_METHOD("set_one_shot", "secs"), &Particles2D::set_one_shot); ClassDB::bind_method(D_METHOD("set_one_shot", "secs"), &GPUParticles2D::set_one_shot);
ClassDB::bind_method(D_METHOD("set_pre_process_time", "secs"), &Particles2D::set_pre_process_time); ClassDB::bind_method(D_METHOD("set_pre_process_time", "secs"), &GPUParticles2D::set_pre_process_time);
ClassDB::bind_method(D_METHOD("set_explosiveness_ratio", "ratio"), &Particles2D::set_explosiveness_ratio); ClassDB::bind_method(D_METHOD("set_explosiveness_ratio", "ratio"), &GPUParticles2D::set_explosiveness_ratio);
ClassDB::bind_method(D_METHOD("set_randomness_ratio", "ratio"), &Particles2D::set_randomness_ratio); ClassDB::bind_method(D_METHOD("set_randomness_ratio", "ratio"), &GPUParticles2D::set_randomness_ratio);
ClassDB::bind_method(D_METHOD("set_visibility_rect", "visibility_rect"), &Particles2D::set_visibility_rect); ClassDB::bind_method(D_METHOD("set_visibility_rect", "visibility_rect"), &GPUParticles2D::set_visibility_rect);
ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &Particles2D::set_use_local_coordinates); ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &GPUParticles2D::set_use_local_coordinates);
ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &Particles2D::set_fixed_fps); ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &GPUParticles2D::set_fixed_fps);
ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &Particles2D::set_fractional_delta); ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &GPUParticles2D::set_fractional_delta);
ClassDB::bind_method(D_METHOD("set_process_material", "material"), &Particles2D::set_process_material); ClassDB::bind_method(D_METHOD("set_process_material", "material"), &GPUParticles2D::set_process_material);
ClassDB::bind_method(D_METHOD("set_speed_scale", "scale"), &Particles2D::set_speed_scale); ClassDB::bind_method(D_METHOD("set_speed_scale", "scale"), &GPUParticles2D::set_speed_scale);
ClassDB::bind_method(D_METHOD("is_emitting"), &Particles2D::is_emitting); ClassDB::bind_method(D_METHOD("is_emitting"), &GPUParticles2D::is_emitting);
ClassDB::bind_method(D_METHOD("get_amount"), &Particles2D::get_amount); ClassDB::bind_method(D_METHOD("get_amount"), &GPUParticles2D::get_amount);
ClassDB::bind_method(D_METHOD("get_lifetime"), &Particles2D::get_lifetime); ClassDB::bind_method(D_METHOD("get_lifetime"), &GPUParticles2D::get_lifetime);
ClassDB::bind_method(D_METHOD("get_one_shot"), &Particles2D::get_one_shot); ClassDB::bind_method(D_METHOD("get_one_shot"), &GPUParticles2D::get_one_shot);
ClassDB::bind_method(D_METHOD("get_pre_process_time"), &Particles2D::get_pre_process_time); ClassDB::bind_method(D_METHOD("get_pre_process_time"), &GPUParticles2D::get_pre_process_time);
ClassDB::bind_method(D_METHOD("get_explosiveness_ratio"), &Particles2D::get_explosiveness_ratio); ClassDB::bind_method(D_METHOD("get_explosiveness_ratio"), &GPUParticles2D::get_explosiveness_ratio);
ClassDB::bind_method(D_METHOD("get_randomness_ratio"), &Particles2D::get_randomness_ratio); ClassDB::bind_method(D_METHOD("get_randomness_ratio"), &GPUParticles2D::get_randomness_ratio);
ClassDB::bind_method(D_METHOD("get_visibility_rect"), &Particles2D::get_visibility_rect); ClassDB::bind_method(D_METHOD("get_visibility_rect"), &GPUParticles2D::get_visibility_rect);
ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &Particles2D::get_use_local_coordinates); ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &GPUParticles2D::get_use_local_coordinates);
ClassDB::bind_method(D_METHOD("get_fixed_fps"), &Particles2D::get_fixed_fps); ClassDB::bind_method(D_METHOD("get_fixed_fps"), &GPUParticles2D::get_fixed_fps);
ClassDB::bind_method(D_METHOD("get_fractional_delta"), &Particles2D::get_fractional_delta); ClassDB::bind_method(D_METHOD("get_fractional_delta"), &GPUParticles2D::get_fractional_delta);
ClassDB::bind_method(D_METHOD("get_process_material"), &Particles2D::get_process_material); ClassDB::bind_method(D_METHOD("get_process_material"), &GPUParticles2D::get_process_material);
ClassDB::bind_method(D_METHOD("get_speed_scale"), &Particles2D::get_speed_scale); ClassDB::bind_method(D_METHOD("get_speed_scale"), &GPUParticles2D::get_speed_scale);
ClassDB::bind_method(D_METHOD("set_draw_order", "order"), &Particles2D::set_draw_order); ClassDB::bind_method(D_METHOD("set_draw_order", "order"), &GPUParticles2D::set_draw_order);
ClassDB::bind_method(D_METHOD("get_draw_order"), &Particles2D::get_draw_order); ClassDB::bind_method(D_METHOD("get_draw_order"), &GPUParticles2D::get_draw_order);
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Particles2D::set_texture); ClassDB::bind_method(D_METHOD("set_texture", "texture"), &GPUParticles2D::set_texture);
ClassDB::bind_method(D_METHOD("get_texture"), &Particles2D::get_texture); ClassDB::bind_method(D_METHOD("get_texture"), &GPUParticles2D::get_texture);
ClassDB::bind_method(D_METHOD("set_normal_map", "texture"), &Particles2D::set_normal_map); ClassDB::bind_method(D_METHOD("set_normal_map", "texture"), &GPUParticles2D::set_normal_map);
ClassDB::bind_method(D_METHOD("get_normal_map"), &Particles2D::get_normal_map); ClassDB::bind_method(D_METHOD("get_normal_map"), &GPUParticles2D::get_normal_map);
ClassDB::bind_method(D_METHOD("capture_rect"), &Particles2D::capture_rect); ClassDB::bind_method(D_METHOD("capture_rect"), &GPUParticles2D::capture_rect);
ClassDB::bind_method(D_METHOD("restart"), &Particles2D::restart); ClassDB::bind_method(D_METHOD("restart"), &GPUParticles2D::restart);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting");
ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_EXP_RANGE, "1,1000000,1"), "set_amount", "get_amount"); ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_EXP_RANGE, "1,1000000,1"), "set_amount", "get_amount");
@ -406,7 +406,7 @@ void Particles2D::_bind_methods() {
BIND_ENUM_CONSTANT(DRAW_ORDER_LIFETIME); BIND_ENUM_CONSTANT(DRAW_ORDER_LIFETIME);
} }
Particles2D::Particles2D() { GPUParticles2D::GPUParticles2D() {
particles = VS::get_singleton()->particles_create(); particles = VS::get_singleton()->particles_create();
@ -426,7 +426,7 @@ Particles2D::Particles2D() {
set_speed_scale(1); set_speed_scale(1);
} }
Particles2D::~Particles2D() { GPUParticles2D::~GPUParticles2D() {
VS::get_singleton()->free(particles); VS::get_singleton()->free(particles);
} }

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* particles_2d.h */ /* gpu_particles_2d.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -35,9 +35,9 @@
#include "scene/2d/node_2d.h" #include "scene/2d/node_2d.h"
#include "scene/resources/texture.h" #include "scene/resources/texture.h"
class Particles2D : public Node2D { class GPUParticles2D : public Node2D {
private: private:
GDCLASS(Particles2D, Node2D); GDCLASS(GPUParticles2D, Node2D);
public: public:
enum DrawOrder { enum DrawOrder {
@ -118,10 +118,10 @@ public:
void restart(); void restart();
Rect2 capture_rect() const; Rect2 capture_rect() const;
Particles2D(); GPUParticles2D();
~Particles2D(); ~GPUParticles2D();
}; };
VARIANT_ENUM_CAST(Particles2D::DrawOrder) VARIANT_ENUM_CAST(GPUParticles2D::DrawOrder)
#endif // PARTICLES_2D_H #endif // PARTICLES_2D_H

View file

@ -31,7 +31,7 @@
#ifndef NAVIGATION_2D_H #ifndef NAVIGATION_2D_H
#define NAVIGATION_2D_H #define NAVIGATION_2D_H
#include "scene/2d/navigation_polygon.h" #include "scene/2d/navigation_region_2d.h"
#include "scene/2d/node_2d.h" #include "scene/2d/node_2d.h"
class Navigation2D : public Node2D { class Navigation2D : public Node2D {

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* navigation_polygon.cpp */ /* navigation_region_2d.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "navigation_polygon.h" #include "navigation_region_2d.h"
#include "core/core_string_names.h" #include "core/core_string_names.h"
#include "core/engine.h" #include "core/engine.h"

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* navigation_polygon.h */ /* navigation_region_2d.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#ifndef NAVIGATION_POLYGON_H #ifndef NAVIGATION_REGION_2D_H
#define NAVIGATION_POLYGON_H #define NAVIGATION_REGION_2D_H
#include "scene/2d/node_2d.h" #include "scene/2d/node_2d.h"
#include "scene/resources/navigation_mesh.h" #include "scene/resources/navigation_mesh.h"
@ -127,4 +127,4 @@ public:
~NavigationRegion2D(); ~NavigationRegion2D();
}; };
#endif // NAVIGATIONPOLYGON_H #endif // NAVIGATION_REGION_2D_H

View file

@ -31,7 +31,7 @@
#ifndef NODE2D_H #ifndef NODE2D_H
#define NODE2D_H #define NODE2D_H
#include "scene/2d/canvas_item.h" #include "scene/main/canvas_item.h"
class Node2D : public CanvasItem { class Node2D : public CanvasItem {

View file

@ -31,7 +31,7 @@
#include "visibility_notifier_2d.h" #include "visibility_notifier_2d.h"
#include "core/engine.h" #include "core/engine.h"
#include "particles_2d.h" #include "gpu_particles_2d.h"
#include "scene/2d/animated_sprite_2d.h" #include "scene/2d/animated_sprite_2d.h"
#include "scene/2d/physics_body_2d.h" #include "scene/2d/physics_body_2d.h"
#include "scene/animation/animation_player.h" #include "scene/animation/animation_player.h"
@ -212,7 +212,7 @@ void VisibilityEnabler2D::_find_nodes(Node *p_node) {
} }
{ {
Particles2D *ps = Object::cast_to<Particles2D>(p_node); GPUParticles2D *ps = Object::cast_to<GPUParticles2D>(p_node);
if (ps) { if (ps) {
add = true; add = true;
} }
@ -304,7 +304,7 @@ void VisibilityEnabler2D::_change_node_state(Node *p_node, bool p_enabled) {
} }
if (enabler[ENABLER_PAUSE_PARTICLES]) { if (enabler[ENABLER_PAUSE_PARTICLES]) {
Particles2D *ps = Object::cast_to<Particles2D>(p_node); GPUParticles2D *ps = Object::cast_to<GPUParticles2D>(p_node);
if (ps) { if (ps) {

View file

@ -384,7 +384,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
linear_velocity = velocity_tracker->get_tracked_linear_velocity(); linear_velocity = velocity_tracker->get_tracked_linear_velocity();
} }
Ref<World> world = get_world(); Ref<World3D> world = get_world();
ERR_FAIL_COND(world.is_null()); ERR_FAIL_COND(world.is_null());
int new_output_count = 0; int new_output_count = 0;

View file

@ -726,13 +726,13 @@ Camera3D::~Camera3D() {
//////////////////////////////////////// ////////////////////////////////////////
void ClippedCamera::set_margin(float p_margin) { void ClippedCamera3D::set_margin(float p_margin) {
margin = p_margin; margin = p_margin;
} }
float ClippedCamera::get_margin() const { float ClippedCamera3D::get_margin() const {
return margin; return margin;
} }
void ClippedCamera::set_process_mode(ProcessMode p_mode) { void ClippedCamera3D::set_process_mode(ProcessMode p_mode) {
if (process_mode == p_mode) { if (process_mode == p_mode) {
return; return;
@ -741,18 +741,18 @@ void ClippedCamera::set_process_mode(ProcessMode p_mode) {
set_process_internal(process_mode == CLIP_PROCESS_IDLE); set_process_internal(process_mode == CLIP_PROCESS_IDLE);
set_physics_process_internal(process_mode == CLIP_PROCESS_PHYSICS); set_physics_process_internal(process_mode == CLIP_PROCESS_PHYSICS);
} }
ClippedCamera::ProcessMode ClippedCamera::get_process_mode() const { ClippedCamera3D::ProcessMode ClippedCamera3D::get_process_mode() const {
return process_mode; return process_mode;
} }
Transform ClippedCamera::get_camera_transform() const { Transform ClippedCamera3D::get_camera_transform() const {
Transform t = Camera3D::get_camera_transform(); Transform t = Camera3D::get_camera_transform();
t.origin += -t.basis.get_axis(Vector3::AXIS_Z).normalized() * clip_offset; t.origin += -t.basis.get_axis(Vector3::AXIS_Z).normalized() * clip_offset;
return t; return t;
} }
void ClippedCamera::_notification(int p_what) { void ClippedCamera3D::_notification(int p_what) {
if (p_what == NOTIFICATION_INTERNAL_PROCESS || p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) { if (p_what == NOTIFICATION_INTERNAL_PROCESS || p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
Node3D *parent = Object::cast_to<Node3D>(get_parent()); Node3D *parent = Object::cast_to<Node3D>(get_parent());
@ -813,17 +813,17 @@ void ClippedCamera::_notification(int p_what) {
} }
} }
void ClippedCamera::set_collision_mask(uint32_t p_mask) { void ClippedCamera3D::set_collision_mask(uint32_t p_mask) {
collision_mask = p_mask; collision_mask = p_mask;
} }
uint32_t ClippedCamera::get_collision_mask() const { uint32_t ClippedCamera3D::get_collision_mask() const {
return collision_mask; return collision_mask;
} }
void ClippedCamera::set_collision_mask_bit(int p_bit, bool p_value) { void ClippedCamera3D::set_collision_mask_bit(int p_bit, bool p_value) {
uint32_t mask = get_collision_mask(); uint32_t mask = get_collision_mask();
if (p_value) if (p_value)
@ -833,17 +833,17 @@ void ClippedCamera::set_collision_mask_bit(int p_bit, bool p_value) {
set_collision_mask(mask); set_collision_mask(mask);
} }
bool ClippedCamera::get_collision_mask_bit(int p_bit) const { bool ClippedCamera3D::get_collision_mask_bit(int p_bit) const {
return get_collision_mask() & (1 << p_bit); return get_collision_mask() & (1 << p_bit);
} }
void ClippedCamera::add_exception_rid(const RID &p_rid) { void ClippedCamera3D::add_exception_rid(const RID &p_rid) {
exclude.insert(p_rid); exclude.insert(p_rid);
} }
void ClippedCamera::add_exception(const Object *p_object) { void ClippedCamera3D::add_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object); ERR_FAIL_NULL(p_object);
const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object); const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object);
@ -852,12 +852,12 @@ void ClippedCamera::add_exception(const Object *p_object) {
add_exception_rid(co->get_rid()); add_exception_rid(co->get_rid());
} }
void ClippedCamera::remove_exception_rid(const RID &p_rid) { void ClippedCamera3D::remove_exception_rid(const RID &p_rid) {
exclude.erase(p_rid); exclude.erase(p_rid);
} }
void ClippedCamera::remove_exception(const Object *p_object) { void ClippedCamera3D::remove_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object); ERR_FAIL_NULL(p_object);
const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object); const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object);
@ -866,65 +866,65 @@ void ClippedCamera::remove_exception(const Object *p_object) {
remove_exception_rid(co->get_rid()); remove_exception_rid(co->get_rid());
} }
void ClippedCamera::clear_exceptions() { void ClippedCamera3D::clear_exceptions() {
exclude.clear(); exclude.clear();
} }
float ClippedCamera::get_clip_offset() const { float ClippedCamera3D::get_clip_offset() const {
return clip_offset; return clip_offset;
} }
void ClippedCamera::set_clip_to_areas(bool p_clip) { void ClippedCamera3D::set_clip_to_areas(bool p_clip) {
clip_to_areas = p_clip; clip_to_areas = p_clip;
} }
bool ClippedCamera::is_clip_to_areas_enabled() const { bool ClippedCamera3D::is_clip_to_areas_enabled() const {
return clip_to_areas; return clip_to_areas;
} }
void ClippedCamera::set_clip_to_bodies(bool p_clip) { void ClippedCamera3D::set_clip_to_bodies(bool p_clip) {
clip_to_bodies = p_clip; clip_to_bodies = p_clip;
} }
bool ClippedCamera::is_clip_to_bodies_enabled() const { bool ClippedCamera3D::is_clip_to_bodies_enabled() const {
return clip_to_bodies; return clip_to_bodies;
} }
void ClippedCamera::_bind_methods() { void ClippedCamera3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_margin", "margin"), &ClippedCamera::set_margin); ClassDB::bind_method(D_METHOD("set_margin", "margin"), &ClippedCamera3D::set_margin);
ClassDB::bind_method(D_METHOD("get_margin"), &ClippedCamera::get_margin); ClassDB::bind_method(D_METHOD("get_margin"), &ClippedCamera3D::get_margin);
ClassDB::bind_method(D_METHOD("set_process_mode", "process_mode"), &ClippedCamera::set_process_mode); ClassDB::bind_method(D_METHOD("set_process_mode", "process_mode"), &ClippedCamera3D::set_process_mode);
ClassDB::bind_method(D_METHOD("get_process_mode"), &ClippedCamera::get_process_mode); ClassDB::bind_method(D_METHOD("get_process_mode"), &ClippedCamera3D::get_process_mode);
ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &ClippedCamera::set_collision_mask); ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &ClippedCamera3D::set_collision_mask);
ClassDB::bind_method(D_METHOD("get_collision_mask"), &ClippedCamera::get_collision_mask); ClassDB::bind_method(D_METHOD("get_collision_mask"), &ClippedCamera3D::get_collision_mask);
ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &ClippedCamera::set_collision_mask_bit); ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &ClippedCamera3D::set_collision_mask_bit);
ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &ClippedCamera::get_collision_mask_bit); ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &ClippedCamera3D::get_collision_mask_bit);
ClassDB::bind_method(D_METHOD("add_exception_rid", "rid"), &ClippedCamera::add_exception_rid); ClassDB::bind_method(D_METHOD("add_exception_rid", "rid"), &ClippedCamera3D::add_exception_rid);
ClassDB::bind_method(D_METHOD("add_exception", "node"), &ClippedCamera::add_exception); ClassDB::bind_method(D_METHOD("add_exception", "node"), &ClippedCamera3D::add_exception);
ClassDB::bind_method(D_METHOD("remove_exception_rid", "rid"), &ClippedCamera::remove_exception_rid); ClassDB::bind_method(D_METHOD("remove_exception_rid", "rid"), &ClippedCamera3D::remove_exception_rid);
ClassDB::bind_method(D_METHOD("remove_exception", "node"), &ClippedCamera::remove_exception); ClassDB::bind_method(D_METHOD("remove_exception", "node"), &ClippedCamera3D::remove_exception);
ClassDB::bind_method(D_METHOD("set_clip_to_areas", "enable"), &ClippedCamera::set_clip_to_areas); ClassDB::bind_method(D_METHOD("set_clip_to_areas", "enable"), &ClippedCamera3D::set_clip_to_areas);
ClassDB::bind_method(D_METHOD("is_clip_to_areas_enabled"), &ClippedCamera::is_clip_to_areas_enabled); ClassDB::bind_method(D_METHOD("is_clip_to_areas_enabled"), &ClippedCamera3D::is_clip_to_areas_enabled);
ClassDB::bind_method(D_METHOD("get_clip_offset"), &ClippedCamera::get_clip_offset); ClassDB::bind_method(D_METHOD("get_clip_offset"), &ClippedCamera3D::get_clip_offset);
ClassDB::bind_method(D_METHOD("set_clip_to_bodies", "enable"), &ClippedCamera::set_clip_to_bodies); ClassDB::bind_method(D_METHOD("set_clip_to_bodies", "enable"), &ClippedCamera3D::set_clip_to_bodies);
ClassDB::bind_method(D_METHOD("is_clip_to_bodies_enabled"), &ClippedCamera::is_clip_to_bodies_enabled); ClassDB::bind_method(D_METHOD("is_clip_to_bodies_enabled"), &ClippedCamera3D::is_clip_to_bodies_enabled);
ClassDB::bind_method(D_METHOD("clear_exceptions"), &ClippedCamera::clear_exceptions); ClassDB::bind_method(D_METHOD("clear_exceptions"), &ClippedCamera3D::clear_exceptions);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_margin", "get_margin"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_margin", "get_margin");
ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_process_mode", "get_process_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_process_mode", "get_process_mode");
@ -937,7 +937,7 @@ void ClippedCamera::_bind_methods() {
BIND_ENUM_CONSTANT(CLIP_PROCESS_PHYSICS); BIND_ENUM_CONSTANT(CLIP_PROCESS_PHYSICS);
BIND_ENUM_CONSTANT(CLIP_PROCESS_IDLE); BIND_ENUM_CONSTANT(CLIP_PROCESS_IDLE);
} }
ClippedCamera::ClippedCamera() { ClippedCamera3D::ClippedCamera3D() {
margin = 0; margin = 0;
clip_offset = 0; clip_offset = 0;
process_mode = CLIP_PROCESS_PHYSICS; process_mode = CLIP_PROCESS_PHYSICS;
@ -949,6 +949,6 @@ ClippedCamera::ClippedCamera() {
clip_to_areas = false; clip_to_areas = false;
clip_to_bodies = true; clip_to_bodies = true;
} }
ClippedCamera::~ClippedCamera() { ClippedCamera3D::~ClippedCamera3D() {
PhysicsServer::get_singleton()->free(pyramid_shape); PhysicsServer::get_singleton()->free(pyramid_shape);
} }

View file

@ -48,10 +48,8 @@ public:
PROJECTION_FRUSTUM PROJECTION_FRUSTUM
}; };
enum KeepAspect { enum KeepAspect { KEEP_WIDTH,
KEEP_WIDTH, KEEP_HEIGHT };
KEEP_HEIGHT
};
enum DopplerTracking { enum DopplerTracking {
DOPPLER_TRACKING_DISABLED, DOPPLER_TRACKING_DISABLED,
@ -77,7 +75,7 @@ private:
RID camera; RID camera;
RID scenario_id; RID scenario_id;
//String camera_group; // String camera_group;
uint32_t layers; uint32_t layers;
@ -86,7 +84,7 @@ private:
virtual bool _can_gizmo_scale() const; virtual bool _can_gizmo_scale() const;
//void _camera_make_current(Node *p_camera); // void _camera_make_current(Node *p_camera);
friend class Viewport; friend class Viewport;
void _update_audio_listener_state(); void _update_audio_listener_state();
@ -112,7 +110,8 @@ public:
void set_perspective(float p_fovy_degrees, float p_z_near, float p_z_far); void set_perspective(float p_fovy_degrees, float p_z_near, float p_z_far);
void set_orthogonal(float p_size, float p_z_near, float p_z_far); void set_orthogonal(float p_size, float p_z_near, float p_z_far);
void set_frustum(float p_size, Vector2 p_offset, float p_z_near, float p_z_far); void set_frustum(float p_size, Vector2 p_offset, float p_z_near,
float p_z_far);
void set_projection(Camera3D::Projection p_mode); void set_projection(Camera3D::Projection p_mode);
void make_current(); void make_current();
@ -143,7 +142,8 @@ public:
virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const; virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const;
virtual Point2 unproject_position(const Vector3 &p_pos) const; virtual Point2 unproject_position(const Vector3 &p_pos) const;
bool is_position_behind(const Vector3 &p_pos) const; bool is_position_behind(const Vector3 &p_pos) const;
virtual Vector3 project_position(const Point2 &p_point, float p_z_depth) const; virtual Vector3 project_position(const Point2 &p_point,
float p_z_depth) const;
Vector<Vector3> get_near_plane_points() const; Vector<Vector3> get_near_plane_points() const;
@ -183,9 +183,9 @@ VARIANT_ENUM_CAST(Camera3D::Projection);
VARIANT_ENUM_CAST(Camera3D::KeepAspect); VARIANT_ENUM_CAST(Camera3D::KeepAspect);
VARIANT_ENUM_CAST(Camera3D::DopplerTracking); VARIANT_ENUM_CAST(Camera3D::DopplerTracking);
class ClippedCamera : public Camera3D { class ClippedCamera3D : public Camera3D {
GDCLASS(ClippedCamera, Camera3D); GDCLASS(ClippedCamera3D, Camera3D);
public: public:
enum ProcessMode { enum ProcessMode {
@ -238,9 +238,9 @@ public:
float get_clip_offset() const; float get_clip_offset() const;
ClippedCamera(); ClippedCamera3D();
~ClippedCamera(); ~ClippedCamera3D();
}; };
VARIANT_ENUM_CAST(ClippedCamera::ProcessMode); VARIANT_ENUM_CAST(ClippedCamera3D::ProcessMode);
#endif #endif

View file

@ -33,7 +33,7 @@
#include "scene/resources/capsule_shape_3d.h" #include "scene/resources/capsule_shape_3d.h"
#include "scene/resources/concave_polygon_shape_3d.h" #include "scene/resources/concave_polygon_shape_3d.h"
#include "scene/resources/convex_polygon_shape_3d.h" #include "scene/resources/convex_polygon_shape_3d.h"
#include "scene/resources/ray_shape.h" #include "scene/resources/ray_shape_3d.h"
#include "scene/resources/sphere_shape_3d.h" #include "scene/resources/sphere_shape_3d.h"
#include "scene/resources/world_margin_shape_3d.h" #include "scene/resources/world_margin_shape_3d.h"
#include "servers/visual_server.h" #include "servers/visual_server.h"

View file

@ -507,10 +507,10 @@ bool Node3D::is_set_as_toplevel() const {
return data.toplevel; return data.toplevel;
} }
Ref<World> Node3D::get_world() const { Ref<World3D> Node3D::get_world() const {
ERR_FAIL_COND_V(!is_inside_world(), Ref<World>()); ERR_FAIL_COND_V(!is_inside_world(), Ref<World3D>());
ERR_FAIL_COND_V(!data.viewport, Ref<World>()); ERR_FAIL_COND_V(!data.viewport, Ref<World3D>());
return data.viewport->find_world(); return data.viewport->find_world();
} }

View file

@ -124,7 +124,7 @@ public:
Node3D *get_parent_spatial() const; Node3D *get_parent_spatial() const;
Ref<World> get_world() const; Ref<World3D> get_world() const;
void set_translation(const Vector3 &p_translation); void set_translation(const Vector3 &p_translation);
void set_rotation(const Vector3 &p_euler_rad); void set_rotation(const Vector3 &p_euler_rad);

View file

@ -41,7 +41,7 @@
#include "servers/navigation_server.h" #include "servers/navigation_server.h"
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
#include "editor/plugins/spatial_editor_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h"
#endif #endif
Vector3 PhysicsBody3D::get_linear_velocity() const { Vector3 PhysicsBody3D::get_linear_velocity() const {

View file

@ -196,7 +196,7 @@ void RayCast3D::_notification(int p_what) {
} }
void RayCast3D::_update_raycast_state() { void RayCast3D::_update_raycast_state() {
Ref<World> w3d = get_world(); Ref<World3D> w3d = get_world();
ERR_FAIL_COND(w3d.is_null()); ERR_FAIL_COND(w3d.is_null());
PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space()); PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space());

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* skeleton_ik.cpp */ /* skeleton_ik_3d.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -32,7 +32,7 @@
* @author AndreaCatania * @author AndreaCatania
*/ */
#include "skeleton_ik.h" #include "skeleton_ik_3d.h"
#ifndef _3D_DISABLED #ifndef _3D_DISABLED

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* skeleton_ik.h */ /* skeleton_ik_3d.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* vehicle_body.cpp */ /* vehicle_body_3d.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "vehicle_body.h" #include "vehicle_body_3d.h"
#define ROLLING_INFLUENCE_FIX #define ROLLING_INFLUENCE_FIX
@ -78,11 +78,11 @@ public:
} }
}; };
void VehicleWheel::_notification(int p_what) { void VehicleWheel3D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) { if (p_what == NOTIFICATION_ENTER_TREE) {
VehicleBody *cb = Object::cast_to<VehicleBody>(get_parent()); VehicleBody3D *cb = Object::cast_to<VehicleBody3D>(get_parent());
if (!cb) if (!cb)
return; return;
body = cb; body = cb;
@ -95,7 +95,7 @@ void VehicleWheel::_notification(int p_what) {
} }
if (p_what == NOTIFICATION_EXIT_TREE) { if (p_what == NOTIFICATION_EXIT_TREE) {
VehicleBody *cb = Object::cast_to<VehicleBody>(get_parent()); VehicleBody3D *cb = Object::cast_to<VehicleBody3D>(get_parent());
if (!cb) if (!cb)
return; return;
cb->wheels.erase(this); cb->wheels.erase(this);
@ -103,15 +103,15 @@ void VehicleWheel::_notification(int p_what) {
} }
} }
String VehicleWheel::get_configuration_warning() const { String VehicleWheel3D::get_configuration_warning() const {
if (!Object::cast_to<VehicleBody>(get_parent())) { if (!Object::cast_to<VehicleBody3D>(get_parent())) {
return TTR("VehicleWheel serves to provide a wheel system to a VehicleBody. Please use it as a child of a VehicleBody."); return TTR("VehicleWheel serves to provide a wheel system to a VehicleBody. Please use it as a child of a VehicleBody.");
} }
return String(); return String();
} }
void VehicleWheel::_update(PhysicsDirectBodyState *s) { void VehicleWheel3D::_update(PhysicsDirectBodyState *s) {
if (m_raycastInfo.m_isInContact) if (m_raycastInfo.m_isInContact)
@ -144,142 +144,142 @@ void VehicleWheel::_update(PhysicsDirectBodyState *s) {
} }
} }
void VehicleWheel::set_radius(float p_radius) { void VehicleWheel3D::set_radius(float p_radius) {
m_wheelRadius = p_radius; m_wheelRadius = p_radius;
update_gizmo(); update_gizmo();
} }
float VehicleWheel::get_radius() const { float VehicleWheel3D::get_radius() const {
return m_wheelRadius; return m_wheelRadius;
} }
void VehicleWheel::set_suspension_rest_length(float p_length) { void VehicleWheel3D::set_suspension_rest_length(float p_length) {
m_suspensionRestLength = p_length; m_suspensionRestLength = p_length;
update_gizmo(); update_gizmo();
} }
float VehicleWheel::get_suspension_rest_length() const { float VehicleWheel3D::get_suspension_rest_length() const {
return m_suspensionRestLength; return m_suspensionRestLength;
} }
void VehicleWheel::set_suspension_travel(float p_length) { void VehicleWheel3D::set_suspension_travel(float p_length) {
m_maxSuspensionTravelCm = p_length / 0.01; m_maxSuspensionTravelCm = p_length / 0.01;
} }
float VehicleWheel::get_suspension_travel() const { float VehicleWheel3D::get_suspension_travel() const {
return m_maxSuspensionTravelCm * 0.01; return m_maxSuspensionTravelCm * 0.01;
} }
void VehicleWheel::set_suspension_stiffness(float p_value) { void VehicleWheel3D::set_suspension_stiffness(float p_value) {
m_suspensionStiffness = p_value; m_suspensionStiffness = p_value;
} }
float VehicleWheel::get_suspension_stiffness() const { float VehicleWheel3D::get_suspension_stiffness() const {
return m_suspensionStiffness; return m_suspensionStiffness;
} }
void VehicleWheel::set_suspension_max_force(float p_value) { void VehicleWheel3D::set_suspension_max_force(float p_value) {
m_maxSuspensionForce = p_value; m_maxSuspensionForce = p_value;
} }
float VehicleWheel::get_suspension_max_force() const { float VehicleWheel3D::get_suspension_max_force() const {
return m_maxSuspensionForce; return m_maxSuspensionForce;
} }
void VehicleWheel::set_damping_compression(float p_value) { void VehicleWheel3D::set_damping_compression(float p_value) {
m_wheelsDampingCompression = p_value; m_wheelsDampingCompression = p_value;
} }
float VehicleWheel::get_damping_compression() const { float VehicleWheel3D::get_damping_compression() const {
return m_wheelsDampingCompression; return m_wheelsDampingCompression;
} }
void VehicleWheel::set_damping_relaxation(float p_value) { void VehicleWheel3D::set_damping_relaxation(float p_value) {
m_wheelsDampingRelaxation = p_value; m_wheelsDampingRelaxation = p_value;
} }
float VehicleWheel::get_damping_relaxation() const { float VehicleWheel3D::get_damping_relaxation() const {
return m_wheelsDampingRelaxation; return m_wheelsDampingRelaxation;
} }
void VehicleWheel::set_friction_slip(float p_value) { void VehicleWheel3D::set_friction_slip(float p_value) {
m_frictionSlip = p_value; m_frictionSlip = p_value;
} }
float VehicleWheel::get_friction_slip() const { float VehicleWheel3D::get_friction_slip() const {
return m_frictionSlip; return m_frictionSlip;
} }
void VehicleWheel::set_roll_influence(float p_value) { void VehicleWheel3D::set_roll_influence(float p_value) {
m_rollInfluence = p_value; m_rollInfluence = p_value;
} }
float VehicleWheel::get_roll_influence() const { float VehicleWheel3D::get_roll_influence() const {
return m_rollInfluence; return m_rollInfluence;
} }
bool VehicleWheel::is_in_contact() const { bool VehicleWheel3D::is_in_contact() const {
return m_raycastInfo.m_isInContact; return m_raycastInfo.m_isInContact;
} }
void VehicleWheel::_bind_methods() { void VehicleWheel3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_radius", "length"), &VehicleWheel::set_radius); ClassDB::bind_method(D_METHOD("set_radius", "length"), &VehicleWheel3D::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"), &VehicleWheel::get_radius); ClassDB::bind_method(D_METHOD("get_radius"), &VehicleWheel3D::get_radius);
ClassDB::bind_method(D_METHOD("set_suspension_rest_length", "length"), &VehicleWheel::set_suspension_rest_length); ClassDB::bind_method(D_METHOD("set_suspension_rest_length", "length"), &VehicleWheel3D::set_suspension_rest_length);
ClassDB::bind_method(D_METHOD("get_suspension_rest_length"), &VehicleWheel::get_suspension_rest_length); ClassDB::bind_method(D_METHOD("get_suspension_rest_length"), &VehicleWheel3D::get_suspension_rest_length);
ClassDB::bind_method(D_METHOD("set_suspension_travel", "length"), &VehicleWheel::set_suspension_travel); ClassDB::bind_method(D_METHOD("set_suspension_travel", "length"), &VehicleWheel3D::set_suspension_travel);
ClassDB::bind_method(D_METHOD("get_suspension_travel"), &VehicleWheel::get_suspension_travel); ClassDB::bind_method(D_METHOD("get_suspension_travel"), &VehicleWheel3D::get_suspension_travel);
ClassDB::bind_method(D_METHOD("set_suspension_stiffness", "length"), &VehicleWheel::set_suspension_stiffness); ClassDB::bind_method(D_METHOD("set_suspension_stiffness", "length"), &VehicleWheel3D::set_suspension_stiffness);
ClassDB::bind_method(D_METHOD("get_suspension_stiffness"), &VehicleWheel::get_suspension_stiffness); ClassDB::bind_method(D_METHOD("get_suspension_stiffness"), &VehicleWheel3D::get_suspension_stiffness);
ClassDB::bind_method(D_METHOD("set_suspension_max_force", "length"), &VehicleWheel::set_suspension_max_force); ClassDB::bind_method(D_METHOD("set_suspension_max_force", "length"), &VehicleWheel3D::set_suspension_max_force);
ClassDB::bind_method(D_METHOD("get_suspension_max_force"), &VehicleWheel::get_suspension_max_force); ClassDB::bind_method(D_METHOD("get_suspension_max_force"), &VehicleWheel3D::get_suspension_max_force);
ClassDB::bind_method(D_METHOD("set_damping_compression", "length"), &VehicleWheel::set_damping_compression); ClassDB::bind_method(D_METHOD("set_damping_compression", "length"), &VehicleWheel3D::set_damping_compression);
ClassDB::bind_method(D_METHOD("get_damping_compression"), &VehicleWheel::get_damping_compression); ClassDB::bind_method(D_METHOD("get_damping_compression"), &VehicleWheel3D::get_damping_compression);
ClassDB::bind_method(D_METHOD("set_damping_relaxation", "length"), &VehicleWheel::set_damping_relaxation); ClassDB::bind_method(D_METHOD("set_damping_relaxation", "length"), &VehicleWheel3D::set_damping_relaxation);
ClassDB::bind_method(D_METHOD("get_damping_relaxation"), &VehicleWheel::get_damping_relaxation); ClassDB::bind_method(D_METHOD("get_damping_relaxation"), &VehicleWheel3D::get_damping_relaxation);
ClassDB::bind_method(D_METHOD("set_use_as_traction", "enable"), &VehicleWheel::set_use_as_traction); ClassDB::bind_method(D_METHOD("set_use_as_traction", "enable"), &VehicleWheel3D::set_use_as_traction);
ClassDB::bind_method(D_METHOD("is_used_as_traction"), &VehicleWheel::is_used_as_traction); ClassDB::bind_method(D_METHOD("is_used_as_traction"), &VehicleWheel3D::is_used_as_traction);
ClassDB::bind_method(D_METHOD("set_use_as_steering", "enable"), &VehicleWheel::set_use_as_steering); ClassDB::bind_method(D_METHOD("set_use_as_steering", "enable"), &VehicleWheel3D::set_use_as_steering);
ClassDB::bind_method(D_METHOD("is_used_as_steering"), &VehicleWheel::is_used_as_steering); ClassDB::bind_method(D_METHOD("is_used_as_steering"), &VehicleWheel3D::is_used_as_steering);
ClassDB::bind_method(D_METHOD("set_friction_slip", "length"), &VehicleWheel::set_friction_slip); ClassDB::bind_method(D_METHOD("set_friction_slip", "length"), &VehicleWheel3D::set_friction_slip);
ClassDB::bind_method(D_METHOD("get_friction_slip"), &VehicleWheel::get_friction_slip); ClassDB::bind_method(D_METHOD("get_friction_slip"), &VehicleWheel3D::get_friction_slip);
ClassDB::bind_method(D_METHOD("is_in_contact"), &VehicleWheel::is_in_contact); ClassDB::bind_method(D_METHOD("is_in_contact"), &VehicleWheel3D::is_in_contact);
ClassDB::bind_method(D_METHOD("set_roll_influence", "roll_influence"), &VehicleWheel::set_roll_influence); ClassDB::bind_method(D_METHOD("set_roll_influence", "roll_influence"), &VehicleWheel3D::set_roll_influence);
ClassDB::bind_method(D_METHOD("get_roll_influence"), &VehicleWheel::get_roll_influence); ClassDB::bind_method(D_METHOD("get_roll_influence"), &VehicleWheel3D::get_roll_influence);
ClassDB::bind_method(D_METHOD("get_skidinfo"), &VehicleWheel::get_skidinfo); ClassDB::bind_method(D_METHOD("get_skidinfo"), &VehicleWheel3D::get_skidinfo);
ClassDB::bind_method(D_METHOD("get_rpm"), &VehicleWheel::get_rpm); ClassDB::bind_method(D_METHOD("get_rpm"), &VehicleWheel3D::get_rpm);
ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleWheel::set_engine_force); ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleWheel3D::set_engine_force);
ClassDB::bind_method(D_METHOD("get_engine_force"), &VehicleWheel::get_engine_force); ClassDB::bind_method(D_METHOD("get_engine_force"), &VehicleWheel3D::get_engine_force);
ClassDB::bind_method(D_METHOD("set_brake", "brake"), &VehicleWheel::set_brake); ClassDB::bind_method(D_METHOD("set_brake", "brake"), &VehicleWheel3D::set_brake);
ClassDB::bind_method(D_METHOD("get_brake"), &VehicleWheel::get_brake); ClassDB::bind_method(D_METHOD("get_brake"), &VehicleWheel3D::get_brake);
ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleWheel::set_steering); ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleWheel3D::set_steering);
ClassDB::bind_method(D_METHOD("get_steering"), &VehicleWheel::get_steering); ClassDB::bind_method(D_METHOD("get_steering"), &VehicleWheel3D::get_steering);
ADD_GROUP("Per-Wheel Motion", ""); ADD_GROUP("Per-Wheel Motion", "");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01,or_greater"), "set_engine_force", "get_engine_force"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01,or_greater"), "set_engine_force", "get_engine_force");
@ -302,65 +302,65 @@ void VehicleWheel::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "damping_relaxation"), "set_damping_relaxation", "get_damping_relaxation"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "damping_relaxation"), "set_damping_relaxation", "get_damping_relaxation");
} }
void VehicleWheel::set_engine_force(float p_engine_force) { void VehicleWheel3D::set_engine_force(float p_engine_force) {
m_engineForce = p_engine_force; m_engineForce = p_engine_force;
} }
float VehicleWheel::get_engine_force() const { float VehicleWheel3D::get_engine_force() const {
return m_engineForce; return m_engineForce;
} }
void VehicleWheel::set_brake(float p_brake) { void VehicleWheel3D::set_brake(float p_brake) {
m_brake = p_brake; m_brake = p_brake;
} }
float VehicleWheel::get_brake() const { float VehicleWheel3D::get_brake() const {
return m_brake; return m_brake;
} }
void VehicleWheel::set_steering(float p_steering) { void VehicleWheel3D::set_steering(float p_steering) {
m_steering = p_steering; m_steering = p_steering;
} }
float VehicleWheel::get_steering() const { float VehicleWheel3D::get_steering() const {
return m_steering; return m_steering;
} }
void VehicleWheel::set_use_as_traction(bool p_enable) { void VehicleWheel3D::set_use_as_traction(bool p_enable) {
engine_traction = p_enable; engine_traction = p_enable;
} }
bool VehicleWheel::is_used_as_traction() const { bool VehicleWheel3D::is_used_as_traction() const {
return engine_traction; return engine_traction;
} }
void VehicleWheel::set_use_as_steering(bool p_enabled) { void VehicleWheel3D::set_use_as_steering(bool p_enabled) {
steers = p_enabled; steers = p_enabled;
} }
bool VehicleWheel::is_used_as_steering() const { bool VehicleWheel3D::is_used_as_steering() const {
return steers; return steers;
} }
float VehicleWheel::get_skidinfo() const { float VehicleWheel3D::get_skidinfo() const {
return m_skidInfo; return m_skidInfo;
} }
float VehicleWheel::get_rpm() const { float VehicleWheel3D::get_rpm() const {
return m_rpm; return m_rpm;
} }
VehicleWheel::VehicleWheel() { VehicleWheel3D::VehicleWheel3D() {
steers = false; steers = false;
engine_traction = false; engine_traction = false;
@ -388,7 +388,7 @@ VehicleWheel::VehicleWheel() {
body = NULL; body = NULL;
} }
void VehicleBody::_update_wheel_transform(VehicleWheel &wheel, PhysicsDirectBodyState *s) { void VehicleBody3D::_update_wheel_transform(VehicleWheel3D &wheel, PhysicsDirectBodyState *s) {
wheel.m_raycastInfo.m_isInContact = false; wheel.m_raycastInfo.m_isInContact = false;
@ -405,9 +405,9 @@ void VehicleBody::_update_wheel_transform(VehicleWheel &wheel, PhysicsDirectBody
wheel.m_raycastInfo.m_wheelAxleWS = chassisTrans.get_basis().xform(wheel.m_wheelAxleCS).normalized(); wheel.m_raycastInfo.m_wheelAxleWS = chassisTrans.get_basis().xform(wheel.m_wheelAxleCS).normalized();
} }
void VehicleBody::_update_wheel(int p_idx, PhysicsDirectBodyState *s) { void VehicleBody3D::_update_wheel(int p_idx, PhysicsDirectBodyState *s) {
VehicleWheel &wheel = *wheels[p_idx]; VehicleWheel3D &wheel = *wheels[p_idx];
_update_wheel_transform(wheel, s); _update_wheel_transform(wheel, s);
Vector3 up = -wheel.m_raycastInfo.m_wheelDirectionWS; Vector3 up = -wheel.m_raycastInfo.m_wheelDirectionWS;
@ -430,9 +430,9 @@ void VehicleBody::_update_wheel(int p_idx, PhysicsDirectBodyState *s) {
wheel.m_raycastInfo.m_hardPointWS + wheel.m_raycastInfo.m_wheelDirectionWS * wheel.m_raycastInfo.m_suspensionLength); wheel.m_raycastInfo.m_hardPointWS + wheel.m_raycastInfo.m_wheelDirectionWS * wheel.m_raycastInfo.m_suspensionLength);
} }
real_t VehicleBody::_ray_cast(int p_idx, PhysicsDirectBodyState *s) { real_t VehicleBody3D::_ray_cast(int p_idx, PhysicsDirectBodyState *s) {
VehicleWheel &wheel = *wheels[p_idx]; VehicleWheel3D &wheel = *wheels[p_idx];
_update_wheel_transform(wheel, s); _update_wheel_transform(wheel, s);
@ -513,12 +513,12 @@ real_t VehicleBody::_ray_cast(int p_idx, PhysicsDirectBodyState *s) {
return depth; return depth;
} }
void VehicleBody::_update_suspension(PhysicsDirectBodyState *s) { void VehicleBody3D::_update_suspension(PhysicsDirectBodyState *s) {
real_t chassisMass = mass; real_t chassisMass = mass;
for (int w_it = 0; w_it < wheels.size(); w_it++) { for (int w_it = 0; w_it < wheels.size(); w_it++) {
VehicleWheel &wheel_info = *wheels[w_it]; VehicleWheel3D &wheel_info = *wheels[w_it];
if (wheel_info.m_raycastInfo.m_isInContact) { if (wheel_info.m_raycastInfo.m_isInContact) {
real_t force; real_t force;
@ -558,7 +558,7 @@ void VehicleBody::_update_suspension(PhysicsDirectBodyState *s) {
} }
//bilateral constraint between two dynamic objects //bilateral constraint between two dynamic objects
void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vector3 &pos1, void VehicleBody3D::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vector3 &pos1,
PhysicsBody3D *body2, const Vector3 &pos2, const Vector3 &normal, real_t &impulse, const real_t p_rollInfluence) { PhysicsBody3D *body2, const Vector3 &pos2, const Vector3 &normal, real_t &impulse, const real_t p_rollInfluence) {
real_t normalLenSqr = normal.length_squared(); real_t normalLenSqr = normal.length_squared();
@ -636,7 +636,7 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec
#endif #endif
} }
VehicleBody::btVehicleWheelContactPoint::btVehicleWheelContactPoint(PhysicsDirectBodyState *s, PhysicsBody3D *body1, const Vector3 &frictionPosWorld, const Vector3 &frictionDirectionWorld, real_t maxImpulse) : VehicleBody3D::btVehicleWheelContactPoint::btVehicleWheelContactPoint(PhysicsDirectBodyState *s, PhysicsBody3D *body1, const Vector3 &frictionPosWorld, const Vector3 &frictionDirectionWorld, real_t maxImpulse) :
m_s(s), m_s(s),
m_body1(body1), m_body1(body1),
m_frictionPositionWorld(frictionPosWorld), m_frictionPositionWorld(frictionPosWorld),
@ -667,7 +667,7 @@ VehicleBody::btVehicleWheelContactPoint::btVehicleWheelContactPoint(PhysicsDirec
m_jacDiagABInv = relaxation / (denom0 + denom1); m_jacDiagABInv = relaxation / (denom0 + denom1);
} }
real_t VehicleBody::_calc_rolling_friction(btVehicleWheelContactPoint &contactPoint) { real_t VehicleBody3D::_calc_rolling_friction(btVehicleWheelContactPoint &contactPoint) {
real_t j1 = 0.f; real_t j1 = 0.f;
@ -698,7 +698,7 @@ real_t VehicleBody::_calc_rolling_friction(btVehicleWheelContactPoint &contactPo
} }
static const real_t sideFrictionStiffness2 = real_t(1.0); static const real_t sideFrictionStiffness2 = real_t(1.0);
void VehicleBody::_update_friction(PhysicsDirectBodyState *s) { void VehicleBody3D::_update_friction(PhysicsDirectBodyState *s) {
//calculate the impulse, so that the wheels don't move sidewards //calculate the impulse, so that the wheels don't move sidewards
int numWheel = wheels.size(); int numWheel = wheels.size();
@ -720,7 +720,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
for (int i = 0; i < wheels.size(); i++) { for (int i = 0; i < wheels.size(); i++) {
VehicleWheel &wheelInfo = *wheels[i]; VehicleWheel3D &wheelInfo = *wheels[i];
if (wheelInfo.m_raycastInfo.m_isInContact) { if (wheelInfo.m_raycastInfo.m_isInContact) {
@ -754,7 +754,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
bool sliding = false; bool sliding = false;
{ {
for (int wheel = 0; wheel < wheels.size(); wheel++) { for (int wheel = 0; wheel < wheels.size(); wheel++) {
VehicleWheel &wheelInfo = *wheels[wheel]; VehicleWheel3D &wheelInfo = *wheels[wheel];
//class btRigidBody* groundObject = (class btRigidBody*) wheelInfo.m_raycastInfo.m_groundObject; //class btRigidBody* groundObject = (class btRigidBody*) wheelInfo.m_raycastInfo.m_groundObject;
@ -816,7 +816,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
// apply the impulses // apply the impulses
{ {
for (int wheel = 0; wheel < wheels.size(); wheel++) { for (int wheel = 0; wheel < wheels.size(); wheel++) {
VehicleWheel &wheelInfo = *wheels[wheel]; VehicleWheel3D &wheelInfo = *wheels[wheel];
Vector3 rel_pos = wheelInfo.m_raycastInfo.m_contactPointWS - Vector3 rel_pos = wheelInfo.m_raycastInfo.m_contactPointWS -
s->get_transform().origin; s->get_transform().origin;
@ -850,7 +850,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
} }
} }
void VehicleBody::_direct_state_changed(Object *p_state) { void VehicleBody3D::_direct_state_changed(Object *p_state) {
RigidBody3D::_direct_state_changed(p_state); RigidBody3D::_direct_state_changed(p_state);
@ -874,7 +874,7 @@ void VehicleBody::_direct_state_changed(Object *p_state) {
for (int i = 0; i < wheels.size(); i++) { for (int i = 0; i < wheels.size(); i++) {
//apply suspension force //apply suspension force
VehicleWheel &wheel = *wheels[i]; VehicleWheel3D &wheel = *wheels[i];
real_t suspensionForce = wheel.m_wheelsSuspensionForce; real_t suspensionForce = wheel.m_wheelsSuspensionForce;
@ -891,7 +891,7 @@ void VehicleBody::_direct_state_changed(Object *p_state) {
_update_friction(state); _update_friction(state);
for (int i = 0; i < wheels.size(); i++) { for (int i = 0; i < wheels.size(); i++) {
VehicleWheel &wheel = *wheels[i]; VehicleWheel3D &wheel = *wheels[i];
Vector3 relpos = wheel.m_raycastInfo.m_hardPointWS - state->get_transform().origin; Vector3 relpos = wheel.m_raycastInfo.m_hardPointWS - state->get_transform().origin;
Vector3 vel = state->get_linear_velocity() + (state->get_angular_velocity()).cross(relpos); // * mPos); Vector3 vel = state->get_linear_velocity() + (state->get_angular_velocity()).cross(relpos); // * mPos);
@ -920,58 +920,58 @@ void VehicleBody::_direct_state_changed(Object *p_state) {
state = NULL; state = NULL;
} }
void VehicleBody::set_engine_force(float p_engine_force) { void VehicleBody3D::set_engine_force(float p_engine_force) {
engine_force = p_engine_force; engine_force = p_engine_force;
for (int i = 0; i < wheels.size(); i++) { for (int i = 0; i < wheels.size(); i++) {
VehicleWheel &wheelInfo = *wheels[i]; VehicleWheel3D &wheelInfo = *wheels[i];
if (wheelInfo.engine_traction) if (wheelInfo.engine_traction)
wheelInfo.m_engineForce = p_engine_force; wheelInfo.m_engineForce = p_engine_force;
} }
} }
float VehicleBody::get_engine_force() const { float VehicleBody3D::get_engine_force() const {
return engine_force; return engine_force;
} }
void VehicleBody::set_brake(float p_brake) { void VehicleBody3D::set_brake(float p_brake) {
brake = p_brake; brake = p_brake;
for (int i = 0; i < wheels.size(); i++) { for (int i = 0; i < wheels.size(); i++) {
VehicleWheel &wheelInfo = *wheels[i]; VehicleWheel3D &wheelInfo = *wheels[i];
wheelInfo.m_brake = p_brake; wheelInfo.m_brake = p_brake;
} }
} }
float VehicleBody::get_brake() const { float VehicleBody3D::get_brake() const {
return brake; return brake;
} }
void VehicleBody::set_steering(float p_steering) { void VehicleBody3D::set_steering(float p_steering) {
m_steeringValue = p_steering; m_steeringValue = p_steering;
for (int i = 0; i < wheels.size(); i++) { for (int i = 0; i < wheels.size(); i++) {
VehicleWheel &wheelInfo = *wheels[i]; VehicleWheel3D &wheelInfo = *wheels[i];
if (wheelInfo.steers) if (wheelInfo.steers)
wheelInfo.m_steering = p_steering; wheelInfo.m_steering = p_steering;
} }
} }
float VehicleBody::get_steering() const { float VehicleBody3D::get_steering() const {
return m_steeringValue; return m_steeringValue;
} }
void VehicleBody::_bind_methods() { void VehicleBody3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleBody::set_engine_force); ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleBody3D::set_engine_force);
ClassDB::bind_method(D_METHOD("get_engine_force"), &VehicleBody::get_engine_force); ClassDB::bind_method(D_METHOD("get_engine_force"), &VehicleBody3D::get_engine_force);
ClassDB::bind_method(D_METHOD("set_brake", "brake"), &VehicleBody::set_brake); ClassDB::bind_method(D_METHOD("set_brake", "brake"), &VehicleBody3D::set_brake);
ClassDB::bind_method(D_METHOD("get_brake"), &VehicleBody::get_brake); ClassDB::bind_method(D_METHOD("get_brake"), &VehicleBody3D::get_brake);
ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleBody::set_steering); ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleBody3D::set_steering);
ClassDB::bind_method(D_METHOD("get_steering"), &VehicleBody::get_steering); ClassDB::bind_method(D_METHOD("get_steering"), &VehicleBody3D::get_steering);
ADD_GROUP("Motion", ""); ADD_GROUP("Motion", "");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01,or_greater"), "set_engine_force", "get_engine_force"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01,or_greater"), "set_engine_force", "get_engine_force");
@ -979,7 +979,7 @@ void VehicleBody::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "steering", PROPERTY_HINT_RANGE, "-180,180.0,0.01"), "set_steering", "get_steering"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "steering", PROPERTY_HINT_RANGE, "-180,180.0,0.01"), "set_steering", "get_steering");
} }
VehicleBody::VehicleBody() { VehicleBody3D::VehicleBody3D() {
m_pitchControl = 0; m_pitchControl = 0;
m_currentVehicleSpeedKmHour = real_t(0.); m_currentVehicleSpeedKmHour = real_t(0.);

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* vehicle_body.h */ /* vehicle_body_3d.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -33,13 +33,13 @@
#include "scene/3d/physics_body_3d.h" #include "scene/3d/physics_body_3d.h"
class VehicleBody; class VehicleBody3D;
class VehicleWheel : public Node3D { class VehicleWheel3D : public Node3D {
GDCLASS(VehicleWheel, Node3D); GDCLASS(VehicleWheel3D, Node3D);
friend class VehicleBody; friend class VehicleBody3D;
Transform m_worldTransform; Transform m_worldTransform;
Transform local_xform; Transform local_xform;
@ -61,7 +61,7 @@ class VehicleWheel : public Node3D {
real_t m_maxSuspensionForce; real_t m_maxSuspensionForce;
bool m_bIsFrontWheel; bool m_bIsFrontWheel;
VehicleBody *body; VehicleBody3D *body;
//btVector3 m_wheelAxleCS; // const or modified by steering ? //btVector3 m_wheelAxleCS; // const or modified by steering ?
@ -148,12 +148,12 @@ public:
String get_configuration_warning() const; String get_configuration_warning() const;
VehicleWheel(); VehicleWheel3D();
}; };
class VehicleBody : public RigidBody3D { class VehicleBody3D : public RigidBody3D {
GDCLASS(VehicleBody, RigidBody3D); GDCLASS(VehicleBody3D, RigidBody3D);
float engine_force; float engine_force;
float brake; float brake;
@ -186,11 +186,11 @@ class VehicleBody : public RigidBody3D {
void _update_friction(PhysicsDirectBodyState *s); void _update_friction(PhysicsDirectBodyState *s);
void _update_suspension(PhysicsDirectBodyState *s); void _update_suspension(PhysicsDirectBodyState *s);
real_t _ray_cast(int p_idx, PhysicsDirectBodyState *s); real_t _ray_cast(int p_idx, PhysicsDirectBodyState *s);
void _update_wheel_transform(VehicleWheel &wheel, PhysicsDirectBodyState *s); void _update_wheel_transform(VehicleWheel3D &wheel, PhysicsDirectBodyState *s);
void _update_wheel(int p_idx, PhysicsDirectBodyState *s); void _update_wheel(int p_idx, PhysicsDirectBodyState *s);
friend class VehicleWheel; friend class VehicleWheel3D;
Vector<VehicleWheel *> wheels; Vector<VehicleWheel3D *> wheels;
static void _bind_methods(); static void _bind_methods();
@ -206,7 +206,7 @@ public:
void set_steering(float p_steering); void set_steering(float p_steering);
float get_steering() const; float get_steering() const;
VehicleBody(); VehicleBody3D();
}; };
#endif // VEHICLE_BODY_H #endif // VEHICLE_BODY_H

View file

@ -33,8 +33,8 @@
#include "core/math/transform_2d.h" #include "core/math/transform_2d.h"
#include "core/rid.h" #include "core/rid.h"
#include "scene/2d/canvas_item.h"
#include "scene/gui/shortcut.h" #include "scene/gui/shortcut.h"
#include "scene/main/canvas_item.h"
#include "scene/main/node.h" #include "scene/main/node.h"
#include "scene/main/timer.h" #include "scene/main/timer.h"
#include "scene/resources/theme.h" #include "scene/resources/theme.h"

View file

@ -1410,7 +1410,7 @@ SceneTree::SceneTree() {
root = memnew(Window); root = memnew(Window);
root->set_name("root"); root->set_name("root");
if (!root->get_world().is_valid()) if (!root->get_world().is_valid())
root->set_world(Ref<World>(memnew(World))); root->set_world(Ref<World3D>(memnew(World3D)));
// Initialize network state // Initialize network state
multiplayer_poll = true; multiplayer_poll = true;

View file

@ -36,8 +36,8 @@
#include "core/os/thread_safe.h" #include "core/os/thread_safe.h"
#include "core/self_list.h" #include "core/self_list.h"
#include "scene/resources/mesh.h" #include "scene/resources/mesh.h"
#include "scene/resources/world.h"
#include "scene/resources/world_2d.h" #include "scene/resources/world_2d.h"
#include "scene/resources/world_3d.h"
#undef Window #undef Window

0
scene/main/timer.cpp Executable file → Normal file
View file

0
scene/main/timer.h Executable file → Normal file
View file

View file

@ -1285,7 +1285,7 @@ void Viewport::_propagate_exit_world(Node *p_node) {
} }
} }
void Viewport::set_world(const Ref<World> &p_world) { void Viewport::set_world(const Ref<World3D> &p_world) {
if (world == p_world) if (world == p_world)
return; return;
@ -1304,7 +1304,7 @@ void Viewport::set_world(const Ref<World> &p_world) {
own_world = world->duplicate(); own_world = world->duplicate();
world->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed)); world->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
} else { } else {
own_world = Ref<World>(memnew(World)); own_world = Ref<World3D>(memnew(World3D));
} }
} }
@ -1318,7 +1318,7 @@ void Viewport::set_world(const Ref<World> &p_world) {
_update_listener(); _update_listener();
} }
Ref<World> Viewport::get_world() const { Ref<World3D> Viewport::get_world() const {
return world; return world;
} }
@ -1328,7 +1328,7 @@ Ref<World2D> Viewport::get_world_2d() const {
return world_2d; return world_2d;
} }
Ref<World> Viewport::find_world() const { Ref<World3D> Viewport::find_world() const {
if (own_world.is_valid()) if (own_world.is_valid())
return own_world; return own_world;
@ -1337,7 +1337,7 @@ Ref<World> Viewport::find_world() const {
else if (parent) else if (parent)
return parent->find_world(); return parent->find_world();
else else
return Ref<World>(); return Ref<World3D>();
} }
Listener3D *Viewport::get_listener() const { Listener3D *Viewport::get_listener() const {
@ -3092,7 +3092,7 @@ void Viewport::set_use_own_world(bool p_world) {
_propagate_exit_world(this); _propagate_exit_world(this);
if (!p_world) { if (!p_world) {
own_world = Ref<World>(); own_world = Ref<World3D>();
if (world.is_valid()) { if (world.is_valid()) {
world->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed)); world->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
} }
@ -3101,7 +3101,7 @@ void Viewport::set_use_own_world(bool p_world) {
own_world = world->duplicate(); own_world = world->duplicate();
world->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed)); world->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
} else { } else {
own_world = Ref<World>(memnew(World)); own_world = Ref<World3D>(memnew(World3D));
} }
} }

View file

@ -245,8 +245,8 @@ private:
Map<ObjectID, uint64_t> physics_2d_mouseover; Map<ObjectID, uint64_t> physics_2d_mouseover;
Ref<World2D> world_2d; Ref<World2D> world_2d;
Ref<World> world; Ref<World3D> world;
Ref<World> own_world; Ref<World3D> own_world;
Rect2i to_screen_rect; Rect2i to_screen_rect;
StringName input_group; StringName input_group;
@ -467,10 +467,10 @@ public:
Rect2 get_visible_rect() const; Rect2 get_visible_rect() const;
RID get_viewport_rid() const; RID get_viewport_rid() const;
void set_world(const Ref<World> &p_world); void set_world(const Ref<World3D> &p_world);
void set_world_2d(const Ref<World2D> &p_world_2d); void set_world_2d(const Ref<World2D> &p_world_2d);
Ref<World> get_world() const; Ref<World3D> get_world() const;
Ref<World> find_world() const; Ref<World3D> find_world() const;
Ref<World2D> get_world_2d() const; Ref<World2D> get_world_2d() const;
Ref<World2D> find_world_2d() const; Ref<World2D> find_world_2d() const;

View file

@ -38,11 +38,11 @@
#include "scene/2d/audio_stream_player_2d.h" #include "scene/2d/audio_stream_player_2d.h"
#include "scene/2d/back_buffer_copy.h" #include "scene/2d/back_buffer_copy.h"
#include "scene/2d/camera_2d.h" #include "scene/2d/camera_2d.h"
#include "scene/2d/canvas_item.h"
#include "scene/2d/canvas_modulate.h" #include "scene/2d/canvas_modulate.h"
#include "scene/2d/collision_polygon_2d.h" #include "scene/2d/collision_polygon_2d.h"
#include "scene/2d/collision_shape_2d.h" #include "scene/2d/collision_shape_2d.h"
#include "scene/2d/cpu_particles_2d.h" #include "scene/2d/cpu_particles_2d.h"
#include "scene/2d/gpu_particles_2d.h"
#include "scene/2d/joints_2d.h" #include "scene/2d/joints_2d.h"
#include "scene/2d/light_2d.h" #include "scene/2d/light_2d.h"
#include "scene/2d/light_occluder_2d.h" #include "scene/2d/light_occluder_2d.h"
@ -54,7 +54,6 @@
#include "scene/2d/navigation_obstacle_2d.h" #include "scene/2d/navigation_obstacle_2d.h"
#include "scene/2d/parallax_background.h" #include "scene/2d/parallax_background.h"
#include "scene/2d/parallax_layer.h" #include "scene/2d/parallax_layer.h"
#include "scene/2d/particles_2d.h"
#include "scene/2d/path_2d.h" #include "scene/2d/path_2d.h"
#include "scene/2d/physics_body_2d.h" #include "scene/2d/physics_body_2d.h"
#include "scene/2d/polygon_2d.h" #include "scene/2d/polygon_2d.h"
@ -121,6 +120,7 @@
#include "scene/gui/tree.h" #include "scene/gui/tree.h"
#include "scene/gui/video_player.h" #include "scene/gui/video_player.h"
#include "scene/gui/viewport_container.h" #include "scene/gui/viewport_container.h"
#include "scene/main/canvas_item.h"
#include "scene/main/canvas_layer.h" #include "scene/main/canvas_layer.h"
#include "scene/main/http_request.h" #include "scene/main/http_request.h"
#include "scene/main/instance_placeholder.h" #include "scene/main/instance_placeholder.h"
@ -143,7 +143,7 @@
#include "scene/resources/default_theme/default_theme.h" #include "scene/resources/default_theme/default_theme.h"
#include "scene/resources/dynamic_font.h" #include "scene/resources/dynamic_font.h"
#include "scene/resources/gradient.h" #include "scene/resources/gradient.h"
#include "scene/resources/height_map_shape.h" #include "scene/resources/height_map_shape_3d.h"
#include "scene/resources/line_shape_2d.h" #include "scene/resources/line_shape_2d.h"
#include "scene/resources/material.h" #include "scene/resources/material.h"
#include "scene/resources/mesh.h" #include "scene/resources/mesh.h"
@ -154,7 +154,7 @@
#include "scene/resources/physics_material.h" #include "scene/resources/physics_material.h"
#include "scene/resources/polygon_path_finder.h" #include "scene/resources/polygon_path_finder.h"
#include "scene/resources/primitive_meshes.h" #include "scene/resources/primitive_meshes.h"
#include "scene/resources/ray_shape.h" #include "scene/resources/ray_shape_3d.h"
#include "scene/resources/rectangle_shape_2d.h" #include "scene/resources/rectangle_shape_2d.h"
#include "scene/resources/resource_format_text.h" #include "scene/resources/resource_format_text.h"
#include "scene/resources/segment_shape_2d.h" #include "scene/resources/segment_shape_2d.h"
@ -168,8 +168,8 @@
#include "scene/resources/video_stream.h" #include "scene/resources/video_stream.h"
#include "scene/resources/visual_shader.h" #include "scene/resources/visual_shader.h"
#include "scene/resources/visual_shader_nodes.h" #include "scene/resources/visual_shader_nodes.h"
#include "scene/resources/world.h"
#include "scene/resources/world_2d.h" #include "scene/resources/world_2d.h"
#include "scene/resources/world_3d.h"
#include "scene/resources/world_margin_shape_3d.h" #include "scene/resources/world_margin_shape_3d.h"
#include "scene/scene_string_names.h" #include "scene/scene_string_names.h"
@ -206,13 +206,13 @@
#include "scene/3d/ray_cast_3d.h" #include "scene/3d/ray_cast_3d.h"
#include "scene/3d/reflection_probe.h" #include "scene/3d/reflection_probe.h"
#include "scene/3d/remote_transform_3d.h" #include "scene/3d/remote_transform_3d.h"
#include "scene/3d/skeleton_ik_3d.h"
#include "scene/3d/soft_body_3d.h" #include "scene/3d/soft_body_3d.h"
#include "scene/3d/spring_arm_3d.h" #include "scene/3d/spring_arm_3d.h"
#include "scene/3d/sprite_3d.h" #include "scene/3d/sprite_3d.h"
#include "scene/3d/vehicle_body.h" #include "scene/3d/vehicle_body_3d.h"
#include "scene/3d/visibility_notifier_3d.h" #include "scene/3d/visibility_notifier_3d.h"
#include "scene/3d/world_environment.h" #include "scene/3d/world_environment.h"
#include "scene/animation/skeleton_ik.h"
#include "scene/resources/environment.h" #include "scene/resources/environment.h"
#include "scene/resources/mesh_library.h" #include "scene/resources/mesh_library.h"
#endif #endif
@ -279,6 +279,7 @@ void register_scene_types() {
ClassDB::register_class<Window>(); ClassDB::register_class<Window>();
/* REGISTER GUI */ /* REGISTER GUI */
ClassDB::register_class<ButtonGroup>(); ClassDB::register_class<ButtonGroup>();
ClassDB::register_virtual_class<BaseButton>(); ClassDB::register_virtual_class<BaseButton>();
@ -335,7 +336,6 @@ void register_scene_types() {
ClassDB::register_class<VideoPlayer>(); ClassDB::register_class<VideoPlayer>();
#ifndef ADVANCED_GUI_DISABLED #ifndef ADVANCED_GUI_DISABLED
ClassDB::register_class<FileDialog>(); ClassDB::register_class<FileDialog>();
ClassDB::register_class<PopupMenu>(); ClassDB::register_class<PopupMenu>();
@ -351,9 +351,10 @@ void register_scene_types() {
ClassDB::register_class<RichTextLabel>(); ClassDB::register_class<RichTextLabel>();
ClassDB::register_class<RichTextEffect>(); ClassDB::register_class<RichTextEffect>();
ClassDB::register_class<CharFXTransform>(); ClassDB::register_class<CharFXTransform>();
;
ClassDB::register_class<AcceptDialog>(); ClassDB::register_class<AcceptDialog>();
ClassDB::register_class<ConfirmationDialog>(); ClassDB::register_class<ConfirmationDialog>();
ClassDB::register_class<MarginContainer>(); ClassDB::register_class<MarginContainer>();
ClassDB::register_class<ViewportContainer>(); ClassDB::register_class<ViewportContainer>();
ClassDB::register_virtual_class<SplitContainer>(); ClassDB::register_virtual_class<SplitContainer>();
@ -364,6 +365,7 @@ void register_scene_types() {
OS::get_singleton()->yield(); //may take time to init OS::get_singleton()->yield(); //may take time to init
AcceptDialog::set_swap_ok_cancel(GLOBAL_DEF("gui/common/swap_ok_cancel", bool(DisplayServer::get_singleton()->get_swap_ok_cancel())));
#endif #endif
/* REGISTER 3D */ /* REGISTER 3D */
@ -405,7 +407,7 @@ void register_scene_types() {
ClassDB::register_virtual_class<VisualInstance3D>(); ClassDB::register_virtual_class<VisualInstance3D>();
ClassDB::register_virtual_class<GeometryInstance3D>(); ClassDB::register_virtual_class<GeometryInstance3D>();
ClassDB::register_class<Camera3D>(); ClassDB::register_class<Camera3D>();
ClassDB::register_class<ClippedCamera>(); ClassDB::register_class<ClippedCamera3D>();
ClassDB::register_class<Listener3D>(); ClassDB::register_class<Listener3D>();
ClassDB::register_class<ARVRCamera>(); ClassDB::register_class<ARVRCamera>();
ClassDB::register_class<ARVRController>(); ClassDB::register_class<ARVRController>();
@ -448,8 +450,8 @@ void register_scene_types() {
ClassDB::register_class<SkeletonIK3D>(); ClassDB::register_class<SkeletonIK3D>();
ClassDB::register_class<BoneAttachment3D>(); ClassDB::register_class<BoneAttachment3D>();
ClassDB::register_class<VehicleBody>(); ClassDB::register_class<VehicleBody3D>();
ClassDB::register_class<VehicleWheel>(); ClassDB::register_class<VehicleWheel3D>();
ClassDB::register_class<Area3D>(); ClassDB::register_class<Area3D>();
ClassDB::register_class<ProximityGroup3D>(); ClassDB::register_class<ProximityGroup3D>();
ClassDB::register_class<CollisionShape3D>(); ClassDB::register_class<CollisionShape3D>();
@ -478,11 +480,9 @@ void register_scene_types() {
ClassDB::register_class<NavigationObstacle3D>(); ClassDB::register_class<NavigationObstacle3D>();
OS::get_singleton()->yield(); //may take time to init OS::get_singleton()->yield(); //may take time to init
#endif #endif
ClassDB::register_class<NavigationMesh>();
AcceptDialog::set_swap_ok_cancel(GLOBAL_DEF("gui/common/swap_ok_cancel", bool(DisplayServer::get_singleton()->get_swap_ok_cancel()))); /* REGISTER SHADER */
ClassDB::register_class<Shader>(); ClassDB::register_class<Shader>();
ClassDB::register_class<VisualShader>(); ClassDB::register_class<VisualShader>();
@ -556,12 +556,13 @@ void register_scene_types() {
ClassDB::register_class<CanvasItemMaterial>(); ClassDB::register_class<CanvasItemMaterial>();
SceneTree::add_idle_callback(CanvasItemMaterial::flush_changes); SceneTree::add_idle_callback(CanvasItemMaterial::flush_changes);
CanvasItemMaterial::init_shaders(); CanvasItemMaterial::init_shaders();
/* REGISTER 2D */
ClassDB::register_class<Node2D>(); ClassDB::register_class<Node2D>();
ClassDB::register_class<CPUParticles2D>(); ClassDB::register_class<CPUParticles2D>();
ClassDB::register_class<Particles2D>(); ClassDB::register_class<GPUParticles2D>();
//ClassDB::register_class<ParticleAttractor2D>();
ClassDB::register_class<Sprite2D>(); ClassDB::register_class<Sprite2D>();
//ClassDB::register_type<ViewportSprite>();
ClassDB::register_class<SpriteFrames>(); ClassDB::register_class<SpriteFrames>();
ClassDB::register_class<AnimatedSprite2D>(); ClassDB::register_class<AnimatedSprite2D>();
ClassDB::register_class<Position2D>(); ClassDB::register_class<Position2D>();
@ -649,7 +650,7 @@ void register_scene_types() {
ClassDB::register_class<BoxShape3D>(); ClassDB::register_class<BoxShape3D>();
ClassDB::register_class<CapsuleShape3D>(); ClassDB::register_class<CapsuleShape3D>();
ClassDB::register_class<CylinderShape3D>(); ClassDB::register_class<CylinderShape3D>();
ClassDB::register_class<HeightMapShape>(); ClassDB::register_class<HeightMapShape3D>();
ClassDB::register_class<WorldMarginShape3D>(); ClassDB::register_class<WorldMarginShape3D>();
ClassDB::register_class<ConvexPolygonShape3D>(); ClassDB::register_class<ConvexPolygonShape3D>();
ClassDB::register_class<ConcavePolygonShape3D>(); ClassDB::register_class<ConcavePolygonShape3D>();
@ -657,10 +658,10 @@ void register_scene_types() {
OS::get_singleton()->yield(); //may take time to init OS::get_singleton()->yield(); //may take time to init
ClassDB::register_class<VelocityTracker3D>(); ClassDB::register_class<VelocityTracker3D>();
#endif #endif
ClassDB::register_class<PhysicsMaterial>(); ClassDB::register_class<PhysicsMaterial>();
ClassDB::register_class<World>(); ClassDB::register_class<World3D>();
ClassDB::register_class<Environment>(); ClassDB::register_class<Environment>();
ClassDB::register_class<CameraEffects>(); ClassDB::register_class<CameraEffects>();
ClassDB::register_class<World2D>(); ClassDB::register_class<World2D>();
@ -729,6 +730,7 @@ void register_scene_types() {
ClassDB::register_class<Path2D>(); ClassDB::register_class<Path2D>();
ClassDB::register_class<PathFollow2D>(); ClassDB::register_class<PathFollow2D>();
ClassDB::register_class<NavigationMesh>();
ClassDB::register_class<Navigation2D>(); ClassDB::register_class<Navigation2D>();
ClassDB::register_class<NavigationPolygon>(); ClassDB::register_class<NavigationPolygon>();
ClassDB::register_class<NavigationRegion2D>(); ClassDB::register_class<NavigationRegion2D>();
@ -744,90 +746,79 @@ void register_scene_types() {
ClassDB::register_virtual_class<SceneTreeTimer>(); //sorry, you can't create it ClassDB::register_virtual_class<SceneTreeTimer>(); //sorry, you can't create it
#ifndef DISABLE_DEPRECATED #ifndef DISABLE_DEPRECATED
// Dropped in 4.0, near approximation.
ClassDB::add_compatibility_class("AnimatedSprite", "AnimatedSprite2D");
ClassDB::add_compatibility_class("Sprite", "Sprite2D");
ClassDB::add_compatibility_class("SpatialMaterial", "StandardMaterial3D");
ClassDB::add_compatibility_class("Mesh", "ArrayMesh");
ClassDB::add_compatibility_class("AnimationTreePlayer", "AnimationTree"); ClassDB::add_compatibility_class("AnimationTreePlayer", "AnimationTree");
ClassDB::add_compatibility_class("VisualShaderNodeScalarConstant", "VisualShaderNodeFloatConstant");
ClassDB::add_compatibility_class("VisualShaderNodeScalarUniform", "VisualShaderNodeFloatUniform");
ClassDB::add_compatibility_class("VisualShaderNodeScalarOp", "VisualShaderNodeFloatOp");
ClassDB::add_compatibility_class("VisualShaderNodeScalarFunc", "VisualShaderNodeFloatFunc");
ClassDB::add_compatibility_class("NavigationMeshInstance", "NavigationRegion3D");
ClassDB::add_compatibility_class("NavigationPolygonInstance", "NavigationRegion2D");
ClassDB::add_compatibility_class("PlaneShape", "WorldMarginShape3D");
ClassDB::add_compatibility_class("WorldMarginShape", "WorldMarginShape3D");
ClassDB::add_compatibility_class("Spatial", "Node3D"); // Renamed in 4.0.
ClassDB::add_compatibility_class("AnimatedSprite", "AnimatedSprite2D");
ClassDB::add_compatibility_class("Area", "Area3D"); ClassDB::add_compatibility_class("Area", "Area3D");
ClassDB::add_compatibility_class("BoneAttachment", "BoneAttachment3D");
ClassDB::add_compatibility_class("BoxShape", "BoxShape3D");
ClassDB::add_compatibility_class("Camera", "Camera3D"); ClassDB::add_compatibility_class("Camera", "Camera3D");
ClassDB::add_compatibility_class("CapsuleShape", "CapsuleShape3D");
ClassDB::add_compatibility_class("Particles", "GPUParticles3D"); ClassDB::add_compatibility_class("ClippedCamera", "ClippedCamera3D");
ClassDB::add_compatibility_class("CollisionObject", "CollisionObject3D");
ClassDB::add_compatibility_class("CollisionPolygon", "CollisionPolygon3D");
ClassDB::add_compatibility_class("CollisionShape", "CollisionShape3D");
ClassDB::add_compatibility_class("ConcavePolygonShape", "ConcavePolygonShape3D");
ClassDB::add_compatibility_class("ConeTwistJoint", "ConeTwistJoint3D");
ClassDB::add_compatibility_class("ConvexPolygonShape", "ConvexPolygonShape3D");
ClassDB::add_compatibility_class("CPUParticles", "CPUParticles3D"); ClassDB::add_compatibility_class("CPUParticles", "CPUParticles3D");
ClassDB::add_compatibility_class("CylinderShape", "CylinderShape3D");
ClassDB::add_compatibility_class("Particles2D", "GPUParticles2D");
ClassDB::add_compatibility_class("Light", "Light3D");
ClassDB::add_compatibility_class("DirectionalLight", "DirectionalLight3D"); ClassDB::add_compatibility_class("DirectionalLight", "DirectionalLight3D");
ClassDB::add_compatibility_class("SpotLight", "SpotLight3D"); ClassDB::add_compatibility_class("Generic6DOFJoint", "Generic6DOFJoint3D");
ClassDB::add_compatibility_class("OmniLight", "OmniLight3D"); ClassDB::add_compatibility_class("HeightMapShape", "HeightMapShape3D");
ClassDB::add_compatibility_class("HingeJoint", "HingeJoint3D");
ClassDB::add_compatibility_class("ImmediateGeometry", "ImmediateGeometry3D");
ClassDB::add_compatibility_class("Joint", "Joint3D");
ClassDB::add_compatibility_class("KinematicBody", "KinematicBody3D");
ClassDB::add_compatibility_class("KinematicCollision", "KinematicCollision3D");
ClassDB::add_compatibility_class("Light", "Light3D");
ClassDB::add_compatibility_class("Listener", "Listener3D"); ClassDB::add_compatibility_class("Listener", "Listener3D");
ClassDB::add_compatibility_class("MeshInstance", "MeshInstance3D"); ClassDB::add_compatibility_class("MeshInstance", "MeshInstance3D");
ClassDB::add_compatibility_class("MultiMeshInstance", "MultiMeshInstance3D"); ClassDB::add_compatibility_class("MultiMeshInstance", "MultiMeshInstance3D");
ClassDB::add_compatibility_class("ImmediateGeometry", "ImmediateGeometry3D");
ClassDB::add_compatibility_class("Navigation", "Navigation3D"); ClassDB::add_compatibility_class("Navigation", "Navigation3D");
ClassDB::add_compatibility_class("NavigationAgent", "NavigationAgent3D"); ClassDB::add_compatibility_class("NavigationAgent", "NavigationAgent3D");
ClassDB::add_compatibility_class("NavigationMeshInstance", "NavigationRegion3D");
ClassDB::add_compatibility_class("NavigationObstacle", "NavigationObstacle3D"); ClassDB::add_compatibility_class("NavigationObstacle", "NavigationObstacle3D");
ClassDB::add_compatibility_class("NavigationPolygonInstance", "NavigationRegion2D");
ClassDB::add_compatibility_class("NavigationRegion", "NavigationRegion3D"); ClassDB::add_compatibility_class("NavigationRegion", "NavigationRegion3D");
ClassDB::add_compatibility_class("OmniLight", "OmniLight3D");
ClassDB::add_compatibility_class("Particles", "GPUParticles3D");
ClassDB::add_compatibility_class("Particles2D", "GPUParticles2D");
ClassDB::add_compatibility_class("Path", "Path3D"); ClassDB::add_compatibility_class("Path", "Path3D");
ClassDB::add_compatibility_class("PathFollow", "PathFollow3D"); ClassDB::add_compatibility_class("PathFollow", "PathFollow3D");
ClassDB::add_compatibility_class("PhysicalBone", "PhysicalBone3D");
ClassDB::add_compatibility_class("PhysicsBody", "PhysicsBody3D");
ClassDB::add_compatibility_class("PinJoint", "PinJoint3D");
ClassDB::add_compatibility_class("PlaneShape", "WorldMarginShape3D");
ClassDB::add_compatibility_class("ProximityGroup", "ProximityGroup3D"); ClassDB::add_compatibility_class("ProximityGroup", "ProximityGroup3D");
ClassDB::add_compatibility_class("RayCast", "RayCast3D"); ClassDB::add_compatibility_class("RayCast", "RayCast3D");
ClassDB::add_compatibility_class("RayShape", "RayShape3D");
ClassDB::add_compatibility_class("RemoteTransform", "RemoteTransform3D"); ClassDB::add_compatibility_class("RemoteTransform", "RemoteTransform3D");
ClassDB::add_compatibility_class("RigidBody", "RigidBody3D");
ClassDB::add_compatibility_class("Shape", "Shape3D");
ClassDB::add_compatibility_class("Skeleton", "Skeleton3D"); ClassDB::add_compatibility_class("Skeleton", "Skeleton3D");
ClassDB::add_compatibility_class("SkeletonIK", "SkeletonIK3D"); ClassDB::add_compatibility_class("SkeletonIK", "SkeletonIK3D");
ClassDB::add_compatibility_class("VisibilityNotifier", "VisibilityNotifier3D");
ClassDB::add_compatibility_class("VisibilityEnabler", "VisibilityEnabler3D");
ClassDB::add_compatibility_class("CollisionObject", "CollisionObject3D");
ClassDB::add_compatibility_class("CollisionShape", "CollisionShape3D");
ClassDB::add_compatibility_class("CollisionPolygon", "CollisionPolygon3D");
ClassDB::add_compatibility_class("PhysicsBody", "PhysicsBody3D");
ClassDB::add_compatibility_class("RigidBody", "RigidBody3D");
ClassDB::add_compatibility_class("StaticBody", "StaticBody3D");
ClassDB::add_compatibility_class("KinematicBody", "KinematicBody3D");
ClassDB::add_compatibility_class("SoftBody", "SoftBody3D");
ClassDB::add_compatibility_class("PhysicalBone", "PhysicalBone3D");
ClassDB::add_compatibility_class("KinematicCollision", "KinematicCollision3D");
ClassDB::add_compatibility_class("SpringArm", "SpringArm3D");
ClassDB::add_compatibility_class("Shape", "Shape3D");
ClassDB::add_compatibility_class("RayShape", "RayShape3D");
ClassDB::add_compatibility_class("SphereShape", "SphereShape3D");
ClassDB::add_compatibility_class("BoxShape", "BoxShape3D");
ClassDB::add_compatibility_class("CylinderShape", "CylinderShape3D");
ClassDB::add_compatibility_class("CapsuleShape", "CapsuleShape3D");
ClassDB::add_compatibility_class("ConvexPolygonShape", "ConvexPolygonShape3D");
ClassDB::add_compatibility_class("ConcavePolygonShape", "ConcavePolygonShape3D");
ClassDB::add_compatibility_class("Joint", "Joint3D");
ClassDB::add_compatibility_class("PinJoint", "PinJoint3D");
ClassDB::add_compatibility_class("SliderJoint", "SliderJoint3D"); ClassDB::add_compatibility_class("SliderJoint", "SliderJoint3D");
ClassDB::add_compatibility_class("HingeJoint", "HingeJoint3D"); ClassDB::add_compatibility_class("SoftBody", "SoftBody3D");
ClassDB::add_compatibility_class("ConeTwistJoint", "ConeTwistJoint3D"); ClassDB::add_compatibility_class("Spatial", "Node3D");
ClassDB::add_compatibility_class("Generic6DOFJoint", "Generic6DOFJoint3D"); ClassDB::add_compatibility_class("SpatialMaterial", "StandardMaterial3D");
ClassDB::add_compatibility_class("SpatialVelocityTracker", "VelocityTracker3D");
ClassDB::add_compatibility_class("SphereShape", "SphereShape3D");
ClassDB::add_compatibility_class("SpotLight", "SpotLight3D");
ClassDB::add_compatibility_class("SpringArm", "SpringArm3D");
ClassDB::add_compatibility_class("Sprite", "Sprite2D");
ClassDB::add_compatibility_class("StaticBody", "StaticBody3D");
ClassDB::add_compatibility_class("VehicleBody", "VehicleBody3D");
ClassDB::add_compatibility_class("VehicleWheel", "VehicleWheel3D");
ClassDB::add_compatibility_class("VisibilityEnabler", "VisibilityEnabler3D");
ClassDB::add_compatibility_class("VisibilityNotifier", "VisibilityNotifier3D");
ClassDB::add_compatibility_class("VisualShaderNodeScalarConstant", "VisualShaderNodeFloatConstant");
ClassDB::add_compatibility_class("VisualShaderNodeScalarFunc", "VisualShaderNodeFloatFunc");
ClassDB::add_compatibility_class("VisualShaderNodeScalarOp", "VisualShaderNodeFloatOp");
ClassDB::add_compatibility_class("VisualShaderNodeScalarUniform", "VisualShaderNodeFloatUniform");
ClassDB::add_compatibility_class("World", "World3D");
#endif #endif
OS::get_singleton()->yield(); //may take time to init OS::get_singleton()->yield(); //may take time to init

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* height_map_shape.cpp */ /* height_map_shape_3d.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,10 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "height_map_shape.h" #include "height_map_shape_3d.h"
#include "servers/physics_server.h" #include "servers/physics_server.h"
Vector<Vector3> HeightMapShape::get_debug_mesh_lines() { Vector<Vector3> HeightMapShape3D::get_debug_mesh_lines() {
Vector<Vector3> points; Vector<Vector3> points;
if ((map_width != 0) && (map_depth != 0)) { if ((map_width != 0) && (map_depth != 0)) {
@ -76,11 +76,11 @@ Vector<Vector3> HeightMapShape::get_debug_mesh_lines() {
return points; return points;
} }
real_t HeightMapShape::get_enclosing_radius() const { real_t HeightMapShape3D::get_enclosing_radius() const {
return Vector3(real_t(map_width), max_height - min_height, real_t(map_depth)).length(); return Vector3(real_t(map_width), max_height - min_height, real_t(map_depth)).length();
} }
void HeightMapShape::_update_shape() { void HeightMapShape3D::_update_shape() {
Dictionary d; Dictionary d;
d["width"] = map_width; d["width"] = map_width;
@ -92,7 +92,7 @@ void HeightMapShape::_update_shape() {
Shape3D::_update_shape(); Shape3D::_update_shape();
} }
void HeightMapShape::set_map_width(int p_new) { void HeightMapShape3D::set_map_width(int p_new) {
if (p_new < 1) { if (p_new < 1) {
// ignore // ignore
} else if (map_width != p_new) { } else if (map_width != p_new) {
@ -114,11 +114,11 @@ void HeightMapShape::set_map_width(int p_new) {
} }
} }
int HeightMapShape::get_map_width() const { int HeightMapShape3D::get_map_width() const {
return map_width; return map_width;
} }
void HeightMapShape::set_map_depth(int p_new) { void HeightMapShape3D::set_map_depth(int p_new) {
if (p_new < 1) { if (p_new < 1) {
// ignore // ignore
} else if (map_depth != p_new) { } else if (map_depth != p_new) {
@ -140,11 +140,11 @@ void HeightMapShape::set_map_depth(int p_new) {
} }
} }
int HeightMapShape::get_map_depth() const { int HeightMapShape3D::get_map_depth() const {
return map_depth; return map_depth;
} }
void HeightMapShape::set_map_data(PackedFloat32Array p_new) { void HeightMapShape3D::set_map_data(PackedFloat32Array p_new) {
int size = (map_width * map_depth); int size = (map_width * map_depth);
if (p_new.size() != size) { if (p_new.size() != size) {
// fail // fail
@ -174,24 +174,24 @@ void HeightMapShape::set_map_data(PackedFloat32Array p_new) {
_change_notify("map_data"); _change_notify("map_data");
} }
PackedFloat32Array HeightMapShape::get_map_data() const { PackedFloat32Array HeightMapShape3D::get_map_data() const {
return map_data; return map_data;
} }
void HeightMapShape::_bind_methods() { void HeightMapShape3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_map_width", "width"), &HeightMapShape::set_map_width); ClassDB::bind_method(D_METHOD("set_map_width", "width"), &HeightMapShape3D::set_map_width);
ClassDB::bind_method(D_METHOD("get_map_width"), &HeightMapShape::get_map_width); ClassDB::bind_method(D_METHOD("get_map_width"), &HeightMapShape3D::get_map_width);
ClassDB::bind_method(D_METHOD("set_map_depth", "height"), &HeightMapShape::set_map_depth); ClassDB::bind_method(D_METHOD("set_map_depth", "height"), &HeightMapShape3D::set_map_depth);
ClassDB::bind_method(D_METHOD("get_map_depth"), &HeightMapShape::get_map_depth); ClassDB::bind_method(D_METHOD("get_map_depth"), &HeightMapShape3D::get_map_depth);
ClassDB::bind_method(D_METHOD("set_map_data", "data"), &HeightMapShape::set_map_data); ClassDB::bind_method(D_METHOD("set_map_data", "data"), &HeightMapShape3D::set_map_data);
ClassDB::bind_method(D_METHOD("get_map_data"), &HeightMapShape::get_map_data); ClassDB::bind_method(D_METHOD("get_map_data"), &HeightMapShape3D::get_map_data);
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_width", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_width", "get_map_width"); ADD_PROPERTY(PropertyInfo(Variant::INT, "map_width", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_width", "get_map_width");
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_depth", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_depth", "get_map_depth"); ADD_PROPERTY(PropertyInfo(Variant::INT, "map_depth", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_depth", "get_map_depth");
ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "map_data"), "set_map_data", "get_map_data"); ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "map_data"), "set_map_data", "get_map_data");
} }
HeightMapShape::HeightMapShape() : HeightMapShape3D::HeightMapShape3D() :
Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_HEIGHTMAP)) { Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_HEIGHTMAP)) {
map_width = 2; map_width = 2;

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* height_map_shape.h */ /* height_map_shape_3d.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -33,8 +33,8 @@
#include "scene/resources/shape_3d.h" #include "scene/resources/shape_3d.h"
class HeightMapShape : public Shape3D { class HeightMapShape3D : public Shape3D {
GDCLASS(HeightMapShape, Shape3D); GDCLASS(HeightMapShape3D, Shape3D);
int map_width; int map_width;
int map_depth; int map_depth;
@ -57,7 +57,7 @@ public:
virtual Vector<Vector3> get_debug_mesh_lines(); virtual Vector<Vector3> get_debug_mesh_lines();
virtual real_t get_enclosing_radius() const; virtual real_t get_enclosing_radius() const;
HeightMapShape(); HeightMapShape3D();
}; };
#endif /* !HEIGHT_MAP_SHAPE_H */ #endif /* !HEIGHT_MAP_SHAPE_H */

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* ray_shape.cpp */ /* ray_shape_3d.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "ray_shape.h" #include "ray_shape_3d.h"
#include "servers/physics_server.h" #include "servers/physics_server.h"

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* ray_shape.h */ /* ray_shape_3d.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */

View file

@ -29,7 +29,8 @@
/*************************************************************************/ /*************************************************************************/
#include "style_box.h" #include "style_box.h"
#include "scene/2d/canvas_item.h"
#include "scene/main/canvas_item.h"
#include <limits.h> #include <limits.h>

View file

@ -34,7 +34,7 @@
#include "core/array.h" #include "core/array.h"
#include "core/resource.h" #include "core/resource.h"
#include "scene/2d/light_occluder_2d.h" #include "scene/2d/light_occluder_2d.h"
#include "scene/2d/navigation_polygon.h" #include "scene/2d/navigation_region_2d.h"
#include "scene/resources/convex_polygon_shape_2d.h" #include "scene/resources/convex_polygon_shape_2d.h"
#include "scene/resources/shape_2d.h" #include "scene/resources/shape_2d.h"
#include "scene/resources/texture.h" #include "scene/resources/texture.h"

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* world.cpp */ /* world_3d.cpp */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "world.h" #include "world_3d.h"
#include "core/math/camera_matrix.h" #include "core/math/camera_matrix.h"
#include "core/math/octree.h" #include "core/math/octree.h"
@ -210,65 +210,65 @@ struct SpatialIndexer {
} }
}; };
void World::_register_camera(Camera3D *p_camera) { void World3D::_register_camera(Camera3D *p_camera) {
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
indexer->_add_camera(p_camera); indexer->_add_camera(p_camera);
#endif #endif
} }
void World::_update_camera(Camera3D *p_camera) { void World3D::_update_camera(Camera3D *p_camera) {
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
indexer->_update_camera(p_camera); indexer->_update_camera(p_camera);
#endif #endif
} }
void World::_remove_camera(Camera3D *p_camera) { void World3D::_remove_camera(Camera3D *p_camera) {
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
indexer->_remove_camera(p_camera); indexer->_remove_camera(p_camera);
#endif #endif
} }
void World::_register_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect) { void World3D::_register_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect) {
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
indexer->_notifier_add(p_notifier, p_rect); indexer->_notifier_add(p_notifier, p_rect);
#endif #endif
} }
void World::_update_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect) { void World3D::_update_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect) {
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
indexer->_notifier_update(p_notifier, p_rect); indexer->_notifier_update(p_notifier, p_rect);
#endif #endif
} }
void World::_remove_notifier(VisibilityNotifier3D *p_notifier) { void World3D::_remove_notifier(VisibilityNotifier3D *p_notifier) {
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
indexer->_notifier_remove(p_notifier); indexer->_notifier_remove(p_notifier);
#endif #endif
} }
void World::_update(uint64_t p_frame) { void World3D::_update(uint64_t p_frame) {
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
indexer->_update(p_frame); indexer->_update(p_frame);
#endif #endif
} }
RID World::get_space() const { RID World3D::get_space() const {
return space; return space;
} }
RID World::get_scenario() const { RID World3D::get_scenario() const {
return scenario; return scenario;
} }
void World::set_environment(const Ref<Environment> &p_environment) { void World3D::set_environment(const Ref<Environment> &p_environment) {
if (environment == p_environment) { if (environment == p_environment) {
return; return;
} }
@ -282,12 +282,12 @@ void World::set_environment(const Ref<Environment> &p_environment) {
emit_changed(); emit_changed();
} }
Ref<Environment> World::get_environment() const { Ref<Environment> World3D::get_environment() const {
return environment; return environment;
} }
void World::set_fallback_environment(const Ref<Environment> &p_environment) { void World3D::set_fallback_environment(const Ref<Environment> &p_environment) {
if (fallback_environment == p_environment) { if (fallback_environment == p_environment) {
return; return;
} }
@ -301,12 +301,12 @@ void World::set_fallback_environment(const Ref<Environment> &p_environment) {
emit_changed(); emit_changed();
} }
Ref<Environment> World::get_fallback_environment() const { Ref<Environment> World3D::get_fallback_environment() const {
return fallback_environment; return fallback_environment;
} }
void World::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) { void World3D::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) {
camera_effects = p_camera_effects; camera_effects = p_camera_effects;
if (camera_effects.is_valid()) if (camera_effects.is_valid())
@ -315,34 +315,34 @@ void World::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) {
VS::get_singleton()->scenario_set_camera_effects(scenario, RID()); VS::get_singleton()->scenario_set_camera_effects(scenario, RID());
} }
Ref<CameraEffects> World::get_camera_effects() const { Ref<CameraEffects> World3D::get_camera_effects() const {
return camera_effects; return camera_effects;
} }
PhysicsDirectSpaceState *World::get_direct_space_state() { PhysicsDirectSpaceState *World3D::get_direct_space_state() {
return PhysicsServer::get_singleton()->space_get_direct_state(space); return PhysicsServer::get_singleton()->space_get_direct_state(space);
} }
void World::get_camera_list(List<Camera3D *> *r_cameras) { void World3D::get_camera_list(List<Camera3D *> *r_cameras) {
for (Map<Camera3D *, SpatialIndexer::CameraData>::Element *E = indexer->cameras.front(); E; E = E->next()) { for (Map<Camera3D *, SpatialIndexer::CameraData>::Element *E = indexer->cameras.front(); E; E = E->next()) {
r_cameras->push_back(E->key()); r_cameras->push_back(E->key());
} }
} }
void World::_bind_methods() { void World3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_space"), &World::get_space); ClassDB::bind_method(D_METHOD("get_space"), &World3D::get_space);
ClassDB::bind_method(D_METHOD("get_scenario"), &World::get_scenario); ClassDB::bind_method(D_METHOD("get_scenario"), &World3D::get_scenario);
ClassDB::bind_method(D_METHOD("set_environment", "env"), &World::set_environment); ClassDB::bind_method(D_METHOD("set_environment", "env"), &World3D::set_environment);
ClassDB::bind_method(D_METHOD("get_environment"), &World::get_environment); ClassDB::bind_method(D_METHOD("get_environment"), &World3D::get_environment);
ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World::set_fallback_environment); ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World3D::set_fallback_environment);
ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World::get_fallback_environment); ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World3D::get_fallback_environment);
ClassDB::bind_method(D_METHOD("set_camera_effects", "env"), &World::set_camera_effects); ClassDB::bind_method(D_METHOD("set_camera_effects", "env"), &World3D::set_camera_effects);
ClassDB::bind_method(D_METHOD("get_camera_effects"), &World::get_camera_effects); ClassDB::bind_method(D_METHOD("get_camera_effects"), &World3D::get_camera_effects);
ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World::get_direct_space_state); ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World3D::get_direct_space_state);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_effects", PROPERTY_HINT_RESOURCE_TYPE, "CameraEffects"), "set_camera_effects", "get_camera_effects"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_effects", PROPERTY_HINT_RESOURCE_TYPE, "CameraEffects"), "set_camera_effects", "get_camera_effects");
@ -351,7 +351,7 @@ void World::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state");
} }
World::World() { World3D::World3D() {
space = PhysicsServer::get_singleton()->space_create(); space = PhysicsServer::get_singleton()->space_create();
scenario = VisualServer::get_singleton()->scenario_create(); scenario = VisualServer::get_singleton()->scenario_create();
@ -371,7 +371,7 @@ World::World() {
#endif #endif
} }
World::~World() { World3D::~World3D() {
PhysicsServer::get_singleton()->free(space); PhysicsServer::get_singleton()->free(space);
VisualServer::get_singleton()->free(scenario); VisualServer::get_singleton()->free(scenario);

View file

@ -1,5 +1,5 @@
/*************************************************************************/ /*************************************************************************/
/* world.h */ /* world_3d.h */
/*************************************************************************/ /*************************************************************************/
/* This file is part of: */ /* This file is part of: */
/* GODOT ENGINE */ /* GODOT ENGINE */
@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#ifndef WORLD_H #ifndef WORLD_3D_H
#define WORLD_H #define WORLD_3D_H
#include "core/resource.h" #include "core/resource.h"
#include "scene/resources/environment.h" #include "scene/resources/environment.h"
@ -40,9 +40,8 @@ class Camera3D;
class VisibilityNotifier3D; class VisibilityNotifier3D;
struct SpatialIndexer; struct SpatialIndexer;
class World : public Resource { class World3D : public Resource {
GDCLASS(World, Resource); GDCLASS(World3D, Resource);
RES_BASE_EXTENSION("world");
private: private:
RID space; RID space;
@ -85,8 +84,8 @@ public:
PhysicsDirectSpaceState *get_direct_space_state(); PhysicsDirectSpaceState *get_direct_space_state();
World(); World3D();
~World(); ~World3D();
}; };
#endif // WORLD_H #endif // WORLD_3D_H

View file

@ -37,7 +37,7 @@
#include "core/object.h" #include "core/object.h"
#include "core/rid.h" #include "core/rid.h"
#include "scene/2d/navigation_polygon.h" #include "scene/2d/navigation_region_2d.h"
// This server exposes the 3D `NavigationServer` features in the 2D world. // This server exposes the 3D `NavigationServer` features in the 2D world.
class Navigation2DServer : public Object { class Navigation2DServer : public Object {