summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp2
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/io/packet_peer.cpp2
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp64
-rw-r--r--editor/editor_themes.cpp2
-rw-r--r--editor/plugins/script_text_editor.cpp33
-rw-r--r--editor/plugins/script_text_editor.h4
-rw-r--r--modules/etc/image_etc.cpp20
-rw-r--r--platform/osx/godot_main_osx.mm11
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm21
-rw-r--r--scene/2d/collision_polygon_2d.cpp22
-rw-r--r--scene/2d/collision_polygon_2d.h2
-rw-r--r--scene/2d/collision_shape_2d.cpp22
-rw-r--r--scene/2d/collision_shape_2d.h2
-rw-r--r--scene/3d/collision_polygon.cpp20
-rw-r--r--scene/3d/collision_polygon.h2
-rw-r--r--scene/3d/collision_shape.cpp17
-rw-r--r--scene/3d/collision_shape.h2
-rw-r--r--scene/gui/text_edit.cpp25
-rw-r--r--scene/gui/text_edit.h4
-rw-r--r--scene/resources/material.cpp2
22 files changed, 257 insertions, 26 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index c7039353ae..32b94b9b02 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -2585,7 +2585,7 @@ void _Engine::set_target_fps(int p_fps) {
Engine::get_singleton()->set_target_fps(p_fps);
}
-float _Engine::get_target_fps() const {
+int _Engine::get_target_fps() const {
return Engine::get_singleton()->get_target_fps();
}
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index bc5b8ea04c..2353b6d09f 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -656,7 +656,7 @@ public:
int get_iterations_per_second() const;
void set_target_fps(int p_fps);
- float get_target_fps() const;
+ int get_target_fps() const;
float get_frames_per_second() const;
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 0a54a84c8c..bd851ebb6d 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -155,7 +155,7 @@ void PacketPeerStream::_set_stream_peer(REF p_peer) {
void PacketPeerStream::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_stream_peer", "peer"), &PacketPeerStream::_set_stream_peer);
+ ClassDB::bind_method(D_METHOD("set_stream_peer", "peer"), &PacketPeerStream::set_stream_peer);
ClassDB::bind_method(D_METHOD("get_stream_peer"), &PacketPeerStream::get_stream_peer);
ClassDB::bind_method(D_METHOD("set_input_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_input_buffer_max_size);
ClassDB::bind_method(D_METHOD("set_output_buffer_max_size", "max_size_bytes"), &PacketPeerStream::set_output_buffer_max_size);
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index ada7acb879..945970c6b4 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -56,6 +56,41 @@ static int _get_datatype_size(SL::DataType p_type) {
case SL::TYPE_VOID: return 0;
case SL::TYPE_BOOL: return 4;
case SL::TYPE_BVEC2: return 8;
+ case SL::TYPE_BVEC3: return 12;
+ case SL::TYPE_BVEC4: return 16;
+ case SL::TYPE_INT: return 4;
+ case SL::TYPE_IVEC2: return 8;
+ case SL::TYPE_IVEC3: return 12;
+ case SL::TYPE_IVEC4: return 16;
+ case SL::TYPE_UINT: return 4;
+ case SL::TYPE_UVEC2: return 8;
+ case SL::TYPE_UVEC3: return 12;
+ case SL::TYPE_UVEC4: return 16;
+ case SL::TYPE_FLOAT: return 4;
+ case SL::TYPE_VEC2: return 8;
+ case SL::TYPE_VEC3: return 12;
+ case SL::TYPE_VEC4: return 16;
+ case SL::TYPE_MAT2:
+ return 24; //4 * 4 + 4 * 2
+ case SL::TYPE_MAT3:
+ return 44; // 4 * 4 + 4 * 4 + 4 * 3
+ case SL::TYPE_MAT4: return 64;
+ case SL::TYPE_SAMPLER2D: return 16;
+ case SL::TYPE_ISAMPLER2D: return 16;
+ case SL::TYPE_USAMPLER2D: return 16;
+ case SL::TYPE_SAMPLERCUBE: return 16;
+ }
+
+ ERR_FAIL_V(0);
+}
+
+static int _get_datatype_alignment(SL::DataType p_type) {
+
+ switch (p_type) {
+
+ case SL::TYPE_VOID: return 0;
+ case SL::TYPE_BOOL: return 4;
+ case SL::TYPE_BVEC2: return 8;
case SL::TYPE_BVEC3: return 16;
case SL::TYPE_BVEC4: return 16;
case SL::TYPE_INT: return 4;
@@ -71,8 +106,8 @@ static int _get_datatype_size(SL::DataType p_type) {
case SL::TYPE_VEC3: return 16;
case SL::TYPE_VEC4: return 16;
case SL::TYPE_MAT2: return 16;
- case SL::TYPE_MAT3: return 48;
- case SL::TYPE_MAT4: return 64;
+ case SL::TYPE_MAT3: return 16;
+ case SL::TYPE_MAT4: return 16;
case SL::TYPE_SAMPLER2D: return 16;
case SL::TYPE_ISAMPLER2D: return 16;
case SL::TYPE_USAMPLER2D: return 16;
@@ -81,7 +116,6 @@ static int _get_datatype_size(SL::DataType p_type) {
ERR_FAIL_V(0);
}
-
static String _interpstr(SL::DataInterpolation p_interp) {
switch (p_interp) {
@@ -341,7 +375,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
}
uniform_defines[E->get().order] = ucode;
uniform_sizes[E->get().order] = _get_datatype_size(E->get().type);
- uniform_alignments[E->get().order] = MIN(16, _get_datatype_size(E->get().type));
+ uniform_alignments[E->get().order] = _get_datatype_alignment(E->get().type);
}
p_actions.uniforms->insert(E->key(), E->get());
@@ -350,6 +384,27 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
for (int i = 0; i < max_uniforms; i++) {
r_gen_code.uniforms += uniform_defines[i];
}
+#if 1
+ // add up
+ int offset = 0;
+ for (int i = 0; i < uniform_sizes.size(); i++) {
+
+ int align = offset % uniform_alignments[i];
+
+ if (align != 0) {
+ offset += uniform_alignments[i] - align;
+ }
+
+ r_gen_code.uniform_offsets.push_back(offset);
+
+ offset += uniform_sizes[i];
+ }
+
+ r_gen_code.uniform_total_size = offset;
+ if (r_gen_code.uniform_total_size % 16 != 0) { //UBO sizes must be multiples of 16
+ r_gen_code.uniform_total_size += r_gen_code.uniform_total_size % 16;
+ }
+#else
// add up
for (int i = 0; i < uniform_sizes.size(); i++) {
@@ -389,6 +444,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
} else {
r_gen_code.uniform_total_size = 0;
}
+#endif
for (Map<StringName, SL::ShaderNode::Varying>::Element *E = pnode->varyings.front(); E; E = E->next()) {
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 9fda9d2ff6..9f031b5a80 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -1053,7 +1053,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color word_highlighted_color = alpha1;
const Color number_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3);
const Color function_color = main_color;
- const Color member_variable_color = mono_color;
+ const Color member_variable_color = main_color.linear_interpolate(mono_color, 0.6);
const Color mark_color = Color(error_color.r, error_color.g, error_color.b, 0.3);
const Color breakpoint_color = error_color;
const Color code_folding_color = alpha4;
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index f1ed984fee..2a6b4ee173 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -63,6 +63,7 @@ void ScriptTextEditor::apply_code() {
//print_line("applying code");
script->set_source_code(code_editor->get_text_edit()->get_text());
script->update_exports();
+ _update_member_keywords();
}
Ref<Script> ScriptTextEditor::get_edited_script() const {
@@ -70,6 +71,37 @@ Ref<Script> ScriptTextEditor::get_edited_script() const {
return script;
}
+void ScriptTextEditor::_update_member_keywords() {
+ member_keywords.clear();
+ code_editor->get_text_edit()->clear_member_keywords();
+ Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color");
+
+ StringName instance_base = script->get_instance_base_type();
+
+ if (instance_base == StringName())
+ return;
+ List<PropertyInfo> plist;
+ ClassDB::get_property_list(instance_base, &plist);
+
+ for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
+ String name = E->get().name;
+ if (E->get().usage & PROPERTY_USAGE_CATEGORY || E->get().usage & PROPERTY_USAGE_GROUP)
+ continue;
+ if (name.find("/") != -1)
+ continue;
+
+ code_editor->get_text_edit()->add_member_keyword(name, member_variable_color);
+ }
+
+ List<String> clist;
+ ClassDB::get_integer_constant_list(instance_base, &clist);
+
+ for (List<String>::Element *E = clist.front(); E; E = E->next()) {
+
+ code_editor->get_text_edit()->add_member_keyword(E->get(), member_variable_color);
+ }
+}
+
void ScriptTextEditor::_load_theme_settings() {
TextEdit *text_edit = code_editor->get_text_edit();
@@ -563,6 +595,7 @@ void ScriptTextEditor::_validate_script() {
if (!script->is_tool()) {
script->set_source_code(text);
script->update_exports();
+ _update_member_keywords();
//script->reload(); //will update all the variables in property editors
}
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index ebbe865cee..22e8fbce25 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -44,6 +44,8 @@ class ScriptTextEditor : public ScriptEditorBase {
Vector<String> functions;
+ Vector<String> member_keywords;
+
HBoxContainer *edit_hb;
MenuButton *edit_menu;
@@ -58,6 +60,8 @@ class ScriptTextEditor : public ScriptEditorBase {
int color_line;
String color_args;
+ void _update_member_keywords();
+
struct ColorsCache {
Color symbol_color;
Color keyword_color;
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
index e56ec774dd..8a674bc8c1 100644
--- a/modules/etc/image_etc.cpp
+++ b/modules/etc/image_etc.cpp
@@ -118,7 +118,6 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
}
uint32_t imgw = p_img->get_width(), imgh = p_img->get_height();
- ERR_FAIL_COND(next_power_of_2(imgw) != imgw || next_power_of_2(imgh) != imgh);
Image::Format etc_format = force_etc1_format ? Image::FORMAT_ETC : _get_etc2_mode(detected_channels);
@@ -127,6 +126,25 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
if (img->get_format() != Image::FORMAT_RGBA8)
img->convert(Image::FORMAT_RGBA8); //still uses RGBA to convert
+ if (img->has_mipmaps()) {
+ if (next_power_of_2(imgw) != imgw || next_power_of_2(imgh) != imgh) {
+ img->resize_to_po2();
+ imgw = img->get_width();
+ imgh = img->get_height();
+ }
+ } else {
+ if (imgw % 4 != 0 || imgh % 4 != 0) {
+ if (imgw % 4) {
+ imgw += 4 - imgw % 4;
+ }
+ if (imgh % 4) {
+ imgh += 4 - imgh % 4;
+ }
+
+ img->resize(imgw, imgh);
+ }
+ }
+
PoolVector<uint8_t>::Read r = img->get_data().read();
int target_size = Image::get_image_data_size(imgw, imgh, etc_format, p_img->has_mipmaps() ? -1 : 0);
diff --git a/platform/osx/godot_main_osx.mm b/platform/osx/godot_main_osx.mm
index 9d1a5566c9..6ccbaf896b 100644
--- a/platform/osx/godot_main_osx.mm
+++ b/platform/osx/godot_main_osx.mm
@@ -82,8 +82,17 @@ int main(int argc, char **argv) {
#endif
OS_OSX os;
+ Error err;
+
+ if (os.open_with_filename != "") {
+ char *argv_c = (char *)malloc(os.open_with_filename.utf8().size());
+ memcpy(argv_c, os.open_with_filename.utf8().get_data(), os.open_with_filename.utf8().size());
+ err = Main::setup(argv[0], 1, &argv_c);
+ free(argv_c);
+ } else {
+ err = Main::setup(argv[0], argc - first_arg, &argv[first_arg]);
+ }
- Error err = Main::setup(argv[0], argc - first_arg, &argv[first_arg]);
if (err != OK)
return 255;
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index a1869497ef..c422eb9223 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -115,6 +115,8 @@ public:
Size2 window_size;
Rect2 restore_rect;
+ String open_with_filename;
+
Point2 im_position;
ImeCallback im_callback;
void *im_target;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index d0cc115f0e..8369adbb5f 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -144,6 +144,13 @@ static Vector2 get_mouse_pos(NSEvent *event) {
@implementation GodotApplicationDelegate
+- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename {
+ // Note: called before main loop init!
+ char *utfs = strdup([filename UTF8String]);
+ OS_OSX::singleton->open_with_filename.parse_utf8(utfs);
+ return YES;
+}
+
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
if (OS_OSX::singleton->get_main_loop())
OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
@@ -2322,6 +2329,20 @@ OS_OSX::OS_OSX() {
Vector<Logger *> loggers;
loggers.push_back(memnew(OSXTerminalLogger));
_set_logger(memnew(CompositeLogger(loggers)));
+
+ //process application:openFile: event
+ while (true) {
+ NSEvent *event = [NSApp
+ nextEventMatchingMask:NSEventMaskAny
+ untilDate:[NSDate distantPast]
+ inMode:NSDefaultRunLoopMode
+ dequeue:YES];
+
+ if (event == nil)
+ break;
+
+ [NSApp sendEvent:event];
+ }
}
bool OS_OSX::_check_internal_feature_support(const String &p_feature) {
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index 965507e385..978fb379ac 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -115,6 +115,15 @@ Vector<Vector<Vector2> > CollisionPolygon2D::_decompose_in_convex() {
return decomp;
}
+void CollisionPolygon2D::_update_in_shape_owner(bool p_xform_only) {
+
+ parent->shape_owner_set_transform(owner_id, get_transform());
+ if (p_xform_only)
+ return;
+ parent->shape_owner_set_disabled(owner_id, disabled);
+ parent->shape_owner_set_one_way_collision(owner_id, one_way_collision);
+}
+
void CollisionPolygon2D::_notification(int p_what) {
switch (p_what) {
@@ -124,9 +133,7 @@ void CollisionPolygon2D::_notification(int p_what) {
if (parent) {
owner_id = parent->create_shape_owner(this);
_build_polygon();
- parent->shape_owner_set_transform(owner_id, get_transform());
- parent->shape_owner_set_disabled(owner_id, disabled);
- parent->shape_owner_set_one_way_collision(owner_id, one_way_collision);
+ _update_in_shape_owner();
}
/*if (Engine::get_singleton()->is_editor_hint()) {
@@ -136,10 +143,17 @@ void CollisionPolygon2D::_notification(int p_what) {
}*/
} break;
+ case NOTIFICATION_ENTER_TREE: {
+
+ if (parent) {
+ _update_in_shape_owner();
+ }
+
+ } break;
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
if (parent) {
- parent->shape_owner_set_transform(owner_id, get_transform());
+ _update_in_shape_owner(true);
}
} break;
diff --git a/scene/2d/collision_polygon_2d.h b/scene/2d/collision_polygon_2d.h
index 83451f3f1a..4dafe7d1da 100644
--- a/scene/2d/collision_polygon_2d.h
+++ b/scene/2d/collision_polygon_2d.h
@@ -59,6 +59,8 @@ protected:
void _build_polygon();
+ void _update_in_shape_owner(bool p_xform_only = false);
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index bf213614ed..0eeb6dafe5 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -45,6 +45,15 @@ void CollisionShape2D::_shape_changed() {
update();
}
+void CollisionShape2D::_update_in_shape_owner(bool p_xform_only) {
+
+ parent->shape_owner_set_transform(owner_id, get_transform());
+ if (p_xform_only)
+ return;
+ parent->shape_owner_set_disabled(owner_id, disabled);
+ parent->shape_owner_set_one_way_collision(owner_id, one_way_collision);
+}
+
void CollisionShape2D::_notification(int p_what) {
switch (p_what) {
@@ -57,9 +66,7 @@ void CollisionShape2D::_notification(int p_what) {
if (shape.is_valid()) {
parent->shape_owner_add_shape(owner_id, shape);
}
- parent->shape_owner_set_transform(owner_id, get_transform());
- parent->shape_owner_set_disabled(owner_id, disabled);
- parent->shape_owner_set_one_way_collision(owner_id, one_way_collision);
+ _update_in_shape_owner();
}
/*if (Engine::get_singleton()->is_editor_hint()) {
@@ -69,10 +76,17 @@ void CollisionShape2D::_notification(int p_what) {
}*/
} break;
+ case NOTIFICATION_ENTER_TREE: {
+
+ if (parent) {
+ _update_in_shape_owner();
+ }
+
+ } break;
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
if (parent) {
- parent->shape_owner_set_transform(owner_id, get_transform());
+ _update_in_shape_owner(true);
}
} break;
diff --git a/scene/2d/collision_shape_2d.h b/scene/2d/collision_shape_2d.h
index b3f7d3f02a..cdff595828 100644
--- a/scene/2d/collision_shape_2d.h
+++ b/scene/2d/collision_shape_2d.h
@@ -47,6 +47,8 @@ class CollisionShape2D : public Node2D {
bool disabled;
bool one_way_collision;
+ void _update_in_shape_owner(bool p_xform_only = false);
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp
index ef1b33a4e2..3a77360bc2 100644
--- a/scene/3d/collision_polygon.cpp
+++ b/scene/3d/collision_polygon.cpp
@@ -73,6 +73,14 @@ void CollisionPolygon::_build_polygon() {
}
}
+void CollisionPolygon::_update_in_shape_owner(bool p_xform_only) {
+
+ parent->shape_owner_set_transform(owner_id, get_transform());
+ if (p_xform_only)
+ return;
+ parent->shape_owner_set_disabled(owner_id, disabled);
+}
+
void CollisionPolygon::_notification(int p_what) {
switch (p_what) {
@@ -82,14 +90,20 @@ void CollisionPolygon::_notification(int p_what) {
if (parent) {
owner_id = parent->create_shape_owner(this);
_build_polygon();
- parent->shape_owner_set_transform(owner_id, get_transform());
- parent->shape_owner_set_disabled(owner_id, disabled);
+ _update_in_shape_owner();
}
} break;
+ case NOTIFICATION_ENTER_TREE: {
+
+ if (parent) {
+ _update_in_shape_owner();
+ }
+
+ } break;
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
if (parent) {
- parent->shape_owner_set_transform(owner_id, get_transform());
+ _update_in_shape_owner(true);
}
} break;
diff --git a/scene/3d/collision_polygon.h b/scene/3d/collision_polygon.h
index 6643cfa044..971c67f1ad 100644
--- a/scene/3d/collision_polygon.h
+++ b/scene/3d/collision_polygon.h
@@ -51,6 +51,8 @@ protected:
void _build_polygon();
+ void _update_in_shape_owner(bool p_xform_only = false);
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp
index d6d49a197c..943f4158f7 100644
--- a/scene/3d/collision_shape.cpp
+++ b/scene/3d/collision_shape.cpp
@@ -64,6 +64,14 @@ void CollisionShape::make_convex_from_brothers() {
}
}
+void CollisionShape::_update_in_shape_owner(bool p_xform_only) {
+
+ parent->shape_owner_set_transform(owner_id, get_transform());
+ if (p_xform_only)
+ return;
+ parent->shape_owner_set_disabled(owner_id, disabled);
+}
+
void CollisionShape::_notification(int p_what) {
switch (p_what) {
@@ -75,19 +83,20 @@ void CollisionShape::_notification(int p_what) {
if (shape.is_valid()) {
parent->shape_owner_add_shape(owner_id, shape);
}
- parent->shape_owner_set_transform(owner_id, get_transform());
- parent->shape_owner_set_disabled(owner_id, disabled);
+ _update_in_shape_owner();
}
} break;
case NOTIFICATION_ENTER_TREE: {
+ if (parent) {
+ _update_in_shape_owner();
+ }
if (get_tree()->is_debugging_collisions_hint()) {
_create_debug_shape();
}
-
} break;
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
if (parent) {
- parent->shape_owner_set_transform(owner_id, get_transform());
+ _update_in_shape_owner(true);
}
} break;
case NOTIFICATION_UNPARENTED: {
diff --git a/scene/3d/collision_shape.h b/scene/3d/collision_shape.h
index 724a025165..c9c91a5824 100644
--- a/scene/3d/collision_shape.h
+++ b/scene/3d/collision_shape.h
@@ -51,6 +51,8 @@ class CollisionShape : public Spatial {
void _create_debug_shape();
+ void _update_in_shape_owner(bool p_xform_only = false);
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 8f37628c33..d673f21077 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1025,6 +1025,21 @@ void TextEdit::_notification(int p_what) {
const Color *col = keywords.custom_getptr(range, hash);
+ if (!col) {
+ col = member_keywords.custom_getptr(range, hash);
+
+ if (col) {
+ for (int k = j - 1; k >= 0; k--) {
+ if (str[k] == '.') {
+ col = NULL; //member indexing not allowed
+ break;
+ } else if (str[k] > 32) {
+ break;
+ }
+ }
+ }
+ }
+
if (col) {
in_keyword = true;
@@ -4138,6 +4153,16 @@ void TextEdit::add_color_region(const String &p_begin_key, const String &p_end_k
update();
}
+void TextEdit::add_member_keyword(const String &p_keyword, const Color &p_color) {
+ member_keywords[p_keyword] = p_color;
+ update();
+}
+
+void TextEdit::clear_member_keywords() {
+ member_keywords.clear();
+ update();
+}
+
void TextEdit::set_syntax_coloring(bool p_enabled) {
syntax_coloring = p_enabled;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 5ce751faa8..acbf41aa81 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -210,6 +210,7 @@ class TextEdit : public Control {
//syntax coloring
HashMap<String, Color> keywords;
+ HashMap<String, Color> member_keywords;
Vector<ColorRegion> color_regions;
@@ -546,6 +547,9 @@ public:
void add_color_region(const String &p_begin_key = String(), const String &p_end_key = String(), const Color &p_color = Color(), bool p_line_only = false);
void clear_colors();
+ void add_member_keyword(const String &p_keyword, const Color &p_color);
+ void clear_member_keywords();
+
int get_v_scroll() const;
void set_v_scroll(int p_scroll);
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 91ba9e4768..8a1978cf85 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -2127,7 +2127,7 @@ SpatialMaterial::SpatialMaterial() :
for (int i = 0; i < FLAG_MAX; i++) {
flags[i] = 0;
}
- diffuse_mode = DIFFUSE_LAMBERT;
+ diffuse_mode = DIFFUSE_BURLEY;
specular_mode = SPECULAR_SCHLICK_GGX;
for (int i = 0; i < FEATURE_MAX; i++) {