summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp11
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.h3
-rw-r--r--tools/editor/plugins/baked_light_baker.cpp14
-rw-r--r--tools/editor/plugins/baked_light_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp40
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.h1
-rw-r--r--tools/editor/property_editor.cpp7
-rw-r--r--tools/editor/scenes_dock.cpp59
-rw-r--r--tools/editor/scenes_dock.h23
10 files changed, 120 insertions, 42 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index ceb5b45a03..27a5ddbeaf 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -4067,7 +4067,7 @@ EditorNode::EditorNode() {
import_menu->get_popup()->add_separator();
- import_menu->get_popup()->add_item("Import Settings",SETTINGS_IMPORT);
+ import_menu->get_popup()->add_item("Re-Import..",SETTINGS_IMPORT);
editor_plugin_screen=NULL;
editor_plugin_over=NULL;
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
index 5d45594246..c7593625ff 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -45,6 +45,7 @@ static const char *flag_names[]={
"Repeat",
"Filter (Magnifying)",
"Premultiply Alpha",
+ "Convert SRGB->Linear",
NULL
};
@@ -57,6 +58,7 @@ static const char *flag_short_names[]={
"Repeat",
"Filter",
"PMAlpha",
+ "ToLinear",
NULL
};
@@ -927,6 +929,10 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
image.premultiply_alpha();
}
+ if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) {
+
+ image.srgb_to_linear();
+ }
if (shrink>1) {
@@ -985,6 +991,11 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
image.premultiply_alpha();
}
+ if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) {
+
+ image.srgb_to_linear();
+ }
+
int orig_w=image.get_width();
int orig_h=image.get_height();
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.h b/tools/editor/io_plugins/editor_texture_import_plugin.h
index fcc1bd2d0c..9374c6eb0b 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.h
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.h
@@ -92,7 +92,8 @@ public:
IMAGE_FLAG_NO_MIPMAPS=16, //normal for 2D games
IMAGE_FLAG_REPEAT=32, //usually disabled in 2D
IMAGE_FLAG_FILTER=64, //almost always enabled
- IMAGE_FLAG_PREMULT_ALPHA=128//almost always enabled
+ IMAGE_FLAG_PREMULT_ALPHA=128,//almost always enabled
+ IMAGE_FLAG_CONVERT_TO_LINEAR=256 //convert image to linear
};
virtual String get_name() const;
diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp
index ae5746321a..36948673a8 100644
--- a/tools/editor/plugins/baked_light_baker.cpp
+++ b/tools/editor/plugins/baked_light_baker.cpp
@@ -912,12 +912,6 @@ float BakedLightBaker::_throw_ray(int p_light_index,const Vector3& p_begin, cons
Color diffuse_at_point(0.8,0.8,0.8);
Color specular_at_point(0.0,0.0,0.0);
- if (triangle->material) {
-
- //triangle->get_uv(r_point);
- diffuse_at_point=triangle->material->diffuse.get_color(uv);
- specular_at_point=triangle->material->specular.get_color(uv);
- }
float dist = p_begin.distance_to(r_point);
@@ -963,6 +957,14 @@ float BakedLightBaker::_throw_ray(int p_light_index,const Vector3& p_begin, cons
+ if (triangle->material) {
+
+ //triangle->get_uv(r_point);
+
+ diffuse_at_point=triangle->material->diffuse.get_color(uv);
+ specular_at_point=triangle->material->specular.get_color(uv);
+ }
+
diffuse_at_point.r=res_light.r*diffuse_at_point.r;
diffuse_at_point.g=res_light.g*diffuse_at_point.g;
diff --git a/tools/editor/plugins/baked_light_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp
index 4d84b95900..71f9671fd9 100644
--- a/tools/editor/plugins/baked_light_editor_plugin.cpp
+++ b/tools/editor/plugins/baked_light_editor_plugin.cpp
@@ -111,7 +111,7 @@ void BakedLightEditor::_notification(int p_option) {
ERR_FAIL_COND(node->get_baked_light().is_null());
baker->update_octree_image(octree_texture);
-#if 0
+#if 1
//debug
Image img(baker->baked_octree_texture_w,baker->baked_octree_texture_h,0,Image::FORMAT_RGBA,octree_texture);
Ref<ImageTexture> it = memnew( ImageTexture );
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 2e3632f18f..1bf425f3f3 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -1166,7 +1166,6 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
Transform r;
r.basis.scale(Vector3(scale,scale,scale));
-
List<Node*> &selection = editor_selection->get_selected_node_list();
for(List<Node*>::Element *E=selection.front();E;E=E->next()) {
@@ -1519,7 +1518,13 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
} break;
case KEY_F: {
- _menu_option(VIEW_CENTER_TO_SELECTION);
+
+ if (k.pressed && k.mod.shift && k.mod.control) {
+ _menu_option(VIEW_ALIGN_SELECTION_WITH_VIEW);
+ } else if (k.pressed) {
+ _menu_option(VIEW_CENTER_TO_SELECTION);
+ }
+
} break;
case KEY_SPACE: {
@@ -1818,6 +1823,34 @@ void SpatialEditorViewport::_menu_option(int p_option) {
cursor.pos=center;
} break;
+ case VIEW_ALIGN_SELECTION_WITH_VIEW: {
+
+ if (!get_selected_count())
+ break;
+
+ Transform camera_transform = camera->get_global_transform();
+
+ List<Node*> &selection = editor_selection->get_selected_node_list();
+
+ undo_redo->create_action("Align with view");
+ for(List<Node*>::Element *E=selection.front();E;E=E->next()) {
+
+ Spatial *sp = E->get()->cast_to<Spatial>();
+ if (!sp)
+ continue;
+
+ SpatialEditorSelectedItem *se=editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
+ if (!se)
+ continue;
+
+ Vector3 original_scale = sp->get_scale();
+ sp->set_global_transform(camera_transform);
+ sp->set_scale(original_scale);
+ undo_redo->add_do_method(sp,"set_global_transform",sp->get_global_transform());
+ undo_redo->add_undo_method(sp,"set_global_transform",se->original);
+ }
+ undo_redo->commit_action();
+ } break;
case VIEW_ENVIRONMENT: {
int idx = view_menu->get_popup()->get_item_index(VIEW_ENVIRONMENT);
@@ -2060,7 +2093,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
view_menu->get_popup()->add_check_item("Environment",VIEW_ENVIRONMENT);
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(VIEW_ENVIRONMENT),true);
view_menu->get_popup()->add_separator();
- view_menu->get_popup()->add_item("Selection",VIEW_CENTER_TO_SELECTION);
+ view_menu->get_popup()->add_item("Selection (F)",VIEW_CENTER_TO_SELECTION);
+ view_menu->get_popup()->add_item("Align with view (Ctrl+Shift+F)",VIEW_ALIGN_SELECTION_WITH_VIEW);
view_menu->get_popup()->connect("item_pressed",this,"_menu_option");
preview_camera = memnew( Button );
diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h
index 4bc3b553ef..29719cb80c 100644
--- a/tools/editor/plugins/spatial_editor_plugin.h
+++ b/tools/editor/plugins/spatial_editor_plugin.h
@@ -75,6 +75,7 @@ class SpatialEditorViewport : public Control {
VIEW_FRONT,
VIEW_REAR,
VIEW_CENTER_TO_SELECTION,
+ VIEW_ALIGN_SELECTION_WITH_VIEW,
VIEW_PERSPECTIVE,
VIEW_ENVIRONMENT,
VIEW_ORTHOGONAL
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 2197902933..4ac2ff0594 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -1828,6 +1828,13 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
if (obj->get( p_name ).get_type() == Variant::NIL || obj->get( p_name ).operator RefPtr().is_null()) {
p_item->set_text(1,"<null>");
+ Dictionary d = p_item->get_metadata(0);
+ int hint=d.has("hint")?d["hint"].operator int():-1;
+ String hint_text=d.has("hint_text")?d["hint_text"]:"";
+ if (hint==PROPERTY_HINT_RESOURCE_TYPE && hint_text == "Texture") {
+ p_item->set_icon(1,NULL);
+ }
+
} else {
RES res = obj->get( p_name ).operator RefPtr();
if (res->is_type("Texture")) {
diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp
index bc0d48367a..a23c9cead7 100644
--- a/tools/editor/scenes_dock.cpp
+++ b/tools/editor/scenes_dock.cpp
@@ -38,7 +38,7 @@
bool ScenesDock::_create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_dir) {
String search_term = tree_filter->get_search_term();
- String file_filter = tree_filter->get_file_filter();
+ ScenesDockFilter::FilterOption file_filter = tree_filter->get_file_filter();
TreeItem *item = tree->create_item(p_parent);
item->set_text(0,p_dir->get_name()+"/");
@@ -56,15 +56,19 @@ bool ScenesDock::_create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_di
for (int i=0;i<p_dir->get_file_count();i++) {
String file_name = p_dir->get_file(i);
- String extension = file_name.extension();
+ String file_path = p_dir->get_file_path(i);
- if (search_term!="" && file_name.findn(search_term)==-1)
- continue;
+ // ScenesDockFilter::FILTER_PATH
+ String search_from = file_path.right(6); // trim "res://"
+ if (file_filter == ScenesDockFilter::FILTER_NAME)
+ search_from = file_name;
+ else if (file_filter == ScenesDockFilter::FILTER_FOLDER)
+ search_from = file_path.right(6).get_base_dir();
- if (file_filter!="*" && extension != file_filter )
+ if (search_term!="" && search_from.findn(search_term)==-1)
continue;
- bool isfave = favorites.has(p_dir->get_file_path(i));
+ bool isfave = favorites.has(file_path);
if (button_favorite->is_pressed() && !isfave)
continue;
@@ -78,7 +82,7 @@ bool ScenesDock::_create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_di
fitem->set_icon(0, icon );
- fitem->set_metadata(0,p_dir->get_file_path(i));
+ fitem->set_metadata(0,file_path);
//if (p_dir->files[i]->icon.is_valid()) {
// fitem->set_icon(0,p_dir->files[i]->icon);
// }
@@ -289,7 +293,7 @@ ScenesDock::ScenesDock(EditorNode *p_editor) {
toolbar_hbc->add_child(button_instance);
tree = memnew( Tree );
- tree_filter=memnew( ScenesDockFilter(tree) );
+ tree_filter=memnew( ScenesDockFilter() );
tree_filter->connect("filter_changed", this, "_update_tree");
add_child(tree_filter);
add_child(tree);
@@ -314,8 +318,11 @@ ScenesDock::~ScenesDock() {
void ScenesDockFilter::_setup_filters() {
- file_filter->clear();
-
+ filter_option->clear();
+ filter_option->add_item("Path");
+ filter_option->add_item("Name");
+ filter_option->add_item("Folder");
+#if 0
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("",&extensions);
@@ -336,6 +343,7 @@ void ScenesDockFilter::_setup_filters() {
else
file_filter->add_item("( "+flt+" )");
}
+#endif
}
void ScenesDockFilter::_command(int p_command) {
@@ -358,18 +366,26 @@ String ScenesDockFilter::get_search_term() {
return search_box->get_text().strip_edges();
}
-String ScenesDockFilter::get_file_filter() {
+ScenesDockFilter::FilterOption ScenesDockFilter::get_file_filter() {
return _current_filter;
}
void ScenesDockFilter::_file_filter_selected(int p_idx) {
- String selected = filters[file_filter->get_selected()];
+ FilterOption selected = (FilterOption)(filter_option->get_selected());
if (_current_filter != selected ) {
_current_filter = selected;
emit_signal("filter_changed");
}
}
+void ScenesDockFilter::_notification(int p_what) {
+ switch(p_what) {
+ case NOTIFICATION_ENTER_SCENE: {
+ clear_search_button->set_icon(get_icon("CloseHover","EditorIcons"));
+ } break;
+ }
+}
+
void ScenesDockFilter::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_command"),&ScenesDockFilter::_command);
@@ -379,17 +395,15 @@ void ScenesDockFilter::_bind_methods() {
ADD_SIGNAL( MethodInfo("filter_changed") );
}
-ScenesDockFilter::ScenesDockFilter(Tree *p_tree) {
-
- _current_filter = "*";
+ScenesDockFilter::ScenesDockFilter() {
- tree = p_tree;
+ _current_filter = FILTER_PATH;
- file_filter = memnew( OptionButton );
- file_filter->set_custom_minimum_size(Size2(90,10));
- file_filter->set_clip_text(true);
- file_filter->connect("item_selected", this, "_file_filter_selected");
- add_child(file_filter);
+ filter_option = memnew( OptionButton );
+ filter_option->set_custom_minimum_size(Size2(60,10));
+ filter_option->set_clip_text(true);
+ filter_option->connect("item_selected", this, "_file_filter_selected");
+ add_child(filter_option);
_setup_filters();
@@ -398,8 +412,7 @@ ScenesDockFilter::ScenesDockFilter(Tree *p_tree) {
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(search_box);
- clear_search_button = memnew( Button );
- clear_search_button->set_text("clear");
+ clear_search_button = memnew( ToolButton );
clear_search_button->connect("pressed",this,"_command",make_binds(CMD_CLEAR_FILTER));
add_child(clear_search_button);
diff --git a/tools/editor/scenes_dock.h b/tools/editor/scenes_dock.h
index cf48e2885f..9849f5ace0 100644
--- a/tools/editor/scenes_dock.h
+++ b/tools/editor/scenes_dock.h
@@ -33,7 +33,7 @@
#include "scene/gui/control.h"
#include "scene/gui/tree.h"
#include "scene/gui/label.h"
-#include "scene/gui/button.h"
+#include "scene/gui/tool_button.h"
#include "scene/gui/option_button.h"
#include "scene/gui/box_container.h"
#include "os/dir_access.h"
@@ -86,17 +86,25 @@ class ScenesDockFilter : public HBoxContainer {
OBJ_TYPE( ScenesDockFilter, HBoxContainer );
+private:
+ friend class ScenesDock;
+
enum Command {
CMD_CLEAR_FILTER,
};
Tree *tree;
- OptionButton *file_filter;
+ OptionButton *filter_option;
LineEdit *search_box;
- Button *clear_search_button;
+ ToolButton *clear_search_button;
- String _current_filter;
- Vector<String> filters;
+ enum FilterOption {
+ FILTER_PATH, // NAME or Folder
+ FILTER_NAME,
+ FILTER_FOLDER,
+ };
+ FilterOption _current_filter;
+ //Vector<String> filters;
void _command(int p_command);
void _search_text_changed(const String& p_newtext);
@@ -104,12 +112,13 @@ class ScenesDockFilter : public HBoxContainer {
void _file_filter_selected(int p_idx);
protected:
+ void _notification(int p_what);
static void _bind_methods();
public:
String get_search_term();
- String get_file_filter();
- ScenesDockFilter(Tree *p_tree);
+ FilterOption get_file_filter();
+ ScenesDockFilter();
};
#endif // SCENES_DOCK_H