Merge pull request #103416 from CreatedBySeb/animation-workflow-enhancements
Minor Animation Player workflow enhancements
This commit is contained in:
@@ -56,6 +56,24 @@
|
||||
|
||||
///////////////////////////////////
|
||||
|
||||
void AnimationPlayerEditor::_find_player() {
|
||||
if (!is_visible() || player) {
|
||||
return;
|
||||
}
|
||||
|
||||
Node *edited_scene = EditorNode::get_singleton()->get_edited_scene();
|
||||
|
||||
if (!edited_scene) {
|
||||
return;
|
||||
}
|
||||
|
||||
TypedArray<Node> players = edited_scene->find_children("", "AnimationPlayer");
|
||||
|
||||
if (players.size() == 1) {
|
||||
plugin->edit(players.front());
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationPlayerEditor::_node_removed(Node *p_node) {
|
||||
if (player && original_node == p_node) {
|
||||
if (is_dummy) {
|
||||
@@ -130,6 +148,8 @@ void AnimationPlayerEditor::_notification(int p_what) {
|
||||
|
||||
get_tree()->connect(SNAME("node_removed"), callable_mp(this, &AnimationPlayerEditor::_node_removed));
|
||||
|
||||
EditorNode::get_singleton()->connect("scene_changed", callable_mp(this, &AnimationPlayerEditor::_find_player));
|
||||
|
||||
add_theme_style_override(SceneStringName(panel), EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SceneStringName(panel), SNAME("Panel")));
|
||||
} break;
|
||||
|
||||
@@ -190,6 +210,7 @@ void AnimationPlayerEditor::_notification(int p_what) {
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
_find_player();
|
||||
_ensure_dummy_player();
|
||||
} break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user