summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/chibi/cp_loader_s3m.cpp2
-rw-r--r--drivers/gles1/rasterizer_gles1.cpp10
-rw-r--r--drivers/gles1/rasterizer_gles1.h3
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp49
-rw-r--r--drivers/gles2/rasterizer_gles2.h3
-rw-r--r--platform/x11/os_x11.cpp8
-rw-r--r--scene/gui/box_container.cpp4
-rw-r--r--scene/gui/graph_node.cpp179
-rw-r--r--scene/gui/graph_node.h23
-rw-r--r--scene/register_scene_types.cpp2
-rw-r--r--scene/resources/default_theme/default_theme.cpp12
-rw-r--r--scene/resources/default_theme/graph_node.pngbin734 -> 770 bytes
-rw-r--r--scene/resources/default_theme/graph_port.pngbin0 -> 509 bytes
-rw-r--r--scene/resources/default_theme/theme_data.h10
-rw-r--r--scene/resources/shader.cpp43
-rw-r--r--scene/resources/shader.h7
-rw-r--r--servers/visual/rasterizer.h4
-rw-r--r--servers/visual/rasterizer_dummy.cpp10
-rw-r--r--servers/visual/rasterizer_dummy.h4
-rw-r--r--servers/visual/visual_server_raster.cpp10
-rw-r--r--servers/visual/visual_server_raster.h4
-rw-r--r--servers/visual/visual_server_wrap_mt.h4
-rw-r--r--servers/visual_server.h4
23 files changed, 351 insertions, 44 deletions
diff --git a/drivers/chibi/cp_loader_s3m.cpp b/drivers/chibi/cp_loader_s3m.cpp
index c5f0830ae6..8b9871463f 100644
--- a/drivers/chibi/cp_loader_s3m.cpp
+++ b/drivers/chibi/cp_loader_s3m.cpp
@@ -162,7 +162,7 @@ CPLoader::Error CPLoader_S3M::load_sample(CPSample *p_sample) {
p_sample->set_default_volume(def_volume);
p_sample->set_name(name);
- char scrs[4];
+ char scrs[5];
file->get_byte_array((uint8_t*)scrs,4);
scrs[4]=0;
diff --git a/drivers/gles1/rasterizer_gles1.cpp b/drivers/gles1/rasterizer_gles1.cpp
index 00fc85c41c..902c105d64 100644
--- a/drivers/gles1/rasterizer_gles1.cpp
+++ b/drivers/gles1/rasterizer_gles1.cpp
@@ -1021,6 +1021,16 @@ void RasterizerGLES1::shader_get_param_list(RID p_shader, List<PropertyInfo> *p_
}
+
+void RasterizerGLES1::shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture) {
+
+}
+
+RID RasterizerGLES1::shader_get_default_texture_param(RID p_shader, const StringName& p_name) const {
+
+ return RID();
+}
+
/* COMMON MATERIAL API */
diff --git a/drivers/gles1/rasterizer_gles1.h b/drivers/gles1/rasterizer_gles1.h
index 0995089dd7..d3e38f3ded 100644
--- a/drivers/gles1/rasterizer_gles1.h
+++ b/drivers/gles1/rasterizer_gles1.h
@@ -875,6 +875,9 @@ public:
virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const;
+ virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture);
+ virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const;
+
/* COMMON MATERIAL API */
virtual RID material_create();
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index 9f2fd032fa..9d47084c1c 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -1539,6 +1539,29 @@ void RasterizerGLES2::shader_get_param_list(RID p_shader, List<PropertyInfo> *p_
}
+void RasterizerGLES2::shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture) {
+
+ Shader *shader=shader_owner.get(p_shader);
+ ERR_FAIL_COND(!shader);
+ ERR_FAIL_COND(!texture_owner.owns(p_texture));
+
+ if (p_texture.is_valid())
+ shader->default_textures[p_name]=p_texture;
+ else
+ shader->default_textures.erase(p_name);
+
+}
+
+RID RasterizerGLES2::shader_get_default_texture_param(RID p_shader, const StringName& p_name) const{
+ const Shader *shader=shader_owner.get(p_shader);
+
+ const Map<StringName,RID>::Element *E=shader->default_textures.find(p_name);
+ if (!E)
+ return RID();
+ return E->get();
+}
+
+
/* COMMON MATERIAL API */
@@ -4991,9 +5014,26 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material
Texture *t=NULL;
if (rid.is_valid()) {
+
t=texture_owner.get(rid);
- if (!t)
+ if (!t) {
E->get().value=RID(); //nullify, invalid texture
+ rid=RID();
+ }
+ } else {
+
+
+ }
+
+ if (!rid.is_valid()) {
+ //use from default textures
+ Map<StringName,RID>::Element *F=p_material->shader_cache->default_textures.find(E->key());
+ if (F) {
+ t=texture_owner.get(F->get());
+ if (!t) {
+ p_material->shader_cache->default_textures.erase(E->key());
+ }
+ }
}
@@ -5020,6 +5060,13 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material
}
+ for (Map<StringName,RID>::Element *E=p_material->shader_cache->default_textures.front();E;E=E->next()) {
+ if (p_material->shader_params.has(E->key()))
+ continue;
+
+
+ }
+
if (p_material->shader_cache->has_texscreen && framebuffer.active) {
material_shader.set_uniform(MaterialShaderGLES2::TEXSCREEN_SCREEN_MULT,Vector2(float(viewport.width)/framebuffer.width,float(viewport.height)/framebuffer.height));
material_shader.set_uniform(MaterialShaderGLES2::TEXSCREEN_TEX,texcoord);
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index 27f7848b13..dc596f9f6c 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -195,6 +195,7 @@ class RasterizerGLES2 : public Rasterizer {
Map<StringName,ShaderLanguage::Uniform> uniforms;
StringName first_texture;
+ Map<StringName,RID> default_textures;
SelfList<Shader> dirty_list;
@@ -1255,6 +1256,8 @@ public:
virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const;
+ virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture);
+ virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const;
/* COMMON MATERIAL API */
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 804809a87d..aa9e4c63c9 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1458,14 +1458,14 @@ OS_X11::OS_X11() {
AudioDriverManagerSW::add_driver(&driver_rtaudio);
#endif
-#ifdef ALSA_ENABLED
- AudioDriverManagerSW::add_driver(&driver_alsa);
-#endif
-
#ifdef PULSEAUDIO_ENABLED
AudioDriverManagerSW::add_driver(&driver_pulseaudio);
#endif
+#ifdef ALSA_ENABLED
+ AudioDriverManagerSW::add_driver(&driver_alsa);
+#endif
+
minimized = false;
xim_style=NULL;
mouse_mode=MOUSE_MODE_VISIBLE;
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index 216c6d7122..5ed60e88f8 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -44,7 +44,7 @@ void BoxContainer::_resort() {
Size2i new_size=get_size();;
- int sep=get_constant("separation",vertical?"VBoxContainer":"HBoxContainer");
+ int sep=get_constant("separation");//,vertical?"VBoxContainer":"HBoxContainer");
bool first=true;
int children_count=0;
@@ -202,7 +202,7 @@ Size2 BoxContainer::get_minimum_size() const {
/* Calculate MINIMUM SIZE */
Size2i minimum;
- int sep=get_constant("separation",vertical?"VBoxContainer":"HBoxContainer");
+ int sep=get_constant("separation");//,vertical?"VBoxContainer":"HBoxContainer");
bool first=true;
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 96f8828efc..6e3afeefd0 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -1,6 +1,98 @@
#include "graph_node.h"
+bool GraphNode::_set(const StringName& p_name, const Variant& p_value) {
+
+ if (!p_name.operator String().begins_with("slot/"))
+ return false;
+
+ int idx=p_name.operator String().get_slice("/",1).to_int();
+ String what = p_name.operator String().get_slice("/",2);
+
+
+ Slot si;
+ if (slot_info.has(idx))
+ si=slot_info[idx];
+
+
+ if (what=="left_enabled")
+ si.enable_left=p_value;
+ else if (what=="left_type")
+ si.type_left=p_value;
+ else if (what=="left_color")
+ si.color_left=p_value;
+ else if (what=="right_enabled")
+ si.enable_right=p_value;
+ else if (what=="right_type")
+ si.type_right=p_value;
+ else if (what=="right_color")
+ si.color_right=p_value;
+ else
+ return false;
+
+ set_slot(idx,si.enable_left,si.type_left,si.color_left,si.enable_right,si.type_right,si.color_right);
+ update();
+ return true;
+}
+
+bool GraphNode::_get(const StringName& p_name,Variant &r_ret) const{
+
+
+ print_line("get "+p_name.operator String());
+ if (!p_name.operator String().begins_with("slot/")) {
+ print_line("no begins");
+ return false;
+ }
+
+ int idx=p_name.operator String().get_slice("/",1).to_int();
+ String what = p_name.operator String().get_slice("/",2);
+
+
+
+ Slot si;
+ if (slot_info.has(idx))
+ si=slot_info[idx];
+
+ if (what=="left_enabled")
+ r_ret=si.enable_left;
+ else if (what=="left_type")
+ r_ret=si.type_left;
+ else if (what=="left_color")
+ r_ret=si.color_left;
+ else if (what=="right_enabled")
+ r_ret=si.enable_right;
+ else if (what=="right_type")
+ r_ret=si.type_right;
+ else if (what=="right_color")
+ r_ret=si.color_right;
+ else
+ return false;
+
+ print_line("ask for: "+p_name.operator String()+" get: "+String(r_ret));
+ return true;
+}
+void GraphNode::_get_property_list( List<PropertyInfo> *p_list) const{
+
+ int idx=0;
+ for(int i=0;i<get_child_count();i++) {
+ Control *c=get_child(i)->cast_to<Control>();
+ if (!c || c->is_set_as_toplevel() || !c->get_owner())
+ continue;
+
+ String base="slot/"+itos(idx)+"/";
+
+ p_list->push_back(PropertyInfo(Variant::BOOL,base+"left_enabled"));
+ p_list->push_back(PropertyInfo(Variant::INT,base+"left_type"));
+ p_list->push_back(PropertyInfo(Variant::COLOR,base+"left_color"));
+ p_list->push_back(PropertyInfo(Variant::BOOL,base+"right_enabled"));
+ p_list->push_back(PropertyInfo(Variant::INT,base+"right_type"));
+ p_list->push_back(PropertyInfo(Variant::COLOR,base+"right_color"));
+
+ idx++;
+ }
+}
+
+
void GraphNode::_resort() {
@@ -13,7 +105,7 @@ void GraphNode::_resort() {
for(int i=0;i<get_child_count();i++) {
Control *c=get_child(i)->cast_to<Control>();
- if (!c || !c->is_visible())
+ if (!c)
continue;
if (c->is_set_as_toplevel())
continue;
@@ -34,11 +126,12 @@ void GraphNode::_resort() {
int w = get_size().x - sb->get_minimum_size().x;
+ cache_y.clear();
for(int i=0;i<get_child_count();i++) {
Control *c=get_child(i)->cast_to<Control>();
- if (!c || !c->is_visible())
+ if (!c)
continue;
- if (c->is_set_as_toplevel())
+ if (c->is_set_as_toplevel() || !c->get_owner())
continue;
Size2i size=c->get_combined_minimum_size();
@@ -46,14 +139,18 @@ void GraphNode::_resort() {
Rect2 r(sb->get_margin(MARGIN_LEFT),sb->get_margin(MARGIN_TOP)+vofs,w,size.y);
fit_child_in_rect(c,r);
-
+ cache_y.push_back(vofs+size.y*0.5);
if (vofs>0)
vofs+=sep;
vofs+=size.y;
+
}
+ _change_notify();
+ update();
+
}
@@ -62,7 +159,26 @@ void GraphNode::_notification(int p_what) {
if (p_what==NOTIFICATION_DRAW) {
Ref<StyleBox> sb=get_stylebox("frame");
+ Ref<Texture> port =get_icon("port");
+ Point2i icofs = -port->get_size()*0.5;
+ int edgeofs=3;
+ icofs.y+=sb->get_margin(MARGIN_TOP);
draw_style_box(sb,Rect2(Point2(),get_size()));
+
+ for (Map<int,Slot>::Element *E=slot_info.front();E;E=E->next()) {
+
+ if (E->key()>cache_y.size())
+ continue;
+ if (!slot_info.has(E->key()))
+ continue;
+ const Slot &s=slot_info[E->key()];
+ //left
+ if (s.enable_left)
+ port->draw(get_canvas_item(),icofs+Point2(edgeofs,cache_y[E->key()]),s.color_left);
+ if (s.enable_right)
+ port->draw(get_canvas_item(),icofs+Point2(get_size().x-edgeofs,cache_y[E->key()]),s.color_right);
+
+ }
}
if (p_what==NOTIFICATION_SORT_CHILDREN) {
@@ -82,16 +198,22 @@ String GraphNode::get_title() const {
return title;
}
-void GraphNode::set_slot(int p_idx,int p_type_left,int p_index_left,const Color& p_color_left, int p_type_right,int p_index_right,const Color& p_color_right) {
+void GraphNode::set_slot(int p_idx,bool p_enable_left,int p_type_left,const Color& p_color_left, bool p_enable_right,int p_type_right,const Color& p_color_right) {
ERR_FAIL_COND(p_idx<0);
+
+ if (!p_enable_left && p_type_left==0 && p_color_left==Color(1,1,1,1) && !p_enable_right && p_type_right==0 && p_color_right==Color(1,1,1,1)) {
+ slot_info.erase(p_idx);
+ return;
+ }
+
Slot s;
+ s.enable_left=p_enable_left;
s.type_left=p_type_left;
s.color_left=p_color_left;
- s.index_left=p_index_left;
+ s.enable_right=p_enable_right;
s.type_right=p_type_right;
s.color_right=p_color_right;
- s.index_right=p_index_right;
slot_info[p_idx]=s;
update();
}
@@ -106,46 +228,52 @@ void GraphNode::clear_all_slots(){
slot_info.clear();
update();
}
-int GraphNode::get_slot_type_left(int p_idx) const{
+bool GraphNode::is_slot_enabled_left(int p_idx) const{
if (!slot_info.has(p_idx))
- return TYPE_DISABLED;
- return slot_info[p_idx].type_left;
+ return false;
+ return slot_info[p_idx].enable_left;
}
-int GraphNode::get_slot_index_left(int p_idx) const{
+
+int GraphNode::get_slot_type_left(int p_idx) const{
if (!slot_info.has(p_idx))
- return TYPE_DISABLED;
- return slot_info[p_idx].index_left;
+ return 0;
+ return slot_info[p_idx].type_left;
}
+
Color GraphNode::get_slot_color_left(int p_idx) const{
if (!slot_info.has(p_idx))
- return Color();
+ return Color(1,1,1,1);
return slot_info[p_idx].color_left;
}
-int GraphNode::get_slot_type_right(int p_idx) const{
+bool GraphNode::is_slot_enabled_right(int p_idx) const{
if (!slot_info.has(p_idx))
- return TYPE_DISABLED;
- return slot_info[p_idx].type_right;
+ return false;
+ return slot_info[p_idx].enable_right;
}
-int GraphNode::get_slot_index_right(int p_idx) const{
+
+
+
+int GraphNode::get_slot_type_right(int p_idx) const{
if (!slot_info.has(p_idx))
- return TYPE_DISABLED;
- return slot_info[p_idx].index_right;
+ return 0;
+ return slot_info[p_idx].type_right;
}
+
Color GraphNode::get_slot_color_right(int p_idx) const{
if (!slot_info.has(p_idx))
- return Color();
+ return Color(1,1,1,1);
return slot_info[p_idx].color_right;
}
@@ -161,9 +289,9 @@ Size2 GraphNode::get_minimum_size() const {
for(int i=0;i<get_child_count();i++) {
Control *c=get_child(i)->cast_to<Control>();
- if (!c || !c->is_visible())
+ if (!c)
continue;
- if (c->is_set_as_toplevel())
+ if (c->is_set_as_toplevel() || !c->get_owner())
continue;
Size2i size=c->get_combined_minimum_size();
@@ -186,6 +314,7 @@ void GraphNode::_bind_methods() {
}
-GraphNode::GraphNode()
-{
+GraphNode::GraphNode() {
+
+
}
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index 1b2e8cec21..3b89da9f0f 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -10,14 +10,19 @@ class GraphNode : public Container {
String title;
struct Slot {
+ bool enable_left;
int type_left;
- int index_left;
Color color_left;
+ bool enable_right;
int type_right;
- int index_right;
Color color_right;
+
+
+ Slot() { enable_left=false; type_left=0; color_left=Color(1,1,1,1); enable_right=false; type_right=0; color_right=Color(1,1,1,1); };
};
+ Vector<int> cache_y;
+
Map<int,Slot> slot_info;
void _resort();
@@ -25,24 +30,26 @@ protected:
void _notification(int p_what);
static void _bind_methods();
+
+ bool _set(const StringName& p_name, const Variant& p_value);
+ bool _get(const StringName& p_name,Variant &r_ret) const;
+ void _get_property_list( List<PropertyInfo> *p_list) const;
+
public:
- enum {
- TYPE_DISABLED=-1
- };
void set_title(const String& p_title);
String get_title() const;
- void set_slot(int p_idx,int p_type_left,int p_index_left,const Color& p_color_left, int p_type_right,int p_index_right,const Color& p_color_right);
+ void set_slot(int p_idx,bool p_enable_left,int p_type_left,const Color& p_color_left, bool p_enable_right,int p_type_right,const Color& p_color_right);
void clear_slot(int p_idx);
void clear_all_slots();
+ bool is_slot_enabled_left(int p_idx) const;
int get_slot_type_left(int p_idx) const;
- int get_slot_index_left(int p_idx) const;
Color get_slot_color_left(int p_idx) const;
+ bool is_slot_enabled_right(int p_idx) const;
int get_slot_type_right(int p_idx) const;
- int get_slot_index_right(int p_idx) const;
Color get_slot_color_right(int p_idx) const;
virtual Size2 get_minimum_size() const;
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 741deccdbe..962e8c26e0 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -75,6 +75,7 @@
#include "scene/gui/split_container.h"
#include "scene/gui/video_player.h"
#include "scene/gui/reference_frame.h"
+#include "scene/gui/graph_node.h"
#include "scene/resources/video_stream.h"
#include "scene/2d/particles_2d.h"
#include "scene/2d/path_2d.h"
@@ -303,6 +304,7 @@ void register_scene_types() {
ObjectTypeDB::register_virtual_type<SplitContainer>();
ObjectTypeDB::register_type<HSplitContainer>();
ObjectTypeDB::register_type<VSplitContainer>();
+ ObjectTypeDB::register_type<GraphNode>();
OS::get_singleton()->yield(); //may take time to init
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index f27cfb9511..050e462902 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -65,7 +65,7 @@ static Ref<Texture> make_icon(T p_src) {
Ref<ImageTexture> texture( memnew( ImageTexture ) );
- texture->create_from_image( Image(p_src) );
+ texture->create_from_image( Image(p_src),ImageTexture::FLAG_FILTER );
return texture;
}
@@ -416,7 +416,15 @@ void make_default_theme() {
t->set_color("font_color_hover","PopupMenu", control_font_color );
t->set_constant("hseparation","PopupMenu",2);
t->set_constant("vseparation","PopupMenu",1);
-
+
+ Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,21,6,5,16,21,16,5);
+ //graphsb->set_expand_margin_size(MARGIN_LEFT,10);
+ //graphsb->set_expand_margin_size(MARGIN_RIGHT,10);
+ t->set_stylebox("frame","GraphNode", graphsb );
+ t->set_constant("separation","GraphNode", 1 );
+ t->set_icon("port","GraphNode", make_icon( graph_port_png ) );
+
+
t->set_stylebox("bg","Tree", make_stylebox( tree_bg_png,4,4,4,5,3,3,3,3) );
t->set_stylebox("bg_focus","Tree", focus );
Ref<StyleBoxTexture> tree_selected = make_stylebox( selection_png,4,4,4,4);
diff --git a/scene/resources/default_theme/graph_node.png b/scene/resources/default_theme/graph_node.png
index b9fe334948..3adccf2c3b 100644
--- a/scene/resources/default_theme/graph_node.png
+++ b/scene/resources/default_theme/graph_node.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_port.png b/scene/resources/default_theme/graph_port.png
new file mode 100644
index 0000000000..92f425f977
--- /dev/null
+++ b/scene/resources/default_theme/graph_port.png
Binary files differ
diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h
index 9cef0265ee..9fe77b3223 100644
--- a/scene/resources/default_theme/theme_data.h
+++ b/scene/resources/default_theme/theme_data.h
@@ -99,6 +99,16 @@ static const unsigned char full_panel_bg_png[]={
};
+static const unsigned char graph_node_png[]={
+0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x40,0x8,0x6,0x0,0x0,0x0,0x13,0x7d,0xf7,0x96,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0xc,0x14,0x10,0x3,0x2e,0x15,0xb6,0x7,0x4a,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x2,0x6a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,0x6e,0x7e,0xff,0xf1,0xf5,0x12,0xb0,0x14,0x7a,0x1d,0xda,0x61,0x10,0xb6,0x87,0xbf,0x63,0x10,0x75,0x47,0xa,0x2a,0x79,0x85,0x95,0x51,0xbc,0xc5,0x28,0x86,0x30,0x8,0xdb,0xbe,0x6c,0x49,0x1,0x1,0x80,0x51,0xeb,0xfc,0x9d,0xc0,0x4e,0x6b,0xf,0xd1,0xfc,0xb9,0xb3,0x20,0x5,0x68,0xfa,0x8b,0x5a,0x8b,0xaa,0x80,0x28,0x82,0xa0,0x28,0xa2,0x92,0x73,0xd3,0xb1,0xde,0x86,0x85,0x46,0x5b,0x45,0x51,0x50,0x45,0xc4,0x95,0x61,0x53,0x27,0x71,0x61,0x74,0x1a,0xc0,0xaa,0xcd,0x6e,0xa8,0x64,0x2f,0xee,0x5d,0x29,0x8a,0x32,0x39,0x3,0x5f,0xb6,0x2f,0x4c,0x45,0x73,0x5a,0xd8,0x31,0x48,0x1,0x60,0xac,0x2d,0xf1,0x5,0x51,0x75,0x45,0x68,0x5a,0xbf,0x4e,0xcf,0x60,0xfb,0x82,0x2b,0x5a,0x73,0x4e,0xb6,0xe2,0xf,0x52,0x2,0xd8,0x82,0xe2,0x14,0x50,0x54,0xc4,0x2f,0x8b,0x68,0xad,0x1f,0x99,0x54,0x79,0x41,0xdd,0x0,0xf8,0xb6,0x82,0x88,0x4e,0xeb,0x82,0x66,0x89,0xaa,0x3b,0xc8,0x52,0x48,0x41,0x56,0x76,0xcc,0x60,0x7b,0x74,0x75,0xac,0x1a,0x49,0x47,0x72,0x72,0x6,0xe2,0xe7,0x56,0x45,0xfd,0x5d,0xc9,0x44,0x28,0x40,0x2b,0x45,0x34,0xea,0x7,0xa8,0x14,0xc9,0x92,0x75,0x64,0x7,0x11,0x8d,0x8f,0x98,0x9b,0x87,0xf2,0xf4,0x4d,0xd5,0x40,0xd5,0xc9,0x97,0xf,0xa3,0x5a,0x74,0x9c,0x36,0x89,0xf7,0x9f,0xdc,0x61,0xaf,0x96,0x1,0x92,0x2d,0xc3,0xe2,0xf9,0x8b,0xbb,0x72,0x5a,0x7a,0xff,0xb6,0x3a,0x83,0x8d,0x41,0x7f,0xcf,0x19,0x34,0xf8,0x47,0xab,0x1,0x35,0xa0,0x6,0xd4,0x80,0x1a,0x50,0x3,0x6a,0xc0,0x7f,0x9,0x90,0x8a,0x4f,0xe0,0x3d,0x67,0x60,0xf7,0xe1,0x6b,0x53,0x80,0x5,0x22,0x63,0x4c,0x6c,0x93,0x5d,0x78,0x25,0x60,0x8c,0x89,0x81,0x8,0xb0,0xd,0xbf,0xca,0xae,0x47,0xf1,0x70,0x79,0xad,0xb7,0xca,0x34,0x88,0x4d,0x60,0xad,0xb7,0x4a,0x14,0xf,0x97,0x81,0x75,0xc0,0xa4,0x9b,0xeb,0x1c,0x70,0xa1,0xd3,0xee,0x3e,0x6d,0x35,0x67,0xcf,0x5,0x41,0x50,0x29,0xae,0x31,0xc6,0x46,0xf1,0xf0,0xc3,0x60,0xb3,0x7f,0x13,0x78,0x7,0x6c,0x48,0x6e,0x85,0xeb,0x0,0x27,0x80,0x23,0x40,0x73,0xc2,0xf2,0x1d,0x3,0x3f,0x81,0x6f,0x7e,0x8f,0x36,0x52,0x12,0x34,0x4c,0xf7,0xc1,0x9,0x55,0xa8,0x2f,0x39,0xd9,0xa7,0xf0,0xe3,0xf6,0x17,0x4c,0x97,0x1d,0x24,0x5b,0x8,0x8b,0x95,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
+};
+
+
+static const unsigned char graph_port_png[]={
+0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0xa,0x0,0x0,0x0,0xa,0x8,0x6,0x0,0x0,0x0,0x8d,0x32,0xcf,0xbd,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0x0,0x0,0x0,0x0,0x0,0xf9,0x43,0xbb,0x7f,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0xc,0x14,0x17,0x20,0x3,0xeb,0x8f,0x3a,0xdb,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x1,0x65,0x49,0x44,0x41,0x54,0x18,0xd3,0x4d,0xd0,0x4f,0x6b,0xda,0x70,0x1c,0x7,0xe0,0xcf,0x37,0x7f,0x7e,0x49,0x66,0xd2,0x64,0x61,0x5,0x61,0x76,0x47,0xf1,0xa4,0x2d,0xdb,0x75,0x5,0x11,0x84,0xb0,0x5e,0xeb,0xd9,0xeb,0xf4,0x6d,0xec,0x2d,0xf8,0x26,0xb6,0x77,0xe0,0x45,0xba,0xa3,0x6c,0xa0,0x3b,0xad,0x39,0xb6,0x36,0x8,0x1b,0x4b,0x32,0xd2,0xc6,0x6c,0x9a,0x4f,0x4f,0x85,0x3e,0x2f,0xe1,0x11,0x0,0x20,0x29,0xd3,0xe9,0xd4,0xda,0x6e,0xb7,0x23,0xdf,0xf7,0xbb,0x0,0x90,0xe7,0xf9,0x8f,0x66,0xb3,0xf9,0x79,0x36,0x9b,0x55,0x22,0x42,0x83,0xa4,0x44,0x51,0xf4,0xea,0xe2,0xe2,0xc3,0xf7,0xf1,0x78,0xdc,0xa,0x82,0x40,0x8,0x20,0xcf,0x32,0x2e,0x97,0xcb,0x4f,0x51,0x14,0xbd,0x25,0xf9,0x5b,0x26,0x93,0x89,0xdd,0xe9,0x74,0xe2,0xf7,0xe7,0xe7,0x27,0x59,0xfa,0x87,0x65,0xb9,0x13,0x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+};
+
+
static const unsigned char hscroll_bg_png[]={
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x8,0x8,0x6,0x0,0x0,0x0,0xc4,0xf,0xbe,0x8b,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0x49,0x0,0x42,0x0,0x4e,0x4e,0xda,0xb4,0x7e,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xdd,0x9,0x1b,0x12,0x30,0x1c,0x3c,0x99,0xa,0x1c,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x0,0x53,0x49,0x44,0x41,0x54,0x18,0xd3,0x7d,0x8f,0xc9,0xd,0x80,0x20,0x0,0xc0,0xca,0x21,0xe8,0x5f,0x12,0x89,0x84,0xfd,0x5c,0x48,0x26,0x34,0x3e,0x74,0x2,0xa2,0xe8,0x2,0x40,0xbf,0xed,0xa7,0xc2,0xbb,0xb0,0x3,0x1b,0x75,0x92,0xf0,0x2e,0x7c,0x46,0x9b,0xaa,0xcd,0x4f,0x46,0x3,0x8c,0x76,0xea,0x7,0x4a,0x29,0x5a,0x68,0x0,0x29,0x65,0x3f,0x30,0x83,0xed,0x6,0xe9,0xbc,0x8e,0xf6,0x45,0x79,0xb,0xc0,0x5c,0xb3,0xeb,0x12,0xef,0x1f,0xc6,0x6f,0x12,0x2,0xa,0xbd,0xc9,0x5d,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index 6d65da3782..cc6bed3148 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -120,6 +120,13 @@ Dictionary Shader::_get_code() {
c["vertex_ofs"]=0;
c["light"]=ls;
c["light_ofs"]=0;
+ Array arr;
+ for(const Map<StringName,Ref<Texture> >::Element *E=default_textures.front();E;E=E->next()) {
+ arr.push_back(E->key());
+ arr.push_back(E->get());
+ }
+ if (arr.size())
+ c["default_tex"]=arr;
return c;
}
@@ -132,8 +139,41 @@ void Shader::_set_code(const Dictionary& p_string) {
light=p_string["light"];
set_code(p_string["vertex"],p_string["fragment"],light);
+ if (p_string.has("default_tex")) {
+ Array arr=p_string["default_tex"];
+ if ((arr.size()&1)==0) {
+ for(int i=0;i<arr.size();i+=2)
+ set_default_texture_param(arr[i],arr[i+1]);
+ }
+ }
+}
+
+void Shader::set_default_texture_param(const StringName& p_param,const Ref<Texture>& p_texture) {
+
+ if (p_texture.is_valid())
+ default_textures[p_param]=p_texture;
+ else
+ default_textures.erase(p_param);
+}
+
+Ref<Texture> Shader::get_default_texture_param(const StringName& p_param) const{
+
+ if (default_textures.has(p_param))
+ return default_textures[p_param];
+ else
+ return Ref<Texture>();
}
+void Shader::get_default_texture_param_list(List<StringName>* r_textures) const{
+
+ for(const Map<StringName,Ref<Texture> >::Element *E=default_textures.front();E;E=E->next()) {
+
+ r_textures->push_back(E->key());
+ }
+
+}
+
+
void Shader::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_mode","mode"),&Shader::set_mode);
@@ -144,6 +184,9 @@ void Shader::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_fragment_code"),&Shader::get_fragment_code);
ObjectTypeDB::bind_method(_MD("get_light_code"),&Shader::get_light_code);
+ ObjectTypeDB::bind_method(_MD("set_default_texture_param","param","texture:Texture"),&Shader::set_default_texture_param);
+ ObjectTypeDB::bind_method(_MD("get_default_texture_param:Texture","param"),&Shader::get_default_texture_param);
+
ObjectTypeDB::bind_method(_MD("has_param","name"),&Shader::has_param);
ObjectTypeDB::bind_method(_MD("_set_code","code"),&Shader::_set_code);
diff --git a/scene/resources/shader.h b/scene/resources/shader.h
index fff6f1d28a..e1b8288c51 100644
--- a/scene/resources/shader.h
+++ b/scene/resources/shader.h
@@ -31,7 +31,7 @@
#include "resource.h"
#include "io/resource_loader.h"
-
+#include "scene/resources/texture.h"
class Shader : public Resource {
OBJ_TYPE(Shader,Resource);
@@ -48,6 +48,7 @@ class Shader : public Resource {
// convertion fast and save memory.
mutable bool params_cache_dirty;
mutable Map<StringName,StringName> params_cache; //map a shader param to a material param..
+ Map<StringName,Ref<Texture> > default_textures;
protected:
@@ -72,6 +73,10 @@ public:
void get_param_list(List<PropertyInfo> *p_params) const;
bool has_param(const StringName& p_param) const;
+ void set_default_texture_param(const StringName& p_param, const Ref<Texture> &p_texture);
+ Ref<Texture> get_default_texture_param(const StringName& p_param) const;
+ void get_default_texture_param_list(List<StringName>* r_textures) const;
+
virtual RID get_rid() const;
Shader();
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 55625a2218..8731095425 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -187,6 +187,7 @@ public:
virtual bool texture_has_alpha(RID p_texture) const=0;
virtual void texture_set_size_override(RID p_texture,int p_width, int p_height)=0;
+
virtual void texture_set_reload_hook(RID p_texture,ObjectID p_owner,const StringName& p_function) const=0;
/* SHADER API */
@@ -203,6 +204,9 @@ public:
virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const=0;
+ virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture)=0;
+ virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const=0;
+
/* COMMON MATERIAL API */
virtual RID material_create()=0;
diff --git a/servers/visual/rasterizer_dummy.cpp b/servers/visual/rasterizer_dummy.cpp
index a671821e25..a399960014 100644
--- a/servers/visual/rasterizer_dummy.cpp
+++ b/servers/visual/rasterizer_dummy.cpp
@@ -221,6 +221,16 @@ void RasterizerDummy::shader_get_param_list(RID p_shader, List<PropertyInfo> *p_
}
+
+void RasterizerDummy::shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture) {
+
+}
+
+RID RasterizerDummy::shader_get_default_texture_param(RID p_shader, const StringName& p_name) const {
+
+ return RID();
+}
+
/* COMMON MATERIAL API */
diff --git a/servers/visual/rasterizer_dummy.h b/servers/visual/rasterizer_dummy.h
index 44bca423a4..d879fcafeb 100644
--- a/servers/visual/rasterizer_dummy.h
+++ b/servers/visual/rasterizer_dummy.h
@@ -429,6 +429,10 @@ public:
virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const;
+
+ virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture);
+ virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const;
+
/* COMMON MATERIAL API */
virtual RID material_create();
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index af50b9b592..7cfa6dbb32 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -157,6 +157,16 @@ void VisualServerRaster::shader_get_param_list(RID p_shader, List<PropertyInfo>
}
+void VisualServerRaster::shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture) {
+
+ rasterizer->shader_set_default_texture_param(p_shader,p_name,p_texture);
+}
+
+RID VisualServerRaster::shader_get_default_texture_param(RID p_shader, const StringName& p_name) const{
+
+ return rasterizer->shader_get_default_texture_param(p_shader,p_name);
+}
+
/* Material */
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 3064f9ceb0..ce52077550 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -756,6 +756,10 @@ public:
virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const;
+ virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture);
+ virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const;
+
+
/* COMMON MATERIAL API */
virtual RID material_create();
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index a4653b1013..7d2b8a3767 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -653,6 +653,10 @@ public:
FUNC1RC(String,shader_get_light_code,RID);
FUNC2SC(shader_get_param_list,RID,List<PropertyInfo>*);
+ FUNC3(shader_set_default_texture_param,RID,const StringName&,RID);
+ FUNC2RC(RID,shader_get_default_texture_param,RID,const StringName&);
+
+
/*virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) {
if (Thread::get_caller_ID()!=server_thread) {
command_queue.push_and_sync( visual_server, &VisualServer::shader_get_param_list,p_shader,p_param_list);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index ed04b0d09c..4336a91407 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -140,6 +140,7 @@ public:
SHADER_POST_PROCESS,
};
+
virtual RID shader_create(ShaderMode p_mode=SHADER_MATERIAL)=0;
virtual void shader_set_mode(RID p_shader,ShaderMode p_mode)=0;
@@ -151,6 +152,9 @@ public:
virtual String shader_get_light_code(RID p_shader) const=0;
virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const=0;
+ virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture)=0;
+ virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const=0;
+
/* COMMON MATERIAL API */