diff options
author | Juan Linietsky <reduzio@gmail.com> | 2020-03-26 18:49:16 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-03-27 14:54:04 +0100 |
commit | eaae4b6408361eb34363adcb22a08046f43147f4 (patch) | |
tree | 4baf4cd8758696d260bef2cb149e27bf3135a284 /modules | |
parent | 9a7dbc2acafdd04ff0fe09bc5f4838b4920348a8 (diff) |
Renamed 2D and 3D nodes to make their types explicit
Fixes #30736.
Diffstat (limited to 'modules')
28 files changed, 502 insertions, 493 deletions
diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp index 682a7e33c8..1482fe99eb 100644 --- a/modules/assimp/editor_scene_importer_assimp.cpp +++ b/modules/assimp/editor_scene_importer_assimp.cpp @@ -32,9 +32,9 @@ #include "core/io/image_loader.h" #include "editor/import/resource_importer_scene.h" #include "import_utils.h" -#include "scene/3d/camera.h" -#include "scene/3d/light.h" -#include "scene/3d/mesh_instance.h" +#include "scene/3d/camera_3d.h" +#include "scene/3d/light_3d.h" +#include "scene/3d/mesh_instance_3d.h" #include "scene/main/node.h" #include "scene/resources/material.h" #include "scene/resources/surface_tool.h" @@ -297,7 +297,7 @@ aiBone *EditorSceneImporterAssimp::get_bone_from_stack(ImportState &state, aiStr return NULL; } -Spatial * +Node3D * EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, const uint32_t p_flags, int p_bake_fps, const int32_t p_max_bone_weights) { ERR_FAIL_COND_V(scene == NULL, NULL); @@ -343,7 +343,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, String node_name = AssimpUtils::get_assimp_string(element_assimp_node->mName); //print_verbose("node: " + node_name); - Spatial *spatial = NULL; + Node3D *spatial = NULL; Transform transform = AssimpUtils::assimp_matrix_transform(element_assimp_node->mTransformation); // retrieve this node bone @@ -356,7 +356,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, } else if (state.armature_nodes.find(element_assimp_node)) { // create skeleton print_verbose("Making skeleton: " + node_name); - Skeleton *skeleton = memnew(Skeleton); + Skeleton3D *skeleton = memnew(Skeleton3D); spatial = skeleton; if (!state.armature_skeletons.has(element_assimp_node)) { state.armature_skeletons.insert(element_assimp_node, skeleton); @@ -364,7 +364,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, } else if (bone != NULL) { continue; } else { - spatial = memnew(Spatial); + spatial = memnew(Node3D); } ERR_CONTINUE_MSG(spatial == NULL, "FBX Import - are we out of ram?"); @@ -381,11 +381,11 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, // flat node map parent lookup tool state.flat_node_map.insert(element_assimp_node, spatial); - Map<const aiNode *, Spatial *>::Element *parent_lookup = state.flat_node_map.find(parent_assimp_node); + Map<const aiNode *, Node3D *>::Element *parent_lookup = state.flat_node_map.find(parent_assimp_node); // note: this always fails on the root node :) keep that in mind this is by design if (parent_lookup) { - Spatial *parent_node = parent_lookup->value(); + Node3D *parent_node = parent_lookup->value(); ERR_FAIL_COND_V_MSG(parent_node == NULL, state.root, "Parent node invalid even though lookup successful, out of ram?"); @@ -435,7 +435,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, String bone_name = AssimpUtils::get_anim_string_from_assimp(bone->mName); ERR_CONTINUE_MSG(armature_for_bone == NULL, "Armature for bone invalid: " + bone_name); - Skeleton *skeleton = state.armature_skeletons[armature_for_bone]; + Skeleton3D *skeleton = state.armature_skeletons[armature_for_bone]; state.skeleton_bone_map[bone] = skeleton; @@ -464,11 +464,11 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, print_verbose("generating mesh phase from skeletal mesh"); - List<Spatial *> cleanup_template_nodes; + List<Node3D *> cleanup_template_nodes; - for (Map<const aiNode *, Spatial *>::Element *key_value_pair = state.flat_node_map.front(); key_value_pair; key_value_pair = key_value_pair->next()) { + for (Map<const aiNode *, Node3D *>::Element *key_value_pair = state.flat_node_map.front(); key_value_pair; key_value_pair = key_value_pair->next()) { const aiNode *assimp_node = key_value_pair->key(); - Spatial *mesh_template = key_value_pair->value(); + Node3D *mesh_template = key_value_pair->value(); ERR_CONTINUE(assimp_node == NULL); ERR_CONTINUE(mesh_template == NULL); @@ -488,7 +488,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, Transform node_transform = AssimpUtils::assimp_matrix_transform(assimp_node->mTransformation); if (assimp_node->mNumMeshes > 0) { - MeshInstance *mesh = create_mesh(state, assimp_node, node_name, parent_node, node_transform); + MeshInstance3D *mesh = create_mesh(state, assimp_node, node_name, parent_node, node_transform); if (mesh) { parent_node->remove_child(mesh_template); @@ -522,7 +522,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, } } - for (List<Spatial *>::Element *element = cleanup_template_nodes.front(); element; element = element->next()) { + for (List<Node3D *>::Element *element = cleanup_template_nodes.front(); element; element = element->next()) { if (element->get()) { memdelete(element->get()); } @@ -559,7 +559,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, void EditorSceneImporterAssimp::_insert_animation_track(ImportState &scene, const aiAnimation *assimp_anim, int track_id, int anim_fps, Ref<Animation> animation, float ticks_per_second, - Skeleton *skeleton, const NodePath &node_path, + Skeleton3D *skeleton, const NodePath &node_path, const String &node_name, aiBone *track_bone) { const aiNodeAnim *assimp_track = assimp_anim->mChannels[track_id]; //make transform track @@ -652,9 +652,9 @@ void EditorSceneImporterAssimp::_insert_animation_track(ImportState &scene, cons // I really do not like this but need to figure out a better way of removing it later. Node *EditorSceneImporterAssimp::get_node_by_name(ImportState &state, String name) { - for (Map<const aiNode *, Spatial *>::Element *key_value_pair = state.flat_node_map.front(); key_value_pair; key_value_pair = key_value_pair->next()) { + for (Map<const aiNode *, Node3D *>::Element *key_value_pair = state.flat_node_map.front(); key_value_pair; key_value_pair = key_value_pair->next()) { const aiNode *assimp_node = key_value_pair->key(); - Spatial *node = key_value_pair->value(); + Node3D *node = key_value_pair->value(); String node_name = AssimpUtils::get_assimp_string(assimp_node->mName); if (name == node_name && node) { @@ -747,7 +747,7 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim continue; //do not bother } - Skeleton *skeleton = NULL; + Skeleton3D *skeleton = NULL; NodePath node_path; aiBone *bone = NULL; @@ -805,7 +805,7 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim Node *item = get_node_by_name(state, mesh_name); ERR_CONTINUE_MSG(!item, "failed to look up node by name"); - const MeshInstance *mesh_instance = Object::cast_to<MeshInstance>(item); + const MeshInstance3D *mesh_instance = Object::cast_to<MeshInstance3D>(item); ERR_CONTINUE(mesh_instance == NULL); String base_path = state.root->get_path_to(mesh_instance); @@ -842,7 +842,7 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim Ref<Mesh> EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &state, const Vector<int> &p_surface_indices, const aiNode *assimp_node, Ref<Skin> &skin, - Skeleton *&skeleton_assigned) { + Skeleton3D *&skeleton_assigned) { Ref<ArrayMesh> mesh; mesh.instance(); @@ -1299,7 +1299,7 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat /** * Create a new mesh for the node supplied */ -MeshInstance * +MeshInstance3D * EditorSceneImporterAssimp::create_mesh(ImportState &state, const aiNode *assimp_node, const String &node_name, Node *active_node, Transform node_transform) { /* MESH NODE */ Ref<Mesh> mesh; @@ -1325,7 +1325,7 @@ EditorSceneImporterAssimp::create_mesh(ImportState &state, const aiNode *assimp_ mesh_key += itos(surface_indices[i]); } - Skeleton *skeleton = NULL; + Skeleton3D *skeleton = NULL; aiNode *armature = NULL; if (!state.mesh_cache.has(mesh_key)) { @@ -1333,7 +1333,7 @@ EditorSceneImporterAssimp::create_mesh(ImportState &state, const aiNode *assimp_ state.mesh_cache[mesh_key] = mesh; } - MeshInstance *mesh_node = memnew(MeshInstance); + MeshInstance3D *mesh_node = memnew(MeshInstance3D); mesh = state.mesh_cache[mesh_key]; mesh_node->set_mesh(mesh); @@ -1407,20 +1407,20 @@ EditorSceneImporterAssimp::create_mesh(ImportState &state, const aiNode *assimp_ * Create a light for the scene * Automatically caches lights for lookup later */ -Spatial *EditorSceneImporterAssimp::create_light( +Node3D *EditorSceneImporterAssimp::create_light( ImportState &state, const String &node_name, Transform &look_at_transform) { - Light *light = NULL; + Light3D *light = NULL; aiLight *assimp_light = state.assimp_scene->mLights[state.light_cache[node_name]]; ERR_FAIL_COND_V(!assimp_light, NULL); if (assimp_light->mType == aiLightSource_DIRECTIONAL) { - light = memnew(DirectionalLight); + light = memnew(DirectionalLight3D); } else if (assimp_light->mType == aiLightSource_POINT) { - light = memnew(OmniLight); + light = memnew(OmniLight3D); } else if (assimp_light->mType == aiLightSource_SPOT) { - light = memnew(SpotLight); + light = memnew(SpotLight3D); } ERR_FAIL_COND_V(light == NULL, NULL); @@ -1453,14 +1453,14 @@ Spatial *EditorSceneImporterAssimp::create_light( /** * Create camera for the scene */ -Spatial *EditorSceneImporterAssimp::create_camera( +Node3D *EditorSceneImporterAssimp::create_camera( ImportState &state, const String &node_name, Transform &look_at_transform) { aiCamera *camera = state.assimp_scene->mCameras[state.camera_cache[node_name]]; ERR_FAIL_COND_V(!camera, NULL); - Camera *camera_node = memnew(Camera); + Camera3D *camera_node = memnew(Camera3D); ERR_FAIL_COND_V(!camera_node, NULL); float near = camera->mClipPlaneNear; if (Math::is_equal_approx(near, 0.0f)) { diff --git a/modules/assimp/editor_scene_importer_assimp.h b/modules/assimp/editor_scene_importer_assimp.h index 4cd50e7681..5059138b64 100644 --- a/modules/assimp/editor_scene_importer_assimp.h +++ b/modules/assimp/editor_scene_importer_assimp.h @@ -37,9 +37,9 @@ #include "core/vector.h" #include "editor/import/resource_importer_scene.h" #include "editor/project_settings_editor.h" -#include "scene/3d/mesh_instance.h" -#include "scene/3d/skeleton.h" -#include "scene/3d/spatial.h" +#include "scene/3d/mesh_instance_3d.h" +#include "scene/3d/node_3d.h" +#include "scene/3d/skeleton_3d.h" #include "scene/animation/animation_player.h" #include "scene/resources/animation.h" #include "scene/resources/surface_tool.h" @@ -90,29 +90,29 @@ private: Ref<Mesh> _generate_mesh_from_surface_indices(ImportState &state, const Vector<int> &p_surface_indices, const aiNode *assimp_node, Ref<Skin> &skin, - Skeleton *&skeleton_assigned); + Skeleton3D *&skeleton_assigned); // simple object creation functions - Spatial *create_light(ImportState &state, + Node3D *create_light(ImportState &state, const String &node_name, Transform &look_at_transform); - Spatial *create_camera( + Node3D *create_camera( ImportState &state, const String &node_name, Transform &look_at_transform); // non recursive - linear so must not use recursive arguments - MeshInstance *create_mesh(ImportState &state, const aiNode *assimp_node, const String &node_name, Node *active_node, Transform node_transform); + MeshInstance3D *create_mesh(ImportState &state, const aiNode *assimp_node, const String &node_name, Node *active_node, Transform node_transform); // recursive node generator void _generate_node(ImportState &state, const aiNode *assimp_node); void _insert_animation_track(ImportState &scene, const aiAnimation *assimp_anim, int track_id, int anim_fps, Ref<Animation> animation, float ticks_per_second, - Skeleton *skeleton, const NodePath &node_path, + Skeleton3D *skeleton, const NodePath &node_path, const String &node_name, aiBone *track_bone); void _import_animation(ImportState &state, int p_animation_index, int p_bake_fps); Node *get_node_by_name(ImportState &state, String name); aiBone *get_bone_from_stack(ImportState &state, aiString name); - Spatial *_generate_scene(const String &p_path, aiScene *scene, const uint32_t p_flags, int p_bake_fps, const int32_t p_max_bone_weights); + Node3D *_generate_scene(const String &p_path, aiScene *scene, const uint32_t p_flags, int p_bake_fps, const int32_t p_max_bone_weights); template <class T> T _interpolate_track(const Vector<float> &p_times, const Vector<T> &p_values, float p_time, AssetImportAnimation::Interpolation p_interp); diff --git a/modules/assimp/import_state.h b/modules/assimp/import_state.h index fbbbe23399..b16366b38c 100644 --- a/modules/assimp/import_state.h +++ b/modules/assimp/import_state.h @@ -36,9 +36,9 @@ #include "core/vector.h" #include "editor/import/resource_importer_scene.h" #include "editor/project_settings_editor.h" -#include "scene/3d/mesh_instance.h" -#include "scene/3d/skeleton.h" -#include "scene/3d/spatial.h" +#include "scene/3d/mesh_instance_3d.h" +#include "scene/3d/node_3d.h" +#include "scene/3d/skeleton_3d.h" #include "scene/animation/animation_player.h" #include "scene/resources/animation.h" #include "scene/resources/surface_tool.h" @@ -57,7 +57,7 @@ namespace AssimpImporter { struct ImportState { String path; - Spatial *root; + Node3D *root; const aiScene *assimp_scene; uint32_t max_bone_weights; @@ -74,15 +74,15 @@ struct ImportState { // Generation 3 - determinisitic iteration // to lower potential recursion errors List<const aiNode *> nodes; - Map<const aiNode *, Spatial *> flat_node_map; + Map<const aiNode *, Node3D *> flat_node_map; AnimationPlayer *animation_player; // Generation 3 - deterministic armatures // list of armature nodes - flat and simple to parse // assimp node, node in godot List<aiNode *> armature_nodes; - Map<const aiNode *, Skeleton *> armature_skeletons; - Map<aiBone *, Skeleton *> skeleton_bone_map; + Map<const aiNode *, Skeleton3D *> armature_skeletons; + Map<aiBone *, Skeleton3D *> skeleton_bone_map; // Generation 3 - deterministic bone handling // bones from the stack are popped when found // this means we can detect @@ -103,8 +103,8 @@ struct RecursiveState { RecursiveState() {} // do not construct :) RecursiveState( Transform &_node_transform, - Skeleton *_skeleton, - Spatial *_new_node, + Skeleton3D *_skeleton, + Node3D *_new_node, String &_node_name, aiNode *_assimp_node, Node *_parent_node, @@ -118,8 +118,8 @@ struct RecursiveState { bone(_bone) {} Transform node_transform; - Skeleton *skeleton = NULL; - Spatial *new_node = NULL; + Skeleton3D *skeleton = NULL; + Node3D *new_node = NULL; String node_name; aiNode *assimp_node = NULL; Node *parent_node = NULL; diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index f21206dd0d..fb36a0d3e1 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -32,7 +32,7 @@ #include "bullet_types_converter.h" #include "bullet_utilities.h" -#include "scene/3d/soft_body.h" +#include "scene/3d/soft_body_3d.h" #include "space_bullet.h" SoftBodyBullet::SoftBodyBullet() : diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp index 1b63bccb06..4b27eea019 100644 --- a/modules/csg/csg_gizmos.cpp +++ b/modules/csg/csg_gizmos.cpp @@ -32,7 +32,7 @@ /////////// -CSGShapeSpatialGizmoPlugin::CSGShapeSpatialGizmoPlugin() { +CSGShapeNode3DGizmoPlugin::CSGShapeNode3DGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/csg", Color(0.0, 0.4, 1, 0.15)); create_material("shape_union_material", gizmo_color); @@ -49,46 +49,46 @@ CSGShapeSpatialGizmoPlugin::CSGShapeSpatialGizmoPlugin() { create_handle_material("handles"); } -String CSGShapeSpatialGizmoPlugin::get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const { +String CSGShapeNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { - CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node()); + CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node()); - if (Object::cast_to<CSGSphere>(cs)) { + if (Object::cast_to<CSGSphere3D>(cs)) { return "Radius"; } - if (Object::cast_to<CSGBox>(cs)) { + if (Object::cast_to<CSGBox3D>(cs)) { static const char *hname[3] = { "Width", "Height", "Depth" }; return hname[p_idx]; } - if (Object::cast_to<CSGCylinder>(cs)) { + if (Object::cast_to<CSGCylinder3D>(cs)) { return p_idx == 0 ? "Radius" : "Height"; } - if (Object::cast_to<CSGTorus>(cs)) { + if (Object::cast_to<CSGTorus3D>(cs)) { return p_idx == 0 ? "InnerRadius" : "OuterRadius"; } return ""; } -Variant CSGShapeSpatialGizmoPlugin::get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const { +Variant CSGShapeNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { - CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node()); + CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node()); - if (Object::cast_to<CSGSphere>(cs)) { + if (Object::cast_to<CSGSphere3D>(cs)) { - CSGSphere *s = Object::cast_to<CSGSphere>(cs); + CSGSphere3D *s = Object::cast_to<CSGSphere3D>(cs); return s->get_radius(); } - if (Object::cast_to<CSGBox>(cs)) { + if (Object::cast_to<CSGBox3D>(cs)) { - CSGBox *s = Object::cast_to<CSGBox>(cs); + CSGBox3D *s = Object::cast_to<CSGBox3D>(cs); switch (p_idx) { case 0: return s->get_width(); case 1: return s->get_height(); @@ -96,23 +96,23 @@ Variant CSGShapeSpatialGizmoPlugin::get_handle_value(EditorSpatialGizmo *p_gizmo } } - if (Object::cast_to<CSGCylinder>(cs)) { + if (Object::cast_to<CSGCylinder3D>(cs)) { - CSGCylinder *s = Object::cast_to<CSGCylinder>(cs); + CSGCylinder3D *s = Object::cast_to<CSGCylinder3D>(cs); return p_idx == 0 ? s->get_radius() : s->get_height(); } - if (Object::cast_to<CSGTorus>(cs)) { + if (Object::cast_to<CSGTorus3D>(cs)) { - CSGTorus *s = Object::cast_to<CSGTorus>(cs); + CSGTorus3D *s = Object::cast_to<CSGTorus3D>(cs); return p_idx == 0 ? s->get_inner_radius() : s->get_outer_radius(); } return Variant(); } -void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx, Camera *p_camera, const Point2 &p_point) { +void CSGShapeNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { - CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node()); + CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node()); Transform gt = cs->get_global_transform(); //gt.orthonormalize(); @@ -123,15 +123,15 @@ void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_i Vector3 sg[2] = { gi.xform(ray_from), gi.xform(ray_from + ray_dir * 16384) }; - if (Object::cast_to<CSGSphere>(cs)) { + if (Object::cast_to<CSGSphere3D>(cs)) { - CSGSphere *s = Object::cast_to<CSGSphere>(cs); + CSGSphere3D *s = Object::cast_to<CSGSphere3D>(cs); Vector3 ra, rb; Geometry::get_closest_points_between_segments(Vector3(), Vector3(4096, 0, 0), sg[0], sg[1], ra, rb); float d = ra.x; - if (SpatialEditor::get_singleton()->is_snap_enabled()) { - d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap()); + if (Node3DEditor::get_singleton()->is_snap_enabled()) { + d = Math::stepify(d, Node3DEditor::get_singleton()->get_translate_snap()); } if (d < 0.001) @@ -140,17 +140,17 @@ void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_i s->set_radius(d); } - if (Object::cast_to<CSGBox>(cs)) { + if (Object::cast_to<CSGBox3D>(cs)) { - CSGBox *s = Object::cast_to<CSGBox>(cs); + CSGBox3D *s = Object::cast_to<CSGBox3D>(cs); Vector3 axis; axis[p_idx] = 1.0; Vector3 ra, rb; Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb); float d = ra[p_idx]; - if (SpatialEditor::get_singleton()->is_snap_enabled()) { - d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap()); + if (Node3DEditor::get_singleton()->is_snap_enabled()) { + d = Math::stepify(d, Node3DEditor::get_singleton()->get_translate_snap()); } if (d < 0.001) @@ -163,17 +163,17 @@ void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_i } } - if (Object::cast_to<CSGCylinder>(cs)) { + if (Object::cast_to<CSGCylinder3D>(cs)) { - CSGCylinder *s = Object::cast_to<CSGCylinder>(cs); + CSGCylinder3D *s = Object::cast_to<CSGCylinder3D>(cs); Vector3 axis; axis[p_idx == 0 ? 0 : 1] = 1.0; Vector3 ra, rb; Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb); float d = axis.dot(ra); - if (SpatialEditor::get_singleton()->is_snap_enabled()) { - d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap()); + if (Node3DEditor::get_singleton()->is_snap_enabled()) { + d = Math::stepify(d, Node3DEditor::get_singleton()->get_translate_snap()); } if (d < 0.001) @@ -185,17 +185,17 @@ void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_i s->set_height(d * 2.0); } - if (Object::cast_to<CSGTorus>(cs)) { + if (Object::cast_to<CSGTorus3D>(cs)) { - CSGTorus *s = Object::cast_to<CSGTorus>(cs); + CSGTorus3D *s = Object::cast_to<CSGTorus3D>(cs); Vector3 axis; axis[0] = 1.0; Vector3 ra, rb; Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb); float d = axis.dot(ra); - if (SpatialEditor::get_singleton()->is_snap_enabled()) { - d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap()); + if (Node3DEditor::get_singleton()->is_snap_enabled()) { + d = Math::stepify(d, Node3DEditor::get_singleton()->get_translate_snap()); } if (d < 0.001) @@ -207,26 +207,26 @@ void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_i s->set_outer_radius(d); } } -void CSGShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { +void CSGShapeNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { - CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node()); + CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node()); - if (Object::cast_to<CSGSphere>(cs)) { - CSGSphere *s = Object::cast_to<CSGSphere>(cs); + if (Object::cast_to<CSGSphere3D>(cs)) { + CSGSphere3D *s = Object::cast_to<CSGSphere3D>(cs); if (p_cancel) { s->set_radius(p_restore); return; } - UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); + UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo(); ur->create_action(TTR("Change Sphere Shape Radius")); ur->add_do_method(s, "set_radius", s->get_radius()); ur->add_undo_method(s, "set_radius", p_restore); ur->commit_action(); } - if (Object::cast_to<CSGBox>(cs)) { - CSGBox *s = Object::cast_to<CSGBox>(cs); + if (Object::cast_to<CSGBox3D>(cs)) { + CSGBox3D *s = Object::cast_to<CSGBox3D>(cs); if (p_cancel) { switch (p_idx) { case 0: s->set_width(p_restore); break; @@ -236,7 +236,7 @@ void CSGShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int return; } - UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); + UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo(); ur->create_action(TTR("Change Box Shape Extents")); static const char *method[3] = { "set_width", "set_height", "set_depth" }; float current = 0; @@ -251,8 +251,8 @@ void CSGShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int ur->commit_action(); } - if (Object::cast_to<CSGCylinder>(cs)) { - CSGCylinder *s = Object::cast_to<CSGCylinder>(cs); + if (Object::cast_to<CSGCylinder3D>(cs)) { + CSGCylinder3D *s = Object::cast_to<CSGCylinder3D>(cs); if (p_cancel) { if (p_idx == 0) s->set_radius(p_restore); @@ -261,7 +261,7 @@ void CSGShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int return; } - UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); + UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo(); if (p_idx == 0) { ur->create_action(TTR("Change Cylinder Radius")); ur->add_do_method(s, "set_radius", s->get_radius()); @@ -275,8 +275,8 @@ void CSGShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int ur->commit_action(); } - if (Object::cast_to<CSGTorus>(cs)) { - CSGTorus *s = Object::cast_to<CSGTorus>(cs); + if (Object::cast_to<CSGTorus3D>(cs)) { + CSGTorus3D *s = Object::cast_to<CSGTorus3D>(cs); if (p_cancel) { if (p_idx == 0) s->set_inner_radius(p_restore); @@ -285,7 +285,7 @@ void CSGShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int return; } - UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); + UndoRedo *ur = Node3DEditor::get_singleton()->get_undo_redo(); if (p_idx == 0) { ur->create_action(TTR("Change Torus Inner Radius")); ur->add_do_method(s, "set_inner_radius", s->get_inner_radius()); @@ -299,37 +299,37 @@ void CSGShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int ur->commit_action(); } } -bool CSGShapeSpatialGizmoPlugin::has_gizmo(Spatial *p_spatial) { - return Object::cast_to<CSGSphere>(p_spatial) || Object::cast_to<CSGBox>(p_spatial) || Object::cast_to<CSGCylinder>(p_spatial) || Object::cast_to<CSGTorus>(p_spatial) || Object::cast_to<CSGMesh>(p_spatial) || Object::cast_to<CSGPolygon>(p_spatial); +bool CSGShapeNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { + return Object::cast_to<CSGSphere3D>(p_spatial) || Object::cast_to<CSGBox3D>(p_spatial) || Object::cast_to<CSGCylinder3D>(p_spatial) || Object::cast_to<CSGTorus3D>(p_spatial) || Object::cast_to<CSGMesh3D>(p_spatial) || Object::cast_to<CSGPolygon3D>(p_spatial); } -String CSGShapeSpatialGizmoPlugin::get_name() const { +String CSGShapeNode3DGizmoPlugin::get_name() const { return "CSGShapes"; } -int CSGShapeSpatialGizmoPlugin::get_priority() const { +int CSGShapeNode3DGizmoPlugin::get_priority() const { return -1; } -bool CSGShapeSpatialGizmoPlugin::is_selectable_when_hidden() const { +bool CSGShapeNode3DGizmoPlugin::is_selectable_when_hidden() const { return true; } -void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { +void CSGShapeNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { - CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node()); + CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node()); p_gizmo->clear(); Ref<Material> material; switch (cs->get_operation()) { - case CSGShape::OPERATION_UNION: + case CSGShape3D::OPERATION_UNION: material = get_material("shape_union_material", p_gizmo); break; - case CSGShape::OPERATION_INTERSECTION: + case CSGShape3D::OPERATION_INTERSECTION: material = get_material("shape_intersection_material", p_gizmo); break; - case CSGShape::OPERATION_SUBTRACTION: + case CSGShape3D::OPERATION_SUBTRACTION: material = get_material("shape_subtraction_material", p_gizmo); break; } @@ -366,13 +366,13 @@ void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { Ref<Material> solid_material; switch (cs->get_operation()) { - case CSGShape::OPERATION_UNION: + case CSGShape3D::OPERATION_UNION: solid_material = get_material("shape_union_solid_material", p_gizmo); break; - case CSGShape::OPERATION_INTERSECTION: + case CSGShape3D::OPERATION_INTERSECTION: solid_material = get_material("shape_intersection_solid_material", p_gizmo); break; - case CSGShape::OPERATION_SUBTRACTION: + case CSGShape3D::OPERATION_SUBTRACTION: solid_material = get_material("shape_subtraction_solid_material", p_gizmo); break; } @@ -380,8 +380,8 @@ void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { p_gizmo->add_mesh(mesh, false, Ref<SkinReference>(), solid_material); } - if (Object::cast_to<CSGSphere>(cs)) { - CSGSphere *s = Object::cast_to<CSGSphere>(cs); + if (Object::cast_to<CSGSphere3D>(cs)) { + CSGSphere3D *s = Object::cast_to<CSGSphere3D>(cs); float r = s->get_radius(); Vector<Vector3> handles; @@ -389,8 +389,8 @@ void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { p_gizmo->add_handles(handles, handles_material); } - if (Object::cast_to<CSGBox>(cs)) { - CSGBox *s = Object::cast_to<CSGBox>(cs); + if (Object::cast_to<CSGBox3D>(cs)) { + CSGBox3D *s = Object::cast_to<CSGBox3D>(cs); Vector<Vector3> handles; handles.push_back(Vector3(s->get_width() * 0.5, 0, 0)); @@ -399,8 +399,8 @@ void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { p_gizmo->add_handles(handles, handles_material); } - if (Object::cast_to<CSGCylinder>(cs)) { - CSGCylinder *s = Object::cast_to<CSGCylinder>(cs); + if (Object::cast_to<CSGCylinder3D>(cs)) { + CSGCylinder3D *s = Object::cast_to<CSGCylinder3D>(cs); Vector<Vector3> handles; handles.push_back(Vector3(s->get_radius(), 0, 0)); @@ -408,8 +408,8 @@ void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { p_gizmo->add_handles(handles, handles_material); } - if (Object::cast_to<CSGTorus>(cs)) { - CSGTorus *s = Object::cast_to<CSGTorus>(cs); + if (Object::cast_to<CSGTorus3D>(cs)) { + CSGTorus3D *s = Object::cast_to<CSGTorus3D>(cs); Vector<Vector3> handles; handles.push_back(Vector3(s->get_inner_radius(), 0, 0)); @@ -419,6 +419,6 @@ void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { } EditorPluginCSG::EditorPluginCSG(EditorNode *p_editor) { - Ref<CSGShapeSpatialGizmoPlugin> gizmo_plugin = Ref<CSGShapeSpatialGizmoPlugin>(memnew(CSGShapeSpatialGizmoPlugin)); - SpatialEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin); + Ref<CSGShapeNode3DGizmoPlugin> gizmo_plugin = Ref<CSGShapeNode3DGizmoPlugin>(memnew(CSGShapeNode3DGizmoPlugin)); + Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin); } diff --git a/modules/csg/csg_gizmos.h b/modules/csg/csg_gizmos.h index 966b654802..cca27a4629 100644 --- a/modules/csg/csg_gizmos.h +++ b/modules/csg/csg_gizmos.h @@ -35,23 +35,23 @@ #include "editor/editor_plugin.h" #include "editor/spatial_editor_gizmos.h" -class CSGShapeSpatialGizmoPlugin : public EditorSpatialGizmoPlugin { +class CSGShapeNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(CSGShapeSpatialGizmoPlugin, EditorSpatialGizmoPlugin); + GDCLASS(CSGShapeNode3DGizmoPlugin, EditorNode3DGizmoPlugin); public: - bool has_gizmo(Spatial *p_spatial); + bool has_gizmo(Node3D *p_spatial); String get_name() const; int get_priority() const; bool is_selectable_when_hidden() const; - void redraw(EditorSpatialGizmo *p_gizmo); + void redraw(EditorNode3DGizmo *p_gizmo); - String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const; - Variant get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const; - void set_handle(EditorSpatialGizmo *p_gizmo, int p_idx, Camera *p_camera, const Point2 &p_point); - void commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel); + String get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const; + Variant get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const; + void set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point); + void commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel); - CSGShapeSpatialGizmoPlugin(); + CSGShapeNode3DGizmoPlugin(); }; class EditorPluginCSG : public EditorPlugin { diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 746c66bdf1..d052eba41c 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -29,9 +29,9 @@ /*************************************************************************/ #include "csg_shape.h" -#include "scene/3d/path.h" +#include "scene/3d/path_3d.h" -void CSGShape::set_use_collision(bool p_enable) { +void CSGShape3D::set_use_collision(bool p_enable) { if (use_collision == p_enable) return; @@ -59,23 +59,23 @@ void CSGShape::set_use_collision(bool p_enable) { _change_notify(); } -bool CSGShape::is_using_collision() const { +bool CSGShape3D::is_using_collision() const { return use_collision; } -void CSGShape::set_collision_layer(uint32_t p_layer) { +void CSGShape3D::set_collision_layer(uint32_t p_layer) { collision_layer = p_layer; if (root_collision_instance.is_valid()) { PhysicsServer::get_singleton()->body_set_collision_layer(root_collision_instance, p_layer); } } -uint32_t CSGShape::get_collision_layer() const { +uint32_t CSGShape3D::get_collision_layer() const { return collision_layer; } -void CSGShape::set_collision_mask(uint32_t p_mask) { +void CSGShape3D::set_collision_mask(uint32_t p_mask) { collision_mask = p_mask; if (root_collision_instance.is_valid()) { @@ -83,12 +83,12 @@ void CSGShape::set_collision_mask(uint32_t p_mask) { } } -uint32_t CSGShape::get_collision_mask() const { +uint32_t CSGShape3D::get_collision_mask() const { return collision_mask; } -void CSGShape::set_collision_mask_bit(int p_bit, bool p_value) { +void CSGShape3D::set_collision_mask_bit(int p_bit, bool p_value) { uint32_t mask = get_collision_mask(); if (p_value) @@ -98,12 +98,12 @@ void CSGShape::set_collision_mask_bit(int p_bit, bool p_value) { set_collision_mask(mask); } -bool CSGShape::get_collision_mask_bit(int p_bit) const { +bool CSGShape3D::get_collision_mask_bit(int p_bit) const { return get_collision_mask() & (1 << p_bit); } -void CSGShape::set_collision_layer_bit(int p_bit, bool p_value) { +void CSGShape3D::set_collision_layer_bit(int p_bit, bool p_value) { uint32_t mask = get_collision_layer(); if (p_value) @@ -113,25 +113,25 @@ void CSGShape::set_collision_layer_bit(int p_bit, bool p_value) { set_collision_layer(mask); } -bool CSGShape::get_collision_layer_bit(int p_bit) const { +bool CSGShape3D::get_collision_layer_bit(int p_bit) const { return get_collision_layer() & (1 << p_bit); } -bool CSGShape::is_root_shape() const { +bool CSGShape3D::is_root_shape() const { return !parent; } -void CSGShape::set_snap(float p_snap) { +void CSGShape3D::set_snap(float p_snap) { snap = p_snap; } -float CSGShape::get_snap() const { +float CSGShape3D::get_snap() const { return snap; } -void CSGShape::_make_dirty() { +void CSGShape3D::_make_dirty() { if (!is_inside_tree()) return; @@ -150,7 +150,7 @@ void CSGShape::_make_dirty() { } } -CSGBrush *CSGShape::_get_brush() { +CSGBrush *CSGShape3D::_get_brush() { if (dirty) { if (brush) { @@ -162,7 +162,7 @@ CSGBrush *CSGShape::_get_brush() { for (int i = 0; i < get_child_count(); i++) { - CSGShape *child = Object::cast_to<CSGShape>(get_child(i)); + CSGShape3D *child = Object::cast_to<CSGShape3D>(get_child(i)); if (!child) continue; if (!child->is_visible_in_tree()) @@ -185,9 +185,9 @@ CSGBrush *CSGShape::_get_brush() { CSGBrushOperation bop; switch (child->get_operation()) { - case CSGShape::OPERATION_UNION: bop.merge_brushes(CSGBrushOperation::OPERATION_UNION, *n, *nn2, *nn, snap); break; - case CSGShape::OPERATION_INTERSECTION: bop.merge_brushes(CSGBrushOperation::OPERATION_INTERSECTION, *n, *nn2, *nn, snap); break; - case CSGShape::OPERATION_SUBTRACTION: bop.merge_brushes(CSGBrushOperation::OPERATION_SUBSTRACTION, *n, *nn2, *nn, snap); break; + case CSGShape3D::OPERATION_UNION: bop.merge_brushes(CSGBrushOperation::OPERATION_UNION, *n, *nn2, *nn, snap); break; + case CSGShape3D::OPERATION_INTERSECTION: bop.merge_brushes(CSGBrushOperation::OPERATION_INTERSECTION, *n, *nn2, *nn, snap); break; + case CSGShape3D::OPERATION_SUBTRACTION: bop.merge_brushes(CSGBrushOperation::OPERATION_SUBSTRACTION, *n, *nn2, *nn, snap); break; } memdelete(n); memdelete(nn2); @@ -218,18 +218,18 @@ CSGBrush *CSGShape::_get_brush() { return brush; } -int CSGShape::mikktGetNumFaces(const SMikkTSpaceContext *pContext) { +int CSGShape3D::mikktGetNumFaces(const SMikkTSpaceContext *pContext) { ShapeUpdateSurface &surface = *((ShapeUpdateSurface *)pContext->m_pUserData); return surface.vertices.size() / 3; } -int CSGShape::mikktGetNumVerticesOfFace(const SMikkTSpaceContext *pContext, const int iFace) { +int CSGShape3D::mikktGetNumVerticesOfFace(const SMikkTSpaceContext *pContext, const int iFace) { // always 3 return 3; } -void CSGShape::mikktGetPosition(const SMikkTSpaceContext *pContext, float fvPosOut[], const int iFace, const int iVert) { +void CSGShape3D::mikktGetPosition(const SMikkTSpaceContext *pContext, float fvPosOut[], const int iFace, const int iVert) { ShapeUpdateSurface &surface = *((ShapeUpdateSurface *)pContext->m_pUserData); Vector3 v = surface.verticesw[iFace * 3 + iVert]; @@ -238,7 +238,7 @@ void CSGShape::mikktGetPosition(const SMikkTSpaceContext *pContext, float fvPosO fvPosOut[2] = v.z; } -void CSGShape::mikktGetNormal(const SMikkTSpaceContext *pContext, float fvNormOut[], const int iFace, const int iVert) { +void CSGShape3D::mikktGetNormal(const SMikkTSpaceContext *pContext, float fvNormOut[], const int iFace, const int iVert) { ShapeUpdateSurface &surface = *((ShapeUpdateSurface *)pContext->m_pUserData); Vector3 n = surface.normalsw[iFace * 3 + iVert]; @@ -247,7 +247,7 @@ void CSGShape::mikktGetNormal(const SMikkTSpaceContext *pContext, float fvNormOu fvNormOut[2] = n.z; } -void CSGShape::mikktGetTexCoord(const SMikkTSpaceContext *pContext, float fvTexcOut[], const int iFace, const int iVert) { +void CSGShape3D::mikktGetTexCoord(const SMikkTSpaceContext *pContext, float fvTexcOut[], const int iFace, const int iVert) { ShapeUpdateSurface &surface = *((ShapeUpdateSurface *)pContext->m_pUserData); Vector2 t = surface.uvsw[iFace * 3 + iVert]; @@ -255,7 +255,7 @@ void CSGShape::mikktGetTexCoord(const SMikkTSpaceContext *pContext, float fvTexc fvTexcOut[1] = t.y; } -void CSGShape::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fvBiTangent[], const float fMagS, const float fMagT, +void CSGShape3D::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fvBiTangent[], const float fMagS, const float fMagT, const tbool bIsOrientationPreserving, const int iFace, const int iVert) { ShapeUpdateSurface &surface = *((ShapeUpdateSurface *)pContext->m_pUserData); @@ -273,7 +273,7 @@ void CSGShape::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const f surface.tansw[i++] = d < 0 ? -1 : 1; } -void CSGShape::_update_shape() { +void CSGShape3D::_update_shape() { if (parent) return; @@ -460,11 +460,11 @@ void CSGShape::_update_shape() { set_base(root_mesh->get_rid()); } -AABB CSGShape::get_aabb() const { +AABB CSGShape3D::get_aabb() const { return node_aabb; } -Vector<Vector3> CSGShape::get_brush_faces() { +Vector<Vector3> CSGShape3D::get_brush_faces() { ERR_FAIL_COND_V(!is_inside_tree(), Vector<Vector3>()); CSGBrush *b = _get_brush(); if (!b) { @@ -486,18 +486,18 @@ Vector<Vector3> CSGShape::get_brush_faces() { return faces; } -Vector<Face3> CSGShape::get_faces(uint32_t p_usage_flags) const { +Vector<Face3> CSGShape3D::get_faces(uint32_t p_usage_flags) const { return Vector<Face3>(); } -void CSGShape::_notification(int p_what) { +void CSGShape3D::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { Node *parentn = get_parent(); if (parentn) { - parent = Object::cast_to<CSGShape>(parentn); + parent = Object::cast_to<CSGShape3D>(parentn); if (parent) { set_base(RID()); root_mesh.unref(); @@ -547,27 +547,27 @@ void CSGShape::_notification(int p_what) { } } -void CSGShape::set_operation(Operation p_operation) { +void CSGShape3D::set_operation(Operation p_operation) { operation = p_operation; _make_dirty(); update_gizmo(); } -CSGShape::Operation CSGShape::get_operation() const { +CSGShape3D::Operation CSGShape3D::get_operation() const { return operation; } -void CSGShape::set_calculate_tangents(bool p_calculate_tangents) { +void CSGShape3D::set_calculate_tangents(bool p_calculate_tangents) { calculate_tangents = p_calculate_tangents; _make_dirty(); } -bool CSGShape::is_calculating_tangents() const { +bool CSGShape3D::is_calculating_tangents() const { return calculate_tangents; } -void CSGShape::_validate_property(PropertyInfo &property) const { +void CSGShape3D::_validate_property(PropertyInfo &property) const { bool is_collision_prefixed = property.name.begins_with("collision_"); if ((is_collision_prefixed || property.name.begins_with("use_collision")) && is_inside_tree() && !is_root_shape()) { //hide collision if not root @@ -577,7 +577,7 @@ void CSGShape::_validate_property(PropertyInfo &property) const { } } -Array CSGShape::get_meshes() const { +Array CSGShape3D::get_meshes() const { if (root_mesh.is_valid()) { Array arr; @@ -589,36 +589,36 @@ Array CSGShape::get_meshes() const { return Array(); } -void CSGShape::_bind_methods() { +void CSGShape3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("_update_shape"), &CSGShape::_update_shape); - ClassDB::bind_method(D_METHOD("is_root_shape"), &CSGShape::is_root_shape); + ClassDB::bind_method(D_METHOD("_update_shape"), &CSGShape3D::_update_shape); + ClassDB::bind_method(D_METHOD("is_root_shape"), &CSGShape3D::is_root_shape); - ClassDB::bind_method(D_METHOD("set_operation", "operation"), &CSGShape::set_operation); - ClassDB::bind_method(D_METHOD("get_operation"), &CSGShape::get_operation); + ClassDB::bind_method(D_METHOD("set_operation", "operation"), &CSGShape3D::set_operation); + ClassDB::bind_method(D_METHOD("get_operation"), &CSGShape3D::get_operation); - ClassDB::bind_method(D_METHOD("set_snap", "snap"), &CSGShape::set_snap); - ClassDB::bind_method(D_METHOD("get_snap"), &CSGShape::get_snap); + ClassDB::bind_method(D_METHOD("set_snap", "snap"), &CSGShape3D::set_snap); + ClassDB::bind_method(D_METHOD("get_snap"), &CSGShape3D::get_snap); - ClassDB::bind_method(D_METHOD("set_use_collision", "operation"), &CSGShape::set_use_collision); - ClassDB::bind_method(D_METHOD("is_using_collision"), &CSGShape::is_using_collision); + ClassDB::bind_method(D_METHOD("set_use_collision", "operation"), &CSGShape3D::set_use_collision); + ClassDB::bind_method(D_METHOD("is_using_collision"), &CSGShape3D::is_using_collision); - ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &CSGShape::set_collision_layer); - ClassDB::bind_method(D_METHOD("get_collision_layer"), &CSGShape::get_collision_layer); + ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &CSGShape3D::set_collision_layer); + ClassDB::bind_method(D_METHOD("get_collision_layer"), &CSGShape3D::get_collision_layer); - ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &CSGShape::set_collision_mask); - ClassDB::bind_method(D_METHOD("get_collision_mask"), &CSGShape::get_collision_mask); + ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &CSGShape3D::set_collision_mask); + ClassDB::bind_method(D_METHOD("get_collision_mask"), &CSGShape3D::get_collision_mask); - ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &CSGShape::set_collision_mask_bit); - ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &CSGShape::get_collision_mask_bit); + ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &CSGShape3D::set_collision_mask_bit); + ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &CSGShape3D::get_collision_mask_bit); - ClassDB::bind_method(D_METHOD("set_collision_layer_bit", "bit", "value"), &CSGShape::set_collision_layer_bit); - ClassDB::bind_method(D_METHOD("get_collision_layer_bit", "bit"), &CSGShape::get_collision_layer_bit); + ClassDB::bind_method(D_METHOD("set_collision_layer_bit", "bit", "value"), &CSGShape3D::set_collision_layer_bit); + ClassDB::bind_method(D_METHOD("get_collision_layer_bit", "bit"), &CSGShape3D::get_collision_layer_bit); - ClassDB::bind_method(D_METHOD("set_calculate_tangents", "enabled"), &CSGShape::set_calculate_tangents); - ClassDB::bind_method(D_METHOD("is_calculating_tangents"), &CSGShape::is_calculating_tangents); + ClassDB::bind_method(D_METHOD("set_calculate_tangents", "enabled"), &CSGShape3D::set_calculate_tangents); + ClassDB::bind_method(D_METHOD("is_calculating_tangents"), &CSGShape3D::is_calculating_tangents); - ClassDB::bind_method(D_METHOD("get_meshes"), &CSGShape::get_meshes); + ClassDB::bind_method(D_METHOD("get_meshes"), &CSGShape3D::get_meshes); ADD_PROPERTY(PropertyInfo(Variant::INT, "operation", PROPERTY_HINT_ENUM, "Union,Intersection,Subtraction"), "set_operation", "get_operation"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "snap", PROPERTY_HINT_RANGE, "0.0001,1,0.001"), "set_snap", "get_snap"); @@ -634,7 +634,7 @@ void CSGShape::_bind_methods() { BIND_ENUM_CONSTANT(OPERATION_SUBTRACTION); } -CSGShape::CSGShape() { +CSGShape3D::CSGShape3D() { operation = OPERATION_UNION; parent = NULL; brush = NULL; @@ -647,7 +647,7 @@ CSGShape::CSGShape() { set_notify_local_transform(true); } -CSGShape::~CSGShape() { +CSGShape3D::~CSGShape3D() { if (brush) { memdelete(brush); brush = NULL; @@ -655,17 +655,17 @@ CSGShape::~CSGShape() { } ////////////////////////////////// -CSGBrush *CSGCombiner::_build_brush() { +CSGBrush *CSGCombiner3D::_build_brush() { return NULL; //does not build anything } -CSGCombiner::CSGCombiner() { +CSGCombiner3D::CSGCombiner3D() { } ///////////////////// -CSGBrush *CSGPrimitive::_create_brush_from_arrays(const Vector<Vector3> &p_vertices, const Vector<Vector2> &p_uv, const Vector<bool> &p_smooth, const Vector<Ref<Material>> &p_materials) { +CSGBrush *CSGPrimitive3D::_create_brush_from_arrays(const Vector<Vector3> &p_vertices, const Vector<Vector2> &p_uv, const Vector<bool> &p_smooth, const Vector<Ref<Material>> &p_materials) { CSGBrush *brush = memnew(CSGBrush); @@ -683,15 +683,15 @@ CSGBrush *CSGPrimitive::_create_brush_from_arrays(const Vector<Vector3> &p_verti return brush; } -void CSGPrimitive::_bind_methods() { +void CSGPrimitive3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_invert_faces", "invert_faces"), &CSGPrimitive::set_invert_faces); - ClassDB::bind_method(D_METHOD("is_inverting_faces"), &CSGPrimitive::is_inverting_faces); + ClassDB::bind_method(D_METHOD("set_invert_faces", "invert_faces"), &CSGPrimitive3D::set_invert_faces); + ClassDB::bind_method(D_METHOD("is_inverting_faces"), &CSGPrimitive3D::is_inverting_faces); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "invert_faces"), "set_invert_faces", "is_inverting_faces"); } -void CSGPrimitive::set_invert_faces(bool p_invert) { +void CSGPrimitive3D::set_invert_faces(bool p_invert) { if (invert_faces == p_invert) return; @@ -700,17 +700,17 @@ void CSGPrimitive::set_invert_faces(bool p_invert) { _make_dirty(); } -bool CSGPrimitive::is_inverting_faces() { +bool CSGPrimitive3D::is_inverting_faces() { return invert_faces; } -CSGPrimitive::CSGPrimitive() { +CSGPrimitive3D::CSGPrimitive3D() { invert_faces = false; } ///////////////////// -CSGBrush *CSGMesh::_build_brush() { +CSGBrush *CSGMesh3D::_build_brush() { if (!mesh.is_valid()) return NULL; @@ -862,58 +862,58 @@ CSGBrush *CSGMesh::_build_brush() { return _create_brush_from_arrays(vertices, uvs, smooth, materials); } -void CSGMesh::_mesh_changed() { +void CSGMesh3D::_mesh_changed() { _make_dirty(); update_gizmo(); } -void CSGMesh::set_material(const Ref<Material> &p_material) { +void CSGMesh3D::set_material(const Ref<Material> &p_material) { if (material == p_material) return; material = p_material; _make_dirty(); } -Ref<Material> CSGMesh::get_material() const { +Ref<Material> CSGMesh3D::get_material() const { return material; } -void CSGMesh::_bind_methods() { +void CSGMesh3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &CSGMesh::set_mesh); - ClassDB::bind_method(D_METHOD("get_mesh"), &CSGMesh::get_mesh); + ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &CSGMesh3D::set_mesh); + ClassDB::bind_method(D_METHOD("get_mesh"), &CSGMesh3D::get_mesh); - ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGMesh::set_material); - ClassDB::bind_method(D_METHOD("get_material"), &CSGMesh::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGMesh3D::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &CSGMesh3D::get_material); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_mesh", "get_mesh"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "StandardMaterial3D,ShaderMaterial"), "set_material", "get_material"); } -void CSGMesh::set_mesh(const Ref<Mesh> &p_mesh) { +void CSGMesh3D::set_mesh(const Ref<Mesh> &p_mesh) { if (mesh == p_mesh) return; if (mesh.is_valid()) { - mesh->disconnect("changed", callable_mp(this, &CSGMesh::_mesh_changed)); + mesh->disconnect("changed", callable_mp(this, &CSGMesh3D::_mesh_changed)); } mesh = p_mesh; if (mesh.is_valid()) { - mesh->connect("changed", callable_mp(this, &CSGMesh::_mesh_changed)); + mesh->connect("changed", callable_mp(this, &CSGMesh3D::_mesh_changed)); } _make_dirty(); } -Ref<Mesh> CSGMesh::get_mesh() { +Ref<Mesh> CSGMesh3D::get_mesh() { return mesh; } //////////////////////////////// -CSGBrush *CSGSphere::_build_brush() { +CSGBrush *CSGSphere3D::_build_brush() { // set our bounding box @@ -1032,20 +1032,20 @@ CSGBrush *CSGSphere::_build_brush() { return brush; } -void CSGSphere::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CSGSphere::set_radius); - ClassDB::bind_method(D_METHOD("get_radius"), &CSGSphere::get_radius); +void CSGSphere3D::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CSGSphere3D::set_radius); + ClassDB::bind_method(D_METHOD("get_radius"), &CSGSphere3D::get_radius); - ClassDB::bind_method(D_METHOD("set_radial_segments", "radial_segments"), &CSGSphere::set_radial_segments); - ClassDB::bind_method(D_METHOD("get_radial_segments"), &CSGSphere::get_radial_segments); - ClassDB::bind_method(D_METHOD("set_rings", "rings"), &CSGSphere::set_rings); - ClassDB::bind_method(D_METHOD("get_rings"), &CSGSphere::get_rings); + ClassDB::bind_method(D_METHOD("set_radial_segments", "radial_segments"), &CSGSphere3D::set_radial_segments); + ClassDB::bind_method(D_METHOD("get_radial_segments"), &CSGSphere3D::get_radial_segments); + ClassDB::bind_method(D_METHOD("set_rings", "rings"), &CSGSphere3D::set_rings); + ClassDB::bind_method(D_METHOD("get_rings"), &CSGSphere3D::get_rings); - ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGSphere::set_smooth_faces); - ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGSphere::get_smooth_faces); + ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGSphere3D::set_smooth_faces); + ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGSphere3D::get_smooth_faces); - ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGSphere::set_material); - ClassDB::bind_method(D_METHOD("get_material"), &CSGSphere::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGSphere3D::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &CSGSphere3D::get_material); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_radius", "get_radius"); ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1"), "set_radial_segments", "get_radial_segments"); @@ -1054,7 +1054,7 @@ void CSGSphere::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "StandardMaterial3D,ShaderMaterial"), "set_material", "get_material"); } -void CSGSphere::set_radius(const float p_radius) { +void CSGSphere3D::set_radius(const float p_radius) { ERR_FAIL_COND(p_radius <= 0); radius = p_radius; _make_dirty(); @@ -1062,51 +1062,51 @@ void CSGSphere::set_radius(const float p_radius) { _change_notify("radius"); } -float CSGSphere::get_radius() const { +float CSGSphere3D::get_radius() const { return radius; } -void CSGSphere::set_radial_segments(const int p_radial_segments) { +void CSGSphere3D::set_radial_segments(const int p_radial_segments) { radial_segments = p_radial_segments > 4 ? p_radial_segments : 4; _make_dirty(); update_gizmo(); } -int CSGSphere::get_radial_segments() const { +int CSGSphere3D::get_radial_segments() const { return radial_segments; } -void CSGSphere::set_rings(const int p_rings) { +void CSGSphere3D::set_rings(const int p_rings) { rings = p_rings > 1 ? p_rings : 1; _make_dirty(); update_gizmo(); } -int CSGSphere::get_rings() const { +int CSGSphere3D::get_rings() const { return rings; } -void CSGSphere::set_smooth_faces(const bool p_smooth_faces) { +void CSGSphere3D::set_smooth_faces(const bool p_smooth_faces) { smooth_faces = p_smooth_faces; _make_dirty(); } -bool CSGSphere::get_smooth_faces() const { +bool CSGSphere3D::get_smooth_faces() const { return smooth_faces; } -void CSGSphere::set_material(const Ref<Material> &p_material) { +void CSGSphere3D::set_material(const Ref<Material> &p_material) { material = p_material; _make_dirty(); } -Ref<Material> CSGSphere::get_material() const { +Ref<Material> CSGSphere3D::get_material() const { return material; } -CSGSphere::CSGSphere() { +CSGSphere3D::CSGSphere3D() { // defaults radius = 1.0; radial_segments = 12; @@ -1116,7 +1116,7 @@ CSGSphere::CSGSphere() { /////////////// -CSGBrush *CSGBox::_build_brush() { +CSGBrush *CSGBox3D::_build_brush() { // set our bounding box @@ -1221,18 +1221,18 @@ CSGBrush *CSGBox::_build_brush() { return brush; } -void CSGBox::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_width", "width"), &CSGBox::set_width); - ClassDB::bind_method(D_METHOD("get_width"), &CSGBox::get_width); +void CSGBox3D::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_width", "width"), &CSGBox3D::set_width); + ClassDB::bind_method(D_METHOD("get_width"), &CSGBox3D::get_width); - ClassDB::bind_method(D_METHOD("set_height", "height"), &CSGBox::set_height); - ClassDB::bind_method(D_METHOD("get_height"), &CSGBox::get_height); + ClassDB::bind_method(D_METHOD("set_height", "height"), &CSGBox3D::set_height); + ClassDB::bind_method(D_METHOD("get_height"), &CSGBox3D::get_height); - ClassDB::bind_method(D_METHOD("set_depth", "depth"), &CSGBox::set_depth); - ClassDB::bind_method(D_METHOD("get_depth"), &CSGBox::get_depth); + ClassDB::bind_method(D_METHOD("set_depth", "depth"), &CSGBox3D::set_depth); + ClassDB::bind_method(D_METHOD("get_depth"), &CSGBox3D::get_depth); - ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGBox::set_material); - ClassDB::bind_method(D_METHOD("get_material"), &CSGBox::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGBox3D::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &CSGBox3D::get_material); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "width", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_width", "get_width"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_height", "get_height"); @@ -1240,52 +1240,52 @@ void CSGBox::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "StandardMaterial3D,ShaderMaterial"), "set_material", "get_material"); } -void CSGBox::set_width(const float p_width) { +void CSGBox3D::set_width(const float p_width) { width = p_width; _make_dirty(); update_gizmo(); _change_notify("width"); } -float CSGBox::get_width() const { +float CSGBox3D::get_width() const { return width; } -void CSGBox::set_height(const float p_height) { +void CSGBox3D::set_height(const float p_height) { height = p_height; _make_dirty(); update_gizmo(); _change_notify("height"); } -float CSGBox::get_height() const { +float CSGBox3D::get_height() const { return height; } -void CSGBox::set_depth(const float p_depth) { +void CSGBox3D::set_depth(const float p_depth) { depth = p_depth; _make_dirty(); update_gizmo(); _change_notify("depth"); } -float CSGBox::get_depth() const { +float CSGBox3D::get_depth() const { return depth; } -void CSGBox::set_material(const Ref<Material> &p_material) { +void CSGBox3D::set_material(const Ref<Material> &p_material) { material = p_material; _make_dirty(); update_gizmo(); } -Ref<Material> CSGBox::get_material() const { +Ref<Material> CSGBox3D::get_material() const { return material; } -CSGBox::CSGBox() { +CSGBox3D::CSGBox3D() { // defaults width = 2.0; height = 2.0; @@ -1294,7 +1294,7 @@ CSGBox::CSGBox() { /////////////// -CSGBrush *CSGCylinder::_build_brush() { +CSGBrush *CSGCylinder3D::_build_brush() { // set our bounding box @@ -1430,24 +1430,24 @@ CSGBrush *CSGCylinder::_build_brush() { return brush; } -void CSGCylinder::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CSGCylinder::set_radius); - ClassDB::bind_method(D_METHOD("get_radius"), &CSGCylinder::get_radius); +void CSGCylinder3D::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CSGCylinder3D::set_radius); + ClassDB::bind_method(D_METHOD("get_radius"), &CSGCylinder3D::get_radius); - ClassDB::bind_method(D_METHOD("set_height", "height"), &CSGCylinder::set_height); - ClassDB::bind_method(D_METHOD("get_height"), &CSGCylinder::get_height); + ClassDB::bind_method(D_METHOD("set_height", "height"), &CSGCylinder3D::set_height); + ClassDB::bind_method(D_METHOD("get_height"), &CSGCylinder3D::get_height); - ClassDB::bind_method(D_METHOD("set_sides", "sides"), &CSGCylinder::set_sides); - ClassDB::bind_method(D_METHOD("get_sides"), &CSGCylinder::get_sides); + ClassDB::bind_method(D_METHOD("set_sides", "sides"), &CSGCylinder3D::set_sides); + ClassDB::bind_method(D_METHOD("get_sides"), &CSGCylinder3D::get_sides); - ClassDB::bind_method(D_METHOD("set_cone", "cone"), &CSGCylinder::set_cone); - ClassDB::bind_method(D_METHOD("is_cone"), &CSGCylinder::is_cone); + ClassDB::bind_method(D_METHOD("set_cone", "cone"), &CSGCylinder3D::set_cone); + ClassDB::bind_method(D_METHOD("is_cone"), &CSGCylinder3D::is_cone); - ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGCylinder::set_material); - ClassDB::bind_method(D_METHOD("get_material"), &CSGCylinder::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGCylinder3D::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &CSGCylinder3D::get_material); - ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGCylinder::set_smooth_faces); - ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGCylinder::get_smooth_faces); + ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGCylinder3D::set_smooth_faces); + ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGCylinder3D::get_smooth_faces); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_radius", "get_radius"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_height", "get_height"); @@ -1457,70 +1457,70 @@ void CSGCylinder::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "StandardMaterial3D,ShaderMaterial"), "set_material", "get_material"); } -void CSGCylinder::set_radius(const float p_radius) { +void CSGCylinder3D::set_radius(const float p_radius) { radius = p_radius; _make_dirty(); update_gizmo(); _change_notify("radius"); } -float CSGCylinder::get_radius() const { +float CSGCylinder3D::get_radius() const { return radius; } -void CSGCylinder::set_height(const float p_height) { +void CSGCylinder3D::set_height(const float p_height) { height = p_height; _make_dirty(); update_gizmo(); _change_notify("height"); } -float CSGCylinder::get_height() const { +float CSGCylinder3D::get_height() const { return height; } -void CSGCylinder::set_sides(const int p_sides) { +void CSGCylinder3D::set_sides(const int p_sides) { ERR_FAIL_COND(p_sides < 3); sides = p_sides; _make_dirty(); update_gizmo(); } -int CSGCylinder::get_sides() const { +int CSGCylinder3D::get_sides() const { return sides; } -void CSGCylinder::set_cone(const bool p_cone) { +void CSGCylinder3D::set_cone(const bool p_cone) { cone = p_cone; _make_dirty(); update_gizmo(); } -bool CSGCylinder::is_cone() const { +bool CSGCylinder3D::is_cone() const { return cone; } -void CSGCylinder::set_smooth_faces(const bool p_smooth_faces) { +void CSGCylinder3D::set_smooth_faces(const bool p_smooth_faces) { smooth_faces = p_smooth_faces; _make_dirty(); } -bool CSGCylinder::get_smooth_faces() const { +bool CSGCylinder3D::get_smooth_faces() const { return smooth_faces; } -void CSGCylinder::set_material(const Ref<Material> &p_material) { +void CSGCylinder3D::set_material(const Ref<Material> &p_material) { material = p_material; _make_dirty(); } -Ref<Material> CSGCylinder::get_material() const { +Ref<Material> CSGCylinder3D::get_material() const { return material; } -CSGCylinder::CSGCylinder() { +CSGCylinder3D::CSGCylinder3D() { // defaults radius = 1.0; height = 1.0; @@ -1531,7 +1531,7 @@ CSGCylinder::CSGCylinder() { /////////////// -CSGBrush *CSGTorus::_build_brush() { +CSGBrush *CSGTorus3D::_build_brush() { // set our bounding box @@ -1657,24 +1657,24 @@ CSGBrush *CSGTorus::_build_brush() { return brush; } -void CSGTorus::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_inner_radius", "radius"), &CSGTorus::set_inner_radius); - ClassDB::bind_method(D_METHOD("get_inner_radius"), &CSGTorus::get_inner_radius); +void CSGTorus3D::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_inner_radius", "radius"), &CSGTorus3D::set_inner_radius); + ClassDB::bind_method(D_METHOD("get_inner_radius"), &CSGTorus3D::get_inner_radius); - ClassDB::bind_method(D_METHOD("set_outer_radius", "radius"), &CSGTorus::set_outer_radius); - ClassDB::bind_method(D_METHOD("get_outer_radius"), &CSGTorus::get_outer_radius); + ClassDB::bind_method(D_METHOD("set_outer_radius", "radius"), &CSGTorus3D::set_outer_radius); + ClassDB::bind_method(D_METHOD("get_outer_radius"), &CSGTorus3D::get_outer_radius); - ClassDB::bind_method(D_METHOD("set_sides", "sides"), &CSGTorus::set_sides); - ClassDB::bind_method(D_METHOD("get_sides"), &CSGTorus::get_sides); + ClassDB::bind_method(D_METHOD("set_sides", "sides"), &CSGTorus3D::set_sides); + ClassDB::bind_method(D_METHOD("get_sides"), &CSGTorus3D::get_sides); - ClassDB::bind_method(D_METHOD("set_ring_sides", "sides"), &CSGTorus::set_ring_sides); - ClassDB::bind_method(D_METHOD("get_ring_sides"), &CSGTorus::get_ring_sides); + ClassDB::bind_method(D_METHOD("set_ring_sides", "sides"), &CSGTorus3D::set_ring_sides); + ClassDB::bind_method(D_METHOD("get_ring_sides"), &CSGTorus3D::get_ring_sides); - ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGTorus::set_material); - ClassDB::bind_method(D_METHOD("get_material"), &CSGTorus::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGTorus3D::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &CSGTorus3D::get_material); - ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGTorus::set_smooth_faces); - ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGTorus::get_smooth_faces); + ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGTorus3D::set_smooth_faces); + ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGTorus3D::get_smooth_faces); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "inner_radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_inner_radius", "get_inner_radius"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "outer_radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_outer_radius", "get_outer_radius"); @@ -1684,71 +1684,71 @@ void CSGTorus::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "StandardMaterial3D,ShaderMaterial"), "set_material", "get_material"); } -void CSGTorus::set_inner_radius(const float p_inner_radius) { +void CSGTorus3D::set_inner_radius(const float p_inner_radius) { inner_radius = p_inner_radius; _make_dirty(); update_gizmo(); _change_notify("inner_radius"); } -float CSGTorus::get_inner_radius() const { +float CSGTorus3D::get_inner_radius() const { return inner_radius; } -void CSGTorus::set_outer_radius(const float p_outer_radius) { +void CSGTorus3D::set_outer_radius(const float p_outer_radius) { outer_radius = p_outer_radius; _make_dirty(); update_gizmo(); _change_notify("outer_radius"); } -float CSGTorus::get_outer_radius() const { +float CSGTorus3D::get_outer_radius() const { return outer_radius; } -void CSGTorus::set_sides(const int p_sides) { +void CSGTorus3D::set_sides(const int p_sides) { ERR_FAIL_COND(p_sides < 3); sides = p_sides; _make_dirty(); update_gizmo(); } -int CSGTorus::get_sides() const { +int CSGTorus3D::get_sides() const { return sides; } -void CSGTorus::set_ring_sides(const int p_ring_sides) { +void CSGTorus3D::set_ring_sides(const int p_ring_sides) { ERR_FAIL_COND(p_ring_sides < 3); ring_sides = p_ring_sides; _make_dirty(); update_gizmo(); } -int CSGTorus::get_ring_sides() const { +int CSGTorus3D::get_ring_sides() const { return ring_sides; } -void CSGTorus::set_smooth_faces(const bool p_smooth_faces) { +void CSGTorus3D::set_smooth_faces(const bool p_smooth_faces) { smooth_faces = p_smooth_faces; _make_dirty(); } -bool CSGTorus::get_smooth_faces() const { +bool CSGTorus3D::get_smooth_faces() const { return smooth_faces; } -void CSGTorus::set_material(const Ref<Material> &p_material) { +void CSGTorus3D::set_material(const Ref<Material> &p_material) { material = p_material; _make_dirty(); } -Ref<Material> CSGTorus::get_material() const { +Ref<Material> CSGTorus3D::get_material() const { return material; } -CSGTorus::CSGTorus() { +CSGTorus3D::CSGTorus3D() { // defaults inner_radius = 2.0; outer_radius = 3.0; @@ -1759,7 +1759,7 @@ CSGTorus::CSGTorus() { /////////////// -CSGBrush *CSGPolygon::_build_brush() { +CSGBrush *CSGPolygon3D::_build_brush() { // set our bounding box @@ -1777,7 +1777,7 @@ CSGBrush *CSGPolygon::_build_brush() { if (triangles.size() < 3) return NULL; - Path *path = NULL; + Path3D *path = NULL; Ref<Curve3D> curve; // get bounds for our polygon @@ -1804,21 +1804,21 @@ CSGBrush *CSGPolygon::_build_brush() { Node *n = get_node(path_node); if (!n) return NULL; - path = Object::cast_to<Path>(n); + path = Object::cast_to<Path3D>(n); if (!path) return NULL; if (path != path_cache) { if (path_cache) { - path_cache->disconnect("tree_exited", callable_mp(this, &CSGPolygon::_path_exited)); - path_cache->disconnect("curve_changed", callable_mp(this, &CSGPolygon::_path_changed)); + path_cache->disconnect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited)); + path_cache->disconnect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed)); path_cache = NULL; } path_cache = path; - path_cache->connect("tree_exited", callable_mp(this, &CSGPolygon::_path_exited)); - path_cache->connect("curve_changed", callable_mp(this, &CSGPolygon::_path_changed)); + path_cache->connect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited)); + path_cache->connect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed)); path_cache = NULL; } curve = path->get_curve(); @@ -2231,17 +2231,17 @@ CSGBrush *CSGPolygon::_build_brush() { return brush; } -void CSGPolygon::_notification(int p_what) { +void CSGPolygon3D::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_TREE) { if (path_cache) { - path_cache->disconnect("tree_exited", callable_mp(this, &CSGPolygon::_path_exited)); - path_cache->disconnect("curve_changed", callable_mp(this, &CSGPolygon::_path_changed)); + path_cache->disconnect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited)); + path_cache->disconnect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed)); path_cache = NULL; } } } -void CSGPolygon::_validate_property(PropertyInfo &property) const { +void CSGPolygon3D::_validate_property(PropertyInfo &property) const { if (property.name.begins_with("spin") && mode != MODE_SPIN) { property.usage = 0; } @@ -2252,60 +2252,60 @@ void CSGPolygon::_validate_property(PropertyInfo &property) const { property.usage = 0; } - CSGShape::_validate_property(property); + CSGShape3D::_validate_property(property); } -void CSGPolygon::_path_changed() { +void CSGPolygon3D::_path_changed() { _make_dirty(); update_gizmo(); } -void CSGPolygon::_path_exited() { +void CSGPolygon3D::_path_exited() { path_cache = NULL; } -void CSGPolygon::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_polygon", "polygon"), &CSGPolygon::set_polygon); - ClassDB::bind_method(D_METHOD("get_polygon"), &CSGPolygon::get_polygon); +void CSGPolygon3D::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_polygon", "polygon"), &CSGPolygon3D::set_polygon); + ClassDB::bind_method(D_METHOD("get_polygon"), &CSGPolygon3D::get_polygon); - ClassDB::bind_method(D_METHOD("set_mode", "mode"), &CSGPolygon::set_mode); - ClassDB::bind_method(D_METHOD("get_mode"), &CSGPolygon::get_mode); + ClassDB::bind_method(D_METHOD("set_mode", "mode"), &CSGPolygon3D::set_mode); + ClassDB::bind_method(D_METHOD("get_mode"), &CSGPolygon3D::get_mode); - ClassDB::bind_method(D_METHOD("set_depth", "depth"), &CSGPolygon::set_depth); - ClassDB::bind_method(D_METHOD("get_depth"), &CSGPolygon::get_depth); + ClassDB::bind_method(D_METHOD("set_depth", "depth"), &CSGPolygon3D::set_depth); + ClassDB::bind_method(D_METHOD("get_depth"), &CSGPolygon3D::get_depth); - ClassDB::bind_method(D_METHOD("set_spin_degrees", "degrees"), &CSGPolygon::set_spin_degrees); - ClassDB::bind_method(D_METHOD("get_spin_degrees"), &CSGPolygon::get_spin_degrees); + ClassDB::bind_method(D_METHOD("set_spin_degrees", "degrees"), &CSGPolygon3D::set_spin_degrees); + ClassDB::bind_method(D_METHOD("get_spin_degrees"), &CSGPolygon3D::get_spin_degrees); - ClassDB::bind_method(D_METHOD("set_spin_sides", "spin_sides"), &CSGPolygon::set_spin_sides); - ClassDB::bind_method(D_METHOD("get_spin_sides"), &CSGPolygon::get_spin_sides); + ClassDB::bind_method(D_METHOD("set_spin_sides", "spin_sides"), &CSGPolygon3D::set_spin_sides); + ClassDB::bind_method(D_METHOD("get_spin_sides"), &CSGPolygon3D::get_spin_sides); - ClassDB::bind_method(D_METHOD("set_path_node", "path"), &CSGPolygon::set_path_node); - ClassDB::bind_method(D_METHOD("get_path_node"), &CSGPolygon::get_path_node); + ClassDB::bind_method(D_METHOD("set_path_node", "path"), &CSGPolygon3D::set_path_node); + ClassDB::bind_method(D_METHOD("get_path_node"), &CSGPolygon3D::get_path_node); - ClassDB::bind_method(D_METHOD("set_path_interval", "distance"), &CSGPolygon::set_path_interval); - ClassDB::bind_method(D_METHOD("get_path_interval"), &CSGPolygon::get_path_interval); + ClassDB::bind_method(D_METHOD("set_path_interval", "distance"), &CSGPolygon3D::set_path_interval); + ClassDB::bind_method(D_METHOD("get_path_interval"), &CSGPolygon3D::get_path_interval); - ClassDB::bind_method(D_METHOD("set_path_rotation", "mode"), &CSGPolygon::set_path_rotation); - ClassDB::bind_method(D_METHOD("get_path_rotation"), &CSGPolygon::get_path_rotation); + ClassDB::bind_method(D_METHOD("set_path_rotation", "mode"), &CSGPolygon3D::set_path_rotation); + ClassDB::bind_method(D_METHOD("get_path_rotation"), &CSGPolygon3D::get_path_rotation); - ClassDB::bind_method(D_METHOD("set_path_local", "enable"), &CSGPolygon::set_path_local); - ClassDB::bind_method(D_METHOD("is_path_local"), &CSGPolygon::is_path_local); + ClassDB::bind_method(D_METHOD("set_path_local", "enable"), &CSGPolygon3D::set_path_local); + ClassDB::bind_method(D_METHOD("is_path_local"), &CSGPolygon3D::is_path_local); - ClassDB::bind_method(D_METHOD("set_path_continuous_u", "enable"), &CSGPolygon::set_path_continuous_u); - ClassDB::bind_method(D_METHOD("is_path_continuous_u"), &CSGPolygon::is_path_continuous_u); + ClassDB::bind_method(D_METHOD("set_path_continuous_u", "enable"), &CSGPolygon3D::set_path_continuous_u); + ClassDB::bind_method(D_METHOD("is_path_continuous_u"), &CSGPolygon3D::is_path_continuous_u); - ClassDB::bind_method(D_METHOD("set_path_joined", "enable"), &CSGPolygon::set_path_joined); - ClassDB::bind_method(D_METHOD("is_path_joined"), &CSGPolygon::is_path_joined); + ClassDB::bind_method(D_METHOD("set_path_joined", "enable"), &CSGPolygon3D::set_path_joined); + ClassDB::bind_method(D_METHOD("is_path_joined"), &CSGPolygon3D::is_path_joined); - ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGPolygon::set_material); - ClassDB::bind_method(D_METHOD("get_material"), &CSGPolygon::get_material); + ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGPolygon3D::set_material); + ClassDB::bind_method(D_METHOD("get_material"), &CSGPolygon3D::get_material); - ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGPolygon::set_smooth_faces); - ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGPolygon::get_smooth_faces); + ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGPolygon3D::set_smooth_faces); + ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGPolygon3D::get_smooth_faces); - ClassDB::bind_method(D_METHOD("_is_editable_3d_polygon"), &CSGPolygon::_is_editable_3d_polygon); - ClassDB::bind_method(D_METHOD("_has_editable_3d_polygon_no_depth"), &CSGPolygon::_has_editable_3d_polygon_no_depth); + ClassDB::bind_method(D_METHOD("_is_editable_3d_polygon"), &CSGPolygon3D::_is_editable_3d_polygon); + ClassDB::bind_method(D_METHOD("_has_editable_3d_polygon_no_depth"), &CSGPolygon3D::_has_editable_3d_polygon_no_depth); ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Depth,Spin,Path"), "set_mode", "get_mode"); @@ -2330,148 +2330,148 @@ void CSGPolygon::_bind_methods() { BIND_ENUM_CONSTANT(PATH_ROTATION_PATH_FOLLOW); } -void CSGPolygon::set_polygon(const Vector<Vector2> &p_polygon) { +void CSGPolygon3D::set_polygon(const Vector<Vector2> &p_polygon) { polygon = p_polygon; _make_dirty(); update_gizmo(); } -Vector<Vector2> CSGPolygon::get_polygon() const { +Vector<Vector2> CSGPolygon3D::get_polygon() const { return polygon; } -void CSGPolygon::set_mode(Mode p_mode) { +void CSGPolygon3D::set_mode(Mode p_mode) { mode = p_mode; _make_dirty(); update_gizmo(); _change_notify(); } -CSGPolygon::Mode CSGPolygon::get_mode() const { +CSGPolygon3D::Mode CSGPolygon3D::get_mode() const { return mode; } -void CSGPolygon::set_depth(const float p_depth) { +void CSGPolygon3D::set_depth(const float p_depth) { ERR_FAIL_COND(p_depth < 0.001); depth = p_depth; _make_dirty(); update_gizmo(); } -float CSGPolygon::get_depth() const { +float CSGPolygon3D::get_depth() const { return depth; } -void CSGPolygon::set_path_continuous_u(bool p_enable) { +void CSGPolygon3D::set_path_continuous_u(bool p_enable) { path_continuous_u = p_enable; _make_dirty(); } -bool CSGPolygon::is_path_continuous_u() const { +bool CSGPolygon3D::is_path_continuous_u() const { return path_continuous_u; } -void CSGPolygon::set_spin_degrees(const float p_spin_degrees) { +void CSGPolygon3D::set_spin_degrees(const float p_spin_degrees) { ERR_FAIL_COND(p_spin_degrees < 0.01 || p_spin_degrees > 360); spin_degrees = p_spin_degrees; _make_dirty(); update_gizmo(); } -float CSGPolygon::get_spin_degrees() const { +float CSGPolygon3D::get_spin_degrees() const { return spin_degrees; } -void CSGPolygon::set_spin_sides(const int p_spin_sides) { +void CSGPolygon3D::set_spin_sides(const int p_spin_sides) { ERR_FAIL_COND(p_spin_sides < 3); spin_sides = p_spin_sides; _make_dirty(); update_gizmo(); } -int CSGPolygon::get_spin_sides() const { +int CSGPolygon3D::get_spin_sides() const { return spin_sides; } -void CSGPolygon::set_path_node(const NodePath &p_path) { +void CSGPolygon3D::set_path_node(const NodePath &p_path) { path_node = p_path; _make_dirty(); update_gizmo(); } -NodePath CSGPolygon::get_path_node() const { +NodePath CSGPolygon3D::get_path_node() const { return path_node; } -void CSGPolygon::set_path_interval(float p_interval) { +void CSGPolygon3D::set_path_interval(float p_interval) { ERR_FAIL_COND_MSG(p_interval < 0.001, "Path interval cannot be smaller than 0.001."); path_interval = p_interval; _make_dirty(); update_gizmo(); } -float CSGPolygon::get_path_interval() const { +float CSGPolygon3D::get_path_interval() const { return path_interval; } -void CSGPolygon::set_path_rotation(PathRotation p_rotation) { +void CSGPolygon3D::set_path_rotation(PathRotation p_rotation) { path_rotation = p_rotation; _make_dirty(); update_gizmo(); } -CSGPolygon::PathRotation CSGPolygon::get_path_rotation() const { +CSGPolygon3D::PathRotation CSGPolygon3D::get_path_rotation() const { return path_rotation; } -void CSGPolygon::set_path_local(bool p_enable) { +void CSGPolygon3D::set_path_local(bool p_enable) { path_local = p_enable; _make_dirty(); update_gizmo(); } -bool CSGPolygon::is_path_local() const { +bool CSGPolygon3D::is_path_local() const { return path_local; } -void CSGPolygon::set_path_joined(bool p_enable) { +void CSGPolygon3D::set_path_joined(bool p_enable) { path_joined = p_enable; _make_dirty(); update_gizmo(); } -bool CSGPolygon::is_path_joined() const { +bool CSGPolygon3D::is_path_joined() const { return path_joined; } -void CSGPolygon::set_smooth_faces(const bool p_smooth_faces) { +void CSGPolygon3D::set_smooth_faces(const bool p_smooth_faces) { smooth_faces = p_smooth_faces; _make_dirty(); } -bool CSGPolygon::get_smooth_faces() const { +bool CSGPolygon3D::get_smooth_faces() const { return smooth_faces; } -void CSGPolygon::set_material(const Ref<Material> &p_material) { +void CSGPolygon3D::set_material(const Ref<Material> &p_material) { material = p_material; _make_dirty(); } -Ref<Material> CSGPolygon::get_material() const { +Ref<Material> CSGPolygon3D::get_material() const { return material; } -bool CSGPolygon::_is_editable_3d_polygon() const { +bool CSGPolygon3D::_is_editable_3d_polygon() const { return true; } -bool CSGPolygon::_has_editable_3d_polygon_no_depth() const { +bool CSGPolygon3D::_has_editable_3d_polygon_no_depth() const { return true; } -CSGPolygon::CSGPolygon() { +CSGPolygon3D::CSGPolygon3D() { // defaults mode = MODE_DEPTH; polygon.push_back(Vector2(0, 0)); diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index fdbf979fe7..abab1ded20 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -34,12 +34,12 @@ #define CSGJS_HEADER_ONLY #include "csg.h" -#include "scene/3d/visual_instance.h" -#include "scene/resources/concave_polygon_shape.h" +#include "scene/3d/visual_instance_3d.h" +#include "scene/resources/concave_polygon_shape_3d.h" #include "thirdparty/misc/mikktspace.h" -class CSGShape : public GeometryInstance { - GDCLASS(CSGShape, GeometryInstance); +class CSGShape3D : public GeometryInstance3D { + GDCLASS(CSGShape3D, GeometryInstance3D); public: enum Operation { @@ -51,7 +51,7 @@ public: private: Operation operation; - CSGShape *parent; + CSGShape3D *parent; CSGBrush *brush; @@ -63,7 +63,7 @@ private: bool use_collision; uint32_t collision_layer; uint32_t collision_mask; - Ref<ConcavePolygonShape> root_collision_shape; + Ref<ConcavePolygonShape3D> root_collision_shape; RID root_collision_instance; bool calculate_tangents; @@ -111,7 +111,7 @@ protected: static void _bind_methods(); - friend class CSGCombiner; + friend class CSGCombiner3D; CSGBrush *_get_brush(); virtual void _validate_property(PropertyInfo &property) const; @@ -149,24 +149,24 @@ public: bool is_calculating_tangents() const; bool is_root_shape() const; - CSGShape(); - ~CSGShape(); + CSGShape3D(); + ~CSGShape3D(); }; -VARIANT_ENUM_CAST(CSGShape::Operation) +VARIANT_ENUM_CAST(CSGShape3D::Operation) -class CSGCombiner : public CSGShape { - GDCLASS(CSGCombiner, CSGShape); +class CSGCombiner3D : public CSGShape3D { + GDCLASS(CSGCombiner3D, CSGShape3D); private: virtual CSGBrush *_build_brush(); public: - CSGCombiner(); + CSGCombiner3D(); }; -class CSGPrimitive : public CSGShape { - GDCLASS(CSGPrimitive, CSGShape); +class CSGPrimitive3D : public CSGShape3D { + GDCLASS(CSGPrimitive3D, CSGShape3D); private: bool invert_faces; @@ -179,11 +179,11 @@ public: void set_invert_faces(bool p_invert); bool is_inverting_faces(); - CSGPrimitive(); + CSGPrimitive3D(); }; -class CSGMesh : public CSGPrimitive { - GDCLASS(CSGMesh, CSGPrimitive); +class CSGMesh3D : public CSGPrimitive3D { + GDCLASS(CSGMesh3D, CSGPrimitive3D); virtual CSGBrush *_build_brush(); @@ -203,9 +203,9 @@ public: Ref<Material> get_material() const; }; -class CSGSphere : public CSGPrimitive { +class CSGSphere3D : public CSGPrimitive3D { - GDCLASS(CSGSphere, CSGPrimitive); + GDCLASS(CSGSphere3D, CSGPrimitive3D); virtual CSGBrush *_build_brush(); Ref<Material> material; @@ -233,12 +233,12 @@ public: void set_smooth_faces(bool p_smooth_faces); bool get_smooth_faces() const; - CSGSphere(); + CSGSphere3D(); }; -class CSGBox : public CSGPrimitive { +class CSGBox3D : public CSGPrimitive3D { - GDCLASS(CSGBox, CSGPrimitive); + GDCLASS(CSGBox3D, CSGPrimitive3D); virtual CSGBrush *_build_brush(); Ref<Material> material; @@ -262,12 +262,12 @@ public: void set_material(const Ref<Material> &p_material); Ref<Material> get_material() const; - CSGBox(); + CSGBox3D(); }; -class CSGCylinder : public CSGPrimitive { +class CSGCylinder3D : public CSGPrimitive3D { - GDCLASS(CSGCylinder, CSGPrimitive); + GDCLASS(CSGCylinder3D, CSGPrimitive3D); virtual CSGBrush *_build_brush(); Ref<Material> material; @@ -299,12 +299,12 @@ public: void set_material(const Ref<Material> &p_material); Ref<Material> get_material() const; - CSGCylinder(); + CSGCylinder3D(); }; -class CSGTorus : public CSGPrimitive { +class CSGTorus3D : public CSGPrimitive3D { - GDCLASS(CSGTorus, CSGPrimitive); + GDCLASS(CSGTorus3D, CSGPrimitive3D); virtual CSGBrush *_build_brush(); Ref<Material> material; @@ -336,12 +336,12 @@ public: void set_material(const Ref<Material> &p_material); Ref<Material> get_material() const; - CSGTorus(); + CSGTorus3D(); }; -class CSGPolygon : public CSGPrimitive { +class CSGPolygon3D : public CSGPrimitive3D { - GDCLASS(CSGPolygon, CSGPrimitive); + GDCLASS(CSGPolygon3D, CSGPrimitive3D); public: enum Mode { @@ -431,10 +431,10 @@ public: void set_material(const Ref<Material> &p_material); Ref<Material> get_material() const; - CSGPolygon(); + CSGPolygon3D(); }; -VARIANT_ENUM_CAST(CSGPolygon::Mode) -VARIANT_ENUM_CAST(CSGPolygon::PathRotation) +VARIANT_ENUM_CAST(CSGPolygon3D::Mode) +VARIANT_ENUM_CAST(CSGPolygon3D::PathRotation) #endif // CSG_SHAPE_H diff --git a/modules/csg/icons/CSGBox.svg b/modules/csg/icons/CSGBox3D.svg index 67e34df444..67e34df444 100644 --- a/modules/csg/icons/CSGBox.svg +++ b/modules/csg/icons/CSGBox3D.svg diff --git a/modules/csg/icons/CSGCapsule.svg b/modules/csg/icons/CSGCapsule3D.svg index 92a7b5a870..92a7b5a870 100644 --- a/modules/csg/icons/CSGCapsule.svg +++ b/modules/csg/icons/CSGCapsule3D.svg diff --git a/modules/csg/icons/CSGCombiner.svg b/modules/csg/icons/CSGCombiner3D.svg index cce2902e24..cce2902e24 100644 --- a/modules/csg/icons/CSGCombiner.svg +++ b/modules/csg/icons/CSGCombiner3D.svg diff --git a/modules/csg/icons/CSGCylinder.svg b/modules/csg/icons/CSGCylinder3D.svg index 645a74c79b..645a74c79b 100644 --- a/modules/csg/icons/CSGCylinder.svg +++ b/modules/csg/icons/CSGCylinder3D.svg diff --git a/modules/csg/icons/CSGMesh.svg b/modules/csg/icons/CSGMesh3D.svg index 6e940a4aa5..6e940a4aa5 100644 --- a/modules/csg/icons/CSGMesh.svg +++ b/modules/csg/icons/CSGMesh3D.svg diff --git a/modules/csg/icons/CSGPolygon.svg b/modules/csg/icons/CSGPolygon3D.svg index 71b03cb8e6..71b03cb8e6 100644 --- a/modules/csg/icons/CSGPolygon.svg +++ b/modules/csg/icons/CSGPolygon3D.svg diff --git a/modules/csg/icons/CSGSphere.svg b/modules/csg/icons/CSGSphere3D.svg index f81b566993..f81b566993 100644 --- a/modules/csg/icons/CSGSphere.svg +++ b/modules/csg/icons/CSGSphere3D.svg diff --git a/modules/csg/icons/CSGTorus.svg b/modules/csg/icons/CSGTorus3D.svg index 3d30aa47b2..3d30aa47b2 100644 --- a/modules/csg/icons/CSGTorus.svg +++ b/modules/csg/icons/CSGTorus3D.svg diff --git a/modules/csg/register_types.cpp b/modules/csg/register_types.cpp index 677a20df38..1a12a6706d 100644 --- a/modules/csg/register_types.cpp +++ b/modules/csg/register_types.cpp @@ -37,15 +37,24 @@ void register_csg_types() { #ifndef _3D_DISABLED - ClassDB::register_virtual_class<CSGShape>(); - ClassDB::register_virtual_class<CSGPrimitive>(); - ClassDB::register_class<CSGMesh>(); - ClassDB::register_class<CSGSphere>(); - ClassDB::register_class<CSGBox>(); - ClassDB::register_class<CSGCylinder>(); - ClassDB::register_class<CSGTorus>(); - ClassDB::register_class<CSGPolygon>(); - ClassDB::register_class<CSGCombiner>(); + ClassDB::register_virtual_class<CSGShape3D>(); + ClassDB::register_virtual_class<CSGPrimitive3D>(); + ClassDB::register_class<CSGMesh3D>(); + ClassDB::register_class<CSGSphere3D>(); + ClassDB::register_class<CSGBox3D>(); + ClassDB::register_class<CSGCylinder3D>(); + ClassDB::register_class<CSGTorus3D>(); + ClassDB::register_class<CSGPolygon3D>(); + ClassDB::register_class<CSGCombiner3D>(); + + ClassDB::add_compatibility_class("CSGShape", "CSGShape3D"); + ClassDB::add_compatibility_class("CSGMesh", "CSGMesh3D"); + ClassDB::add_compatibility_class("CSGSphere", "CSGSphere3D"); + ClassDB::add_compatibility_class("CSGBox", "CSGBox3D"); + ClassDB::add_compatibility_class("CSGCylinder", "CSGCylinder3D"); + ClassDB::add_compatibility_class("CSGTorus", "CSGTorus3D"); + ClassDB::add_compatibility_class("CSGPolygon", "CSGPolygon3D"); + ClassDB::add_compatibility_class("CSGCombiner", "CSGCombiner3D"); #ifdef TOOLS_ENABLED EditorPlugins::add_by_type<EditorPluginCSG>(); diff --git a/modules/gdnavigation/nav_region.h b/modules/gdnavigation/nav_region.h index d99254d1ad..f35ee4bea0 100644 --- a/modules/gdnavigation/nav_region.h +++ b/modules/gdnavigation/nav_region.h @@ -34,7 +34,7 @@ #include "nav_rid.h" #include "nav_utils.h" -#include "scene/3d/navigation.h" +#include "scene/3d/navigation_3d.h" #include <vector> /** diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp index 05feb97131..6238acfdc5 100644 --- a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp +++ b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp @@ -34,7 +34,7 @@ #include "core/io/marshalls.h" #include "core/io/resource_saver.h" #include "navigation_mesh_generator.h" -#include "scene/3d/mesh_instance.h" +#include "scene/3d/mesh_instance_3d.h" #include "scene/gui/box_container.h" void NavigationMeshEditor::_node_removed(Node *p_node) { @@ -84,7 +84,7 @@ void NavigationMeshEditor::_clear_pressed() { } } -void NavigationMeshEditor::edit(NavigationRegion *p_nav_region) { +void NavigationMeshEditor::edit(NavigationRegion3D *p_nav_region) { if (p_nav_region == NULL || node == p_nav_region) { return; @@ -125,12 +125,12 @@ NavigationMeshEditor::~NavigationMeshEditor() { void NavigationMeshEditorPlugin::edit(Object *p_object) { - navigation_mesh_editor->edit(Object::cast_to<NavigationRegion>(p_object)); + navigation_mesh_editor->edit(Object::cast_to<NavigationRegion3D>(p_object)); } bool NavigationMeshEditorPlugin::handles(Object *p_object) const { - return p_object->is_class("NavigationRegion"); + return p_object->is_class("NavigationRegion3D"); } void NavigationMeshEditorPlugin::make_visible(bool p_visible) { diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.h b/modules/gdnavigation/navigation_mesh_editor_plugin.h index 847ad4f63d..434981c9e0 100644 --- a/modules/gdnavigation/navigation_mesh_editor_plugin.h +++ b/modules/gdnavigation/navigation_mesh_editor_plugin.h @@ -36,7 +36,7 @@ #include "editor/editor_node.h" #include "editor/editor_plugin.h" -class NavigationRegion; +class NavigationRegion3D; class NavigationMeshEditor : public Control { friend class NavigationMeshEditorPlugin; @@ -50,7 +50,7 @@ class NavigationMeshEditor : public Control { ToolButton *button_reset; Label *bake_info; - NavigationRegion *node; + NavigationRegion3D *node; void _bake_pressed(); void _clear_pressed(); @@ -61,7 +61,7 @@ protected: void _notification(int p_option); public: - void edit(NavigationRegion *p_nav_region); + void edit(NavigationRegion3D *p_nav_region); NavigationMeshEditor(); ~NavigationMeshEditor(); }; diff --git a/modules/gdnavigation/navigation_mesh_generator.cpp b/modules/gdnavigation/navigation_mesh_generator.cpp index e7038b38a2..ec19c7b8a3 100644 --- a/modules/gdnavigation/navigation_mesh_generator.cpp +++ b/modules/gdnavigation/navigation_mesh_generator.cpp @@ -34,18 +34,18 @@ #include "core/math/quick_hull.h" #include "core/os/thread.h" -#include "scene/3d/collision_shape.h" -#include "scene/3d/mesh_instance.h" -#include "scene/3d/physics_body.h" -#include "scene/resources/box_shape.h" -#include "scene/resources/capsule_shape.h" -#include "scene/resources/concave_polygon_shape.h" -#include "scene/resources/convex_polygon_shape.h" -#include "scene/resources/cylinder_shape.h" +#include "scene/3d/collision_shape_3d.h" +#include "scene/3d/mesh_instance_3d.h" +#include "scene/3d/physics_body_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/primitive_meshes.h" -#include "scene/resources/shape.h" -#include "scene/resources/sphere_shape.h" -#include "scene/resources/world_margin_shape.h" +#include "scene/resources/shape_3d.h" +#include "scene/resources/sphere_shape_3d.h" +#include "scene/resources/world_margin_shape_3d.h" #include "modules/modules_enabled.gen.h" #ifdef TOOLS_ENABLED @@ -140,9 +140,9 @@ void NavigationMeshGenerator::_add_faces(const PackedVector3Array &p_faces, cons void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, Node *p_node, Vector<float> &p_verticies, Vector<int> &p_indices, int p_generate_from, uint32_t p_collision_mask, bool p_recurse_children) { - if (Object::cast_to<MeshInstance>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) { + if (Object::cast_to<MeshInstance3D>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) { - MeshInstance *mesh_instance = Object::cast_to<MeshInstance>(p_node); + MeshInstance3D *mesh_instance = Object::cast_to<MeshInstance3D>(p_node); Ref<Mesh> mesh = mesh_instance->get_mesh(); if (mesh.is_valid()) { _add_mesh(mesh, p_accumulated_transform * mesh_instance->get_transform(), p_verticies, p_indices); @@ -150,9 +150,9 @@ void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, } #ifdef MODULE_CSG_ENABLED - if (Object::cast_to<CSGShape>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) { + if (Object::cast_to<CSGShape3D>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) { - CSGShape *csg_shape = Object::cast_to<CSGShape>(p_node); + CSGShape3D *csg_shape = Object::cast_to<CSGShape3D>(p_node); Array meshes = csg_shape->get_meshes(); if (!meshes.empty()) { Ref<Mesh> mesh = meshes[1]; @@ -163,22 +163,22 @@ void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, } #endif - if (Object::cast_to<StaticBody>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_MESH_INSTANCES) { - StaticBody *static_body = Object::cast_to<StaticBody>(p_node); + if (Object::cast_to<StaticBody3D>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_MESH_INSTANCES) { + StaticBody3D *static_body = Object::cast_to<StaticBody3D>(p_node); if (static_body->get_collision_layer() & p_collision_mask) { for (int i = 0; i < p_node->get_child_count(); ++i) { Node *child = p_node->get_child(i); - if (Object::cast_to<CollisionShape>(child)) { - CollisionShape *col_shape = Object::cast_to<CollisionShape>(child); + if (Object::cast_to<CollisionShape3D>(child)) { + CollisionShape3D *col_shape = Object::cast_to<CollisionShape3D>(child); Transform transform = p_accumulated_transform * static_body->get_transform() * col_shape->get_transform(); Ref<Mesh> mesh; - Ref<Shape> s = col_shape->get_shape(); + Ref<Shape3D> s = col_shape->get_shape(); - BoxShape *box = Object::cast_to<BoxShape>(*s); + BoxShape3D *box = Object::cast_to<BoxShape3D>(*s); if (box) { Ref<CubeMesh> cube_mesh; cube_mesh.instance(); @@ -186,7 +186,7 @@ void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, mesh = cube_mesh; } - CapsuleShape *capsule = Object::cast_to<CapsuleShape>(*s); + CapsuleShape3D *capsule = Object::cast_to<CapsuleShape3D>(*s); if (capsule) { Ref<CapsuleMesh> capsule_mesh; capsule_mesh.instance(); @@ -195,7 +195,7 @@ void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, mesh = capsule_mesh; } - CylinderShape *cylinder = Object::cast_to<CylinderShape>(*s); + CylinderShape3D *cylinder = Object::cast_to<CylinderShape3D>(*s); if (cylinder) { Ref<CylinderMesh> cylinder_mesh; cylinder_mesh.instance(); @@ -205,7 +205,7 @@ void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, mesh = cylinder_mesh; } - SphereShape *sphere = Object::cast_to<SphereShape>(*s); + SphereShape3D *sphere = Object::cast_to<SphereShape3D>(*s); if (sphere) { Ref<SphereMesh> sphere_mesh; sphere_mesh.instance(); @@ -214,12 +214,12 @@ void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, mesh = sphere_mesh; } - ConcavePolygonShape *concave_polygon = Object::cast_to<ConcavePolygonShape>(*s); + ConcavePolygonShape3D *concave_polygon = Object::cast_to<ConcavePolygonShape3D>(*s); if (concave_polygon) { _add_faces(concave_polygon->get_faces(), transform, p_verticies, p_indices); } - ConvexPolygonShape *convex_polygon = Object::cast_to<ConvexPolygonShape>(*s); + ConvexPolygonShape3D *convex_polygon = Object::cast_to<ConvexPolygonShape3D>(*s); if (convex_polygon) { Vector<Vector3> varr = Variant(convex_polygon->get_points()); Geometry::MeshData md; @@ -265,8 +265,8 @@ void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, } #endif - if (Object::cast_to<Spatial>(p_node)) { - Spatial *spatial = Object::cast_to<Spatial>(p_node); + if (Object::cast_to<Node3D>(p_node)) { + Node3D *spatial = Object::cast_to<Node3D>(p_node); p_accumulated_transform = p_accumulated_transform * spatial->get_transform(); } @@ -505,7 +505,7 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node) p_node->get_tree()->get_nodes_in_group(p_nav_mesh->get_source_group_name(), &parse_nodes); } - Transform navmesh_xform = Object::cast_to<Spatial>(p_node)->get_transform().affine_inverse(); + Transform navmesh_xform = Object::cast_to<Node3D>(p_node)->get_transform().affine_inverse(); for (const List<Node *>::Element *E = parse_nodes.front(); E; E = E->next()) { int geometry_type = p_nav_mesh->get_parsed_geometry_type(); uint32_t collision_mask = p_nav_mesh->get_collision_mask(); diff --git a/modules/gdnavigation/navigation_mesh_generator.h b/modules/gdnavigation/navigation_mesh_generator.h index d1f2e4b56f..c5f7b2ab81 100644 --- a/modules/gdnavigation/navigation_mesh_generator.h +++ b/modules/gdnavigation/navigation_mesh_generator.h @@ -33,7 +33,7 @@ #ifndef _3D_DISABLED -#include "scene/3d/navigation_region.h" +#include "scene/3d/navigation_region_3d.h" #include <Recast.h> diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 7273a014f0..61f18fbfee 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -32,7 +32,7 @@ #include "core/io/marshalls.h" #include "core/message_queue.h" -#include "scene/3d/light.h" +#include "scene/3d/light_3d.h" #include "scene/resources/mesh_library.h" #include "scene/resources/surface_tool.h" #include "scene/scene_string_names.h" @@ -667,14 +667,14 @@ void GridMap::_notification(int p_what) { case NOTIFICATION_ENTER_WORLD: { - Spatial *c = this; + Node3D *c = this; while (c) { - navigation = Object::cast_to<Navigation>(c); + navigation = Object::cast_to<Navigation3D>(c); if (navigation) { break; } - c = Object::cast_to<Spatial>(c->get_parent()); + c = Object::cast_to<Node3D>(c->get_parent()); } last_transform = get_global_transform(); diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index cc1c8c2923..43f4c09715 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -31,17 +31,17 @@ #ifndef GRID_MAP_H #define GRID_MAP_H -#include "scene/3d/navigation.h" -#include "scene/3d/spatial.h" +#include "scene/3d/navigation_3d.h" +#include "scene/3d/node_3d.h" #include "scene/resources/mesh_library.h" #include "scene/resources/multimesh.h" //heh heh, godotsphir!! this shares no code and the design is completely different with previous projects i've done.. //should scale better with hardware that supports instancing -class GridMap : public Spatial { +class GridMap : public Node3D { - GDCLASS(GridMap, Spatial); + GDCLASS(GridMap, Node3D); enum { MAP_DIRTY_TRANSFORMS = 1, @@ -147,7 +147,7 @@ class GridMap : public Spatial { int octant_size; bool center_x, center_y, center_z; float cell_scale; - Navigation *navigation; + Navigation3D *navigation; bool clip; bool clip_above; diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 1917a69388..0f377e2dec 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -33,7 +33,7 @@ #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/plugins/spatial_editor_plugin.h" -#include "scene/3d/camera.h" +#include "scene/3d/camera_3d.h" #include "core/math/geometry.h" #include "core/os/keyboard.h" @@ -362,7 +362,7 @@ void GridMapEditor::_set_selection(bool p_active, const Vector3 &p_begin, const options->get_popup()->set_item_disabled(options->get_popup()->get_item_index(MENU_OPTION_SELECTION_FILL), !selection.active); } -bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, bool p_click) { +bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, bool p_click) { if (!spatial_editor) return false; @@ -375,7 +375,7 @@ bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, boo if (input_action != INPUT_PICK && input_action != INPUT_SELECT && input_action != INPUT_PASTE && !mesh_library->has_item(selected_palette)) return false; - Camera *camera = p_camera; + Camera3D *camera = p_camera; Vector3 from = camera->project_ray_origin(p_point); Vector3 normal = camera->project_ray_normal(p_point); Transform local_xform = node->get_global_transform().affine_inverse(); @@ -639,7 +639,7 @@ void GridMapEditor::_do_paste() { _clear_clipboard_data(); } -bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<InputEvent> &p_event) { +bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<InputEvent> &p_event) { if (!node) { return false; } @@ -660,8 +660,8 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu } if (mb->is_pressed()) { - SpatialEditorViewport::NavigationScheme nav_scheme = (SpatialEditorViewport::NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); - if ((nav_scheme == SpatialEditorViewport::NAVIGATION_MAYA || nav_scheme == SpatialEditorViewport::NAVIGATION_MODO) && mb->get_alt()) { + Node3DEditorViewport::NavigationScheme nav_scheme = (Node3DEditorViewport::NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int(); + if ((nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA || nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) && mb->get_alt()) { input_action = INPUT_NONE; } else if (mb->get_button_index() == BUTTON_LEFT) { @@ -964,7 +964,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) { _update_selection_transform(); _update_paste_indicator(); - spatial_editor = Object::cast_to<SpatialEditorPlugin>(editor->get_editor_plugin_screen()); + spatial_editor = Object::cast_to<Node3DEditorPlugin>(editor->get_editor_plugin_screen()); if (!node) { set_process(false); @@ -1140,7 +1140,7 @@ void GridMapEditor::_notification(int p_what) { p.d = edit_floor[edit_axis] * node->get_cell_size()[edit_axis]; p = node->get_transform().xform(p); // plane to snap - SpatialEditorPlugin *sep = Object::cast_to<SpatialEditorPlugin>(editor->get_editor_plugin_screen()); + Node3DEditorPlugin *sep = Object::cast_to<Node3DEditorPlugin>(editor->get_editor_plugin_screen()); if (sep) sep->snap_cursor_to_plane(p); } @@ -1217,7 +1217,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { spatial_editor_hb = memnew(HBoxContainer); spatial_editor_hb->set_h_size_flags(SIZE_EXPAND_FILL); spatial_editor_hb->set_alignment(BoxContainer::ALIGN_END); - SpatialEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb); + Node3DEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb); spin_box_label = memnew(Label); spin_box_label->set_text(TTR("Floor:")); @@ -1519,10 +1519,10 @@ void GridMapEditorPlugin::_notification(int p_what) { switch ((int)EditorSettings::get_singleton()->get("editors/grid_map/editor_side")) { case 0: { // Left. - SpatialEditor::get_singleton()->get_palette_split()->move_child(grid_map_editor, 0); + Node3DEditor::get_singleton()->get_palette_split()->move_child(grid_map_editor, 0); } break; case 1: { // Right. - SpatialEditor::get_singleton()->get_palette_split()->move_child(grid_map_editor, 1); + Node3DEditor::get_singleton()->get_palette_split()->move_child(grid_map_editor, 1); } break; } } diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h index d6459cee0a..fd880e8b7b 100644 --- a/modules/gridmap/grid_map_editor_plugin.h +++ b/modules/gridmap/grid_map_editor_plugin.h @@ -36,7 +36,7 @@ #include "editor/pane_drag.h" #include "grid_map.h" -class SpatialEditorPlugin; +class Node3DEditorPlugin; class GridMapEditor : public VBoxContainer { GDCLASS(GridMapEditor, VBoxContainer); @@ -188,7 +188,7 @@ class GridMapEditor : public VBoxContainer { }; - SpatialEditorPlugin *spatial_editor; + Node3DEditorPlugin *spatial_editor; struct AreaDisplay { @@ -232,7 +232,7 @@ class GridMapEditor : public VBoxContainer { void _delete_selection(); void _fill_selection(); - bool do_input_action(Camera *p_camera, const Point2 &p_point, bool p_click); + bool do_input_action(Camera3D *p_camera, const Point2 &p_point, bool p_click); friend class GridMapEditorPlugin; @@ -242,7 +242,7 @@ protected: static void _bind_methods(); public: - bool forward_spatial_input_event(Camera *p_camera, const Ref<InputEvent> &p_event); + bool forward_spatial_input_event(Camera3D *p_camera, const Ref<InputEvent> &p_event); void edit(GridMap *p_gridmap); GridMapEditor() {} @@ -261,7 +261,7 @@ protected: void _notification(int p_what); public: - virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) { return grid_map_editor->forward_spatial_input_event(p_camera, p_event); } + virtual bool forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) { return grid_map_editor->forward_spatial_input_event(p_camera, p_event); } virtual String get_name() const { return "GridMap"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object); diff --git a/modules/mono/mono_gd/gd_mono_cache.cpp b/modules/mono/mono_gd/gd_mono_cache.cpp index be0b846702..e493098211 100644 --- a/modules/mono/mono_gd/gd_mono_cache.cpp +++ b/modules/mono/mono_gd/gd_mono_cache.cpp @@ -122,7 +122,7 @@ void CachedData::clear_godot_api_cache() { class_GodotResource = NULL; class_Node = NULL; class_Control = NULL; - class_Spatial = NULL; + class_Node3D = NULL; class_WeakRef = NULL; class_Callable = NULL; class_SignalInfo = NULL; @@ -251,7 +251,7 @@ void update_godot_api_cache() { CACHE_CLASS_AND_CHECK(GodotResource, GODOT_API_CLASS(Resource)); CACHE_CLASS_AND_CHECK(Node, GODOT_API_CLASS(Node)); CACHE_CLASS_AND_CHECK(Control, GODOT_API_CLASS(Control)); - CACHE_CLASS_AND_CHECK(Spatial, GODOT_API_CLASS(Spatial)); + CACHE_CLASS_AND_CHECK(Node3D, GODOT_API_CLASS(Node3Dshou)); CACHE_CLASS_AND_CHECK(WeakRef, GODOT_API_CLASS(WeakRef)); CACHE_CLASS_AND_CHECK(Callable, GODOT_API_CLASS(Callable)); CACHE_CLASS_AND_CHECK(SignalInfo, GODOT_API_CLASS(SignalInfo)); diff --git a/modules/mono/mono_gd/gd_mono_cache.h b/modules/mono/mono_gd/gd_mono_cache.h index b2dacee67c..21c8ed4efe 100644 --- a/modules/mono/mono_gd/gd_mono_cache.h +++ b/modules/mono/mono_gd/gd_mono_cache.h @@ -92,7 +92,7 @@ struct CachedData { GDMonoClass *class_GodotResource; GDMonoClass *class_Node; GDMonoClass *class_Control; - GDMonoClass *class_Spatial; + GDMonoClass *class_Node3D; GDMonoClass *class_WeakRef; GDMonoClass *class_Callable; GDMonoClass *class_SignalInfo; |