diff options
Diffstat (limited to 'modules/csg')
-rw-r--r-- | modules/csg/csg_gizmos.cpp | 24 | ||||
-rw-r--r-- | modules/csg/csg_gizmos.h | 6 | ||||
-rw-r--r-- | modules/csg/csg_shape.cpp | 52 |
3 files changed, 41 insertions, 41 deletions
diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp index 4b27eea019..fa176cb94e 100644 --- a/modules/csg/csg_gizmos.cpp +++ b/modules/csg/csg_gizmos.cpp @@ -32,7 +32,7 @@ /////////// -CSGShapeNode3DGizmoPlugin::CSGShapeNode3DGizmoPlugin() { +CSGShape3DGizmoPlugin::CSGShape3DGizmoPlugin() { 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,7 +49,7 @@ CSGShapeNode3DGizmoPlugin::CSGShapeNode3DGizmoPlugin() { create_handle_material("handles"); } -String CSGShapeNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { +String CSGShape3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const { CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node()); @@ -76,7 +76,7 @@ String CSGShapeNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_giz return ""; } -Variant CSGShapeNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { +Variant CSGShape3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const { CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node()); @@ -110,7 +110,7 @@ Variant CSGShapeNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, return Variant(); } -void CSGShapeNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { +void CSGShape3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node()); @@ -207,7 +207,7 @@ void CSGShapeNode3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx s->set_outer_radius(d); } } -void CSGShapeNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { +void CSGShape3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) { CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node()); @@ -299,23 +299,23 @@ void CSGShapeNode3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_ ur->commit_action(); } } -bool CSGShapeNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { +bool CSGShape3DGizmoPlugin::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 CSGShapeNode3DGizmoPlugin::get_name() const { - return "CSGShapes"; +String CSGShape3DGizmoPlugin::get_name() const { + return "CSGShape3D"; } -int CSGShapeNode3DGizmoPlugin::get_priority() const { +int CSGShape3DGizmoPlugin::get_priority() const { return -1; } -bool CSGShapeNode3DGizmoPlugin::is_selectable_when_hidden() const { +bool CSGShape3DGizmoPlugin::is_selectable_when_hidden() const { return true; } -void CSGShapeNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { +void CSGShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { CSGShape3D *cs = Object::cast_to<CSGShape3D>(p_gizmo->get_spatial_node()); @@ -419,6 +419,6 @@ void CSGShapeNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { } EditorPluginCSG::EditorPluginCSG(EditorNode *p_editor) { - Ref<CSGShapeNode3DGizmoPlugin> gizmo_plugin = Ref<CSGShapeNode3DGizmoPlugin>(memnew(CSGShapeNode3DGizmoPlugin)); + Ref<CSGShape3DGizmoPlugin> gizmo_plugin = Ref<CSGShape3DGizmoPlugin>(memnew(CSGShape3DGizmoPlugin)); Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin); } diff --git a/modules/csg/csg_gizmos.h b/modules/csg/csg_gizmos.h index 90a059b31c..7763989b2a 100644 --- a/modules/csg/csg_gizmos.h +++ b/modules/csg/csg_gizmos.h @@ -35,9 +35,9 @@ #include "editor/editor_plugin.h" #include "editor/node_3d_editor_gizmos.h" -class CSGShapeNode3DGizmoPlugin : public EditorNode3DGizmoPlugin { +class CSGShape3DGizmoPlugin : public EditorNode3DGizmoPlugin { - GDCLASS(CSGShapeNode3DGizmoPlugin, EditorNode3DGizmoPlugin); + GDCLASS(CSGShape3DGizmoPlugin, EditorNode3DGizmoPlugin); public: bool has_gizmo(Node3D *p_spatial); @@ -51,7 +51,7 @@ public: 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); - CSGShapeNode3DGizmoPlugin(); + CSGShape3DGizmoPlugin(); }; class EditorPluginCSG : public EditorPlugin { diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 1ed48a573c..5557da3014 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -156,7 +156,7 @@ CSGBrush *CSGShape3D::_get_brush() { if (brush) { memdelete(brush); } - brush = NULL; + brush = nullptr; CSGBrush *n = _build_brush(); @@ -427,7 +427,7 @@ void CSGShape3D::_update_shape() { mkif.m_getPosition = mikktGetPosition; mkif.m_getTexCoord = mikktGetTexCoord; mkif.m_setTSpace = mikktSetTSpaceDefault; - mkif.m_setTSpaceBasic = NULL; + mkif.m_setTSpaceBasic = nullptr; SMikkTSpaceContext msc; msc.m_pInterface = &mkif; @@ -536,7 +536,7 @@ void CSGShape3D::_notification(int p_what) { if (parent) parent->_make_dirty(); - parent = NULL; + parent = nullptr; if (use_collision && is_root_shape() && root_collision_instance.is_valid()) { PhysicsServer3D::get_singleton()->free(root_collision_instance); @@ -636,8 +636,8 @@ void CSGShape3D::_bind_methods() { CSGShape3D::CSGShape3D() { operation = OPERATION_UNION; - parent = NULL; - brush = NULL; + parent = nullptr; + brush = nullptr; dirty = false; snap = 0.001; use_collision = false; @@ -650,14 +650,14 @@ CSGShape3D::CSGShape3D() { CSGShape3D::~CSGShape3D() { if (brush) { memdelete(brush); - brush = NULL; + brush = nullptr; } } ////////////////////////////////// CSGBrush *CSGCombiner3D::_build_brush() { - return NULL; //does not build anything + return nullptr; //does not build anything } CSGCombiner3D::CSGCombiner3D() { @@ -713,7 +713,7 @@ CSGPrimitive3D::CSGPrimitive3D() { CSGBrush *CSGMesh3D::_build_brush() { if (!mesh.is_valid()) - return NULL; + return nullptr; Vector<Vector3> vertices; Vector<bool> smooth; @@ -731,7 +731,7 @@ CSGBrush *CSGMesh3D::_build_brush() { if (arrays.size() == 0) { _make_dirty(); - ERR_FAIL_COND_V(arrays.size() == 0, NULL); + ERR_FAIL_COND_V(arrays.size() == 0, nullptr); } Vector<Vector3> avertices = arrays[Mesh::ARRAY_VERTEX]; @@ -741,13 +741,13 @@ CSGBrush *CSGMesh3D::_build_brush() { const Vector3 *vr = avertices.ptr(); Vector<Vector3> anormals = arrays[Mesh::ARRAY_NORMAL]; - const Vector3 *nr = NULL; + const Vector3 *nr = nullptr; if (anormals.size()) { nr = anormals.ptr(); } Vector<Vector2> auvs = arrays[Mesh::ARRAY_TEX_UV]; - const Vector2 *uvr = NULL; + const Vector2 *uvr = nullptr; if (auvs.size()) { uvr = auvs.ptr(); } @@ -853,7 +853,7 @@ CSGBrush *CSGMesh3D::_build_brush() { } if (vertices.size() == 0) - return NULL; + return nullptr; return _create_brush_from_arrays(vertices, uvs, smooth, materials); } @@ -1535,7 +1535,7 @@ CSGBrush *CSGTorus3D::_build_brush() { float max_radius = outer_radius; if (min_radius == max_radius) - return NULL; //sorry, can't + return nullptr; //sorry, can't if (min_radius > max_radius) { SWAP(min_radius, max_radius); @@ -1760,7 +1760,7 @@ CSGBrush *CSGPolygon3D::_build_brush() { // set our bounding box if (polygon.size() < 3) - return NULL; + return nullptr; Vector<Point2> final_polygon = polygon; @@ -1771,9 +1771,9 @@ CSGBrush *CSGPolygon3D::_build_brush() { Vector<int> triangles = Geometry::triangulate_polygon(final_polygon); if (triangles.size() < 3) - return NULL; + return nullptr; - Path3D *path = NULL; + Path3D *path = nullptr; Ref<Curve3D> curve; // get bounds for our polygon @@ -1796,32 +1796,32 @@ CSGBrush *CSGPolygon3D::_build_brush() { if (mode == MODE_PATH) { if (!has_node(path_node)) - return NULL; + return nullptr; Node *n = get_node(path_node); if (!n) - return NULL; + return nullptr; path = Object::cast_to<Path3D>(n); if (!path) - return NULL; + return nullptr; if (path != path_cache) { if (path_cache) { 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 = nullptr; } path_cache = path; 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; + path_cache = nullptr; } curve = path->get_curve(); if (curve.is_null()) - return NULL; + return nullptr; if (curve->get_baked_length() <= 0) - return NULL; + return nullptr; } CSGBrush *brush = memnew(CSGBrush); @@ -2232,7 +2232,7 @@ void CSGPolygon3D::_notification(int p_what) { if (path_cache) { 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 = nullptr; } } } @@ -2257,7 +2257,7 @@ void CSGPolygon3D::_path_changed() { } void CSGPolygon3D::_path_exited() { - path_cache = NULL; + path_cache = nullptr; } void CSGPolygon3D::_bind_methods() { @@ -2483,5 +2483,5 @@ CSGPolygon3D::CSGPolygon3D() { path_local = false; path_continuous_u = false; path_joined = false; - path_cache = NULL; + path_cache = nullptr; } |