| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "editor/plugins/editor_plugin.h" |
| 34 |
#include "editor/scene/3d/node_3d_editor_plugin.h" |
| 35 |
#include "scene/3d/spring_bone_collision_3d.h" |
| 36 |
#include "scene/3d/spring_bone_simulator_3d.h" |
| 37 |
#include "scene/resources/surface_tool.h" |
| 38 |
|
| 39 |
class SpringBoneSimulator3DGizmoPlugin : public EditorNode3DGizmoPlugin { |
| 40 |
GDCLASS(SpringBoneSimulator3DGizmoPlugin, EditorNode3DGizmoPlugin); |
| 41 |
|
| 42 |
struct SelectionMaterials { |
| 43 |
Ref<StandardMaterial3D> unselected_mat; |
| 44 |
Ref<ShaderMaterial> selected_mat; |
| 45 |
}; |
| 46 |
static SelectionMaterials selection_materials; |
| 47 |
|
| 48 |
public: |
| 49 |
static Ref<ArrayMesh> get_joints_mesh(Skeleton3D *p_skeleton, SpringBoneSimulator3D *p_simulator, bool p_is_selected); |
| 50 |
static void draw_sphere(Ref<SurfaceTool> &p_surface_tool, const Basis &p_basis, const Vector3 &p_center, float p_radius, const Color &p_color); |
| 51 |
static void draw_line(Ref<SurfaceTool> &p_surface_tool, const Vector3 &p_begin_pos, const Vector3 &p_end_pos, const Color &p_color); |
| 52 |
|
| 53 |
bool has_gizmo(Node3D *p_spatial) override; |
| 54 |
String get_gizmo_name() const override; |
| 55 |
int get_priority() const override; |
| 56 |
|
| 57 |
void redraw(EditorNode3DGizmo *p_gizmo) override; |
| 58 |
|
| 59 |
SpringBoneSimulator3DGizmoPlugin(); |
| 60 |
~SpringBoneSimulator3DGizmoPlugin(); |
| 61 |
}; |
| 62 |
|
| 63 |
class SpringBoneCollision3DGizmoPlugin : public EditorNode3DGizmoPlugin { |
| 64 |
GDCLASS(SpringBoneCollision3DGizmoPlugin, EditorNode3DGizmoPlugin); |
| 65 |
|
| 66 |
struct SelectionMaterials { |
| 67 |
Ref<StandardMaterial3D> unselected_mat; |
| 68 |
Ref<ShaderMaterial> selected_mat; |
| 69 |
}; |
| 70 |
static SelectionMaterials selection_materials; |
| 71 |
|
| 72 |
public: |
| 73 |
static Ref<ArrayMesh> get_collision_mesh(SpringBoneCollision3D *p_collision, bool p_is_selected); |
| 74 |
static void draw_sphere(Ref<SurfaceTool> &p_surface_tool, float p_radius, const Color &p_color); |
| 75 |
static void draw_capsule(Ref<SurfaceTool> &p_surface_tool, float p_radius, float p_height, const Color &p_color); |
| 76 |
static void draw_plane(Ref<SurfaceTool> &p_surface_tool, const Color &p_color); |
| 77 |
|
| 78 |
bool has_gizmo(Node3D *p_spatial) override; |
| 79 |
String get_gizmo_name() const override; |
| 80 |
int get_priority() const override; |
| 81 |
|
| 82 |
void redraw(EditorNode3DGizmo *p_gizmo) override; |
| 83 |
|
| 84 |
SpringBoneCollision3DGizmoPlugin(); |
| 85 |
~SpringBoneCollision3DGizmoPlugin(); |
| 86 |
}; |