Improve Path3D gizmo usability

Allow change tilt gizmo color and size in editor setting
This commit is contained in:
Yaohua Xiong 2023-08-20 07:41:53 +08:00
parent a2f90d565a
commit ce4f64524f
2 changed files with 35 additions and 17 deletions

View file

@ -58,6 +58,7 @@ class Path3DGizmo : public EditorNode3DGizmo {
mutable Vector3 original;
mutable float orig_in_length;
mutable float orig_out_length;
mutable float disk_size = 0.8;
// Cache information of secondary handles.
Vector<HandleInfo> _secondary_handles_info;
@ -69,19 +70,21 @@ public:
virtual void commit_handle(int p_id, bool p_secondary, const Variant &p_restore, bool p_cancel = false) override;
virtual void redraw() override;
Path3DGizmo(Path3D *p_path = nullptr);
Path3DGizmo(Path3D *p_path = nullptr, float p_disk_size = 0.8);
};
class Path3DGizmoPlugin : public EditorNode3DGizmoPlugin {
GDCLASS(Path3DGizmoPlugin, EditorNode3DGizmoPlugin);
float disk_size = 0.8;
protected:
Ref<EditorNode3DGizmo> create_gizmo(Node3D *p_spatial) override;
public:
String get_gizmo_name() const override;
int get_priority() const override;
Path3DGizmoPlugin();
Path3DGizmoPlugin(float p_disk_size);
};
class Path3DEditorPlugin : public EditorPlugin {
@ -95,6 +98,8 @@ class Path3DEditorPlugin : public EditorPlugin {
Button *curve_close = nullptr;
MenuButton *handle_menu = nullptr;
float disk_size = 0.8;
enum Mode {
MODE_CREATE,
MODE_EDIT,