Rename more 2D and 3D nodes to follow convention
Rename editor plugins to match the new node names.
|
@ -42,7 +42,7 @@
|
|||
#include "editor/editor_scale.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/plugins/canvas_item_editor_plugin.h"
|
||||
#include "editor/plugins/spatial_editor_plugin.h"
|
||||
#include "editor/plugins/node_3d_editor_plugin.h"
|
||||
#include "editor/property_editor.h"
|
||||
#include "main/performance.h"
|
||||
#include "scene/3d/camera_3d.h"
|
||||
|
|
|
@ -114,32 +114,33 @@
|
|||
#include "editor/plugins/asset_library_editor_plugin.h"
|
||||
#include "editor/plugins/audio_stream_editor_plugin.h"
|
||||
#include "editor/plugins/baked_lightmap_editor_plugin.h"
|
||||
#include "editor/plugins/camera_editor_plugin.h"
|
||||
#include "editor/plugins/camera_3d_editor_plugin.h"
|
||||
#include "editor/plugins/canvas_item_editor_plugin.h"
|
||||
#include "editor/plugins/collision_polygon_2d_editor_plugin.h"
|
||||
#include "editor/plugins/collision_polygon_editor_plugin.h"
|
||||
#include "editor/plugins/collision_polygon_3d_editor_plugin.h"
|
||||
#include "editor/plugins/collision_shape_2d_editor_plugin.h"
|
||||
#include "editor/plugins/cpu_particles_2d_editor_plugin.h"
|
||||
#include "editor/plugins/cpu_particles_editor_plugin.h"
|
||||
#include "editor/plugins/cpu_particles_3d_editor_plugin.h"
|
||||
#include "editor/plugins/curve_editor_plugin.h"
|
||||
#include "editor/plugins/debugger_editor_plugin.h"
|
||||
#include "editor/plugins/editor_preview_plugins.h"
|
||||
#include "editor/plugins/gi_probe_editor_plugin.h"
|
||||
#include "editor/plugins/gpu_particles_2d_editor_plugin.h"
|
||||
#include "editor/plugins/gpu_particles_3d_editor_plugin.h"
|
||||
#include "editor/plugins/gradient_editor_plugin.h"
|
||||
#include "editor/plugins/item_list_editor_plugin.h"
|
||||
#include "editor/plugins/light_occluder_2d_editor_plugin.h"
|
||||
#include "editor/plugins/line_2d_editor_plugin.h"
|
||||
#include "editor/plugins/material_editor_plugin.h"
|
||||
#include "editor/plugins/mesh_editor_plugin.h"
|
||||
#include "editor/plugins/mesh_instance_editor_plugin.h"
|
||||
#include "editor/plugins/mesh_instance_3d_editor_plugin.h"
|
||||
#include "editor/plugins/mesh_library_editor_plugin.h"
|
||||
#include "editor/plugins/multimesh_editor_plugin.h"
|
||||
#include "editor/plugins/navigation_polygon_editor_plugin.h"
|
||||
#include "editor/plugins/particles_2d_editor_plugin.h"
|
||||
#include "editor/plugins/particles_editor_plugin.h"
|
||||
#include "editor/plugins/node_3d_editor_plugin.h"
|
||||
#include "editor/plugins/path_2d_editor_plugin.h"
|
||||
#include "editor/plugins/path_editor_plugin.h"
|
||||
#include "editor/plugins/physical_bone_plugin.h"
|
||||
#include "editor/plugins/path_3d_editor_plugin.h"
|
||||
#include "editor/plugins/physical_bone_3d_editor_plugin.h"
|
||||
#include "editor/plugins/polygon_2d_editor_plugin.h"
|
||||
#include "editor/plugins/resource_preloader_editor_plugin.h"
|
||||
#include "editor/plugins/root_motion_editor_plugin.h"
|
||||
|
@ -147,10 +148,9 @@
|
|||
#include "editor/plugins/script_text_editor.h"
|
||||
#include "editor/plugins/shader_editor_plugin.h"
|
||||
#include "editor/plugins/skeleton_2d_editor_plugin.h"
|
||||
#include "editor/plugins/skeleton_editor_plugin.h"
|
||||
#include "editor/plugins/skeleton_ik_editor_plugin.h"
|
||||
#include "editor/plugins/spatial_editor_plugin.h"
|
||||
#include "editor/plugins/sprite_editor_plugin.h"
|
||||
#include "editor/plugins/skeleton_3d_editor_plugin.h"
|
||||
#include "editor/plugins/skeleton_ik_3d_editor_plugin.h"
|
||||
#include "editor/plugins/sprite_2d_editor_plugin.h"
|
||||
#include "editor/plugins/sprite_frames_editor_plugin.h"
|
||||
#include "editor/plugins/style_box_editor_plugin.h"
|
||||
#include "editor/plugins/text_editor.h"
|
||||
|
@ -6597,18 +6597,19 @@ EditorNode::EditorNode() {
|
|||
add_editor_plugin(memnew(ShaderEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(VisualShaderEditorPlugin(this)));
|
||||
|
||||
add_editor_plugin(memnew(CameraEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(Camera3DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(ThemeEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(MultiMeshEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(MeshInstanceEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(MeshInstance3DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(AnimationTreeEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(MeshLibraryEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(StyleBoxEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(SpriteEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(Sprite2DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(Skeleton2DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(ParticlesEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(GPUParticles2DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(GPUParticles3DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(CPUParticles2DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(CPUParticlesEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(CPUParticles3DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(ResourcePreloaderEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(ItemListEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(Polygon3DEditorPlugin(this)));
|
||||
|
@ -6617,11 +6618,10 @@ EditorNode::EditorNode() {
|
|||
add_editor_plugin(memnew(TileMapEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(SpriteFramesEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(TextureRegionEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(Particles2DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(GIProbeEditorPlugin(this)));
|
||||
// add_editor_plugin(memnew(BakedLightmapEditorPlugin(this)));
|
||||
//add_editor_plugin(memnew(BakedLightmapEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(Path2DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(PathEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(Path3DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(Line2DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(Polygon2DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(LightOccluder2DEditorPlugin(this)));
|
||||
|
@ -6632,9 +6632,9 @@ EditorNode::EditorNode() {
|
|||
add_editor_plugin(memnew(TextureEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(AudioStreamEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor)));
|
||||
add_editor_plugin(memnew(SkeletonEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(SkeletonIKEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(PhysicalBonePlugin(this)));
|
||||
add_editor_plugin(memnew(Skeleton3DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(SkeletonIK3DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(PhysicalBone3DEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(MeshEditorPlugin(this)));
|
||||
add_editor_plugin(memnew(MaterialEditorPlugin(this)));
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "editor_resource_preview.h"
|
||||
#include "main/main.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/gui/popup_menu.h"
|
||||
#include "servers/visual_server.h"
|
||||
|
|
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 558 B After Width: | Height: | Size: 558 B |
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 516 B |
|
@ -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 |
Before Width: | Height: | Size: 511 B After Width: | Height: | Size: 511 B |
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 581 B |
Before Width: | Height: | Size: 244 B After Width: | Height: | Size: 244 B |
|
@ -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 |
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 191 B |
|
@ -36,12 +36,12 @@
|
|||
#include "scene/3d/mesh_instance_3d.h"
|
||||
#include "scene/3d/navigation_3d.h"
|
||||
#include "scene/3d/physics_body_3d.h"
|
||||
#include "scene/3d/vehicle_body.h"
|
||||
#include "scene/3d/vehicle_body_3d.h"
|
||||
#include "scene/animation/animation_player.h"
|
||||
#include "scene/resources/animation.h"
|
||||
#include "scene/resources/box_shape_3d.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/sphere_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();
|
||||
Node3D *s = Object::cast_to<Node3D>(p_node);
|
||||
VehicleBody *bv = memnew(VehicleBody);
|
||||
VehicleBody3D *bv = memnew(VehicleBody3D);
|
||||
String n = _fixstr(p_node->get_name(), "vehicle");
|
||||
bv->set_name(n);
|
||||
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();
|
||||
Node3D *s = Object::cast_to<Node3D>(p_node);
|
||||
VehicleWheel *bv = memnew(VehicleWheel);
|
||||
VehicleWheel3D *bv = memnew(VehicleWheel3D);
|
||||
String n = _fixstr(p_node->get_name(), "wheel");
|
||||
bv->set_name(n);
|
||||
p_node->replace_by(bv);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* spatial_editor_gizmos.cpp */
|
||||
/* node_3d_editor_gizmos.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,7 +28,7 @@
|
|||
/* 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/quick_hull.h"
|
||||
|
@ -50,16 +50,16 @@
|
|||
#include "scene/3d/soft_body_3d.h"
|
||||
#include "scene/3d/spring_arm_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/resources/box_shape_3d.h"
|
||||
#include "scene/resources/capsule_shape_3d.h"
|
||||
#include "scene/resources/concave_polygon_shape_3d.h"
|
||||
#include "scene/resources/convex_polygon_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/ray_shape.h"
|
||||
#include "scene/resources/ray_shape_3d.h"
|
||||
#include "scene/resources/sphere_shape_3d.h"
|
||||
#include "scene/resources/surface_tool.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_handles(handles, get_material("handles"));
|
||||
|
||||
ClippedCamera *clipcam = Object::cast_to<ClippedCamera>(camera);
|
||||
ClippedCamera3D *clipcam = Object::cast_to<ClippedCamera3D>(camera);
|
||||
if (clipcam) {
|
||||
Node3D *parent = Object::cast_to<Node3D>(camera->get_parent());
|
||||
if (!parent) {
|
||||
|
@ -2041,7 +2041,7 @@ VehicleWheelNode3DGizmoPlugin::VehicleWheelNode3DGizmoPlugin() {
|
|||
}
|
||||
|
||||
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 {
|
||||
|
@ -2054,7 +2054,7 @@ int VehicleWheelNode3DGizmoPlugin::get_priority() const {
|
|||
|
||||
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();
|
||||
|
||||
|
@ -3652,9 +3652,9 @@ void CollisionShapeNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
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();
|
||||
p_gizmo->add_mesh(mesh, false, Ref<SkinReference>(), material);
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* spatial_editor_gizmos.h */
|
||||
/* node_3d_editor_gizmos.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -31,7 +31,7 @@
|
|||
#ifndef 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"
|
||||
|
||||
class Camera3D;
|
|
@ -39,7 +39,7 @@
|
|||
#include "editor/editor_scale.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#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 "servers/visual_server.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* camera_editor_plugin.cpp */
|
||||
/* camera_3d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,11 +28,11 @@
|
|||
/* 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) {
|
||||
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;
|
||||
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;
|
||||
|
||||
|
@ -66,7 +66,7 @@ void CameraEditor::edit(Node *p_camera) {
|
|||
}
|
||||
}
|
||||
|
||||
CameraEditor::CameraEditor() {
|
||||
Camera3DEditor::Camera3DEditor() {
|
||||
|
||||
preview = memnew(Button);
|
||||
add_child(preview);
|
||||
|
@ -79,21 +79,21 @@ CameraEditor::CameraEditor() {
|
|||
preview->set_margin(MARGIN_RIGHT, 0);
|
||||
preview->set_margin(MARGIN_TOP, 0);
|
||||
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));
|
||||
//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");
|
||||
}
|
||||
|
||||
void CameraEditorPlugin::make_visible(bool p_visible) {
|
||||
void Camera3DEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
if (p_visible) {
|
||||
//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;
|
||||
/* camera_editor = memnew( CameraEditor );
|
||||
|
@ -120,5 +120,5 @@ CameraEditorPlugin::CameraEditorPlugin(EditorNode *p_node) {
|
|||
*/
|
||||
}
|
||||
|
||||
CameraEditorPlugin::~CameraEditorPlugin() {
|
||||
Camera3DEditorPlugin::~Camera3DEditorPlugin() {
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* camera_editor_plugin.h */
|
||||
/* camera_3d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -35,9 +35,9 @@
|
|||
#include "editor/editor_plugin.h"
|
||||
#include "scene/3d/camera_3d.h"
|
||||
|
||||
class CameraEditor : public Control {
|
||||
class Camera3DEditor : public Control {
|
||||
|
||||
GDCLASS(CameraEditor, Control);
|
||||
GDCLASS(Camera3DEditor, Control);
|
||||
|
||||
Panel *panel;
|
||||
Button *preview;
|
||||
|
@ -51,12 +51,12 @@ protected:
|
|||
|
||||
public:
|
||||
void edit(Node *p_camera);
|
||||
CameraEditor();
|
||||
Camera3DEditor();
|
||||
};
|
||||
|
||||
class CameraEditorPlugin : public EditorPlugin {
|
||||
class Camera3DEditorPlugin : public EditorPlugin {
|
||||
|
||||
GDCLASS(CameraEditorPlugin, EditorPlugin);
|
||||
GDCLASS(Camera3DEditorPlugin, EditorPlugin);
|
||||
|
||||
//CameraEditor *camera_editor;
|
||||
EditorNode *editor;
|
||||
|
@ -68,8 +68,8 @@ public:
|
|||
virtual bool handles(Object *p_object) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
|
||||
CameraEditorPlugin(EditorNode *p_node);
|
||||
~CameraEditorPlugin();
|
||||
Camera3DEditorPlugin(EditorNode *p_node);
|
||||
~Camera3DEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // CAMERA_EDITOR_PLUGIN_H
|
|
@ -40,8 +40,8 @@
|
|||
#include "editor/editor_settings.h"
|
||||
#include "editor/plugins/animation_player_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/particles_2d.h"
|
||||
#include "scene/2d/polygon_2d.h"
|
||||
#include "scene/2d/skeleton_2d.h"
|
||||
#include "scene/2d/sprite_2d.h"
|
||||
|
@ -6083,8 +6083,8 @@ void CanvasItemEditorViewport::_perform_drop_data() {
|
|||
Node *child;
|
||||
if (default_type == "Light2D")
|
||||
child = memnew(Light2D);
|
||||
else if (default_type == "Particles2D")
|
||||
child = memnew(Particles2D);
|
||||
else if (default_type == "GPUParticles2D")
|
||||
child = memnew(GPUParticles2D);
|
||||
else if (default_type == "Polygon2D")
|
||||
child = memnew(Polygon2D);
|
||||
else if (default_type == "TouchScreenButton")
|
||||
|
@ -6247,11 +6247,11 @@ void CanvasItemEditorViewport::_bind_methods() {
|
|||
}
|
||||
|
||||
CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasItemEditor *p_canvas_item_editor) {
|
||||
default_type = "Sprite";
|
||||
default_type = "Sprite2D";
|
||||
// Node2D
|
||||
types.push_back("Sprite");
|
||||
types.push_back("Sprite2D");
|
||||
types.push_back("Light2D");
|
||||
types.push_back("Particles2D");
|
||||
types.push_back("GPUParticles2D");
|
||||
types.push_back("Polygon2D");
|
||||
types.push_back("TouchScreenButton");
|
||||
// Control
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_plugin.h"
|
||||
#include "scene/2d/canvas_item.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "scene/gui/check_box.h"
|
||||
#include "scene/gui/label.h"
|
||||
#include "scene/gui/panel_container.h"
|
||||
#include "scene/gui/spin_box.h"
|
||||
#include "scene/main/canvas_item.h"
|
||||
|
||||
class CanvasItemEditorViewport;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* collision_polygon_editor_plugin.cpp */
|
||||
/* collision_polygon_3d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,17 +28,17 @@
|
|||
/* 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 "core/input/input_filter.h"
|
||||
#include "core/os/file_access.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "node_3d_editor_plugin.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) {
|
||||
|
||||
|
@ -47,7 +47,7 @@ void Polygon3DEditor::_notification(int p_what) {
|
|||
button_create->set_icon(get_theme_icon("Edit", "EditorIcons"));
|
||||
button_edit->set_icon(get_theme_icon("MovePoint", "EditorIcons"));
|
||||
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;
|
||||
case NOTIFICATION_PROCESS: {
|
||||
|
@ -63,7 +63,7 @@ void Polygon3DEditor::_notification(int p_what) {
|
|||
} break;
|
||||
}
|
||||
}
|
||||
void Polygon3DEditor::_node_removed(Node *p_node) {
|
||||
void CollisionPolygon3DEditor::_node_removed(Node *p_node) {
|
||||
|
||||
if (p_node == node) {
|
||||
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) {
|
||||
|
||||
|
@ -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->add_undo_method(node, "set_polygon", node->call("get_polygon"));
|
||||
|
@ -109,7 +109,7 @@ void Polygon3DEditor::_wip_close() {
|
|||
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)
|
||||
return false;
|
||||
|
@ -360,7 +360,7 @@ bool Polygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, const Ref<In
|
|||
return false;
|
||||
}
|
||||
|
||||
float Polygon3DEditor::_get_depth() {
|
||||
float CollisionPolygon3DEditor::_get_depth() {
|
||||
|
||||
if (bool(node->call("_has_editable_3d_polygon_no_depth")))
|
||||
return 0;
|
||||
|
@ -368,7 +368,7 @@ float Polygon3DEditor::_get_depth() {
|
|||
return float(node->call("get_depth"));
|
||||
}
|
||||
|
||||
void Polygon3DEditor::_polygon_draw() {
|
||||
void CollisionPolygon3DEditor::_polygon_draw() {
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
@ -489,7 +489,7 @@ void Polygon3DEditor::_polygon_draw() {
|
|||
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) {
|
||||
|
||||
|
@ -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;
|
||||
editor = p_editor;
|
||||
|
@ -530,12 +530,12 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
|
|||
add_child(memnew(VSeparator));
|
||||
button_create = memnew(ToolButton);
|
||||
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_edit = memnew(ToolButton);
|
||||
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);
|
||||
|
||||
mode = MODE_EDIT;
|
||||
|
@ -569,7 +569,7 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
|
|||
snap_ignore = false;
|
||||
}
|
||||
|
||||
Polygon3DEditor::~Polygon3DEditor() {
|
||||
CollisionPolygon3DEditor::~CollisionPolygon3DEditor() {
|
||||
|
||||
memdelete(imgeom);
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ void Polygon3DEditorPlugin::make_visible(bool p_visible) {
|
|||
Polygon3DEditorPlugin::Polygon3DEditorPlugin(EditorNode *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);
|
||||
|
||||
collision_polygon_editor->hide();
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* collision_polygon_editor_plugin.h */
|
||||
/* collision_polygon_3d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -40,9 +40,9 @@
|
|||
|
||||
class CanvasItemEditor;
|
||||
|
||||
class Polygon3DEditor : public HBoxContainer {
|
||||
class CollisionPolygon3DEditor : public HBoxContainer {
|
||||
|
||||
GDCLASS(Polygon3DEditor, HBoxContainer);
|
||||
GDCLASS(CollisionPolygon3DEditor, HBoxContainer);
|
||||
|
||||
UndoRedo *undo_redo;
|
||||
enum Mode {
|
||||
|
@ -92,15 +92,15 @@ protected:
|
|||
public:
|
||||
virtual bool forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event);
|
||||
void edit(Node *p_collision_polygon);
|
||||
Polygon3DEditor(EditorNode *p_editor);
|
||||
~Polygon3DEditor();
|
||||
CollisionPolygon3DEditor(EditorNode *p_editor);
|
||||
~CollisionPolygon3DEditor();
|
||||
};
|
||||
|
||||
class Polygon3DEditorPlugin : public EditorPlugin {
|
||||
|
||||
GDCLASS(Polygon3DEditorPlugin, EditorPlugin);
|
||||
|
||||
Polygon3DEditor *collision_polygon_editor;
|
||||
CollisionPolygon3DEditor *collision_polygon_editor;
|
||||
EditorNode *editor;
|
||||
|
||||
public:
|
|
@ -241,7 +241,7 @@ void CPUParticles2DEditorPlugin::_notification(int p_what) {
|
|||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -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_separator();
|
||||
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("Particles"));
|
||||
menu->set_text(TTR("CPUParticles2D"));
|
||||
menu->set_switch_on_hover(true);
|
||||
toolbar->add_child(menu);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* cpu_particles_editor_plugin.cpp */
|
||||
/* cpu_particles_3d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,11 +28,11 @@
|
|||
/* 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) {
|
||||
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) {
|
||||
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) {
|
||||
|
||||
|
@ -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;
|
||||
node = p_particles;
|
||||
}
|
||||
|
||||
void CPUParticlesEditor::_generate_emission_points() {
|
||||
void CPUParticles3DEditor::_generate_emission_points() {
|
||||
|
||||
/// hacer codigo aca
|
||||
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);
|
||||
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->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_separator();
|
||||
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));
|
||||
}
|
||||
|
||||
bool CPUParticlesEditorPlugin::handles(Object *p_object) const {
|
||||
bool CPUParticles3DEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
return p_object->is_class("CPUParticles3D");
|
||||
}
|
||||
|
||||
void CPUParticlesEditorPlugin::make_visible(bool p_visible) {
|
||||
void CPUParticles3DEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
if (p_visible) {
|
||||
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;
|
||||
particles_editor = memnew(CPUParticlesEditor);
|
||||
particles_editor = memnew(CPUParticles3DEditor);
|
||||
editor->get_viewport()->add_child(particles_editor);
|
||||
|
||||
particles_editor->hide();
|
||||
}
|
||||
|
||||
CPUParticlesEditorPlugin::~CPUParticlesEditorPlugin() {
|
||||
CPUParticles3DEditorPlugin::~CPUParticles3DEditorPlugin() {
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* cpu_particles_editor_plugin.h */
|
||||
/* cpu_particles_3d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -31,12 +31,12 @@
|
|||
#ifndef 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"
|
||||
|
||||
class CPUParticlesEditor : public ParticlesEditorBase {
|
||||
class CPUParticles3DEditor : public GPUParticles3DEditorBase {
|
||||
|
||||
GDCLASS(CPUParticlesEditor, ParticlesEditorBase);
|
||||
GDCLASS(CPUParticles3DEditor, GPUParticles3DEditorBase);
|
||||
|
||||
enum Menu {
|
||||
|
||||
|
@ -50,7 +50,7 @@ class CPUParticlesEditor : public ParticlesEditorBase {
|
|||
|
||||
void _menu_option(int);
|
||||
|
||||
friend class CPUParticlesEditorPlugin;
|
||||
friend class CPUParticles3DEditorPlugin;
|
||||
|
||||
virtual void _generate_emission_points();
|
||||
|
||||
|
@ -61,14 +61,14 @@ protected:
|
|||
|
||||
public:
|
||||
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;
|
||||
|
||||
public:
|
||||
|
@ -78,8 +78,8 @@ public:
|
|||
virtual bool handles(Object *p_object) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
|
||||
CPUParticlesEditorPlugin(EditorNode *p_node);
|
||||
~CPUParticlesEditorPlugin();
|
||||
CPUParticles3DEditorPlugin(EditorNode *p_node);
|
||||
~CPUParticles3DEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // CPU_PARTICLES_EDITOR_PLUGIN_H
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* particles_2d_editor_plugin.cpp */
|
||||
/* gpu_particles_2d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,7 +28,7 @@
|
|||
/* 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 "core/io/image_loader.h"
|
||||
|
@ -36,17 +36,17 @@
|
|||
#include "scene/gui/separator.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");
|
||||
}
|
||||
|
||||
void Particles2DEditorPlugin::make_visible(bool p_visible) {
|
||||
void GPUParticles2DEditorPlugin::make_visible(bool 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;
|
||||
emission_mask->popup_centered();
|
||||
}
|
||||
|
||||
void Particles2DEditorPlugin::_menu_callback(int p_idx) {
|
||||
void GPUParticles2DEditorPlugin::_menu_callback(int p_idx) {
|
||||
|
||||
switch (p_idx) {
|
||||
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());
|
||||
|
||||
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_reference(cpu_particles);
|
||||
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();
|
||||
|
||||
|
@ -149,7 +149,7 @@ void Particles2DEditorPlugin::_generate_visibility_rect() {
|
|||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
void Particles2DEditorPlugin::_generate_emission_mask() {
|
||||
void GPUParticles2DEditorPlugin::_generate_emission_mask() {
|
||||
|
||||
Ref<ParticlesMaterial> pm = particles->get_process_material();
|
||||
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) {
|
||||
|
||||
menu->get_popup()->connect("id_pressed", callable_mp(this, &Particles2DEditorPlugin::_menu_callback));
|
||||
menu->set_icon(menu->get_theme_icon("Particles2D", "EditorIcons"));
|
||||
file->connect("file_selected", callable_mp(this, &Particles2DEditorPlugin::_file_selected));
|
||||
menu->get_popup()->connect("id_pressed", callable_mp(this, &GPUParticles2DEditorPlugin::_menu_callback));
|
||||
menu->set_icon(menu->get_theme_icon("GPUParticles2D", "EditorIcons"));
|
||||
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;
|
||||
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("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK);
|
||||
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_item(TTR("Restart"), MENU_RESTART);
|
||||
menu->set_text(TTR("Particles"));
|
||||
menu->set_text(TTR("GPUParticles2D"));
|
||||
menu->set_switch_on_hover(true);
|
||||
toolbar->add_child(menu);
|
||||
|
||||
|
@ -411,7 +411,7 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
|
|||
|
||||
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->set_title(TTR("Load Emission Mask"));
|
||||
|
@ -428,8 +428,8 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
|
|||
|
||||
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() {
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* particles_2d_editor_plugin.h */
|
||||
/* gpu_particles_2d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -34,13 +34,13 @@
|
|||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_plugin.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/file_dialog.h"
|
||||
|
||||
class Particles2DEditorPlugin : public EditorPlugin {
|
||||
class GPUParticles2DEditorPlugin : public EditorPlugin {
|
||||
|
||||
GDCLASS(Particles2DEditorPlugin, EditorPlugin);
|
||||
GDCLASS(GPUParticles2DEditorPlugin, EditorPlugin);
|
||||
|
||||
enum {
|
||||
|
||||
|
@ -57,7 +57,7 @@ class Particles2DEditorPlugin : public EditorPlugin {
|
|||
EMISSION_MODE_BORDER_DIRECTED
|
||||
};
|
||||
|
||||
Particles2D *particles;
|
||||
GPUParticles2D *particles;
|
||||
|
||||
EditorFileDialog *file;
|
||||
EditorNode *editor;
|
||||
|
@ -93,8 +93,8 @@ public:
|
|||
virtual bool handles(Object *p_object) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
|
||||
Particles2DEditorPlugin(EditorNode *p_node);
|
||||
~Particles2DEditorPlugin();
|
||||
GPUParticles2DEditorPlugin(EditorNode *p_node);
|
||||
~GPUParticles2DEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // PARTICLES_2D_EDITOR_PLUGIN_H
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* particles_editor_plugin.cpp */
|
||||
/* gpu_particles_3d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,14 +28,14 @@
|
|||
/* 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 "editor/plugins/spatial_editor_plugin.h"
|
||||
#include "editor/plugins/node_3d_editor_plugin.h"
|
||||
#include "scene/3d/cpu_particles_3d.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;
|
||||
|
||||
|
@ -161,7 +161,7 @@ bool ParticlesEditorBase::_generate(Vector<Vector3> &points, Vector<Vector3> &no
|
|||
return true;
|
||||
}
|
||||
|
||||
void ParticlesEditorBase::_node_selected(const NodePath &p_path) {
|
||||
void GPUParticles3DEditorBase::_node_selected(const NodePath &p_path) {
|
||||
|
||||
Node *sel = get_node(p_path);
|
||||
if (!sel)
|
||||
|
@ -202,10 +202,10 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) {
|
|||
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->set_title(TTR("Create Emitter"));
|
||||
|
@ -226,14 +226,14 @@ ParticlesEditorBase::ParticlesEditorBase() {
|
|||
emd_vb->add_margin_child(TTR("Emission Source: "), emission_fill);
|
||||
|
||||
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);
|
||||
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) {
|
||||
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) {
|
||||
options->set_icon(options->get_popup()->get_theme_icon("Particles", "EditorIcons"));
|
||||
get_tree()->connect("node_removed", callable_mp(this, &ParticlesEditor::_node_removed));
|
||||
options->set_icon(options->get_popup()->get_theme_icon("GPUParticles3D", "EditorIcons"));
|
||||
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) {
|
||||
|
||||
|
@ -282,7 +282,7 @@ void ParticlesEditor::_menu_option(int p_option) {
|
|||
cpu_particles->set_pause_mode(node->get_pause_mode());
|
||||
|
||||
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_reference(cpu_particles);
|
||||
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();
|
||||
|
||||
|
@ -340,13 +340,13 @@ void ParticlesEditor::_generate_aabb() {
|
|||
ur->commit_action();
|
||||
}
|
||||
|
||||
void ParticlesEditor::edit(GPUParticles3D *p_particles) {
|
||||
void GPUParticles3DEditor::edit(GPUParticles3D *p_particles) {
|
||||
|
||||
base_node = p_particles;
|
||||
node = p_particles;
|
||||
}
|
||||
|
||||
void ParticlesEditor::_generate_emission_points() {
|
||||
void GPUParticles3DEditor::_generate_emission_points() {
|
||||
|
||||
/// hacer codigo aca
|
||||
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;
|
||||
particles_editor_hb = memnew(HBoxContainer);
|
||||
|
@ -432,16 +432,16 @@ ParticlesEditor::ParticlesEditor() {
|
|||
particles_editor_hb->add_child(options);
|
||||
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_separator();
|
||||
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_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_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->set_title(TTR("Generate Visibility AABB"));
|
||||
|
@ -455,20 +455,20 @@ ParticlesEditor::ParticlesEditor() {
|
|||
|
||||
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));
|
||||
}
|
||||
|
||||
bool ParticlesEditorPlugin::handles(Object *p_object) const {
|
||||
bool GPUParticles3DEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
return p_object->is_class("GPUParticles3D");
|
||||
}
|
||||
|
||||
void ParticlesEditorPlugin::make_visible(bool p_visible) {
|
||||
void GPUParticles3DEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
if (p_visible) {
|
||||
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;
|
||||
particles_editor = memnew(ParticlesEditor);
|
||||
particles_editor = memnew(GPUParticles3DEditor);
|
||||
editor->get_viewport()->add_child(particles_editor);
|
||||
|
||||
particles_editor->hide();
|
||||
}
|
||||
|
||||
ParticlesEditorPlugin::~ParticlesEditorPlugin() {
|
||||
GPUParticles3DEditorPlugin::~GPUParticles3DEditorPlugin() {
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* particles_editor_plugin.h */
|
||||
/* gpu_particles_3d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -36,9 +36,9 @@
|
|||
#include "scene/3d/gpu_particles_3d.h"
|
||||
#include "scene/gui/spin_box.h"
|
||||
|
||||
class ParticlesEditorBase : public Control {
|
||||
class GPUParticles3DEditorBase : public Control {
|
||||
|
||||
GDCLASS(ParticlesEditorBase, Control);
|
||||
GDCLASS(GPUParticles3DEditorBase, Control);
|
||||
|
||||
protected:
|
||||
Node3D *base_node;
|
||||
|
@ -61,12 +61,12 @@ protected:
|
|||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
ParticlesEditorBase();
|
||||
GPUParticles3DEditorBase();
|
||||
};
|
||||
|
||||
class ParticlesEditor : public ParticlesEditorBase {
|
||||
class GPUParticles3DEditor : public GPUParticles3DEditorBase {
|
||||
|
||||
GDCLASS(ParticlesEditor, ParticlesEditorBase);
|
||||
GDCLASS(GPUParticles3DEditor, GPUParticles3DEditorBase);
|
||||
|
||||
ConfirmationDialog *generate_aabb;
|
||||
SpinBox *generate_seconds;
|
||||
|
@ -86,7 +86,7 @@ class ParticlesEditor : public ParticlesEditorBase {
|
|||
|
||||
void _menu_option(int);
|
||||
|
||||
friend class ParticlesEditorPlugin;
|
||||
friend class GPUParticles3DEditorPlugin;
|
||||
|
||||
virtual void _generate_emission_points();
|
||||
|
||||
|
@ -97,14 +97,14 @@ protected:
|
|||
|
||||
public:
|
||||
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;
|
||||
|
||||
public:
|
||||
|
@ -114,8 +114,8 @@ public:
|
|||
virtual bool handles(Object *p_object) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
|
||||
ParticlesEditorPlugin(EditorNode *p_node);
|
||||
~ParticlesEditorPlugin();
|
||||
GPUParticles3DEditorPlugin(EditorNode *p_node);
|
||||
~GPUParticles3DEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // PARTICLES_EDITOR_PLUGIN_H
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "canvas_item_editor_plugin.h"
|
||||
#include "editor/editor_scale.h"
|
||||
#include "spatial_editor_plugin.h"
|
||||
#include "node_3d_editor_plugin.h"
|
||||
|
||||
Size2 GradientEditor::get_minimum_size() const {
|
||||
return Size2(0, 60) * EDSCALE;
|
||||
|
|
|
@ -115,7 +115,7 @@ MaterialEditor::MaterialEditor() {
|
|||
add_child(vc);
|
||||
vc->set_anchors_and_margins_preset(PRESET_WIDE);
|
||||
viewport = memnew(SubViewport);
|
||||
Ref<World> world;
|
||||
Ref<World3D> world;
|
||||
world.instance();
|
||||
viewport->set_world(world); //use own world
|
||||
vc->add_child(viewport);
|
||||
|
|
|
@ -116,7 +116,7 @@ void MeshEditor::_bind_methods() {
|
|||
MeshEditor::MeshEditor() {
|
||||
|
||||
viewport = memnew(SubViewport);
|
||||
Ref<World> world;
|
||||
Ref<World3D> world;
|
||||
world.instance();
|
||||
viewport->set_world(world); //use own world
|
||||
add_child(viewport);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* mesh_instance_editor_plugin.cpp */
|
||||
/* mesh_instance_3d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,16 +28,16 @@
|
|||
/* 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 "node_3d_editor_plugin.h"
|
||||
#include "scene/3d/collision_shape_3d.h"
|
||||
#include "scene/3d/navigation_region_3d.h"
|
||||
#include "scene/3d/physics_body_3d.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "spatial_editor_plugin.h"
|
||||
|
||||
void MeshInstanceEditor::_node_removed(Node *p_node) {
|
||||
void MeshInstance3DEditor::_node_removed(Node *p_node) {
|
||||
|
||||
if (p_node == node) {
|
||||
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;
|
||||
}
|
||||
|
||||
void MeshInstanceEditor::_menu_option(int p_option) {
|
||||
void MeshInstance3DEditor::_menu_option(int p_option) {
|
||||
|
||||
Ref<Mesh> mesh = node->get_mesh();
|
||||
if (mesh.is_null()) {
|
||||
|
@ -291,20 +291,20 @@ void MeshInstanceEditor::_menu_option(int p_option) {
|
|||
}
|
||||
}
|
||||
|
||||
struct MeshInstanceEditorEdgeSort {
|
||||
struct MeshInstance3DEditorEdgeSort {
|
||||
|
||||
Vector2 a;
|
||||
Vector2 b;
|
||||
|
||||
bool operator<(const MeshInstanceEditorEdgeSort &p_b) const {
|
||||
bool operator<(const MeshInstance3DEditorEdgeSort &p_b) const {
|
||||
if (a == p_b.a)
|
||||
return b < p_b.b;
|
||||
else
|
||||
return a < p_b.a;
|
||||
}
|
||||
|
||||
MeshInstanceEditorEdgeSort() {}
|
||||
MeshInstanceEditorEdgeSort(const Vector2 &p_a, const Vector2 &p_b) {
|
||||
MeshInstance3DEditorEdgeSort() {}
|
||||
MeshInstance3DEditorEdgeSort(const Vector2 &p_a, const Vector2 &p_b) {
|
||||
if (p_a < p_b) {
|
||||
a = p_a;
|
||||
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();
|
||||
ERR_FAIL_COND(!mesh.is_valid());
|
||||
|
||||
Set<MeshInstanceEditorEdgeSort> edges;
|
||||
Set<MeshInstance3DEditorEdgeSort> edges;
|
||||
uv_lines.clear();
|
||||
for (int i = 0; i < mesh->get_surface_count(); i++) {
|
||||
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++) {
|
||||
|
||||
MeshInstanceEditorEdgeSort edge;
|
||||
MeshInstance3DEditorEdgeSort edge;
|
||||
if (use_indices) {
|
||||
edge.a = r[ri[j + k]];
|
||||
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();
|
||||
}
|
||||
|
||||
void MeshInstanceEditor::_debug_uv_draw() {
|
||||
void MeshInstance3DEditor::_debug_uv_draw() {
|
||||
|
||||
if (uv_lines.size() == 0)
|
||||
return;
|
||||
|
@ -388,7 +388,7 @@ void MeshInstanceEditor::_debug_uv_draw() {
|
|||
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();
|
||||
if (mesh.is_null()) {
|
||||
|
@ -434,10 +434,10 @@ void MeshInstanceEditor::_create_outline_mesh() {
|
|||
ur->commit_action();
|
||||
}
|
||||
|
||||
void MeshInstanceEditor::_bind_methods() {
|
||||
void MeshInstance3DEditor::_bind_methods() {
|
||||
}
|
||||
|
||||
MeshInstanceEditor::MeshInstanceEditor() {
|
||||
MeshInstance3DEditor::MeshInstance3DEditor() {
|
||||
|
||||
options = memnew(MenuButton);
|
||||
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("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->set_title(TTR("Create Outline Mesh"));
|
||||
|
@ -483,7 +483,7 @@ MeshInstanceEditor::MeshInstanceEditor() {
|
|||
outline_dialog_vbc->add_margin_child(TTR("Outline Size:"), outline_size);
|
||||
|
||||
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);
|
||||
add_child(err_dialog);
|
||||
|
@ -493,21 +493,21 @@ MeshInstanceEditor::MeshInstanceEditor() {
|
|||
add_child(debug_uv_dialog);
|
||||
debug_uv = memnew(Control);
|
||||
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);
|
||||
}
|
||||
|
||||
void MeshInstanceEditorPlugin::edit(Object *p_object) {
|
||||
void MeshInstance3DEditorPlugin::edit(Object *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");
|
||||
}
|
||||
|
||||
void MeshInstanceEditorPlugin::make_visible(bool p_visible) {
|
||||
void MeshInstance3DEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
if (p_visible) {
|
||||
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;
|
||||
mesh_editor = memnew(MeshInstanceEditor);
|
||||
mesh_editor = memnew(MeshInstance3DEditor);
|
||||
editor->get_viewport()->add_child(mesh_editor);
|
||||
|
||||
mesh_editor->options->hide();
|
||||
}
|
||||
|
||||
MeshInstanceEditorPlugin::~MeshInstanceEditorPlugin() {
|
||||
MeshInstance3DEditorPlugin::~MeshInstance3DEditorPlugin() {
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* mesh_instance_editor_plugin.h */
|
||||
/* mesh_instance_3d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -36,9 +36,9 @@
|
|||
#include "scene/3d/mesh_instance_3d.h"
|
||||
#include "scene/gui/spin_box.h"
|
||||
|
||||
class MeshInstanceEditor : public Control {
|
||||
class MeshInstance3DEditor : public Control {
|
||||
|
||||
GDCLASS(MeshInstanceEditor, Control);
|
||||
GDCLASS(MeshInstance3DEditor, Control);
|
||||
|
||||
enum Menu {
|
||||
|
||||
|
@ -70,7 +70,7 @@ class MeshInstanceEditor : public Control {
|
|||
void _create_outline_mesh();
|
||||
|
||||
void _create_uv_lines(int p_layer);
|
||||
friend class MeshInstanceEditorPlugin;
|
||||
friend class MeshInstance3DEditorPlugin;
|
||||
|
||||
void _debug_uv_draw();
|
||||
|
||||
|
@ -80,14 +80,14 @@ protected:
|
|||
|
||||
public:
|
||||
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;
|
||||
|
||||
public:
|
||||
|
@ -97,8 +97,8 @@ public:
|
|||
virtual bool handles(Object *p_object) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
|
||||
MeshInstanceEditorPlugin(EditorNode *p_node);
|
||||
~MeshInstanceEditorPlugin();
|
||||
MeshInstance3DEditorPlugin(EditorNode *p_node);
|
||||
~MeshInstance3DEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // MESH_EDITOR_PLUGIN_H
|
|
@ -33,12 +33,12 @@
|
|||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "main/main.h"
|
||||
#include "node_3d_editor_plugin.h"
|
||||
#include "scene/3d/mesh_instance_3d.h"
|
||||
#include "scene/3d/navigation_region_3d.h"
|
||||
#include "scene/3d/physics_body_3d.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "spatial_editor_plugin.h"
|
||||
|
||||
void MeshLibraryEditor::edit(const Ref<MeshLibrary> &p_mesh_library) {
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
|
||||
#include "multimesh_editor_plugin.h"
|
||||
|
||||
#include "node_3d_editor_plugin.h"
|
||||
#include "scene/3d/mesh_instance_3d.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "spatial_editor_plugin.h"
|
||||
|
||||
void MultiMeshEditor::_node_removed(Node *p_node) {
|
||||
|
||||
|
@ -287,7 +287,7 @@ MultiMeshEditor::MultiMeshEditor() {
|
|||
Node3DEditor::get_singleton()->add_control_to_menu_panel(options);
|
||||
|
||||
options->set_text("MultiMesh");
|
||||
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MultiMeshInstance", "EditorIcons"));
|
||||
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()->connect("id_pressed", callable_mp(this, &MultiMeshEditor::_menu_option));
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#define NAVIGATIONPOLYGONEDITORPLUGIN_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 {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* spatial_editor_plugin.cpp */
|
||||
/* node_3d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,7 +28,7 @@
|
|||
/* 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/math/camera_matrix.h"
|
||||
|
@ -40,9 +40,9 @@
|
|||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_scale.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/node_3d_editor_gizmos.h"
|
||||
#include "editor/plugins/animation_player_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/collision_shape_3d.h"
|
||||
#include "scene/3d/mesh_instance_3d.h"
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* spatial_editor_plugin.h */
|
||||
/* node_3d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* path_editor_plugin.cpp */
|
||||
/* path_3d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,11 +28,11 @@
|
|||
/* 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 "node_3d_editor_plugin.h"
|
||||
#include "scene/resources/curve.h"
|
||||
#include "spatial_editor_plugin.h"
|
||||
|
||||
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
|
||||
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_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;
|
||||
|
@ -144,12 +144,12 @@ void PathNode3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_
|
|||
|
||||
if (t == 0) {
|
||||
c->set_point_in(idx, local);
|
||||
if (PathEditorPlugin::singleton->mirror_angle_enabled())
|
||||
c->set_point_out(idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -local : (-local.normalized() * orig_out_length));
|
||||
if (Path3DEditorPlugin::singleton->mirror_angle_enabled())
|
||||
c->set_point_out(idx, Path3DEditorPlugin::singleton->mirror_length_enabled() ? -local : (-local.normalized() * orig_out_length));
|
||||
} else {
|
||||
c->set_point_out(idx, local);
|
||||
if (PathEditorPlugin::singleton->mirror_angle_enabled())
|
||||
c->set_point_in(idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -local : (-local.normalized() * orig_in_length));
|
||||
if (Path3DEditorPlugin::singleton->mirror_angle_enabled())
|
||||
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_undo_method(c.ptr(), "set_point_in", idx, p_restore);
|
||||
|
||||
if (PathEditorPlugin::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_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));
|
||||
if (Path3DEditorPlugin::singleton->mirror_angle_enabled()) {
|
||||
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, Path3DEditorPlugin::singleton->mirror_length_enabled() ? -static_cast<Vector3>(p_restore) : (-static_cast<Vector3>(p_restore).normalized() * orig_out_length));
|
||||
}
|
||||
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_undo_method(c.ptr(), "set_point_out", idx, p_restore);
|
||||
|
||||
if (PathEditorPlugin::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_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));
|
||||
if (Path3DEditorPlugin::singleton->mirror_angle_enabled()) {
|
||||
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, Path3DEditorPlugin::singleton->mirror_length_enabled() ? -static_cast<Vector3>(p_restore) : (-static_cast<Vector3>(p_restore).normalized() * orig_in_length));
|
||||
}
|
||||
ur->commit_action();
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ void PathNode3DGizmo::redraw() {
|
|||
add_collision_segments(v3p);
|
||||
}
|
||||
|
||||
if (PathEditorPlugin::singleton->get_edited_path() == path) {
|
||||
if (Path3DEditorPlugin::singleton->get_edited_path() == path) {
|
||||
v3p.clear();
|
||||
Vector<Vector3> handles;
|
||||
Vector<Vector3> sec_handles;
|
||||
|
@ -292,7 +292,7 @@ PathNode3DGizmo::PathNode3DGizmo(Path3D *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)
|
||||
return false;
|
||||
|
@ -448,7 +448,7 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref<I
|
|||
return false;
|
||||
}
|
||||
|
||||
void PathEditorPlugin::edit(Object *p_object) {
|
||||
void Path3DEditorPlugin::edit(Object *p_object) {
|
||||
|
||||
if (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));
|
||||
}
|
||||
|
||||
bool PathEditorPlugin::handles(Object *p_object) const {
|
||||
bool Path3DEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
return p_object->is_class("Path3D");
|
||||
}
|
||||
|
||||
void PathEditorPlugin::make_visible(bool p_visible) {
|
||||
void Path3DEditorPlugin::make_visible(bool 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_edit->set_pressed(p_idx == 1);
|
||||
curve_del->set_pressed(p_idx == 2);
|
||||
}
|
||||
|
||||
void PathEditorPlugin::_close_curve() {
|
||||
void Path3DEditorPlugin::_close_curve() {
|
||||
|
||||
Ref<Curve3D> c = path->get_curve();
|
||||
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));
|
||||
}
|
||||
|
||||
void PathEditorPlugin::_handle_option_pressed(int p_option) {
|
||||
void Path3DEditorPlugin::_handle_option_pressed(int p_option) {
|
||||
|
||||
PopupMenu *pm;
|
||||
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) {
|
||||
|
||||
curve_create->connect("pressed", callable_mp(this, &PathEditorPlugin::_mode_changed), make_binds(0));
|
||||
curve_edit->connect("pressed", callable_mp(this, &PathEditorPlugin::_mode_changed), make_binds(1));
|
||||
curve_del->connect("pressed", callable_mp(this, &PathEditorPlugin::_mode_changed), make_binds(2));
|
||||
curve_close->connect("pressed", callable_mp(this, &PathEditorPlugin::_close_curve));
|
||||
curve_create->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(0));
|
||||
curve_edit->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(1));
|
||||
curve_del->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(2));
|
||||
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;
|
||||
editor = p_node;
|
||||
|
@ -610,7 +610,7 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
|
|||
menu->set_item_checked(HANDLE_OPTION_ANGLE, mirror_handle_angle);
|
||||
menu->add_check_item(TTR("Mirror Handle Lengths"));
|
||||
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);
|
||||
/*
|
||||
|
@ -624,7 +624,7 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
|
|||
*/
|
||||
}
|
||||
|
||||
PathEditorPlugin::~PathEditorPlugin() {
|
||||
Path3DEditorPlugin::~Path3DEditorPlugin() {
|
||||
}
|
||||
|
||||
Ref<EditorNode3DGizmo> PathNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) {
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* path_editor_plugin.h */
|
||||
/* path_3d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -31,7 +31,7 @@
|
|||
#ifndef 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"
|
||||
|
||||
class PathNode3DGizmo : public EditorNode3DGizmo {
|
||||
|
@ -66,9 +66,9 @@ public:
|
|||
PathNode3DGizmoPlugin();
|
||||
};
|
||||
|
||||
class PathEditorPlugin : public EditorPlugin {
|
||||
class Path3DEditorPlugin : public EditorPlugin {
|
||||
|
||||
GDCLASS(PathEditorPlugin, EditorPlugin);
|
||||
GDCLASS(Path3DEditorPlugin, EditorPlugin);
|
||||
|
||||
Separator *sep;
|
||||
ToolButton *curve_create;
|
||||
|
@ -100,7 +100,7 @@ protected:
|
|||
public:
|
||||
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_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; }
|
||||
void set_handle_clicked(bool clicked) { handle_clicked = clicked; }
|
||||
|
||||
PathEditorPlugin(EditorNode *p_node);
|
||||
~PathEditorPlugin();
|
||||
Path3DEditorPlugin(EditorNode *p_node);
|
||||
~Path3DEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // PATH_EDITOR_PLUGIN_H
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* physical_bone_plugin.cpp */
|
||||
/* physical_bone_3d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,25 +28,26 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "physical_bone_plugin.h"
|
||||
#include "editor/plugins/spatial_editor_plugin.h"
|
||||
#include "physical_bone_3d_editor_plugin.h"
|
||||
|
||||
#include "editor/plugins/node_3d_editor_plugin.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();
|
||||
}
|
||||
|
||||
void PhysicalBoneEditor::_set_move_joint() {
|
||||
void PhysicalBone3DEditor::_set_move_joint() {
|
||||
if (selected) {
|
||||
selected->_set_gizmo_move_joint(button_transform_joint->is_pressed());
|
||||
}
|
||||
}
|
||||
|
||||
PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) :
|
||||
PhysicalBone3DEditor::PhysicalBone3DEditor(EditorNode *p_editor) :
|
||||
editor(p_editor),
|
||||
selected(NULL) {
|
||||
|
||||
|
@ -61,16 +62,16 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) :
|
|||
spatial_editor_hb->add_child(button_transform_joint);
|
||||
|
||||
button_transform_joint->set_text(TTR("Move Joint"));
|
||||
button_transform_joint->set_icon(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->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();
|
||||
}
|
||||
|
||||
PhysicalBoneEditor::~PhysicalBoneEditor() {}
|
||||
PhysicalBone3DEditor::~PhysicalBone3DEditor() {}
|
||||
|
||||
void PhysicalBoneEditor::set_selected(PhysicalBone3D *p_pb) {
|
||||
void PhysicalBone3DEditor::set_selected(PhysicalBone3D *p_pb) {
|
||||
|
||||
button_transform_joint->set_pressed(false);
|
||||
|
||||
|
@ -79,20 +80,20 @@ void PhysicalBoneEditor::set_selected(PhysicalBone3D *p_pb) {
|
|||
_set_move_joint();
|
||||
}
|
||||
|
||||
void PhysicalBoneEditor::hide() {
|
||||
void PhysicalBone3DEditor::hide() {
|
||||
spatial_editor_hb->hide();
|
||||
}
|
||||
|
||||
void PhysicalBoneEditor::show() {
|
||||
void PhysicalBone3DEditor::show() {
|
||||
spatial_editor_hb->show();
|
||||
}
|
||||
|
||||
PhysicalBonePlugin::PhysicalBonePlugin(EditorNode *p_editor) :
|
||||
PhysicalBone3DEditorPlugin::PhysicalBone3DEditorPlugin(EditorNode *p_editor) :
|
||||
editor(p_editor),
|
||||
selected(NULL),
|
||||
physical_bone_editor(editor) {}
|
||||
|
||||
void PhysicalBonePlugin::make_visible(bool p_visible) {
|
||||
void PhysicalBone3DEditorPlugin::make_visible(bool p_visible) {
|
||||
if (p_visible) {
|
||||
|
||||
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
|
||||
ERR_FAIL_COND(!selected);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* physical_bone_plugin.h */
|
||||
/* physical_bone_3d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -33,8 +33,8 @@
|
|||
|
||||
#include "editor/editor_node.h"
|
||||
|
||||
class PhysicalBoneEditor : public Object {
|
||||
GDCLASS(PhysicalBoneEditor, Object);
|
||||
class PhysicalBone3DEditor : public Object {
|
||||
GDCLASS(PhysicalBone3DEditor, Object);
|
||||
|
||||
EditorNode *editor;
|
||||
HBoxContainer *spatial_editor_hb;
|
||||
|
@ -50,8 +50,8 @@ private:
|
|||
void _set_move_joint();
|
||||
|
||||
public:
|
||||
PhysicalBoneEditor(EditorNode *p_editor);
|
||||
~PhysicalBoneEditor();
|
||||
PhysicalBone3DEditor(EditorNode *p_editor);
|
||||
~PhysicalBone3DEditor();
|
||||
|
||||
void set_selected(PhysicalBone3D *p_pb);
|
||||
|
||||
|
@ -59,12 +59,12 @@ public:
|
|||
void show();
|
||||
};
|
||||
|
||||
class PhysicalBonePlugin : public EditorPlugin {
|
||||
GDCLASS(PhysicalBonePlugin, EditorPlugin);
|
||||
class PhysicalBone3DEditorPlugin : public EditorPlugin {
|
||||
GDCLASS(PhysicalBone3DEditorPlugin, EditorPlugin);
|
||||
|
||||
EditorNode *editor;
|
||||
PhysicalBone3D *selected;
|
||||
PhysicalBoneEditor physical_bone_editor;
|
||||
PhysicalBone3DEditor physical_bone_editor;
|
||||
|
||||
public:
|
||||
virtual String get_name() const { return "PhysicalBone3D"; }
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
virtual void make_visible(bool p_visible);
|
||||
virtual void edit(Object *p_node);
|
||||
|
||||
PhysicalBonePlugin(EditorNode *p_editor);
|
||||
PhysicalBone3DEditorPlugin(EditorNode *p_editor);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* skeleton_editor_plugin.cpp */
|
||||
/* skeleton_3d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,16 +28,16 @@
|
|||
/* 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/physics_body_3d.h"
|
||||
#include "scene/3d/physics_joint_3d.h"
|
||||
#include "scene/resources/capsule_shape_3d.h"
|
||||
#include "scene/resources/sphere_shape_3d.h"
|
||||
#include "spatial_editor_plugin.h"
|
||||
|
||||
void SkeletonEditor::_on_click_option(int p_option) {
|
||||
void Skeleton3DEditor::_on_click_option(int p_option) {
|
||||
if (!skeleton) {
|
||||
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();
|
||||
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);
|
||||
|
||||
|
@ -130,18 +130,18 @@ PhysicalBone3D *SkeletonEditor::create_physical_bone(int bone_id, int bone_child
|
|||
return physical_bone;
|
||||
}
|
||||
|
||||
void SkeletonEditor::edit(Skeleton3D *p_node) {
|
||||
void Skeleton3DEditor::edit(Skeleton3D *p_node) {
|
||||
|
||||
skeleton = p_node;
|
||||
}
|
||||
|
||||
void SkeletonEditor::_notification(int p_what) {
|
||||
void Skeleton3DEditor::_notification(int p_what) {
|
||||
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) {
|
||||
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;
|
||||
options = memnew(MenuButton);
|
||||
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->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();
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
bool SkeletonEditorPlugin::handles(Object *p_object) const {
|
||||
bool Skeleton3DEditorPlugin::handles(Object *p_object) const {
|
||||
return p_object->is_class("Skeleton3D");
|
||||
}
|
||||
|
||||
void SkeletonEditorPlugin::make_visible(bool p_visible) {
|
||||
void Skeleton3DEditorPlugin::make_visible(bool p_visible) {
|
||||
if (p_visible) {
|
||||
skeleton_editor->options->show();
|
||||
} 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;
|
||||
skeleton_editor = memnew(SkeletonEditor);
|
||||
skeleton_editor = memnew(Skeleton3DEditor);
|
||||
editor->get_viewport()->add_child(skeleton_editor);
|
||||
}
|
||||
|
||||
SkeletonEditorPlugin::~SkeletonEditorPlugin() {}
|
||||
Skeleton3DEditorPlugin::~Skeleton3DEditorPlugin() {}
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* skeleton_editor_plugin.h */
|
||||
/* skeleton_3d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,8 +28,8 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef SKELETON_EDITOR_PLUGIN_H
|
||||
#define SKELETON_EDITOR_PLUGIN_H
|
||||
#ifndef SKELETON_3D_EDITOR_PLUGIN_H
|
||||
#define SKELETON_3D_EDITOR_PLUGIN_H
|
||||
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_plugin.h"
|
||||
|
@ -38,8 +38,8 @@
|
|||
class PhysicalBone3D;
|
||||
class Joint3D;
|
||||
|
||||
class SkeletonEditor : public Node {
|
||||
GDCLASS(SkeletonEditor, Node);
|
||||
class Skeleton3DEditor : public Node {
|
||||
GDCLASS(Skeleton3DEditor, Node);
|
||||
|
||||
enum Menu {
|
||||
MENU_OPTION_CREATE_PHYSICAL_SKELETON
|
||||
|
@ -58,7 +58,7 @@ class SkeletonEditor : public Node {
|
|||
|
||||
void _on_click_option(int p_option);
|
||||
|
||||
friend class SkeletonEditorPlugin;
|
||||
friend class Skeleton3DEditorPlugin;
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
|
@ -71,26 +71,26 @@ protected:
|
|||
public:
|
||||
void edit(Skeleton3D *p_node);
|
||||
|
||||
SkeletonEditor();
|
||||
~SkeletonEditor();
|
||||
Skeleton3DEditor();
|
||||
~Skeleton3DEditor();
|
||||
};
|
||||
|
||||
class SkeletonEditorPlugin : public EditorPlugin {
|
||||
class Skeleton3DEditorPlugin : public EditorPlugin {
|
||||
|
||||
GDCLASS(SkeletonEditorPlugin, EditorPlugin);
|
||||
GDCLASS(Skeleton3DEditorPlugin, EditorPlugin);
|
||||
|
||||
EditorNode *editor;
|
||||
SkeletonEditor *skeleton_editor;
|
||||
Skeleton3DEditor *skeleton_editor;
|
||||
|
||||
public:
|
||||
virtual String get_name() const { return "Skeleton"; }
|
||||
virtual String get_name() const { return "Skeleton3D"; }
|
||||
virtual bool has_main_screen() const { return false; }
|
||||
virtual void edit(Object *p_object);
|
||||
virtual bool handles(Object *p_object) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
|
||||
SkeletonEditorPlugin(EditorNode *p_node);
|
||||
~SkeletonEditorPlugin();
|
||||
Skeleton3DEditorPlugin(EditorNode *p_node);
|
||||
~Skeleton3DEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // SKELETON_EDITOR_PLUGIN_H
|
||||
#endif // SKELETON_3D_EDITOR_PLUGIN_H
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* skeleton_ik_editor_plugin.cpp */
|
||||
/* skeleton_ik_3d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,11 +28,11 @@
|
|||
/* 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)
|
||||
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 (skeleton_ik) {
|
||||
|
@ -64,12 +64,12 @@ void SkeletonIKEditorPlugin::edit(Object *p_object) {
|
|||
skeleton_ik = s;
|
||||
}
|
||||
|
||||
bool SkeletonIKEditorPlugin::handles(Object *p_object) const {
|
||||
bool SkeletonIK3DEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
return p_object->is_class("SkeletonIK3D");
|
||||
}
|
||||
|
||||
void SkeletonIKEditorPlugin::make_visible(bool p_visible) {
|
||||
void SkeletonIK3DEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
if (p_visible)
|
||||
play_btn->show();
|
||||
|
@ -77,10 +77,10 @@ void SkeletonIKEditorPlugin::make_visible(bool p_visible) {
|
|||
play_btn->hide();
|
||||
}
|
||||
|
||||
void SkeletonIKEditorPlugin::_bind_methods() {
|
||||
void SkeletonIK3DEditorPlugin::_bind_methods() {
|
||||
}
|
||||
|
||||
SkeletonIKEditorPlugin::SkeletonIKEditorPlugin(EditorNode *p_node) {
|
||||
SkeletonIK3DEditorPlugin::SkeletonIK3DEditorPlugin(EditorNode *p_node) {
|
||||
|
||||
editor = p_node;
|
||||
play_btn = memnew(Button);
|
||||
|
@ -88,9 +88,9 @@ SkeletonIKEditorPlugin::SkeletonIKEditorPlugin(EditorNode *p_node) {
|
|||
play_btn->set_text(TTR("Play IK"));
|
||||
play_btn->set_toggle_mode(true);
|
||||
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);
|
||||
skeleton_ik = NULL;
|
||||
}
|
||||
|
||||
SkeletonIKEditorPlugin::~SkeletonIKEditorPlugin() {}
|
||||
SkeletonIK3DEditorPlugin::~SkeletonIK3DEditorPlugin() {}
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* skeleton_ik_editor_plugin.h */
|
||||
/* skeleton_ik_3d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,17 +28,17 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef SKELETON_IK_EDITOR_PLUGIN_H
|
||||
#define SKELETON_IK_EDITOR_PLUGIN_H
|
||||
#ifndef SKELETON_IK_3D_EDITOR_PLUGIN_H
|
||||
#define SKELETON_IK_3D_EDITOR_PLUGIN_H
|
||||
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_plugin.h"
|
||||
|
||||
class SkeletonIK3D;
|
||||
|
||||
class SkeletonIKEditorPlugin : public EditorPlugin {
|
||||
class SkeletonIK3DEditorPlugin : public EditorPlugin {
|
||||
|
||||
GDCLASS(SkeletonIKEditorPlugin, EditorPlugin);
|
||||
GDCLASS(SkeletonIK3DEditorPlugin, EditorPlugin);
|
||||
|
||||
SkeletonIK3D *skeleton_ik;
|
||||
|
||||
|
@ -57,8 +57,8 @@ public:
|
|||
virtual bool handles(Object *p_object) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
|
||||
SkeletonIKEditorPlugin(EditorNode *p_node);
|
||||
~SkeletonIKEditorPlugin();
|
||||
SkeletonIK3DEditorPlugin(EditorNode *p_node);
|
||||
~SkeletonIK3DEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // SKELETON_IK_EDITOR_PLUGIN_H
|
||||
#endif // SKELETON_IK_3D_EDITOR_PLUGIN_H
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* sprite_editor_plugin.cpp */
|
||||
/* sprite_2d_editor_plugin.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,7 +28,7 @@
|
|||
/* 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 "editor/editor_scale.h"
|
||||
|
@ -39,7 +39,7 @@
|
|||
#include "scene/gui/box_container.h"
|
||||
#include "thirdparty/misc/clipper.hpp"
|
||||
|
||||
void SpriteEditor::_node_removed(Node *p_node) {
|
||||
void Sprite2DEditor::_node_removed(Node *p_node) {
|
||||
|
||||
if (p_node == node) {
|
||||
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;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ Vector<Vector2> expand(const Vector<Vector2> &points, const Rect2i &rect, float
|
|||
return outPoints;
|
||||
}
|
||||
|
||||
void SpriteEditor::_menu_option(int p_option) {
|
||||
void Sprite2DEditor::_menu_option(int p_option) {
|
||||
|
||||
if (!node) {
|
||||
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();
|
||||
if (texture.is_null()) {
|
||||
err_dialog->set_text(TTR("Sprite is empty!"));
|
||||
err_dialog->set_text(TTR("Sprite2D is empty!"));
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ void SpriteEditor::_update_mesh_data() {
|
|||
debug_uv->update();
|
||||
}
|
||||
|
||||
void SpriteEditor::_create_node() {
|
||||
void Sprite2DEditor::_create_node() {
|
||||
switch (selected_menu_item) {
|
||||
case MENU_OPTION_CONVERT_TO_MESH_2D: {
|
||||
_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) {
|
||||
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();
|
||||
}
|
||||
|
||||
void SpriteEditor::_convert_to_polygon_2d_node() {
|
||||
void Sprite2DEditor::_convert_to_polygon_2d_node() {
|
||||
|
||||
if (computed_outline_lines.empty()) {
|
||||
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();
|
||||
}
|
||||
|
||||
void SpriteEditor::_create_collision_polygon_2d_node() {
|
||||
void Sprite2DEditor::_create_collision_polygon_2d_node() {
|
||||
|
||||
if (computed_outline_lines.empty()) {
|
||||
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()) {
|
||||
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
|
||||
if (p_own_node != this->get_tree()->get_edited_scene_root()) {
|
||||
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());
|
||||
}
|
||||
|
||||
void SpriteEditor::_debug_uv_draw() {
|
||||
void Sprite2DEditor::_debug_uv_draw() {
|
||||
|
||||
Ref<Texture2D> tex = node->get_texture();
|
||||
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);
|
||||
|
||||
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options);
|
||||
|
||||
options->set_text(TTR("Sprite"));
|
||||
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Sprite", "EditorIcons"));
|
||||
options->set_text(TTR("Sprite2D"));
|
||||
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 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->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);
|
||||
add_child(err_dialog);
|
||||
|
@ -538,9 +538,9 @@ SpriteEditor::SpriteEditor() {
|
|||
scroll->set_enable_v_scroll(true);
|
||||
vb->add_margin_child(TTR("Preview:"), scroll, true);
|
||||
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);
|
||||
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);
|
||||
hb->add_child(memnew(Label(TTR("Simplification: "))));
|
||||
|
@ -569,24 +569,24 @@ SpriteEditor::SpriteEditor() {
|
|||
hb->add_spacer();
|
||||
update_preview = memnew(Button);
|
||||
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);
|
||||
vb->add_margin_child(TTR("Settings:"), hb);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
bool SpriteEditorPlugin::handles(Object *p_object) const {
|
||||
bool Sprite2DEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
return p_object->is_class("Sprite2D");
|
||||
}
|
||||
|
||||
void SpriteEditorPlugin::make_visible(bool p_visible) {
|
||||
void Sprite2DEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
if (p_visible) {
|
||||
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;
|
||||
sprite_editor = memnew(SpriteEditor);
|
||||
sprite_editor = memnew(Sprite2DEditor);
|
||||
editor->get_viewport()->add_child(sprite_editor);
|
||||
make_visible(false);
|
||||
|
||||
//sprite_editor->options->hide();
|
||||
}
|
||||
|
||||
SpriteEditorPlugin::~SpriteEditorPlugin() {
|
||||
Sprite2DEditorPlugin::~Sprite2DEditorPlugin() {
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* sprite_editor_plugin.h */
|
||||
/* sprite_2d_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -36,9 +36,9 @@
|
|||
#include "scene/2d/sprite_2d.h"
|
||||
#include "scene/gui/spin_box.h"
|
||||
|
||||
class SpriteEditor : public Control {
|
||||
class Sprite2DEditor : public Control {
|
||||
|
||||
GDCLASS(SpriteEditor, Control);
|
||||
GDCLASS(Sprite2DEditor, Control);
|
||||
|
||||
enum Menu {
|
||||
MENU_OPTION_CONVERT_TO_MESH_2D,
|
||||
|
@ -74,7 +74,7 @@ class SpriteEditor : public Control {
|
|||
void _menu_option(int p_option);
|
||||
|
||||
//void _create_uv_lines();
|
||||
friend class SpriteEditorPlugin;
|
||||
friend class Sprite2DEditorPlugin;
|
||||
|
||||
void _debug_uv_draw();
|
||||
void _update_mesh_data();
|
||||
|
@ -93,14 +93,14 @@ protected:
|
|||
|
||||
public:
|
||||
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;
|
||||
|
||||
public:
|
||||
|
@ -110,8 +110,8 @@ public:
|
|||
virtual bool handles(Object *p_object) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
|
||||
SpriteEditorPlugin(EditorNode *p_node);
|
||||
~SpriteEditorPlugin();
|
||||
Sprite2DEditorPlugin(EditorNode *p_node);
|
||||
~Sprite2DEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // SPRITE_EDITOR_PLUGIN_H
|
|
@ -42,8 +42,8 @@
|
|||
#include "editor/multi_node_edit.h"
|
||||
#include "editor/plugins/animation_player_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/spatial_editor_plugin.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "servers/display_server.h"
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "csg_shape.h"
|
||||
#include "editor/editor_plugin.h"
|
||||
#include "editor/spatial_editor_gizmos.h"
|
||||
#include "editor/node_3d_editor_gizmos.h"
|
||||
|
||||
class CSGShapeNode3DGizmoPlugin : public EditorNode3DGizmoPlugin {
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "core/input/input_filter.h"
|
||||
#include "editor/editor_scale.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 "core/math/geometry.h"
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
#include "cpu_particles_2d.h"
|
||||
|
||||
#include "core/core_string_names.h"
|
||||
#include "scene/2d/canvas_item.h"
|
||||
#include "scene/2d/particles_2d.h"
|
||||
#include "scene/2d/gpu_particles_2d.h"
|
||||
#include "scene/main/canvas_item.h"
|
||||
#include "scene/resources/particles_material.h"
|
||||
#include "servers/visual_server.h"
|
||||
|
||||
|
@ -1144,7 +1144,7 @@ void CPUParticles2D::_notification(int p_what) {
|
|||
|
||||
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.");
|
||||
|
||||
set_emitting(particles->is_emitting());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* particles_2d.cpp */
|
||||
/* gpu_particles_2d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,7 +28,7 @@
|
|||
/* 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 "scene/resources/particles_material.h"
|
||||
|
@ -38,7 +38,7 @@
|
|||
#include "core/engine.h"
|
||||
#endif
|
||||
|
||||
void Particles2D::set_emitting(bool p_emitting) {
|
||||
void GPUParticles2D::set_emitting(bool 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.");
|
||||
amount = p_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.");
|
||||
lifetime = p_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;
|
||||
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)
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
AABB aabb;
|
||||
|
@ -106,7 +106,7 @@ void Particles2D::set_visibility_rect(const Rect2 &p_visibility_rect) {
|
|||
_change_notify("visibility_rect");
|
||||
update();
|
||||
}
|
||||
void Particles2D::set_use_local_coordinates(bool p_enable) {
|
||||
void GPUParticles2D::set_use_local_coordinates(bool p_enable) {
|
||||
|
||||
local_coords = p_enable;
|
||||
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();
|
||||
Transform xf;
|
||||
|
@ -127,7 +127,7 @@ void Particles2D::_update_particle_emission_transform() {
|
|||
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;
|
||||
Ref<ParticlesMaterial> pm = p_material;
|
||||
|
@ -144,89 +144,89 @@ void Particles2D::set_process_material(const Ref<Material> &p_material) {
|
|||
update_configuration_warning();
|
||||
}
|
||||
|
||||
void Particles2D::set_speed_scale(float p_scale) {
|
||||
void GPUParticles2D::set_speed_scale(float p_scale) {
|
||||
|
||||
speed_scale = 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);
|
||||
}
|
||||
int Particles2D::get_amount() const {
|
||||
int GPUParticles2D::get_amount() const {
|
||||
|
||||
return amount;
|
||||
}
|
||||
float Particles2D::get_lifetime() const {
|
||||
float GPUParticles2D::get_lifetime() const {
|
||||
|
||||
return lifetime;
|
||||
}
|
||||
|
||||
bool Particles2D::get_one_shot() const {
|
||||
bool GPUParticles2D::get_one_shot() const {
|
||||
|
||||
return one_shot;
|
||||
}
|
||||
float Particles2D::get_pre_process_time() const {
|
||||
float GPUParticles2D::get_pre_process_time() const {
|
||||
|
||||
return pre_process_time;
|
||||
}
|
||||
float Particles2D::get_explosiveness_ratio() const {
|
||||
float GPUParticles2D::get_explosiveness_ratio() const {
|
||||
|
||||
return explosiveness_ratio;
|
||||
}
|
||||
float Particles2D::get_randomness_ratio() const {
|
||||
float GPUParticles2D::get_randomness_ratio() const {
|
||||
|
||||
return randomness_ratio;
|
||||
}
|
||||
Rect2 Particles2D::get_visibility_rect() const {
|
||||
Rect2 GPUParticles2D::get_visibility_rect() const {
|
||||
|
||||
return visibility_rect;
|
||||
}
|
||||
bool Particles2D::get_use_local_coordinates() const {
|
||||
bool GPUParticles2D::get_use_local_coordinates() const {
|
||||
|
||||
return local_coords;
|
||||
}
|
||||
Ref<Material> Particles2D::get_process_material() const {
|
||||
Ref<Material> GPUParticles2D::get_process_material() const {
|
||||
|
||||
return process_material;
|
||||
}
|
||||
|
||||
float Particles2D::get_speed_scale() const {
|
||||
float GPUParticles2D::get_speed_scale() const {
|
||||
|
||||
return speed_scale;
|
||||
}
|
||||
|
||||
void Particles2D::set_draw_order(DrawOrder p_order) {
|
||||
void GPUParticles2D::set_draw_order(DrawOrder p_order) {
|
||||
|
||||
draw_order = 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;
|
||||
}
|
||||
|
||||
void Particles2D::set_fixed_fps(int p_count) {
|
||||
void GPUParticles2D::set_fixed_fps(int p_count) {
|
||||
fixed_fps = 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;
|
||||
}
|
||||
|
||||
void Particles2D::set_fractional_delta(bool p_enable) {
|
||||
void GPUParticles2D::set_fractional_delta(bool p_enable) {
|
||||
fractional_delta = 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;
|
||||
}
|
||||
|
||||
String Particles2D::get_configuration_warning() const {
|
||||
String GPUParticles2D::get_configuration_warning() const {
|
||||
|
||||
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.");
|
||||
|
@ -257,7 +257,7 @@ String Particles2D::get_configuration_warning() const {
|
|||
return warnings;
|
||||
}
|
||||
|
||||
Rect2 Particles2D::capture_rect() const {
|
||||
Rect2 GPUParticles2D::capture_rect() const {
|
||||
|
||||
AABB aabb = VS::get_singleton()->particles_get_current_aabb(particles);
|
||||
Rect2 r;
|
||||
|
@ -268,34 +268,34 @@ Rect2 Particles2D::capture_rect() const {
|
|||
return r;
|
||||
}
|
||||
|
||||
void Particles2D::set_texture(const Ref<Texture2D> &p_texture) {
|
||||
void GPUParticles2D::set_texture(const Ref<Texture2D> &p_texture) {
|
||||
texture = p_texture;
|
||||
update();
|
||||
}
|
||||
|
||||
Ref<Texture2D> Particles2D::get_texture() const {
|
||||
Ref<Texture2D> GPUParticles2D::get_texture() const {
|
||||
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;
|
||||
update();
|
||||
}
|
||||
|
||||
Ref<Texture2D> Particles2D::get_normal_map() const {
|
||||
Ref<Texture2D> GPUParticles2D::get_normal_map() const {
|
||||
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_set_emitting(particles, true);
|
||||
}
|
||||
|
||||
void Particles2D::_notification(int p_what) {
|
||||
void GPUParticles2D::_notification(int p_what) {
|
||||
|
||||
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_amount", "amount"), &Particles2D::set_amount);
|
||||
ClassDB::bind_method(D_METHOD("set_lifetime", "secs"), &Particles2D::set_lifetime);
|
||||
ClassDB::bind_method(D_METHOD("set_one_shot", "secs"), &Particles2D::set_one_shot);
|
||||
ClassDB::bind_method(D_METHOD("set_pre_process_time", "secs"), &Particles2D::set_pre_process_time);
|
||||
ClassDB::bind_method(D_METHOD("set_explosiveness_ratio", "ratio"), &Particles2D::set_explosiveness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("set_randomness_ratio", "ratio"), &Particles2D::set_randomness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("set_visibility_rect", "visibility_rect"), &Particles2D::set_visibility_rect);
|
||||
ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &Particles2D::set_use_local_coordinates);
|
||||
ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &Particles2D::set_fixed_fps);
|
||||
ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &Particles2D::set_fractional_delta);
|
||||
ClassDB::bind_method(D_METHOD("set_process_material", "material"), &Particles2D::set_process_material);
|
||||
ClassDB::bind_method(D_METHOD("set_speed_scale", "scale"), &Particles2D::set_speed_scale);
|
||||
ClassDB::bind_method(D_METHOD("set_emitting", "emitting"), &GPUParticles2D::set_emitting);
|
||||
ClassDB::bind_method(D_METHOD("set_amount", "amount"), &GPUParticles2D::set_amount);
|
||||
ClassDB::bind_method(D_METHOD("set_lifetime", "secs"), &GPUParticles2D::set_lifetime);
|
||||
ClassDB::bind_method(D_METHOD("set_one_shot", "secs"), &GPUParticles2D::set_one_shot);
|
||||
ClassDB::bind_method(D_METHOD("set_pre_process_time", "secs"), &GPUParticles2D::set_pre_process_time);
|
||||
ClassDB::bind_method(D_METHOD("set_explosiveness_ratio", "ratio"), &GPUParticles2D::set_explosiveness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("set_randomness_ratio", "ratio"), &GPUParticles2D::set_randomness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("set_visibility_rect", "visibility_rect"), &GPUParticles2D::set_visibility_rect);
|
||||
ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &GPUParticles2D::set_use_local_coordinates);
|
||||
ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &GPUParticles2D::set_fixed_fps);
|
||||
ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &GPUParticles2D::set_fractional_delta);
|
||||
ClassDB::bind_method(D_METHOD("set_process_material", "material"), &GPUParticles2D::set_process_material);
|
||||
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("get_amount"), &Particles2D::get_amount);
|
||||
ClassDB::bind_method(D_METHOD("get_lifetime"), &Particles2D::get_lifetime);
|
||||
ClassDB::bind_method(D_METHOD("get_one_shot"), &Particles2D::get_one_shot);
|
||||
ClassDB::bind_method(D_METHOD("get_pre_process_time"), &Particles2D::get_pre_process_time);
|
||||
ClassDB::bind_method(D_METHOD("get_explosiveness_ratio"), &Particles2D::get_explosiveness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("get_randomness_ratio"), &Particles2D::get_randomness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("get_visibility_rect"), &Particles2D::get_visibility_rect);
|
||||
ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &Particles2D::get_use_local_coordinates);
|
||||
ClassDB::bind_method(D_METHOD("get_fixed_fps"), &Particles2D::get_fixed_fps);
|
||||
ClassDB::bind_method(D_METHOD("get_fractional_delta"), &Particles2D::get_fractional_delta);
|
||||
ClassDB::bind_method(D_METHOD("get_process_material"), &Particles2D::get_process_material);
|
||||
ClassDB::bind_method(D_METHOD("get_speed_scale"), &Particles2D::get_speed_scale);
|
||||
ClassDB::bind_method(D_METHOD("is_emitting"), &GPUParticles2D::is_emitting);
|
||||
ClassDB::bind_method(D_METHOD("get_amount"), &GPUParticles2D::get_amount);
|
||||
ClassDB::bind_method(D_METHOD("get_lifetime"), &GPUParticles2D::get_lifetime);
|
||||
ClassDB::bind_method(D_METHOD("get_one_shot"), &GPUParticles2D::get_one_shot);
|
||||
ClassDB::bind_method(D_METHOD("get_pre_process_time"), &GPUParticles2D::get_pre_process_time);
|
||||
ClassDB::bind_method(D_METHOD("get_explosiveness_ratio"), &GPUParticles2D::get_explosiveness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("get_randomness_ratio"), &GPUParticles2D::get_randomness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("get_visibility_rect"), &GPUParticles2D::get_visibility_rect);
|
||||
ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &GPUParticles2D::get_use_local_coordinates);
|
||||
ClassDB::bind_method(D_METHOD("get_fixed_fps"), &GPUParticles2D::get_fixed_fps);
|
||||
ClassDB::bind_method(D_METHOD("get_fractional_delta"), &GPUParticles2D::get_fractional_delta);
|
||||
ClassDB::bind_method(D_METHOD("get_process_material"), &GPUParticles2D::get_process_material);
|
||||
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("get_draw_order"), &Particles2D::get_draw_order);
|
||||
ClassDB::bind_method(D_METHOD("set_draw_order", "order"), &GPUParticles2D::set_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("get_texture"), &Particles2D::get_texture);
|
||||
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &GPUParticles2D::set_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("get_normal_map"), &Particles2D::get_normal_map);
|
||||
ClassDB::bind_method(D_METHOD("set_normal_map", "texture"), &GPUParticles2D::set_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::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);
|
||||
}
|
||||
|
||||
Particles2D::Particles2D() {
|
||||
GPUParticles2D::GPUParticles2D() {
|
||||
|
||||
particles = VS::get_singleton()->particles_create();
|
||||
|
||||
|
@ -426,7 +426,7 @@ Particles2D::Particles2D() {
|
|||
set_speed_scale(1);
|
||||
}
|
||||
|
||||
Particles2D::~Particles2D() {
|
||||
GPUParticles2D::~GPUParticles2D() {
|
||||
|
||||
VS::get_singleton()->free(particles);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* particles_2d.h */
|
||||
/* gpu_particles_2d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -35,9 +35,9 @@
|
|||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
class Particles2D : public Node2D {
|
||||
class GPUParticles2D : public Node2D {
|
||||
private:
|
||||
GDCLASS(Particles2D, Node2D);
|
||||
GDCLASS(GPUParticles2D, Node2D);
|
||||
|
||||
public:
|
||||
enum DrawOrder {
|
||||
|
@ -118,10 +118,10 @@ public:
|
|||
|
||||
void restart();
|
||||
Rect2 capture_rect() const;
|
||||
Particles2D();
|
||||
~Particles2D();
|
||||
GPUParticles2D();
|
||||
~GPUParticles2D();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(Particles2D::DrawOrder)
|
||||
VARIANT_ENUM_CAST(GPUParticles2D::DrawOrder)
|
||||
|
||||
#endif // PARTICLES_2D_H
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef 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"
|
||||
|
||||
class Navigation2D : public Node2D {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* navigation_polygon.cpp */
|
||||
/* navigation_region_2d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,7 +28,7 @@
|
|||
/* 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/engine.h"
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* navigation_polygon.h */
|
||||
/* navigation_region_2d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,8 +28,8 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef NAVIGATION_POLYGON_H
|
||||
#define NAVIGATION_POLYGON_H
|
||||
#ifndef NAVIGATION_REGION_2D_H
|
||||
#define NAVIGATION_REGION_2D_H
|
||||
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/resources/navigation_mesh.h"
|
||||
|
@ -127,4 +127,4 @@ public:
|
|||
~NavigationRegion2D();
|
||||
};
|
||||
|
||||
#endif // NAVIGATIONPOLYGON_H
|
||||
#endif // NAVIGATION_REGION_2D_H
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef NODE2D_H
|
||||
#define NODE2D_H
|
||||
|
||||
#include "scene/2d/canvas_item.h"
|
||||
#include "scene/main/canvas_item.h"
|
||||
|
||||
class Node2D : public CanvasItem {
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "visibility_notifier_2d.h"
|
||||
|
||||
#include "core/engine.h"
|
||||
#include "particles_2d.h"
|
||||
#include "gpu_particles_2d.h"
|
||||
#include "scene/2d/animated_sprite_2d.h"
|
||||
#include "scene/2d/physics_body_2d.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) {
|
||||
add = true;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ void VisibilityEnabler2D::_change_node_state(Node *p_node, bool p_enabled) {
|
|||
}
|
||||
|
||||
if (enabler[ENABLER_PAUSE_PARTICLES]) {
|
||||
Particles2D *ps = Object::cast_to<Particles2D>(p_node);
|
||||
GPUParticles2D *ps = Object::cast_to<GPUParticles2D>(p_node);
|
||||
|
||||
if (ps) {
|
||||
|
||||
|
|
|
@ -384,7 +384,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
|
|||
linear_velocity = velocity_tracker->get_tracked_linear_velocity();
|
||||
}
|
||||
|
||||
Ref<World> world = get_world();
|
||||
Ref<World3D> world = get_world();
|
||||
ERR_FAIL_COND(world.is_null());
|
||||
|
||||
int new_output_count = 0;
|
||||
|
|
|
@ -726,13 +726,13 @@ Camera3D::~Camera3D() {
|
|||
|
||||
////////////////////////////////////////
|
||||
|
||||
void ClippedCamera::set_margin(float p_margin) {
|
||||
void ClippedCamera3D::set_margin(float p_margin) {
|
||||
margin = p_margin;
|
||||
}
|
||||
float ClippedCamera::get_margin() const {
|
||||
float ClippedCamera3D::get_margin() const {
|
||||
return margin;
|
||||
}
|
||||
void ClippedCamera::set_process_mode(ProcessMode p_mode) {
|
||||
void ClippedCamera3D::set_process_mode(ProcessMode p_mode) {
|
||||
|
||||
if (process_mode == p_mode) {
|
||||
return;
|
||||
|
@ -741,18 +741,18 @@ void ClippedCamera::set_process_mode(ProcessMode p_mode) {
|
|||
set_process_internal(process_mode == CLIP_PROCESS_IDLE);
|
||||
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;
|
||||
}
|
||||
|
||||
Transform ClippedCamera::get_camera_transform() const {
|
||||
Transform ClippedCamera3D::get_camera_transform() const {
|
||||
|
||||
Transform t = Camera3D::get_camera_transform();
|
||||
t.origin += -t.basis.get_axis(Vector3::AXIS_Z).normalized() * clip_offset;
|
||||
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) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
uint32_t ClippedCamera::get_collision_mask() const {
|
||||
uint32_t ClippedCamera3D::get_collision_mask() const {
|
||||
|
||||
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();
|
||||
if (p_value)
|
||||
|
@ -833,17 +833,17 @@ void ClippedCamera::set_collision_mask_bit(int p_bit, bool p_value) {
|
|||
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);
|
||||
}
|
||||
|
||||
void ClippedCamera::add_exception_rid(const RID &p_rid) {
|
||||
void ClippedCamera3D::add_exception_rid(const RID &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);
|
||||
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());
|
||||
}
|
||||
|
||||
void ClippedCamera::remove_exception_rid(const RID &p_rid) {
|
||||
void ClippedCamera3D::remove_exception_rid(const RID &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);
|
||||
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());
|
||||
}
|
||||
|
||||
void ClippedCamera::clear_exceptions() {
|
||||
void ClippedCamera3D::clear_exceptions() {
|
||||
|
||||
exclude.clear();
|
||||
}
|
||||
|
||||
float ClippedCamera::get_clip_offset() const {
|
||||
float ClippedCamera3D::get_clip_offset() const {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
bool ClippedCamera::is_clip_to_areas_enabled() const {
|
||||
bool ClippedCamera3D::is_clip_to_areas_enabled() const {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
bool ClippedCamera::is_clip_to_bodies_enabled() const {
|
||||
bool ClippedCamera3D::is_clip_to_bodies_enabled() const {
|
||||
|
||||
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("get_margin"), &ClippedCamera::get_margin);
|
||||
ClassDB::bind_method(D_METHOD("set_margin", "margin"), &ClippedCamera3D::set_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("get_process_mode"), &ClippedCamera::get_process_mode);
|
||||
ClassDB::bind_method(D_METHOD("set_process_mode", "process_mode"), &ClippedCamera3D::set_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("get_collision_mask"), &ClippedCamera::get_collision_mask);
|
||||
ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &ClippedCamera3D::set_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("get_collision_mask_bit", "bit"), &ClippedCamera::get_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"), &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", "node"), &ClippedCamera::add_exception);
|
||||
ClassDB::bind_method(D_METHOD("add_exception_rid", "rid"), &ClippedCamera3D::add_exception_rid);
|
||||
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", "node"), &ClippedCamera::remove_exception);
|
||||
ClassDB::bind_method(D_METHOD("remove_exception_rid", "rid"), &ClippedCamera3D::remove_exception_rid);
|
||||
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("is_clip_to_areas_enabled"), &ClippedCamera::is_clip_to_areas_enabled);
|
||||
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"), &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("is_clip_to_bodies_enabled"), &ClippedCamera::is_clip_to_bodies_enabled);
|
||||
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"), &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::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_IDLE);
|
||||
}
|
||||
ClippedCamera::ClippedCamera() {
|
||||
ClippedCamera3D::ClippedCamera3D() {
|
||||
margin = 0;
|
||||
clip_offset = 0;
|
||||
process_mode = CLIP_PROCESS_PHYSICS;
|
||||
|
@ -949,6 +949,6 @@ ClippedCamera::ClippedCamera() {
|
|||
clip_to_areas = false;
|
||||
clip_to_bodies = true;
|
||||
}
|
||||
ClippedCamera::~ClippedCamera() {
|
||||
ClippedCamera3D::~ClippedCamera3D() {
|
||||
PhysicsServer::get_singleton()->free(pyramid_shape);
|
||||
}
|
||||
|
|
|
@ -48,10 +48,8 @@ public:
|
|||
PROJECTION_FRUSTUM
|
||||
};
|
||||
|
||||
enum KeepAspect {
|
||||
KEEP_WIDTH,
|
||||
KEEP_HEIGHT
|
||||
};
|
||||
enum KeepAspect { KEEP_WIDTH,
|
||||
KEEP_HEIGHT };
|
||||
|
||||
enum DopplerTracking {
|
||||
DOPPLER_TRACKING_DISABLED,
|
||||
|
@ -77,7 +75,7 @@ private:
|
|||
RID camera;
|
||||
RID scenario_id;
|
||||
|
||||
//String camera_group;
|
||||
// String camera_group;
|
||||
|
||||
uint32_t layers;
|
||||
|
||||
|
@ -86,7 +84,7 @@ private:
|
|||
|
||||
virtual bool _can_gizmo_scale() const;
|
||||
|
||||
//void _camera_make_current(Node *p_camera);
|
||||
// void _camera_make_current(Node *p_camera);
|
||||
friend class Viewport;
|
||||
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_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 make_current();
|
||||
|
@ -143,7 +142,8 @@ public:
|
|||
virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const;
|
||||
virtual Point2 unproject_position(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;
|
||||
|
||||
|
@ -183,9 +183,9 @@ VARIANT_ENUM_CAST(Camera3D::Projection);
|
|||
VARIANT_ENUM_CAST(Camera3D::KeepAspect);
|
||||
VARIANT_ENUM_CAST(Camera3D::DopplerTracking);
|
||||
|
||||
class ClippedCamera : public Camera3D {
|
||||
class ClippedCamera3D : public Camera3D {
|
||||
|
||||
GDCLASS(ClippedCamera, Camera3D);
|
||||
GDCLASS(ClippedCamera3D, Camera3D);
|
||||
|
||||
public:
|
||||
enum ProcessMode {
|
||||
|
@ -238,9 +238,9 @@ public:
|
|||
|
||||
float get_clip_offset() const;
|
||||
|
||||
ClippedCamera();
|
||||
~ClippedCamera();
|
||||
ClippedCamera3D();
|
||||
~ClippedCamera3D();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(ClippedCamera::ProcessMode);
|
||||
VARIANT_ENUM_CAST(ClippedCamera3D::ProcessMode);
|
||||
#endif
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "scene/resources/capsule_shape_3d.h"
|
||||
#include "scene/resources/concave_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/world_margin_shape_3d.h"
|
||||
#include "servers/visual_server.h"
|
||||
|
|
|
@ -507,10 +507,10 @@ bool Node3D::is_set_as_toplevel() const {
|
|||
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(!data.viewport, Ref<World>());
|
||||
ERR_FAIL_COND_V(!is_inside_world(), Ref<World3D>());
|
||||
ERR_FAIL_COND_V(!data.viewport, Ref<World3D>());
|
||||
|
||||
return data.viewport->find_world();
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
|
||||
Node3D *get_parent_spatial() const;
|
||||
|
||||
Ref<World> get_world() const;
|
||||
Ref<World3D> get_world() const;
|
||||
|
||||
void set_translation(const Vector3 &p_translation);
|
||||
void set_rotation(const Vector3 &p_euler_rad);
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "servers/navigation_server.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/plugins/spatial_editor_plugin.h"
|
||||
#include "editor/plugins/node_3d_editor_plugin.h"
|
||||
#endif
|
||||
|
||||
Vector3 PhysicsBody3D::get_linear_velocity() const {
|
||||
|
|
|
@ -196,7 +196,7 @@ void RayCast3D::_notification(int p_what) {
|
|||
}
|
||||
|
||||
void RayCast3D::_update_raycast_state() {
|
||||
Ref<World> w3d = get_world();
|
||||
Ref<World3D> w3d = get_world();
|
||||
ERR_FAIL_COND(w3d.is_null());
|
||||
|
||||
PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* skeleton_ik.cpp */
|
||||
/* skeleton_ik_3d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -32,7 +32,7 @@
|
|||
* @author AndreaCatania
|
||||
*/
|
||||
|
||||
#include "skeleton_ik.h"
|
||||
#include "skeleton_ik_3d.h"
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* skeleton_ik.h */
|
||||
/* skeleton_ik_3d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* vehicle_body.cpp */
|
||||
/* vehicle_body_3d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,7 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "vehicle_body.h"
|
||||
#include "vehicle_body_3d.h"
|
||||
|
||||
#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) {
|
||||
|
||||
VehicleBody *cb = Object::cast_to<VehicleBody>(get_parent());
|
||||
VehicleBody3D *cb = Object::cast_to<VehicleBody3D>(get_parent());
|
||||
if (!cb)
|
||||
return;
|
||||
body = cb;
|
||||
|
@ -95,7 +95,7 @@ void VehicleWheel::_notification(int p_what) {
|
|||
}
|
||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
||||
|
||||
VehicleBody *cb = Object::cast_to<VehicleBody>(get_parent());
|
||||
VehicleBody3D *cb = Object::cast_to<VehicleBody3D>(get_parent());
|
||||
if (!cb)
|
||||
return;
|
||||
cb->wheels.erase(this);
|
||||
|
@ -103,15 +103,15 @@ void VehicleWheel::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
|
||||
String VehicleWheel::get_configuration_warning() const {
|
||||
if (!Object::cast_to<VehicleBody>(get_parent())) {
|
||||
String VehicleWheel3D::get_configuration_warning() const {
|
||||
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 String();
|
||||
}
|
||||
|
||||
void VehicleWheel::_update(PhysicsDirectBodyState *s) {
|
||||
void VehicleWheel3D::_update(PhysicsDirectBodyState *s) {
|
||||
|
||||
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;
|
||||
update_gizmo();
|
||||
}
|
||||
|
||||
float VehicleWheel::get_radius() const {
|
||||
float VehicleWheel3D::get_radius() const {
|
||||
|
||||
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;
|
||||
update_gizmo();
|
||||
}
|
||||
float VehicleWheel::get_suspension_rest_length() const {
|
||||
float VehicleWheel3D::get_suspension_rest_length() const {
|
||||
|
||||
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;
|
||||
}
|
||||
float VehicleWheel::get_suspension_travel() const {
|
||||
float VehicleWheel3D::get_suspension_travel() const {
|
||||
|
||||
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;
|
||||
}
|
||||
float VehicleWheel::get_suspension_stiffness() const {
|
||||
float VehicleWheel3D::get_suspension_stiffness() const {
|
||||
|
||||
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;
|
||||
}
|
||||
float VehicleWheel::get_suspension_max_force() const {
|
||||
float VehicleWheel3D::get_suspension_max_force() const {
|
||||
|
||||
return m_maxSuspensionForce;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_damping_compression(float p_value) {
|
||||
void VehicleWheel3D::set_damping_compression(float p_value) {
|
||||
|
||||
m_wheelsDampingCompression = p_value;
|
||||
}
|
||||
float VehicleWheel::get_damping_compression() const {
|
||||
float VehicleWheel3D::get_damping_compression() const {
|
||||
|
||||
return m_wheelsDampingCompression;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_damping_relaxation(float p_value) {
|
||||
void VehicleWheel3D::set_damping_relaxation(float p_value) {
|
||||
|
||||
m_wheelsDampingRelaxation = p_value;
|
||||
}
|
||||
float VehicleWheel::get_damping_relaxation() const {
|
||||
float VehicleWheel3D::get_damping_relaxation() const {
|
||||
|
||||
return m_wheelsDampingRelaxation;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_friction_slip(float p_value) {
|
||||
void VehicleWheel3D::set_friction_slip(float p_value) {
|
||||
|
||||
m_frictionSlip = p_value;
|
||||
}
|
||||
float VehicleWheel::get_friction_slip() const {
|
||||
float VehicleWheel3D::get_friction_slip() const {
|
||||
|
||||
return m_frictionSlip;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_roll_influence(float p_value) {
|
||||
void VehicleWheel3D::set_roll_influence(float p_value) {
|
||||
m_rollInfluence = p_value;
|
||||
}
|
||||
|
||||
float VehicleWheel::get_roll_influence() const {
|
||||
float VehicleWheel3D::get_roll_influence() const {
|
||||
return m_rollInfluence;
|
||||
}
|
||||
|
||||
bool VehicleWheel::is_in_contact() const {
|
||||
bool VehicleWheel3D::is_in_contact() const {
|
||||
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("get_radius"), &VehicleWheel::get_radius);
|
||||
ClassDB::bind_method(D_METHOD("set_radius", "length"), &VehicleWheel3D::set_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("get_suspension_rest_length"), &VehicleWheel::get_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"), &VehicleWheel3D::get_suspension_rest_length);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_suspension_travel", "length"), &VehicleWheel::set_suspension_travel);
|
||||
ClassDB::bind_method(D_METHOD("get_suspension_travel"), &VehicleWheel::get_suspension_travel);
|
||||
ClassDB::bind_method(D_METHOD("set_suspension_travel", "length"), &VehicleWheel3D::set_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("get_suspension_stiffness"), &VehicleWheel::get_suspension_stiffness);
|
||||
ClassDB::bind_method(D_METHOD("set_suspension_stiffness", "length"), &VehicleWheel3D::set_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("get_suspension_max_force"), &VehicleWheel::get_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"), &VehicleWheel3D::get_suspension_max_force);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_damping_compression", "length"), &VehicleWheel::set_damping_compression);
|
||||
ClassDB::bind_method(D_METHOD("get_damping_compression"), &VehicleWheel::get_damping_compression);
|
||||
ClassDB::bind_method(D_METHOD("set_damping_compression", "length"), &VehicleWheel3D::set_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("get_damping_relaxation"), &VehicleWheel::get_damping_relaxation);
|
||||
ClassDB::bind_method(D_METHOD("set_damping_relaxation", "length"), &VehicleWheel3D::set_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("is_used_as_traction"), &VehicleWheel::is_used_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"), &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("is_used_as_steering"), &VehicleWheel::is_used_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"), &VehicleWheel3D::is_used_as_steering);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_friction_slip", "length"), &VehicleWheel::set_friction_slip);
|
||||
ClassDB::bind_method(D_METHOD("get_friction_slip"), &VehicleWheel::get_friction_slip);
|
||||
ClassDB::bind_method(D_METHOD("set_friction_slip", "length"), &VehicleWheel3D::set_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("get_roll_influence"), &VehicleWheel::get_roll_influence);
|
||||
ClassDB::bind_method(D_METHOD("set_roll_influence", "roll_influence"), &VehicleWheel3D::set_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("get_engine_force"), &VehicleWheel::get_engine_force);
|
||||
ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleWheel3D::set_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("get_brake"), &VehicleWheel::get_brake);
|
||||
ClassDB::bind_method(D_METHOD("set_brake", "brake"), &VehicleWheel3D::set_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("get_steering"), &VehicleWheel::get_steering);
|
||||
ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleWheel3D::set_steering);
|
||||
ClassDB::bind_method(D_METHOD("get_steering"), &VehicleWheel3D::get_steering);
|
||||
|
||||
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");
|
||||
|
@ -302,65 +302,65 @@ void VehicleWheel::_bind_methods() {
|
|||
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;
|
||||
}
|
||||
|
||||
float VehicleWheel::get_engine_force() const {
|
||||
float VehicleWheel3D::get_engine_force() const {
|
||||
|
||||
return m_engineForce;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_brake(float p_brake) {
|
||||
void VehicleWheel3D::set_brake(float p_brake) {
|
||||
|
||||
m_brake = p_brake;
|
||||
}
|
||||
float VehicleWheel::get_brake() const {
|
||||
float VehicleWheel3D::get_brake() const {
|
||||
|
||||
return m_brake;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_steering(float p_steering) {
|
||||
void VehicleWheel3D::set_steering(float p_steering) {
|
||||
|
||||
m_steering = p_steering;
|
||||
}
|
||||
float VehicleWheel::get_steering() const {
|
||||
float VehicleWheel3D::get_steering() const {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
bool VehicleWheel::is_used_as_traction() const {
|
||||
bool VehicleWheel3D::is_used_as_traction() const {
|
||||
|
||||
return engine_traction;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_use_as_steering(bool p_enabled) {
|
||||
void VehicleWheel3D::set_use_as_steering(bool p_enabled) {
|
||||
|
||||
steers = p_enabled;
|
||||
}
|
||||
|
||||
bool VehicleWheel::is_used_as_steering() const {
|
||||
bool VehicleWheel3D::is_used_as_steering() const {
|
||||
|
||||
return steers;
|
||||
}
|
||||
|
||||
float VehicleWheel::get_skidinfo() const {
|
||||
float VehicleWheel3D::get_skidinfo() const {
|
||||
|
||||
return m_skidInfo;
|
||||
}
|
||||
|
||||
float VehicleWheel::get_rpm() const {
|
||||
float VehicleWheel3D::get_rpm() const {
|
||||
|
||||
return m_rpm;
|
||||
}
|
||||
|
||||
VehicleWheel::VehicleWheel() {
|
||||
VehicleWheel3D::VehicleWheel3D() {
|
||||
|
||||
steers = false;
|
||||
engine_traction = false;
|
||||
|
@ -388,7 +388,7 @@ VehicleWheel::VehicleWheel() {
|
|||
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;
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -513,12 +513,12 @@ real_t VehicleBody::_ray_cast(int p_idx, PhysicsDirectBodyState *s) {
|
|||
return depth;
|
||||
}
|
||||
|
||||
void VehicleBody::_update_suspension(PhysicsDirectBodyState *s) {
|
||||
void VehicleBody3D::_update_suspension(PhysicsDirectBodyState *s) {
|
||||
|
||||
real_t chassisMass = mass;
|
||||
|
||||
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) {
|
||||
real_t force;
|
||||
|
@ -558,7 +558,7 @@ void VehicleBody::_update_suspension(PhysicsDirectBodyState *s) {
|
|||
}
|
||||
|
||||
//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) {
|
||||
|
||||
real_t normalLenSqr = normal.length_squared();
|
||||
|
@ -636,7 +636,7 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec
|
|||
#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_body1(body1),
|
||||
m_frictionPositionWorld(frictionPosWorld),
|
||||
|
@ -667,7 +667,7 @@ VehicleBody::btVehicleWheelContactPoint::btVehicleWheelContactPoint(PhysicsDirec
|
|||
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;
|
||||
|
||||
|
@ -698,7 +698,7 @@ real_t VehicleBody::_calc_rolling_friction(btVehicleWheelContactPoint &contactPo
|
|||
}
|
||||
|
||||
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
|
||||
int numWheel = wheels.size();
|
||||
|
@ -720,7 +720,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
|
|||
|
||||
for (int i = 0; i < wheels.size(); i++) {
|
||||
|
||||
VehicleWheel &wheelInfo = *wheels[i];
|
||||
VehicleWheel3D &wheelInfo = *wheels[i];
|
||||
|
||||
if (wheelInfo.m_raycastInfo.m_isInContact) {
|
||||
|
||||
|
@ -754,7 +754,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
|
|||
bool sliding = false;
|
||||
{
|
||||
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;
|
||||
|
||||
|
@ -816,7 +816,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
|
|||
// apply the impulses
|
||||
{
|
||||
for (int wheel = 0; wheel < wheels.size(); wheel++) {
|
||||
VehicleWheel &wheelInfo = *wheels[wheel];
|
||||
VehicleWheel3D &wheelInfo = *wheels[wheel];
|
||||
|
||||
Vector3 rel_pos = wheelInfo.m_raycastInfo.m_contactPointWS -
|
||||
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);
|
||||
|
||||
|
@ -874,7 +874,7 @@ void VehicleBody::_direct_state_changed(Object *p_state) {
|
|||
for (int i = 0; i < wheels.size(); i++) {
|
||||
|
||||
//apply suspension force
|
||||
VehicleWheel &wheel = *wheels[i];
|
||||
VehicleWheel3D &wheel = *wheels[i];
|
||||
|
||||
real_t suspensionForce = wheel.m_wheelsSuspensionForce;
|
||||
|
||||
|
@ -891,7 +891,7 @@ void VehicleBody::_direct_state_changed(Object *p_state) {
|
|||
_update_friction(state);
|
||||
|
||||
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 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;
|
||||
}
|
||||
|
||||
void VehicleBody::set_engine_force(float p_engine_force) {
|
||||
void VehicleBody3D::set_engine_force(float p_engine_force) {
|
||||
|
||||
engine_force = p_engine_force;
|
||||
for (int i = 0; i < wheels.size(); i++) {
|
||||
VehicleWheel &wheelInfo = *wheels[i];
|
||||
VehicleWheel3D &wheelInfo = *wheels[i];
|
||||
if (wheelInfo.engine_traction)
|
||||
wheelInfo.m_engineForce = p_engine_force;
|
||||
}
|
||||
}
|
||||
|
||||
float VehicleBody::get_engine_force() const {
|
||||
float VehicleBody3D::get_engine_force() const {
|
||||
|
||||
return engine_force;
|
||||
}
|
||||
|
||||
void VehicleBody::set_brake(float p_brake) {
|
||||
void VehicleBody3D::set_brake(float p_brake) {
|
||||
|
||||
brake = p_brake;
|
||||
for (int i = 0; i < wheels.size(); i++) {
|
||||
VehicleWheel &wheelInfo = *wheels[i];
|
||||
VehicleWheel3D &wheelInfo = *wheels[i];
|
||||
wheelInfo.m_brake = p_brake;
|
||||
}
|
||||
}
|
||||
float VehicleBody::get_brake() const {
|
||||
float VehicleBody3D::get_brake() const {
|
||||
|
||||
return brake;
|
||||
}
|
||||
|
||||
void VehicleBody::set_steering(float p_steering) {
|
||||
void VehicleBody3D::set_steering(float p_steering) {
|
||||
|
||||
m_steeringValue = p_steering;
|
||||
for (int i = 0; i < wheels.size(); i++) {
|
||||
VehicleWheel &wheelInfo = *wheels[i];
|
||||
VehicleWheel3D &wheelInfo = *wheels[i];
|
||||
if (wheelInfo.steers)
|
||||
wheelInfo.m_steering = p_steering;
|
||||
}
|
||||
}
|
||||
float VehicleBody::get_steering() const {
|
||||
float VehicleBody3D::get_steering() const {
|
||||
|
||||
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("get_engine_force"), &VehicleBody::get_engine_force);
|
||||
ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleBody3D::set_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("get_brake"), &VehicleBody::get_brake);
|
||||
ClassDB::bind_method(D_METHOD("set_brake", "brake"), &VehicleBody3D::set_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("get_steering"), &VehicleBody::get_steering);
|
||||
ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleBody3D::set_steering);
|
||||
ClassDB::bind_method(D_METHOD("get_steering"), &VehicleBody3D::get_steering);
|
||||
|
||||
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");
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
VehicleBody::VehicleBody() {
|
||||
VehicleBody3D::VehicleBody3D() {
|
||||
|
||||
m_pitchControl = 0;
|
||||
m_currentVehicleSpeedKmHour = real_t(0.);
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* vehicle_body.h */
|
||||
/* vehicle_body_3d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -33,13 +33,13 @@
|
|||
|
||||
#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 local_xform;
|
||||
|
@ -61,7 +61,7 @@ class VehicleWheel : public Node3D {
|
|||
real_t m_maxSuspensionForce;
|
||||
bool m_bIsFrontWheel;
|
||||
|
||||
VehicleBody *body;
|
||||
VehicleBody3D *body;
|
||||
|
||||
//btVector3 m_wheelAxleCS; // const or modified by steering ?
|
||||
|
||||
|
@ -148,12 +148,12 @@ public:
|
|||
|
||||
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 brake;
|
||||
|
@ -186,11 +186,11 @@ class VehicleBody : public RigidBody3D {
|
|||
void _update_friction(PhysicsDirectBodyState *s);
|
||||
void _update_suspension(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);
|
||||
|
||||
friend class VehicleWheel;
|
||||
Vector<VehicleWheel *> wheels;
|
||||
friend class VehicleWheel3D;
|
||||
Vector<VehicleWheel3D *> wheels;
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
void set_steering(float p_steering);
|
||||
float get_steering() const;
|
||||
|
||||
VehicleBody();
|
||||
VehicleBody3D();
|
||||
};
|
||||
|
||||
#endif // VEHICLE_BODY_H
|
|
@ -33,8 +33,8 @@
|
|||
|
||||
#include "core/math/transform_2d.h"
|
||||
#include "core/rid.h"
|
||||
#include "scene/2d/canvas_item.h"
|
||||
#include "scene/gui/shortcut.h"
|
||||
#include "scene/main/canvas_item.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/main/timer.h"
|
||||
#include "scene/resources/theme.h"
|
||||
|
|
|
@ -1410,7 +1410,7 @@ SceneTree::SceneTree() {
|
|||
root = memnew(Window);
|
||||
root->set_name("root");
|
||||
if (!root->get_world().is_valid())
|
||||
root->set_world(Ref<World>(memnew(World)));
|
||||
root->set_world(Ref<World3D>(memnew(World3D)));
|
||||
|
||||
// Initialize network state
|
||||
multiplayer_poll = true;
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
#include "core/os/thread_safe.h"
|
||||
#include "core/self_list.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "scene/resources/world.h"
|
||||
#include "scene/resources/world_2d.h"
|
||||
#include "scene/resources/world_3d.h"
|
||||
|
||||
#undef Window
|
||||
|
||||
|
|
|
@ -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)
|
||||
return;
|
||||
|
@ -1304,7 +1304,7 @@ void Viewport::set_world(const Ref<World> &p_world) {
|
|||
own_world = world->duplicate();
|
||||
world->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
|
||||
} 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();
|
||||
}
|
||||
|
||||
Ref<World> Viewport::get_world() const {
|
||||
Ref<World3D> Viewport::get_world() const {
|
||||
|
||||
return world;
|
||||
}
|
||||
|
@ -1328,7 +1328,7 @@ Ref<World2D> Viewport::get_world_2d() const {
|
|||
return world_2d;
|
||||
}
|
||||
|
||||
Ref<World> Viewport::find_world() const {
|
||||
Ref<World3D> Viewport::find_world() const {
|
||||
|
||||
if (own_world.is_valid())
|
||||
return own_world;
|
||||
|
@ -1337,7 +1337,7 @@ Ref<World> Viewport::find_world() const {
|
|||
else if (parent)
|
||||
return parent->find_world();
|
||||
else
|
||||
return Ref<World>();
|
||||
return Ref<World3D>();
|
||||
}
|
||||
|
||||
Listener3D *Viewport::get_listener() const {
|
||||
|
@ -3092,7 +3092,7 @@ void Viewport::set_use_own_world(bool p_world) {
|
|||
_propagate_exit_world(this);
|
||||
|
||||
if (!p_world) {
|
||||
own_world = Ref<World>();
|
||||
own_world = Ref<World3D>();
|
||||
if (world.is_valid()) {
|
||||
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();
|
||||
world->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
|
||||
} else {
|
||||
own_world = Ref<World>(memnew(World));
|
||||
own_world = Ref<World3D>(memnew(World3D));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -245,8 +245,8 @@ private:
|
|||
Map<ObjectID, uint64_t> physics_2d_mouseover;
|
||||
|
||||
Ref<World2D> world_2d;
|
||||
Ref<World> world;
|
||||
Ref<World> own_world;
|
||||
Ref<World3D> world;
|
||||
Ref<World3D> own_world;
|
||||
|
||||
Rect2i to_screen_rect;
|
||||
StringName input_group;
|
||||
|
@ -467,10 +467,10 @@ public:
|
|||
Rect2 get_visible_rect() 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);
|
||||
Ref<World> get_world() const;
|
||||
Ref<World> find_world() const;
|
||||
Ref<World3D> get_world() const;
|
||||
Ref<World3D> find_world() const;
|
||||
|
||||
Ref<World2D> get_world_2d() const;
|
||||
Ref<World2D> find_world_2d() const;
|
||||
|
|
|
@ -38,11 +38,11 @@
|
|||
#include "scene/2d/audio_stream_player_2d.h"
|
||||
#include "scene/2d/back_buffer_copy.h"
|
||||
#include "scene/2d/camera_2d.h"
|
||||
#include "scene/2d/canvas_item.h"
|
||||
#include "scene/2d/canvas_modulate.h"
|
||||
#include "scene/2d/collision_polygon_2d.h"
|
||||
#include "scene/2d/collision_shape_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/light_2d.h"
|
||||
#include "scene/2d/light_occluder_2d.h"
|
||||
|
@ -54,7 +54,6 @@
|
|||
#include "scene/2d/navigation_obstacle_2d.h"
|
||||
#include "scene/2d/parallax_background.h"
|
||||
#include "scene/2d/parallax_layer.h"
|
||||
#include "scene/2d/particles_2d.h"
|
||||
#include "scene/2d/path_2d.h"
|
||||
#include "scene/2d/physics_body_2d.h"
|
||||
#include "scene/2d/polygon_2d.h"
|
||||
|
@ -121,6 +120,7 @@
|
|||
#include "scene/gui/tree.h"
|
||||
#include "scene/gui/video_player.h"
|
||||
#include "scene/gui/viewport_container.h"
|
||||
#include "scene/main/canvas_item.h"
|
||||
#include "scene/main/canvas_layer.h"
|
||||
#include "scene/main/http_request.h"
|
||||
#include "scene/main/instance_placeholder.h"
|
||||
|
@ -143,7 +143,7 @@
|
|||
#include "scene/resources/default_theme/default_theme.h"
|
||||
#include "scene/resources/dynamic_font.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/material.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
|
@ -154,7 +154,7 @@
|
|||
#include "scene/resources/physics_material.h"
|
||||
#include "scene/resources/polygon_path_finder.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/resource_format_text.h"
|
||||
#include "scene/resources/segment_shape_2d.h"
|
||||
|
@ -168,8 +168,8 @@
|
|||
#include "scene/resources/video_stream.h"
|
||||
#include "scene/resources/visual_shader.h"
|
||||
#include "scene/resources/visual_shader_nodes.h"
|
||||
#include "scene/resources/world.h"
|
||||
#include "scene/resources/world_2d.h"
|
||||
#include "scene/resources/world_3d.h"
|
||||
#include "scene/resources/world_margin_shape_3d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
|
@ -206,13 +206,13 @@
|
|||
#include "scene/3d/ray_cast_3d.h"
|
||||
#include "scene/3d/reflection_probe.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/spring_arm_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/world_environment.h"
|
||||
#include "scene/animation/skeleton_ik.h"
|
||||
#include "scene/resources/environment.h"
|
||||
#include "scene/resources/mesh_library.h"
|
||||
#endif
|
||||
|
@ -279,6 +279,7 @@ void register_scene_types() {
|
|||
ClassDB::register_class<Window>();
|
||||
|
||||
/* REGISTER GUI */
|
||||
|
||||
ClassDB::register_class<ButtonGroup>();
|
||||
ClassDB::register_virtual_class<BaseButton>();
|
||||
|
||||
|
@ -335,7 +336,6 @@ void register_scene_types() {
|
|||
ClassDB::register_class<VideoPlayer>();
|
||||
|
||||
#ifndef ADVANCED_GUI_DISABLED
|
||||
|
||||
ClassDB::register_class<FileDialog>();
|
||||
|
||||
ClassDB::register_class<PopupMenu>();
|
||||
|
@ -351,9 +351,10 @@ void register_scene_types() {
|
|||
ClassDB::register_class<RichTextLabel>();
|
||||
ClassDB::register_class<RichTextEffect>();
|
||||
ClassDB::register_class<CharFXTransform>();
|
||||
;
|
||||
|
||||
ClassDB::register_class<AcceptDialog>();
|
||||
ClassDB::register_class<ConfirmationDialog>();
|
||||
|
||||
ClassDB::register_class<MarginContainer>();
|
||||
ClassDB::register_class<ViewportContainer>();
|
||||
ClassDB::register_virtual_class<SplitContainer>();
|
||||
|
@ -364,6 +365,7 @@ void register_scene_types() {
|
|||
|
||||
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
|
||||
|
||||
/* REGISTER 3D */
|
||||
|
@ -405,7 +407,7 @@ void register_scene_types() {
|
|||
ClassDB::register_virtual_class<VisualInstance3D>();
|
||||
ClassDB::register_virtual_class<GeometryInstance3D>();
|
||||
ClassDB::register_class<Camera3D>();
|
||||
ClassDB::register_class<ClippedCamera>();
|
||||
ClassDB::register_class<ClippedCamera3D>();
|
||||
ClassDB::register_class<Listener3D>();
|
||||
ClassDB::register_class<ARVRCamera>();
|
||||
ClassDB::register_class<ARVRController>();
|
||||
|
@ -448,8 +450,8 @@ void register_scene_types() {
|
|||
ClassDB::register_class<SkeletonIK3D>();
|
||||
ClassDB::register_class<BoneAttachment3D>();
|
||||
|
||||
ClassDB::register_class<VehicleBody>();
|
||||
ClassDB::register_class<VehicleWheel>();
|
||||
ClassDB::register_class<VehicleBody3D>();
|
||||
ClassDB::register_class<VehicleWheel3D>();
|
||||
ClassDB::register_class<Area3D>();
|
||||
ClassDB::register_class<ProximityGroup3D>();
|
||||
ClassDB::register_class<CollisionShape3D>();
|
||||
|
@ -478,11 +480,9 @@ void register_scene_types() {
|
|||
ClassDB::register_class<NavigationObstacle3D>();
|
||||
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
#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<VisualShader>();
|
||||
|
@ -556,12 +556,13 @@ void register_scene_types() {
|
|||
ClassDB::register_class<CanvasItemMaterial>();
|
||||
SceneTree::add_idle_callback(CanvasItemMaterial::flush_changes);
|
||||
CanvasItemMaterial::init_shaders();
|
||||
|
||||
/* REGISTER 2D */
|
||||
|
||||
ClassDB::register_class<Node2D>();
|
||||
ClassDB::register_class<CPUParticles2D>();
|
||||
ClassDB::register_class<Particles2D>();
|
||||
//ClassDB::register_class<ParticleAttractor2D>();
|
||||
ClassDB::register_class<GPUParticles2D>();
|
||||
ClassDB::register_class<Sprite2D>();
|
||||
//ClassDB::register_type<ViewportSprite>();
|
||||
ClassDB::register_class<SpriteFrames>();
|
||||
ClassDB::register_class<AnimatedSprite2D>();
|
||||
ClassDB::register_class<Position2D>();
|
||||
|
@ -649,7 +650,7 @@ void register_scene_types() {
|
|||
ClassDB::register_class<BoxShape3D>();
|
||||
ClassDB::register_class<CapsuleShape3D>();
|
||||
ClassDB::register_class<CylinderShape3D>();
|
||||
ClassDB::register_class<HeightMapShape>();
|
||||
ClassDB::register_class<HeightMapShape3D>();
|
||||
ClassDB::register_class<WorldMarginShape3D>();
|
||||
ClassDB::register_class<ConvexPolygonShape3D>();
|
||||
ClassDB::register_class<ConcavePolygonShape3D>();
|
||||
|
@ -657,10 +658,10 @@ void register_scene_types() {
|
|||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
ClassDB::register_class<VelocityTracker3D>();
|
||||
|
||||
#endif
|
||||
|
||||
ClassDB::register_class<PhysicsMaterial>();
|
||||
ClassDB::register_class<World>();
|
||||
ClassDB::register_class<World3D>();
|
||||
ClassDB::register_class<Environment>();
|
||||
ClassDB::register_class<CameraEffects>();
|
||||
ClassDB::register_class<World2D>();
|
||||
|
@ -729,6 +730,7 @@ void register_scene_types() {
|
|||
ClassDB::register_class<Path2D>();
|
||||
ClassDB::register_class<PathFollow2D>();
|
||||
|
||||
ClassDB::register_class<NavigationMesh>();
|
||||
ClassDB::register_class<Navigation2D>();
|
||||
ClassDB::register_class<NavigationPolygon>();
|
||||
ClassDB::register_class<NavigationRegion2D>();
|
||||
|
@ -744,90 +746,79 @@ void register_scene_types() {
|
|||
ClassDB::register_virtual_class<SceneTreeTimer>(); //sorry, you can't create it
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
|
||||
ClassDB::add_compatibility_class("AnimatedSprite", "AnimatedSprite2D");
|
||||
ClassDB::add_compatibility_class("Sprite", "Sprite2D");
|
||||
|
||||
ClassDB::add_compatibility_class("SpatialMaterial", "StandardMaterial3D");
|
||||
ClassDB::add_compatibility_class("Mesh", "ArrayMesh");
|
||||
// Dropped in 4.0, near approximation.
|
||||
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("BoneAttachment", "BoneAttachment3D");
|
||||
ClassDB::add_compatibility_class("BoxShape", "BoxShape3D");
|
||||
ClassDB::add_compatibility_class("Camera", "Camera3D");
|
||||
|
||||
ClassDB::add_compatibility_class("Particles", "GPUParticles3D");
|
||||
ClassDB::add_compatibility_class("CapsuleShape", "CapsuleShape3D");
|
||||
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("Particles2D", "GPUParticles2D");
|
||||
|
||||
ClassDB::add_compatibility_class("Light", "Light3D");
|
||||
ClassDB::add_compatibility_class("CylinderShape", "CylinderShape3D");
|
||||
ClassDB::add_compatibility_class("DirectionalLight", "DirectionalLight3D");
|
||||
ClassDB::add_compatibility_class("SpotLight", "SpotLight3D");
|
||||
ClassDB::add_compatibility_class("OmniLight", "OmniLight3D");
|
||||
|
||||
ClassDB::add_compatibility_class("Generic6DOFJoint", "Generic6DOFJoint3D");
|
||||
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("MeshInstance", "MeshInstance3D");
|
||||
ClassDB::add_compatibility_class("MultiMeshInstance", "MultiMeshInstance3D");
|
||||
ClassDB::add_compatibility_class("ImmediateGeometry", "ImmediateGeometry3D");
|
||||
|
||||
ClassDB::add_compatibility_class("Navigation", "Navigation3D");
|
||||
ClassDB::add_compatibility_class("NavigationAgent", "NavigationAgent3D");
|
||||
ClassDB::add_compatibility_class("NavigationMeshInstance", "NavigationRegion3D");
|
||||
ClassDB::add_compatibility_class("NavigationObstacle", "NavigationObstacle3D");
|
||||
ClassDB::add_compatibility_class("NavigationPolygonInstance", "NavigationRegion2D");
|
||||
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("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("RayCast", "RayCast3D");
|
||||
ClassDB::add_compatibility_class("RayShape", "RayShape3D");
|
||||
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("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("HingeJoint", "HingeJoint3D");
|
||||
ClassDB::add_compatibility_class("ConeTwistJoint", "ConeTwistJoint3D");
|
||||
ClassDB::add_compatibility_class("Generic6DOFJoint", "Generic6DOFJoint3D");
|
||||
|
||||
ClassDB::add_compatibility_class("SoftBody", "SoftBody3D");
|
||||
ClassDB::add_compatibility_class("Spatial", "Node3D");
|
||||
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
|
||||
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* height_map_shape.cpp */
|
||||
/* height_map_shape_3d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,10 +28,10 @@
|
|||
/* 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"
|
||||
|
||||
Vector<Vector3> HeightMapShape::get_debug_mesh_lines() {
|
||||
Vector<Vector3> HeightMapShape3D::get_debug_mesh_lines() {
|
||||
Vector<Vector3> points;
|
||||
|
||||
if ((map_width != 0) && (map_depth != 0)) {
|
||||
|
@ -76,11 +76,11 @@ Vector<Vector3> HeightMapShape::get_debug_mesh_lines() {
|
|||
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();
|
||||
}
|
||||
|
||||
void HeightMapShape::_update_shape() {
|
||||
void HeightMapShape3D::_update_shape() {
|
||||
|
||||
Dictionary d;
|
||||
d["width"] = map_width;
|
||||
|
@ -92,7 +92,7 @@ void HeightMapShape::_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) {
|
||||
// ignore
|
||||
} 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;
|
||||
}
|
||||
|
||||
void HeightMapShape::set_map_depth(int p_new) {
|
||||
void HeightMapShape3D::set_map_depth(int p_new) {
|
||||
if (p_new < 1) {
|
||||
// ignore
|
||||
} 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;
|
||||
}
|
||||
|
||||
void HeightMapShape::set_map_data(PackedFloat32Array p_new) {
|
||||
void HeightMapShape3D::set_map_data(PackedFloat32Array p_new) {
|
||||
int size = (map_width * map_depth);
|
||||
if (p_new.size() != size) {
|
||||
// fail
|
||||
|
@ -174,24 +174,24 @@ void HeightMapShape::set_map_data(PackedFloat32Array p_new) {
|
|||
_change_notify("map_data");
|
||||
}
|
||||
|
||||
PackedFloat32Array HeightMapShape::get_map_data() const {
|
||||
PackedFloat32Array HeightMapShape3D::get_map_data() const {
|
||||
return map_data;
|
||||
}
|
||||
|
||||
void HeightMapShape::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_map_width", "width"), &HeightMapShape::set_map_width);
|
||||
ClassDB::bind_method(D_METHOD("get_map_width"), &HeightMapShape::get_map_width);
|
||||
ClassDB::bind_method(D_METHOD("set_map_depth", "height"), &HeightMapShape::set_map_depth);
|
||||
ClassDB::bind_method(D_METHOD("get_map_depth"), &HeightMapShape::get_map_depth);
|
||||
ClassDB::bind_method(D_METHOD("set_map_data", "data"), &HeightMapShape::set_map_data);
|
||||
ClassDB::bind_method(D_METHOD("get_map_data"), &HeightMapShape::get_map_data);
|
||||
void HeightMapShape3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_map_width", "width"), &HeightMapShape3D::set_map_width);
|
||||
ClassDB::bind_method(D_METHOD("get_map_width"), &HeightMapShape3D::get_map_width);
|
||||
ClassDB::bind_method(D_METHOD("set_map_depth", "height"), &HeightMapShape3D::set_map_depth);
|
||||
ClassDB::bind_method(D_METHOD("get_map_depth"), &HeightMapShape3D::get_map_depth);
|
||||
ClassDB::bind_method(D_METHOD("set_map_data", "data"), &HeightMapShape3D::set_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_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");
|
||||
}
|
||||
|
||||
HeightMapShape::HeightMapShape() :
|
||||
HeightMapShape3D::HeightMapShape3D() :
|
||||
Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_HEIGHTMAP)) {
|
||||
|
||||
map_width = 2;
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* height_map_shape.h */
|
||||
/* height_map_shape_3d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -33,8 +33,8 @@
|
|||
|
||||
#include "scene/resources/shape_3d.h"
|
||||
|
||||
class HeightMapShape : public Shape3D {
|
||||
GDCLASS(HeightMapShape, Shape3D);
|
||||
class HeightMapShape3D : public Shape3D {
|
||||
GDCLASS(HeightMapShape3D, Shape3D);
|
||||
|
||||
int map_width;
|
||||
int map_depth;
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
virtual Vector<Vector3> get_debug_mesh_lines();
|
||||
virtual real_t get_enclosing_radius() const;
|
||||
|
||||
HeightMapShape();
|
||||
HeightMapShape3D();
|
||||
};
|
||||
|
||||
#endif /* !HEIGHT_MAP_SHAPE_H */
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* ray_shape.cpp */
|
||||
/* ray_shape_3d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,7 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "ray_shape.h"
|
||||
#include "ray_shape_3d.h"
|
||||
|
||||
#include "servers/physics_server.h"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* ray_shape.h */
|
||||
/* ray_shape_3d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
|
@ -29,7 +29,8 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "style_box.h"
|
||||
#include "scene/2d/canvas_item.h"
|
||||
|
||||
#include "scene/main/canvas_item.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "core/array.h"
|
||||
#include "core/resource.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/shape_2d.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* world.cpp */
|
||||
/* world_3d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,7 +28,7 @@
|
|||
/* 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/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
|
||||
indexer->_add_camera(p_camera);
|
||||
#endif
|
||||
}
|
||||
|
||||
void World::_update_camera(Camera3D *p_camera) {
|
||||
void World3D::_update_camera(Camera3D *p_camera) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
indexer->_update_camera(p_camera);
|
||||
#endif
|
||||
}
|
||||
void World::_remove_camera(Camera3D *p_camera) {
|
||||
void World3D::_remove_camera(Camera3D *p_camera) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
indexer->_remove_camera(p_camera);
|
||||
#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
|
||||
indexer->_notifier_add(p_notifier, p_rect);
|
||||
#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
|
||||
indexer->_notifier_update(p_notifier, p_rect);
|
||||
#endif
|
||||
}
|
||||
|
||||
void World::_remove_notifier(VisibilityNotifier3D *p_notifier) {
|
||||
void World3D::_remove_notifier(VisibilityNotifier3D *p_notifier) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
indexer->_notifier_remove(p_notifier);
|
||||
#endif
|
||||
}
|
||||
|
||||
void World::_update(uint64_t p_frame) {
|
||||
void World3D::_update(uint64_t p_frame) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
indexer->_update(p_frame);
|
||||
#endif
|
||||
}
|
||||
|
||||
RID World::get_space() const {
|
||||
RID World3D::get_space() const {
|
||||
|
||||
return space;
|
||||
}
|
||||
|
||||
RID World::get_scenario() const {
|
||||
RID World3D::get_scenario() const {
|
||||
|
||||
return scenario;
|
||||
}
|
||||
|
||||
void World::set_environment(const Ref<Environment> &p_environment) {
|
||||
void World3D::set_environment(const Ref<Environment> &p_environment) {
|
||||
if (environment == p_environment) {
|
||||
return;
|
||||
}
|
||||
|
@ -282,12 +282,12 @@ void World::set_environment(const Ref<Environment> &p_environment) {
|
|||
emit_changed();
|
||||
}
|
||||
|
||||
Ref<Environment> World::get_environment() const {
|
||||
Ref<Environment> World3D::get_environment() const {
|
||||
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
|
@ -301,12 +301,12 @@ void World::set_fallback_environment(const Ref<Environment> &p_environment) {
|
|||
emit_changed();
|
||||
}
|
||||
|
||||
Ref<Environment> World::get_fallback_environment() const {
|
||||
Ref<Environment> World3D::get_fallback_environment() const {
|
||||
|
||||
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;
|
||||
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());
|
||||
}
|
||||
|
||||
Ref<CameraEffects> World::get_camera_effects() const {
|
||||
Ref<CameraEffects> World3D::get_camera_effects() const {
|
||||
|
||||
return camera_effects;
|
||||
}
|
||||
|
||||
PhysicsDirectSpaceState *World::get_direct_space_state() {
|
||||
PhysicsDirectSpaceState *World3D::get_direct_space_state() {
|
||||
|
||||
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()) {
|
||||
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_scenario"), &World::get_scenario);
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "env"), &World::set_environment);
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &World::get_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World::set_fallback_environment);
|
||||
ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World::get_fallback_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_camera_effects", "env"), &World::set_camera_effects);
|
||||
ClassDB::bind_method(D_METHOD("get_camera_effects"), &World::get_camera_effects);
|
||||
ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World::get_direct_space_state);
|
||||
ClassDB::bind_method(D_METHOD("get_space"), &World3D::get_space);
|
||||
ClassDB::bind_method(D_METHOD("get_scenario"), &World3D::get_scenario);
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "env"), &World3D::set_environment);
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &World3D::get_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World3D::set_fallback_environment);
|
||||
ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World3D::get_fallback_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_camera_effects", "env"), &World3D::set_camera_effects);
|
||||
ClassDB::bind_method(D_METHOD("get_camera_effects"), &World3D::get_camera_effects);
|
||||
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, "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");
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
World::World() {
|
||||
World3D::World3D() {
|
||||
|
||||
space = PhysicsServer::get_singleton()->space_create();
|
||||
scenario = VisualServer::get_singleton()->scenario_create();
|
||||
|
@ -371,7 +371,7 @@ World::World() {
|
|||
#endif
|
||||
}
|
||||
|
||||
World::~World() {
|
||||
World3D::~World3D() {
|
||||
|
||||
PhysicsServer::get_singleton()->free(space);
|
||||
VisualServer::get_singleton()->free(scenario);
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* world.h */
|
||||
/* world_3d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,8 +28,8 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef WORLD_H
|
||||
#define WORLD_H
|
||||
#ifndef WORLD_3D_H
|
||||
#define WORLD_3D_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "scene/resources/environment.h"
|
||||
|
@ -40,9 +40,8 @@ class Camera3D;
|
|||
class VisibilityNotifier3D;
|
||||
struct SpatialIndexer;
|
||||
|
||||
class World : public Resource {
|
||||
GDCLASS(World, Resource);
|
||||
RES_BASE_EXTENSION("world");
|
||||
class World3D : public Resource {
|
||||
GDCLASS(World3D, Resource);
|
||||
|
||||
private:
|
||||
RID space;
|
||||
|
@ -85,8 +84,8 @@ public:
|
|||
|
||||
PhysicsDirectSpaceState *get_direct_space_state();
|
||||
|
||||
World();
|
||||
~World();
|
||||
World3D();
|
||||
~World3D();
|
||||
};
|
||||
|
||||
#endif // WORLD_H
|
||||
#endif // WORLD_3D_H
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include "core/object.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.
|
||||
class Navigation2DServer : public Object {
|
||||
|
|