Browse Source

-ability to set default textures in shader (needed for visual shader editing)
-work in progress new graph system (will replace current one)
-crash fix in s3m loader (out of bounds acess)
-fixed vbox overriding of separation (fixes empty line between section tabs)

Juan Linietsky 10 years ago
parent
commit
f7f197c409

+ 1 - 1
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;
 

+ 10 - 0
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 */
 
 

+ 3 - 0
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();

+ 48 - 1
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);

+ 3 - 0
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 */
 

+ 4 - 4
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;

+ 2 - 2
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;
 

+ 154 - 25
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() {
+
+
 }

+ 15 - 8
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;

+ 2 - 0
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
 

+ 10 - 2
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);

BIN
scene/resources/default_theme/graph_node.png


BIN
scene/resources/default_theme/graph_port.png


File diff suppressed because it is too large
+ 1 - 0
scene/resources/default_theme/theme_data.h


+ 43 - 0
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);

+ 6 - 1
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();

+ 4 - 0
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;

+ 10 - 0
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 */
 
 

+ 4 - 0
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();

+ 10 - 0
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 */
 

+ 4 - 0
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();

+ 4 - 0
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);

+ 4 - 0
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 */
 

Some files were not shown because too many files changed in this diff