From a503f8aadcb8cbc85bde589fb25ea06e599b367b Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 10 Jan 2017 01:04:31 -0300 Subject: Groundbreaking!! Godot resources can now be flagged to be local to the scene being edited! This means that each time this scene is instanced, the resource will be unique! As such, thanks to this, the following features were implemented: -ButtonGroup is no longer a control, it's now a resource local to the scene -ViewportTexture can be created from the editor and set to any object, making ViewportSprite and other kind of nodes obsolete! --- core/resource.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'core/resource.h') diff --git a/core/resource.h b/core/resource.h index 40b6dd78a0..8b73bcdc57 100644 --- a/core/resource.h +++ b/core/resource.h @@ -61,6 +61,7 @@ class ResourceImportMetadata : public Reference { Map options; StringArray _get_options() const; + protected: static void _bind_methods(); @@ -82,6 +83,7 @@ public: void get_options(List *r_options) const; + ResourceImportMetadata(); }; @@ -108,6 +110,10 @@ friend class ResourceCache; uint64_t last_modified_time; #endif + bool local_to_scene; +friend class SceneState; + Node* local_scene; + protected: void emit_changed(); @@ -121,6 +127,8 @@ protected: void _take_over_path(const String& p_path); public: + static Node* (*_get_local_scene_func)(); //used by editor + virtual bool editor_can_reload_from_file(); virtual void reload_from_file(); @@ -137,12 +145,17 @@ public: int get_subindex() const; Ref duplicate(bool p_subresources=false); + Ref duplicate_for_local_scene(Node *p_scene,Map,Ref >& remap_cache); + void set_import_metadata(const Ref& p_metadata); Ref get_import_metadata() const; + void set_local_to_scene(bool p_enable); + bool is_local_to_scene() const; + virtual void setup_local_to_scene(); - + Node* get_local_scene() const; #ifdef TOOLS_ENABLED -- cgit v1.2.3