summaryrefslogtreecommitdiffstats
path: root/tools/editor/plugins/baked_light_editor_plugin.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-08-14 10:31:38 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-08-14 10:31:38 -0300
commit2ee4ac183babedd679e901b0158f5268556deceb (patch)
treec0b5215b7ab17186835e1919912fa09de7301bfb /tools/editor/plugins/baked_light_editor_plugin.cpp
parentc3e1d7b7c788530dc69e973352763a90da05d4e1 (diff)
downloadredot-engine-2ee4ac183babedd679e901b0158f5268556deceb.tar.gz
Little Bits
-=-=-=-=-=- -Fixed small bugs all around -Added ability to show/hide entire sections of the spatial (3D) tree -WIP new vehicle (not ready yet) based on Bullet
Diffstat (limited to 'tools/editor/plugins/baked_light_editor_plugin.cpp')
-rw-r--r--tools/editor/plugins/baked_light_editor_plugin.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/tools/editor/plugins/baked_light_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp
index a1383f22fe..3d48f2e732 100644
--- a/tools/editor/plugins/baked_light_editor_plugin.cpp
+++ b/tools/editor/plugins/baked_light_editor_plugin.cpp
@@ -38,6 +38,7 @@ void BakedLightEditor::_notification(int p_option) {
button_bake->set_icon(get_icon("Bake","EditorIcons"));
button_reset->set_icon(get_icon("Reload","EditorIcons"));
+ button_make_lightmaps->set_icon(get_icon("LightMap","EditorIcons"));
}
if (p_option==NOTIFICATION_PROCESS) {
@@ -148,7 +149,7 @@ void BakedLightEditor::_menu_option(int p_option) {
ERR_FAIL_COND(!node);
ERR_FAIL_COND(node->get_baked_light().is_null());
baker->bake(node->get_baked_light(),node);
-
+ node->get_baked_light()->set_mode(BakedLight::MODE_OCTREE);
update_timeout=0;
set_process(true);
@@ -180,14 +181,19 @@ void BakedLightEditor::_bake_pressed() {
set_process(false);
bake_info->set_text("");
+ button_reset->show();
+ button_make_lightmaps->show();
+
} else {
update_timeout=0;
set_process(true);
+ button_make_lightmaps->hide();
+ button_reset->hide();
}
-
} else {
baker->bake(node->get_baked_light(),node);
+ node->get_baked_light()->set_mode(BakedLight::MODE_OCTREE);
update_timeout=0;
set_process(true);
}
@@ -216,13 +222,27 @@ void BakedLightEditor::edit(BakedLightInstance *p_baked_light) {
}
+void BakedLightEditor::_bake_lightmaps() {
+
+ Error err = baker->transfer_to_lightmaps();
+ if (err) {
+
+ err_dialog->set_text("Error baking to lightmaps!\nMake sure that a bake has just\n happened and that lightmaps are\n configured. ");
+ err_dialog->popup_centered(Size2(350,70));
+ return;
+ }
+ node->get_baked_light()->set_mode(BakedLight::MODE_LIGHTMAPS);
+
+
+}
void BakedLightEditor::_bind_methods() {
ObjectTypeDB::bind_method("_menu_option",&BakedLightEditor::_menu_option);
ObjectTypeDB::bind_method("_bake_pressed",&BakedLightEditor::_bake_pressed);
ObjectTypeDB::bind_method("_clear_pressed",&BakedLightEditor::_clear_pressed);
+ ObjectTypeDB::bind_method("_bake_lightmaps",&BakedLightEditor::_bake_lightmaps);
}
BakedLightEditor::BakedLightEditor() {
@@ -233,6 +253,11 @@ BakedLightEditor::BakedLightEditor() {
button_bake->set_text("Bake!");
button_bake->set_toggle_mode(true);
button_reset = memnew( Button );
+ button_make_lightmaps = memnew( Button );
+ button_bake->set_tooltip("Start/Unpause the baking process.\nThis bakes lighting into the lightmap octree.");
+ button_make_lightmaps ->set_tooltip("Convert the lightmap octree to lightmap textures\n(must have set up UV/Lightmaps properly before!).");
+
+
bake_info = memnew( Label );
bake_hbox->add_child( button_bake );
bake_hbox->add_child( button_reset );
@@ -243,8 +268,15 @@ BakedLightEditor::BakedLightEditor() {
node=NULL;
baker = memnew( BakedLightBaker );
+ bake_hbox->add_child(button_make_lightmaps);
+ button_make_lightmaps->hide();
+
button_bake->connect("pressed",this,"_bake_pressed");
button_reset->connect("pressed",this,"_clear_pressed");
+ button_make_lightmaps->connect("pressed",this,"_bake_lightmaps");
+ button_reset->hide();
+ button_reset->set_tooltip("Reset the lightmap octree baking process (start over).");
+
update_timeout=0;