summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/image.cpp329
-rw-r--r--core/image.h2
-rw-r--r--core/os/input_event.cpp8
-rw-r--r--core/os/input_event.h6
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp63
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h26
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp56
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h12
-rw-r--r--drivers/gles3/shaders/copy.glsl43
-rw-r--r--drivers/gles3/shaders/cubemap_filter.glsl35
-rw-r--r--editor/editor_audio_buses.cpp4
-rw-r--r--editor/editor_node.cpp264
-rw-r--r--editor/editor_node.h7
-rw-r--r--editor/editor_settings.cpp16
-rw-r--r--editor/editor_themes.cpp23
-rw-r--r--editor/import/resource_importer_csv_translation.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp4
-rw-r--r--editor/plugins/path_editor_plugin.cpp399
-rw-r--r--editor/plugins/path_editor_plugin.h32
-rw-r--r--editor/script_create_dialog.cpp2
-rw-r--r--main/input_default.cpp2
-rw-r--r--methods.py118
-rw-r--r--modules/gdnative/godot/godot_array.cpp10
-rw-r--r--modules/gdnative/godot/godot_array.h2
-rw-r--r--modules/gdnative/godot/godot_dictionary.cpp9
-rw-r--r--modules/gdnative/godot/godot_dictionary.h2
-rw-r--r--modules/squish/image_compress_squish.cpp42
-rw-r--r--modules/squish/image_compress_squish.h1
-rw-r--r--modules/squish/register_types.cpp1
-rw-r--r--platform/iphone/app_delegate.mm8
-rw-r--r--platform/iphone/detect.py17
-rw-r--r--platform/iphone/ios.h2
-rw-r--r--platform/iphone/ios.mm5
-rw-r--r--platform/iphone/os_iphone.cpp25
-rw-r--r--platform/iphone/os_iphone.h2
-rw-r--r--platform/uwp/app.cpp117
-rw-r--r--platform/uwp/detect.py15
-rw-r--r--platform/uwp/gl_context_egl.cpp2
-rw-r--r--platform/uwp/os_uwp.cpp29
-rw-r--r--platform/uwp/os_uwp.h4
-rw-r--r--platform/windows/os_windows.cpp2
-rw-r--r--platform/windows/os_windows.h3
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--scene/register_scene_types.cpp4
-rw-r--r--scene/resources/environment.cpp70
-rw-r--r--scene/resources/environment.h20
-rw-r--r--scene/resources/sky_box.cpp119
-rw-r--r--scene/resources/sky_box.h35
-rw-r--r--scene/resources/texture.cpp7
-rw-r--r--scene/resources/texture.h2
-rw-r--r--servers/visual/rasterizer.h12
-rw-r--r--servers/visual/visual_server_raster.h10
-rw-r--r--servers/visual_server.h14
53 files changed, 847 insertions, 1199 deletions
diff --git a/core/image.cpp b/core/image.cpp
index 85ca63be5e..316faf954e 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -1370,7 +1370,7 @@ Error Image::load(const String &p_path) {
return ImageLoader::load_image(p_path, this);
}
-Error Image::save_png(const String &p_path) {
+Error Image::save_png(const String &p_path) const {
if (save_png_func == NULL)
return ERR_UNAVAILABLE;
@@ -1391,337 +1391,14 @@ int Image::get_image_required_mipmaps(int p_width, int p_height, Format p_format
return mm;
}
-Error Image::_decompress_bc() {
-
- int wd = width, ht = height;
- if (wd % 4 != 0) {
- wd += 4 - (wd % 4);
- }
- if (ht % 4 != 0) {
- ht += 4 - (ht % 4);
- }
-
- int mm;
- int size = _get_dst_image_size(wd, ht, FORMAT_RGBA8, mm);
-
- PoolVector<uint8_t> newdata;
- newdata.resize(size);
-
- PoolVector<uint8_t>::Write w = newdata.write();
- PoolVector<uint8_t>::Read r = data.read();
-
- int rofs = 0;
- int wofs = 0;
-
- //print_line("width: "+itos(wd)+" height: "+itos(ht));
-
- for (int i = 0; i <= mm; i++) {
-
- switch (format) {
-
- case FORMAT_DXT1: {
-
- int len = (wd * ht) / 16;
- uint8_t *dst = &w[wofs];
-
- uint32_t ofs_table[16];
- for (int x = 0; x < 4; x++) {
-
- for (int y = 0; y < 4; y++) {
-
- ofs_table[15 - (y * 4 + (3 - x))] = (x + y * wd) * 4;
- }
- }
-
- for (int j = 0; j < len; j++) {
-
- const uint8_t *src = &r[rofs + j * 8];
- uint16_t col_a = src[1];
- col_a <<= 8;
- col_a |= src[0];
- uint16_t col_b = src[3];
- col_b <<= 8;
- col_b |= src[2];
-
- uint8_t table[4][4] = {
- { uint8_t((col_a >> 11) << 3), uint8_t(((col_a >> 5) & 0x3f) << 2), uint8_t(((col_a)&0x1f) << 3), 255 },
- { uint8_t((col_b >> 11) << 3), uint8_t(((col_b >> 5) & 0x3f) << 2), uint8_t(((col_b)&0x1f) << 3), 255 },
- { 0, 0, 0, 255 },
- { 0, 0, 0, 255 }
- };
-
- if (col_a < col_b) {
- //punchrough
- table[2][0] = (int(table[0][0]) + int(table[1][0])) >> 1;
- table[2][1] = (int(table[0][1]) + int(table[1][1])) >> 1;
- table[2][2] = (int(table[0][2]) + int(table[1][2])) >> 1;
- table[3][3] = 0; //premul alpha black
- } else {
- //gradient
- table[2][0] = (int(table[0][0]) * 2 + int(table[1][0])) / 3;
- table[2][1] = (int(table[0][1]) * 2 + int(table[1][1])) / 3;
- table[2][2] = (int(table[0][2]) * 2 + int(table[1][2])) / 3;
- table[3][0] = (int(table[0][0]) + int(table[1][0]) * 2) / 3;
- table[3][1] = (int(table[0][1]) + int(table[1][1]) * 2) / 3;
- table[3][2] = (int(table[0][2]) + int(table[1][2]) * 2) / 3;
- }
-
- uint32_t block = src[4];
- block <<= 8;
- block |= src[5];
- block <<= 8;
- block |= src[6];
- block <<= 8;
- block |= src[7];
-
- int y = (j / (wd / 4)) * 4;
- int x = (j % (wd / 4)) * 4;
- int pixofs = (y * wd + x) * 4;
-
- for (int k = 0; k < 16; k++) {
- int idx = pixofs + ofs_table[k];
- dst[idx + 0] = table[block & 0x3][0];
- dst[idx + 1] = table[block & 0x3][1];
- dst[idx + 2] = table[block & 0x3][2];
- dst[idx + 3] = table[block & 0x3][3];
- block >>= 2;
- }
- }
-
- rofs += len * 8;
- wofs += wd * ht * 4;
-
- wd /= 2;
- ht /= 2;
-
- } break;
- case FORMAT_DXT3: {
-
- int len = (wd * ht) / 16;
- uint8_t *dst = &w[wofs];
-
- uint32_t ofs_table[16];
- for (int x = 0; x < 4; x++) {
-
- for (int y = 0; y < 4; y++) {
-
- ofs_table[15 - (y * 4 + (3 - x))] = (x + y * wd) * 4;
- }
- }
-
- for (int j = 0; j < len; j++) {
-
- const uint8_t *src = &r[rofs + j * 16];
-
- uint64_t ablock = src[1];
- ablock <<= 8;
- ablock |= src[0];
- ablock <<= 8;
- ablock |= src[3];
- ablock <<= 8;
- ablock |= src[2];
- ablock <<= 8;
- ablock |= src[5];
- ablock <<= 8;
- ablock |= src[4];
- ablock <<= 8;
- ablock |= src[7];
- ablock <<= 8;
- ablock |= src[6];
-
- uint16_t col_a = src[8 + 1];
- col_a <<= 8;
- col_a |= src[8 + 0];
- uint16_t col_b = src[8 + 3];
- col_b <<= 8;
- col_b |= src[8 + 2];
-
- uint8_t table[4][4] = {
- { uint8_t((col_a >> 11) << 3), uint8_t(((col_a >> 5) & 0x3f) << 2), uint8_t(((col_a)&0x1f) << 3), 255 },
- { uint8_t((col_b >> 11) << 3), uint8_t(((col_b >> 5) & 0x3f) << 2), uint8_t(((col_b)&0x1f) << 3), 255 },
-
- { 0, 0, 0, 255 },
- { 0, 0, 0, 255 }
- };
-
- //always gradient
- table[2][0] = (int(table[0][0]) * 2 + int(table[1][0])) / 3;
- table[2][1] = (int(table[0][1]) * 2 + int(table[1][1])) / 3;
- table[2][2] = (int(table[0][2]) * 2 + int(table[1][2])) / 3;
- table[3][0] = (int(table[0][0]) + int(table[1][0]) * 2) / 3;
- table[3][1] = (int(table[0][1]) + int(table[1][1]) * 2) / 3;
- table[3][2] = (int(table[0][2]) + int(table[1][2]) * 2) / 3;
-
- uint32_t block = src[4 + 8];
- block <<= 8;
- block |= src[5 + 8];
- block <<= 8;
- block |= src[6 + 8];
- block <<= 8;
- block |= src[7 + 8];
-
- int y = (j / (wd / 4)) * 4;
- int x = (j % (wd / 4)) * 4;
- int pixofs = (y * wd + x) * 4;
-
- for (int k = 0; k < 16; k++) {
- uint8_t alpha = ablock & 0xf;
- alpha = int(alpha) * 255 / 15; //right way for alpha
- int idx = pixofs + ofs_table[k];
- dst[idx + 0] = table[block & 0x3][0];
- dst[idx + 1] = table[block & 0x3][1];
- dst[idx + 2] = table[block & 0x3][2];
- dst[idx + 3] = alpha;
- block >>= 2;
- ablock >>= 4;
- }
- }
-
- rofs += len * 16;
- wofs += wd * ht * 4;
-
- wd /= 2;
- ht /= 2;
-
- } break;
- case FORMAT_DXT5: {
-
- int len = (wd * ht) / 16;
- uint8_t *dst = &w[wofs];
-
- uint32_t ofs_table[16];
- for (int x = 0; x < 4; x++) {
-
- for (int y = 0; y < 4; y++) {
-
- ofs_table[15 - (y * 4 + (3 - x))] = (x + y * wd) * 4;
- }
- }
-
- for (int j = 0; j < len; j++) {
-
- const uint8_t *src = &r[rofs + j * 16];
-
- uint8_t a_start = src[1];
- uint8_t a_end = src[0];
-
- uint64_t ablock = src[3];
- ablock <<= 8;
- ablock |= src[2];
- ablock <<= 8;
- ablock |= src[5];
- ablock <<= 8;
- ablock |= src[4];
- ablock <<= 8;
- ablock |= src[7];
- ablock <<= 8;
- ablock |= src[6];
-
- uint8_t atable[8];
-
- if (a_start > a_end) {
-
- atable[0] = (int(a_start) * 7 + int(a_end) * 0) / 7;
- atable[1] = (int(a_start) * 6 + int(a_end) * 1) / 7;
- atable[2] = (int(a_start) * 5 + int(a_end) * 2) / 7;
- atable[3] = (int(a_start) * 4 + int(a_end) * 3) / 7;
- atable[4] = (int(a_start) * 3 + int(a_end) * 4) / 7;
- atable[5] = (int(a_start) * 2 + int(a_end) * 5) / 7;
- atable[6] = (int(a_start) * 1 + int(a_end) * 6) / 7;
- atable[7] = (int(a_start) * 0 + int(a_end) * 7) / 7;
- } else {
-
- atable[0] = (int(a_start) * 5 + int(a_end) * 0) / 5;
- atable[1] = (int(a_start) * 4 + int(a_end) * 1) / 5;
- atable[2] = (int(a_start) * 3 + int(a_end) * 2) / 5;
- atable[3] = (int(a_start) * 2 + int(a_end) * 3) / 5;
- atable[4] = (int(a_start) * 1 + int(a_end) * 4) / 5;
- atable[5] = (int(a_start) * 0 + int(a_end) * 5) / 5;
- atable[6] = 0;
- atable[7] = 255;
- }
-
- uint16_t col_a = src[8 + 1];
- col_a <<= 8;
- col_a |= src[8 + 0];
- uint16_t col_b = src[8 + 3];
- col_b <<= 8;
- col_b |= src[8 + 2];
-
- uint8_t table[4][4] = {
- { uint8_t((col_a >> 11) << 3), uint8_t(((col_a >> 5) & 0x3f) << 2), uint8_t(((col_a)&0x1f) << 3), 255 },
- { uint8_t((col_b >> 11) << 3), uint8_t(((col_b >> 5) & 0x3f) << 2), uint8_t(((col_b)&0x1f) << 3), 255 },
-
- { 0, 0, 0, 255 },
- { 0, 0, 0, 255 }
- };
-
- //always gradient
- table[2][0] = (int(table[0][0]) * 2 + int(table[1][0])) / 3;
- table[2][1] = (int(table[0][1]) * 2 + int(table[1][1])) / 3;
- table[2][2] = (int(table[0][2]) * 2 + int(table[1][2])) / 3;
- table[3][0] = (int(table[0][0]) + int(table[1][0]) * 2) / 3;
- table[3][1] = (int(table[0][1]) + int(table[1][1]) * 2) / 3;
- table[3][2] = (int(table[0][2]) + int(table[1][2]) * 2) / 3;
-
- uint32_t block = src[4 + 8];
- block <<= 8;
- block |= src[5 + 8];
- block <<= 8;
- block |= src[6 + 8];
- block <<= 8;
- block |= src[7 + 8];
-
- int y = (j / (wd / 4)) * 4;
- int x = (j % (wd / 4)) * 4;
- int pixofs = (y * wd + x) * 4;
-
- for (int k = 0; k < 16; k++) {
- uint8_t alpha = ablock & 0x7;
- int idx = pixofs + ofs_table[k];
- dst[idx + 0] = table[block & 0x3][0];
- dst[idx + 1] = table[block & 0x3][1];
- dst[idx + 2] = table[block & 0x3][2];
- dst[idx + 3] = atable[alpha];
- block >>= 2;
- ablock >>= 3;
- }
- }
-
- rofs += len * 16;
- wofs += wd * ht * 4;
-
- wd /= 2;
- ht /= 2;
-
- } break;
- default: {}
- }
- }
-
- w = PoolVector<uint8_t>::Write();
- r = PoolVector<uint8_t>::Read();
-
- data = newdata;
- format = FORMAT_RGBA8;
- if (wd != width || ht != height) {
-
- SWAP(width, wd);
- SWAP(height, ht);
- crop(wd, ht);
- }
-
- return OK;
-}
-
bool Image::is_compressed() const {
return format >= FORMAT_RGB565;
}
Error Image::decompress() {
- if (format >= FORMAT_DXT1 && format <= FORMAT_ATI2)
- _decompress_bc(); //_image_decompress_bc(this);
+ if (format >= FORMAT_DXT1 && format <= FORMAT_ATI2 && _image_decompress_bc)
+ _image_decompress_bc(this);
else if (format >= FORMAT_PVRTC2 && format <= FORMAT_PVRTC4A && _image_decompress_pvrtc)
_image_decompress_pvrtc(this);
else if (format == FORMAT_ETC && _image_decompress_etc)
diff --git a/core/image.h b/core/image.h
index 4decaa3436..273e2d0ab7 100644
--- a/core/image.h
+++ b/core/image.h
@@ -227,7 +227,7 @@ public:
PoolVector<uint8_t> get_data() const;
Error load(const String &p_path);
- Error save_png(const String &p_path);
+ Error save_png(const String &p_path) const;
/**
* create an empty image
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 2538e8dad2..cf3b8f74ec 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -57,7 +57,7 @@ bool InputEvent::is_pressed() const {
bool InputEvent::is_action(const StringName &p_action) const {
- return InputMap::get_singleton()->event_is_action(Ref<InputEvent>(this), p_action);
+ return InputMap::get_singleton()->event_is_action(Ref<InputEvent>((InputEvent *)this), p_action);
}
bool InputEvent::is_action_pressed(const StringName &p_action) const {
@@ -229,7 +229,7 @@ void InputEventKey::set_pressed(bool p_pressed) {
pressed = p_pressed;
}
-bool InputEventKey::is_pressed() {
+bool InputEventKey::is_pressed() const {
return pressed;
}
@@ -461,7 +461,7 @@ void InputEventMouseButton::_bind_methods() {
InputEventMouseButton::InputEventMouseButton() {
- factor = 0;
+ factor = 1;
button_index = 0;
pressed = false;
doubleclick = false;
@@ -816,7 +816,7 @@ void InputEventAction::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &InputEventAction::set_pressed);
//ClassDB::bind_method(D_METHOD("is_pressed"), &InputEventAction::is_pressed);
- ClassDB::bind_method(D_METHOD("is_action", "name"), &InputEventAction::is_action);
+ // ClassDB::bind_method(D_METHOD("is_action", "name"), &InputEventAction::is_action);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "action"), "set_action", "get_action");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
diff --git a/core/os/input_event.h b/core/os/input_event.h
index b94f0ef46a..31f88b295b 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -229,7 +229,7 @@ protected:
public:
void set_pressed(bool p_pressed);
- bool is_pressed();
+ virtual bool is_pressed() const;
void set_scancode(uint32_t p_scancode);
uint32_t get_scancode() const;
@@ -238,7 +238,7 @@ public:
uint32_t get_unicode() const;
void set_echo(bool p_enable);
- bool is_echo() const;
+ virtual bool is_echo() const;
uint32_t get_scancode_with_modifiers() const;
@@ -377,7 +377,7 @@ public:
InputEventJoypadButton();
};
-struct InputEventScreenTouch : public InputEvent {
+class InputEventScreenTouch : public InputEvent {
GDCLASS(InputEventScreenTouch, InputEvent)
int index;
Vector2 pos;
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index a7996b09d3..5214de6d06 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -798,20 +798,20 @@ void RasterizerSceneGLES3::environment_set_background(RID p_env, VS::Environment
env->bg_mode = p_bg;
}
-void RasterizerSceneGLES3::environment_set_skybox(RID p_env, RID p_skybox) {
+void RasterizerSceneGLES3::environment_set_sky(RID p_env, RID p_sky) {
Environment *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
- env->skybox = p_skybox;
+ env->sky = p_sky;
}
-void RasterizerSceneGLES3::environment_set_skybox_scale(RID p_env, float p_scale) {
+void RasterizerSceneGLES3::environment_set_sky_scale(RID p_env, float p_scale) {
Environment *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
- env->skybox_scale = p_scale;
+ env->sky_scale = p_scale;
}
void RasterizerSceneGLES3::environment_set_bg_color(RID p_env, const Color &p_color) {
@@ -836,14 +836,14 @@ void RasterizerSceneGLES3::environment_set_canvas_max_layer(RID p_env, int p_max
env->canvas_max_layer = p_max_layer;
}
-void RasterizerSceneGLES3::environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy, float p_skybox_contribution) {
+void RasterizerSceneGLES3::environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy, float p_sky_contribution) {
Environment *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
env->ambient_color = p_color;
env->ambient_energy = p_energy;
- env->ambient_skybox_contribution = p_skybox_contribution;
+ env->ambient_sky_contribution = p_sky_contribution;
}
void RasterizerSceneGLES3::environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality) {
@@ -2120,12 +2120,12 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo
}
}
-void RasterizerSceneGLES3::_draw_skybox(RasterizerStorageGLES3::SkyBox *p_skybox, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale) {
+void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale) {
- if (!p_skybox)
+ if (!p_sky)
return;
- RasterizerStorageGLES3::Texture *tex = storage->texture_owner.getornull(p_skybox->cubemap);
+ RasterizerStorageGLES3::Texture *tex = storage->texture_owner.getornull(p_sky->panorama);
ERR_FAIL_COND(!tex);
glActiveTexture(GL_TEXTURE0);
@@ -2164,7 +2164,7 @@ void RasterizerSceneGLES3::_draw_skybox(RasterizerStorageGLES3::SkyBox *p_skybox
};
- //skybox uv vectors
+ //sky uv vectors
float vw, vh, zn;
p_projection.get_viewport_size(vw, vh);
zn = p_projection.get_z_near();
@@ -2181,13 +2181,13 @@ void RasterizerSceneGLES3::_draw_skybox(RasterizerStorageGLES3::SkyBox *p_skybox
vertices[i * 2 + 1].z = -vertices[i * 2 + 1].z;
}
- glBindBuffer(GL_ARRAY_BUFFER, state.skybox_verts);
+ glBindBuffer(GL_ARRAY_BUFFER, state.sky_verts);
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector3) * 8, vertices);
glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind
- glBindVertexArray(state.skybox_array);
+ glBindVertexArray(state.sky_array);
- storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_CUBEMAP, true);
+ storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_PANORAMA, true);
storage->shaders.copy.bind();
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
@@ -2195,7 +2195,7 @@ void RasterizerSceneGLES3::_draw_skybox(RasterizerStorageGLES3::SkyBox *p_skybox
glBindVertexArray(0);
glColorMask(1, 1, 1, 1);
- storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_CUBEMAP, false);
+ storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_PANORAMA, false);
}
void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform) {
@@ -2239,7 +2239,7 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatr
state.ubo_data.bg_color[2] = bg_color.b;
state.ubo_data.bg_color[3] = bg_color.a;
- state.env_radiance_data.ambient_contribution = env->ambient_skybox_contribution;
+ state.env_radiance_data.ambient_contribution = env->ambient_sky_contribution;
state.ubo_data.ambient_occlusion_affect_light = env->ssao_light_affect;
} else {
state.ubo_data.bg_energy = 1.0;
@@ -2683,7 +2683,7 @@ void RasterizerSceneGLES3::_setup_reflections(RID *p_reflection_probe_cull_resul
ambient_linear.r *= p_env->ambient_energy;
ambient_linear.g *= p_env->ambient_energy;
ambient_linear.b *= p_env->ambient_energy;
- contrib = p_env->ambient_skybox_contribution;
+ contrib = p_env->ambient_sky_contribution;
}
reflection_ubo.ambient[0] = ambient_linear.r;
@@ -3807,7 +3807,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
Color clear_color(0, 0, 0, 0);
- RasterizerStorageGLES3::SkyBox *skybox = NULL;
+ RasterizerStorageGLES3::Sky *sky = NULL;
GLuint env_radiance_tex = 0;
if (!env || env->bg_mode == VS::ENV_BG_CLEAR_COLOR) {
@@ -3822,12 +3822,12 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
clear_color = env->bg_color.to_linear();
storage->frame.clear_request = false;
- } else if (env->bg_mode == VS::ENV_BG_SKYBOX) {
+ } else if (env->bg_mode == VS::ENV_BG_SKY) {
- skybox = storage->skybox_owner.getornull(env->skybox);
+ sky = storage->sky_owner.getornull(env->sky);
- if (skybox) {
- env_radiance_tex = skybox->radiance;
+ if (sky) {
+ env_radiance_tex = sky->radiance;
}
storage->frame.clear_request = false;
@@ -3878,14 +3878,14 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glDrawBuffers(1, &gldb);
}
- if (env && env->bg_mode == VS::ENV_BG_SKYBOX) {
+ if (env && env->bg_mode == VS::ENV_BG_SKY) {
/*
if (use_mrt) {
- glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); //switch to alpha fbo for skybox, only diffuse/ambient matters
+ glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); //switch to alpha fbo for sky, only diffuse/ambient matters
*/
- _draw_skybox(skybox, p_cam_projection, p_cam_transform, storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP], env->skybox_scale);
+ _draw_sky(sky, p_cam_projection, p_cam_transform, storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP], env->sky_scale);
}
//_render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true);
@@ -4585,14 +4585,14 @@ void RasterizerSceneGLES3::initialize() {
{
//quad buffers
- glGenBuffers(1, &state.skybox_verts);
- glBindBuffer(GL_ARRAY_BUFFER, state.skybox_verts);
+ glGenBuffers(1, &state.sky_verts);
+ glBindBuffer(GL_ARRAY_BUFFER, state.sky_verts);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vector3) * 8, NULL, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind
- glGenVertexArrays(1, &state.skybox_array);
- glBindVertexArray(state.skybox_array);
- glBindBuffer(GL_ARRAY_BUFFER, state.skybox_verts);
+ glGenVertexArrays(1, &state.sky_array);
+ glBindVertexArray(state.sky_array);
+ glBindBuffer(GL_ARRAY_BUFFER, state.sky_verts);
glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3) * 2, 0);
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
glVertexAttribPointer(VS::ARRAY_TEX_UV, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3) * 2, ((uint8_t *)NULL) + sizeof(Vector3));
@@ -4831,7 +4831,12 @@ void RasterizerSceneGLES3::initialize() {
glGenTextures(1, &e.color);
glBindTexture(GL_TEXTURE_2D, e.color);
+#ifdef IPHONE_ENABLED
+ ///@TODO ugly hack to get around iOS not supporting 32bit single channel floating point textures...
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_R16F, max_exposure_shrink_size, max_exposure_shrink_size, 0, GL_RED, GL_FLOAT, NULL);
+#else
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, max_exposure_shrink_size, max_exposure_shrink_size, 0, GL_RED, GL_FLOAT, NULL);
+#endif
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, e.color, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index 33698fc267..69a7e40604 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -141,8 +141,8 @@ public:
GLuint brdf_texture;
- GLuint skybox_verts;
- GLuint skybox_array;
+ GLuint sky_verts;
+ GLuint sky_array;
GLuint directional_ubo;
@@ -329,16 +329,16 @@ public:
VS::EnvironmentBG bg_mode;
- RID skybox;
- float skybox_scale;
+ RID sky;
+ float sky_scale;
Color bg_color;
float bg_energy;
- float skybox_ambient;
+ float sky_ambient;
Color ambient_color;
float ambient_energy;
- float ambient_skybox_contribution;
+ float ambient_sky_contribution;
int canvas_max_layer;
@@ -393,11 +393,11 @@ public:
Environment() {
bg_mode = VS::ENV_BG_CLEAR_COLOR;
- skybox_scale = 1.0;
+ sky_scale = 1.0;
bg_energy = 1.0;
- skybox_ambient = 0;
+ sky_ambient = 0;
ambient_energy = 1.0;
- ambient_skybox_contribution = 0.0;
+ ambient_sky_contribution = 0.0;
canvas_max_layer = 0;
ssr_enabled = false;
@@ -455,12 +455,12 @@ public:
virtual RID environment_create();
virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg);
- virtual void environment_set_skybox(RID p_env, RID p_skybox);
- virtual void environment_set_skybox_scale(RID p_env, float p_scale);
+ virtual void environment_set_sky(RID p_env, RID p_sky);
+ virtual void environment_set_sky_scale(RID p_env, float p_scale);
virtual void environment_set_bg_color(RID p_env, const Color &p_color);
virtual void environment_set_bg_energy(RID p_env, float p_energy);
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer);
- virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_skybox_contribution = 0.0);
+ virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0);
virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality);
virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality);
@@ -700,7 +700,7 @@ public:
_FORCE_INLINE_ void _add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_shadow);
- void _draw_skybox(RasterizerStorageGLES3::SkyBox *p_skybox, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale);
+ void _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale);
void _setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform);
void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transformm, bool p_use_shadows);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 8749021a12..08ff687510 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1213,32 +1213,32 @@ RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source, int p_
return texture_owner.make_rid(ctex);
}
-RID RasterizerStorageGLES3::skybox_create() {
+RID RasterizerStorageGLES3::sky_create() {
- SkyBox *skybox = memnew(SkyBox);
- skybox->radiance = 0;
- return skybox_owner.make_rid(skybox);
+ Sky *sky = memnew(Sky);
+ sky->radiance = 0;
+ return sky_owner.make_rid(sky);
}
-void RasterizerStorageGLES3::skybox_set_texture(RID p_skybox, RID p_cube_map, int p_radiance_size) {
+void RasterizerStorageGLES3::sky_set_texture(RID p_sky, RID p_panorama, int p_radiance_size) {
- SkyBox *skybox = skybox_owner.getornull(p_skybox);
- ERR_FAIL_COND(!skybox);
+ Sky *sky = sky_owner.getornull(p_sky);
+ ERR_FAIL_COND(!sky);
- if (skybox->cubemap.is_valid()) {
- skybox->cubemap = RID();
- glDeleteTextures(1, &skybox->radiance);
- skybox->radiance = 0;
+ if (sky->panorama.is_valid()) {
+ sky->panorama = RID();
+ glDeleteTextures(1, &sky->radiance);
+ sky->radiance = 0;
}
- skybox->cubemap = p_cube_map;
- if (!skybox->cubemap.is_valid())
+ sky->panorama = p_panorama;
+ if (!sky->panorama.is_valid())
return; //cleared
- Texture *texture = texture_owner.getornull(skybox->cubemap);
- if (!texture || !(texture->flags & VS::TEXTURE_FLAG_CUBEMAP)) {
- skybox->cubemap = RID();
- ERR_FAIL_COND(!texture || !(texture->flags & VS::TEXTURE_FLAG_CUBEMAP));
+ Texture *texture = texture_owner.getornull(sky->panorama);
+ if (!texture) {
+ sky->panorama = RID();
+ ERR_FAIL_COND(!texture);
}
glBindVertexArray(0);
@@ -1263,8 +1263,8 @@ void RasterizerStorageGLES3::skybox_set_texture(RID p_skybox, RID p_cube_map, in
}
glActiveTexture(GL_TEXTURE1);
- glGenTextures(1, &skybox->radiance);
- glBindTexture(GL_TEXTURE_2D, skybox->radiance);
+ glGenTextures(1, &sky->radiance);
+ glBindTexture(GL_TEXTURE_2D, sky->radiance);
GLuint tmp_fb;
@@ -1304,11 +1304,12 @@ void RasterizerStorageGLES3::skybox_set_texture(RID p_skybox, RID p_cube_map, in
size = p_radiance_size;
shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID, true);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_PANORAMA, true);
shaders.cubemap_filter.bind();
while (mm_level) {
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, skybox->radiance, lod);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, sky->radiance, lod);
#ifdef DEBUG_ENABLED
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
ERR_CONTINUE(status != GL_FRAMEBUFFER_COMPLETE);
@@ -1331,6 +1332,7 @@ void RasterizerStorageGLES3::skybox_set_texture(RID p_skybox, RID p_cube_map, in
mm_level--;
}
shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID, false);
+ shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_PANORAMA, false);
//restore ranges
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
@@ -6116,12 +6118,12 @@ bool RasterizerStorageGLES3::free(RID p_rid) {
info.texture_mem -= texture->total_data_size;
texture_owner.free(p_rid);
memdelete(texture);
- } else if (skybox_owner.owns(p_rid)) {
- // delete the skybox
- SkyBox *skybox = skybox_owner.get(p_rid);
- skybox_set_texture(p_rid, RID(), 256);
- skybox_owner.free(p_rid);
- memdelete(skybox);
+ } else if (sky_owner.owns(p_rid)) {
+ // delete the sky
+ Sky *sky = sky_owner.get(p_rid);
+ sky_set_texture(p_rid, RID(), 256);
+ sky_owner.free(p_rid);
+ memdelete(sky);
} else if (shader_owner.owns(p_rid)) {
@@ -6478,7 +6480,7 @@ void RasterizerStorageGLES3::initialize() {
glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind
}
- //generic quadie for copying without touching skybox
+ //generic quadie for copying without touching sky
{
//transform feedback buffers
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 7cae58852d..26b7cea45e 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -308,19 +308,19 @@ public:
virtual void texture_set_detect_3d_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
virtual void texture_set_detect_srgb_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
- /* SKYBOX API */
+ /* SKY API */
- struct SkyBox : public RID_Data {
+ struct Sky : public RID_Data {
- RID cubemap;
+ RID panorama;
GLuint radiance;
int radiance_size;
};
- mutable RID_Owner<SkyBox> skybox_owner;
+ mutable RID_Owner<Sky> sky_owner;
- virtual RID skybox_create();
- virtual void skybox_set_texture(RID p_skybox, RID p_cube_map, int p_radiance_size);
+ virtual RID sky_create();
+ virtual void sky_set_texture(RID p_sky, RID p_panorama, int p_radiance_size);
/* SHADER API */
diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl
index a87d62f2d7..f3c72a4e6f 100644
--- a/drivers/gles3/shaders/copy.glsl
+++ b/drivers/gles3/shaders/copy.glsl
@@ -2,14 +2,14 @@
layout(location=0) in highp vec4 vertex_attrib;
-#ifdef USE_CUBEMAP
+#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
layout(location=4) in vec3 cube_in;
#else
layout(location=4) in vec2 uv_in;
#endif
layout(location=5) in vec2 uv2_in;
-#ifdef USE_CUBEMAP
+#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
out vec3 cube_interp;
#else
out vec2 uv_interp;
@@ -19,7 +19,7 @@ out vec2 uv2_interp;
void main() {
-#ifdef USE_CUBEMAP
+#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
cube_interp = cube_in;
#else
uv_interp = uv_in;
@@ -30,15 +30,40 @@ void main() {
[fragment]
+#define M_PI 3.14159265359
-#ifdef USE_CUBEMAP
+
+#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
in vec3 cube_interp;
-uniform samplerCube source_cube; //texunit:0
#else
in vec2 uv_interp;
+#endif
+
+#ifdef USE_CUBEMAP
+uniform samplerCube source_cube; //texunit:0
+#else
uniform sampler2D source; //texunit:0
#endif
+#ifdef USE_PANORAMA
+
+vec4 texturePanorama(vec3 normal,sampler2D pano ) {
+
+ vec2 st = vec2(
+ atan(normal.x, normal.z),
+ acos(normal.y)
+ );
+
+ if(st.x < 0.0)
+ st.x += M_PI*2.0;
+
+ st/=vec2(M_PI*2.0,M_PI);
+
+ return textureLod(pano,st,0.0);
+
+}
+
+#endif
float sRGB_gamma_correct(float c){
float a = 0.055;
@@ -60,13 +85,19 @@ void main() {
//vec4 color = color_interp;
-#ifdef USE_CUBEMAP
+#ifdef USE_PANORAMA
+
+ vec4 color = texturePanorama( normalize(cube_interp), source );
+
+#elif defined(USE_CUBEMAP)
vec4 color = texture( source_cube, normalize(cube_interp) );
#else
vec4 color = texture( source, uv_interp );
#endif
+
+
#ifdef LINEAR_TO_SRGB
//regular Linear -> SRGB conversion
vec3 a = vec3(0.055);
diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl
index 768d20ad22..2aec6380f5 100644
--- a/drivers/gles3/shaders/cubemap_filter.glsl
+++ b/drivers/gles3/shaders/cubemap_filter.glsl
@@ -19,8 +19,12 @@ void main() {
precision highp float;
precision highp int;
-
+#ifdef USE_PANORAMA
+uniform sampler2D source_panorama; //texunit:0
+#else
uniform samplerCube source_cube; //texunit:0
+#endif
+
uniform int face_id;
uniform float roughness;
in highp vec2 uv_interp;
@@ -165,6 +169,26 @@ vec2 Hammersley(uint i, uint N) {
uniform bool z_flip;
+#ifdef USE_PANORAMA
+
+vec4 texturePanorama(vec3 normal,sampler2D pano ) {
+
+ vec2 st = vec2(
+ atan(normal.x, normal.z),
+ acos(normal.y)
+ );
+
+ if(st.x < 0.0)
+ st.x += M_PI*2.0;
+
+ st/=vec2(M_PI*2.0,M_PI);
+
+ return textureLod(pano,st,0.0);
+
+}
+
+#endif
+
void main() {
#ifdef USE_DUAL_PARABOLOID
@@ -188,7 +212,12 @@ void main() {
#ifdef USE_DIRECT_WRITE
+#ifdef USE_PANORAMA
+
+ frag_color=vec4(texturePanorama(N,source_panorama).rgb,1.0);
+#else
frag_color=vec4(texture(N,source_cube).rgb,1.0);
+#endif
#else
@@ -204,7 +233,11 @@ void main() {
float ndotl = clamp(dot(N, L),0.0,1.0);
if (ndotl>0.0) {
+#ifdef USE_PANORAMA
+ sum.rgb += texturePanorama(H,source_panorama).rgb *ndotl;
+#else
sum.rgb += textureLod(source_cube, H, 0.0).rgb *ndotl;
+#endif
sum.a += ndotl;
}
}
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index f60186e3b4..26029261b2 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -1108,9 +1108,9 @@ EditorAudioBuses::EditorAudioBuses() {
file_dialog = memnew(EditorFileDialog);
List<String> ext;
- ResourceLoader::get_recognized_extensions_for_type("AudioServerState", &ext);
+ ResourceLoader::get_recognized_extensions_for_type("AudioBusLayout", &ext);
for (List<String>::Element *E = ext.front(); E; E = E->next()) {
- file_dialog->add_filter("*." + E->get() + "; Audio Bus State");
+ file_dialog->add_filter("*." + E->get() + "; Audio Bus Layout");
}
add_child(file_dialog);
file_dialog->connect("file_selected", this, "_file_dialog_callback");
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 4ecb292027..fd1ecc78b9 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -269,29 +269,8 @@ void EditorNode::_notification(int p_what) {
update_menu->set_icon(gui_base->get_icon("Progress" + itos(circle_step + 1), "EditorIcons"));
}
}
-
editor_selection->update();
- {
- uint32_t p32 = 0; //AudioServer::get_singleton()->read_output_peak()>>8;
-
- float peak = p32 == 0 ? -80 : Math::linear2db(p32 / 65535.0);
-
- if (peak < -80)
- peak = -80;
- float vu = audio_vu->get_value();
-
- if (peak > vu) {
- audio_vu->set_value(peak);
- } else {
- float new_vu = vu - get_process_delta_time() * 70.0;
- if (new_vu < -80)
- new_vu = -80;
- if (new_vu != -80 && vu != -80)
- audio_vu->set_value(new_vu);
- }
- }
-
ResourceImporterTexture::get_singleton()->update_imports();
}
if (p_what == NOTIFICATION_ENTER_TREE) {
@@ -2457,28 +2436,28 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case RUN_FILE_SERVER: {
//file_server
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_FILE_SERVER));
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER));
if (ischecked) {
file_server->stop();
run_native->set_deploy_dumb(false);
- //debug_button->set_icon(gui_base->get_icon("FileServer","EditorIcons"));
- //debug_button->get_popup()->set_item_text( debug_button->get_popup()->get_item_index(RUN_FILE_SERVER),"Enable File Server");
+ //debug_menu->set_icon(gui_base->get_icon("FileServer","EditorIcons"));
+ //debug_menu->get_popup()->set_item_text( debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER),"Enable File Server");
} else {
file_server->start();
run_native->set_deploy_dumb(true);
- //debug_button->set_icon(gui_base->get_icon("FileServerActive","EditorIcons"));
- //debug_button->get_popup()->set_item_text( debug_button->get_popup()->get_item_index(RUN_FILE_SERVER),"Disable File Server");
+ //debug_menu->set_icon(gui_base->get_icon("FileServerActive","EditorIcons"));
+ //debug_menu->get_popup()->set_item_text( debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER),"Disable File Server");
}
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_FILE_SERVER), !ischecked);
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER), !ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_file_server", !ischecked);
} break;
case RUN_LIVE_DEBUG: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_LIVE_DEBUG));
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_LIVE_DEBUG));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_LIVE_DEBUG), !ischecked);
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_LIVE_DEBUG), !ischecked);
ScriptEditor::get_singleton()->get_debugger()->set_live_debugging(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_live_debug", !ischecked);
@@ -2486,23 +2465,23 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
/*case RUN_DEPLOY_DUMB_CLIENTS: {
- bool ischecked = debug_button->get_popup()->is_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS));
- debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),!ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked( debug_menu->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS));
+ debug_menu->get_popup()->set_item_checked( debug_menu->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),!ischecked);
run_native->set_deploy_dumb(!ischecked);
} break;*/
case RUN_DEPLOY_REMOTE_DEBUG: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG), !ischecked);
run_native->set_deploy_debug_remote(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_deploy_remote_debug", !ischecked);
} break;
case RUN_DEBUG_COLLISONS: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_COLLISONS));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_COLLISONS), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_COLLISONS));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_COLLISONS), !ischecked);
run_native->set_debug_collisions(!ischecked);
editor_run.set_debug_collisions(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_collisons", !ischecked);
@@ -2510,8 +2489,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case RUN_DEBUG_NAVIGATION: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION), !ischecked);
run_native->set_debug_navigation(!ischecked);
editor_run.set_debug_navigation(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_navigation", !ischecked);
@@ -2519,8 +2498,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case RUN_RELOAD_SCRIPTS: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS), !ischecked);
ScriptEditor::get_singleton()->set_live_auto_reload_running_scripts(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_reload_scripts", !ischecked);
@@ -5166,7 +5145,17 @@ EditorNode::EditorNode() {
scene_tabs->connect("right_button_pressed", this, "_scene_tab_script_edited");
scene_tabs->connect("tab_close", this, "_scene_tab_closed");
- srt->add_child(scene_tabs);
+ HBoxContainer *tabbar_container = memnew(HBoxContainer);
+ scene_tabs->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+
+ srt->add_child(tabbar_container);
+ tabbar_container->add_child(scene_tabs);
+ distraction_free = memnew(ToolButton);
+ tabbar_container->add_child(distraction_free);
+ distraction_free->set_shortcut(ED_SHORTCUT("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11));
+ distraction_free->connect("pressed", this, "_toggle_distraction_free_mode");
+ distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons"));
+ distraction_free->set_toggle_mode(true);
scene_root_parent = memnew(PanelContainer);
scene_root_parent->set_custom_minimum_size(Size2(0, 80) * EDSCALE);
@@ -5210,6 +5199,33 @@ EditorNode::EditorNode() {
PopupMenu *p;
+ project_menu = memnew(MenuButton);
+ project_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools."));
+ project_menu->set_text(TTR("Project"));
+ project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ left_menu_hb->add_child(project_menu);
+
+ p = project_menu->get_popup();
+ p->connect("id_pressed", this, "_menu_option");
+ p->add_item(TTR("Run Script"), FILE_RUN_SCRIPT, KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_R);
+ p->add_item(TTR("Export"), FILE_EXPORT_PROJECT);
+
+ PopupMenu *tool_menu = memnew(PopupMenu);
+ tool_menu->set_name("Tools");
+ tool_menu->connect("id_pressed", this, "_menu_option");
+ p->add_child(tool_menu);
+ p->add_submenu_item(TTR("Tools"), "Tools");
+ tool_menu->add_item(TTR("Orphan Resource Explorer"), TOOLS_ORPHAN_RESOURCES);
+ p->add_separator();
+ p->add_item(TTR("Project Settings"), RUN_SETTINGS);
+ p->add_separator();
+#ifdef OSX_ENABLED
+ p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q);
+#else
+ p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_Q);
+#endif
+ p->add_item(TTR("Quit"), FILE_QUIT, KEY_MASK_CMD + KEY_Q);
+
file_menu = memnew(MenuButton);
file_menu->set_text(TTR("Scene"));
//file_menu->set_icon(gui_base->get_icon("Save","EditorIcons"));
@@ -5262,18 +5278,7 @@ EditorNode::EditorNode() {
p->add_shortcut(ED_SHORTCUT("editor/undo", TTR("Undo"), KEY_MASK_CMD + KEY_Z), EDIT_UNDO, true);
p->add_shortcut(ED_SHORTCUT("editor/redo", TTR("Redo"), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_Z), EDIT_REDO, true);
p->add_separator();
- p->add_item(TTR("Run Script"), FILE_RUN_SCRIPT, KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_R);
- p->add_separator();
- p->add_item(TTR("Project Settings"), RUN_SETTINGS);
- p->add_separator();
p->add_item(TTR("Revert Scene"), EDIT_REVERT);
- p->add_separator();
-#ifdef OSX_ENABLED
- p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q);
-#else
- p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_Q);
-#endif
- p->add_item(TTR("Quit"), FILE_QUIT, KEY_MASK_CMD + KEY_Q);
recent_scenes = memnew(PopupMenu);
recent_scenes->set_name("RecentScenes");
@@ -5289,14 +5294,9 @@ EditorNode::EditorNode() {
PanelContainer *editor_region = memnew(PanelContainer);
main_editor_button_vb = memnew(HBoxContainer);
editor_region->add_child(main_editor_button_vb);
- menu_hb->add_child(editor_region);
- distraction_free = memnew(ToolButton);
- main_editor_button_vb->add_child(distraction_free);
- distraction_free->set_shortcut(ED_SHORTCUT("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11));
- distraction_free->connect("pressed", this, "_toggle_distraction_free_mode");
- distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons"));
- distraction_free->set_toggle_mode(true);
+ menu_hb->add_spacer();
+ menu_hb->add_child(editor_region);
//menu_hb->add_spacer();
#if 0
@@ -5327,27 +5327,54 @@ EditorNode::EditorNode() {
menu_panel->add_child( resource_menu );
#endif
- tool_menu = memnew(MenuButton);
- tool_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools."));
- tool_menu->set_text(TTR("Tools"));
- tool_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ debug_menu = memnew(MenuButton);
+ debug_menu->set_text(TTR("Debug"));
+ debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ left_menu_hb->add_child(debug_menu);
+ p = debug_menu->get_popup();
+ p->set_hide_on_item_selection(false);
+ p->add_check_item(TTR("Deploy with Remote Debug"), RUN_DEPLOY_REMOTE_DEBUG);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When exporting or deploying, the resulting executable will attempt to connect to the IP of this computer in order to be debugged."));
+ p->add_check_item(TTR("Small Deploy with Network FS"), RUN_FILE_SERVER);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is enabled, export or deploy will produce a minimal executable.\nThe filesystem will be provided from the project by the editor over the network.\nOn Android, deploy will use the USB cable for faster performance. This option speeds up testing for games with a large footprint."));
+ p->add_separator();
+ p->add_check_item(TTR("Visible Collision Shapes"), RUN_DEBUG_COLLISONS);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("Collision shapes and raycast nodes (for 2D and 3D) will be visible on the running game if this option is turned on."));
+ p->add_check_item(TTR("Visible Navigation"), RUN_DEBUG_NAVIGATION);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("Navigation meshes and polygons will be visible on the running game if this option is turned on."));
+ p->add_separator();
+ p->add_check_item(TTR("Sync Scene Changes"), RUN_LIVE_DEBUG);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any changes made to the scene in the editor will be replicated in the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
+ p->add_check_item(TTR("Sync Script Changes"), RUN_RELOAD_SCRIPTS);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any script that is saved will be reloaded on the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
+ p->connect("id_pressed", this, "_menu_option");
- //tool_menu->set_icon(gui_base->get_icon("Save","EditorIcons"));
- left_menu_hb->add_child(tool_menu);
+ menu_hb->add_spacer();
- p = tool_menu->get_popup();
- p->connect("id_pressed", this, "_menu_option");
- p->add_item(TTR("Orphan Resource Explorer"), TOOLS_ORPHAN_RESOURCES);
+ settings_menu = memnew(MenuButton);
+ left_menu_hb->add_child(settings_menu);
+ settings_menu->set_text(TTR("Editor"));
+ settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ //settings_menu->set_anchor(MARGIN_RIGHT,ANCHOR_END);
+ p = settings_menu->get_popup();
- export_button = memnew(ToolButton);
- export_button->set_tooltip(TTR("Export the project to many platforms."));
- export_button->set_text(TTR("Export"));
- export_button->connect("pressed", this, "_menu_option", varray(FILE_EXPORT_PROJECT));
- export_button->set_focus_mode(Control::FOCUS_NONE);
- export_button->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
- left_menu_hb->add_child(export_button);
+ //p->add_item("Export Settings",SETTINGS_EXPORT_PREFERENCES);
+ p->add_item(TTR("Editor Settings"), SETTINGS_PREFERENCES);
+ //p->add_item("Optimization Presets",SETTINGS_OPTIMIZED_PRESETS);
+ p->add_separator();
+ editor_layouts = memnew(PopupMenu);
+ editor_layouts->set_name("Layouts");
+ p->add_child(editor_layouts);
+ editor_layouts->connect("id_pressed", this, "_layout_menu_option");
+ p->add_submenu_item(TTR("Editor Layout"), "Layouts");
- menu_hb->add_spacer();
+ p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREN);
+
+ p->add_separator();
+ p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES);
+ p->add_separator();
+ p->add_item(TTR("About"), SETTINGS_ABOUT);
//Separator *s1 = memnew( VSeparator );
//menu_panel->add_child(s1);
@@ -5356,7 +5383,7 @@ EditorNode::EditorNode() {
play_cc = memnew(CenterContainer);
play_cc->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
- gui_base->add_child(play_cc);
+ menu_hb->add_child(play_cc);
play_cc->set_area_as_parent_rect();
play_cc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_BEGIN, 10);
play_cc->set_margin(MARGIN_TOP, 5);
@@ -5427,33 +5454,6 @@ EditorNode::EditorNode() {
play_custom_scene_button->set_tooltip(TTR("Play custom scene"));
play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5));
- debug_button = memnew(MenuButton);
- debug_button->set_flat(true);
- play_hb->add_child(debug_button);
- //debug_button->set_toggle_mode(true);
- debug_button->set_focus_mode(Control::FOCUS_NONE);
- debug_button->set_icon(gui_base->get_icon("Remote", "EditorIcons"));
- //debug_button->connect("pressed", this,"_menu_option",make_binds(RUN_LIVE_DEBUG));
- debug_button->set_tooltip(TTR("Debug options"));
-
- p = debug_button->get_popup();
- p->set_hide_on_item_selection(false);
- p->add_check_item(TTR("Deploy with Remote Debug"), RUN_DEPLOY_REMOTE_DEBUG);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When exporting or deploying, the resulting executable will attempt to connect to the IP of this computer in order to be debugged."));
- p->add_check_item(TTR("Small Deploy with Network FS"), RUN_FILE_SERVER);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is enabled, export or deploy will produce a minimal executable.\nThe filesystem will be provided from the project by the editor over the network.\nOn Android, deploy will use the USB cable for faster performance. This option speeds up testing for games with a large footprint."));
- p->add_separator();
- p->add_check_item(TTR("Visible Collision Shapes"), RUN_DEBUG_COLLISONS);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("Collision shapes and raycast nodes (for 2D and 3D) will be visible on the running game if this option is turned on."));
- p->add_check_item(TTR("Visible Navigation"), RUN_DEBUG_NAVIGATION);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("Navigation meshes and polygons will be visible on the running game if this option is turned on."));
- p->add_separator();
- p->add_check_item(TTR("Sync Scene Changes"), RUN_LIVE_DEBUG);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any changes made to the scene in the editor will be replicated in the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
- p->add_check_item(TTR("Sync Script Changes"), RUN_RELOAD_SCRIPTS);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any script that is saved will be reloaded on the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
- p->connect("id_pressed", this, "_menu_option");
-
/*
run_settings_button = memnew( ToolButton );
//menu_hb->add_child(run_settings_button);
@@ -5473,62 +5473,24 @@ EditorNode::EditorNode() {
*/
progress_hb = memnew(BackgroundProgress);
- menu_hb->add_child(progress_hb);
+ //menu_hb->add_child(progress_hb);
{
Control *sp = memnew(Control);
sp->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
- menu_hb->add_child(sp);
+ //menu_hb->add_child(sp);
}
- PanelContainer *vu_cont = memnew(PanelContainer);
- menu_hb->add_child(vu_cont);
-
- audio_vu = memnew(TextureProgress);
- CenterContainer *vu_cc = memnew(CenterContainer);
- vu_cc->add_child(audio_vu);
- vu_cont->add_child(vu_cc);
- audio_vu->set_under_texture(gui_base->get_icon("VuEmpty", "EditorIcons"));
- audio_vu->set_progress_texture(gui_base->get_icon("VuFull", "EditorIcons"));
- audio_vu->set_max(24);
- audio_vu->set_min(-80);
- audio_vu->set_step(0.01);
- audio_vu->set_value(0);
-
{
Control *sp = memnew(Control);
sp->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
- menu_hb->add_child(sp);
+ //menu_hb->add_child(sp);
}
top_region = memnew(PanelContainer);
HBoxContainer *right_menu_hb = memnew(HBoxContainer);
- top_region->add_child(right_menu_hb);
- menu_hb->add_child(top_region);
-
- settings_menu = memnew(MenuButton);
- settings_menu->set_text(TTR("Settings"));
- settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
- //settings_menu->set_anchor(MARGIN_RIGHT,ANCHOR_END);
- right_menu_hb->add_child(settings_menu);
- p = settings_menu->get_popup();
-
- //p->add_item("Export Settings",SETTINGS_EXPORT_PREFERENCES);
- p->add_item(TTR("Editor Settings"), SETTINGS_PREFERENCES);
- //p->add_item("Optimization Presets",SETTINGS_OPTIMIZED_PRESETS);
- p->add_separator();
- editor_layouts = memnew(PopupMenu);
- editor_layouts->set_name("Layouts");
- p->add_child(editor_layouts);
- editor_layouts->connect("id_pressed", this, "_layout_menu_option");
- p->add_submenu_item(TTR("Editor Layout"), "Layouts");
-
- p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREN);
-
- p->add_separator();
- p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES);
- p->add_separator();
- p->add_item(TTR("About"), SETTINGS_ABOUT);
+ //top_region->add_child(right_menu_hb);
+ menu_hb->add_child(right_menu_hb);
layout_dialog = memnew(EditorNameDialog);
gui_base->add_child(layout_dialog);
@@ -5536,16 +5498,11 @@ EditorNode::EditorNode() {
layout_dialog->set_size(Size2(175, 70) * EDSCALE);
layout_dialog->connect("name_confirmed", this, "_dialog_action");
- sources_button = memnew(ToolButton);
- right_menu_hb->add_child(sources_button);
- sources_button->set_icon(gui_base->get_icon("DependencyOk", "EditorIcons"));
- sources_button->connect("pressed", this, "_menu_option", varray(SOURCES_REIMPORT));
- sources_button->set_tooltip(TTR("Alerts when an external resource has changed."));
-
update_menu = memnew(MenuButton);
update_menu->set_tooltip(TTR("Spins when the editor window repaints!"));
right_menu_hb->add_child(update_menu);
update_menu->set_icon(gui_base->get_icon("Progress1", "EditorIcons"));
+ update_menu->get_popup()->connect("id_pressed", this, "_menu_option");
p = update_menu->get_popup();
p->add_check_item(TTR("Update Always"), SETTINGS_UPDATE_ALWAYS);
p->add_check_item(TTR("Update Changes"), SETTINGS_UPDATE_CHANGES);
@@ -5930,7 +5887,6 @@ EditorNode::EditorNode() {
file_menu->get_popup()->connect("id_pressed", this, "_menu_option");
object_menu->get_popup()->connect("id_pressed", this, "_menu_option");
- update_menu->get_popup()->connect("id_pressed", this, "_menu_option");
settings_menu->get_popup()->connect("id_pressed", this, "_menu_option");
file->connect("file_selected", this, "_dialog_action");
@@ -5988,7 +5944,7 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(Particles2DEditorPlugin(this)));
add_editor_plugin(memnew(GIProbeEditorPlugin(this)));
add_editor_plugin(memnew(Path2DEditorPlugin(this)));
- //add_editor_plugin( memnew( PathEditorPlugin(this) ) );
+ add_editor_plugin(memnew(PathEditorPlugin(this)));
//add_editor_plugin( memnew( BakedLightEditorPlugin(this) ) );
add_editor_plugin(memnew(Line2DEditorPlugin(this)));
add_editor_plugin(memnew(Polygon2DEditorPlugin(this)));
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 667f58e6da..b996505016 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -244,7 +244,9 @@ private:
HBoxContainer *menu_hb;
Control *viewport;
MenuButton *file_menu;
- MenuButton *tool_menu;
+ MenuButton *project_menu;
+ MenuButton *debug_menu;
+ PopupMenu *tool_menu;
ToolButton *export_button;
ToolButton *prev_scene;
MenuButton *object_menu;
@@ -256,7 +258,6 @@ private:
ToolButton *run_settings_button;
ToolButton *play_scene_button;
ToolButton *play_custom_scene_button;
- MenuButton *debug_button;
ToolButton *search_button;
TextureProgress *audio_vu;
//MenuButton *fileserver_menu;
@@ -312,7 +313,7 @@ private:
LineEdit *file_export_password;
String current_path;
MenuButton *update_menu;
- ToolButton *sources_button;
+
//TabContainer *prop_pallete;
//TabContainer *top_pallete;
String defer_load_scene;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index ebd4643537..858c38c796 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -503,8 +503,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["interface/source_font_size"] = PropertyInfo(Variant::INT, "interface/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
set("interface/custom_font", "");
hints["interface/custom_font"] = PropertyInfo(Variant::STRING, "interface/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.fnt", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/custom_theme", "");
- hints["interface/custom_theme"] = PropertyInfo(Variant::STRING, "interface/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
set("interface/dim_editor_on_dialog_popup", true);
set("interface/dim_amount", 0.6f);
hints["interface/dim_amount"] = PropertyInfo(Variant::REAL, "interface/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT);
@@ -513,6 +511,15 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("interface/separate_distraction_mode", false);
+ set("interface/theme/base_color", Color(0.3, 0.3, 0.3, 1));
+ hints["interface/theme/highlight_color"] = PropertyInfo(Variant::COLOR, "interface/theme/highlight_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ set("interface/theme/highlight_color", Color(0.5, 0.5, 0.6, 1));
+ hints["interface/theme/base_color"] = PropertyInfo(Variant::COLOR, "interface/theme/base_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ set("interface/theme/contrast", 0.2);
+ hints["interface/theme/contrast"] = PropertyInfo(Variant::REAL, "interface/theme/contrast", PROPERTY_HINT_RANGE, "0.01, 1, 0.01");
+ set("interface/theme/custom_theme", "");
+ hints["interface/theme/custom_theme"] = PropertyInfo(Variant::STRING, "interface/theme/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+
set("filesystem/directories/autoscan_project_path", "");
hints["filesystem/directories/autoscan_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/autoscan_project_path", PROPERTY_HINT_GLOBAL_DIR);
set("filesystem/directories/default_project_path", "");
@@ -606,11 +613,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("editors/poly_editor/point_grab_radius", 8);
- set("editors/theme/base_color", Color(0.3, 0.3, 0.3, 1));
- hints["editors/theme/base_color"] = PropertyInfo(Variant::COLOR, "editors/theme/base_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("editors/theme/contrast", 0.2);
- hints["editors/theme/contrast"] = PropertyInfo(Variant::REAL, "editors/theme/contrast", PROPERTY_HINT_RANGE, "0.01, 1, 0.01");
-
set("run/window_placement/rect", 0);
hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Default,Centered,Custom Position,Force Maximized,Force Full Screen");
String screen_hints = TTR("Default (Same as Editor)");
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index b88474e2c3..9968b73044 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -95,16 +95,16 @@ Ref<Theme> create_editor_theme() {
editor_register_icons(theme);
// Define colors
- Color highlight_color = EDITOR_DEF("editors/theme/highlight_color", Color::html("#6ca9f3"));
- Color base_color = EDITOR_DEF("editors/theme/base_color", Color::html("#2e3742"));
- float contrast = EDITOR_DEF("editors/theme/contrast", 0.2);
+ Color highlight_color = EDITOR_DEF("interface/theme/highlight_color", Color::html("#b79047"));
+ Color base_color = EDITOR_DEF("interface/theme/base_color", Color::html("#213d4c"));
+ float contrast = EDITOR_DEF("interface/theme/contrast", 0.25);
Color dark_color_1 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast);
- Color dark_color_2 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 2);
- Color dark_color_3 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 3);
+ Color dark_color_2 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 1.5);
+ Color dark_color_3 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 2);
Color light_color_1 = base_color.linear_interpolate(Color(1, 1, 1, 1), contrast);
- Color light_color_2 = base_color.linear_interpolate(Color(1, 1, 1, 1), contrast * 2);
+ Color light_color_2 = base_color.linear_interpolate(Color(1, 1, 1, 1), contrast * 1.5);
theme->set_color("highlight_color", "Editor", highlight_color);
theme->set_color("base_color", "Editor", base_color);
@@ -293,12 +293,13 @@ Ref<Theme> create_editor_theme() {
// LineEdit
Ref<StyleBoxFlat> style_lineedit = make_flat_stylebox(dark_color_1, 4, 4, 4, 4);
style_lineedit->set_border_size(1 * EDSCALE);
- style_lineedit->set_light_color(light_color_1);
- style_lineedit->set_dark_color(light_color_1);
+ style_lineedit = change_border_color(style_lineedit, light_color_1);
Ref<StyleBoxFlat> style_lineedit_disabled = style_lineedit->duplicate();
- style_lineedit_disabled->set_bg_color(light_color_2);
+ style_lineedit_disabled->set_bg_color(light_color_1);
+ Ref<StyleBoxFlat> style_lineedit_focus = change_border_color(style_lineedit, highlight_color);
+ style_lineedit_focus->set_draw_center(false);
theme->set_stylebox("normal", "LineEdit", style_lineedit);
- theme->set_stylebox("focus", "LineEdit", change_border_color(style_lineedit, highlight_color));
+ theme->set_stylebox("focus", "LineEdit", style_lineedit_focus);
theme->set_stylebox("read_only", "LineEdit", style_lineedit_disabled);
// TextEdit
@@ -424,7 +425,7 @@ Ref<Theme> create_editor_theme() {
Ref<Theme> create_custom_theme() {
Ref<Theme> theme;
- String custom_theme = EditorSettings::get_singleton()->get("interface/custom_theme");
+ String custom_theme = EditorSettings::get_singleton()->get("interface/theme/custom_theme");
if (custom_theme != "") {
theme = ResourceLoader::load(custom_theme);
}
diff --git a/editor/import/resource_importer_csv_translation.cpp b/editor/import/resource_importer_csv_translation.cpp
index ea43477dc3..85d446f38a 100644
--- a/editor/import/resource_importer_csv_translation.cpp
+++ b/editor/import/resource_importer_csv_translation.cpp
@@ -54,7 +54,7 @@ String ResourceImporterCSVTranslation::get_save_extension() const {
String ResourceImporterCSVTranslation::get_resource_type() const {
- return "StreamCSVTranslation";
+ return "Translation";
}
bool ResourceImporterCSVTranslation::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const {
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 2f1a4ce115..a626dffc3c 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -1531,8 +1531,8 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
continue;
}
- bool uniform = b->get_shift();
- bool symmetric = b->get_alt();
+ bool uniform = m->get_shift();
+ bool symmetric = m->get_alt();
dto = dto - (drag == DRAG_ALL || drag == DRAG_NODE_2D ? drag_from - drag_point_from : Vector2(0, 0));
diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp
index 12b6dce798..20535d796e 100644
--- a/editor/plugins/path_editor_plugin.cpp
+++ b/editor/plugins/path_editor_plugin.cpp
@@ -33,61 +33,57 @@
#include "scene/resources/curve.h"
#include "spatial_editor_plugin.h"
-#if 0
String PathSpatialGizmo::get_handle_name(int p_idx) const {
Ref<Curve3D> c = path->get_curve();
if (c.is_null())
return "";
- if (p_idx<c->get_point_count()) {
+ if (p_idx < c->get_point_count()) {
- return TTR("Curve Point #")+itos(p_idx);
+ return TTR("Curve Point #") + itos(p_idx);
}
- p_idx=p_idx-c->get_point_count()+1;
+ p_idx = p_idx - c->get_point_count() + 1;
- int idx=p_idx/2;
- int t=p_idx%2;
- String n = TTR("Curve Point #")+itos(idx);
- if (t==0)
- n+=" In";
+ int idx = p_idx / 2;
+ int t = p_idx % 2;
+ String n = TTR("Curve Point #") + itos(idx);
+ if (t == 0)
+ n += " In";
else
- n+=" Out";
+ n += " Out";
return n;
-
-
}
-Variant PathSpatialGizmo::get_handle_value(int p_idx) const{
+Variant PathSpatialGizmo::get_handle_value(int p_idx) const {
Ref<Curve3D> c = path->get_curve();
if (c.is_null())
return Variant();
- if (p_idx<c->get_point_count()) {
+ if (p_idx < c->get_point_count()) {
- original=c->get_point_pos(p_idx);
+ original = c->get_point_pos(p_idx);
return original;
}
- p_idx=p_idx-c->get_point_count()+1;
+ p_idx = p_idx - c->get_point_count() + 1;
- int idx=p_idx/2;
- int t=p_idx%2;
+ int idx = p_idx / 2;
+ int t = p_idx % 2;
Vector3 ofs;
- if (t==0)
- ofs=c->get_point_in(idx);
+ if (t == 0)
+ ofs = c->get_point_in(idx);
else
- ofs= c->get_point_out(idx);
+ ofs = c->get_point_out(idx);
- original=ofs+c->get_point_pos(idx);
+ original = ofs + c->get_point_pos(idx);
return ofs;
-
}
-void PathSpatialGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_point){
+void PathSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_point) {
Ref<Curve3D> c = path->get_curve();
if (c.is_null())
@@ -98,51 +94,49 @@ void PathSpatialGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_po
Vector3 ray_from = p_camera->project_ray_origin(p_point);
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
- if (p_idx<c->get_point_count()) {
+ if (p_idx < c->get_point_count()) {
- Plane p(gt.xform(original),p_camera->get_transform().basis.get_axis(2));
+ Plane p(gt.xform(original), p_camera->get_transform().basis.get_axis(2));
Vector3 inters;
- if (p.intersects_ray(ray_from,ray_dir,&inters)) {
+ if (p.intersects_ray(ray_from, ray_dir, &inters)) {
- if(SpatialEditor::get_singleton()->is_snap_enabled())
- {
+ if (SpatialEditor::get_singleton()->is_snap_enabled()) {
float snap = SpatialEditor::get_singleton()->get_translate_snap();
inters.snap(snap);
}
-
+
Vector3 local = gi.xform(inters);
- c->set_point_pos(p_idx,local);
+ c->set_point_pos(p_idx, local);
}
return;
}
- p_idx=p_idx-c->get_point_count()+1;
+ p_idx = p_idx - c->get_point_count() + 1;
- int idx=p_idx/2;
- int t=p_idx%2;
+ int idx = p_idx / 2;
+ int t = p_idx % 2;
Vector3 base = c->get_point_pos(idx);
- Plane p(gt.xform(original),p_camera->get_transform().basis.get_axis(2));
+ Plane p(gt.xform(original), p_camera->get_transform().basis.get_axis(2));
Vector3 inters;
- if (p.intersects_ray(ray_from,ray_dir,&inters)) {
+ if (p.intersects_ray(ray_from, ray_dir, &inters)) {
- Vector3 local = gi.xform(inters)-base;
- if (t==0) {
- c->set_point_in(idx,local);
+ Vector3 local = gi.xform(inters) - base;
+ if (t == 0) {
+ c->set_point_in(idx, local);
} else {
- c->set_point_out(idx,local);
+ c->set_point_out(idx, local);
}
}
-
}
-void PathSpatialGizmo::commit_handle(int p_idx,const Variant& p_restore,bool p_cancel){
+void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) {
Ref<Curve3D> c = path->get_curve();
if (c.is_null())
@@ -150,67 +144,59 @@ void PathSpatialGizmo::commit_handle(int p_idx,const Variant& p_restore,bool p_c
UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
- if (p_idx<c->get_point_count()) {
+ if (p_idx < c->get_point_count()) {
if (p_cancel) {
- c->set_point_pos(p_idx,p_restore);
+ c->set_point_pos(p_idx, p_restore);
return;
}
ur->create_action(TTR("Set Curve Point Pos"));
- ur->add_do_method(c.ptr(),"set_point_pos",p_idx,c->get_point_pos(p_idx));
- ur->add_undo_method(c.ptr(),"set_point_pos",p_idx,p_restore);
+ ur->add_do_method(c.ptr(), "set_point_pos", p_idx, c->get_point_pos(p_idx));
+ ur->add_undo_method(c.ptr(), "set_point_pos", p_idx, p_restore);
ur->commit_action();
return;
}
- p_idx=p_idx-c->get_point_count()+1;
+ p_idx = p_idx - c->get_point_count() + 1;
- int idx=p_idx/2;
- int t=p_idx%2;
+ int idx = p_idx / 2;
+ int t = p_idx % 2;
Vector3 ofs;
if (p_cancel) {
-
-
return;
}
-
-
- if (t==0) {
+ if (t == 0) {
if (p_cancel) {
- c->set_point_in(p_idx,p_restore);
+ c->set_point_in(p_idx, p_restore);
return;
}
ur->create_action(TTR("Set Curve In Pos"));
- ur->add_do_method(c.ptr(),"set_point_in",idx,c->get_point_in(idx));
- ur->add_undo_method(c.ptr(),"set_point_in",idx,p_restore);
+ ur->add_do_method(c.ptr(), "set_point_in", idx, c->get_point_in(idx));
+ ur->add_undo_method(c.ptr(), "set_point_in", idx, p_restore);
ur->commit_action();
-
} else {
if (p_cancel) {
- c->set_point_out(idx,p_restore);
+ c->set_point_out(idx, p_restore);
return;
}
ur->create_action(TTR("Set Curve Out Pos"));
- ur->add_do_method(c.ptr(),"set_point_out",idx,c->get_point_out(idx));
- ur->add_undo_method(c.ptr(),"set_point_out",idx,p_restore);
+ ur->add_do_method(c.ptr(), "set_point_out", idx, c->get_point_out(idx));
+ ur->add_undo_method(c.ptr(), "set_point_out", idx, p_restore);
ur->commit_action();
-
}
-
}
-
-void PathSpatialGizmo::redraw(){
+void PathSpatialGizmo::redraw() {
clear();
@@ -218,80 +204,76 @@ void PathSpatialGizmo::redraw(){
if (c.is_null())
return;
- Vector3Array v3a=c->tesselate();
- //Vector3Array v3a=c->get_baked_points();
+ PoolVector<Vector3> v3a = c->tesselate();
+ //PoolVector<Vector3> v3a=c->get_baked_points();
int v3s = v3a.size();
- if (v3s==0)
+ if (v3s == 0)
return;
Vector<Vector3> v3p;
- Vector3Array::Read r = v3a.read();
+ PoolVector<Vector3>::Read r = v3a.read();
- for(int i=0;i<v3s-1;i++) {
+ // BUG: the following won't work when v3s, avoid drawing as a temporary workaround.
+ for (int i = 0; i < v3s - 1; i++) {
v3p.push_back(r[i]);
- v3p.push_back(r[i+1]);
+ v3p.push_back(r[i + 1]);
//v3p.push_back(r[i]);
//v3p.push_back(r[i]+Vector3(0,0.2,0));
}
- add_lines(v3p,PathEditorPlugin::singleton->path_material);
+ add_lines(v3p, PathEditorPlugin::singleton->path_material);
add_collision_segments(v3p);
- if (PathEditorPlugin::singleton->get_edited_path()==path) {
+ if (PathEditorPlugin::singleton->get_edited_path() == path) {
v3p.clear();
Vector<Vector3> handles;
Vector<Vector3> sec_handles;
- for(int i=0;i<c->get_point_count();i++) {
+ for (int i = 0; i < c->get_point_count(); i++) {
Vector3 p = c->get_point_pos(i);
handles.push_back(p);
- if (i>0) {
+ if (i > 0) {
v3p.push_back(p);
- v3p.push_back(p+c->get_point_in(i));
- sec_handles.push_back(p+c->get_point_in(i));
+ v3p.push_back(p + c->get_point_in(i));
+ sec_handles.push_back(p + c->get_point_in(i));
}
- if (i<c->get_point_count()-1) {
+ if (i < c->get_point_count() - 1) {
v3p.push_back(p);
- v3p.push_back(p+c->get_point_out(i));
- sec_handles.push_back(p+c->get_point_out(i));
+ v3p.push_back(p + c->get_point_out(i));
+ sec_handles.push_back(p + c->get_point_out(i));
}
}
- add_lines(v3p,PathEditorPlugin::singleton->path_thin_material);
+ add_lines(v3p, PathEditorPlugin::singleton->path_thin_material);
add_handles(handles);
- add_handles(sec_handles,false,true);
+ add_handles(sec_handles, false, true);
}
-
}
-PathSpatialGizmo::PathSpatialGizmo(Path* p_path){
+PathSpatialGizmo::PathSpatialGizmo(Path *p_path) {
- path=p_path;
+ path = p_path;
set_spatial_node(p_path);
-
-
-
}
-Ref<SpatialEditorGizmo> PathEditorPlugin::create_spatial_gizmo(Spatial* p_spatial) {
-
+Ref<SpatialEditorGizmo> PathEditorPlugin::create_spatial_gizmo(Spatial *p_spatial) {
if (p_spatial->cast_to<Path>()) {
- return memnew( PathSpatialGizmo(p_spatial->cast_to<Path>()));
+ return memnew(PathSpatialGizmo(p_spatial->cast_to<Path>()));
}
return Ref<SpatialEditorGizmo>();
}
-bool PathEditorPlugin::forward_spatial_gui_input(Camera* p_camera,const InputEvent& p_event) {
+bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) {
if (!path)
return false;
- Ref<Curve3D> c=path->get_curve();
+ Ref<Curve3D> c = path->get_curve();
if (c.is_null())
return false;
Transform gt = path->get_global_transform();
@@ -299,105 +281,99 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera* p_camera,const InputEve
static const int click_dist = 10; //should make global
+ Ref<InputEventMouseButton> mb = p_event;
- if (p_event.type==InputEvent::MOUSE_BUTTON) {
+ if (mb.is_valid()) {
- const InputEventMouseButton &mb=p_event.mouse_button;
- Point2 mbpos(mb->get_pos().x,mb->get_pos().y);
+ Point2 mbpos(mb->get_pos().x, mb->get_pos().y);
- if (mb->is_pressed() && mb->get_button_index()==BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) {
+ if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) {
//click into curve, break it down
- Vector3Array v3a = c->tesselate();
- int idx=0;
- int rc=v3a.size();
- int closest_seg=-1;
+ PoolVector<Vector3> v3a = c->tesselate();
+ int idx = 0;
+ int rc = v3a.size();
+ int closest_seg = -1;
Vector3 closest_seg_point;
- float closest_d=1e20;
+ float closest_d = 1e20;
- if (rc>=2) {
- Vector3Array::Read r = v3a.read();
+ if (rc >= 2) {
+ PoolVector<Vector3>::Read r = v3a.read();
- if (p_camera->unproject_position(gt.xform(c->get_point_pos(0))).distance_to(mbpos)<click_dist)
+ if (p_camera->unproject_position(gt.xform(c->get_point_pos(0))).distance_to(mbpos) < click_dist)
return false; //nope, existing
-
- for(int i=0;i<c->get_point_count()-1;i++) {
+ for (int i = 0; i < c->get_point_count() - 1; i++) {
//find the offset and point index of the place to break up
- int j=idx;
- if (p_camera->unproject_position(gt.xform(c->get_point_pos(i+1))).distance_to(mbpos)<click_dist)
+ int j = idx;
+ if (p_camera->unproject_position(gt.xform(c->get_point_pos(i + 1))).distance_to(mbpos) < click_dist)
return false; //nope, existing
+ while (j < rc && c->get_point_pos(i + 1) != r[j]) {
- while(j<rc && c->get_point_pos(i+1)!=r[j]) {
-
- Vector3 from =r[j];
- Vector3 to =r[j+1];
+ Vector3 from = r[j];
+ Vector3 to = r[j + 1];
real_t cdist = from.distance_to(to);
- from=gt.xform(from);
- to=gt.xform(to);
- if (cdist>0) {
+ from = gt.xform(from);
+ to = gt.xform(to);
+ if (cdist > 0) {
Vector2 s[2];
s[0] = p_camera->unproject_position(from);
s[1] = p_camera->unproject_position(to);
- Vector2 inters = Geometry::get_closest_point_to_segment_2d(mbpos,s);
+ Vector2 inters = Geometry::get_closest_point_to_segment_2d(mbpos, s);
float d = inters.distance_to(mbpos);
- if (d<10 && d<closest_d) {
+ if (d < 10 && d < closest_d) {
+ closest_d = d;
+ closest_seg = i;
+ Vector3 ray_from = p_camera->project_ray_origin(mbpos);
+ Vector3 ray_dir = p_camera->project_ray_normal(mbpos);
- closest_d=d;
- closest_seg=i;
- Vector3 ray_from=p_camera->project_ray_origin(mbpos);
- Vector3 ray_dir=p_camera->project_ray_normal(mbpos);
+ Vector3 ra, rb;
+ Geometry::get_closest_points_between_segments(ray_from, ray_from + ray_dir * 4096, from, to, ra, rb);
- Vector3 ra,rb;
- Geometry::get_closest_points_between_segments(ray_from,ray_from+ray_dir*4096,from,to,ra,rb);
-
- closest_seg_point=it.xform(rb);
+ closest_seg_point = it.xform(rb);
}
-
}
j++;
-
}
- if (idx==j)
+ if (idx == j)
idx++; //force next
else
- idx=j; //swap
+ idx = j; //swap
-
- if (j==rc)
+ if (j == rc)
break;
}
}
UndoRedo *ur = editor->get_undo_redo();
- if (closest_seg!=-1) {
+ if (closest_seg != -1) {
//subdivide
ur->create_action(TTR("Split Path"));
- ur->add_do_method(c.ptr(),"add_point",closest_seg_point,Vector3(),Vector3(),closest_seg+1);
- ur->add_undo_method(c.ptr(),"remove_point",closest_seg+1);
+ ur->add_do_method(c.ptr(), "add_point", closest_seg_point, Vector3(), Vector3(), closest_seg + 1);
+ ur->add_undo_method(c.ptr(), "remove_point", closest_seg + 1);
ur->commit_action();
return true;
} else {
Vector3 org;
- if (c->get_point_count()==0)
- org=path->get_transform().get_origin();
+ if (c->get_point_count() == 0)
+ org = path->get_transform().get_origin();
else
- org=gt.xform(c->get_point_pos(c->get_point_count()));
- Plane p(org,p_camera->get_transform().basis.get_axis(2));
- Vector3 ray_from=p_camera->project_ray_origin(mbpos);
- Vector3 ray_dir=p_camera->project_ray_normal(mbpos);
+ org = gt.xform(c->get_point_pos(c->get_point_count() - 1));
+ Plane p(org, p_camera->get_transform().basis.get_axis(2));
+ Vector3 ray_from = p_camera->project_ray_origin(mbpos);
+ Vector3 ray_dir = p_camera->project_ray_normal(mbpos);
Vector3 inters;
- if (p.intersects_ray(ray_from,ray_dir,&inters)) {
+ if (p.intersects_ray(ray_from, ray_dir, &inters)) {
ur->create_action(TTR("Add Point to Curve"));
- ur->add_do_method(c.ptr(),"add_point",it.xform(inters),Vector3(),Vector3(),-1);
- ur->add_undo_method(c.ptr(),"remove_point",c->get_point_count());
+ ur->add_do_method(c.ptr(), "add_point", it.xform(inters), Vector3(), Vector3(), -1);
+ ur->add_undo_method(c.ptr(), "remove_point", c->get_point_count());
ur->commit_action();
return true;
}
@@ -405,9 +381,9 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera* p_camera,const InputEve
//add new at pos
}
- } else if (mb->is_pressed() && ((mb->get_button_index()==BUTTON_LEFT && curve_del->is_pressed()) || (mb->get_button_index()==BUTTON_RIGHT && curve_edit->is_pressed()))) {
+ } else if (mb->is_pressed() && ((mb->get_button_index() == BUTTON_LEFT && curve_del->is_pressed()) || (mb->get_button_index() == BUTTON_RIGHT && curve_edit->is_pressed()))) {
- for(int i=0;i<c->get_point_count();i++) {
+ for (int i = 0; i < c->get_point_count(); i++) {
real_t dist_to_p = p_camera->unproject_position(gt.xform(c->get_point_pos(i))).distance_to(mbpos);
real_t dist_to_p_out = p_camera->unproject_position(gt.xform(c->get_point_pos(i) + c->get_point_out(i))).distance_to(mbpos);
real_t dist_to_p_in = p_camera->unproject_position(gt.xform(c->get_point_pos(i) + c->get_point_in(i))).distance_to(mbpos);
@@ -418,40 +394,38 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera* p_camera,const InputEve
UndoRedo *ur = editor->get_undo_redo();
ur->create_action(TTR("Remove Path Point"));
- ur->add_do_method(c.ptr(),"remove_point",i);
- ur->add_undo_method(c.ptr(),"add_point",c->get_point_pos(i),c->get_point_in(i),c->get_point_out(i),i);
+ ur->add_do_method(c.ptr(), "remove_point", i);
+ ur->add_undo_method(c.ptr(), "add_point", c->get_point_pos(i), c->get_point_in(i), c->get_point_out(i), i);
ur->commit_action();
return true;
} else if (dist_to_p_out < click_dist) {
UndoRedo *ur = editor->get_undo_redo();
ur->create_action(TTR("Remove Out-Control Point"));
- ur->add_do_method(c.ptr(),"set_point_out",i,Vector3());
- ur->add_undo_method(c.ptr(),"set_point_out",i,c->get_point_out(i));
+ ur->add_do_method(c.ptr(), "set_point_out", i, Vector3());
+ ur->add_undo_method(c.ptr(), "set_point_out", i, c->get_point_out(i));
ur->commit_action();
return true;
} else if (dist_to_p_in < click_dist) {
UndoRedo *ur = editor->get_undo_redo();
ur->create_action(TTR("Remove In-Control Point"));
- ur->add_do_method(c.ptr(),"set_point_in",i,Vector3());
- ur->add_undo_method(c.ptr(),"set_point_in",i,c->get_point_in(i));
+ ur->add_do_method(c.ptr(), "set_point_in", i, Vector3());
+ ur->add_undo_method(c.ptr(), "set_point_in", i, c->get_point_in(i));
ur->commit_action();
return true;
}
}
}
-
}
return false;
}
-
void PathEditorPlugin::edit(Object *p_object) {
if (p_object) {
- path=p_object->cast_to<Path>();
+ path = p_object->cast_to<Path>();
if (path) {
if (path->get_curve().is_valid()) {
@@ -459,8 +433,8 @@ void PathEditorPlugin::edit(Object *p_object) {
}
}
} else {
- Path *pre=path;
- path=NULL;
+ Path *pre = path;
+ path = NULL;
if (pre) {
pre->get_curve()->emit_signal("changed");
}
@@ -470,7 +444,7 @@ void PathEditorPlugin::edit(Object *p_object) {
bool PathEditorPlugin::handles(Object *p_object) const {
- return p_object->is_type("Path");
+ return p_object->is_class("Path");
}
void PathEditorPlugin::make_visible(bool p_visible) {
@@ -480,120 +454,115 @@ void PathEditorPlugin::make_visible(bool p_visible) {
curve_create->show();
curve_edit->show();
curve_del->show();
- curve_close->show();
- sep->show();
+ curve_close->show();
+ sep->show();
} else {
curve_create->hide();
curve_edit->hide();
curve_del->hide();
- curve_close->hide();
- sep->hide();
+ curve_close->hide();
+ sep->hide();
{
- Path *pre=path;
- path=NULL;
+ Path *pre = path;
+ path = NULL;
if (pre && pre->get_curve().is_valid()) {
pre->get_curve()->emit_signal("changed");
}
}
}
-
}
void PathEditorPlugin::_mode_changed(int p_idx) {
- curve_create->set_pressed(p_idx==0);
- curve_edit->set_pressed(p_idx==1);
- curve_del->set_pressed(p_idx==2);
+ curve_create->set_pressed(p_idx == 0);
+ curve_edit->set_pressed(p_idx == 1);
+ curve_del->set_pressed(p_idx == 2);
}
void PathEditorPlugin::_close_curve() {
- Ref<Curve3D> c = path->get_curve();
- if (c.is_null())
- return ;
- if (c->get_point_count()<2)
- return;
- c->add_point(c->get_point_pos(0),c->get_point_in(0),c->get_point_out(0));
-
+ Ref<Curve3D> c = path->get_curve();
+ if (c.is_null())
+ return;
+ if (c->get_point_count() < 2)
+ return;
+ c->add_point(c->get_point_pos(0), c->get_point_in(0), c->get_point_out(0));
}
void PathEditorPlugin::_notification(int p_what) {
- if (p_what==NOTIFICATION_ENTER_TREE) {
+ if (p_what == NOTIFICATION_ENTER_TREE) {
- curve_create->connect("pressed",this,"_mode_changed",make_binds(0));
- curve_edit->connect("pressed",this,"_mode_changed",make_binds(1));
- curve_del->connect("pressed",this,"_mode_changed",make_binds(2));
- curve_close->connect("pressed",this,"_close_curve");
- }
+ curve_create->connect("pressed", this, "_mode_changed", make_binds(0));
+ curve_edit->connect("pressed", this, "_mode_changed", make_binds(1));
+ curve_del->connect("pressed", this, "_mode_changed", make_binds(2));
+ curve_close->connect("pressed", this, "_close_curve");
+ }
}
void PathEditorPlugin::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_mode_changed"),&PathEditorPlugin::_mode_changed);
- ClassDB::bind_method(D_METHOD("_close_curve"),&PathEditorPlugin::_close_curve);
+ ClassDB::bind_method(D_METHOD("_mode_changed"), &PathEditorPlugin::_mode_changed);
+ ClassDB::bind_method(D_METHOD("_close_curve"), &PathEditorPlugin::_close_curve);
}
-PathEditorPlugin* PathEditorPlugin::singleton=NULL;
-
+PathEditorPlugin *PathEditorPlugin::singleton = NULL;
PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
- path=NULL;
- editor=p_node;
- singleton=this;
+ path = NULL;
+ editor = p_node;
+ singleton = this;
- path_material = Ref<SpatialMaterial>( memnew( SpatialMaterial ));
- path_material->set_parameter( SpatialMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.8) );
- path_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true);
+ path_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
+ path_material->set_albedo(Color(0.5, 0.5, 1.0, 0.8));
+ path_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
path_material->set_line_width(3);
- path_material->set_flag(Material::FLAG_DOUBLE_SIDED,true);
- path_material->set_flag(Material::FLAG_UNSHADED,true);
+ path_material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
+ path_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
- path_thin_material = Ref<SpatialMaterial>( memnew( SpatialMaterial ));
- path_thin_material->set_parameter( SpatialMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.4) );
- path_thin_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true);
+ path_thin_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
+ path_thin_material->set_albedo(Color(0.5, 0.5, 1.0, 0.4));
+ path_thin_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
path_thin_material->set_line_width(1);
- path_thin_material->set_flag(Material::FLAG_DOUBLE_SIDED,true);
- path_thin_material->set_flag(Material::FLAG_UNSHADED,true);
+ path_thin_material->set_cull_mode(SpatialMaterial::CULL_DISABLED);
+ path_thin_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
//SpatialEditor::get_singleton()->add_gizmo_plugin(this);
- sep = memnew( VSeparator);
+ sep = memnew(VSeparator);
sep->hide();
SpatialEditor::get_singleton()->add_control_to_menu_panel(sep);
- curve_edit = memnew( ToolButton );
- curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveEdit","EditorIcons"));
+ curve_edit = memnew(ToolButton);
+ curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveEdit", "EditorIcons"));
curve_edit->set_toggle_mode(true);
curve_edit->hide();
curve_edit->set_focus_mode(Control::FOCUS_NONE);
- curve_edit->set_tooltip(TTR("Select Points")+"\n"+TTR("Shift+Drag: Select Control Points")+"\n"+keycode_get_string(KEY_MASK_CMD)+TTR("Click: Add Point")+"\n"+TTR("Right Click: Delete Point"));
+ curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point"));
SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_edit);
- curve_create = memnew( ToolButton );
- curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate","EditorIcons"));
+ curve_create = memnew(ToolButton);
+ curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate", "EditorIcons"));
curve_create->set_toggle_mode(true);
curve_create->hide();
curve_create->set_focus_mode(Control::FOCUS_NONE);
- curve_create->set_tooltip(TTR("Add Point (in empty space)")+"\n"+TTR("Split Segment (in curve)"));
+ curve_create->set_tooltip(TTR("Add Point (in empty space)") + "\n" + TTR("Split Segment (in curve)"));
SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_create);
- curve_del = memnew( ToolButton );
- curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete","EditorIcons"));
+ curve_del = memnew(ToolButton);
+ curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete", "EditorIcons"));
curve_del->set_toggle_mode(true);
curve_del->hide();
curve_del->set_focus_mode(Control::FOCUS_NONE);
curve_del->set_tooltip(TTR("Delete Point"));
SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_del);
- curve_close = memnew( ToolButton );
- curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveClose","EditorIcons"));
+ curve_close = memnew(ToolButton);
+ curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveClose", "EditorIcons"));
curve_close->hide();
curve_close->set_focus_mode(Control::FOCUS_NONE);
curve_close->set_tooltip(TTR("Close Curve"));
SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_close);
-
-
curve_edit->set_pressed(true);
/*
collision_polygon_editor = memnew( PathEditor(p_node) );
@@ -607,13 +576,7 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
collision_polygon_editor->hide();
*/
-
-
}
-
-PathEditorPlugin::~PathEditorPlugin()
-{
+PathEditorPlugin::~PathEditorPlugin() {
}
-
-#endif
diff --git a/editor/plugins/path_editor_plugin.h b/editor/plugins/path_editor_plugin.h
index 4dbda10263..651dcdaa78 100644
--- a/editor/plugins/path_editor_plugin.h
+++ b/editor/plugins/path_editor_plugin.h
@@ -32,30 +32,27 @@
#include "editor/spatial_editor_gizmos.h"
#include "scene/3d/path.h"
-#if 0
-class PathSpatialGizmo : public EditorSpatialGizmo {
- GDCLASS(PathSpatialGizmo,EditorSpatialGizmo);
+class PathSpatialGizmo : public EditorSpatialGizmo {
- Path* path;
+ GDCLASS(PathSpatialGizmo, EditorSpatialGizmo);
+
+ Path *path;
mutable Vector3 original;
public:
-
virtual String get_handle_name(int p_idx) const;
virtual Variant get_handle_value(int p_idx) const;
- virtual void set_handle(int p_idx,Camera *p_camera, const Point2& p_point);
- virtual void commit_handle(int p_idx,const Variant& p_restore,bool p_cancel=false);
+ virtual void set_handle(int p_idx, Camera *p_camera, const Point2 &p_point);
+ virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false);
void redraw();
- PathSpatialGizmo(Path* p_path=NULL);
-
+ PathSpatialGizmo(Path *p_path = NULL);
};
class PathEditorPlugin : public EditorPlugin {
- GDCLASS( PathEditorPlugin, EditorPlugin );
-
+ GDCLASS(PathEditorPlugin, EditorPlugin);
Separator *sep;
ToolButton *curve_create;
@@ -65,26 +62,25 @@ class PathEditorPlugin : public EditorPlugin {
EditorNode *editor;
-
Path *path;
void _mode_changed(int p_idx);
- void _close_curve();
+ void _close_curve();
+
protected:
void _notification(int p_what);
static void _bind_methods();
public:
-
Path *get_edited_path() { return path; }
- static PathEditorPlugin* singleton;
+ static PathEditorPlugin *singleton;
Ref<SpatialMaterial> path_material;
Ref<SpatialMaterial> path_thin_material;
- virtual bool forward_spatial_gui_input(Camera* p_camera,const InputEvent& p_event);
+ virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event);
//virtual bool forward_gui_input(const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
- virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial);
+ virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
virtual String get_name() const { return "Path"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_node);
@@ -93,8 +89,6 @@ public:
PathEditorPlugin(EditorNode *p_node);
~PathEditorPlugin();
-
};
-#endif
#endif // PATH_EDITOR_PLUGIN_H
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 1e86d8db4b..2220e3330f 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -539,10 +539,12 @@ ScriptCreateDialog::ScriptCreateDialog() {
/* Margins */
empty_h = memnew(Control);
+ empty_h->set_name("empty_h"); //duplicate() doesn't like nodes without a name
empty_h->set_h_size_flags(Control::SIZE_EXPAND_FILL);
empty_h->set_v_size_flags(Control::SIZE_EXPAND_FILL);
empty_h->set_custom_minimum_size(Size2(0, 10 * EDSCALE));
empty_v = memnew(Control);
+ empty_v->set_name("empty_v");
empty_v->set_h_size_flags(Control::SIZE_EXPAND_FILL);
empty_v->set_v_size_flags(Control::SIZE_EXPAND_FILL);
empty_v->set_custom_minimum_size(Size2(10, 0 * EDSCALE));
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 2cce62ab51..9e11a595dc 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -302,7 +302,7 @@ void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
_THREAD_SAFE_METHOD_
Ref<InputEventKey> k = p_event;
- if (k.is_valid() && k->is_echo() && k->get_scancode() != 0) {
+ if (k.is_valid() && !k->is_echo() && k->get_scancode() != 0) {
//print_line(p_event);
diff --git a/methods.py b/methods.py
index 40f7deedbc..5af6c6aed0 100644
--- a/methods.py
+++ b/methods.py
@@ -1594,61 +1594,69 @@ def detect_visual_c_compiler_version(tools_env):
vc_chosen_compiler_index = -1
vc_chosen_compiler_str = ""
- # find() works with -1 so big ifs bellow are needed... the simplest solution, in fact
- # First test if amd64 and amd64_x86 compilers are present in the path
- vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64;")
- if(vc_amd64_compiler_detection_index > -1):
- vc_chosen_compiler_index = vc_amd64_compiler_detection_index
- vc_chosen_compiler_str = "amd64"
-
- vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64_x86;")
- if(vc_amd64_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
- vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
- vc_chosen_compiler_str = "amd64_x86"
-
- # Now check the 32 bit compilers
- vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN;")
- if(vc_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
- vc_chosen_compiler_index = vc_x86_compiler_detection_index
- vc_chosen_compiler_str = "x86"
-
- vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR'] + "BIN\\x86_amd64;")
- if(vc_x86_amd64_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
- vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
- vc_chosen_compiler_str = "x86_amd64"
-
- # Newer versions have a different path available
- vc_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X64;")
- if(vc_amd64_compiler_detection_index > -1):
- vc_chosen_compiler_index = vc_amd64_compiler_detection_index
- vc_chosen_compiler_str = "amd64"
-
- vc_amd64_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X86;")
- if(vc_amd64_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
- vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
- vc_chosen_compiler_str = "amd64_x86"
-
- vc_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X86;")
- if(vc_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
- vc_chosen_compiler_index = vc_x86_compiler_detection_index
- vc_chosen_compiler_str = "x86"
-
- vc_x86_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X64;")
- if(vc_x86_amd64_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
- vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
- vc_chosen_compiler_str = "x86_amd64"
+ # Start with Pre VS 2017 checks which uses VCINSTALLDIR:
+ if 'VCINSTALLDIR' in tools_env:
+ # print "Checking VCINSTALLDIR"
+
+ # find() works with -1 so big ifs bellow are needed... the simplest solution, in fact
+ # First test if amd64 and amd64_x86 compilers are present in the path
+ vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64;")
+ if(vc_amd64_compiler_detection_index > -1):
+ vc_chosen_compiler_index = vc_amd64_compiler_detection_index
+ vc_chosen_compiler_str = "amd64"
+
+ vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64_x86;")
+ if(vc_amd64_x86_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
+ vc_chosen_compiler_str = "amd64_x86"
+
+ # Now check the 32 bit compilers
+ vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN;")
+ if(vc_x86_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_x86_compiler_detection_index
+ vc_chosen_compiler_str = "x86"
+
+ vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR'] + "BIN\\x86_amd64;")
+ if(vc_x86_amd64_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
+ vc_chosen_compiler_str = "x86_amd64"
+
+ # and for VS 2017 and newer we check VCTOOLSINSTALLDIR:
+ if 'VCTOOLSINSTALLDIR' in tools_env:
+ # print "Checking VCTOOLSINSTALLDIR"
+
+ # Newer versions have a different path available
+ vc_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X64;")
+ if(vc_amd64_compiler_detection_index > -1):
+ vc_chosen_compiler_index = vc_amd64_compiler_detection_index
+ vc_chosen_compiler_str = "amd64"
+
+ vc_amd64_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X86;")
+ if(vc_amd64_x86_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
+ vc_chosen_compiler_str = "amd64_x86"
+
+ vc_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X86;")
+ if(vc_x86_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_x86_compiler_detection_index
+ vc_chosen_compiler_str = "x86"
+
+ vc_x86_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X64;")
+ if(vc_x86_amd64_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
+ vc_chosen_compiler_str = "x86_amd64"
# debug help
# print vc_amd64_compiler_detection_index
diff --git a/modules/gdnative/godot/godot_array.cpp b/modules/gdnative/godot/godot_array.cpp
index 65353c5b0f..bf2ef35972 100644
--- a/modules/gdnative/godot/godot_array.cpp
+++ b/modules/gdnative/godot/godot_array.cpp
@@ -139,13 +139,9 @@ void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godo
a->operator[](p_idx) = *val;
}
-godot_variant GDAPI godot_array_get(const godot_array *p_arr, const godot_int p_idx) {
- godot_variant raw_dest;
- Variant *dest = (Variant *)&raw_dest;
- memnew_placement(dest, Variant);
- const Array *a = (const Array *)p_arr;
- *dest = a->operator[](p_idx);
- return raw_dest;
+godot_variant GDAPI *godot_array_get(const godot_array *p_arr, const godot_int p_idx) {
+ Array *a = (Array *)p_arr;
+ return (godot_variant *)&a->operator[](p_idx);
}
void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value) {
diff --git a/modules/gdnative/godot/godot_array.h b/modules/gdnative/godot/godot_array.h
index 29a76304d0..f7150950fc 100644
--- a/modules/gdnative/godot/godot_array.h
+++ b/modules/gdnative/godot/godot_array.h
@@ -59,7 +59,7 @@ void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_
void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value);
-godot_variant GDAPI godot_array_get(const godot_array *p_arr, const godot_int p_idx);
+godot_variant GDAPI *godot_array_get(const godot_array *p_arr, const godot_int p_idx);
void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value);
diff --git a/modules/gdnative/godot/godot_dictionary.cpp b/modules/gdnative/godot/godot_dictionary.cpp
index dda245e59e..b98ee5b5c9 100644
--- a/modules/gdnative/godot/godot_dictionary.cpp
+++ b/modules/gdnative/godot/godot_dictionary.cpp
@@ -101,13 +101,10 @@ godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self) {
return dest;
}
-godot_variant GDAPI godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) {
- godot_variant raw_dest;
- Variant *dest = (Variant *)&raw_dest;
- const Dictionary *dict = (const Dictionary *)p_dict;
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) {
+ Dictionary *dict = (Dictionary *)p_dict;
const Variant *key = (const Variant *)p_key;
- *dest = dict->operator[](*key);
- return raw_dest;
+ return (godot_variant *)&dict->operator[](*key);
}
godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b) {
diff --git a/modules/gdnative/godot/godot_dictionary.h b/modules/gdnative/godot/godot_dictionary.h
index 9f6de77aac..42f7f872a1 100644
--- a/modules/gdnative/godot/godot_dictionary.h
+++ b/modules/gdnative/godot/godot_dictionary.h
@@ -68,7 +68,7 @@ godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self);
godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self);
-godot_variant GDAPI godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b);
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index 3f7ad8b2c2..5c53492034 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -39,6 +39,46 @@
#include <squish.h>
+void image_decompress_squish(Image *p_image) {
+ int w = p_image->get_width();
+ int h = p_image->get_height();
+
+ Image::Format target_format = Image::FORMAT_RGBA8;
+ PoolVector<uint8_t> data;
+ int target_size = Image::get_image_data_size(w, h, target_format, p_image->has_mipmaps() ? -1 : 0);
+ int mm_count = p_image->get_mipmap_count();
+ data.resize(target_size);
+
+ PoolVector<uint8_t>::Read rb = p_image->get_data().read();
+ PoolVector<uint8_t>::Write wb = data.write();
+
+ int squish_flags = Image::FORMAT_MAX;
+ if (p_image->get_format() == Image::FORMAT_DXT1) {
+ squish_flags = squish::kDxt1;
+ } else if (p_image->get_format() == Image::FORMAT_DXT3) {
+ squish_flags = squish::kDxt3;
+ } else if (p_image->get_format() == Image::FORMAT_DXT5) {
+ squish_flags = squish::kDxt5;
+ } else if (p_image->get_format() == Image::FORMAT_ATI1) {
+ squish_flags = squish::kBc4;
+ } else if (p_image->get_format() == Image::FORMAT_ATI2) {
+ squish_flags = squish::kBc5;
+ } else {
+ ERR_FAIL_COND(true);
+ return;
+ }
+
+ int dst_ofs = 0;
+
+ for (int i = 0; i <= mm_count; i++) {
+ int src_ofs = 0, mipmap_size = 0, mipmap_w = 0, mipmap_h = 0;
+ p_image->get_mipmap_offset_size_and_dimensions(i, src_ofs, mipmap_size, mipmap_w, mipmap_h);
+ squish::DecompressImage(&wb[dst_ofs], mipmap_w, mipmap_h, &rb[src_ofs], squish_flags);
+ }
+
+ p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
+}
+
void image_compress_squish(Image *p_image) {
int w = p_image->get_width();
@@ -56,7 +96,7 @@ void image_compress_squish(Image *p_image) {
return; //do not compress, already compressed
int shift = 0;
- int squish_comp = squish::kColourRangeFit;
+ int squish_comp = squish::kColourRangeFit; // TODO: use lossy quality setting to determine the quality
Image::Format target_format;
if (p_image->get_format() == Image::FORMAT_LA8) {
diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h
index 81f57c6822..519e3537ef 100644
--- a/modules/squish/image_compress_squish.h
+++ b/modules/squish/image_compress_squish.h
@@ -33,5 +33,6 @@
#include "image.h"
void image_compress_squish(Image *p_image);
+void image_decompress_squish(Image *p_image);
#endif // IMAGE_COMPRESS_SQUISH_H
diff --git a/modules/squish/register_types.cpp b/modules/squish/register_types.cpp
index 41341db93b..2eeea59836 100644
--- a/modules/squish/register_types.cpp
+++ b/modules/squish/register_types.cpp
@@ -36,6 +36,7 @@
void register_squish_types() {
Image::set_compress_bc_func(image_compress_squish);
+ Image::_image_decompress_bc = image_decompress_squish;
}
void unregister_squish_types() {}
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 5dc0fb08b1..0d9750d701 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -604,7 +604,12 @@ static int frame_count = 0;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
- iphone_main(backingWidth, backingHeight, gargc, gargv);
+ int err = iphone_main(backingWidth, backingHeight, gargc, gargv);
+ if (err != 0) {
+ // bail, things did not go very well for us, should probably output a message on screen with our error code...
+ exit(0);
+ return;
+ };
view_controller = [[ViewController alloc] init];
view_controller.view = glView;
@@ -668,6 +673,7 @@ static int frame_count = 0;
isAdvertisingTrackingEnabled]];
#endif
+
};
- (void)applicationWillTerminate:(UIApplication *)application {
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index 248c73982b..970abc7daa 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -59,15 +59,16 @@ def configure(env):
env["arch"] = "x86"
env["bits"] = "32"
env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $IPHONESDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"')
- elif (env["arch"] == "arm64"): # arm64
+ elif (env["arch"] == "arm" or env["arch"] == "arm32" or env["arch"] == "armv7" or env["bits"] == "32"): # arm
+ env["arch"] = "arm"
+ env["bits"] = "32"
+ env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -isysroot $IPHONESDK -fvisibility=hidden -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=9.0 -MMD -MT dependencies -isysroot $IPHONESDK')
+ else: # armv64
+ env["arch"] = "arm64"
env["bits"] = "64"
- env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fvisibility=hidden -MMD -MT dependencies -miphoneos-version-min=7.0 -isysroot $IPHONESDK')
+ env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fvisibility=hidden -MMD -MT dependencies -miphoneos-version-min=9.0 -isysroot $IPHONESDK')
env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
- else: # armv7
- env["arch"] = "arm"
- env["bits"] = "32"
- env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -isysroot $IPHONESDK -fvisibility=hidden -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=7.0 -MMD -MT dependencies -isysroot $IPHONESDK')
if (env["arch"] == "x86"):
env['IPHONEPLATFORM'] = 'iPhoneSimulator'
@@ -93,7 +94,7 @@ def configure(env):
'-F$IPHONESDK',
])
elif (env["arch"] == "arm64"):
- env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=7.0',
+ env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=9.0',
'-isysroot', '$IPHONESDK',
#'-stdlib=libc++',
'-framework', 'Foundation',
@@ -112,7 +113,7 @@ def configure(env):
'-framework', 'CoreMotion',
])
else:
- env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=7.0',
+ env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=9.0',
'-isysroot', '$IPHONESDK',
'-framework', 'Foundation',
'-framework', 'UIKit',
diff --git a/platform/iphone/ios.h b/platform/iphone/ios.h
index 5329d4f02a..2572d626d2 100644
--- a/platform/iphone/ios.h
+++ b/platform/iphone/ios.h
@@ -39,6 +39,8 @@ class iOS : public Object {
static void _bind_methods();
public:
+ static void alert(const char *p_alert, const char *p_title);
+
String get_rate_url(int p_app_id) const;
iOS();
diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm
index cd64bbfafc..e9c164393b 100644
--- a/platform/iphone/ios.mm
+++ b/platform/iphone/ios.mm
@@ -36,6 +36,11 @@ void iOS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_rate_url", "app_id"), &iOS::get_rate_url);
};
+void iOS::alert(const char* p_alert, const char* p_title) {
+ UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:[NSString stringWithUTF8String:p_title] message:[NSString stringWithUTF8String:p_alert] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] autorelease];
+ [alert show];
+}
+
String iOS::get_rate_url(int p_app_id) const {
String templ = "itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID";
String templ_iOS7 = "itms-apps://itunes.apple.com/app/idAPP_ID";
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index 3e95d1a706..0d7913446e 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -196,8 +196,8 @@ bool OSIPhone::iterate() {
void OSIPhone::key(uint32_t p_key, bool p_pressed) {
Ref<InputEventKey> ev;
- ev.instance()
- ev->set_echo(false);
+ ev.instance();
+ ev->set_echo(false);
ev->set_pressed(p_pressed);
ev->set_scancode(p_key);
ev->set_unicode(p_key);
@@ -207,7 +207,7 @@ void OSIPhone::key(uint32_t p_key, bool p_pressed) {
void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick, bool p_use_as_mouse) {
if (!GLOBAL_DEF("debug/disable_touch", false)) {
- Ref<InputEventSreenTouch> ev;
+ Ref<InputEventScreenTouch> ev;
ev.instance();
ev->set_index(p_idx);
@@ -216,7 +216,7 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_
queue_event(ev);
};
- mouse_list->is_pressed()[p_idx] = p_pressed;
+ mouse_list.pressed[p_idx] = p_pressed;
if (p_use_as_mouse) {
@@ -225,10 +225,10 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_
// swaped it for tilted screen
//ev->get_pos().x = ev.mouse_button.global_x = video_mode.height - p_y;
//ev->get_pos().y = ev.mouse_button.global_y = p_x;
- ev->set_pos(Vector2(ev.mouse_button.global_x, ev.mouse_button.global_y));
- ev->set_global_pos(Vector2(ev.mouse_button.global_x, ev.mouse_button.global_y));
+ ev->set_pos(Vector2(video_mode.height - p_y, p_x));
+ ev->set_global_pos(Vector2(video_mode.height - p_y, p_x));
- //mouse_list->is_pressed()[p_idx] = p_pressed;
+ //mouse_list.pressed[p_idx] = p_pressed;
input->set_mouse_position(ev->get_pos());
ev->set_button_index(BUTTON_LEFT);
@@ -278,7 +278,7 @@ void OSIPhone::touches_cancelled() {
for (int i = 0; i < MAX_MOUSE_COUNT; i++) {
- if (mouse_list->is_pressed()[i]) {
+ if (mouse_list.pressed[i]) {
// send a mouse_up outside the screen
mouse_button(i, -1, -1, false, false, false);
@@ -398,11 +398,18 @@ Point2 OSIPhone::get_mouse_position() const {
int OSIPhone::get_mouse_button_state() const {
- return mouse_list->is_pressed()[0];
+ return mouse_list.pressed[0];
};
void OSIPhone::set_window_title(const String &p_title){};
+void OSIPhone::alert(const String &p_alert, const String &p_title) {
+
+ const CharString utf8_alert = p_alert.utf8();
+ const CharString utf8_title = p_title.utf8();
+ iOS::alert(utf8_alert.get_data(), utf8_title.get_data());
+}
+
void OSIPhone::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
video_mode = p_video_mode;
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index 0da7e6d081..4031b7524c 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -159,6 +159,8 @@ public:
virtual int get_mouse_button_state() const;
virtual void set_window_title(const String &p_title);
+ virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
+
virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0);
virtual VideoMode get_video_mode(int p_screen = 0) const;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp
index 7c8f09b27b..51aba9b7fd 100644
--- a/platform/uwp/app.cpp
+++ b/platform/uwp/app.cpp
@@ -259,45 +259,48 @@ void App::pointer_event(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Cor
int but = _get_button(point);
if (_is_touch(point)) {
- Ref<InputEvent> event;
- event.type = InputEvent::SCREEN_TOUCH;
- event.device = 0;
- event.screen_touch->is_pressed() = p_pressed;
- event.screen_touch.x = pos.X;
- event.screen_touch.y = pos.Y;
- event.screen_touch.index = _get_finger(point->PointerId);
-
- last_touch_x[event.screen_touch.index] = pos.X;
- last_touch_y[event.screen_touch.index] = pos.Y;
-
- os->input_event(event);
+ Ref<InputEventScreenTouch> screen_touch;
+ screen_touch.instance();
+ screen_touch->set_device(0);
+ screen_touch->set_pressed(p_pressed);
+ screen_touch->set_pos(Vector2(pos.X, pos.Y));
+ screen_touch->set_index(_get_finger(point->PointerId));
+
+ last_touch_x[screen_touch->get_index()] = pos.X;
+ last_touch_y[screen_touch->get_index()] = pos.Y;
+
+ os->input_event(screen_touch);
if (number_of_contacts > 1)
return;
}; // fallthrought of sorts
- Ref<InputEvent> event;
- event.type = InputEvent::MOUSE_BUTTON;
- event.device = 0;
- event->is_pressed() = p_pressed;
- event->get_button_index() = but;
- event->get_pos().x = pos.X;
- event->get_pos().y = pos.Y;
- event.mouse_button.global_x = pos.X;
- event.mouse_button.global_y = pos.Y;
+ Ref<InputEventMouseButton> mouse_button;
+ mouse_button.instance();
+ mouse_button->set_device(0);
+ mouse_button->set_pressed(p_pressed);
+ mouse_button->set_button_index(but);
+ mouse_button->set_pos(Vector2(pos.X, pos.Y));
+ mouse_button->set_global_pos(Vector2(pos.X, pos.Y));
if (p_is_wheel) {
if (point->Properties->MouseWheelDelta > 0) {
- event->get_button_index() = point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_UP;
+ mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_UP);
} else if (point->Properties->MouseWheelDelta < 0) {
- event->get_button_index() = point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_LEFT : BUTTON_WHEEL_DOWN;
+ mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_LEFT : BUTTON_WHEEL_DOWN);
}
}
last_touch_x[31] = pos.X;
last_touch_y[31] = pos.Y;
- os->input_event(event);
+ os->input_event(mouse_button);
+
+ if (p_is_wheel) {
+ // Send release for mouse wheel
+ mouse_button->set_pressed(false);
+ os->input_event(mouse_button);
+ }
};
void App::OnPointerPressed(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
@@ -349,16 +352,14 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Co
if (point->IsInContact && _is_touch(point)) {
- InputEvent event;
- event.type = Ref<InputEvent>::SCREEN_DRAG;
- event.device = 0;
- event.screen_drag.x = pos.X;
- event.screen_drag.y = pos.Y;
- event.screen_drag.index = _get_finger(point->PointerId);
- event.screen_drag.relative_x = event.screen_drag.x - last_touch_x[event.screen_drag.index];
- event.screen_drag.relative_y = event.screen_drag.y - last_touch_y[event.screen_drag.index];
+ Ref<InputEventScreenDrag> screen_drag;
+ screen_drag.instance();
+ screen_drag->set_device(0);
+ screen_drag->set_pos(Vector2(pos.X, pos.Y));
+ screen_drag->set_index(_get_finger(point->PointerId));
+ screen_drag->set_relative(Vector2(screen_drag->get_pos().x - last_touch_x[screen_drag->get_index()], screen_drag->get_pos().y - last_touch_y[screen_drag->get_index()]));
- os->input_event(event);
+ os->input_event(screen_drag);
if (number_of_contacts > 1)
return;
@@ -368,19 +369,16 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Co
if (os->get_mouse_mode() == OS::MouseMode::MOUSE_MODE_CAPTURED)
return;
- InputEvent event;
- event.type = Ref<InputEvent>::MOUSE_MOTION;
- event.device = 0;
- event.mouse_motion.x = pos.X;
- event.mouse_motion.y = pos.Y;
- event.mouse_motion.global_x = pos.X;
- event.mouse_motion.global_y = pos.Y;
- event->get_relative().x = pos.X - last_touch_x[31];
- event->get_relative().y = pos.Y - last_touch_y[31];
+ Ref<InputEventMouseMotion> mouse_motion;
+ mouse_motion.instance();
+ mouse_motion->set_device(0);
+ mouse_motion->set_pos(Vector2(pos.X, pos.Y));
+ mouse_motion->set_global_pos(Vector2(pos.X, pos.Y));
+ mouse_motion->set_relative(Vector2(pos.X - last_touch_x[31], pos.Y - last_touch_y[31]));
last_mouse_pos = pos;
- os->input_event(event);
+ os->input_event(mouse_motion);
}
void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) {
@@ -393,47 +391,40 @@ void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) {
pos.X = last_mouse_pos.X + args->MouseDelta.X;
pos.Y = last_mouse_pos.Y + args->MouseDelta.Y;
- InputEvent event;
- event.type = Ref<InputEvent>::MOUSE_MOTION;
- event.device = 0;
- event.mouse_motion.x = pos.X;
- event.mouse_motion.y = pos.Y;
- event.mouse_motion.global_x = pos.X;
- event.mouse_motion.global_y = pos.Y;
- event->get_relative().x = args->MouseDelta.X;
- event->get_relative().y = args->MouseDelta.Y;
+ Ref<InputEventMouseMotion> mouse_motion;
+ mouse_motion.instance();
+ mouse_motion->set_device(0);
+ mouse_motion->set_pos(Vector2(pos.X, pos.Y));
+ mouse_motion->set_global_pos(Vector2(pos.X, pos.Y));
+ mouse_motion->set_relative(Vector2(args->MouseDelta.X, args->MouseDelta.Y));
last_mouse_pos = pos;
- os->input_event(event);
+ os->input_event(mouse_motion);
}
void App::key_event(Windows::UI::Core::CoreWindow ^ sender, bool p_pressed, Windows::UI::Core::KeyEventArgs ^ key_args, Windows::UI::Core::CharacterReceivedEventArgs ^ char_args) {
OSUWP::KeyEvent ke;
- InputModifierState mod;
- mod.meta = false;
- mod.command = false;
- mod.control = sender->GetAsyncKeyState(VirtualKey::Control) == CoreVirtualKeyStates::Down;
- mod.alt = sender->GetAsyncKeyState(VirtualKey::Menu) == CoreVirtualKeyStates::Down;
- mod.shift = sender->GetAsyncKeyState(VirtualKey::Shift) == CoreVirtualKeyStates::Down;
- ke.mod_state = mod;
+ ke.control = sender->GetAsyncKeyState(VirtualKey::Control) == CoreVirtualKeyStates::Down;
+ ke.alt = sender->GetAsyncKeyState(VirtualKey::Menu) == CoreVirtualKeyStates::Down;
+ ke.shift = sender->GetAsyncKeyState(VirtualKey::Shift) == CoreVirtualKeyStates::Down;
- ke->is_pressed() = p_pressed;
+ ke.pressed = p_pressed;
if (key_args != nullptr) {
ke.type = OSUWP::KeyEvent::MessageType::KEY_EVENT_MESSAGE;
ke.unicode = 0;
- ke->get_scancode() = KeyMappingWindows::get_keysym((unsigned int)key_args->VirtualKey);
+ ke.scancode = KeyMappingWindows::get_keysym((unsigned int)key_args->VirtualKey);
ke.echo = (!p_pressed && !key_args->KeyStatus.IsKeyReleased) || (p_pressed && key_args->KeyStatus.WasKeyDown);
} else {
ke.type = OSUWP::KeyEvent::MessageType::CHAR_EVENT_MESSAGE;
ke.unicode = char_args->KeyCode;
- ke->get_scancode() = 0;
+ ke.scancode = 0;
ke.echo = (!p_pressed && !char_args->KeyStatus.IsKeyReleased) || (p_pressed && char_args->KeyStatus.WasKeyDown);
}
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index f1e0716241..baff7f9788 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -49,6 +49,8 @@ def configure(env):
arch = ""
env['ENV'] = os.environ
+ vc_base_path = os.environ['VCTOOLSINSTALLDIR'] if "VCTOOLSINSTALLDIR" in os.environ else os.environ['VCINSTALLDIR']
+
# ANGLE
angle_root = os.getenv("ANGLE_SRC_PATH")
env.Append(CPPPATH=[angle_root + '/include'])
@@ -65,7 +67,7 @@ def configure(env):
arch = "arm"
env["bits"] = "32"
env.Append(LINKFLAGS=['/MACHINE:ARM'])
- env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/arm'])
+ env.Append(LIBPATH=[vc_base_path + 'lib/store/arm'])
angle_build_cmd += "ARM"
@@ -92,7 +94,7 @@ def configure(env):
env.Append(CPPFLAGS=['/DPNG_ABORT=abort'])
env.Append(LINKFLAGS=['/MACHINE:X86'])
- env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store'])
+ env.Append(LIBPATH=[vc_base_path + 'lib/store'])
env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_Win32/lib'])
else:
@@ -107,10 +109,9 @@ def configure(env):
env.Append(CPPPATH=['#platform/uwp', '#drivers/windows'])
env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"'])
env.Append(CPPFLAGS=['/D', '__WRL_NO_DEFAULT_LIB__', '/D', 'WIN32'])
- env.Append(CPPFLAGS=['/FU', os.environ['VCINSTALLDIR'] + 'lib/store/references/platform.winmd'])
- env.Append(CPPFLAGS=['/AI', os.environ['VCINSTALLDIR'] + 'lib/store/references'])
-
- env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/references'])
+
+ env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/store/references'])
+ env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/x86/store/references'])
if (env["target"] == "release"):
@@ -133,7 +134,7 @@ def configure(env):
env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'))
env.Append(CXXFLAGS=string.split('/ZW /FS'))
- env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR'] + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral'])
+ env.Append(CCFLAGS=['/AI', vc_base_path + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral'])
env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"]
env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"]
diff --git a/platform/uwp/gl_context_egl.cpp b/platform/uwp/gl_context_egl.cpp
index d79ce75db5..57c4c5d572 100644
--- a/platform/uwp/gl_context_egl.cpp
+++ b/platform/uwp/gl_context_egl.cpp
@@ -97,7 +97,7 @@ Error ContextEGL::initialize() {
EGLContext context = EGL_NO_CONTEXT;
EGLSurface surface = EGL_NO_SURFACE;
EGLConfig config = nullptr;
- EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE };
+ EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE, EGL_NONE };
try {
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 47f4b3f3c8..28aaf9161b 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -330,16 +330,9 @@ String OSUWP::get_clipboard() const {
return "";
};
-void OSUWP::input_event(Ref<InputEvent> &p_event) {
+void OSUWP::input_event(const Ref<InputEvent> &p_event) {
input->parse_input_event(p_event);
-
- if (p_event.type == Ref<InputEvent>::MOUSE_BUTTON && p_event->is_pressed() && p_event->get_button_index() > 3) {
-
- //send release for mouse wheel
- p_event->is_pressed() = false;
- input->parse_input_event(p_event);
- }
};
void OSUWP::delete_main_loop() {
@@ -663,16 +656,18 @@ void OSUWP::process_key_events() {
for (int i = 0; i < key_event_pos; i++) {
KeyEvent &kev = key_event_buffer[i];
- Ref<InputEvent> iev;
-
- iev.type = Ref<InputEvent>::KEY;
- iev.key.mod = kev.mod_state;
- iev->is_echo() = kev.echo;
- iev->get_scancode() = kev->get_scancode();
- iev.key.unicode = kev.unicode;
- iev->is_pressed() = kev->is_pressed();
- input_event(iev);
+ Ref<InputEventKey> key_event;
+ key_event.instance();
+ key_event->set_alt(kev.alt);
+ key_event->set_shift(kev.shift);
+ key_event->set_control(kev.control);
+ key_event->set_echo(kev.echo);
+ key_event->set_scancode(kev.scancode);
+ key_event->set_unicode(kev.unicode);
+ key_event->set_pressed(kev.pressed);
+
+ input_event(key_event);
}
key_event_pos = 0;
}
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index d2a51aad4c..45b8eefdee 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -63,7 +63,7 @@ public:
CHAR_EVENT_MESSAGE
};
- InputModifierState mod_state;
+ bool alt, shift, control;
MessageType type;
bool pressed;
unsigned int scancode;
@@ -257,7 +257,7 @@ public:
virtual bool get_swap_ok_cancel() { return true; }
- void input_event(Ref<InputEvent> &p_event);
+ void input_event(const Ref<InputEvent> &p_event);
virtual PowerState get_power_state();
virtual int get_power_seconds_left();
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index ba5db05dab..830aae5515 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -565,7 +565,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
ScreenToClient(hWnd, &coords);
- mb->set_pos(coords);
+ mb->set_pos(Vector2(coords.x, coords.y));
}
if (main_loop) {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index bd5acde417..6cbdd58830 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -68,8 +68,7 @@ class OS_Windows : public OS {
struct KeyEvent {
- InputModifierState mod_state;
- bool alt, shift, ctrl, meta;
+ bool alt, shift, control, meta;
UINT uMsg;
WPARAM wParam;
LPARAM lParam;
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 9ada68f5dc..b17192fe4f 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3032,7 +3032,7 @@ void Tree::ensure_cursor_is_visible() {
int screenh = get_size().height - h_scroll->get_combined_minimum_size().height;
if (ofs + h > v_scroll->get_value() + screenh)
- v_scroll->call_deferred("set_val", ofs - screenh + h);
+ v_scroll->call_deferred("set_value", ofs - screenh + h);
else if (ofs < v_scroll->get_value())
v_scroll->set_value(ofs);
}
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 76ff6edc63..4c359f73ab 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -561,8 +561,8 @@ void register_scene_types() {
ClassDB::register_class<Environment>();
ClassDB::register_class<World2D>();
ClassDB::register_virtual_class<Texture>();
- ClassDB::register_virtual_class<SkyBox>();
- ClassDB::register_class<ImageSkyBox>();
+ ClassDB::register_virtual_class<Sky>();
+ ClassDB::register_class<PanoramaSky>();
ClassDB::register_class<StreamTexture>();
ClassDB::register_class<ImageTexture>();
ClassDB::register_class<AtlasTexture>();
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 96871cc944..39943b99db 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -44,21 +44,21 @@ void Environment::set_background(BGMode p_bg) {
_change_notify();
}
-void Environment::set_skybox(const Ref<SkyBox> &p_skybox) {
+void Environment::set_sky(const Ref<Sky> &p_sky) {
- bg_skybox = p_skybox;
+ bg_sky = p_sky;
RID sb_rid;
- if (bg_skybox.is_valid())
- sb_rid = bg_skybox->get_rid();
+ if (bg_sky.is_valid())
+ sb_rid = bg_sky->get_rid();
- VS::get_singleton()->environment_set_skybox(environment, sb_rid);
+ VS::get_singleton()->environment_set_sky(environment, sb_rid);
}
-void Environment::set_skybox_scale(float p_scale) {
+void Environment::set_sky_scale(float p_scale) {
- bg_skybox_scale = p_scale;
- VS::get_singleton()->environment_set_skybox_scale(environment, p_scale);
+ bg_sky_scale = p_scale;
+ VS::get_singleton()->environment_set_sky_scale(environment, p_scale);
}
void Environment::set_bg_color(const Color &p_color) {
@@ -79,31 +79,31 @@ void Environment::set_canvas_max_layer(int p_max_layer) {
void Environment::set_ambient_light_color(const Color &p_color) {
ambient_color = p_color;
- VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, ambient_energy, ambient_skybox_contribution);
+ VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, ambient_energy, ambient_sky_contribution);
}
void Environment::set_ambient_light_energy(float p_energy) {
ambient_energy = p_energy;
- VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, ambient_energy, ambient_skybox_contribution);
+ VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, ambient_energy, ambient_sky_contribution);
}
-void Environment::set_ambient_light_skybox_contribution(float p_energy) {
+void Environment::set_ambient_light_sky_contribution(float p_energy) {
- ambient_skybox_contribution = p_energy;
- VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, ambient_energy, ambient_skybox_contribution);
+ ambient_sky_contribution = p_energy;
+ VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, ambient_energy, ambient_sky_contribution);
}
Environment::BGMode Environment::get_background() const {
return bg_mode;
}
-Ref<SkyBox> Environment::get_skybox() const {
+Ref<Sky> Environment::get_sky() const {
- return bg_skybox;
+ return bg_sky;
}
-float Environment::get_skybox_scale() const {
+float Environment::get_sky_scale() const {
- return bg_skybox_scale;
+ return bg_sky_scale;
}
Color Environment::get_bg_color() const {
@@ -126,9 +126,9 @@ float Environment::get_ambient_light_energy() const {
return ambient_energy;
}
-float Environment::get_ambient_light_skybox_contribution() const {
+float Environment::get_ambient_light_sky_contribution() const {
- return ambient_skybox_contribution;
+ return ambient_sky_contribution;
}
void Environment::set_tonemapper(ToneMapper p_tone_mapper) {
@@ -266,8 +266,8 @@ Ref<Texture> Environment::get_adjustment_color_correction() const {
void Environment::_validate_property(PropertyInfo &property) const {
- if (property.name == "background/skybox" || property.name == "background/skybox_scale" || property.name == "ambient_light/skybox_contribution") {
- if (bg_mode != BG_SKYBOX) {
+ if (property.name == "background/sky" || property.name == "background/sky_scale" || property.name == "ambient_light/sky_contribution") {
+ if (bg_mode != BG_SKY) {
property.usage = PROPERTY_USAGE_NOEDITOR;
}
}
@@ -664,36 +664,36 @@ Environment::DOFBlurQuality Environment::get_dof_blur_near_quality() const {
void Environment::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_background", "mode"), &Environment::set_background);
- ClassDB::bind_method(D_METHOD("set_skybox", "skybox:CubeMap"), &Environment::set_skybox);
- ClassDB::bind_method(D_METHOD("set_skybox_scale", "scale"), &Environment::set_skybox_scale);
+ ClassDB::bind_method(D_METHOD("set_sky", "sky:CubeMap"), &Environment::set_sky);
+ ClassDB::bind_method(D_METHOD("set_sky_scale", "scale"), &Environment::set_sky_scale);
ClassDB::bind_method(D_METHOD("set_bg_color", "color"), &Environment::set_bg_color);
ClassDB::bind_method(D_METHOD("set_bg_energy", "energy"), &Environment::set_bg_energy);
ClassDB::bind_method(D_METHOD("set_canvas_max_layer", "layer"), &Environment::set_canvas_max_layer);
ClassDB::bind_method(D_METHOD("set_ambient_light_color", "color"), &Environment::set_ambient_light_color);
ClassDB::bind_method(D_METHOD("set_ambient_light_energy", "energy"), &Environment::set_ambient_light_energy);
- ClassDB::bind_method(D_METHOD("set_ambient_light_skybox_contribution", "energy"), &Environment::set_ambient_light_skybox_contribution);
+ ClassDB::bind_method(D_METHOD("set_ambient_light_sky_contribution", "energy"), &Environment::set_ambient_light_sky_contribution);
ClassDB::bind_method(D_METHOD("get_background"), &Environment::get_background);
- ClassDB::bind_method(D_METHOD("get_skybox:CubeMap"), &Environment::get_skybox);
- ClassDB::bind_method(D_METHOD("get_skybox_scale"), &Environment::get_skybox_scale);
+ ClassDB::bind_method(D_METHOD("get_sky:CubeMap"), &Environment::get_sky);
+ ClassDB::bind_method(D_METHOD("get_sky_scale"), &Environment::get_sky_scale);
ClassDB::bind_method(D_METHOD("get_bg_color"), &Environment::get_bg_color);
ClassDB::bind_method(D_METHOD("get_bg_energy"), &Environment::get_bg_energy);
ClassDB::bind_method(D_METHOD("get_canvas_max_layer"), &Environment::get_canvas_max_layer);
ClassDB::bind_method(D_METHOD("get_ambient_light_color"), &Environment::get_ambient_light_color);
ClassDB::bind_method(D_METHOD("get_ambient_light_energy"), &Environment::get_ambient_light_energy);
- ClassDB::bind_method(D_METHOD("get_ambient_light_skybox_contribution"), &Environment::get_ambient_light_skybox_contribution);
+ ClassDB::bind_method(D_METHOD("get_ambient_light_sky_contribution"), &Environment::get_ambient_light_sky_contribution);
ADD_GROUP("Background", "background_");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "background_mode", PROPERTY_HINT_ENUM, "Clear Color,Custom Color,Skybox,Canvas,Keep"), "set_background", "get_background");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "background_skybox", PROPERTY_HINT_RESOURCE_TYPE, "SkyBox"), "set_skybox", "get_skybox");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_skybox_scale", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_skybox_scale", "get_skybox_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "background_mode", PROPERTY_HINT_ENUM, "Clear Color,Custom Color,Sky,Canvas,Keep"), "set_background", "get_background");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "background_sky", PROPERTY_HINT_RESOURCE_TYPE, "Sky"), "set_sky", "get_sky");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_sky_scale", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_sky_scale", "get_sky_scale");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "background_color"), "set_bg_color", "get_bg_color");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_bg_energy", "get_bg_energy");
ADD_PROPERTY(PropertyInfo(Variant::INT, "background_canvas_max_layer", PROPERTY_HINT_RANGE, "-1000,1000,1"), "set_canvas_max_layer", "get_canvas_max_layer");
ADD_GROUP("Ambient Light", "ambient_light_");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ambient_light_color"), "set_ambient_light_color", "get_ambient_light_color");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ambient_light_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_ambient_light_energy", "get_ambient_light_energy");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ambient_light_skybox_contribution", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ambient_light_skybox_contribution", "get_ambient_light_skybox_contribution");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "ambient_light_sky_contribution", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ambient_light_sky_contribution", "get_ambient_light_sky_contribution");
ClassDB::bind_method(D_METHOD("set_ssr_enabled", "enabled"), &Environment::set_ssr_enabled);
ClassDB::bind_method(D_METHOD("is_ssr_enabled"), &Environment::is_ssr_enabled);
@@ -909,12 +909,12 @@ void Environment::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "adjustment_saturation", PROPERTY_HINT_RANGE, "0.01,8,0.01"), "set_adjustment_saturation", "get_adjustment_saturation");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "adjustment_color_correction", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_adjustment_color_correction", "get_adjustment_color_correction");
- GLOBAL_DEF("rendering/skybox/irradiance_cube_resolution", 256);
+ GLOBAL_DEF("rendering/sky/irradiance_cube_resolution", 256);
BIND_CONSTANT(BG_KEEP);
BIND_CONSTANT(BG_CLEAR_COLOR);
BIND_CONSTANT(BG_COLOR);
- BIND_CONSTANT(BG_SKYBOX);
+ BIND_CONSTANT(BG_SKY);
BIND_CONSTANT(BG_CANVAS);
BIND_CONSTANT(BG_MAX);
BIND_CONSTANT(GLOW_BLEND_MODE_ADDITIVE);
@@ -933,11 +933,11 @@ void Environment::_bind_methods() {
Environment::Environment() {
bg_mode = BG_CLEAR_COLOR;
- bg_skybox_scale = 1.0;
+ bg_sky_scale = 1.0;
bg_energy = 1.0;
bg_canvas_max_layer = 0;
ambient_energy = 1.0;
- ambient_skybox_contribution = 0;
+ ambient_sky_contribution = 0;
tone_mapper = TONE_MAPPER_LINEAR;
tonemap_exposure = 1.0;
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index 9014a9f5c2..d9141ccd9c 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -44,7 +44,7 @@ public:
BG_CLEAR_COLOR,
BG_COLOR,
- BG_SKYBOX,
+ BG_SKY,
BG_CANVAS,
BG_KEEP,
BG_MAX
@@ -74,14 +74,14 @@ private:
RID environment;
BGMode bg_mode;
- Ref<SkyBox> bg_skybox;
- float bg_skybox_scale;
+ Ref<Sky> bg_sky;
+ float bg_sky_scale;
Color bg_color;
float bg_energy;
int bg_canvas_max_layer;
Color ambient_color;
float ambient_energy;
- float ambient_skybox_contribution;
+ float ambient_sky_contribution;
ToneMapper tone_mapper;
float tonemap_exposure;
@@ -144,24 +144,24 @@ protected:
public:
void set_background(BGMode p_bg);
- void set_skybox(const Ref<SkyBox> &p_skybox);
- void set_skybox_scale(float p_scale);
+ void set_sky(const Ref<Sky> &p_sky);
+ void set_sky_scale(float p_scale);
void set_bg_color(const Color &p_color);
void set_bg_energy(float p_energy);
void set_canvas_max_layer(int p_max_layer);
void set_ambient_light_color(const Color &p_color);
void set_ambient_light_energy(float p_energy);
- void set_ambient_light_skybox_contribution(float p_energy);
+ void set_ambient_light_sky_contribution(float p_energy);
BGMode get_background() const;
- Ref<SkyBox> get_skybox() const;
- float get_skybox_scale() const;
+ Ref<Sky> get_sky() const;
+ float get_sky_scale() const;
Color get_bg_color() const;
float get_bg_energy() const;
int get_canvas_max_layer() const;
Color get_ambient_light_color() const;
float get_ambient_light_energy() const;
- float get_ambient_light_skybox_contribution() const;
+ float get_ambient_light_sky_contribution() const;
void set_tonemapper(ToneMapper p_tone_mapper);
ToneMapper get_tonemapper() const;
diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp
index 2fd074de0f..59ade4a729 100644
--- a/scene/resources/sky_box.cpp
+++ b/scene/resources/sky_box.cpp
@@ -30,22 +30,22 @@
#include "sky_box.h"
#include "io/image_loader.h"
-void SkyBox::set_radiance_size(RadianceSize p_size) {
+void Sky::set_radiance_size(RadianceSize p_size) {
ERR_FAIL_INDEX(p_size, RADIANCE_SIZE_MAX);
radiance_size = p_size;
_radiance_changed();
}
-SkyBox::RadianceSize SkyBox::get_radiance_size() const {
+Sky::RadianceSize Sky::get_radiance_size() const {
return radiance_size;
}
-void SkyBox::_bind_methods() {
+void Sky::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_radiance_size", "size"), &SkyBox::set_radiance_size);
- ClassDB::bind_method(D_METHOD("get_radiance_size"), &SkyBox::get_radiance_size);
+ ClassDB::bind_method(D_METHOD("set_radiance_size", "size"), &Sky::set_radiance_size);
+ ClassDB::bind_method(D_METHOD("get_radiance_size"), &Sky::get_radiance_size);
ADD_PROPERTY(PropertyInfo(Variant::INT, "radiance_size", PROPERTY_HINT_ENUM, "256,512,1024,2048"), "set_radiance_size", "get_radiance_size");
@@ -56,124 +56,59 @@ void SkyBox::_bind_methods() {
BIND_CONSTANT(RADIANCE_SIZE_MAX);
}
-SkyBox::SkyBox() {
+Sky::Sky() {
radiance_size = RADIANCE_SIZE_512;
}
/////////////////////////////////////////
-void ImageSkyBox::_radiance_changed() {
+void PanoramaSky::_radiance_changed() {
- if (cube_map_valid) {
+ if (panorama.is_valid()) {
static const int size[RADIANCE_SIZE_MAX] = {
256, 512, 1024, 2048
};
- VS::get_singleton()->skybox_set_texture(sky_box, cube_map, size[get_radiance_size()]);
+ VS::get_singleton()->sky_set_texture(sky, panorama->get_rid(), size[get_radiance_size()]);
}
}
-void ImageSkyBox::set_image_path(ImagePath p_image, const String &p_path) {
+void PanoramaSky::set_panorama(const Ref<Texture> &p_panorama) {
- ERR_FAIL_INDEX(p_image, IMAGE_PATH_MAX);
- image_path[p_image] = p_path;
+ panorama = p_panorama;
- bool all_ok = true;
- for (int i = 0; i < IMAGE_PATH_MAX; i++) {
- if (image_path[i] == String()) {
- all_ok = false;
- }
- }
+ if (panorama.is_valid()) {
- cube_map_valid = false;
-
- if (all_ok) {
-
- Ref<Image> images[IMAGE_PATH_MAX];
- int w = 0, h = 0;
- Image::Format format;
-
- for (int i = 0; i < IMAGE_PATH_MAX; i++) {
- images[i].instance();
- Error err = ImageLoader::load_image(image_path[i], images[i]);
- if (err) {
- ERR_PRINTS("Error loading image for skybox: " + image_path[i]);
- return;
- }
-
- if (i == 0) {
- w = images[0]->get_width();
- h = images[0]->get_height();
- format = images[0]->get_format();
- } else {
- if (images[i]->get_width() != w || images[i]->get_height() != h || images[i]->get_format() != format) {
- ERR_PRINTS("Image size mismatch (" + itos(images[i]->get_width()) + "," + itos(images[i]->get_height()) + ":" + Image::get_format_name(images[i]->get_format()) + " when it should be " + itos(w) + "," + itos(h) + ":" + Image::get_format_name(format) + "): " + image_path[i]);
- return;
- }
- }
- }
-
- VS::get_singleton()->texture_allocate(cube_map, w, h, format, VS::TEXTURE_FLAG_FILTER | VS::TEXTURE_FLAG_CUBEMAP | VS::TEXTURE_FLAG_MIPMAPS);
- for (int i = 0; i < IMAGE_PATH_MAX; i++) {
- VS::get_singleton()->texture_set_data(cube_map, images[i], VS::CubeMapSide(i));
- }
-
- cube_map_valid = true;
_radiance_changed();
+
+ } else {
+ VS::get_singleton()->sky_set_texture(sky, RID(), 0);
}
}
-String ImageSkyBox::get_image_path(ImagePath p_image) const {
+Ref<Texture> PanoramaSky::get_panorama() const {
- ERR_FAIL_INDEX_V(p_image, IMAGE_PATH_MAX, String());
- return image_path[p_image];
+ return panorama;
}
-RID ImageSkyBox::get_rid() const {
+RID PanoramaSky::get_rid() const {
- return sky_box;
+ return sky;
}
-void ImageSkyBox::_bind_methods() {
+void PanoramaSky::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_image_path", "image", "path"), &ImageSkyBox::set_image_path);
- ClassDB::bind_method(D_METHOD("get_image_path", "image"), &ImageSkyBox::get_image_path);
-
- List<String> extensions;
- ImageLoader::get_recognized_extensions(&extensions);
- String hints;
- for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
- if (hints != String()) {
- hints += ",";
- }
- hints += "*." + E->get();
- }
+ ClassDB::bind_method(D_METHOD("set_panorama", "texture:Texture"), &PanoramaSky::set_panorama);
+ ClassDB::bind_method(D_METHOD("get_panorama:Texture"), &PanoramaSky::get_panorama);
- ADD_GROUP("Image Path", "image_path_");
- ADD_PROPERTYI(PropertyInfo(Variant::STRING, "image_path_negative_x", PROPERTY_HINT_FILE, hints), "set_image_path", "get_image_path", IMAGE_PATH_NEGATIVE_X);
- ADD_PROPERTYI(PropertyInfo(Variant::STRING, "image_path_positive_x", PROPERTY_HINT_FILE, hints), "set_image_path", "get_image_path", IMAGE_PATH_POSITIVE_X);
- ADD_PROPERTYI(PropertyInfo(Variant::STRING, "image_path_negative_y", PROPERTY_HINT_FILE, hints), "set_image_path", "get_image_path", IMAGE_PATH_NEGATIVE_Y);
- ADD_PROPERTYI(PropertyInfo(Variant::STRING, "image_path_positive_y", PROPERTY_HINT_FILE, hints), "set_image_path", "get_image_path", IMAGE_PATH_POSITIVE_Y);
- ADD_PROPERTYI(PropertyInfo(Variant::STRING, "image_path_negative_z", PROPERTY_HINT_FILE, hints), "set_image_path", "get_image_path", IMAGE_PATH_NEGATIVE_Z);
- ADD_PROPERTYI(PropertyInfo(Variant::STRING, "image_path_positive_z", PROPERTY_HINT_FILE, hints), "set_image_path", "get_image_path", IMAGE_PATH_POSITIVE_Z);
-
- BIND_CONSTANT(IMAGE_PATH_NEGATIVE_X);
- BIND_CONSTANT(IMAGE_PATH_POSITIVE_X);
- BIND_CONSTANT(IMAGE_PATH_NEGATIVE_Y);
- BIND_CONSTANT(IMAGE_PATH_POSITIVE_Y);
- BIND_CONSTANT(IMAGE_PATH_NEGATIVE_Z);
- BIND_CONSTANT(IMAGE_PATH_POSITIVE_Z);
- BIND_CONSTANT(IMAGE_PATH_MAX);
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "panorama", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_panorama", "get_panorama");
}
-ImageSkyBox::ImageSkyBox() {
+PanoramaSky::PanoramaSky() {
- cube_map = VS::get_singleton()->texture_create();
- sky_box = VS::get_singleton()->skybox_create();
- cube_map_valid = false;
+ sky = VS::get_singleton()->sky_create();
}
-ImageSkyBox::~ImageSkyBox() {
+PanoramaSky::~PanoramaSky() {
- VS::get_singleton()->free(cube_map);
- VS::get_singleton()->free(sky_box);
+ VS::get_singleton()->free(sky);
}
diff --git a/scene/resources/sky_box.h b/scene/resources/sky_box.h
index f748ac1e2d..afbfb3019e 100644
--- a/scene/resources/sky_box.h
+++ b/scene/resources/sky_box.h
@@ -27,13 +27,13 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef SKYBOX_H
-#define SKYBOX_H
+#ifndef Sky_H
+#define Sky_H
#include "scene/resources/texture.h"
-class SkyBox : public Resource {
- GDCLASS(SkyBox, Resource);
+class Sky : public Resource {
+ GDCLASS(Sky, Resource);
public:
enum RadianceSize {
@@ -54,13 +54,13 @@ protected:
public:
void set_radiance_size(RadianceSize p_size);
RadianceSize get_radiance_size() const;
- SkyBox();
+ Sky();
};
-VARIANT_ENUM_CAST(SkyBox::RadianceSize)
+VARIANT_ENUM_CAST(Sky::RadianceSize)
-class ImageSkyBox : public SkyBox {
- GDCLASS(ImageSkyBox, SkyBox);
+class PanoramaSky : public Sky {
+ GDCLASS(PanoramaSky, Sky);
public:
enum ImagePath {
@@ -74,26 +74,23 @@ public:
};
private:
- RID cube_map;
- RID sky_box;
- bool cube_map_valid;
-
- String image_path[IMAGE_PATH_MAX];
+ RID sky;
+ Ref<Texture> panorama;
protected:
static void _bind_methods();
virtual void _radiance_changed();
public:
- void set_image_path(ImagePath p_image, const String &p_path);
- String get_image_path(ImagePath p_image) const;
+ void set_panorama(const Ref<Texture> &p_panorama);
+ Ref<Texture> get_panorama() const;
virtual RID get_rid() const;
- ImageSkyBox();
- ~ImageSkyBox();
+ PanoramaSky();
+ ~PanoramaSky();
};
-VARIANT_ENUM_CAST(ImageSkyBox::ImagePath)
+VARIANT_ENUM_CAST(PanoramaSky::ImagePath)
-#endif // SKYBOX_H
+#endif // Sky_H
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index ff80aa4284..bc8deb501e 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -351,10 +351,6 @@ void ImageTexture::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_lossy_storage_quality"), &ImageTexture::get_lossy_storage_quality);
ClassDB::bind_method(D_METHOD("set_size_override", "size"), &ImageTexture::set_size_override);
- ClassDB::set_method_flags(get_class_static(), _scs_create("fix_alpha_edges"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
- ClassDB::set_method_flags(get_class_static(), _scs_create("premultiply_alpha"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
- ClassDB::set_method_flags(get_class_static(), _scs_create("normal_to_xy"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
- ClassDB::set_method_flags(get_class_static(), _scs_create("shrink_x2_and_keep_size"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
ClassDB::bind_method(D_METHOD("_reload_hook", "rid"), &ImageTexture::_reload_hook);
BIND_CONSTANT(STORAGE_RAW);
@@ -406,7 +402,7 @@ Image::Format StreamTexture::get_format() const {
return format;
}
-Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &flags, Ref<Image> image, int p_size_limit) {
+Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &flags, Ref<Image> &image, int p_size_limit) {
ERR_FAIL_COND_V(image.is_null(), ERR_INVALID_PARAMETER);
@@ -502,6 +498,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
memdelete(f);
ERR_FAIL_COND_V(img->empty(), ERR_FILE_CORRUPT);
}
+
total_size += img->get_data().size();
mipmap_images.push_back(img);
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 3aa007fa00..07416529ae 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -170,7 +170,7 @@ public:
};
private:
- Error _load_data(const String &p_path, int &tw, int &th, int &flags, Ref<Image> image, int p_size_limit = 0);
+ Error _load_data(const String &p_path, int &tw, int &th, int &flags, Ref<Image> &image, int p_size_limit = 0);
String path_to_file;
RID texture;
Image::Format format;
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 12cf30cfc4..c51dcd1a3b 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -52,12 +52,12 @@ public:
virtual RID environment_create() = 0;
virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg) = 0;
- virtual void environment_set_skybox(RID p_env, RID p_skybox) = 0;
- virtual void environment_set_skybox_scale(RID p_env, float p_scale) = 0;
+ virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
+ virtual void environment_set_sky_scale(RID p_env, float p_scale) = 0;
virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
- virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_skybox_contribution = 0.0) = 0;
+ virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0) = 0;
virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality) = 0;
virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality) = 0;
@@ -187,10 +187,10 @@ public:
virtual void textures_keep_original(bool p_enable) = 0;
- /* SKYBOX API */
+ /* SKY API */
- virtual RID skybox_create() = 0;
- virtual void skybox_set_texture(RID p_skybox, RID p_cube_map, int p_radiance_size) = 0;
+ virtual RID sky_create() = 0;
+ virtual void sky_set_texture(RID p_sky, RID p_cube_map, int p_radiance_size) = 0;
/* SHADER API */
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 95806a2e1a..957af7b9dd 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -644,10 +644,10 @@ public:
BIND1(textures_keep_original, bool)
- /* SKYBOX API */
+ /* SKY API */
- BIND0R(RID, skybox_create)
- BIND3(skybox_set_texture, RID, RID, int)
+ BIND0R(RID, sky_create)
+ BIND3(sky_set_texture, RID, RID, int)
/* SHADER API */
@@ -932,8 +932,8 @@ public:
BIND0R(RID, environment_create)
BIND2(environment_set_background, RID, EnvironmentBG)
- BIND2(environment_set_skybox, RID, RID)
- BIND2(environment_set_skybox_scale, RID, float)
+ BIND2(environment_set_sky, RID, RID)
+ BIND2(environment_set_sky_scale, RID, float)
BIND2(environment_set_bg_color, RID, const Color &)
BIND2(environment_set_bg_energy, RID, float)
BIND2(environment_set_canvas_max_layer, RID, int)
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 9277684732..aa98d47455 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -141,10 +141,10 @@ public:
virtual void textures_keep_original(bool p_enable) = 0;
- /* SKYBOX API */
+ /* SKY API */
- virtual RID skybox_create() = 0;
- virtual void skybox_set_texture(RID p_skybox, RID p_cube_map, int p_radiance_size) = 0;
+ virtual RID sky_create() = 0;
+ virtual void sky_set_texture(RID p_sky, RID p_cube_map, int p_radiance_size) = 0;
/* SHADER API */
@@ -589,19 +589,19 @@ public:
ENV_BG_CLEAR_COLOR,
ENV_BG_COLOR,
- ENV_BG_SKYBOX,
+ ENV_BG_SKY,
ENV_BG_CANVAS,
ENV_BG_KEEP,
ENV_BG_MAX
};
virtual void environment_set_background(RID p_env, EnvironmentBG p_bg) = 0;
- virtual void environment_set_skybox(RID p_env, RID p_skybox) = 0;
- virtual void environment_set_skybox_scale(RID p_env, float p_scale) = 0;
+ virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
+ virtual void environment_set_sky_scale(RID p_env, float p_scale) = 0;
virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
- virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_skybox_contribution = 0.0) = 0;
+ virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0) = 0;
//set default SSAO options
//set default SSR options