summaryrefslogtreecommitdiff
path: root/editor/editor_data.h
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_data.h')
-rw-r--r--editor/editor_data.h41
1 files changed, 17 insertions, 24 deletions
diff --git a/editor/editor_data.h b/editor/editor_data.h
index e4f4c67c8e..18b4137162 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -31,32 +31,28 @@
#ifndef EDITOR_DATA_H
#define EDITOR_DATA_H
-#include "core/list.h"
-#include "core/pair.h"
-#include "core/undo_redo.h"
+#include "core/object/undo_redo.h"
+#include "core/templates/list.h"
+#include "core/templates/pair.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "scene/resources/texture.h"
class EditorHistory {
-
enum {
-
HISTORY_MAX = 64
};
struct Obj {
-
REF ref;
ObjectID object;
String property;
- bool inspector_only;
+ bool inspector_only = false;
};
struct History {
-
Vector<Obj> path;
- int level;
+ int level = 0;
};
friend class EditorData;
@@ -66,7 +62,6 @@ class EditorHistory {
//Vector<EditorPlugin*> editor_plugins;
struct PropertyData {
-
String name;
Variant value;
};
@@ -106,24 +101,23 @@ public:
class EditorSelection;
class EditorData {
-
public:
struct CustomType {
-
String name;
Ref<Script> script;
Ref<Texture2D> icon;
};
struct EditedScene {
- Node *root;
+ Node *root = nullptr;
String path;
+ uint64_t file_modified_time = 0;
Dictionary editor_states;
List<Node *> selection;
Vector<EditorHistory::History> history_stored;
- int history_current;
+ int history_current = 0;
Dictionary custom_state;
- uint64_t version;
+ uint64_t version = 0;
NodePath live_edit_root;
};
@@ -131,7 +125,6 @@ private:
Vector<EditorPlugin *> editor_plugins;
struct PropertyData {
-
String name;
Variant value;
};
@@ -152,7 +145,6 @@ private:
public:
EditorPlugin *get_editor(Object *p_object);
- EditorPlugin *get_subeditor(Object *p_object);
Vector<EditorPlugin *> get_subeditors(Object *p_object);
EditorPlugin *get_editor(String p_name);
@@ -179,7 +171,7 @@ public:
void restore_editor_global_states();
void add_custom_type(const String &p_type, const String &p_inherits, const Ref<Script> &p_script, const Ref<Texture2D> &p_icon);
- Object *instance_custom_type(const String &p_type, const String &p_inherits);
+ Variant instance_custom_type(const String &p_type, const String &p_inherits);
void remove_custom_type(const String &p_type);
const Map<String, Vector<CustomType>> &get_custom_types() const { return custom_types; }
@@ -198,8 +190,9 @@ public:
void set_scene_path(int p_idx, const String &p_path);
Ref<Script> get_scene_root_script(int p_idx) const;
void set_edited_scene_version(uint64_t version, int p_scene_idx = -1);
- uint64_t get_edited_scene_version() const;
uint64_t get_scene_version(int p_idx) const;
+ void set_scene_modified_time(int p_idx, uint64_t p_time);
+ uint64_t get_scene_modified_time(int p_idx) const;
void clear_edited_scenes();
void set_edited_scene_live_edit_root(const NodePath &p_root);
NodePath get_edited_scene_live_edit_root();
@@ -217,7 +210,7 @@ public:
bool script_class_is_parent(const String &p_class, const String &p_inherits);
StringName script_class_get_base(const String &p_class) const;
- Object *script_class_instance(const String &p_class);
+ Variant script_class_instance(const String &p_class);
Ref<Script> script_class_load_script(const String &p_class) const;
@@ -234,7 +227,6 @@ public:
};
class EditorSelection : public Object {
-
GDCLASS(EditorSelection, Object);
private:
@@ -264,8 +256,9 @@ public:
template <class T>
T *get_node_editor_data(Node *p_node) {
- if (!selection.has(p_node))
+ if (!selection.has(p_node)) {
return nullptr;
+ }
return Object::cast_to<T>(selection[p_node]);
}