Fix Skeleton3D Edit Mode bone buttons have priority over transform gizmo
(cherry picked from commit 41bf7648c29762cd3c3e9d647c99f6a363008811)
This commit is contained in:
committed by
Thaddeus Crews
parent
aff6e91048
commit
cbdc2a2d85
@@ -1515,35 +1515,10 @@ Skeleton3DEditorPlugin::Skeleton3DEditorPlugin() {
|
|||||||
|
|
||||||
EditorPlugin::AfterGUIInput Skeleton3DEditorPlugin::forward_3d_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
|
EditorPlugin::AfterGUIInput Skeleton3DEditorPlugin::forward_3d_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
|
||||||
Skeleton3DEditor *se = Skeleton3DEditor::get_singleton();
|
Skeleton3DEditor *se = Skeleton3DEditor::get_singleton();
|
||||||
Node3DEditor *ne = Node3DEditor::get_singleton();
|
|
||||||
if (se && se->is_edit_mode()) {
|
if (se && se->is_edit_mode()) {
|
||||||
const Ref<InputEventMouseButton> mb = p_event;
|
const Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) {
|
if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) {
|
||||||
Skeleton3D *skeleton = se->get_skeleton();
|
se->update_bone_original();
|
||||||
if (skeleton) {
|
|
||||||
int closest_idx = Skeleton3DGizmoPlugin::skeleton_intersect_ray(skeleton, p_camera, mb->get_position());
|
|
||||||
if (closest_idx >= 0) {
|
|
||||||
se->select_bone(closest_idx);
|
|
||||||
se->update_bone_original();
|
|
||||||
|
|
||||||
Vector<Ref<Node3DGizmo>> gizmos = skeleton->get_gizmos();
|
|
||||||
for (Ref<EditorNode3DGizmo> seg : gizmos) {
|
|
||||||
if (seg.is_valid()) {
|
|
||||||
Transform3D bone_xform = seg->get_subgizmo_transform(closest_idx);
|
|
||||||
ne->call("_set_subgizmo_selection", skeleton, seg, closest_idx, bone_xform);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
|
|
||||||
if (ne->get_tool_mode() != Node3DEditor::TOOL_MODE_SELECT) {
|
|
||||||
if (!ne->is_gizmo_visible()) {
|
|
||||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return EditorPlugin::AFTER_GUI_INPUT_CUSTOM;
|
return EditorPlugin::AFTER_GUI_INPUT_CUSTOM;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user