Merge pull request #2274 from MarianoGnu/master

Improve Visual Shader Editor responsiveness
This commit is contained in:
Juan Linietsky
2015-10-17 15:31:23 -03:00
17 changed files with 2429 additions and 1490 deletions
+32 -32
View File
@@ -49,7 +49,7 @@
enum PropertyHint {
PROPERTY_HINT_NONE, ///< no hint provided.
PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step"
PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step,slider; //slider is optional"
PROPERTY_HINT_EXP_RANGE, ///< hint_text = "min,max,step", exponential edit
PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
PROPERTY_HINT_EXP_EASING, /// exponential easing funciton (Math::ease)
@@ -58,12 +58,12 @@ enum PropertyHint {
PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
PROPERTY_HINT_ALL_FLAGS,
PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
PROPERTY_HINT_DIR, ///< a directort path must be passed
PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
PROPERTY_HINT_GLOBAL_DIR, ///< a directort path must be passed
PROPERTY_HINT_RESOURCE_TYPE, ///< a resource object type
PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines
PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines
PROPERTY_HINT_COLOR_NO_ALPHA, ///< used for ignoring alpha component when editing a color
PROPERTY_HINT_IMAGE_COMPRESS_LOSSY,
PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS,
@@ -71,7 +71,7 @@ enum PropertyHint {
};
enum PropertyUsageFlags {
PROPERTY_USAGE_STORAGE=1,
PROPERTY_USAGE_EDITOR=2,
PROPERTY_USAGE_NETWORK=4,
@@ -102,15 +102,15 @@ enum PropertyUsageFlags {
#define ADD_PROPERTYINO( m_property, m_setter, m_getter, m_index ) ObjectTypeDB::add_property( get_type_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONONE), m_setter, m_getter, m_index )
struct PropertyInfo {
Variant::Type type;
Variant::Type type;
String name;
PropertyHint hint;
String hint_string;
String hint_string;
uint32_t usage;
_FORCE_INLINE_ PropertyInfo added_usage(int p_fl) const { PropertyInfo pi=*this; pi.usage|=p_fl; return pi; }
PropertyInfo() { type=Variant::NIL; hint=PROPERTY_HINT_NONE; usage = PROPERTY_USAGE_DEFAULT; }
PropertyInfo( Variant::Type p_type, const String p_name, PropertyHint p_hint=PROPERTY_HINT_NONE, const String& p_hint_string="",uint32_t p_usage=PROPERTY_USAGE_DEFAULT) {
type=p_type; name=p_name; hint=p_hint; hint_string=p_hint_string; usage=p_usage;
@@ -125,23 +125,23 @@ struct PropertyInfo {
Array convert_property_list(const List<PropertyInfo> * p_list);
struct MethodInfo {
String name;
List<PropertyInfo> arguments;
Vector<Variant> default_arguments;
PropertyInfo return_val;
uint32_t flags;
int id;
inline bool operator<(const MethodInfo& p_method) const { return id==p_method.id?(name < p_method.name):(id<p_method.id); }
MethodInfo();
MethodInfo(const String& p_name);
MethodInfo(const String& p_name, const PropertyInfo& p_param1);
MethodInfo(const String& p_name, const PropertyInfo& p_param1,const PropertyInfo& p_param2);
MethodInfo(const String& p_name, const PropertyInfo& p_param1,const PropertyInfo& p_param2,const PropertyInfo& p_param3);
MethodInfo(const String& p_name, const PropertyInfo& p_param1,const PropertyInfo& p_param2,const PropertyInfo& p_param3,const PropertyInfo& p_param4);
MethodInfo(const String& p_name, const PropertyInfo& p_param1,const PropertyInfo& p_param2,const PropertyInfo& p_param3,const PropertyInfo& p_param4,const PropertyInfo& p_param5);
MethodInfo(const String& p_name, const PropertyInfo& p_param1,const PropertyInfo& p_param2,const PropertyInfo& p_param3,const PropertyInfo& p_param4,const PropertyInfo& p_param5);
MethodInfo(Variant::Type ret);
MethodInfo(Variant::Type ret,const String& p_name);
MethodInfo(Variant::Type ret,const String& p_name, const PropertyInfo& p_param1);
@@ -158,7 +158,7 @@ struct MethodInfo {
//return NULL;
/*
the following is an uncomprehensible blob of hacks and workarounds to compensate for many of the fallencies in C++. As a plus, this macro pretty much alone defines the object model.
the following is an uncomprehensible blob of hacks and workarounds to compensate for many of the fallencies in C++. As a plus, this macro pretty much alone defines the object model.
*/
#define REVERSE_GET_PROPERTY_LIST \
@@ -314,7 +314,7 @@ private:
class ScriptInstance;
typedef uint32_t ObjectID;
class Object {
class Object {
public:
enum ConnectFlags {
@@ -404,7 +404,7 @@ friend void postinitialize_handler(Object*);
void property_list_changed_notify();
protected:
protected:
virtual bool _use_builtin_script() const { return false; }
virtual void _initialize_typev() { initialize_type(); }
@@ -412,14 +412,14 @@ protected:
virtual bool _getv(const StringName& p_name,Variant &r_property) const { return false; };
virtual void _get_property_listv(List<PropertyInfo> *p_list,bool p_reversed) const {};
virtual void _notificationv(int p_notification,bool p_reversed) {};
static String _get_category() { return ""; }
static void _bind_methods();
bool _set(const StringName& p_name,const Variant &p_property) { return false; };
bool _get(const StringName& p_name,Variant &r_property) const { return false; };
void _get_property_list(List<PropertyInfo> *p_list) const {};
void _notification(int p_notification) {};
_FORCE_INLINE_ static void (*_get_bind_methods())() {
return &Object::_bind_methods;
}
@@ -431,13 +431,13 @@ protected:
}
_FORCE_INLINE_ void (Object::* (_get_get_property_list() const))(List<PropertyInfo> *p_list) const{
return &Object::_get_property_list;
}
}
_FORCE_INLINE_ void (Object::* (_get_notification() const))(int){
return &Object::_notification;
}
}
static void get_valid_parents_static(List<String> *p_parents);
static void _get_valid_parents_static(List<String> *p_parents);
void cancel_delete();
@@ -485,7 +485,7 @@ public:
void add_change_receptor( Object *p_receptor );
void remove_change_receptor( Object *p_receptor );
template<class T>
T *cast_to() {
@@ -500,7 +500,7 @@ public:
return NULL;
#endif
}
template<class T>
const T *cast_to() const {
@@ -517,11 +517,11 @@ public:
}
enum {
NOTIFICATION_POSTINITIALIZE=0,
NOTIFICATION_PREDELETE=1
};
/* TYPE API */
static void get_inheritance_list_static(List<String>* p_inheritance_list) { p_inheritance_list->push_back("Object"); }
@@ -545,7 +545,7 @@ public:
return *_type_ptr;
}
}
/* IAPI */
// void set(const String& p_name, const Variant& p_value);
// Variant get(const String& p_name) const;
@@ -554,7 +554,7 @@ public:
Variant get(const StringName& p_name, bool *r_valid=NULL) const;
void get_property_list(List<PropertyInfo> *p_list,bool p_reversed=false) const;
bool has_method(const StringName& p_method) const;
void get_method_list(List<MethodInfo> *p_list) const;
Variant callv(const StringName& p_method,const Array& p_args);
@@ -564,14 +564,14 @@ public:
Variant call(const StringName& p_name, VARIANT_ARG_LIST); // C++ helper
void call_multilevel(const StringName& p_name, VARIANT_ARG_LIST); // C++ helper
void notification(int p_notification,bool p_reversed=false);
void notification(int p_notification,bool p_reversed=false);
//used mainly by script, get and set all INCLUDING string
virtual Variant getvar(const Variant& p_key, bool *r_valid=NULL) const;
virtual void setvar(const Variant& p_key, const Variant& p_value,bool *r_valid=NULL);
/* SCRIPT */
void set_script(const RefPtr& p_script);
RefPtr get_script() const;
@@ -614,14 +614,14 @@ public:
StringName tr(const StringName& p_message) const; //translate message (alternative)
bool _is_queued_for_deletion; // set to true by SceneTree::queue_delete()
bool is_queued_for_deletion() const;
bool is_queued_for_deletion() const;
_FORCE_INLINE_ void set_message_translation(bool p_enable) { _can_translate=p_enable; }
_FORCE_INLINE_ bool can_translate_messages() const { return _can_translate; }
void clear_internal_resource_paths();
Object();
Object();
virtual ~Object();
};
@@ -649,13 +649,13 @@ class ObjectDB {
static HashMap<Object*,ObjectID,ObjectPtrHash> instance_checks;
static uint32_t instance_counter;
friend class Object;
friend class Object;
friend void unregister_core_types();
static void cleanup();
static uint32_t add_instance(Object *p_object);
static void remove_instance(Object *p_object);
public:
public:
typedef void (*DebugFunc)(Object *p_obj);
+193 -6
View File
@@ -141,9 +141,6 @@ void GraphEdit::_graph_node_moved(Node *p_gn) {
GraphNode *gn=p_gn->cast_to<GraphNode>();
ERR_FAIL_COND(!gn);
//gn->set_pos(gn->get_offset()+scroll_offset);
top_layer->update();
}
@@ -172,7 +169,6 @@ void GraphEdit::remove_child_notify(Node *p_child) {
void GraphEdit::_notification(int p_what) {
if (p_what==NOTIFICATION_READY) {
Size2 size = top_layer->get_size();
Size2 hmin = h_scroll->get_combined_minimum_size();
Size2 vmin = v_scroll->get_combined_minimum_size();
@@ -491,7 +487,8 @@ void GraphEdit::_top_layer_draw() {
connections.erase(to_erase.front()->get());
to_erase.pop_front();
}
//draw connections
if (box_selecting)
top_layer->draw_rect(box_selecting_rect,Color(0.7,0.7,1.0,0.3));
}
void GraphEdit::_input_event(const InputEvent& p_ev) {
@@ -500,6 +497,187 @@ void GraphEdit::_input_event(const InputEvent& p_ev) {
h_scroll->set_val( h_scroll->get_val() - p_ev.mouse_motion.relative_x );
v_scroll->set_val( v_scroll->get_val() - p_ev.mouse_motion.relative_y );
}
if (p_ev.type==InputEvent::MOUSE_MOTION && dragging) {
just_selected=true;
drag_accum+=Vector2(p_ev.mouse_motion.relative_x,p_ev.mouse_motion.relative_y);
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (gn && gn->is_selected())
gn->set_offset(gn->get_drag_from()+drag_accum);
}
}
if (p_ev.type==InputEvent::MOUSE_MOTION && box_selecting) {
box_selecting_to = get_local_mouse_pos();
box_selecting_rect = Rect2(MIN(box_selecting_from.x,box_selecting_to.x),
MIN(box_selecting_from.y,box_selecting_to.y),
ABS(box_selecting_from.x-box_selecting_to.x),
ABS(box_selecting_from.y-box_selecting_to.y));
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (!gn)
continue;
bool in_box = gn->get_rect().intersects(box_selecting_rect);
if (in_box)
gn->set_selected(box_selection_mode_aditive);
else
gn->set_selected(previus_selected.find(gn)!=NULL);
}
top_layer->update();
}
if (p_ev.type==InputEvent::MOUSE_BUTTON) {
const InputEventMouseButton &b=p_ev.mouse_button;
if (b.button_index==BUTTON_RIGHT && b.pressed)
{
if (box_selecting) {
box_selecting = false;
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (!gn)
continue;
gn->set_selected(previus_selected.find(gn)!=NULL);
}
top_layer->update();
} else {
emit_signal("popup_request", Vector2(b.global_x, b.global_y));
}
}
if (b.button_index==BUTTON_LEFT && !b.pressed && dragging) {
if (!just_selected && drag_accum==Vector2() && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
//deselect current node
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (gn && gn->get_rect().has_point(get_local_mouse_pos()))
gn->set_selected(false);
}
}
if (drag_accum!=Vector2()) {
emit_signal("_begin_node_move");
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (gn && gn->is_selected())
gn->set_drag(false);
}
emit_signal("_end_node_move");
}
dragging = false;
top_layer->update();
}
if (b.button_index==BUTTON_LEFT && b.pressed) {
GraphNode *gn;
for(int i=get_child_count()-1;i>=0;i--) {
gn=get_child(i)->cast_to<GraphNode>();
if (gn && gn->get_rect().has_point(get_local_mouse_pos()))
break;
}
if (gn) {
if (_filter_input(Vector2(b.x,b.y)))
return;
dragging = true;
drag_accum = Vector2();
just_selected = !gn->is_selected();
if(!gn->is_selected() && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
for (int i = 0; i < get_child_count(); i++) {
GraphNode *o_gn = get_child(i)->cast_to<GraphNode>();
if (o_gn)
o_gn->set_selected(o_gn == gn);
}
}
gn->set_selected(true);
for (int i = 0; i < get_child_count(); i++) {
GraphNode *o_gn = get_child(i)->cast_to<GraphNode>();
if (!o_gn)
continue;
if (o_gn->is_selected())
o_gn->set_drag(true);
}
} else {
box_selecting = true;
box_selecting_from = get_local_mouse_pos();
if (b.mod.control) {
box_selection_mode_aditive = true;
previus_selected.clear();
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (!gn || !gn->is_selected())
continue;
previus_selected.push_back(gn);
}
} else if (b.mod.shift) {
box_selection_mode_aditive = false;
previus_selected.clear();
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (!gn || !gn->is_selected())
continue;
previus_selected.push_back(gn);
}
} else {
box_selection_mode_aditive = true;
previus_selected.clear();
for(int i=get_child_count()-1;i>=0;i--) {
GraphNode *gn=get_child(i)->cast_to<GraphNode>();
if (!gn)
continue;
gn->set_selected(false);
}
}
}
}
if (b.button_index==BUTTON_LEFT && !b.pressed && box_selecting) {
box_selecting = false;
previus_selected.clear();
top_layer->update();
}
}
if (p_ev.type==InputEvent::KEY && p_ev.key.scancode==KEY_D && p_ev.key.pressed && p_ev.key.mod.command) {
emit_signal("duplicate_nodes_request");
accept_event();
}
if (p_ev.type==InputEvent::KEY && p_ev.key.scancode==KEY_DELETE && p_ev.key.pressed) {
emit_signal("delete_nodes_request");
accept_event();
}
}
void GraphEdit::clear_connections() {
@@ -555,12 +733,18 @@ void GraphEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("connection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot")));
ADD_SIGNAL(MethodInfo("disconnection_request",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::STRING,"to"),PropertyInfo(Variant::INT,"to_slot")));
ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2,"p_position")));
ADD_SIGNAL(MethodInfo("duplicate_nodes_request"));
ADD_SIGNAL(MethodInfo("delete_nodes_request"));
ADD_SIGNAL(MethodInfo("_begin_node_move"));
ADD_SIGNAL(MethodInfo("_end_node_move"));
}
GraphEdit::GraphEdit() {
set_focus_mode(FOCUS_ALL);
top_layer=NULL;
top_layer=memnew(GraphEditFilter(this));
add_child(top_layer);
@@ -581,6 +765,9 @@ GraphEdit::GraphEdit() {
connecting=false;
right_disconnects=false;
box_selecting = false;
dragging = false;
h_scroll->connect("value_changed", this,"_scroll_moved");
v_scroll->connect("value_changed", this,"_scroll_moved");
}
+11 -2
View File
@@ -10,7 +10,7 @@ class GraphEditFilter : public Control {
OBJ_TYPE(GraphEditFilter,Control);
friend class GraphEdit;
friend class GraphEdit;
GraphEdit *ge;
virtual bool has_point(const Point2& p_point) const;
@@ -49,7 +49,16 @@ private:
String connecting_target_to;
int connecting_target_index;
bool dragging;
bool just_selected;
Vector2 drag_accum;
bool box_selecting;
bool box_selection_mode_aditive;
Point2 box_selecting_from;
Point2 box_selecting_to;
Rect2 box_selecting_rect;
List<GraphNode*> previus_selected;
bool right_disconnects;
bool updating;
@@ -71,7 +80,7 @@ private:
Array _get_connection_list() const;
friend class GraphEditFilter;
friend class GraphEditFilter;
bool _filter_input(const Point2& p_point);
protected:
+34 -28
View File
@@ -40,7 +40,7 @@ bool GraphNode::_get(const StringName& p_name,Variant &r_ret) const{
if (!p_name.operator String().begins_with("slot/")) {
if (!p_name.operator String().begins_with("slot/")) {
return false;
}
@@ -160,7 +160,7 @@ void GraphNode::_notification(int p_what) {
if (p_what==NOTIFICATION_DRAW) {
Ref<StyleBox> sb=get_stylebox("frame");
Ref<StyleBox> sb=get_stylebox(selected ? "selectedframe" : "frame");
Ref<Texture> port =get_icon("port");
Ref<Texture> close =get_icon("close");
int close_offset = get_constant("close_offset");
@@ -360,6 +360,29 @@ Vector2 GraphNode::get_offset() const {
return offset;
}
void GraphNode::set_selected(bool p_selected)
{
selected = p_selected;
update();
}
bool GraphNode::is_selected()
{
return selected;
}
void GraphNode::set_drag(bool p_drag)
{
if (p_drag)
drag_from=get_offset();
else
emit_signal("dragged",drag_from,get_offset()); //useful for undo/redo
}
Vector2 GraphNode::get_drag_from()
{
return drag_from;
}
void GraphNode::set_show_close_button(bool p_enable){
@@ -379,7 +402,6 @@ void GraphNode::_connpos_update() {
int sep=get_constant("separation");
Ref<StyleBox> sb=get_stylebox("frame");
Ref<Texture> port =get_icon("port");
conn_input_cache.clear();
conn_output_cache.clear();
int vofs=0;
@@ -503,31 +525,17 @@ Color GraphNode::get_connection_output_color(int p_idx) {
void GraphNode::_input_event(const InputEvent& p_ev) {
if (p_ev.type==InputEvent::MOUSE_BUTTON && p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
if (p_ev.type==InputEvent::MOUSE_BUTTON) {
get_parent_control()->grab_focus();
if(p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
Vector2 mpos = Vector2(p_ev.mouse_button.x,p_ev.mouse_button.y);
if (close_rect.size!=Size2() && close_rect.has_point(mpos)) {
emit_signal("close_request");
return;
Vector2 mpos = Vector2(p_ev.mouse_button.x,p_ev.mouse_button.y);
if (close_rect.size!=Size2() && close_rect.has_point(mpos)) {
emit_signal("close_request");
return;
}
emit_signal("raise_request");
}
drag_from=get_offset();
drag_accum=Vector2();
dragging=true;
emit_signal("raise_request");
}
if (p_ev.type==InputEvent::MOUSE_BUTTON && !p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
dragging=false;
emit_signal("dragged",drag_from,get_offset()); //useful for undo/redo
}
if (p_ev.type==InputEvent::MOUSE_MOTION && dragging) {
drag_accum+=Vector2(p_ev.mouse_motion.relative_x,p_ev.mouse_motion.relative_y);
set_offset(drag_from+drag_accum);
}
}
@@ -576,8 +584,6 @@ void GraphNode::_bind_methods() {
}
GraphNode::GraphNode() {
dragging=false;
show_close=false;
connpos_dirty=true;
}
+8 -3
View File
@@ -18,7 +18,7 @@ class GraphNode : public Container {
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); };
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); }
};
String title;
@@ -46,8 +46,7 @@ class GraphNode : public Container {
void _resort();
Vector2 drag_from;
Vector2 drag_accum;
bool dragging;
bool selected;
protected:
void _input_event(const InputEvent& p_ev);
@@ -79,6 +78,12 @@ public:
void set_offset(const Vector2& p_offset);
Vector2 get_offset() const;
void set_selected(bool p_selected);
bool is_selected();
void set_drag(bool p_drag);
Vector2 get_drag_from();
void set_show_close_button(bool p_enable);
bool is_close_button_visible() const;
+171 -171
View File
File diff suppressed because it is too large Load Diff
+50 -44
View File
@@ -31,7 +31,7 @@ static TexCacheMap *tex_cache;
template<class T>
static Ref<StyleBoxTexture> make_stylebox(T p_src,float p_left, float p_top, float p_right, float p_botton,float p_margin_left=-1, float p_margin_top=-1, float p_margin_right=-1, float p_margin_botton=-1, bool p_draw_center=true) {
Ref<ImageTexture> texture;
@@ -56,17 +56,17 @@ static Ref<StyleBoxTexture> make_stylebox(T p_src,float p_left, float p_top, flo
style->set_default_margin( MARGIN_BOTTOM, p_margin_botton );
style->set_default_margin( MARGIN_TOP, p_margin_top );
style->set_draw_center(p_draw_center);
return style;
}
template<class T>
static Ref<Texture> make_icon(T p_src) {
Ref<ImageTexture> texture( memnew( ImageTexture ) );
texture->create_from_image( Image(p_src),ImageTexture::FLAG_FILTER );
return texture;
}
@@ -75,7 +75,7 @@ static Ref<Font> make_font(int p_height,int p_ascent, int p_valign, int p_charco
Ref<Font> font( memnew( Font ) );
font->add_texture( p_texture );
for (int i=0;i<p_charcount;i++) {
const int *c = &p_chars[i*8];
@@ -91,9 +91,9 @@ static Ref<Font> make_font(int p_height,int p_ascent, int p_valign, int p_charco
font->add_char( chr, 0, frect, align,advance );
}
font->set_height( p_height );
font->set_ascent( p_ascent );
@@ -152,12 +152,12 @@ static Ref<Font> make_font2(int p_height,int p_ascent, int p_charcount, const in
static Ref<StyleBox> make_empty_stylebox(float p_margin_left=-1, float p_margin_top=-1, float p_margin_right=-1, float p_margin_botton=-1) {
Ref<StyleBox> style( memnew( StyleBoxEmpty) );
style->set_default_margin( MARGIN_LEFT, p_margin_left );
style->set_default_margin( MARGIN_RIGHT, p_margin_right );
style->set_default_margin( MARGIN_BOTTOM, p_margin_botton );
style->set_default_margin( MARGIN_TOP, p_margin_top );
return style;
}
@@ -299,49 +299,49 @@ void make_default_theme() {
t->set_constant("hseparation","MenuButton", 3 );
// CheckBox
// CheckBox
Ref<StyleBox> cbx_empty = memnew( StyleBoxEmpty );
cbx_empty->set_default_margin(MARGIN_LEFT,22);
cbx_empty->set_default_margin(MARGIN_RIGHT,4);
cbx_empty->set_default_margin(MARGIN_TOP,4);
cbx_empty->set_default_margin(MARGIN_BOTTOM,5);
Ref<StyleBox> cbx_focus = focus;
cbx_focus->set_default_margin(MARGIN_LEFT,4);
cbx_focus->set_default_margin(MARGIN_RIGHT,22);
cbx_focus->set_default_margin(MARGIN_TOP,4);
cbx_focus->set_default_margin(MARGIN_BOTTOM,5);
Ref<StyleBox> cbx_empty = memnew( StyleBoxEmpty );
cbx_empty->set_default_margin(MARGIN_LEFT,22);
cbx_empty->set_default_margin(MARGIN_RIGHT,4);
cbx_empty->set_default_margin(MARGIN_TOP,4);
cbx_empty->set_default_margin(MARGIN_BOTTOM,5);
Ref<StyleBox> cbx_focus = focus;
cbx_focus->set_default_margin(MARGIN_LEFT,4);
cbx_focus->set_default_margin(MARGIN_RIGHT,22);
cbx_focus->set_default_margin(MARGIN_TOP,4);
cbx_focus->set_default_margin(MARGIN_BOTTOM,5);
t->set_stylebox("normal","CheckBox", cbx_empty );
t->set_stylebox("pressed","CheckBox", cbx_empty );
t->set_stylebox("disabled","CheckBox", cbx_empty );
t->set_stylebox("hover","CheckBox", cbx_empty );
t->set_stylebox("focus","CheckBox", cbx_focus );
t->set_stylebox("normal","CheckBox", cbx_empty );
t->set_stylebox("pressed","CheckBox", cbx_empty );
t->set_stylebox("disabled","CheckBox", cbx_empty );
t->set_stylebox("hover","CheckBox", cbx_empty );
t->set_stylebox("focus","CheckBox", cbx_focus );
t->set_icon("checked", "CheckBox", make_icon(checked_png));
t->set_icon("unchecked", "CheckBox", make_icon(unchecked_png));
t->set_icon("radio_checked", "CheckBox", make_icon(radio_checked_png));
t->set_icon("radio_unchecked", "CheckBox", make_icon(radio_unchecked_png));
t->set_icon("checked", "CheckBox", make_icon(checked_png));
t->set_icon("unchecked", "CheckBox", make_icon(unchecked_png));
t->set_icon("radio_checked", "CheckBox", make_icon(radio_checked_png));
t->set_icon("radio_unchecked", "CheckBox", make_icon(radio_unchecked_png));
t->set_font("font","CheckBox", default_font );
t->set_font("font","CheckBox", default_font );
t->set_color("font_color","CheckBox", control_font_color );
t->set_color("font_color_pressed","CheckBox", control_font_color_pressed );
t->set_color("font_color_hover","CheckBox", control_font_color_hover );
t->set_color("font_color_disabled","CheckBox", control_font_color_disabled );
t->set_color("font_color","CheckBox", control_font_color );
t->set_color("font_color_pressed","CheckBox", control_font_color_pressed );
t->set_color("font_color_hover","CheckBox", control_font_color_hover );
t->set_color("font_color_disabled","CheckBox", control_font_color_disabled );
t->set_constant("hseparation","CheckBox",4);
t->set_constant("check_vadjust","CheckBox",0);
t->set_constant("hseparation","CheckBox",4);
t->set_constant("check_vadjust","CheckBox",0);
// CheckButton
Ref<StyleBox> cb_empty = memnew( StyleBoxEmpty );
cb_empty->set_default_margin(MARGIN_LEFT,6);
cb_empty->set_default_margin(MARGIN_RIGHT,70);
cb_empty->set_default_margin(MARGIN_TOP,4);
cb_empty->set_default_margin(MARGIN_BOTTOM,4);
cb_empty->set_default_margin(MARGIN_BOTTOM,4);
t->set_stylebox("normal","CheckButton", cb_empty );
t->set_stylebox("pressed","CheckButton", cb_empty );
@@ -365,7 +365,7 @@ void make_default_theme() {
// Label
t->set_font("font","Label", default_font );
t->set_color("font_color","Label", Color(1,1,1) );
@@ -556,10 +556,16 @@ void make_default_theme() {
// GraphNode
Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,24,6,5,16,24,16,5);
Ref<StyleBoxTexture> graphsb = make_stylebox(graph_node_png,6,24,6,5,3,24,16,5);
Ref<StyleBoxTexture> graphsbselected = make_stylebox(graph_node_selected_png,6,24,6,5,3,24,16,5);
Ref<StyleBoxTexture> graphsbdefault = make_stylebox(graph_node_default_png,4,4,4,4,6,4,4,4);
Ref<StyleBoxTexture> graphsbdeffocus = make_stylebox(graph_node_default_focus_png,4,4,4,4,6,4,4,4);
//graphsb->set_expand_margin_size(MARGIN_LEFT,10);
//graphsb->set_expand_margin_size(MARGIN_RIGHT,10);
t->set_stylebox("frame","GraphNode", graphsb );
t->set_stylebox("selectedframe","GraphNode", graphsbselected );
t->set_stylebox("defaultframe", "GraphNode", graphsbdefault );
t->set_stylebox("defaultfocus", "GraphNode", graphsbdeffocus );
t->set_constant("separation","GraphNode", 1 );
t->set_icon("port","GraphNode", make_icon( graph_port_png ) );
t->set_icon("close","GraphNode", make_icon( graph_node_close_png ) );
@@ -713,7 +719,7 @@ void make_default_theme() {
// FileDialog
t->set_icon("folder","FileDialog",make_icon(icon_folder_png));
t->set_color("files_disabled","FileDialog",Color(0,0,0,0.7));
@@ -877,10 +883,10 @@ void make_default_theme() {
#endif
void clear_default_theme() {
Theme::set_default( Ref<Theme>() );
Theme::set_default_icon( Ref< Texture >() );
Theme::set_default_style( Ref< StyleBox >() );
Theme::set_default_style( Ref< StyleBox >() );
Theme::set_default_font( Ref< Font >() );
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

@@ -114,6 +114,21 @@ static const unsigned char graph_node_close_png[]={
};
static const unsigned char graph_node_default_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,0xdf,0x8,0x1a,0x17,0x2e,0xd,0x4c,0xb7,0x38,0x4,0x0,0x0,0x0,0x1d,0x69,0x54,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x0,0x0,0x0,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x64,0x2e,0x65,0x7,0x0,0x0,0x0,0x85,0x49,0x44,0x41,0x54,0x38,0xcb,0xed,0x93,0x31,0xa,0x83,0x40,0x14,0x44,0xdf,0xba,0xa5,0x20,0x41,0x30,0x20,0x4,0xab,0x40,0x20,0x7,0xc9,0x69,0xec,0x72,0x4e,0x9b,0xa0,0x1e,0xc1,0x2a,0x42,0x10,0x82,0xbb,0xc5,0x77,0x6d,0x4c,0x11,0x48,0xe3,0xb7,0x49,0xe1,0x6b,0x6,0xa6,0x78,0xd5,0x8c,0x1,0x6e,0x80,0xe1,0x9b,0xb0,0xe4,0xaf,0xde,0x3,0x4f,0xa0,0x3,0x6,0x93,0x67,0xa7,0xc0,0xa,0x44,0x64,0x72,0x7e,0x6c,0x87,0xf7,0xab,0x4,0x1e,0x68,0x38,0x17,0x97,0x90,0xc4,0x87,0xa,0xb8,0xa2,0xe5,0x98,0xe6,0x1,0xb8,0x47,0x5a,0x81,0xb5,0x16,0xa0,0x56,0xb,0x3e,0xec,0x82,0x3f,0x10,0x4c,0x6a,0x81,0x88,0x78,0xc0,0x45,0xda,0x29,0x3b,0x3f,0x36,0x40,0xbf,0xf9,0x4c,0x66,0xeb,0x9d,0x67,0x5c,0x46,0x37,0x51,0xb6,0x55,0x6d,0xc2,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
static const unsigned char graph_node_default_focus_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,0xdf,0x8,0x1b,0x1,0x9,0x1c,0x5c,0xd5,0x12,0x34,0x0,0x0,0x0,0x1d,0x69,0x54,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x0,0x0,0x0,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x64,0x2e,0x65,0x7,0x0,0x0,0x0,0xfc,0x49,0x44,0x41,0x54,0x38,0xcb,0xbd,0x93,0x41,0x4a,0x4,0x41,0xc,0x45,0x7f,0xca,0x6a,0x14,0x42,0x2f,0xc4,0x85,0x7,0xf0,0x3c,0xde,0xa2,0xbc,0x41,0xd7,0xa2,0xa1,0x60,0xea,0x60,0xae,0x5c,0xea,0x19,0xdc,0xd7,0x42,0x97,0xe5,0xc,0x12,0xeb,0xbb,0x69,0xa5,0x84,0xe9,0x41,0x1d,0xf1,0x43,0x8,0x84,0xe4,0x2d,0x92,0x1f,0xc1,0x22,0x92,0x2,0xc0,0x2d,0x81,0x2e,0x7f,0xa8,0x75,0xb9,0x89,0x8,0x1,0x40,0x48,0x5e,0x76,0xcd,0xad,0x6b,0x74,0x7b,0xea,0x6,0xe0,0x75,0x9,0x13,0x11,0xca,0x34,0x4d,0xc4,0x37,0x35,0xc,0xc3,0xf3,0x38,0x8e,0xb7,0xf3,0x3c,0xdf,0x0,0xd8,0x1,0x30,0x90,0x4,0x49,0xe4,0x9c,0x11,0x42,0x40,0x29,0x65,0x15,0x50,0x4a,0xb9,0x8,0x21,0x30,0xe7,0x7c,0x47,0x52,0x49,0x9e,0x7c,0x2,0x62,0x8c,0x30,0x33,0xa8,0xea,0x2a,0x40,0x55,0xaf,0xcc,0x4c,0x62,0x8c,0x5b,0x92,0xe7,0x24,0x7,0xd7,0x2d,0x11,0xde,0x7b,0xd4,0x5a,0x57,0x1,0xb5,0xd6,0x47,0xef,0x3d,0x49,0x9e,0x1,0xf0,0x0,0x9c,0xc3,0xef,0xe5,0xf6,0x9d,0xea,0x5f,0x1,0x38,0x16,0xd0,0xfe,0x16,0x20,0x22,0x7,0x3d,0xd0,0x7b,0x41,0x44,0xb6,0x8b,0x2b,0x9b,0xeb,0x6e,0x8c,0x94,0x12,0xcc,0x6c,0x75,0xd8,0xcc,0xc6,0x94,0xd2,0x93,0xaa,0xde,0x2f,0x76,0x6e,0x3f,0xb2,0xb2,0x88,0xec,0x54,0xf5,0x61,0xb3,0xd9,0x5c,0x3,0x78,0x1,0x60,0xc7,0x3c,0x53,0x13,0x91,0x37,0xe9,0x9d,0xd8,0xe9,0xf4,0xc0,0xe2,0xbe,0xbc,0xf3,0x3b,0x49,0xa0,0x89,0xbf,0x71,0xc6,0xcd,0x1c,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
static const unsigned char graph_node_selected_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,0xdf,0x7,0x12,0x1,0xc,0x6,0x23,0x98,0xc7,0x50,0x0,0x0,0x0,0x1d,0x69,0x54,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x0,0x0,0x0,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x64,0x2e,0x65,0x7,0x0,0x0,0x2,0x46,0x49,0x44,0x41,0x54,0x58,0xc3,0xed,0x97,0xcd,0x6a,0x13,0x51,0x14,0xc7,0x7f,0xe7,0xce,0x34,0x49,0xd,0xa6,0xb1,0x2a,0xe2,0x7,0x74,0xa1,0x6e,0x4,0x85,0xe2,0x3,0xb8,0x72,0x21,0xba,0x16,0x5c,0xb9,0x16,0x4,0x7d,0x84,0x3e,0x82,0x82,0xe0,0xda,0x95,0x2f,0x60,0x71,0xe1,0xca,0x7,0xd0,0x82,0xa5,0x6e,0xd4,0x45,0xc1,0x8f,0x4a,0x6c,0x9a,0x46,0x62,0x66,0xa6,0x73,0xef,0x71,0xe1,0x4c,0x92,0x99,0x4c,0x93,0x36,0xdd,0xc9,0xfc,0x37,0x77,0x3e,0xee,0xfd,0xdd,0x73,0xfe,0xf7,0xc,0xcc,0x11,0x86,0x12,0xc0,0x0,0x5e,0x32,0xa,0x59,0x29,0xe0,0x0,0x9b,0x8c,0xca,0xc8,0x24,0x3,0x1c,0x3,0x16,0x81,0xd3,0x40,0x3,0x98,0xcb,0x1,0xf6,0x80,0x2e,0xd0,0x2,0xda,0xc0,0x1f,0xc0,0xa5,0xbb,0xd6,0x81,0x4b,0xb,0xc7,0x9b,0xf,0x6a,0xd5,0xda,0xad,0x4a,0xa5,0x7a,0x81,0x2,0x45,0x51,0xf8,0x35,0x8,0x83,0xd7,0xbb,0xbf,0x3b,0xcf,0x81,0xcf,0x40,0x4f,0x92,0x9d,0x96,0x16,0x9b,0x27,0x9f,0x5c,0x5c,0xba,0x7c,0xfb,0xfe,0xcb,0x3b,0x34,0x2b,0x27,0x8a,0xd6,0xd3,0x89,0x76,0x78,0x71,0xef,0x15,0x5f,0x36,0x3f,0xad,0xb6,0x3b,0xdb,0x8f,0x81,0x4d,0x1,0x6a,0xc0,0xf2,0xd9,0x33,0xe7,0xdf,0xac,0xbc,0x7d,0x54,0xdf,0x73,0x11,0x81,0xed,0x17,0x2,0x6a,0xde,0x3c,0x73,0xa6,0xc2,0xca,0x8d,0xa7,0xbd,0x1f,0x3f,0xbf,0xdd,0x4,0xd6,0xfc,0xc4,0x87,0xba,0xef,0xf9,0xf5,0x6e,0xb4,0xc3,0x24,0xf5,0xe3,0x1e,0x7d,0x7a,0xf8,0x9e,0x5f,0x4f,0xd2,0x96,0x14,0xe0,0x1,0x58,0xb5,0x39,0xdb,0x1d,0x82,0x19,0x5c,0xe7,0xe4,0xa5,0x0,0x4d,0x8f,0x44,0x71,0xa8,0x2a,0x22,0x92,0x81,0x4c,0x92,0x3f,0x7a,0xe3,0xd4,0xe2,0x54,0x41,0xc1,0x13,0xf,0xc5,0xe1,0x54,0x31,0x22,0x8,0xa6,0x10,0x96,0x1,0x58,0x1d,0x4e,0x88,0x35,0x1e,0x79,0x9e,0xd6,0xd0,0x94,0x8,0x54,0xb3,0x93,0x1c,0x8a,0x41,0x6,0x63,0xfa,0x6c,0x5f,0x40,0xe4,0xa2,0xcc,0x4b,0x23,0x32,0xd8,0x37,0x4e,0x52,0x99,0x1c,0x41,0x2e,0x4c,0x9b,0xdd,0x6c,0xec,0xbe,0x20,0x5,0xe5,0xb0,0xca,0x99,0x68,0x93,0x48,0x14,0x41,0x30,0x22,0x3,0x63,0x5,0x41,0x51,0x3c,0x31,0x93,0x8f,0x31,0xf3,0xed,0x6a,0xf6,0x5b,0xfe,0xe7,0x85,0x9b,0x0,0x98,0x52,0x34,0x7,0x2a,0xa4,0xb4,0x74,0x8b,0x4c,0x2d,0x2a,0xa6,0xb1,0x42,0x32,0x8c,0x1b,0x39,0x3c,0x7b,0x37,0xbd,0x90,0xec,0x51,0x52,0x88,0x5d,0x3c,0x36,0x21,0xd,0x39,0x4d,0x4d,0x72,0xc5,0x94,0x1,0xac,0xde,0x7d,0x3f,0xbb,0x89,0xf1,0x9e,0x65,0xf9,0xea,0xf5,0x3,0x2d,0x5a,0x5b,0x7f,0x57,0x1c,0xc1,0x6e,0xb7,0x73,0xe8,0x8,0xc,0x47,0x54,0x9,0x28,0x1,0x25,0xa0,0x4,0x94,0x80,0x12,0x50,0x2,0xfe,0x4b,0x80,0x14,0xf4,0x88,0x87,0x8e,0xc0,0xcd,0xb0,0xd6,0xa5,0x0,0x7,0x4,0xd6,0xda,0xb0,0xe0,0x27,0x6d,0x7c,0x55,0xc,0xd6,0xda,0x10,0x8,0x0,0x67,0x92,0x56,0x76,0x3b,0x8,0xfb,0x1b,0xad,0xf6,0x16,0x93,0x20,0x2e,0x86,0x56,0x7b,0x8b,0x20,0xec,0x6f,0x0,0xdb,0x80,0x4d,0x3b,0xd7,0x5,0xe0,0x5a,0xa3,0xde,0x7c,0x56,0xab,0xce,0x5f,0xf1,0x3c,0xaf,0xd0,0x5c,0x6b,0xad,0xb,0xc2,0xfe,0xc7,0x6e,0xaf,0xf3,0x10,0xf8,0x0,0xec,0xca,0x48,0xb,0xd7,0x0,0xce,0x1,0xa7,0x80,0xea,0x3e,0xcd,0x77,0x8,0xfc,0x2,0xbe,0x27,0x7d,0xb4,0x95,0x9c,0xa1,0x7e,0xda,0xf,0xee,0x93,0x85,0x26,0x29,0xc7,0x33,0x1a,0x3f,0xae,0xbf,0xf0,0x27,0xf6,0x42,0xf6,0xf5,0xfd,0xae,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,0x0,0xb0,0x1d,0x9b,0xe1,0xcb,0x50,0xbe,0x5e,0x5d,0xdd,0xfe,0xbc,0xbe,0x6e,0x6b,0x49,0x92,0x8c,0x4e,0x7b,0xa7,0xad,0xbf,0x79,0x4e,0xd3,0x54,0x12,0x86,0x21,0xc2,0x30,0x84,0x32,0x95,0xe4,0x79,0xc6,0xde,0xd9,0x59,0x2b,0x49,0xee,0x46,0x86,0xeb,0xba,0x5d,0xfb,0x85,0x23,0x87,0xfd,0x1e,0xb6,0xed,0x40,0xd7,0x35,0x0,0x40,0x7d,0x38,0xa0,0xdc,0xed,0x44,0x37,0x74,0xb8,0xae,0xd7,0x35,0x48,0x62,0xff,0xff,0x1f,0xfc,0x20,0x80,0xae,0xe9,0x78,0x42,0x0,0xca,0xb2,0x90,0x65,0x19,0x58,0xd7,0xd0,0x8a,0xa2,0x58,0xa7,0x69,0x56,0x6b,0xa2,0x51,0x29,0x5,0xcb,0x52,0xb0,0x94,0x5,0x4b,0x29,0x88,0x8,0xd3,0x34,0xad,0x8b,0xfb,0x62,0xad,0xf,0x6,0x83,0xb8,0xaa,0xaa,0xb1,0xe7,0x79,0xbe,0x77,0x74,0x44,0xb7,0xe1,0x89,0x69,0x1a,0x28,0xcb,0x92,0x9b,0xcd,0x46,0x56,0xab,0xd5,0x86,0xe4,0x47,0x21,0x29,0xc3,0xe1,0xf0,0xb8,0xdf,0xef,0x7f,0x6b,0xb7,0xdb,0xaf,0x1b,0x8d,0x86,0x46,0x10,0xf,0xf7,0xf,0x75,0x1c,0xc7,0x77,0x8b,0xc5,0xe2,0xdd,0x7c,0x3e,0xff,0x25,0xcf,0xc3,0x6f,0x6e,0x6f,0x2e,0x1d,0xdb,0xe9,0x9,0x80,0xb2,0x2a,0xd7,0x27,0xad,0x37,0x5f,0x9e,0xc2,0x1f,0x1,0x3a,0xe6,0xa5,0x7b,0xef,0xf2,0xf3,0xcd,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
File diff suppressed because it is too large Load Diff
+14 -1
View File
@@ -68,7 +68,7 @@ public:
NODE_VEC_INTERP, // vec3 interpolation (with optional curve)
NODE_COLOR_RAMP, //take scalar, output vec3
NODE_CURVE_MAP, //take scalar, otput scalar
NODE_SCALAR_INPUT, // scalar uniform (assignable in material)
NODE_SCALAR_INPUT, // scalar uniform (assignable in material)
NODE_VEC_INPUT, // vec3 uniform (assignable in material)
NODE_RGB_INPUT, // color uniform (assignable in material)
NODE_XFORM_INPUT, // mat4 uniform (assignable in material)
@@ -120,6 +120,7 @@ private:
String _find_unique_name(const String& p_base);
enum {SLOT_DEFAULT_VALUE = 0x7FFFFFFF};
struct SourceSlot {
int id;
@@ -135,6 +136,7 @@ private:
NodeType type;
Variant param1;
Variant param2;
Map<int, Variant> defaults;
int id;
mutable int order; // used for sorting
int sort_order;
@@ -216,6 +218,10 @@ public:
void texture_node_set_filter_strength(ShaderType p_which,float p_id,float p_strength);
float texture_node_get_filter_strength(ShaderType p_which,float p_id) const;
void duplicate_nodes(ShaderType p_which, List<int> &p_nodes);
List<int> generate_ids(ShaderType p_type, int count);
enum ScalarOp {
SCALAR_OP_ADD,
SCALAR_OP_SUB,
@@ -314,6 +320,9 @@ public:
VEC_MAX_FUNC
};
void default_set_value(ShaderType p_which,int p_id,int p_param, const Variant& p_value);
Variant default_get_value(ShaderType p_which,int p_id,int p_param);
void vec_func_node_set_function(ShaderType p_which,int p_id,VecFunc p_func);
VecFunc vec_func_node_get_function(ShaderType p_which,int p_id) const;
@@ -354,6 +363,8 @@ public:
void get_node_connections(ShaderType p_which,List<Connection> *p_connections) const;
bool is_slot_connected(ShaderType p_which,int p_dst_id,int slot_id);
void clear(ShaderType p_which);
Variant node_get_state(ShaderType p_type, int p_node) const;
@@ -361,6 +372,8 @@ public:
GraphError get_graph_error(ShaderType p_type) const;
int node_count(ShaderType p_which, int p_type);
static int get_type_input_count(NodeType p_type);
static int get_type_output_count(NodeType p_type);
static SlotType get_type_input_type(NodeType p_type,int p_idx);
File diff suppressed because it is too large Load Diff
@@ -129,6 +129,7 @@ class ShaderGraphView : public Node {
GraphEdit *graph_edit;
Ref<ShaderGraph> graph;
int edited_id;
int edited_def;
ShaderGraph::ShaderType type;
@@ -136,13 +137,23 @@ class ShaderGraphView : public Node {
void _create_node(int p_id);
ToolButton *make_label(String text, Variant::Type v_type = Variant::NIL);
ToolButton *make_editor(String text, GraphNode* gn, int p_id, int param, Variant::Type type, String p_hint="");
void _connection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot);
void _disconnection_request(const String& p_from, int p_from_slot,const String& p_to,int p_to_slot);
void _node_removed(int p_id);
void _begin_node_move();
void _node_moved(const Vector2& p_from, const Vector2& p_to,int p_id);
void _end_node_move();
void _move_node(int p_id,const Vector2& p_to);
void _duplicate_nodes_request();
void _duplicate_nodes(Array &p_nodes);
void _delete_nodes_request();
void _default_changed(int p_id, Node* p_button, int p_param, int v_type, String p_hint);
void _scalar_const_changed(double p_value,int p_id);
void _vec_const_changed(double p_value, int p_id, Array p_arr);
@@ -175,7 +186,7 @@ protected:
static void _bind_methods();
public:
void add_node(int p_type);
void add_node(int p_type, const Vector2 &location);
GraphEdit *get_graph_edit() { return graph_edit; }
void set_graph(Ref<ShaderGraph> p_graph);
@@ -186,13 +197,15 @@ class ShaderGraphEditor : public VBoxContainer {
OBJ_TYPE(ShaderGraphEditor,VBoxContainer);
MenuButton *menu;
PopupMenu *popup;
TabContainer *tabs;
ShaderGraphView *graph_edits[ShaderGraph::SHADER_TYPE_MAX];
static const char* node_names[ShaderGraph::NODE_TYPE_MAX];
Vector2 next_location;
bool _2d;
void _add_node(int p_type);
void _popup_requested(const Vector2 &p_position);
protected:
void _notification(int p_what);
static void _bind_methods();
File diff suppressed because it is too large Load Diff
+21 -19
View File
@@ -46,9 +46,9 @@
*/
class CustomPropertyEditor : public Popup {
OBJ_TYPE( CustomPropertyEditor, Popup );
enum {
MAX_VALUE_EDITORS=12,
MAX_ACTION_BUTTONS=5,
@@ -93,7 +93,8 @@ class CustomPropertyEditor : public Popup {
TextEdit *text_edit;
bool read_only;
Button *checks20[20];
SpinBox *spinbox;
HSlider *slider;
Control *easing_draw;
@@ -106,6 +107,7 @@ class CustomPropertyEditor : public Popup {
void _file_selected(String p_file);
void _scroll_modified(double p_value);
void _modified(String p_string);
void _range_modified(double p_value);
void _focus_enter();
void _focus_exit();
void _action_pressed(int p_which);
@@ -114,7 +116,7 @@ class CustomPropertyEditor : public Popup {
void _color_changed(const Color& p_color);
void _draw_easing();
void _menu_option(int p_which);
void _drag_easing(const InputEvent& p_ev);
void _node_path_selected(NodePath p_path);
@@ -125,23 +127,23 @@ class CustomPropertyEditor : public Popup {
protected:
void _notification(int p_what);
static void _bind_methods();
public:
static void _bind_methods();
public:
Variant get_variant() const;
String get_name() const;
void set_read_only(bool p_read_only) { read_only=p_read_only; }
bool edit(Object* p_owner,const String& p_name,Variant::Type p_type, const Variant& p_variant,int p_hint,String p_hint_text);
CustomPropertyEditor();
};
class PropertyEditor : public Control {
OBJ_TYPE( PropertyEditor, Control );
Tree *tree;
Label *top_label;
//Object *object;
@@ -168,26 +170,26 @@ class PropertyEditor : public Control {
Map<StringName,String > class_descr_cache;
CustomPropertyEditor *custom_editor;
void _resource_edit_request();
void _custom_editor_edited();
void _custom_editor_request(bool p_arrow);
void _item_selected();
void _item_edited();
TreeItem *get_parent_node(String p_path,HashMap<String,TreeItem*>& item_paths,TreeItem *root);
void set_item_text(TreeItem *p_item, int p_type, const String& p_name, int p_hint=PROPERTY_HINT_NONE, const String& p_hint_text="");
TreeItem *find_item(TreeItem *p_item,const String& p_name);
virtual void _changed_callback(Object *p_changed,const char * p_what);
virtual void _changed_callbacks(Object *p_changed,const String& p_callback);
void _edit_button(Object *p_item, int p_column, int p_button);
void _node_removed(Node *p_node);
void _edit_set(const String& p_name, const Variant& p_value);
void _draw_flags(Object *ti,const Rect2& p_rect);
@@ -201,7 +203,7 @@ class PropertyEditor : public Control {
UndoRedo *undo_redo;
protected:
void _notification(int p_what);
static void _bind_methods();
public: