summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/canvas_item.cpp4
-rw-r--r--scene/2d/collision_object_2d.cpp2
-rw-r--r--scene/3d/collision_object.cpp1
-rw-r--r--scene/3d/gi_probe.cpp130
-rw-r--r--scene/3d/gi_probe.h7
-rw-r--r--scene/3d/light.cpp2
-rw-r--r--scene/3d/portal.cpp2
-rw-r--r--scene/3d/room_instance.cpp2
-rw-r--r--scene/3d/skeleton.cpp2
-rw-r--r--scene/gui/button_array.cpp14
-rw-r--r--scene/gui/button_array.h1
-rw-r--r--scene/gui/control.cpp2
-rw-r--r--scene/gui/dialogs.cpp4
-rw-r--r--scene/gui/item_list.cpp18
-rw-r--r--scene/gui/item_list.h1
-rw-r--r--scene/gui/label.cpp2
-rw-r--r--scene/gui/text_edit.cpp2
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--scene/io/resource_format_image.cpp2
-rw-r--r--scene/main/node.h2
-rw-r--r--scene/main/scene_main_loop.cpp22
-rw-r--r--scene/main/scene_main_loop.h6
-rw-r--r--scene/main/viewport.cpp2
-rw-r--r--scene/register_scene_types.cpp2
-rw-r--r--scene/resources/audio_stream_resampled.cpp2
-rw-r--r--scene/resources/environment.cpp2
-rw-r--r--scene/resources/material.cpp2
-rw-r--r--scene/resources/mesh.cpp4
-rw-r--r--scene/resources/packed_scene.cpp14
-rw-r--r--scene/resources/packed_scene.h4
-rw-r--r--scene/resources/scene_format_text.cpp2
-rw-r--r--scene/resources/texture.cpp11
-rw-r--r--scene/resources/texture.h4
-rw-r--r--scene/resources/world_2d.cpp4
-rw-r--r--scene/resources/world_2d.h2
35 files changed, 211 insertions, 74 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 3574a39940..4f7acf7f97 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -747,12 +747,12 @@ float CanvasItem::draw_char(const Ref<Font>& p_font,const Point2& p_pos, const S
void CanvasItem::_notify_transform(CanvasItem *p_node) {
- if (p_node->xform_change.in_list() && p_node->global_invalid)
+ if (/*p_node->xform_change.in_list() &&*/ p_node->global_invalid)
return; //nothing to do
p_node->global_invalid=true;
- if (notify_transform && !p_node->xform_change.in_list()) {
+ if (p_node->notify_transform && !p_node->xform_change.in_list()) {
if (!p_node->block_transform_notify) {
if (p_node->is_inside_tree())
get_tree()->xform_change_list.add(&p_node->xform_change);
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 7b935e0d59..f9e1cc0bd7 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -348,6 +348,8 @@ CollisionObject2D::CollisionObject2D(RID p_rid, bool p_area) {
rid=p_rid;
area=p_area;
pickable=true;
+ set_notify_transform(true);
+
if (p_area) {
Physics2DServer::get_singleton()->area_attach_object_instance_ID(rid,get_instance_ID());
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index 09fe7cd2fc..32e60f0d57 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -334,6 +334,7 @@ CollisionObject::CollisionObject(RID p_rid, bool p_area) {
area=p_area;
capture_input_on_drag=false;
ray_pickable=true;
+ set_notify_transform(true);
if (p_area) {
PhysicsServer::get_singleton()->area_attach_object_instance_ID(rid,get_instance_ID());
} else {
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index 4ce714818f..e3c8ba09fc 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -64,6 +64,19 @@ float GIProbeData::get_energy() const{
}
+
+void GIProbeData::set_bias(float p_range) {
+
+ VS::get_singleton()->gi_probe_set_bias(probe,p_range);
+}
+
+float GIProbeData::get_bias() const{
+
+ return VS::get_singleton()->gi_probe_get_bias(probe);
+
+}
+
+
void GIProbeData::set_propagation(float p_range) {
VS::get_singleton()->gi_probe_set_propagation(probe,p_range);
@@ -133,6 +146,9 @@ void GIProbeData::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_energy","energy"),&GIProbeData::set_energy);
ClassDB::bind_method(D_METHOD("get_energy"),&GIProbeData::get_energy);
+ ClassDB::bind_method(D_METHOD("set_bias","bias"),&GIProbeData::set_bias);
+ ClassDB::bind_method(D_METHOD("get_bias"),&GIProbeData::get_bias);
+
ClassDB::bind_method(D_METHOD("set_propagation","propagation"),&GIProbeData::set_propagation);
ClassDB::bind_method(D_METHOD("get_propagation"),&GIProbeData::get_propagation);
@@ -149,6 +165,7 @@ void GIProbeData::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY,"dynamic_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),"set_dynamic_data","get_dynamic_data");
ADD_PROPERTY(PropertyInfo(Variant::INT,"dynamic_range",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),"set_dynamic_range","get_dynamic_range");
ADD_PROPERTY(PropertyInfo(Variant::REAL,"energy",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),"set_energy","get_energy");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL,"bias",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),"set_bias","get_bias");
ADD_PROPERTY(PropertyInfo(Variant::REAL,"propagation",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),"set_propagation","get_propagation");
ADD_PROPERTY(PropertyInfo(Variant::BOOL,"interior",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),"set_interior","is_interior");
ADD_PROPERTY(PropertyInfo(Variant::BOOL,"compress",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),"set_compress","is_compressed");
@@ -230,6 +247,18 @@ float GIProbe::get_energy() const {
return energy;
}
+void GIProbe::set_bias(float p_bias) {
+
+ bias=p_bias;
+ if (probe_data.is_valid()) {
+ probe_data->set_bias(bias);
+ }
+}
+float GIProbe::get_bias() const {
+
+ return bias;
+}
+
void GIProbe::set_propagation(float p_propagation) {
propagation=p_propagation;
@@ -466,7 +495,8 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V
int closest_axis;
float closest_dot;
- Vector3 normal = Plane(p_vtx[0],p_vtx[1],p_vtx[2]).normal;
+ Plane plane = Plane(p_vtx[0],p_vtx[1],p_vtx[2]);
+ Vector3 normal = plane.normal;
for(int i=0;i<3;i++) {
@@ -479,6 +509,7 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V
}
}
+
Vector3 axis;
axis[closest_axis]=1.0;
Vector3 t1;
@@ -517,24 +548,23 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V
Vector3 ray_from = from + (t1+t2)*0.5 - axis * p_aabb.size[closest_axis];
Vector3 ray_to = ray_from + axis * p_aabb.size[closest_axis]*2;
+ if (normal.dot(ray_from-ray_to)<0) {
+ SWAP(ray_from,ray_to);
+ }
+
Vector3 intersection;
- if (!Geometry::ray_intersects_triangle(ray_from,ray_to,p_vtx[0],p_vtx[1],p_vtx[2],&intersection)) {
- //no intersect? look in edges
-
- float closest_dist=1e20;
- for(int j=0;j<3;j++) {
- Vector3 c;
- Vector3 inters;
- Geometry::get_closest_points_between_segments(p_vtx[j],p_vtx[(j+1)%3],ray_from,ray_to,inters,c);
- float d=c.distance_to(intersection);
- if (j==0 || d<closest_dist) {
- closest_dist=d;
- intersection=inters;
- }
+ if (!plane.intersects_segment(ray_from,ray_to,&intersection)) {
+ if (ABS(plane.distance_to(ray_from)) < ABS(plane.distance_to(ray_to))) {
+ intersection = plane.project(ray_from);
+ } else {
+
+ intersection = plane.project(ray_to);
}
}
+ intersection=Face3(p_vtx[0],p_vtx[1],p_vtx[2]).get_closest_point_to(intersection);
+
Vector2 uv = get_uv(intersection,p_vtx,p_uv);
@@ -856,6 +886,10 @@ Vector<Color> GIProbe::_get_bake_texture(Image &p_image,const Color& p_color) {
return ret;
}
+ if (p_image.is_compressed()) {
+ print_line("DECOMPRESSING!!!!");
+ p_image.decompress();
+ }
p_image.convert(Image::FORMAT_RGBA8);
p_image.resize(bake_texture_size,bake_texture_size,Image::INTERPOLATE_CUBIC);
@@ -892,13 +926,14 @@ GIProbe::Baker::MaterialCache GIProbe::_get_material_cache(Ref<Material> p_mater
if (mat.is_valid()) {
-
- Ref<ImageTexture> albedo_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_ALBEDO);
+ Ref<Texture> albedo_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_ALBEDO);
Image img_albedo;
if (albedo_tex.is_valid()) {
img_albedo = albedo_tex->get_data();
+ } else {
+
}
mc.albedo=_get_bake_texture(img_albedo,mat->get_albedo());
@@ -950,6 +985,7 @@ void GIProbe::_plot_mesh(const Transform& p_xform, Ref<Mesh>& p_mesh, Baker *p_b
src_material=p_materials[i];
} else {
src_material=p_mesh->surface_get_material(i);
+
}
Baker::MaterialCache material = _get_material_cache(src_material,p_baker);
@@ -1056,6 +1092,31 @@ void GIProbe::_find_meshes(Node *p_at_node,Baker *p_baker){
}
}
+ if (p_at_node->cast_to<Spatial>()) {
+
+ Spatial *s = p_at_node->cast_to<Spatial>();
+ Array meshes = p_at_node->call("get_meshes");
+ for(int i=0;i<meshes.size();i+=2) {
+
+ Transform mxf = meshes[i];
+ Ref<Mesh> mesh = meshes[i+1];
+ if (!mesh.is_valid())
+ continue;
+
+ Rect3 aabb = mesh->get_aabb();
+
+ Transform xf = get_global_transform().affine_inverse() * (s->get_global_transform() * mxf);
+
+ if (Rect3(-extents,extents*2).intersects(xf.xform(aabb))) {
+ Baker::PlotMesh pm;
+ pm.local_xform=xf;
+ pm.mesh=mesh;
+ p_baker->mesh_list.push_back(pm);
+
+ }
+ }
+ }
+
for(int i=0;i<p_at_node->get_child_count();i++) {
Node *child = p_at_node->get_child(i);
@@ -1208,26 +1269,30 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){
}
- Ref<GIProbeData> probe_data;
- probe_data.instance();
- probe_data->set_bounds(Rect3(-extents,extents*2.0));
- probe_data->set_cell_size(baker.po2_bounds.size[longest_axis]/baker.axis_cell_size[longest_axis]);
- probe_data->set_dynamic_data(data);
- probe_data->set_dynamic_range(dynamic_range);
- probe_data->set_energy(energy);
- probe_data->set_interior(interior);
- probe_data->set_compress(compress);
- probe_data->set_to_cell_xform(baker.to_cell_space);
-
- set_probe_data(probe_data);
+ if (p_create_visual_debug) {
+ _create_debug_mesh(&baker);
+ } else {
+ Ref<GIProbeData> probe_data;
+ probe_data.instance();
+ probe_data->set_bounds(Rect3(-extents,extents*2.0));
+ probe_data->set_cell_size(baker.po2_bounds.size[longest_axis]/baker.axis_cell_size[longest_axis]);
+ probe_data->set_dynamic_data(data);
+ probe_data->set_dynamic_range(dynamic_range);
+ probe_data->set_energy(energy);
+ probe_data->set_bias(bias);
+ probe_data->set_propagation(propagation);
+ probe_data->set_interior(interior);
+ probe_data->set_compress(compress);
+ probe_data->set_to_cell_xform(baker.to_cell_space);
- if (p_create_visual_debug) {
- //_create_debug_mesh(&baker);
+ set_probe_data(probe_data);
}
+
+
}
@@ -1399,6 +1464,9 @@ void GIProbe::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_energy","max"),&GIProbe::set_energy);
ClassDB::bind_method(D_METHOD("get_energy"),&GIProbe::get_energy);
+ ClassDB::bind_method(D_METHOD("set_bias","max"),&GIProbe::set_bias);
+ ClassDB::bind_method(D_METHOD("get_bias"),&GIProbe::get_bias);
+
ClassDB::bind_method(D_METHOD("set_propagation","max"),&GIProbe::set_propagation);
ClassDB::bind_method(D_METHOD("get_propagation"),&GIProbe::get_propagation);
@@ -1417,6 +1485,7 @@ void GIProbe::_bind_methods() {
ADD_PROPERTY( PropertyInfo(Variant::INT,"dynamic_range",PROPERTY_HINT_RANGE,"1,16,1"),"set_dynamic_range","get_dynamic_range");
ADD_PROPERTY( PropertyInfo(Variant::REAL,"energy",PROPERTY_HINT_RANGE,"0,16,0.01"),"set_energy","get_energy");
ADD_PROPERTY( PropertyInfo(Variant::REAL,"propagation",PROPERTY_HINT_RANGE,"0,1,0.01"),"set_propagation","get_propagation");
+ ADD_PROPERTY( PropertyInfo(Variant::REAL,"bias",PROPERTY_HINT_RANGE,"0,4,0.001"),"set_bias","get_bias");
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"interior"),"set_interior","is_interior");
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"compress"),"set_compress","is_compressed");
ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"data",PROPERTY_HINT_RESOURCE_TYPE,"GIProbeData"),"set_probe_data","get_probe_data");
@@ -1434,6 +1503,7 @@ GIProbe::GIProbe() {
subdiv=SUBDIV_128;
dynamic_range=4;
energy=1.0;
+ bias=0.4;
propagation=1.0;
extents=Vector3(10,10,10);
color_scan_cell_width=4;
diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h
index f03a558908..0f003d7cb1 100644
--- a/scene/3d/gi_probe.h
+++ b/scene/3d/gi_probe.h
@@ -38,6 +38,9 @@ public:
void set_energy(float p_range);
float get_energy() const;
+ void set_bias(float p_range);
+ float get_bias() const;
+
void set_interior(bool p_enable);
bool is_interior() const;
@@ -137,6 +140,7 @@ private:
Vector3 extents;
int dynamic_range;
float energy;
+ float bias;
float propagation;
bool interior;
bool compress;
@@ -176,6 +180,9 @@ public:
void set_energy(float p_energy);
float get_energy() const;
+ void set_bias(float p_bias);
+ float get_bias() const;
+
void set_propagation(float p_propagation);
float get_propagation() const;
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 11eaa2ed33..473bca8d3b 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "light.h"
-#include "globals.h"
+#include "global_config.h"
#include "scene/resources/surface_tool.h"
#include "baked_light_instance.h"
diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp
index 44e4fb54da..19f1261238 100644
--- a/scene/3d/portal.cpp
+++ b/scene/3d/portal.cpp
@@ -29,7 +29,7 @@
#include "portal.h"
#include "servers/visual_server.h"
#include "scene/resources/surface_tool.h"
-#include "globals.h"
+#include "global_config.h"
bool Portal::_set(const StringName& p_name, const Variant& p_value) {
diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp
index fbfc44ce90..b363c05ef7 100644
--- a/scene/3d/room_instance.cpp
+++ b/scene/3d/room_instance.cpp
@@ -31,7 +31,7 @@
#include "servers/visual_server.h"
#include "geometry.h"
-#include "globals.h"
+#include "global_config.h"
#include "scene/resources/surface_tool.h"
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index 1bb6d83393..04e82ba914 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -31,7 +31,7 @@
#include "message_queue.h"
#include "scene/resources/surface_tool.h"
-#include "core/globals.h"
+#include "core/global_config.h"
bool Skeleton::_set(const StringName& p_path, const Variant& p_value) {
diff --git a/scene/gui/button_array.cpp b/scene/gui/button_array.cpp
index c05b787bf5..2fd5f0df83 100644
--- a/scene/gui/button_array.cpp
+++ b/scene/gui/button_array.cpp
@@ -58,9 +58,10 @@ bool ButtonArray::_set(const StringName& p_name, const Variant& p_value) {
int idx=what.to_int();
ERR_FAIL_INDEX_V(idx,buttons.size(),false);
String f = n.get_slicec('/',2);
- if (f=="text")
+ if (f=="text") {
buttons[idx].text=p_value;
- else if (f=="tooltip")
+ buttons[idx].xl_text=XL_MESSAGE(p_value);
+ } else if (f=="tooltip")
buttons[idx].tooltip=p_value;
else if (f=="icon")
buttons[idx].icon=p_value;
@@ -146,7 +147,7 @@ Size2 ButtonArray::get_minimum_size() const {
Ref<Font> f = i==selected ? font_selected : font_normal;
Size2 ms;
- ms = f->get_string_size(buttons[i].text);
+ ms = f->get_string_size(buttons[i].xl_text);
if (buttons[i].icon.is_valid()) {
Size2 bs = buttons[i].icon->get_size();
@@ -275,7 +276,7 @@ void ButtonArray::_notification(int p_what) {
c=color_normal;
}
- Size2 ssize = f->get_string_size(buttons[i].text);
+ Size2 ssize = f->get_string_size(buttons[i].xl_text);
if (buttons[i].icon.is_valid()) {
ssize.x+=buttons[i].icon->get_width();
@@ -287,7 +288,7 @@ void ButtonArray::_notification(int p_what) {
text_ofs.x+=buttons[i].icon->get_width()+icon_sep;
}
- draw_string(f,text_ofs+r.pos,buttons[i].text,c);
+ draw_string(f,text_ofs+r.pos,buttons[i].xl_text,c);
buttons[i]._pos_cache=ofs;
buttons[i]._size_cache=s;
@@ -404,6 +405,7 @@ void ButtonArray::add_button(const String& p_text,const String& p_tooltip) {
Button button;
button.text=p_text;
+ button.xl_text=XL_MESSAGE(p_text);
button.tooltip=p_tooltip;
buttons.push_back(button);
update();
@@ -418,6 +420,7 @@ void ButtonArray::add_icon_button(const Ref<Texture>& p_icon,const String& p_tex
Button button;
button.text=p_text;
+ button.xl_text=XL_MESSAGE(p_text);
button.icon=p_icon;
button.tooltip=p_tooltip;
buttons.push_back(button);
@@ -432,6 +435,7 @@ void ButtonArray::set_button_text(int p_button, const String& p_text) {
ERR_FAIL_INDEX(p_button,buttons.size());
buttons[p_button].text=p_text;
+ buttons[p_button].xl_text=XL_MESSAGE(p_text);
update();
minimum_size_changed();
diff --git a/scene/gui/button_array.h b/scene/gui/button_array.h
index 37533695c9..4865ef0373 100644
--- a/scene/gui/button_array.h
+++ b/scene/gui/button_array.h
@@ -50,6 +50,7 @@ private:
struct Button {
String text;
+ String xl_text;
String tooltip;
Ref<Texture> icon;
mutable int _ms_cache;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index e52afdffdf..cffe2ce218 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -30,7 +30,7 @@
#include "servers/visual_server.h"
#include "scene/main/viewport.h"
#include "scene/main/canvas_layer.h"
-#include "globals.h"
+#include "global_config.h"
#include "print_string.h"
#include "os/keyboard.h"
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 2f97ce2d51..72d3f0e8f8 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -272,7 +272,7 @@ void AcceptDialog::_update_child_rects() {
if (!c)
continue;
- if (c==hbc || c==label || c==get_close_button())
+ if (c==hbc || c==label || c==get_close_button() || c->is_set_as_toplevel())
continue;
c->set_pos(cpos);
@@ -299,7 +299,7 @@ Size2 AcceptDialog::get_minimum_size() const {
if (!c)
continue;
- if (c==hbc || c==label || c==const_cast<AcceptDialog*>(this)->get_close_button())
+ if (c==hbc || c==label || c==const_cast<AcceptDialog*>(this)->get_close_button() || c->is_set_as_toplevel())
continue;
Size2 cminsize = c->get_combined_minimum_size();
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 4e10f1d622..a35df53e52 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "item_list.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
void ItemList::add_item(const String& p_item,const Ref<Texture>& p_texture,bool p_selectable) {
@@ -1204,6 +1204,22 @@ int ItemList::get_item_at_pos(const Point2& p_pos, bool p_exact) const {
return closest;
}
+bool ItemList::is_pos_at_end_of_items(const Point2& p_pos) const {
+
+ if (items.empty())
+ return true;
+
+ Vector2 pos=p_pos;
+ Ref<StyleBox> bg = get_stylebox("bg");
+ pos-=bg->get_offset();
+ pos.y+=scroll_bar->get_value();
+
+ Rect2 endrect = items[items.size()-1].rect_cache;
+ return (pos.y > endrect.pos.y + endrect.size.y);
+
+}
+
+
String ItemList::get_tooltip(const Point2& p_pos) const {
int closest = get_item_at_pos(p_pos);
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index f4a864c782..35ffb1be9c 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -191,6 +191,7 @@ public:
virtual String get_tooltip(const Point2& p_pos) const;
int get_item_at_pos(const Point2& p_pos,bool p_exact=false) const;
+ bool is_pos_at_end_of_items(const Point2& p_pos) const;
void set_icon_scale(real_t p_scale);
real_t get_icon_scale() const;
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index dfcea30056..915eaa2f45 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "label.h"
#include "print_string.h"
-#include "globals.h"
+#include "global_config.h"
#include "translation.h"
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index cacb79268c..3f2eab8bef 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -32,7 +32,7 @@
#include "os/input.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
#include "message_queue.h"
#include "scene/main/viewport.h"
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 524ef2aae4..7bfc24079b 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -30,7 +30,7 @@
#include "print_string.h"
#include "os/os.h"
#include "os/keyboard.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/input.h"
#include "scene/main/viewport.h"
diff --git a/scene/io/resource_format_image.cpp b/scene/io/resource_format_image.cpp
index 4d15ab86fd..8bb07adb5f 100644
--- a/scene/io/resource_format_image.cpp
+++ b/scene/io/resource_format_image.cpp
@@ -31,7 +31,7 @@
#if 0
#include "scene/resources/texture.h"
#include "io/image_loader.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/os.h"
RES ResourceFormatLoaderImage::load(const String &p_path, const String& p_original_path, Error *r_error) {
diff --git a/scene/main/node.h b/scene/main/node.h
index d88db8ecb0..93b250ab0f 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -29,7 +29,7 @@
#ifndef NODE_H
#define NODE_H
-#include "globals.h"
+#include "global_config.h"
#include "object.h"
#include "path_db.h"
#include "map.h"
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index 76f5ef7c96..418eb92ee2 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -32,7 +32,7 @@
#include "os/os.h"
#include "message_queue.h"
#include "node.h"
-#include "globals.h"
+#include "global_config.h"
#include <stdio.h>
#include "os/keyboard.h"
//#include "servers/spatial_sound_2d_server.h"
@@ -63,9 +63,19 @@ float SceneTreeTimer::get_time_left() const {
return time_left;
}
+void SceneTreeTimer::set_pause_mode_process(bool p_pause_mode_process) {
+ if (process_pause != p_pause_mode_process) {
+ process_pause = p_pause_mode_process;
+ }
+}
+
+bool SceneTreeTimer::is_pause_mode_process() {
+ return process_pause;
+}
SceneTreeTimer::SceneTreeTimer() {
time_left=0;
+ process_pause = true;
}
@@ -602,7 +612,10 @@ bool SceneTree::idle(float p_time){
for (List<Ref<SceneTreeTimer> >::Element *E=timers.front();E;) {
List<Ref<SceneTreeTimer> >::Element *N = E->next();
-
+ if (pause && !E->get()->is_pause_mode_process()) {
+ E=N;
+ continue;
+ }
float time_left = E->get()->get_time_left();
time_left-=p_time;
E->get()->set_time_left(time_left);
@@ -1714,10 +1727,11 @@ void SceneTree::drop_files(const Vector<String>& p_files,int p_from_screen) {
}
-Ref<SceneTreeTimer> SceneTree::create_timer(float p_delay_sec) {
+Ref<SceneTreeTimer> SceneTree::create_timer(float p_delay_sec, bool p_process_pause) {
Ref<SceneTreeTimer> stt;
stt.instance();
+ stt->set_pause_mode_process(p_process_pause);
stt->set_time_left(p_delay_sec);
timers.push_back(stt);
return stt;
@@ -2243,7 +2257,7 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_paused"),&SceneTree::is_paused);
ClassDB::bind_method(D_METHOD("set_input_as_handled"),&SceneTree::set_input_as_handled);
- ClassDB::bind_method(D_METHOD("create_timer:SceneTreeTimer","time_sec"),&SceneTree::create_timer);
+ ClassDB::bind_method(D_METHOD("create_timer:SceneTreeTimer","time_sec", "pause_mode_process"),&SceneTree::create_timer, DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_node_count"),&SceneTree::get_node_count);
diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h
index f4271e5454..fec8534b40 100644
--- a/scene/main/scene_main_loop.h
+++ b/scene/main/scene_main_loop.h
@@ -56,6 +56,7 @@ class SceneTreeTimer : public Reference {
GDCLASS(SceneTreeTimer,Reference);
float time_left;
+ bool process_pause;
protected:
static void _bind_methods();
public:
@@ -63,6 +64,9 @@ public:
void set_time_left(float p_time);
float get_time_left() const;
+ void set_pause_mode_process(bool p_pause_mode_process);
+ bool is_pause_mode_process();
+
SceneTreeTimer();
};
@@ -430,7 +434,7 @@ public:
Error change_scene_to(const Ref<PackedScene>& p_scene);
Error reload_current_scene();
- Ref<SceneTreeTimer> create_timer(float p_delay_sec);
+ Ref<SceneTreeTimer> create_timer(float p_delay_sec, bool p_process_pause=true);
//used by Main::start, don't use otherwise
void add_current_scene(Node * p_current);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index f7bd98a002..ef39dcde4b 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -48,7 +48,7 @@
#include "scene/main/timer.h"
#include "scene/scene_string_names.h"
-#include "globals.h"
+#include "global_config.h"
void ViewportTexture::setup_local_to_scene() {
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index c0bd86382b..ffdc85301a 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "register_scene_types.h"
#include "os/os.h"
-#include "globals.h"
+#include "global_config.h"
#include "scene/io/resource_format_image.h"
#include "scene/io/resource_format_wav.h"
diff --git a/scene/resources/audio_stream_resampled.cpp b/scene/resources/audio_stream_resampled.cpp
index 7b49ec0849..b2f314a55e 100644
--- a/scene/resources/audio_stream_resampled.cpp
+++ b/scene/resources/audio_stream_resampled.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "audio_stream_resampled.h"
-#include "globals.h"
+#include "global_config.h"
#if 0
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index eb1a3b550a..f44b37f6f5 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "environment.h"
#include "texture.h"
-#include "globals.h"
+#include "global_config.h"
#include "servers/visual_server.h"
RID Environment::get_rid() const {
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index b7c8b1664d..3780c466a5 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -339,7 +339,7 @@ void FixedSpatialMaterial::_update_shader() {
code+="\tROUGHNESS = specular_tex.a * roughness;\n";
} else {
code+="\tvec4 specular_tex = texture(texture_specular,UV);\n";
- code+="\tSPECULAR = vec3(metalness * specular_tex.r);\n";
+ code+="\tSPECULAR = vec3(ALBEDO.rgb * metalness * specular_tex.r);\n";
code+="\tROUGHNESS = specular_tex.a * roughness;\n";
}
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 03d516329a..9990a6e796 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -128,8 +128,8 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) {
if (d.has("arrays")) {
//old format
- ERR_FAIL_COND_V(!d.has("blend_shape_arrays"),false);
- add_surface_from_arrays(PrimitiveType(int(d["primitive"])),d["arrays"],d["blend_shape_arrays"]);
+ ERR_FAIL_COND_V(!d.has("morph_arrays"),false);
+ add_surface_from_arrays(PrimitiveType(int(d["primitive"])),d["arrays"],d["morph_arrays"]);
} else if (d.has("array_data")) {
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index ce755d90db..5e3347687a 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "packed_scene.h"
-#include "globals.h"
+#include "global_config.h"
#include "io/resource_loader.h"
#include "scene/3d/spatial.h"
#include "scene/gui/control.h"
@@ -177,6 +177,9 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
node = obj->cast_to<Node>();
+ } else {
+ print_line("wtf class is disabled for: "+itos(n.type));
+ print_line("name: "+String(snames[n.type]));
}
@@ -196,6 +199,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
ERR_FAIL_INDEX_V( nprops[j].name, sname_count, NULL );
ERR_FAIL_INDEX_V( nprops[j].value, prop_count, NULL );
+
if (snames[ nprops[j].name ]==CoreStringNames::get_singleton()->_script) {
//work around to avoid old script variables from disappearing, should be the proper fix to:
//https://github.com/godotengine/godot/issues/2958
@@ -357,7 +361,7 @@ static int _nm_get_string(const String& p_string, Map<StringName,int> &name_map)
return idx;
}
-static int _vm_get_variant(const Variant& p_variant, HashMap<Variant,int,VariantHasher> &variant_map) {
+static int _vm_get_variant(const Variant& p_variant, HashMap<Variant,int,VariantHasher,VariantComparator> &variant_map) {
if (variant_map.has(p_variant))
return variant_map[p_variant];
@@ -367,7 +371,7 @@ static int _vm_get_variant(const Variant& p_variant, HashMap<Variant,int,Variant
return idx;
}
-Error SceneState::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher> &variant_map,Map<Node*,int> &node_map,Map<Node*,int> &nodepath_map) {
+Error SceneState::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher,VariantComparator> &variant_map,Map<Node*,int> &node_map,Map<Node*,int> &nodepath_map) {
// this function handles all the work related to properly packing scenes, be it
@@ -743,7 +747,7 @@ Error SceneState::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<S
}
-Error SceneState::_parse_connections(Node *p_owner,Node *p_node, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher> &variant_map,Map<Node*,int> &node_map,Map<Node*,int> &nodepath_map) {
+Error SceneState::_parse_connections(Node *p_owner,Node *p_node, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher,VariantComparator> &variant_map,Map<Node*,int> &node_map,Map<Node*,int> &nodepath_map) {
if (p_node!=p_owner && p_node->get_owner() && p_node->get_owner()!=p_owner && !p_owner->is_editable_instance(p_node->get_owner()))
return OK;
@@ -948,7 +952,7 @@ Error SceneState::pack(Node *p_scene) {
Node *scene = p_scene;
Map<StringName,int> name_map;
- HashMap<Variant,int,VariantHasher> variant_map;
+ HashMap<Variant,int,VariantHasher,VariantComparator> variant_map;
Map<Node*,int> node_map;
Map<Node*,int> nodepath_map;
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index 381b356b1e..4a3841abe9 100644
--- a/scene/resources/packed_scene.h
+++ b/scene/resources/packed_scene.h
@@ -91,8 +91,8 @@ class SceneState : public Reference {
Vector<ConnectionData> connections;
- Error _parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher> &variant_map,Map<Node*,int> &node_map,Map<Node*,int> &nodepath_map);
- Error _parse_connections(Node *p_owner,Node *p_node, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher> &variant_map,Map<Node*,int> &node_map,Map<Node*,int> &nodepath_map);
+ Error _parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher,VariantComparator> &variant_map,Map<Node*,int> &node_map,Map<Node*,int> &nodepath_map);
+ Error _parse_connections(Node *p_owner,Node *p_node, Map<StringName,int> &name_map,HashMap<Variant,int,VariantHasher,VariantComparator> &variant_map,Map<Node*,int> &node_map,Map<Node*,int> &nodepath_map);
String path;
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index 9719f321d6..3a254836a2 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "scene_format_text.h"
-#include "globals.h"
+#include "global_config.h"
#include "version.h"
#include "os/dir_access.h"
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 5e67a9e5b2..62feb7b37c 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -559,6 +559,11 @@ Error StreamTexture::_load_data(const String& p_path,int &tw,int &th,int& flags,
int total_size=0;
for(int i=0;i<mipmaps;i++) {
+
+ if (i>0) {
+ size = f->get_32();
+ }
+
PoolVector<uint8_t> pv;
pv.resize(size);
{
@@ -754,6 +759,12 @@ bool StreamTexture::has_alpha() const {
return false;
}
+
+Image StreamTexture::get_data() const {
+
+ return VS::get_singleton()->texture_get_data(texture);
+}
+
void StreamTexture::set_flags(uint32_t p_flags){
}
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index f684aeb658..cae77ad5cf 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -76,7 +76,7 @@ public:
virtual void draw_rect_region(RID p_canvas_item,const Rect2& p_rect, const Rect2& p_src_rect,const Color& p_modulate=Color(1,1,1), bool p_transpose=false) const;
virtual bool get_rect_region(const Rect2& p_rect, const Rect2& p_src_rect,Rect2& r_rect,Rect2& r_src_rect) const;
-
+ virtual Image get_data() const { return Image(); }
Texture();
};
@@ -224,6 +224,8 @@ public:
virtual bool has_alpha() const;
virtual void set_flags(uint32_t p_flags);
+ virtual Image get_data() const;
+
StreamTexture();
~StreamTexture();
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index b2713da569..6b745d5d35 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -30,11 +30,11 @@
#include "servers/visual_server.h"
#include "servers/physics_2d_server.h"
//#include "servers/spatial_sound_2d_server.h"
-#include "globals.h"
+#include "global_config.h"
#include "scene/2d/visibility_notifier_2d.h"
#include "scene/main/viewport.h"
#include "scene/2d/camera_2d.h"
-#include "globals.h"
+#include "global_config.h"
struct SpatialIndexer2D {
diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h
index a9110b3bd9..c02880e9ed 100644
--- a/scene/resources/world_2d.h
+++ b/scene/resources/world_2d.h
@@ -31,7 +31,7 @@
#include "resource.h"
#include "servers/physics_2d_server.h"
-#include "globals.h"
+#include "global_config.h"
class SpatialIndexer2D;
class VisibilityNotifier2D;