Skip to content

Commit

Permalink
Merge pull request #48242 from reduz/particle-trails
Browse files Browse the repository at this point in the history
Implement Particle Trails
  • Loading branch information
akien-mga committed Apr 30, 2021
2 parents d12e0b6 + 9005646 commit 4a7679e
Show file tree
Hide file tree
Showing 33 changed files with 1,572 additions and 176 deletions.
7 changes: 7 additions & 0 deletions core/io/resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ String Resource::get_name() const {
return name;
}

void Resource::update_configuration_warning() {
if (_update_configuration_warning) {
_update_configuration_warning();
}
}

bool Resource::editor_can_reload_from_file() {
return true; //by default yes
}
Expand Down Expand Up @@ -320,6 +326,7 @@ void Resource::setup_local_to_scene() {
}

Node *(*Resource::_get_local_scene_func)() = nullptr;
void (*Resource::_update_configuration_warning)() = nullptr;

void Resource::set_as_translation_remapped(bool p_remapped) {
if (remapped_list.in_list() == p_remapped) {
Expand Down
2 changes: 2 additions & 0 deletions core/io/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ class Resource : public Reference {

public:
static Node *(*_get_local_scene_func)(); //used by editor
static void (*_update_configuration_warning)(); //used by editor

void update_configuration_warning();
virtual bool editor_can_reload_from_file();
virtual void reset_state(); //for resources that use variable amount of properties, either via _validate_property or _get_property_list, this function needs to be implemented to correctly clear state
virtual Error copy_from(const Ref<Resource> &p_resource);
Expand Down
13 changes: 13 additions & 0 deletions editor/scene_tree_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/io/resource_saver.h"
#include "core/object/message_queue.h"
#include "core/os/keyboard.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_feature_profile.h"
Expand Down Expand Up @@ -3016,7 +3017,16 @@ void SceneTreeDock::_bind_methods() {
ADD_SIGNAL(MethodInfo("node_created", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
}

SceneTreeDock *SceneTreeDock::singleton = nullptr;

void SceneTreeDock::_update_configuration_warning() {
if (singleton) {
MessageQueue::get_singleton()->push_callable(callable_mp(singleton->scene_tree, &SceneTreeEditor::update_warning));
}
}

SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSelection *p_editor_selection, EditorData &p_editor_data) {
singleton = this;
set_name("Scene");
editor = p_editor;
edited_scene = nullptr;
Expand Down Expand Up @@ -3207,9 +3217,12 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
EDITOR_DEF("interface/editors/show_scene_tree_root_selection", true);
EDITOR_DEF("interface/editors/derive_script_globals_by_name", true);
EDITOR_DEF("_use_favorites_root_selection", false);

Resource::_update_configuration_warning = _update_configuration_warning;
}

SceneTreeDock::~SceneTreeDock() {
singleton = nullptr;
if (!node_clipboard.is_empty()) {
_clear_clipboard();
}
Expand Down
3 changes: 3 additions & 0 deletions editor/scene_tree_dock.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ class SceneTreeDock : public VBoxContainer {
bool profile_allow_editing;
bool profile_allow_script_editing;

static SceneTreeDock *singleton;
static void _update_configuration_warning();

protected:
void _notification(int p_what);
static void _bind_methods();
Expand Down
5 changes: 4 additions & 1 deletion editor/scene_tree_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ void SceneTreeEditor::_notification(int p_what) {
get_tree()->connect("tree_process_mode_changed", callable_mp(this, &SceneTreeEditor::_tree_process_mode_changed));
get_tree()->connect("node_removed", callable_mp(this, &SceneTreeEditor::_node_removed));
get_tree()->connect("node_renamed", callable_mp(this, &SceneTreeEditor::_node_renamed));
get_tree()->connect("node_configuration_warning_changed", callable_mp(this, &SceneTreeEditor::_warning_changed));
get_tree()->connect("node_configuration_warning_changed", callable_mp(this, &SceneTreeEditor::_warning_changed), varray(), CONNECT_DEFERRED);

tree->connect("item_collapsed", callable_mp(this, &SceneTreeEditor::_cell_collapsed));

Expand Down Expand Up @@ -1102,6 +1102,9 @@ void SceneTreeEditor::_rmb_select(const Vector2 &p_pos) {
emit_signal("rmb_pressed", tree->get_screen_transform().xform(p_pos));
}

void SceneTreeEditor::update_warning() {
_warning_changed(nullptr);
}
void SceneTreeEditor::_warning_changed(Node *p_for_node) {
//should use a timer
update_timer->start();
Expand Down
2 changes: 2 additions & 0 deletions editor/scene_tree_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ class SceneTreeEditor : public Control {

Tree *get_scene_tree() { return tree; }

void update_warning();

SceneTreeEditor(bool p_label = true, bool p_can_rename = false, bool p_can_open_instance = false);
~SceneTreeEditor();
};
Expand Down
Loading

0 comments on commit 4a7679e

Please sign in to comment.