summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/visual_instance.cpp42
-rw-r--r--scene/3d/visual_instance.h12
-rw-r--r--scene/gui/text_edit.cpp27
-rw-r--r--scene/gui/text_edit.h5
4 files changed, 84 insertions, 2 deletions
diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp
index 723b0a9af5..b15226cce3 100644
--- a/scene/3d/visual_instance.cpp
+++ b/scene/3d/visual_instance.cpp
@@ -267,6 +267,15 @@ void GeometryInstance::_update_visibility() {
void GeometryInstance::set_flag(Flags p_flag,bool p_value) {
ERR_FAIL_INDEX(p_flag,FLAG_MAX);
+ if (p_flag==FLAG_CAST_SHADOW) {
+ if (p_value == true) {
+ set_cast_shadows_setting(SHADOW_CASTING_SETTING_ON);
+ }
+ else {
+ set_cast_shadows_setting(SHADOW_CASTING_SETTING_OFF);
+ }
+ }
+
if (flags[p_flag]==p_value)
return;
@@ -294,10 +303,32 @@ void GeometryInstance::set_flag(Flags p_flag,bool p_value) {
bool GeometryInstance::get_flag(Flags p_flag) const{
ERR_FAIL_INDEX_V(p_flag,FLAG_MAX,false);
+
+ if (p_flag == FLAG_CAST_SHADOW) {
+ if (shadow_casting_setting == SHADOW_CASTING_SETTING_OFF) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
return flags[p_flag];
}
+void GeometryInstance::set_cast_shadows_setting(ShadowCastingSetting p_shadow_casting_setting) {
+
+ shadow_casting_setting = p_shadow_casting_setting;
+
+ VS::get_singleton()->instance_geometry_set_cast_shadows_setting(get_instance(), (VS::ShadowCastingSetting)p_shadow_casting_setting);
+}
+
+GeometryInstance::ShadowCastingSetting GeometryInstance::get_cast_shadows_setting() const {
+
+ return shadow_casting_setting;
+}
+
void GeometryInstance::set_baked_light_texture_id(int p_id) {
baked_light_texture_id=p_id;
@@ -330,6 +361,9 @@ void GeometryInstance::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_flag","flag","value"), &GeometryInstance::set_flag);
ObjectTypeDB::bind_method(_MD("get_flag","flag"), &GeometryInstance::get_flag);
+ ObjectTypeDB::bind_method(_MD("set_cast_shadows_setting", "shadow_casting_setting"), &GeometryInstance::set_cast_shadows_setting);
+ ObjectTypeDB::bind_method(_MD("get_cast_shadows_setting"), &GeometryInstance::get_cast_shadows_setting);
+
ObjectTypeDB::bind_method(_MD("set_draw_range_begin","mode"), &GeometryInstance::set_draw_range_begin);
ObjectTypeDB::bind_method(_MD("get_draw_range_begin"), &GeometryInstance::get_draw_range_begin);
@@ -346,7 +380,7 @@ void GeometryInstance::_bind_methods() {
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE);
ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "geometry/material_override",PROPERTY_HINT_RESOURCE_TYPE,"Material"), _SCS("set_material_override"), _SCS("get_material_override"));
- ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/cast_shadow"), _SCS("set_flag"), _SCS("get_flag"),FLAG_CAST_SHADOW);
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry/cast_shadow", PROPERTY_HINT_ENUM, "Off,On,Double-Sided,Shadows Only"), _SCS("set_cast_shadows_setting"), _SCS("get_cast_shadows_setting"));
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/receive_shadows"), _SCS("set_flag"), _SCS("get_flag"),FLAG_RECEIVE_SHADOWS);
ADD_PROPERTY( PropertyInfo( Variant::INT, "geometry/range_begin",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_draw_range_begin"), _SCS("get_draw_range_begin"));
ADD_PROPERTY( PropertyInfo( Variant::INT, "geometry/range_end",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_draw_range_end"), _SCS("get_draw_range_end"));
@@ -369,6 +403,11 @@ void GeometryInstance::_bind_methods() {
BIND_CONSTANT(FLAG_VISIBLE_IN_ALL_ROOMS );
BIND_CONSTANT(FLAG_MAX );
+ BIND_CONSTANT(SHADOW_CASTING_SETTING_OFF);
+ BIND_CONSTANT(SHADOW_CASTING_SETTING_ON);
+ BIND_CONSTANT(SHADOW_CASTING_SETTING_DOUBLE_SIDED);
+ BIND_CONSTANT(SHADOW_CASTING_SETTING_SHADOWS_ONLY);
+
}
GeometryInstance::GeometryInstance() {
@@ -381,6 +420,7 @@ GeometryInstance::GeometryInstance() {
flags[FLAG_VISIBLE]=true;
flags[FLAG_CAST_SHADOW]=true;
flags[FLAG_RECEIVE_SHADOWS]=true;
+ shadow_casting_setting=SHADOW_CASTING_SETTING_ON;
baked_light_instance=NULL;
baked_light_texture_id=0;
extra_cull_margin=0;
diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h
index e49f4fb82f..2b8292261b 100644
--- a/scene/3d/visual_instance.h
+++ b/scene/3d/visual_instance.h
@@ -98,10 +98,17 @@ public:
FLAG_MAX=VS::INSTANCE_FLAG_MAX,
};
+ enum ShadowCastingSetting {
+ SHADOW_CASTING_SETTING_OFF=VS::SHADOW_CASTING_SETTING_OFF,
+ SHADOW_CASTING_SETTING_ON = VS::SHADOW_CASTING_SETTING_ON,
+ SHADOW_CASTING_SETTING_DOUBLE_SIDED=VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED,
+ SHADOW_CASTING_SETTING_SHADOWS_ONLY=VS::SHADOW_CASTING_SETTING_SHADOWS_ONLY
+ };
private:
bool flags[FLAG_MAX];
+ ShadowCastingSetting shadow_casting_setting;
Ref<Material> material_override;
float draw_begin;
float draw_end;
@@ -121,6 +128,9 @@ public:
void set_flag(Flags p_flag,bool p_value);
bool get_flag(Flags p_flag) const;
+ void set_cast_shadows_setting(ShadowCastingSetting p_shadow_casting_setting);
+ ShadowCastingSetting get_cast_shadows_setting() const;
+
void set_draw_range_begin(float p_dist);
float get_draw_range_begin() const;
@@ -140,5 +150,7 @@ public:
};
VARIANT_ENUM_CAST( GeometryInstance::Flags );
+VARIANT_ENUM_CAST( GeometryInstance::ShadowCastingSetting );
+
#endif
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 5d7436517f..96c3d28650 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -290,7 +290,10 @@ void TextEdit::_update_scrollbars() {
int hscroll_rows = ((hmin.height-1)/get_row_height())+1;
int visible_rows = get_visible_rows();
int total_rows = text.size();
-
+ if (scroll_past_end_of_file_enabled) {
+ total_rows += get_visible_rows() - 1;
+ }
+
int vscroll_pixels = v_scroll->get_combined_minimum_size().width;
int visible_width = size.width - cache.style_normal->get_minimum_size().width;
int total_width = text.get_max_width() + vmin.x;
@@ -1677,9 +1680,30 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
ins+="\t";
}
}
+
+ bool first_line = false;
+ if (k.mod.command) {
+ if (k.mod.shift) {
+ if (cursor.line > 0) {
+ cursor_set_line(cursor.line - 1);
+ cursor_set_column(text[cursor.line].length());
+ }
+ else {
+ cursor_set_column(0);
+ first_line = true;
+ }
+ }
+ else {
+ cursor_set_column(text[cursor.line].length());
+ }
+ }
_insert_text_at_cursor(ins);
_push_current_op();
+
+ if (first_line) {
+ cursor_set_line(0);
+ }
} break;
case KEY_ESCAPE: {
@@ -3969,6 +3993,7 @@ TextEdit::TextEdit() {
tooltip_obj=NULL;
line_numbers=false;
next_operation_is_complex=false;
+ scroll_past_end_of_file_enabled=false;
auto_brace_completion_enabled=false;
brace_matching_enabled=false;
auto_indent=false;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 44e780aaf3..8d0efc406a 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -211,6 +211,7 @@ class TextEdit : public Control {
bool undo_enabled;
bool line_numbers;
+ bool scroll_past_end_of_file_enabled;
bool auto_brace_completion_enabled;
bool brace_matching_enabled;
bool auto_indent;
@@ -322,6 +323,10 @@ public:
void set_line(int line, String new_text);
void backspace_at_cursor();
+ inline void set_scroll_pass_end_of_file(bool p_enabled) {
+ scroll_past_end_of_file_enabled = p_enabled;
+ update();
+ }
inline void set_auto_brace_completion(bool p_enabled) {
auto_brace_completion_enabled = p_enabled;
}