summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-11-14 15:44:51 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-11-14 15:45:30 -0300
commit04edfc090b0e78f4f820977da8cb4eb2d015c5f7 (patch)
tree85e317bfbe1fe765dae11a433d1a7943e098c90a /scene/2d
parentbd2b1a62d9d6f97ebfa7457ab3e84ae839531bdb (diff)
Finalized ability to convert from CanvasItem/Spatial/Particles materials to ShaderMaterial, closes #10242
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/canvas_item.cpp6
-rw-r--r--scene/2d/canvas_item.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index b41ba7f590..fa45c61f68 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -178,6 +178,12 @@ CanvasItemMaterial::LightMode CanvasItemMaterial::get_light_mode() const {
void CanvasItemMaterial::_validate_property(PropertyInfo &property) const {
}
+RID CanvasItemMaterial::get_shader_rid() const {
+
+ ERR_FAIL_COND_V(!shader_map.has(current_key), RID());
+ return shader_map[current_key].shader;
+}
+
void CanvasItemMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_blend_mode", "blend_mode"), &CanvasItemMaterial::set_blend_mode);
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index cb8ee761e6..1a043c204f 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -121,6 +121,8 @@ public:
static void finish_shaders();
static void flush_changes();
+ RID get_shader_rid() const;
+
CanvasItemMaterial();
virtual ~CanvasItemMaterial();
};