+351
-123
File diff suppressed because it is too large
Load Diff
+34
-19
@@ -36,25 +36,29 @@
|
||||
#include "scene/gui/button.h"
|
||||
#include "scene/gui/popup.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "scene/gui/option_button.h"
|
||||
#include "scene/gui/texture_frame.h"
|
||||
#include "scene/gui/tool_button.h"
|
||||
#include "scene/gui/check_button.h"
|
||||
#include "scene/resources/material.h"
|
||||
|
||||
class ColorPicker : public HBoxContainer {
|
||||
class ColorPicker : public BoxContainer {
|
||||
|
||||
OBJ_TYPE(ColorPicker,HBoxContainer);
|
||||
public:
|
||||
OBJ_TYPE(ColorPicker,BoxContainer);
|
||||
|
||||
enum Mode {
|
||||
MODE_RGB,
|
||||
MODE_HSV,
|
||||
MODE_RAW
|
||||
};
|
||||
private:
|
||||
|
||||
Mode mode;
|
||||
|
||||
OptionButton *mode_box;
|
||||
|
||||
Control *color_box;
|
||||
Control *screen;
|
||||
Image last_capture;
|
||||
TextureFrame *uv_edit;
|
||||
TextureFrame *w_edit;
|
||||
TextureFrame *sample;
|
||||
TextureFrame *preset;
|
||||
Button *bt_add_preset;
|
||||
List<Color> presets;
|
||||
ToolButton *btn_pick;
|
||||
CheckButton *btn_mode;
|
||||
Ref<CanvasItemMaterial> uv_material;
|
||||
Ref<CanvasItemMaterial> w_material;
|
||||
HSlider *scroll[4];
|
||||
SpinBox *values[4];
|
||||
Label *labels[4];
|
||||
@@ -64,13 +68,25 @@ private:
|
||||
Size2i ms;
|
||||
|
||||
Color color;
|
||||
bool raw_mode_enabled;
|
||||
bool updating;
|
||||
bool changing_color;
|
||||
float h,s,v;
|
||||
|
||||
void _html_entered(const String& p_html);
|
||||
void _value_changed(double);
|
||||
void _update_controls();
|
||||
void _update_color();
|
||||
void _color_box_draw();
|
||||
void _update_presets();
|
||||
void _sample_draw();
|
||||
void _hsv_draw(int p_wich,Control *c);
|
||||
|
||||
void _uv_input(const InputEvent& p_input);
|
||||
void _w_input(const InputEvent& p_input);
|
||||
void _preset_input(const InputEvent& p_input);
|
||||
void _screen_input(const InputEvent& p_input);
|
||||
void _add_preset_pressed();
|
||||
void _screen_pick_pressed();
|
||||
protected:
|
||||
|
||||
void _notification(int);
|
||||
@@ -83,15 +99,14 @@ public:
|
||||
void set_color(const Color& p_color);
|
||||
Color get_color() const;
|
||||
|
||||
void set_mode(Mode p_mode);
|
||||
Mode get_mode() const;
|
||||
void add_preset(const Color& p_color);
|
||||
void set_raw_mode(bool p_enabled);
|
||||
bool is_raw_mode() const;
|
||||
|
||||
|
||||
ColorPicker();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST( ColorPicker::Mode );
|
||||
|
||||
class ColorPickerButton : public Button {
|
||||
|
||||
OBJ_TYPE(ColorPickerButton,Button);
|
||||
|
||||
+93
-1
@@ -109,6 +109,11 @@ bool Control::_set(const StringName& p_name, const Variant& p_value) {
|
||||
data.icon_override.erase(dname);
|
||||
notification(NOTIFICATION_THEME_CHANGED);
|
||||
update();
|
||||
} else if (name.begins_with("custom_shaders/")) {
|
||||
String dname = name.get_slicec('/',1);
|
||||
data.shader_override.erase(dname);
|
||||
notification(NOTIFICATION_THEME_CHANGED);
|
||||
update();
|
||||
} else if (name.begins_with("custom_styles/")) {
|
||||
String dname = name.get_slicec('/',1);
|
||||
data.style_override.erase(dname);
|
||||
@@ -137,6 +142,10 @@ bool Control::_set(const StringName& p_name, const Variant& p_value) {
|
||||
String dname = name.get_slicec('/',1);
|
||||
notification(NOTIFICATION_THEME_CHANGED);
|
||||
add_icon_override(dname,p_value);
|
||||
} else if (name.begins_with("custom_shaders/")) {
|
||||
String dname = name.get_slicec('/',1);
|
||||
add_shader_override(dname,p_value);
|
||||
notification(NOTIFICATION_THEME_CHANGED);
|
||||
} else if (name.begins_with("custom_styles/")) {
|
||||
String dname = name.get_slicec('/',1);
|
||||
add_style_override(dname,p_value);
|
||||
@@ -189,6 +198,10 @@ bool Control::_get(const StringName& p_name,Variant &r_ret) const {
|
||||
String name = sname.get_slicec('/',1);
|
||||
|
||||
r_ret= data.icon_override.has(name)?Variant(data.icon_override[name]):Variant();
|
||||
} else if (sname.begins_with("custom_shaders/")) {
|
||||
String name = sname.get_slicec('/',1);
|
||||
|
||||
r_ret= data.shader_override.has(name)?Variant(data.shader_override[name]):Variant();
|
||||
} else if (sname.begins_with("custom_styles/")) {
|
||||
String name = sname.get_slicec('/',1);
|
||||
|
||||
@@ -236,6 +249,18 @@ void Control::_get_property_list( List<PropertyInfo> *p_list) const {
|
||||
p_list->push_back( PropertyInfo(Variant::OBJECT,"custom_icons/"+E->get(),PROPERTY_HINT_RESOURCE_TYPE, "Texture",hint) );
|
||||
}
|
||||
}
|
||||
{
|
||||
List<StringName> names;
|
||||
theme->get_shader_list(get_type_name(),&names);
|
||||
for(List<StringName>::Element *E=names.front();E;E=E->next()) {
|
||||
|
||||
uint32_t hint= PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_CHECKABLE;
|
||||
if (data.shader_override.has(E->get()))
|
||||
hint|=PROPERTY_USAGE_STORAGE|PROPERTY_USAGE_CHECKED;
|
||||
|
||||
p_list->push_back( PropertyInfo(Variant::OBJECT,"custom_shaders/"+E->get(),PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemShader,CanvasItemShaderGraph",hint) );
|
||||
}
|
||||
}
|
||||
{
|
||||
List<StringName> names;
|
||||
theme->get_stylebox_list(get_type_name(),&names);
|
||||
@@ -650,6 +675,35 @@ Ref<Texture> Control::get_icon(const StringName& p_name,const StringName& p_type
|
||||
|
||||
}
|
||||
|
||||
Ref<Shader> Control::get_shader(const StringName& p_name,const StringName& p_type) const {
|
||||
if (p_type==StringName()) {
|
||||
|
||||
const Ref<Shader>* sdr = data.shader_override.getptr(p_name);
|
||||
if (sdr)
|
||||
return *sdr;
|
||||
}
|
||||
|
||||
StringName type = p_type?p_type:get_type_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
|
||||
while(theme_owner) {
|
||||
|
||||
if (theme_owner->data.theme->has_shader(p_name, type))
|
||||
return data.theme_owner->data.theme->get_shader(p_name, type );
|
||||
Control *parent = theme_owner->get_parent()?theme_owner->get_parent()->cast_to<Control>():NULL;
|
||||
|
||||
if (parent)
|
||||
theme_owner=parent->data.theme_owner;
|
||||
else
|
||||
theme_owner=NULL;
|
||||
|
||||
}
|
||||
|
||||
return Theme::get_default()->get_shader( p_name, type );
|
||||
}
|
||||
|
||||
Ref<StyleBox> Control::get_stylebox(const StringName& p_name,const StringName& p_type) const {
|
||||
|
||||
if (p_type==StringName()) {
|
||||
@@ -796,7 +850,37 @@ bool Control::has_icon(const StringName& p_name,const StringName& p_type) const
|
||||
}
|
||||
|
||||
return Theme::get_default()->has_icon( p_name, type );
|
||||
|
||||
}
|
||||
|
||||
bool Control::has_shader(const StringName &p_name, const StringName &p_type) const
|
||||
{
|
||||
if (p_type==StringName()) {
|
||||
const Ref<Shader>* sdr = data.shader_override.getptr(p_name);
|
||||
if (sdr)
|
||||
return true;
|
||||
}
|
||||
|
||||
StringName type = p_type?p_type:get_type_name();
|
||||
|
||||
// try with custom themes
|
||||
Control *theme_owner = data.theme_owner;
|
||||
|
||||
while(theme_owner) {
|
||||
|
||||
if (theme_owner->data.theme->has_shader(p_name, type))
|
||||
return true;
|
||||
Control *parent = theme_owner->get_parent()?theme_owner->get_parent()->cast_to<Control>():NULL;
|
||||
|
||||
if (parent)
|
||||
theme_owner=parent->data.theme_owner;
|
||||
else
|
||||
theme_owner=NULL;
|
||||
|
||||
}
|
||||
|
||||
return Theme::get_default()->has_shader( p_name, type );
|
||||
|
||||
}
|
||||
bool Control::has_stylebox(const StringName& p_name,const StringName& p_type) const {
|
||||
|
||||
@@ -1261,7 +1345,14 @@ void Control::add_icon_override(const StringName& p_name, const Ref<Texture>& p_
|
||||
data.icon_override[p_name]=p_icon;
|
||||
notification(NOTIFICATION_THEME_CHANGED);
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
void Control::add_shader_override(const StringName &p_name, const Ref<Shader> &p_shader) {
|
||||
ERR_FAIL_COND(p_shader.is_null());
|
||||
data.shader_override[p_name]=p_shader;
|
||||
notification(NOTIFICATION_THEME_CHANGED);
|
||||
update();
|
||||
}
|
||||
void Control::add_style_override(const StringName& p_name, const Ref<StyleBox>& p_style) {
|
||||
|
||||
@@ -2011,8 +2102,9 @@ void Control::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_theme","theme:Theme"),&Control::set_theme);
|
||||
ObjectTypeDB::bind_method(_MD("get_theme:Theme"),&Control::get_theme);
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("add_icon_override","name","texture:Texture"),&Control::add_icon_override);
|
||||
ObjectTypeDB::bind_method(_MD("add_shader_override","name","shader:Shader"),&Control::add_shader_override);
|
||||
ObjectTypeDB::bind_method(_MD("add_style_override","name","stylebox:StyleBox"),&Control::add_style_override);
|
||||
ObjectTypeDB::bind_method(_MD("add_font_override","name","font:Font"),&Control::add_font_override);
|
||||
ObjectTypeDB::bind_method(_MD("add_color_override","name","color"),&Control::add_color_override);
|
||||
|
||||
+5
-1
@@ -142,6 +142,7 @@ private:
|
||||
NodePath focus_neighbour[4];
|
||||
|
||||
HashMap<StringName, Ref<Texture>, StringNameHasher > icon_override;
|
||||
HashMap<StringName, Ref<Shader>, StringNameHasher > shader_override;
|
||||
HashMap<StringName, Ref<StyleBox>, StringNameHasher > style_override;
|
||||
HashMap<StringName, Ref<Font>, StringNameHasher > font_override;
|
||||
HashMap<StringName, Color, StringNameHasher > color_override;
|
||||
@@ -315,18 +316,21 @@ public:
|
||||
/* SKINNING */
|
||||
|
||||
void add_icon_override(const StringName& p_name, const Ref<Texture>& p_icon);
|
||||
void add_shader_override(const StringName& p_name, const Ref<Shader>& p_shader);
|
||||
void add_style_override(const StringName& p_name, const Ref<StyleBox>& p_style);
|
||||
void add_font_override(const StringName& p_name, const Ref<Font>& p_font);
|
||||
void add_color_override(const StringName& p_name, const Color& p_color);
|
||||
void add_constant_override(const StringName& p_name, int p_constant);
|
||||
|
||||
Ref<Texture> get_icon(const StringName& p_name,const StringName& p_type=StringName()) const;
|
||||
Ref<Shader> get_shader(const StringName &p_name, const StringName &p_type=StringName()) const;
|
||||
Ref<StyleBox> get_stylebox(const StringName& p_name,const StringName& p_type=StringName()) const;
|
||||
Ref<Font> get_font(const StringName& p_name,const StringName& p_type=StringName()) const;
|
||||
Color get_color(const StringName& p_name,const StringName& p_type=StringName()) const;
|
||||
int get_constant(const StringName& p_name,const StringName& p_type=StringName()) const;
|
||||
|
||||
bool has_icon(const StringName& p_name,const StringName& p_type=StringName()) const;
|
||||
bool has_shader(const StringName& p_name,const StringName& p_type=StringName()) const;
|
||||
bool has_stylebox(const StringName& p_name,const StringName& p_type=StringName()) const;
|
||||
bool has_font(const StringName& p_name,const StringName& p_type=StringName()) const;
|
||||
bool has_color(const StringName& p_name,const StringName& p_type=StringName()) const;
|
||||
@@ -358,7 +362,7 @@ public:
|
||||
|
||||
Control();
|
||||
~Control();
|
||||
|
||||
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(Control::AnchorType);
|
||||
|
||||
@@ -80,6 +80,13 @@ static Ref<Texture> make_icon(T p_src) {
|
||||
return texture;
|
||||
}
|
||||
|
||||
static Ref<Shader> make_shader(const char*vertex_code,const char*fragment_code,const char*lighting_code) {
|
||||
Ref<Shader> shader = (memnew( Shader(Shader::MODE_CANVAS_ITEM) ));
|
||||
shader->set_code(vertex_code, fragment_code, lighting_code);
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
static Ref<Font> make_font(int p_height,int p_ascent, int p_valign, int p_charcount, const int *p_chars,const Ref<Texture> &p_texture) {
|
||||
|
||||
|
||||
@@ -767,7 +774,11 @@ void make_default_theme() {
|
||||
t->set_constant("label_width","ColorPicker", 20);
|
||||
t->set_constant("hseparator","ColorPicker", 4);
|
||||
|
||||
|
||||
t->set_icon("screen_picker","ColorPicker", make_icon( icon_color_pick_png ) );
|
||||
t->set_icon("add_preset","ColorPicker", make_icon( icon_add_png ) );
|
||||
|
||||
t->set_shader("uv_editor", "ColorPicker", make_shader("", uv_editor_shader_code, ""));
|
||||
t->set_shader("w_editor", "ColorPicker", make_shader("", w_editor_shader_code, ""));
|
||||
|
||||
// TooltipPanel
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 351 B |
Binary file not shown.
|
After Width: | Height: | Size: 646 B |
+44
-13
@@ -3,9 +3,6 @@ import os;
|
||||
import glob;
|
||||
import string;
|
||||
|
||||
pixmaps = glob.glob("*.png");
|
||||
|
||||
pixmaps.sort();
|
||||
|
||||
#Generate include files
|
||||
|
||||
@@ -15,27 +12,61 @@ f.write("// THIS FILE HAS BEEN AUTOGENERATED, DONT EDIT!!\n");
|
||||
|
||||
f.write("\n\n");
|
||||
|
||||
f.write("\n\n\n");
|
||||
|
||||
#Generate png image block
|
||||
|
||||
pixmaps = glob.glob("*.png");
|
||||
|
||||
pixmaps.sort();
|
||||
|
||||
f.write("\n\n\n");
|
||||
|
||||
|
||||
for x in pixmaps:
|
||||
|
||||
|
||||
var_str=x[:-4]+"_png";
|
||||
|
||||
|
||||
f.write("static const unsigned char "+ var_str +"[]={\n");
|
||||
|
||||
|
||||
pngf=open(x,"rb");
|
||||
|
||||
|
||||
b=pngf.read(1);
|
||||
while(len(b)==1):
|
||||
f.write(hex(ord(b)))
|
||||
b=pngf.read(1);
|
||||
if (len(b)==1):
|
||||
f.write(",")
|
||||
|
||||
|
||||
f.write("\n};\n\n\n");
|
||||
pngf.close();
|
||||
|
||||
f.close();
|
||||
|
||||
#Generate shaders block
|
||||
|
||||
shaders = glob.glob("*.gsl")
|
||||
|
||||
shaders.sort();
|
||||
|
||||
f.write("\n\n\n");
|
||||
|
||||
for x in shaders:
|
||||
|
||||
var_str=x[:-4]+"_shader_code";
|
||||
|
||||
f.write("static const char *"+ var_str +"=\n");
|
||||
|
||||
sf=open(x,"rb");
|
||||
|
||||
|
||||
b=sf.readline();
|
||||
while(b!=""):
|
||||
if (b.endswith("\r\n")):
|
||||
b=b[:-2]
|
||||
if (b.endswith("\n")):
|
||||
b=b[:-1]
|
||||
f.write(" \""+b)
|
||||
b=sf.readline();
|
||||
if (b!=""):
|
||||
f.write("\"\n")
|
||||
|
||||
f.write("\";\n\n\n");
|
||||
sf.close();
|
||||
|
||||
f.close();
|
||||
@@ -179,11 +179,21 @@ static const unsigned char hsplitter_png[]={
|
||||
};
|
||||
|
||||
|
||||
static const unsigned char icon_add_png[]={
|
||||
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x12,0x0,0x0,0xb,0x12,0x1,0xd2,0xdd,0x7e,0xfc,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,0xec,0x49,0x44,0x41,0x54,0x38,0x8d,0xdd,0x92,0x41,0x4a,0xc4,0x30,0x18,0x85,0xbf,0x67,0x93,0xc,0xd9,0x28,0xb9,0x41,0xcf,0x21,0x7a,0x28,0xdd,0xcd,0x5,0x14,0x57,0x73,0x28,0xe7,0x20,0xbd,0x41,0x70,0x5c,0x14,0x93,0xe,0xbf,0xb,0xdb,0x61,0x5a,0x5a,0x70,0xab,0xf,0x2,0x21,0xfc,0xf9,0xf2,0xde,0x23,0xf0,0xe7,0xa5,0xb5,0xc3,0x9c,0xf3,0xae,0x94,0xf2,0xda,0xf7,0xfd,0x13,0x40,0x8c,0xf1,0x10,0x42,0xd8,0xa7,0x94,0xbe,0x96,0xb3,0x6e,0x3,0x6c,0x92,0x4e,0x40,0x1,0x90,0xf4,0x1,0xd8,0xda,0xe0,0xc,0x90,0x73,0xde,0x1,0x66,0x66,0xc1,0xcc,0x9a,0xb,0xcd,0xcc,0x99,0x59,0xc8,0x39,0x3,0xe8,0xda,0xc9,0xc,0x50,0x4a,0x79,0x91,0xf4,0x69,0x66,0xcd,0x30,0xc,0xf,0x40,0x3,0x30,0xee,0x91,0x74,0x36,0xb3,0x5b,0xe0,0x79,0xb5,0x83,0xae,0xeb,0x6c,0xb2,0x3d,0x5e,0x9e,0x5c,0x9c,0xc7,0x5,0x10,0xda,0xb6,0xbd,0xdc,0xbb,0xd9,0xe8,0xe0,0xd7,0x9a,0x45,0x88,0x31,0x1e,0x24,0x9d,0xa6,0x8,0xb5,0xd6,0x47,0x0,0xef,0xfd,0xbb,0x73,0xee,0x78,0x15,0x61,0x1d,0x10,0x42,0xd8,0x33,0x96,0x8,0x50,0x6b,0xbd,0x7,0x70,0xce,0x1d,0xbd,0xf7,0x6f,0x92,0xa,0x8b,0xd8,0x33,0xc0,0xd4,0x6e,0xce,0x19,0x49,0x53,0x66,0x24,0xd,0x92,0x4a,0x4a,0xa9,0xb0,0xd0,0xd6,0x3f,0xd0,0x68,0x35,0xf0,0x63,0xe9,0x6e,0xf9,0xf2,0x3f,0xd2,0x37,0xb9,0xed,0x67,0x29,0x9e,0xb,0x7f,0x1a,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
||||
};
|
||||
|
||||
|
||||
static const unsigned char icon_close_png[]={
|
||||
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x1,0x73,0x52,0x47,0x42,0x0,0xae,0xce,0x1c,0xe9,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,0xd9,0xb,0x17,0x6,0x11,0xd,0x6a,0x1e,0x9a,0x6f,0x0,0x0,0x0,0x5e,0x49,0x44,0x41,0x54,0x38,0xcb,0xd5,0x53,0xcb,0xe,0xc0,0x30,0x8,0x12,0xb2,0xff,0xff,0x65,0x77,0x5a,0xb3,0x36,0xf8,0x48,0xcc,0xe,0xf3,0xd4,0x3,0xa2,0x40,0x85,0x9b,0xdb,0xa4,0x68,0xc3,0x1a,0x13,0x5c,0xcf,0x3,0x86,0xa5,0xc5,0xcd,0xa1,0xc0,0xa,0x43,0xd5,0xf4,0x6,0x56,0x3,0x36,0x9,0x11,0x49,0xb6,0x1d,0x54,0xa,0x6a,0x83,0x48,0x1a,0xbb,0xc0,0xc8,0x97,0x6f,0x62,0xac,0x4c,0x4c,0x9,0x4e,0xc3,0xaa,0x74,0xd8,0x89,0x2a,0x23,0x61,0xf7,0x23,0x85,0x11,0xff,0xff,0x98,0x6e,0x7,0x20,0x33,0x1a,0x5b,0xf5,0xcc,0xfe,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
||||
};
|
||||
|
||||
|
||||
static const unsigned char icon_color_pick_png[]={
|
||||
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x1,0x73,0x52,0x47,0x42,0x0,0xae,0xce,0x1c,0xe9,0x0,0x0,0x0,0x4,0x67,0x41,0x4d,0x41,0x0,0x0,0xb1,0x8f,0xb,0xfc,0x61,0x5,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x11,0x0,0x0,0x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8a,0xeb,0x5e,0xb8,0x49,0x36,0xd7,0xe9,0x30,0x1b,0x1a,0x89,0xb4,0x6e,0x27,0xf7,0xea,0xf7,0x4a,0x30,0xb1,0x52,0x46,0xd8,0x2b,0xe3,0x41,0xf6,0xcb,0x66,0x79,0x33,0x1b,0xc2,0x92,0xa7,0x1e,0xe6,0x4,0x57,0xbd,0x75,0xb8,0xd9,0x5f,0x5a,0xeb,0x1d,0x65,0x43,0x23,0x2c,0xb5,0xab,0xc,0x4,0x23,0x9e,0xe0,0xb6,0x57,0xd1,0x2b,0x35,0xf9,0xdb,0x4e,0xb2,0xa1,0x11,0x16,0xf,0x61,0x3a,0x57,0x55,0xaf,0x61,0x44,0x43,0x8a,0x1c,0xb6,0x3f,0xef,0x2e,0x14,0xda,0xc9,0x98,0xf9,0xb4,0xaf,0x76,0x19,0xc7,0xf9,0xb,0x8e,0xb3,0xf3,0x95,0xda,0x15,0xd3,0x79,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
||||
};
|
||||
|
||||
|
||||
static const unsigned char icon_folder_png[]={
|
||||
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,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,0x9,0xf,0x14,0x33,0x39,0x1,0xd2,0x43,0x4c,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,0x36,0x49,0x44,0x41,0x54,0x38,0x8d,0xc5,0x92,0xcd,0x4a,0xc3,0x40,0x14,0x85,0xbf,0x7b,0x67,0x12,0x48,0x3,0x12,0x62,0x45,0xfa,0x30,0x7d,0x5,0x5d,0xfa,0x8,0xbe,0x88,0x3e,0x45,0x5f,0xc1,0x9d,0x4b,0x77,0x3e,0x81,0x2e,0xa4,0x15,0xa5,0x10,0xb2,0xc8,0xa2,0x9b,0x41,0x2c,0x62,0x4c,0x66,0x5c,0x34,0x8a,0x3f,0x95,0x26,0x2b,0xf,0xc,0xcc,0x9d,0x3b,0xe7,0xce,0x39,0x87,0x81,0xff,0x86,0x14,0x45,0x11,0xb6,0x35,0xe2,0x38,0xbe,0x9c,0x4c,0x26,0x47,0xce,0xb9,0x78,0x4b,0x3b,0x64,0x59,0xf6,0x6,0x20,0x65,0x59,0x56,0xde,0xfb,0x43,0x40,0x80,0x0,0x34,0xdd,0xa5,0x28,0x49,0x92,0x73,0x11,0x79,0xf9,0x49,0x16,0x91,0xd5,0x78,0x3c,0x9e,0x1,0x58,0x63,0x4c,0xe9,0xbd,0x3f,0x0,0xc,0x20,0xa3,0xd1,0xe8,0x2c,0x84,0x10,0x1,0x88,0xc8,0x6b,0x37,0xf8,0x9b,0xea,0x10,0xc2,0xa7,0x2a,0xa9,0xaa,0xea,0xa2,0xae,0xeb,0x63,0x40,0xd3,0x34,0x3d,0x5d,0xaf,0xd7,0xb3,0xde,0xfe,0x45,0x9e,0xd4,0x18,0x53,0x0,0x1e,0xd0,0x10,0x42,0xda,0x97,0xc,0x78,0x55,0xad,0x54,0x44,0x96,0x80,0xfd,0xf0,0x37,0x64,0x80,0x31,0x66,0xa1,0xaa,0xfa,0x8,0x68,0x77,0xb8,0x7,0xd4,0x83,0x6,0x88,0xc8,0x3,0x80,0x31,0x66,0xde,0x34,0xcd,0x94,0x4d,0x98,0x7d,0x10,0xab,0xea,0xad,0xe6,0x79,0xbe,0x4,0x88,0xa2,0xe8,0xba,0xae,0xeb,0xe9,0x17,0x35,0x3b,0xa1,0xaa,0x37,0xf6,0x4b,0x71,0x7,0x24,0x7d,0xc9,0x0,0x79,0x9e,0xcf,0x2d,0x80,0x88,0x3c,0xf,0x79,0x99,0x4d,0xd8,0x1e,0xba,0xf4,0x55,0x75,0xd5,0xed,0xdb,0x6e,0xed,0x42,0x63,0xad,0xbd,0x7,0xb0,0xce,0x39,0x6d,0xdb,0xf6,0x44,0x55,0x17,0x49,0x92,0xec,0xff,0xf1,0xfb,0x7e,0x29,0x50,0xd5,0x2b,0xe7,0x9c,0x8,0x80,0x73,0xce,0x74,0x92,0xa2,0x1,0x36,0xda,0x2c,0xcb,0xda,0x77,0xe3,0x5,0x64,0xf1,0xba,0x53,0xe9,0x44,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
||||
};
|
||||
@@ -519,3 +529,42 @@ static const unsigned char vsplitter_png[]={
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static const char *uv_editor_shader_code=
|
||||
"vec3 nd1sl2=vec3(UV,0);"
|
||||
"uniform float H=0;"
|
||||
"float nd4sl0=H;"
|
||||
"float nd7sl0=nd1sl2.x;"
|
||||
"float nd7sl1=nd1sl2.y;"
|
||||
"float nd7sl2=nd1sl2.z;"
|
||||
"float nd2sl1def=-1;"
|
||||
"float nd2sl0=nd7sl1*nd2sl1def;"
|
||||
"float nd6sl1def=1;"
|
||||
"float nd6sl0=nd2sl0+nd6sl1def;"
|
||||
"vec3 nd3sl0=vec3(nd4sl0,nd7sl0,nd6sl0);"
|
||||
"vec3 nd5sl0;"
|
||||
"{"
|
||||
" vec3 c = nd3sl0;"
|
||||
" vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);"
|
||||
" vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);"
|
||||
" nd5sl0=c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);"
|
||||
"}"
|
||||
"COLOR.rgb=nd5sl0;";
|
||||
|
||||
|
||||
static const char *w_editor_shader_code=
|
||||
"vec3 nd1sl2=vec3(UV,0);"
|
||||
"float nd2sl1=1-nd1sl2.y;"
|
||||
"vec3 nd3sl0=vec3(nd2sl1,1,1);"
|
||||
"vec3 nd6sl0;"
|
||||
"{"
|
||||
" vec3 c = nd3sl0;"
|
||||
" vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);"
|
||||
" vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);"
|
||||
" nd6sl0=c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);"
|
||||
"}"
|
||||
"COLOR.rgb=nd6sl0;";
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
vec3 nd1sl2=vec3(UV,0);
|
||||
uniform float H=0;
|
||||
float nd4sl0=H;
|
||||
float nd7sl0=nd1sl2.x;
|
||||
float nd7sl1=nd1sl2.y;
|
||||
float nd7sl2=nd1sl2.z;
|
||||
float nd2sl1def=-1;
|
||||
float nd2sl0=nd7sl1*nd2sl1def;
|
||||
float nd6sl1def=1;
|
||||
float nd6sl0=nd2sl0+nd6sl1def;
|
||||
vec3 nd3sl0=vec3(nd4sl0,nd7sl0,nd6sl0);
|
||||
vec3 nd5sl0;
|
||||
{
|
||||
vec3 c = nd3sl0;
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
nd5sl0=c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
COLOR.rgb=nd5sl0;
|
||||
@@ -0,0 +1,11 @@
|
||||
vec3 nd1sl2=vec3(UV,0);
|
||||
float nd2sl1=1-nd1sl2.y;
|
||||
vec3 nd3sl0=vec3(nd2sl1,1,1);
|
||||
vec3 nd6sl0;
|
||||
{
|
||||
vec3 c = nd3sl0;
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
nd6sl0=c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
COLOR.rgb=nd6sl0;
|
||||
@@ -266,7 +266,52 @@ void Theme::get_icon_list(StringName p_type, List<StringName> *p_list) const {
|
||||
|
||||
p_list->push_back(*key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Theme::set_shader(const StringName &p_name,const StringName &p_type,const Ref<Shader>& p_shader) {
|
||||
bool new_value=!shader_map.has(p_type) || !shader_map[p_type].has(p_name);
|
||||
|
||||
shader_map[p_type][p_name]=p_shader;
|
||||
|
||||
if (new_value) {
|
||||
_change_notify();
|
||||
emit_changed();;
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Shader> Theme::get_shader(const StringName &p_name, const StringName &p_type) const {
|
||||
if (shader_map.has(p_type) && shader_map[p_type].has(p_name) && shader_map[p_type][p_name].is_valid()) {
|
||||
return shader_map[p_type][p_name];
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool Theme::has_shader(const StringName &p_name, const StringName &p_type) const {
|
||||
return (shader_map.has(p_type) && shader_map[p_type].has(p_name) && shader_map[p_type][p_name].is_valid());
|
||||
}
|
||||
|
||||
void Theme::clear_shader(const StringName &p_name, const StringName &p_type) {
|
||||
ERR_FAIL_COND(!shader_map.has(p_type));
|
||||
ERR_FAIL_COND(!shader_map[p_type].has(p_name));
|
||||
|
||||
shader_map[p_type].erase(p_name);
|
||||
_change_notify();
|
||||
emit_changed();;
|
||||
}
|
||||
|
||||
void Theme::get_shader_list(const StringName &p_type, List<StringName> *p_list) const {
|
||||
if (!shader_map.has(p_type))
|
||||
return;
|
||||
|
||||
const StringName *key=NULL;
|
||||
|
||||
while((key=shader_map[p_type].next(key))) {
|
||||
|
||||
p_list->push_back(*key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "scene/resources/font.h"
|
||||
#include "scene/resources/style_box.h"
|
||||
#include "scene/resources/texture.h"
|
||||
#include "scene/resources/shader.h"
|
||||
#include "io/resource_loader.h"
|
||||
|
||||
/**
|
||||
@@ -48,6 +49,7 @@ class Theme : public Resource {
|
||||
HashMap<StringName,HashMap<StringName,Ref<Texture>,StringNameHasher >, StringNameHasher > icon_map;
|
||||
HashMap<StringName,HashMap<StringName,Ref<StyleBox>,StringNameHasher >,StringNameHasher > style_map;
|
||||
HashMap<StringName,HashMap<StringName,Ref<Font>,StringNameHasher >,StringNameHasher > font_map;
|
||||
HashMap<StringName,HashMap<StringName,Ref<Shader>,StringNameHasher >, StringNameHasher > shader_map;
|
||||
HashMap<StringName,HashMap<StringName,Color,StringNameHasher >,StringNameHasher > color_map;
|
||||
HashMap<StringName,HashMap<StringName,int,StringNameHasher>,StringNameHasher > constant_map;
|
||||
protected:
|
||||
@@ -86,7 +88,13 @@ public:
|
||||
bool has_icon(const StringName& p_name,const StringName& p_type) const;
|
||||
void clear_icon(const StringName& p_name,const StringName& p_type);
|
||||
void get_icon_list(StringName p_type, List<StringName> *p_list) const;
|
||||
|
||||
|
||||
void set_shader(const StringName& p_name,const StringName& p_type,const Ref<Shader>& p_shader);
|
||||
Ref<Shader> get_shader(const StringName& p_name,const StringName& p_type) const;
|
||||
bool has_shader(const StringName& p_name,const StringName& p_type) const;
|
||||
void clear_shader(const StringName& p_name,const StringName& p_type);
|
||||
void get_shader_list(const StringName& p_name, List<StringName> *p_list) const;
|
||||
|
||||
void set_stylebox(const StringName& p_name,const StringName& p_type,const Ref<StyleBox>& p_style);
|
||||
Ref<StyleBox> get_stylebox(const StringName& p_name,const StringName& p_type) const;
|
||||
bool has_stylebox(const StringName& p_name,const StringName& p_type) const;
|
||||
|
||||
@@ -595,7 +595,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
|
||||
color_picker->show();
|
||||
color_picker->set_edit_alpha(hint!=PROPERTY_HINT_COLOR_NO_ALPHA);
|
||||
color_picker->set_color(v);
|
||||
set_size( Size2(350, color_picker->get_combined_minimum_size().height+10));
|
||||
set_size( Size2(300, color_picker->get_combined_minimum_size().height+10));
|
||||
/*
|
||||
int ofs=80;
|
||||
int m=10;
|
||||
|
||||
Reference in New Issue
Block a user