summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/OccluderPolygon2D.xml8
-rw-r--r--editor/plugins/gi_probe_editor_plugin.cpp26
-rw-r--r--editor/plugins/gi_probe_editor_plugin.h5
-rw-r--r--modules/mono/utils/path_utils.cpp6
-rw-r--r--scene/3d/gi_probe.cpp21
-rw-r--r--scene/3d/gi_probe.h8
-rw-r--r--scene/gui/tab_container.cpp7
7 files changed, 77 insertions, 4 deletions
diff --git a/doc/classes/OccluderPolygon2D.xml b/doc/classes/OccluderPolygon2D.xml
index 99c1536ddf..7bc1f74762 100644
--- a/doc/classes/OccluderPolygon2D.xml
+++ b/doc/classes/OccluderPolygon2D.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="OccluderPolygon2D" inherits="Resource" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Defines a 2D polygon for LightOccluder2D.
</brief_description>
<description>
+ Editor facility that helps you draw a 2D polygon used as resource for [LightOccluder2D].
</description>
<tutorials>
</tutorials>
@@ -54,18 +56,24 @@
</methods>
<members>
<member name="closed" type="bool" setter="set_closed" getter="is_closed">
+ If [code]true[/code] closes the polygon. A closed OccluderPolygon2D occludes the light coming from any direction. An opened OccluderPolygon2D occludes the light only at its outline's direction. Default value [code]true[/code].
</member>
<member name="cull_mode" type="int" setter="set_cull_mode" getter="get_cull_mode" enum="OccluderPolygon2D.CullMode">
+ Set the direction of the occlusion culling when not [code]CULL_DISABLED[/code]. Default value [code]DISABLED[/code].
</member>
<member name="polygon" type="PoolVector2Array" setter="set_polygon" getter="get_polygon">
+ A [Vector2] array with the index for polygon's vertices positions.
</member>
</members>
<constants>
<constant name="CULL_DISABLED" value="0">
+ Culling mode for the occlusion. Disabled means no culling. See [member cull_mode].
</constant>
<constant name="CULL_CLOCKWISE" value="1">
+ Culling mode for the occlusion. Sets the culling to be in clockwise direction. See [member cull_mode].
</constant>
<constant name="CULL_COUNTER_CLOCKWISE" value="2">
+ Culling mode for the occlusion. Sets the culling to be in counter clockwise direction. See [member cull_mode].
</constant>
</constants>
</class>
diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp
index fcbf282758..443cd2e41f 100644
--- a/editor/plugins/gi_probe_editor_plugin.cpp
+++ b/editor/plugins/gi_probe_editor_plugin.cpp
@@ -60,6 +60,27 @@ void GIProbeEditorPlugin::make_visible(bool p_visible) {
}
}
+EditorProgress *GIProbeEditorPlugin::tmp_progress = NULL;
+
+void GIProbeEditorPlugin::bake_func_begin(int p_steps) {
+
+ ERR_FAIL_COND(tmp_progress != NULL);
+
+ tmp_progress = memnew(EditorProgress("bake_gi", TTR("Bake GI Probe"), p_steps));
+}
+
+void GIProbeEditorPlugin::bake_func_step(int p_step, const String &p_description) {
+
+ ERR_FAIL_COND(tmp_progress == NULL);
+ tmp_progress->step(p_description, p_step);
+}
+
+void GIProbeEditorPlugin::bake_func_end() {
+ ERR_FAIL_COND(tmp_progress == NULL);
+ memdelete(tmp_progress);
+ tmp_progress = NULL;
+}
+
void GIProbeEditorPlugin::_bind_methods() {
ClassDB::bind_method("_bake", &GIProbeEditorPlugin::_bake);
@@ -70,10 +91,15 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) {
editor = p_node;
bake = memnew(Button);
bake->set_icon(editor->get_gui_base()->get_icon("BakedLight", "EditorIcons"));
+ bake->set_text(TTR("Bake GI Probe"));
bake->hide();
bake->connect("pressed", this, "_bake");
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake);
gi_probe = NULL;
+
+ GIProbe::bake_begin_function = bake_func_begin;
+ GIProbe::bake_step_function = bake_func_step;
+ GIProbe::bake_end_function = bake_func_end;
}
GIProbeEditorPlugin::~GIProbeEditorPlugin() {
diff --git a/editor/plugins/gi_probe_editor_plugin.h b/editor/plugins/gi_probe_editor_plugin.h
index a1fecd2911..527f420510 100644
--- a/editor/plugins/gi_probe_editor_plugin.h
+++ b/editor/plugins/gi_probe_editor_plugin.h
@@ -44,6 +44,11 @@ class GIProbeEditorPlugin : public EditorPlugin {
Button *bake;
EditorNode *editor;
+ static EditorProgress *tmp_progress;
+ static void bake_func_begin(int p_steps);
+ static void bake_func_step(int p_step, const String &p_description);
+ static void bake_func_end();
+
void _bake();
protected:
diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp
index c8581f6122..105c2c981e 100644
--- a/modules/mono/utils/path_utils.cpp
+++ b/modules/mono/utils/path_utils.cpp
@@ -56,9 +56,6 @@ String path_which(const String &p_name) {
for (int i = 0; i < env_path.size(); i++) {
String p = path_join(env_path[i], p_name);
- if (FileAccess::exists(p))
- return p;
-
#ifdef WINDOWS_ENABLED
for (int j = 0; j < exts.size(); j++) {
String p2 = p + exts[j];
@@ -66,6 +63,9 @@ String path_which(const String &p_name) {
if (FileAccess::exists(p2))
return p2;
}
+#else
+ if (FileAccess::exists(p))
+ return p;
#endif
}
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index d5a030b35c..c0ca358717 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -1134,6 +1134,10 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
}
}
+GIProbe::BakeBeginFunc GIProbe::bake_begin_function = NULL;
+GIProbe::BakeStepFunc GIProbe::bake_step_function = NULL;
+GIProbe::BakeEndFunc GIProbe::bake_end_function = NULL;
+
void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
Baker baker;
@@ -1177,14 +1181,25 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
_find_meshes(p_from_node ? p_from_node : get_parent(), &baker);
+ if (bake_begin_function) {
+ bake_begin_function(baker.mesh_list.size() + 1);
+ }
+
int pmc = 0;
for (List<Baker::PlotMesh>::Element *E = baker.mesh_list.front(); E; E = E->next()) {
- print_line("plotting mesh " + itos(pmc++) + "/" + itos(baker.mesh_list.size()));
+ if (bake_step_function) {
+ bake_step_function(pmc, RTR("Plotting Meshes") + " " + itos(pmc) + "/" + itos(baker.mesh_list.size()));
+ }
+
+ pmc++;
_plot_mesh(E->get().local_xform, E->get().mesh, &baker, E->get().instance_materials, E->get().override_material);
}
+ if (bake_step_function) {
+ bake_step_function(pmc++, RTR("Finishing Plot"));
+ }
_fixup_plot(0, 0, 0, 0, 0, &baker);
@@ -1282,6 +1297,10 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
set_probe_data(probe_data);
}
+
+ if (bake_end_function) {
+ bake_end_function();
+ }
}
void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker) {
diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h
index 5a06984a47..50d0c33d4f 100644
--- a/scene/3d/gi_probe.h
+++ b/scene/3d/gi_probe.h
@@ -95,6 +95,10 @@ public:
};
+ typedef void (*BakeBeginFunc)(int);
+ typedef void (*BakeStepFunc)(int, const String &);
+ typedef void (*BakeEndFunc)();
+
private:
//stuff used for bake
struct Baker {
@@ -190,6 +194,10 @@ protected:
static void _bind_methods();
public:
+ static BakeBeginFunc bake_begin_function;
+ static BakeStepFunc bake_step_function;
+ static BakeEndFunc bake_end_function;
+
void set_probe_data(const Ref<GIProbeData> &p_data);
Ref<GIProbeData> get_probe_data() const;
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index cfe924ecd4..581034ddee 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -90,6 +90,10 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
return;
}
+ // Do not activate tabs when tabs is empty
+ if (get_tab_count() == 0)
+ return;
+
Vector<Control *> tabs = _get_tabs();
// Handle navigation buttons.
@@ -298,6 +302,8 @@ void TabContainer::_notification(int p_what) {
}
int TabContainer::_get_tab_width(int p_index) const {
+
+ ERR_FAIL_INDEX_V(p_index, get_tab_count(), 0);
Control *control = Object::cast_to<Control>(_get_tabs()[p_index]);
if (!control || control->is_set_as_toplevel())
return 0;
@@ -669,6 +675,7 @@ void TabContainer::_bind_methods() {
TabContainer::TabContainer() {
first_tab_cache = 0;
+ last_tab_cache = 0;
buttons_visible_cache = false;
tabs_ofs_cache = 0;
current = 0;