diff options
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/animation_blend_tree_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/bone_map_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/gizmos/physics_bone_3d_gizmo_plugin.cpp | 8 | ||||
-rw-r--r-- | editor/plugins/root_motion_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 27 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 3 | ||||
-rw-r--r-- | editor/plugins/skeleton_3d_editor_plugin.cpp | 12 |
7 files changed, 39 insertions, 21 deletions
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index a7c64b79db..cb4963dacf 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -850,7 +850,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano ti->set_text(0, F->get()); ti->set_selectable(0, false); ti->set_editable(0, false); - ti->set_icon(0, get_editor_theme_icon(SNAME("BoneAttachment3D"))); + ti->set_icon(0, get_editor_theme_icon(SNAME("Bone"))); } else { ti = parenthood[accum]; } @@ -861,7 +861,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); ti->set_text(0, concat); ti->set_checked(0, anode->is_path_filtered(path)); - ti->set_icon(0, get_editor_theme_icon(SNAME("BoneAttachment3D"))); + ti->set_icon(0, get_editor_theme_icon(SNAME("Bone"))); ti->set_metadata(0, path); } else { diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp index 848989d8e9..e67f3bd596 100644 --- a/editor/plugins/bone_map_editor_plugin.cpp +++ b/editor/plugins/bone_map_editor_plugin.cpp @@ -196,7 +196,7 @@ void BonePicker::create_bones_tree(Skeleton3D *p_skeleton) { items.insert(-1, root); - Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("BoneAttachment3D")); + Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("Bone")); Vector<int> bones_to_process = p_skeleton->get_parentless_bones(); bool is_first = true; @@ -421,7 +421,7 @@ void BoneMapper::recreate_editor() { for (int i = 0; i < len; i++) { if (profile->get_group(i) == profile->get_group_name(current_group_idx)) { - BoneMapperButton *mb = memnew(BoneMapperButton(profile->get_bone_name(i), profile->is_require(i), current_bone_idx == i)); + BoneMapperButton *mb = memnew(BoneMapperButton(profile->get_bone_name(i), profile->is_required(i), current_bone_idx == i)); mb->connect("pressed", callable_mp(this, &BoneMapper::set_current_bone_idx).bind(i), CONNECT_DEFERRED); mb->set_h_grow_direction(GROW_DIRECTION_BOTH); mb->set_v_grow_direction(GROW_DIRECTION_BOTH); diff --git a/editor/plugins/gizmos/physics_bone_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/physics_bone_3d_gizmo_plugin.cpp index b15f9bec3f..94d6be22f4 100644 --- a/editor/plugins/gizmos/physics_bone_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/physics_bone_3d_gizmo_plugin.cpp @@ -61,17 +61,17 @@ void PhysicalBone3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { return; } - Skeleton3D *sk(physical_bone->find_skeleton_parent()); - if (!sk) { + PhysicalBoneSimulator3D *sm(physical_bone->get_simulator()); + if (!sm) { return; } - PhysicalBone3D *pb(sk->get_physical_bone(physical_bone->get_bone_id())); + PhysicalBone3D *pb(sm->get_physical_bone(physical_bone->get_bone_id())); if (!pb) { return; } - PhysicalBone3D *pbp(sk->get_physical_bone_parent(physical_bone->get_bone_id())); + PhysicalBone3D *pbp(sm->get_physical_bone_parent(physical_bone->get_bone_id())); if (!pbp) { return; } diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index 30fb731fc8..f6a5c58acf 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -129,7 +129,7 @@ void EditorPropertyRootMotion::_node_assign() { if (skeleton) { HashMap<int, TreeItem *> items; items.insert(-1, ti); - Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("BoneAttachment3D")); + Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("Bone")); Vector<int> bones_to_process = skeleton->get_parentless_bones(); while (bones_to_process.size() > 0) { int current_bone_idx = bones_to_process[0]; diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index eeb84cb79e..6c63d9ff0d 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -137,12 +137,22 @@ void EditorStandardSyntaxHighlighter::_update_cache() { } } - const Ref<Script> scr = _get_edited_resource(); - if (scr.is_valid()) { + const ScriptLanguage *scr_lang = script_language; + StringName instance_base; + + if (scr_lang == nullptr) { + const Ref<Script> scr = _get_edited_resource(); + if (scr.is_valid()) { + scr_lang = scr->get_language(); + instance_base = scr->get_instance_base_type(); + } + } + + if (scr_lang != nullptr) { /* Core types. */ const Color basetype_color = EDITOR_GET("text_editor/theme/highlighting/base_type_color"); List<String> core_types; - scr->get_language()->get_core_type_words(&core_types); + scr_lang->get_core_type_words(&core_types); for (const String &E : core_types) { highlighter->add_keyword_color(E, basetype_color); } @@ -151,9 +161,9 @@ void EditorStandardSyntaxHighlighter::_update_cache() { const Color keyword_color = EDITOR_GET("text_editor/theme/highlighting/keyword_color"); const Color control_flow_keyword_color = EDITOR_GET("text_editor/theme/highlighting/control_flow_keyword_color"); List<String> keywords; - scr->get_language()->get_reserved_words(&keywords); + scr_lang->get_reserved_words(&keywords); for (const String &E : keywords) { - if (scr->get_language()->is_control_flow_keyword(E)) { + if (scr_lang->is_control_flow_keyword(E)) { highlighter->add_keyword_color(E, control_flow_keyword_color); } else { highlighter->add_keyword_color(E, keyword_color); @@ -162,7 +172,6 @@ void EditorStandardSyntaxHighlighter::_update_cache() { /* Member types. */ const Color member_variable_color = EDITOR_GET("text_editor/theme/highlighting/member_variable_color"); - StringName instance_base = scr->get_instance_base_type(); if (instance_base != StringName()) { List<PropertyInfo> plist; ClassDB::get_property_list(instance_base, &plist); @@ -187,7 +196,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { /* Comments */ const Color comment_color = EDITOR_GET("text_editor/theme/highlighting/comment_color"); List<String> comments; - scr->get_language()->get_comment_delimiters(&comments); + scr_lang->get_comment_delimiters(&comments); for (const String &comment : comments) { String beg = comment.get_slice(" ", 0); String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String(); @@ -197,7 +206,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { /* Doc comments */ const Color doc_comment_color = EDITOR_GET("text_editor/theme/highlighting/doc_comment_color"); List<String> doc_comments; - scr->get_language()->get_doc_comment_delimiters(&doc_comments); + scr_lang->get_doc_comment_delimiters(&doc_comments); for (const String &doc_comment : doc_comments) { String beg = doc_comment.get_slice(" ", 0); String end = doc_comment.get_slice_count(" ") > 1 ? doc_comment.get_slice(" ", 1) : String(); @@ -207,7 +216,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() { /* Strings */ const Color string_color = EDITOR_GET("text_editor/theme/highlighting/string_color"); List<String> strings; - scr->get_language()->get_string_delimiters(&strings); + scr_lang->get_string_delimiters(&strings); for (const String &string : strings) { String beg = string.get_slice(" ", 0); String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String(); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 4fff724866..0252e10b43 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -78,6 +78,7 @@ class EditorStandardSyntaxHighlighter : public EditorSyntaxHighlighter { private: Ref<CodeHighlighter> highlighter; + ScriptLanguage *script_language = nullptr; // See GH-89610. public: virtual void _update_cache() override; @@ -87,6 +88,8 @@ public: virtual Ref<EditorSyntaxHighlighter> _create() const override; + void _set_script_language(ScriptLanguage *p_script_language) { script_language = p_script_language; } + EditorStandardSyntaxHighlighter() { highlighter.instantiate(); } }; diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index e0c5f9e596..1bd6b4e5b1 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -377,6 +377,11 @@ void Skeleton3DEditor::create_physical_skeleton() { bones_infos.resize(bone_count); ur->create_action(TTR("Create physical bones"), UndoRedo::MERGE_ALL); + + PhysicalBoneSimulator3D *simulator = memnew(PhysicalBoneSimulator3D); + ur->add_do_method(skeleton, "add_child", simulator); + ur->add_do_method(simulator, "set_owner", owner); + ur->add_do_method(simulator, "set_name", "PhysicalBoneSimulator3D"); for (int bone_id = 0; bone_count > bone_id; ++bone_id) { const int parent = skeleton->get_bone_parent(bone_id); @@ -395,7 +400,7 @@ void Skeleton3DEditor::create_physical_skeleton() { if (collision_shape) { bones_infos.write[parent].physical_bone = physical_bone; - ur->add_do_method(skeleton, "add_child", physical_bone); + ur->add_do_method(simulator, "add_child", physical_bone); ur->add_do_method(physical_bone, "set_owner", owner); ur->add_do_method(collision_shape, "set_owner", owner); ur->add_do_property(physical_bone, "bone_name", skeleton->get_bone_name(parent)); @@ -409,12 +414,13 @@ void Skeleton3DEditor::create_physical_skeleton() { ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, collision_shape); ur->add_do_reference(physical_bone); - ur->add_undo_method(skeleton, "remove_child", physical_bone); + ur->add_undo_method(simulator, "remove_child", physical_bone); } } } } } + ur->add_undo_method(skeleton, "remove_child", simulator); ur->commit_action(); } @@ -670,7 +676,7 @@ void Skeleton3DEditor::update_joint_tree() { items.insert(-1, root); - Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("BoneAttachment3D")); + Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("Bone")); Vector<int> bones_to_process = skeleton->get_parentless_bones(); while (bones_to_process.size() > 0) { |