diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 19:12:25 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 19:12:25 -0300 |
commit | ce26eb74bca48f16e9a34b4eb1c34e50dfc5daae (patch) | |
tree | 5f9c387037d0142d40f7275575436483dc0a7237 /tools/editor | |
parent | ab4126f51061277e87b41c48b40e7b54942d4eca (diff) | |
parent | 45c5c89de961357a7042d9e1f063e288d7a510cf (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'tools/editor')
229 files changed, 2222 insertions, 1249 deletions
diff --git a/tools/editor/SCsub b/tools/editor/SCsub index f6cb16dc24..caf45d25be 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -3,86 +3,78 @@ Import('env') -def make_doc_header(target,source,env): - - src = source[0].srcnode().abspath - dst = target[0].srcnode().abspath - f = open(src,"rb") - g = open(dst,"wb") - buf = f.read() - decomp_size = len(buf) - import zlib - buf = zlib.compress(buf) - - - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _DOC_DATA_RAW_H\n") - g.write("#define _DOC_DATA_RAW_H\n") - g.write("static const int _doc_data_compressed_size="+str(len(buf))+";\n") - g.write("static const int _doc_data_uncompressed_size="+str(decomp_size)+";\n") - g.write("static const unsigned char _doc_data_compressed[]={\n") - for i in range(len(buf)): - g.write(str(ord(buf[i]))+",\n") - g.write("};\n") - g.write("#endif") - - - -def make_certs_header(target,source,env): - - src = source[0].srcnode().abspath - dst = target[0].srcnode().abspath - f = open(src,"rb") - g = open(dst,"wb") - buf = f.read() - decomp_size = len(buf) - import zlib - buf = zlib.compress(buf) - - - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _CERTS_RAW_H\n") - g.write("#define _CERTS_RAW_H\n") - g.write("static const int _certs_compressed_size="+str(len(buf))+";\n") - g.write("static const int _certs_uncompressed_size="+str(decomp_size)+";\n") - g.write("static const unsigned char _certs_compressed[]={\n") - for i in range(len(buf)): - g.write(str(ord(buf[i]))+",\n") - g.write("};\n") - g.write("#endif") - - - - - - - -if (env["tools"]=="yes"): - - reg_exporters_inc='#include "register_exporters.h"\n' - reg_exporters='void register_exporters() {\n' - for e in env.platform_exporters: - env.tool_sources.append("#platform/"+e+"/export/export.cpp") - reg_exporters+='\tregister_'+e+'_exporter();\n' - reg_exporters_inc+='#include "platform/'+e+'/export/export.h"\n' - reg_exporters+='}\n' - f = open("register_exporters.cpp","wb") - f.write(reg_exporters_inc) - f.write(reg_exporters) - f.close() - - env.Depends("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml") - env.Command("#tools/editor/doc_data_compressed.h","#doc/base/classes.xml",make_doc_header) - - env.Depends("#tools/editor/certs_compressed.h","#tools/certs/ca-certificates.crt") - env.Command("#tools/editor/certs_compressed.h","#tools/certs/ca-certificates.crt",make_certs_header) - - #make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env) - - env.add_source_files(env.tool_sources,"*.cpp") - - Export('env') - SConscript('icons/SCsub'); - SConscript('plugins/SCsub'); - SConscript('fileserver/SCsub'); - SConscript('io_plugins/SCsub'); +def make_doc_header(target, source, env): + + src = source[0].srcnode().abspath + dst = target[0].srcnode().abspath + f = open(src, "rb") + g = open(dst, "wb") + buf = f.read() + decomp_size = len(buf) + import zlib + buf = zlib.compress(buf) + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _DOC_DATA_RAW_H\n") + g.write("#define _DOC_DATA_RAW_H\n") + g.write("static const int _doc_data_compressed_size=" + str(len(buf)) + ";\n") + g.write("static const int _doc_data_uncompressed_size=" + str(decomp_size) + ";\n") + g.write("static const unsigned char _doc_data_compressed[]={\n") + for i in range(len(buf)): + g.write(str(ord(buf[i])) + ",\n") + g.write("};\n") + g.write("#endif") + + +def make_certs_header(target, source, env): + + src = source[0].srcnode().abspath + dst = target[0].srcnode().abspath + f = open(src, "rb") + g = open(dst, "wb") + buf = f.read() + decomp_size = len(buf) + import zlib + buf = zlib.compress(buf) + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _CERTS_RAW_H\n") + g.write("#define _CERTS_RAW_H\n") + g.write("static const int _certs_compressed_size=" + str(len(buf)) + ";\n") + g.write("static const int _certs_uncompressed_size=" + str(decomp_size) + ";\n") + g.write("static const unsigned char _certs_compressed[]={\n") + for i in range(len(buf)): + g.write(str(ord(buf[i])) + ",\n") + g.write("};\n") + g.write("#endif") + + +if (env["tools"] == "yes"): + + reg_exporters_inc = '#include "register_exporters.h"\n' + reg_exporters = 'void register_exporters() {\n' + for e in env.platform_exporters: + env.tool_sources.append("#platform/" + e + "/export/export.cpp") + reg_exporters += '\tregister_' + e + '_exporter();\n' + reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n' + reg_exporters += '}\n' + f = open("register_exporters.cpp", "wb") + f.write(reg_exporters_inc) + f.write(reg_exporters) + f.close() + + env.Depends("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml") + env.Command("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml", make_doc_header) + + env.Depends("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt") + env.Command("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt", make_certs_header) + + # make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env) + + env.add_source_files(env.tool_sources, "*.cpp") + + Export('env') + SConscript('icons/SCsub') + SConscript('plugins/SCsub') + SConscript('fileserver/SCsub') + SConscript('io_plugins/SCsub') diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index a556031e5e..b14a7eb9b3 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/animation_editor.h b/tools/editor/animation_editor.h index 3078b3288b..83aa80ea5a 100644 --- a/tools/editor/animation_editor.h +++ b/tools/editor/animation_editor.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/array_property_edit.cpp b/tools/editor/array_property_edit.cpp index b6219ce67b..a0a445ceae 100644 --- a/tools/editor/array_property_edit.cpp +++ b/tools/editor/array_property_edit.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/array_property_edit.h b/tools/editor/array_property_edit.h index a2aa24c8ed..fc74def244 100644 --- a/tools/editor/array_property_edit.h +++ b/tools/editor/array_property_edit.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp index 3fd5d2b5d1..8c693490c0 100644 --- a/tools/editor/asset_library_editor_plugin.cpp +++ b/tools/editor/asset_library_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/asset_library_editor_plugin.h b/tools/editor/asset_library_editor_plugin.h index fe40255af9..bbd5ed42cd 100644 --- a/tools/editor/asset_library_editor_plugin.h +++ b/tools/editor/asset_library_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/call_dialog.cpp b/tools/editor/call_dialog.cpp index 0c6c64a33b..cc78584101 100644 --- a/tools/editor/call_dialog.cpp +++ b/tools/editor/call_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/call_dialog.h b/tools/editor/call_dialog.h index a2ca925ff1..d6c3928122 100644 --- a/tools/editor/call_dialog.h +++ b/tools/editor/call_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index 626f86d33d..58576a30f1 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -895,7 +895,7 @@ void FindReplaceDialog::_bind_methods() { FindReplaceDialog::FindReplaceDialog() { - set_self_opacity(0.8); + set_self_modulate(Color(1,1,1,0.8)); VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h index ce3b5bee26..b5688bc0be 100644 --- a/tools/editor/code_editor.h +++ b/tools/editor/code_editor.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp index 1baad2c6b3..dc3d6d08f1 100644 --- a/tools/editor/connections_dialog.cpp +++ b/tools/editor/connections_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/connections_dialog.h b/tools/editor/connections_dialog.h index 73f52abc9e..028faccabd 100644 --- a/tools/editor/connections_dialog.h +++ b/tools/editor/connections_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp index 320939cb97..4df6f3498f 100644 --- a/tools/editor/create_dialog.cpp +++ b/tools/editor/create_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/create_dialog.h b/tools/editor/create_dialog.h index 706a06ae16..ccd733b3ad 100644 --- a/tools/editor/create_dialog.h +++ b/tools/editor/create_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/dependency_editor.cpp b/tools/editor/dependency_editor.cpp index 049bcefc75..238bb2a3d7 100644 --- a/tools/editor/dependency_editor.cpp +++ b/tools/editor/dependency_editor.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/dependency_editor.h b/tools/editor/dependency_editor.h index 60758f8f4e..be9c68a877 100644 --- a/tools/editor/dependency_editor.h +++ b/tools/editor/dependency_editor.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/doc_code_font.h b/tools/editor/doc_code_font.h index 879c873ea1..55f335ab78 100644 --- a/tools/editor/doc_code_font.h +++ b/tools/editor/doc_code_font.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/doc_font.h b/tools/editor/doc_font.h index a3c3b58b21..b598ee26f8 100644 --- a/tools/editor/doc_font.h +++ b/tools/editor/doc_font.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/doc_title_font.h b/tools/editor/doc_title_font.h index 75a3f049f0..afa0f61eda 100644 --- a/tools/editor/doc_title_font.h +++ b/tools/editor/doc_title_font.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_asset_installer.cpp b/tools/editor/editor_asset_installer.cpp index b6051886c0..85a9d9cbbd 100644 --- a/tools/editor/editor_asset_installer.cpp +++ b/tools/editor/editor_asset_installer.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_asset_installer.h b/tools/editor/editor_asset_installer.h index d6e71dbb3c..a8525d0fa3 100644 --- a/tools/editor/editor_asset_installer.h +++ b/tools/editor/editor_asset_installer.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_autoload_settings.cpp b/tools/editor/editor_autoload_settings.cpp index 97062b1480..cbe9c81984 100644 --- a/tools/editor/editor_autoload_settings.cpp +++ b/tools/editor/editor_autoload_settings.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -399,7 +399,7 @@ Variant EditorAutoloadSettings::get_drag_data_fw(const Point2& p_point, Control for (int i = 0; i < max_size; i++) { Label *label = memnew( Label(autoloads[i]) ); - label->set_self_opacity(Math::lerp(1, 0, float(i)/PREVIEW_LIST_MAX_SIZE)); + label->set_self_modulate(Color(1,1,1,Math::lerp(1, 0, float(i)/PREVIEW_LIST_MAX_SIZE))); preview->add_child(label); } diff --git a/tools/editor/editor_autoload_settings.h b/tools/editor/editor_autoload_settings.h index b61c44b9c2..ad834f9e84 100644 --- a/tools/editor/editor_autoload_settings.h +++ b/tools/editor/editor_autoload_settings.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index 8fc18b5b39..ddb786484e 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_data.h b/tools/editor/editor_data.h index 59f9d4e4f3..345a1918d0 100644 --- a/tools/editor/editor_data.h +++ b/tools/editor/editor_data.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_dir_dialog.cpp b/tools/editor/editor_dir_dialog.cpp index cf0732501e..c542b1e7cc 100644 --- a/tools/editor/editor_dir_dialog.cpp +++ b/tools/editor/editor_dir_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -145,7 +145,7 @@ void EditorDirDialog::set_current_path(const String& p_path) { if (p.begins_with("res://")) p = p.replace_first("res://",""); - Vector<String> dirs = p.split("/"); + Vector<String> dirs = p.split("/",false); TreeItem *r=tree->get_root(); for(int i=0;i<dirs.size();i++) { diff --git a/tools/editor/editor_dir_dialog.h b/tools/editor/editor_dir_dialog.h index 69f9850c30..8d0986b129 100644 --- a/tools/editor/editor_dir_dialog.h +++ b/tools/editor/editor_dir_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index 90289a275e..28557648e5 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_file_dialog.h b/tools/editor/editor_file_dialog.h index 14683856c0..c918f7bfb0 100644 --- a/tools/editor/editor_file_dialog.h +++ b/tools/editor/editor_file_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index be1af16576..1e2bd44b81 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_file_system.h b/tools/editor/editor_file_system.h index fb768fb358..f70b74b818 100644 --- a/tools/editor/editor_file_system.h +++ b/tools/editor/editor_file_system.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_fonts.cpp b/tools/editor/editor_fonts.cpp index bcf41cbac8..49b1ccc397 100644 --- a/tools/editor/editor_fonts.cpp +++ b/tools/editor/editor_fonts.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_fonts.h b/tools/editor/editor_fonts.h index 3b2422c3e3..0e8ce20609 100644 --- a/tools/editor/editor_fonts.h +++ b/tools/editor/editor_fonts.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 4f83dc2f66..611b6a48a7 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -1710,7 +1710,7 @@ EditorHelp::EditorHelp() { search_dialog->get_ok()->set_text(TTR("Find")); search_dialog->connect("confirmed",this,"_search_cbk"); search_dialog->set_hide_on_ok(false); - search_dialog->set_self_opacity(0.8); + search_dialog->set_self_modulate(Color(1,1,1,0.8)); /*class_search = memnew( EditorHelpSearch(editor) ); diff --git a/tools/editor/editor_help.h b/tools/editor/editor_help.h index b0dc2809fe..6a6cd7439e 100644 --- a/tools/editor/editor_help.h +++ b/tools/editor/editor_help.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_icons.h b/tools/editor/editor_icons.h index 191b908682..7e8d8c0828 100644 --- a/tools/editor/editor_icons.h +++ b/tools/editor/editor_icons.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index d90a175811..90b96f7e1e 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h index e21fd8c8f8..f9a02fe4fa 100644 --- a/tools/editor/editor_import_export.h +++ b/tools/editor/editor_import_export.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_initialize_ssl.cpp b/tools/editor/editor_initialize_ssl.cpp index c0b55b302f..b7f8e2aad5 100644 --- a/tools/editor/editor_initialize_ssl.cpp +++ b/tools/editor/editor_initialize_ssl.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,10 +35,11 @@ void editor_initialize_certificates() { ByteArray data; - data.resize(_certs_uncompressed_size); + data.resize(_certs_uncompressed_size+1); { ByteArray::Write w = data.write(); Compression::decompress(w.ptr(),_certs_uncompressed_size,_certs_compressed,_certs_compressed_size,Compression::MODE_DEFLATE); + w[_certs_uncompressed_size]=0; //make sure it ends at zero } StreamPeerSSL::load_certs_from_memory(data); diff --git a/tools/editor/editor_initialize_ssl.h b/tools/editor/editor_initialize_ssl.h index 082d546832..0b34ac1d7e 100644 --- a/tools/editor/editor_initialize_ssl.h +++ b/tools/editor/editor_initialize_ssl.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp index 02af9712a8..808f32073f 100644 --- a/tools/editor/editor_log.cpp +++ b/tools/editor/editor_log.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -67,6 +67,10 @@ void EditorLog::_error_handler(void *p_self, const char*p_func, const char*p_fil icon = self->get_icon("ScriptError","EditorIcons"); } break; + case ERR_HANDLER_SHADER: { + + icon = self->get_icon("Shader","EditorIcons"); + } break; } @@ -203,7 +207,7 @@ EditorLog::EditorLog() { log->set_selection_enabled(true); log->set_focus_mode(FOCUS_CLICK); pc->add_child(log); - add_message(VERSION_FULL_NAME" (c) 2008-2016 Juan Linietsky, Ariel Manzur."); + add_message(VERSION_FULL_NAME" (c) 2008-2017 Juan Linietsky, Ariel Manzur."); //log->add_text("Initialization Complete.\n"); //because it looks cool. eh.errfunc=_error_handler; diff --git a/tools/editor/editor_log.h b/tools/editor/editor_log.h index bbf35b63cb..f98ad8b75e 100644 --- a/tools/editor/editor_log.h +++ b/tools/editor/editor_log.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_name_dialog.cpp b/tools/editor/editor_name_dialog.cpp index c221b908e0..77e393cecb 100644 --- a/tools/editor/editor_name_dialog.cpp +++ b/tools/editor/editor_name_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_name_dialog.h b/tools/editor/editor_name_dialog.h index 9e66908899..1aabe8e962 100644 --- a/tools/editor/editor_name_dialog.h +++ b/tools/editor/editor_name_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 5a3deb7b9d..46e7f0a42f 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -99,6 +99,7 @@ #include "plugins/light_occluder_2d_editor_plugin.h" #include "plugins/color_ramp_editor_plugin.h" #include "plugins/collision_shape_2d_editor_plugin.h" +#include "plugins/gi_probe_editor_plugin.h" #include "main/input_default.h" // end #include "tools/editor/editor_settings.h" @@ -267,16 +268,14 @@ void EditorNode::_notification(int p_what) { circle_step=0; circle_step_msec=tick; - circle_step_frame=frame+1; + circle_step_frame=frame+1; - // update the circle itself only when its enabled - if (!update_menu->get_popup()->is_item_checked(3)){ - update_menu->set_icon(gui_base->get_icon("Progress"+itos(circle_step+1),"EditorIcons")); - } + // update the circle itself only when its enabled + if (!update_menu->get_popup()->is_item_checked(3)){ + update_menu->set_icon(gui_base->get_icon("Progress"+itos(circle_step+1),"EditorIcons")); + } } - scene_root->set_size_override(true,Size2(Globals::get_singleton()->get("display/width"),Globals::get_singleton()->get("display/height"))); - editor_selection->update(); { @@ -303,7 +302,7 @@ void EditorNode::_notification(int p_what) { } if (p_what==NOTIFICATION_ENTER_TREE) { - + get_tree()->get_root()->set_disable_3d(true); //MessageQueue::get_singleton()->push_call(this,"_get_scene_metadata"); get_tree()->set_editor_hint(true); get_tree()->get_root()->set_as_audio_listener(false); @@ -910,10 +909,11 @@ void EditorNode::_save_scene_with_preview(String p_file) { _editor_select(is2d?EDITOR_2D:EDITOR_3D); - VS::get_singleton()->viewport_queue_screen_capture(viewport); + save.step(TTR("Creating Thumbnail"),2); save.step(TTR("Creating Thumbnail"),3); - Image img = VS::get_singleton()->viewport_get_screen_capture(viewport); +#if 0 + Image img = VS::get_singleton()->viewport_texture(scree_capture(viewport); int preview_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size");; preview_size*=EDSCALE; int width,height; @@ -931,7 +931,7 @@ void EditorNode::_save_scene_with_preview(String p_file) { height=img.get_height(); } - img.convert(Image::FORMAT_RGB); + img.convert(Image::FORMAT_RGB8); img.resize(width,height); String pfile = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp/last_scene_preview.png"); @@ -943,7 +943,7 @@ void EditorNode::_save_scene_with_preview(String p_file) { if (editor_data.get_edited_scene_import_metadata().is_null()) editor_data.set_edited_scene_import_metadata(Ref<ResourceImportMetadata>( memnew( ResourceImportMetadata ) ) ); editor_data.get_edited_scene_import_metadata()->set_option("thumbnail",imgdata); - +#endif //tamanio tel thumbnail if (screen!=-1) { _editor_select(screen); @@ -1246,7 +1246,7 @@ void EditorNode::_dialog_action(String p_file) { ml = Ref<MeshLibrary>( memnew( MeshLibrary )); } - MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(),ml,true); +// MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(),ml,true); Error err = ResourceSaver::save(p_file,ml); if (err) { @@ -1848,7 +1848,6 @@ void EditorNode::_run(bool p_current,const String& p_custom) { run_filename=scene->get_filename(); } else { - args=run_settings_dialog->get_custom_arguments(); current_filename=scene->get_filename(); } @@ -1923,9 +1922,14 @@ void EditorNode::_run(bool p_current,const String& p_custom) { log->clear(); } + if (bool(EDITOR_DEF("run/always_open_output_on_play", true))) { + make_bottom_panel_item_visible(log); + } List<String> breakpoints; editor_data.get_editor_breakpoints(&breakpoints); + + args = Globals::get_singleton()->get("editor/main_run_args"); Error error = editor_run.run(run_filename,args,breakpoints,current_filename); @@ -3275,7 +3279,7 @@ Error EditorNode::save_translatable_strings(const String& p_to_file) { OS::Time time = OS::get_singleton()->get_time(); f->store_line("# Translation Strings Dump."); f->store_line("# Created By."); - f->store_line("# \t" VERSION_FULL_NAME " (c) 2008-2016 Juan Linietsky, Ariel Manzur."); + f->store_line("# \t" VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur."); f->store_line("# From Scene: "); f->store_line("# \t"+get_edited_scene()->get_filename()); f->store_line(""); @@ -5372,6 +5376,8 @@ void EditorNode::_bind_methods() { EditorNode::EditorNode() { + VisualServer::get_singleton()->textures_keep_original(true); + EditorHelp::generate_doc(); //before any editor classes are crated SceneState::set_disable_placeholders(true); editor_initialize_certificates(); //for asset sharing @@ -5458,7 +5464,7 @@ EditorNode::EditorNode() { editor_import_export->load_config(); - GLOBAL_DEF("editor/main_run_args","$exec -path $path -scene $scene $main_scene"); + GLOBAL_DEF("editor/main_run_args","$scene"); ObjectTypeDB::set_type_enabled("CollisionShape",true); ObjectTypeDB::set_type_enabled("CollisionShape2D",true); @@ -5672,6 +5678,7 @@ EditorNode::EditorNode() { scene_root_parent->set_custom_minimum_size(Size2(0,80)*EDSCALE); + //Ref<StyleBox> sp = scene_root_parent->get_stylebox("panel","TabContainer"); //scene_root_parent->add_style_override("panel",sp); @@ -5685,6 +5692,8 @@ EditorNode::EditorNode() { scene_root = memnew( Viewport ); + scene_root->set_disable_3d(true); + //scene_root_base->add_child(scene_root); @@ -5692,7 +5701,7 @@ EditorNode::EditorNode() { VisualServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport(),true); scene_root->set_disable_input(true); scene_root->set_as_audio_listener_2d(true); - scene_root->set_size_override(true,Size2(Globals::get_singleton()->get("display/width"),Globals::get_singleton()->get("display/height"))); + //scene_root->set_size_override(true,Size2(Globals::get_singleton()->get("display/width"),Globals::get_singleton()->get("display/height"))); // scene_root->set_world_2d( Ref<World2D>( memnew( World2D )) ); @@ -5705,6 +5714,7 @@ EditorNode::EditorNode() { scene_root_parent->add_child(viewport); + PanelContainer *top_region = memnew( PanelContainer ); top_region->add_style_override("panel",gui_base->get_stylebox("hover","Button")); HBoxContainer *left_menu_hb = memnew( HBoxContainer ); @@ -5957,6 +5967,7 @@ EditorNode::EditorNode() { 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); @@ -6421,7 +6432,7 @@ EditorNode::EditorNode() { about->get_ok()->set_text(TTR("Thanks!")); about->set_hide_on_ok(true); Label *about_text = memnew( Label ); - about_text->set_text(VERSION_FULL_NAME"\n(c) 2008-2016 Juan Linietsky, Ariel Manzur.\n"); + about_text->set_text(VERSION_FULL_NAME"\n(c) 2008-2017 Juan Linietsky, Ariel Manzur.\n"); about_text->set_pos(Point2(gui_base->get_icon("Logo","EditorIcons")->get_size().width+30,20)); gui_base->add_child(about); about->add_child(about_text); @@ -6549,10 +6560,11 @@ EditorNode::EditorNode() { //more visually meaningful to have this later raise_bottom_panel_item(AnimationPlayerEditor::singleton); - add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,true) ) ); + add_editor_plugin( memnew( ShaderEditorPlugin(this) ) ); +/* add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,true) ) ); add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,false) ) ); - add_editor_plugin( memnew( ShaderEditorPlugin(this,true) ) ); - add_editor_plugin( memnew( ShaderEditorPlugin(this,false) ) ); + + add_editor_plugin( memnew( ShaderEditorPlugin(this,false) ) );*/ add_editor_plugin( memnew( CameraEditorPlugin(this) ) ); add_editor_plugin( memnew( SampleEditorPlugin(this) ) ); add_editor_plugin( memnew( SampleLibraryEditorPlugin(this) ) ); @@ -6561,31 +6573,32 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( MeshInstanceEditorPlugin(this) ) ); add_editor_plugin( memnew( AnimationTreeEditorPlugin(this) ) ); //add_editor_plugin( memnew( SamplePlayerEditorPlugin(this) ) ); - this is kind of useless at this point - add_editor_plugin( memnew( MeshLibraryEditorPlugin(this) ) ); +// add_editor_plugin( memnew( MeshLibraryEditorPlugin(this) ) ); //add_editor_plugin( memnew( StreamEditorPlugin(this) ) ); add_editor_plugin( memnew( StyleBoxEditorPlugin(this) ) ); - add_editor_plugin( memnew( ParticlesEditorPlugin(this) ) ); + //add_editor_plugin( memnew( ParticlesEditorPlugin(this) ) ); add_editor_plugin( memnew( ResourcePreloaderEditorPlugin(this) ) ); add_editor_plugin( memnew( ItemListEditorPlugin(this) ) ); //add_editor_plugin( memnew( RichTextEditorPlugin(this) ) ); - add_editor_plugin( memnew( CollisionPolygonEditorPlugin(this) ) ); +// add_editor_plugin( memnew( CollisionPolygonEditorPlugin(this) ) ); add_editor_plugin( memnew( CollisionPolygon2DEditorPlugin(this) ) ); add_editor_plugin( memnew( TileSetEditorPlugin(this) ) ); add_editor_plugin( memnew( TileMapEditorPlugin(this) ) ); add_editor_plugin( memnew( SpriteFramesEditorPlugin(this) ) ); add_editor_plugin( memnew( TextureRegionEditorPlugin(this) ) ); 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( BakedLightEditorPlugin(this) ) ); +// add_editor_plugin( memnew( PathEditorPlugin(this) ) ); + //add_editor_plugin( memnew( BakedLightEditorPlugin(this) ) ); add_editor_plugin( memnew( Polygon2DEditorPlugin(this) ) ); add_editor_plugin( memnew( LightOccluder2DEditorPlugin(this) ) ); add_editor_plugin( memnew( NavigationPolygonEditorPlugin(this) ) ); add_editor_plugin( memnew( ColorRampEditorPlugin(this) ) ); add_editor_plugin( memnew( CollisionShape2DEditorPlugin(this) ) ); add_editor_plugin( memnew( TextureEditorPlugin(this) ) ); - add_editor_plugin( memnew( MaterialEditorPlugin(this) ) ); - add_editor_plugin( memnew( MeshEditorPlugin(this) ) ); +// add_editor_plugin( memnew( MaterialEditorPlugin(this) ) ); +// add_editor_plugin( memnew( MeshEditorPlugin(this) ) ); for(int i=0;i<EditorPlugins::get_plugin_count();i++) add_editor_plugin( EditorPlugins::create(i,this) ); @@ -6594,14 +6607,14 @@ EditorNode::EditorNode() { plugin_init_callbacks[i](); } - resource_preview->add_preview_generator( Ref<EditorTexturePreviewPlugin>( memnew(EditorTexturePreviewPlugin ))); + /*resource_preview->add_preview_generator( Ref<EditorTexturePreviewPlugin>( memnew(EditorTexturePreviewPlugin ))); resource_preview->add_preview_generator( Ref<EditorPackedScenePreviewPlugin>( memnew(EditorPackedScenePreviewPlugin ))); resource_preview->add_preview_generator( Ref<EditorMaterialPreviewPlugin>( memnew(EditorMaterialPreviewPlugin ))); resource_preview->add_preview_generator( Ref<EditorScriptPreviewPlugin>( memnew(EditorScriptPreviewPlugin ))); resource_preview->add_preview_generator( Ref<EditorSamplePreviewPlugin>( memnew(EditorSamplePreviewPlugin ))); resource_preview->add_preview_generator( Ref<EditorMeshPreviewPlugin>( memnew(EditorMeshPreviewPlugin ))); resource_preview->add_preview_generator( Ref<EditorBitmapPreviewPlugin>( memnew(EditorBitmapPreviewPlugin ))); - +*/ circle_step_msec=OS::get_singleton()->get_ticks_msec(); @@ -6684,6 +6697,7 @@ EditorNode::EditorNode() { load_error_dialog->set_child_rect(load_errors); gui_base->add_child(load_error_dialog); + //EditorImport::add_importer( Ref<EditorImporterCollada>( memnew(EditorImporterCollada ))); EditorFileSystem::get_singleton()->connect("sources_changed",this,"_sources_changed"); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 6392b96f8f..20a7cf4061 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -79,7 +79,7 @@ #include "fileserver/editor_file_server.h" #include "editor_resource_preview.h" - +#include "scene/gui/viewport_container.h" #include "progress_dialog.h" @@ -208,7 +208,7 @@ private: //Ref<ResourceImportMetadata> scene_import_metadata; - Control* scene_root_parent; + PanelContainer* scene_root_parent; Control *gui_base; VBoxContainer *main_vbox; diff --git a/tools/editor/editor_path.cpp b/tools/editor/editor_path.cpp index e7feb1afd3..f924c4a20c 100644 --- a/tools/editor/editor_path.cpp +++ b/tools/editor/editor_path.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_path.h b/tools/editor/editor_path.h index 7f51a5dc48..86b8e77060 100644 --- a/tools/editor/editor_path.h +++ b/tools/editor/editor_path.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 4b82d5e59c..106e91348e 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -76,6 +76,11 @@ Control * EditorPlugin::get_editor_viewport() { return EditorNode::get_singleton()->get_viewport(); } +void EditorPlugin::edit_resource(const Ref<Resource>& p_resource){ + + EditorNode::get_singleton()->edit_resource(p_resource); +} + void EditorPlugin::add_control_to_container(CustomControlContainer p_location,Control *p_control) { switch(p_location) { @@ -370,6 +375,7 @@ void EditorPlugin::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_selection:EditorSelection"),&EditorPlugin::get_selection); ObjectTypeDB::bind_method(_MD("get_editor_settings:EditorSettings"),&EditorPlugin::get_editor_settings); ObjectTypeDB::bind_method(_MD("queue_save_layout"),&EditorPlugin::queue_save_layout); + ObjectTypeDB::bind_method(_MD("edit_resource"),&EditorPlugin::edit_resource); ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_canvas_input_event",PropertyInfo(Variant::MATRIX32,"canvas_xform"),PropertyInfo(Variant::INPUT_EVENT,"event"))); ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("forward_draw_over_canvas",PropertyInfo(Variant::MATRIX32,"canvas_xform"),PropertyInfo(Variant::OBJECT,"canvas:Control"))); diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h index 2700c49a6c..9e7449f7fa 100644 --- a/tools/editor/editor_plugin.h +++ b/tools/editor/editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -101,6 +101,7 @@ public: void remove_control_from_docks(Control *p_control); void remove_control_from_bottom_panel(Control *p_control); Control* get_editor_viewport(); + void edit_resource(const Ref<Resource>& p_resource); virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial); virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform, const InputEvent& p_event); diff --git a/tools/editor/editor_plugin_settings.cpp b/tools/editor/editor_plugin_settings.cpp index 5342007e6d..23738848bf 100644 --- a/tools/editor/editor_plugin_settings.cpp +++ b/tools/editor/editor_plugin_settings.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_plugin_settings.h b/tools/editor/editor_plugin_settings.h index 4a982e40e2..8d3e22bfc9 100644 --- a/tools/editor/editor_plugin_settings.h +++ b/tools/editor/editor_plugin_settings.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_profiler.cpp b/tools/editor/editor_profiler.cpp index 13327f0be9..435ad78b89 100644 --- a/tools/editor/editor_profiler.cpp +++ b/tools/editor/editor_profiler.cpp @@ -338,7 +338,7 @@ void EditorProfiler::_update_plot() { wr = DVector<uint8_t>::Write(); - Image img(w,h,0,Image::FORMAT_RGBA,graph_image); + Image img(w,h,0,Image::FORMAT_RGBA8,graph_image); if (reset_texture) { diff --git a/tools/editor/editor_reimport_dialog.cpp b/tools/editor/editor_reimport_dialog.cpp index b6311a7604..7cb4e76729 100644 --- a/tools/editor/editor_reimport_dialog.cpp +++ b/tools/editor/editor_reimport_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_reimport_dialog.h b/tools/editor/editor_reimport_dialog.h index 0c2d0eb52c..0b006dce6d 100644 --- a/tools/editor/editor_reimport_dialog.h +++ b/tools/editor/editor_reimport_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp index 6afc3e2a34..7b3a3b7e3f 100644 --- a/tools/editor/editor_resource_preview.cpp +++ b/tools/editor/editor_resource_preview.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -267,6 +267,8 @@ void EditorResourcePreview::_thread() { memdelete(f); } + cache_valid=false; + if (cache_valid) { texture = ResourceLoader::load(cache_base+".png","ImageTexture",true); diff --git a/tools/editor/editor_resource_preview.h b/tools/editor/editor_resource_preview.h index 2756360130..9dfdb0ec15 100644 --- a/tools/editor/editor_resource_preview.h +++ b/tools/editor/editor_resource_preview.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_run.cpp b/tools/editor/editor_run.cpp index 5fbb4ae2a0..d408291531 100644 --- a/tools/editor/editor_run.cpp +++ b/tools/editor/editor_run.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -55,15 +55,6 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List args.push_back("-epid"); args.push_back(String::num(OS::get_singleton()->get_process_ID())); - if (p_custom_args!="") { - - Vector<String> cargs=p_custom_args.split(" ",false); - for(int i=0;i<cargs.size();i++) { - - args.push_back(cargs[i].replace("%20"," ").replace("$scene",p_edited_scene.replace(" ","%20"))); - } - } - if (debug_collisions) { args.push_back("-debugcol"); } @@ -150,7 +141,12 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List args.push_back(bpoints); } - args.push_back(p_scene); + if (p_custom_args!="") { + Vector<String> cargs=p_custom_args.split(" ",false); + for(int i=0;i<cargs.size();i++) { + args.push_back(cargs[i].replace("$scene",p_scene).replace(" ","%20")); + } + } String exec = OS::get_singleton()->get_executable_path(); diff --git a/tools/editor/editor_run.h b/tools/editor/editor_run.h index 5aa2adf801..78fa892488 100644 --- a/tools/editor/editor_run.h +++ b/tools/editor/editor_run.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_run_native.cpp b/tools/editor/editor_run_native.cpp index edbcc71284..236618f62b 100644 --- a/tools/editor/editor_run_native.cpp +++ b/tools/editor/editor_run_native.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -55,6 +55,7 @@ void EditorRunNative::_notification(int p_what) { small_icon->create_from_image(im); MenuButton *mb = memnew( MenuButton ); mb->get_popup()->connect("item_pressed",this,"_run_native",varray(E->get())); + mb->connect("pressed",this,"_run_native",varray(-1, E->get())); mb->set_icon(small_icon); add_child(mb); menus[E->get()]=mb; @@ -79,13 +80,16 @@ void EditorRunNative::_notification(int p_what) { if (dc==0) { mb->hide(); } else { - mb->get_popup()->clear(); mb->show(); - for(int i=0;i<dc;i++) { - - mb->get_popup()->add_icon_item(get_icon("Play","EditorIcons"),eep->get_device_name(i)); - mb->get_popup()->set_item_tooltip(mb->get_popup()->get_item_count() -1,eep->get_device_info(i)); + if (dc == 1) { + mb->set_tooltip(eep->get_device_name(0) + "\n\n" + eep->get_device_info(0).strip_edges()); + } else { + mb->set_tooltip("Select device from the list"); + for(int i=0;i<dc;i++) { + mb->get_popup()->add_icon_item(get_icon("Play","EditorIcons"),eep->get_device_name(i)); + mb->get_popup()->set_item_tooltip(mb->get_popup()->get_item_count() -1,eep->get_device_info(i).strip_edges()); + } } } } @@ -96,11 +100,18 @@ void EditorRunNative::_notification(int p_what) { } - void EditorRunNative::_run_native(int p_idx,const String& p_platform) { Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(p_platform); ERR_FAIL_COND(eep.is_null()); + if (p_idx == -1) { + if (eep->get_device_count() == 1) { + menus[p_platform]->get_popup()->hide(); + p_idx = 0; + } else { + return; + } + } emit_signal("native_run"); int flags=0; diff --git a/tools/editor/editor_run_native.h b/tools/editor/editor_run_native.h index 04dad6b6aa..ac72685452 100644 --- a/tools/editor/editor_run_native.h +++ b/tools/editor/editor_run_native.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_run_script.cpp b/tools/editor/editor_run_script.cpp index 765f36d3bc..932acb11df 100644 --- a/tools/editor/editor_run_script.cpp +++ b/tools/editor/editor_run_script.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_run_script.h b/tools/editor/editor_run_script.h index 144fad5ab1..da4d9def17 100644 --- a/tools/editor/editor_run_script.h +++ b/tools/editor/editor_run_script.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index f5741c4a9e..4f5e8f6a4b 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -1032,7 +1032,6 @@ String EditorSettings::get_last_selected_language() String path = get_project_settings_path().plus_file("project_metadata.cfg"); Error err = cf->load(path); if (err != OK) { - WARN_PRINTS("Can't load config file: " + path); return ""; } Variant last_selected_language = cf->get_value("script_setup", "last_selected_language"); @@ -1045,11 +1044,7 @@ void EditorSettings::set_last_selected_language(String p_language) { Ref<ConfigFile> cf = memnew( ConfigFile ); String path = get_project_settings_path().plus_file("project_metadata.cfg"); - Error err = cf->load(path); - if (err != OK) { - WARN_PRINTS("Can't load config file: " + path); - return; - } + cf->load(path); cf->set_value("script_setup", "last_selected_language", p_language); cf->save(path); } @@ -1103,7 +1098,6 @@ EditorSettings::EditorSettings() { } _load_defaults(); - save_changed_setting=false; } diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h index a976602304..1f99748ec0 100644 --- a/tools/editor/editor_settings.h +++ b/tools/editor/editor_settings.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_sub_scene.cpp b/tools/editor/editor_sub_scene.cpp index d32dbcd2e6..57bf4b3975 100644 --- a/tools/editor/editor_sub_scene.cpp +++ b/tools/editor/editor_sub_scene.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_sub_scene.h b/tools/editor/editor_sub_scene.h index 3dd86eefda..5022cf3be5 100644 --- a/tools/editor/editor_sub_scene.h +++ b/tools/editor/editor_sub_scene.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_themes.cpp b/tools/editor/editor_themes.cpp index 08f14ec167..fd71c80a4f 100644 --- a/tools/editor/editor_themes.cpp +++ b/tools/editor/editor_themes.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/editor_themes.h b/tools/editor/editor_themes.h index db49801600..83e7dde78a 100644 --- a/tools/editor/editor_themes.h +++ b/tools/editor/editor_themes.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/file_type_cache.cpp b/tools/editor/file_type_cache.cpp index 8a47f49b03..d9b6f36783 100644 --- a/tools/editor/file_type_cache.cpp +++ b/tools/editor/file_type_cache.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/file_type_cache.h b/tools/editor/file_type_cache.h index 18451cbe19..eb9a0759d3 100644 --- a/tools/editor/file_type_cache.h +++ b/tools/editor/file_type_cache.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/fileserver/SCsub b/tools/editor/fileserver/SCsub index 6299fd416c..4bf55189cc 100644 --- a/tools/editor/fileserver/SCsub +++ b/tools/editor/fileserver/SCsub @@ -2,4 +2,4 @@ Import('env') Export('env') -env.add_source_files(env.tool_sources,"*.cpp") +env.add_source_files(env.tool_sources, "*.cpp") diff --git a/tools/editor/fileserver/editor_file_server.cpp b/tools/editor/fileserver/editor_file_server.cpp index c464e10fc2..727deef0b8 100644 --- a/tools/editor/fileserver/editor_file_server.cpp +++ b/tools/editor/fileserver/editor_file_server.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/fileserver/editor_file_server.h b/tools/editor/fileserver/editor_file_server.h index fcb3d8546c..498314a1b9 100644 --- a/tools/editor/fileserver/editor_file_server.h +++ b/tools/editor/fileserver/editor_file_server.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp index 5b1e80fc3b..86c2fe2a6a 100644 --- a/tools/editor/filesystem_dock.cpp +++ b/tools/editor/filesystem_dock.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/filesystem_dock.h b/tools/editor/filesystem_dock.h index f5b96760fc..c23428fcb8 100644 --- a/tools/editor/filesystem_dock.h +++ b/tools/editor/filesystem_dock.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/groups_editor.cpp b/tools/editor/groups_editor.cpp index 5b7bc1da78..fe9b9c27f8 100644 --- a/tools/editor/groups_editor.cpp +++ b/tools/editor/groups_editor.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/groups_editor.h b/tools/editor/groups_editor.h index 6edb577140..203d56ace5 100644 --- a/tools/editor/groups_editor.h +++ b/tools/editor/groups_editor.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/icons/2x/icon_script_create.png b/tools/editor/icons/2x/icon_script_create.png Binary files differnew file mode 100644 index 0000000000..67f80e8760 --- /dev/null +++ b/tools/editor/icons/2x/icon_script_create.png diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index 9e05d8f391..f86ae2b10d 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -2,97 +2,95 @@ Import('env') -def make_editor_icons_action(target, source, env): - - import os - import cStringIO - dst = target[0].srcnode().abspath - pixmaps = source - - s = cStringIO.StringIO() +def make_editor_icons_action(target, source, env): - s.write("#include \"editor_icons.h\"\n\n") - s.write("#include \"editor_scale.h\"\n\n") - s.write("#include \"scene/resources/theme.h\"\n\n") + import os + import cStringIO - hidpi_list=[] + dst = target[0].srcnode().abspath + pixmaps = source - for x in pixmaps: + s = cStringIO.StringIO() - x=str(x) - var_str=os.path.basename(x)[:-4]+"_png"; - #print(var_str) + s.write("#include \"editor_icons.h\"\n\n") + s.write("#include \"editor_scale.h\"\n\n") + s.write("#include \"scene/resources/theme.h\"\n\n") - s.write("static const unsigned char "+ var_str +"[]={\n"); + hidpi_list = [] - pngf=open(x,"rb"); + for x in pixmaps: - b=pngf.read(1); - while(len(b)==1): - s.write(hex(ord(b))) - b=pngf.read(1); - if (len(b)==1): - s.write(",") + x = str(x) + var_str = os.path.basename(x)[:-4] + "_png" + # print(var_str) - s.write("\n};\n\n"); + s.write("static const unsigned char " + var_str + "[]={\n") - pngf.close(); - var_str=os.path.basename(x)[:-4]+"_hidpi_png"; - try: + pngf = open(x, "rb") - pngf = open(os.path.dirname(x)+"/2x/"+os.path.basename(x), "rb") + b = pngf.read(1) + while(len(b) == 1): + s.write(hex(ord(b))) + b = pngf.read(1) + if (len(b) == 1): + s.write(",") - s.write("static const unsigned char "+ var_str +"[]={\n"); + s.write("\n};\n\n") - b=pngf.read(1); - while(len(b)==1): - s.write(hex(ord(b))) - b=pngf.read(1); - if (len(b)==1): - s.write(",") + pngf.close() + var_str = os.path.basename(x)[:-4] + "_hidpi_png" + try: - s.write("\n};\n\n\n"); - hidpi_list.append(x) + pngf = open(os.path.dirname(x) + "/2x/" + os.path.basename(x), "rb") - except: - s.write("static const unsigned char* "+ var_str +"=NULL;\n\n\n"); + s.write("static const unsigned char " + var_str + "[]={\n") + b = pngf.read(1) + while(len(b) == 1): + s.write(hex(ord(b))) + b = pngf.read(1) + if (len(b) == 1): + s.write(",") + s.write("\n};\n\n\n") + hidpi_list.append(x) + except: + s.write("static const unsigned char* " + var_str + "=NULL;\n\n\n") - s.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") - s.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n") - s.write("\tbool use_hidpi_image=(editor_get_scale()>1.0&&p_hidpi_png);\n") - s.write("\tImage img(use_hidpi_image?p_hidpi_png:p_png);\n") - s.write("\tif (editor_get_scale()>1.0 && !p_hidpi_png) { img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); use_hidpi_image=true;}\n") - s.write("\timg.resize(img.get_width()*EDSCALE/(use_hidpi_image?2:1),img.get_height()*EDSCALE/(use_hidpi_image?2:1));\n") - s.write("\ttexture->create_from_image( img,ImageTexture::FLAG_FILTER );\n") - s.write("\treturn texture;\n") - s.write("}\n\n") + s.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") + s.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n") + s.write("\tbool use_hidpi_image=(editor_get_scale()>1.0&&p_hidpi_png);\n") + s.write("\tImage img(use_hidpi_image?p_hidpi_png:p_png);\n") + s.write("\tif (editor_get_scale()>1.0 && !p_hidpi_png) { img.convert(Image::FORMAT_RGBA8); img.expand_x2_hq2x(); use_hidpi_image=true;}\n") + s.write("\timg.resize(img.get_width()*EDSCALE/(use_hidpi_image?2:1),img.get_height()*EDSCALE/(use_hidpi_image?2:1));\n") + s.write("\ttexture->create_from_image( img,ImageTexture::FLAG_FILTER );\n") + s.write("\treturn texture;\n") + s.write("}\n\n") - s.write("void editor_register_icons(Ref<Theme> p_theme) {\n\n") + s.write("void editor_register_icons(Ref<Theme> p_theme) {\n\n") - for x in pixmaps: + for x in pixmaps: - x=os.path.basename(str(x)) - type=x[5:-4].title().replace("_",""); - var_str=x[:-4]+"_png"; - var_str_hidpi=x[:-4]+"_hidpi_png"; - s.write("\tp_theme->set_icon(\""+type+"\",\"EditorIcons\",make_icon("+var_str+","+var_str_hidpi+"));\n"); + x = os.path.basename(str(x)) + type = x[5:-4].title().replace("_", "") + var_str = x[:-4] + "_png" + var_str_hidpi = x[:-4] + "_hidpi_png" + s.write("\tp_theme->set_icon(\"" + type + "\",\"EditorIcons\",make_icon(" + var_str + "," + var_str_hidpi + "));\n") - s.write("\n\n}\n\n"); + s.write("\n\n}\n\n") - f = open(dst,"wb") - f.write(s.getvalue()) - f.close() - s.close() + f = open(dst, "wb") + f.write(s.getvalue()) + f.close() + s.close() make_editor_icons_builder = Builder(action=make_editor_icons_action, - suffix = '.cpp', - src_suffix = '.png') -env['BUILDERS']['MakeEditorIconsBuilder']=make_editor_icons_builder -env.Alias('editor_icons',[env.MakeEditorIconsBuilder('#tools/editor/editor_icons.cpp',Glob("*.png"))]) + suffix='.cpp', + src_suffix='.png') +env['BUILDERS']['MakeEditorIconsBuilder'] = make_editor_icons_builder +env.Alias('editor_icons', [env.MakeEditorIconsBuilder('#tools/editor/editor_icons.cpp', Glob("*.png"))]) env.tool_sources.append("#tools/editor/editor_icons.cpp") Export('env') diff --git a/tools/editor/icons/icon_script_create.png b/tools/editor/icons/icon_script_create.png Binary files differnew file mode 100644 index 0000000000..f5d8b0cfd6 --- /dev/null +++ b/tools/editor/icons/icon_script_create.png diff --git a/tools/editor/icons/source/icon_script_create.svg b/tools/editor/icons/source/icon_script_create.svg new file mode 100644 index 0000000000..c3f69c4601 --- /dev/null +++ b/tools/editor/icons/source/icon_script_create.svg @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + viewBox="0 0 16 16" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + inkscape:export-filename="/home/godotengine/godot/tools/editor/icons/con_script_create.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + sodipodi:docname="icon_script_create.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="29.966667" + inkscape:cx="5.495872" + inkscape:cy="2.1206692" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="true" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1920" + inkscape:window-height="1119" + inkscape:window-x="0" + inkscape:window-y="26" + inkscape:window-maximized="1" + showguides="false"> + <inkscape:grid + type="xygrid" + id="grid3336" + empspacing="4" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1036.3622)"> + <path + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843" + d="M 6 1 L 6 2 A 1 1 0 0 0 5 3 L 5 13 L 4 13 L 4 11 L 2 11 L 2 13 A 1 1 0 0 0 2.5 13.865234 A 1 1 0 0 0 3 14 L 3 15 L 10 15 L 10 14 L 7 14 L 7 10 L 10 10 L 10 7 L 12 7 L 12 5 L 15 5 L 15 3 A 2 2 0 0 0 13 1 L 6 1 z M 11 8 L 11 11 L 8 11 L 8 13 L 11 13 L 11 14.730469 A 2 2 0 0 0 12 13 L 12 8 L 11 8 z " + transform="translate(0,1036.3622)" + id="rect4255" /> + <path + style="opacity:1;fill:#b4b4b4;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843" + d="M 6 1 C 4.8954305 1 4 1.8954305 4 3 L 4 10 L 2 10 L 1 10 L 1 11 L 1 13 C 1 14.104569 1.8954305 15 3 15 C 4.1045695 15 5 14.104569 5 13 L 5 3 C 5 2.4477153 5.4477153 2 6 2 C 6.5522847 2 7 2.4477153 7 3 L 7 4 L 7 5 L 7 6 L 8 6 L 12 6 L 12 5 L 8 5 L 8 4 L 8 3 C 8 1.8954305 7.1045695 1 6 1 z M 2 11 L 4 11 L 4 13 C 4 13.552285 3.5522847 14 3 14 C 2.4477153 14 2 13.552285 2 13 L 2 11 z " + transform="translate(0,1036.3622)" + id="path4265" /> + <circle + cy="1048.3622" + cx="3" + id="ellipse4234" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843" + ry="1.0000174" + rx="1" /> + <path + style="fill:#e0e0e0;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" + d="m 13,1049.3622 3,0 0,-2 -3,0 0,-3 -2,0 0,3 -3,0 0,2 3,0 0,3 2,0 z" + id="path8069" + inkscape:connector-curvature="0" /> + </g> +</svg> diff --git a/tools/editor/inspector_dock.cpp b/tools/editor/inspector_dock.cpp index 7b06761e53..253f9bcc01 100644 --- a/tools/editor/inspector_dock.cpp +++ b/tools/editor/inspector_dock.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/inspector_dock.h b/tools/editor/inspector_dock.h index 40c153e2d4..df8d299781 100644 --- a/tools/editor/inspector_dock.h +++ b/tools/editor/inspector_dock.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/SCsub b/tools/editor/io_plugins/SCsub index 6299fd416c..4bf55189cc 100644 --- a/tools/editor/io_plugins/SCsub +++ b/tools/editor/io_plugins/SCsub @@ -2,4 +2,4 @@ Import('env') Export('env') -env.add_source_files(env.tool_sources,"*.cpp") +env.add_source_files(env.tool_sources, "*.cpp") diff --git a/tools/editor/io_plugins/editor_atlas.cpp b/tools/editor/io_plugins/editor_atlas.cpp index f69e383fb0..ac776f4ff5 100644 --- a/tools/editor/io_plugins/editor_atlas.cpp +++ b/tools/editor/io_plugins/editor_atlas.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_atlas.h b/tools/editor/io_plugins/editor_atlas.h index 0135e76622..e0cf76576e 100644 --- a/tools/editor/io_plugins/editor_atlas.h +++ b/tools/editor/io_plugins/editor_atlas.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_export_scene.cpp b/tools/editor/io_plugins/editor_export_scene.cpp index acbbf8c737..a88643d53b 100644 --- a/tools/editor/io_plugins/editor_export_scene.cpp +++ b/tools/editor/io_plugins/editor_export_scene.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_export_scene.h b/tools/editor/io_plugins/editor_export_scene.h index 2c7fe9a1ab..098a5bd5b8 100644 --- a/tools/editor/io_plugins/editor_export_scene.h +++ b/tools/editor/io_plugins/editor_export_scene.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index df3741f0d4..0bf9b32b08 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -1330,7 +1330,7 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe if (err==OK) { for(int i=0;i<height;i++){ - color[i]=img.get_pixel(0,i*img.get_height()/height); + //color[i]=img.get_pixel(0,i*img.get_height()/height); } } else { @@ -1514,7 +1514,7 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe w=DVector<uint8_t>::Write(); - Image img(s.width,s.height,0,Image::FORMAT_RGBA,pixels); + Image img(s.width,s.height,0,Image::FORMAT_RGBA8,pixels); font_data_list[i]->blit=img; font_data_list[i]->blit_ofs=o; @@ -1537,7 +1537,7 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe res_size.y=nearest_power_of_2(res_size.y); print_line("Atlas size: "+res_size); - Image atlas(res_size.x,res_size.y,0,Image::FORMAT_RGBA); + Image atlas(res_size.x,res_size.y,0,Image::FORMAT_RGBA8); for(int i=0;i<font_data_list.size();i++) { @@ -1565,12 +1565,12 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe } } - atlas=Image(res_size.x,res_size.y,0,Image::FORMAT_RGBA,data); + atlas=Image(res_size.x,res_size.y,0,Image::FORMAT_RGBA8,data); } if (from->has_option("color/monochrome") && bool(from->get_option("color/monochrome"))) { - atlas.convert(Image::FORMAT_GRAYSCALE_ALPHA); + atlas.convert(Image::FORMAT_LA8); } diff --git a/tools/editor/io_plugins/editor_font_import_plugin.h b/tools/editor/io_plugins/editor_font_import_plugin.h index 25914e6f83..2af81f66d0 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.h +++ b/tools/editor/io_plugins/editor_font_import_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 1130e2be30..c1830bf118 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -85,11 +85,11 @@ struct ColladaImport { Error _create_scene(Collada::Node *p_node, Spatial *p_parent); Error _create_resources(Collada::Node *p_node); Error _create_material(const String& p_material); - Error _create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data,Vector<Ref<Mesh> > p_morph_meshes=Vector<Ref<Mesh> >()); + Error _create_mesh_surfaces(bool p_optimize, Ref<Mesh>& p_mesh, const Map<String,Collada::NodeGeometry::Material>& p_material_map, const Collada::MeshData &meshdata, const Transform& p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data, Vector<Ref<Mesh> > p_morph_meshes=Vector<Ref<Mesh> >(), bool p_for_morph=false); Error load(const String& p_path, int p_flags, bool p_force_make_tangents=false); void _fix_param_animation_tracks(); - void create_animation(int p_clip,bool p_make_tracks_in_all_bones); - void create_animations(bool p_make_tracks_in_all_bones); + void create_animation(int p_clip,bool p_make_tracks_in_all_bones, bool p_import_value_tracks); + void create_animations(bool p_make_tracks_in_all_bones, bool p_import_value_tracks); Set<String> tracks_in_clips; Vector<String> missing_textures; @@ -237,8 +237,8 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) { //well, it's an ambient light.. Light *l = memnew( DirectionalLight ); // l->set_color(Light::COLOR_AMBIENT,ld.color); - l->set_color(Light::COLOR_DIFFUSE,Color(0,0,0)); - l->set_color(Light::COLOR_SPECULAR,Color(0,0,0)); +// l->set_color(Light::COLOR_DIFFUSE,Color(0,0,0)); +// l->set_color(Light::COLOR_SPECULAR,Color(0,0,0)); node = l; } else if (ld.mode==Collada::LightData::MODE_DIRECTIONAL) { @@ -248,8 +248,8 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) { //if (found_ambient) //use it here // l->set_color(Light::COLOR_AMBIENT,ambient); - l->set_color(Light::COLOR_DIFFUSE,ld.color); - l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); +// l->set_color(Light::COLOR_DIFFUSE,ld.color); +// l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); node = l; } else { @@ -259,14 +259,14 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) { l=memnew( OmniLight ); else { l=memnew( SpotLight ); - l->set_parameter(Light::PARAM_SPOT_ANGLE,ld.spot_angle); - l->set_parameter(Light::PARAM_SPOT_ATTENUATION,ld.spot_exp); +// l->set_parameter(Light::PARAM_SPOT_ANGLE,ld.spot_angle); +// l->set_parameter(Light::PARAM_SPOT_ATTENUATION,ld.spot_exp); } // - l->set_color(Light::COLOR_DIFFUSE,ld.color); - l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); - l->approximate_opengl_attenuation(ld.constant_att,ld.linear_att,ld.quad_att); +// l->set_color(Light::COLOR_DIFFUSE,ld.color); +// l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); +// l->approximate_opengl_attenuation(ld.constant_att,ld.linear_att,ld.quad_att); node=l; } @@ -377,7 +377,7 @@ Error ColladaImport::_create_material(const String& p_target) { ERR_FAIL_COND_V(!collada.state.effect_map.has(src_mat.instance_effect),ERR_INVALID_PARAMETER); Collada::Effect &effect=collada.state.effect_map[src_mat.instance_effect]; - Ref<FixedMaterial> material= memnew( FixedMaterial ); + Ref<FixedSpatialMaterial> material= memnew( FixedSpatialMaterial ); if (src_mat.name!="") material->set_name(src_mat.name); @@ -394,14 +394,15 @@ Error ColladaImport::_create_material(const String& p_target) { Ref<Texture> texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { - material->set_texture(FixedMaterial::PARAM_DIFFUSE,texture); - material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,1)); + material->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,texture); + material->set_albedo(Color(1,1,1,1)); +// material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,1)); } else { missing_textures.push_back(texfile.get_file()); } } } else { - material->set_parameter(FixedMaterial::PARAM_DIFFUSE,effect.diffuse.color); +// material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,effect.diffuse.color); } // SPECULAR @@ -413,16 +414,18 @@ Error ColladaImport::_create_material(const String& p_target) { Ref<Texture> texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { + material->set_texture(FixedSpatialMaterial::TEXTURE_SPECULAR,texture); + material->set_specular(Color(1,1,1,1)); - material->set_texture(FixedMaterial::PARAM_SPECULAR,texture); - material->set_parameter(FixedMaterial::PARAM_SPECULAR,Color(1,1,1,1)); +// material->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,texture); +// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,Color(1,1,1,1)); } else { missing_textures.push_back(texfile.get_file()); } } } else { - material->set_parameter(FixedMaterial::PARAM_SPECULAR,effect.specular.color); +// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,effect.specular.color); } // EMISSION @@ -435,15 +438,17 @@ Error ColladaImport::_create_material(const String& p_target) { Ref<Texture> texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { - material->set_texture(FixedMaterial::PARAM_EMISSION,texture); - material->set_parameter(FixedMaterial::PARAM_EMISSION,Color(1,1,1,1)); + material->set_texture(FixedSpatialMaterial::TEXTURE_EMISSION,texture); + material->set_emission(Color(1,1,1,1)); + +// material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,Color(1,1,1,1)); }else { - missing_textures.push_back(texfile.get_file()); +// missing_textures.push_back(texfile.get_file()); } } } else { - material->set_parameter(FixedMaterial::PARAM_EMISSION,effect.emission.color); +// material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,effect.emission.color); } // NORMAL @@ -455,19 +460,23 @@ Error ColladaImport::_create_material(const String& p_target) { Ref<Texture> texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { + material->set_texture(FixedSpatialMaterial::TEXTURE_NORMAL,texture); +// material->set_emission(Color(1,1,1,1)); - material->set_texture(FixedMaterial::PARAM_NORMAL,texture); + // material->set_texture(FixedSpatialMaterial::PARAM_NORMAL,texture); }else { - missing_textures.push_back(texfile.get_file()); +// missing_textures.push_back(texfile.get_file()); } } } - material->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess); - material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided); - material->set_flag(Material::FLAG_UNSHADED,effect.unshaded); +// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,effect.shininess); + if (effect.double_sided) { + material->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + } + material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,effect.unshaded); @@ -597,7 +606,7 @@ static void _generate_tangents_and_binormals(const DVector<int>& p_indices,const } } -Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data,Vector<Ref<Mesh> > p_morph_meshes) { +Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data,Vector<Ref<Mesh> > p_morph_meshes,bool p_for_morph) { bool local_xform_mirror=p_local_xform.basis.determinant() < 0; @@ -1042,7 +1051,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con { - Ref<FixedMaterial> material; + Ref<FixedSpatialMaterial> material; //find material Mesh::PrimitiveType primitive=Mesh::PRIMITIVE_TRIANGLES; @@ -1072,7 +1081,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con DVector<Color> final_color_array; DVector<Vector3> final_uv_array; DVector<Vector3> final_uv2_array; - DVector<float> final_bone_array; + DVector<int> final_bone_array; DVector<float> final_weight_array; uint32_t final_format=0; @@ -1196,7 +1205,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con tarrayw = DVector<real_t>::Write(); final_tangent_array=tarray; - } else if (final_normal_array.size() && primitive==Mesh::PRIMITIVE_TRIANGLES && final_uv_array.size() && (force_make_tangents || (material.is_valid() && material->get_texture(FixedMaterial::PARAM_NORMAL).is_valid()))){ + } else if (final_normal_array.size() && primitive==Mesh::PRIMITIVE_TRIANGLES && final_uv_array.size() && (force_make_tangents || (material.is_valid()))){ //if this uses triangles, there are uvs and the material is using a normalmap, generate tangents and binormals, because they WILL be needed //generate binormals/tangents _generate_tangents_and_binormals(index_array,final_vertex_array,final_uv_array,final_normal_array,final_tangent_array); @@ -1223,12 +1232,12 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con if (has_weights) { DVector<float> weightarray; - DVector<float> bonearray; + DVector<int> bonearray; weightarray.resize(vertex_array.size()*4); DVector<float>::Write weightarrayw = weightarray.write(); bonearray.resize(vertex_array.size()*4); - DVector<float>::Write bonearrayw = bonearray.write(); + DVector<int>::Write bonearrayw = bonearray.write(); for(int k=0;k<vlen;k++) { float sum=0; @@ -1237,7 +1246,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con if (l<vertex_array[k].weights.size()) { weightarrayw[k*VS::ARRAY_WEIGHTS_SIZE+l]=vertex_array[k].weights[l].weight; sum+=weightarrayw[k*VS::ARRAY_WEIGHTS_SIZE+l]; - bonearrayw[k*VS::ARRAY_WEIGHTS_SIZE+l]=vertex_array[k].weights[l].bone_idx; + bonearrayw[k*VS::ARRAY_WEIGHTS_SIZE+l]=int(vertex_array[k].weights[l].bone_idx); //COLLADA_PRINT(itos(k)+": "+rtos(bonearrayw[k*VS::ARRAY_WEIGHTS_SIZE+l])+":"+rtos(weightarray[k*VS::ARRAY_WEIGHTS_SIZE+l])); } else { @@ -1254,7 +1263,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con } weightarrayw = DVector<float>::Write(); - bonearrayw = DVector<float>::Write(); + bonearrayw = DVector<int>::Write(); final_weight_array = weightarray; final_bone_array = bonearray; @@ -1461,14 +1470,20 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con // print_line("want surface "+itos(mi)+" has "+itos(p_morph_meshes[mi]->get_surface_count())); Array a = p_morph_meshes[mi]->surface_get_arrays(surface); - a[Mesh::ARRAY_BONES]=Variant(); - a[Mesh::ARRAY_WEIGHTS]=Variant(); + //add valid weight and bone arrays if they exist, TODO check if they are unique to shape (generally not) + + if (final_weight_array.size()) + a[Mesh::ARRAY_WEIGHTS]=final_weight_array; + if (final_bone_array.size()) + a[Mesh::ARRAY_BONES]=final_bone_array; + a[Mesh::ARRAY_INDEX]=Variant(); //a.resize(Mesh::ARRAY_MAX); //no need for index mr.push_back(a); } - p_mesh->add_surface(Mesh::PRIMITIVE_TRIANGLES,d,mr); + + p_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,d,mr,p_for_morph?0:Mesh::ARRAY_COMPRESS_DEFAULT); if (material.is_valid()) { p_mesh->surface_set_material(surface, material); @@ -1692,7 +1707,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) { if (collada.state.mesh_data_map.has(meshid)) { Ref<Mesh> mesh=Ref<Mesh>(memnew( Mesh )); const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid]; - Error err = _create_mesh_surfaces(false,mesh,ng->material_map,meshdata,apply_xform,bone_remap,skin,NULL); + Error err = _create_mesh_surfaces(false,mesh,ng->material_map,meshdata,apply_xform,bone_remap,skin,NULL,Vector<Ref<Mesh> >(),true); ERR_FAIL_COND_V(err,err); morphs.push_back(mesh); @@ -1898,7 +1913,7 @@ void ColladaImport::_fix_param_animation_tracks() { } -void ColladaImport::create_animations(bool p_make_tracks_in_all_bones) { +void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_import_value_tracks) { _fix_param_animation_tracks(); @@ -1943,14 +1958,14 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones) { } - create_animation(-1,p_make_tracks_in_all_bones); + create_animation(-1,p_make_tracks_in_all_bones, p_import_value_tracks); //print_line("clipcount: "+itos(collada.state.animation_clips.size())); for(int i=0;i<collada.state.animation_clips.size();i++) - create_animation(i,p_make_tracks_in_all_bones); + create_animation(i, p_make_tracks_in_all_bones, p_import_value_tracks); } -void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones) { +void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones, bool p_import_value_tracks) { Ref<Animation> animation = Ref<Animation>( memnew( Animation )); @@ -2251,64 +2266,68 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones + if (p_import_value_tracks) { + for (int i = 0; i < valid_animated_properties.size(); i++) { - for(int i=0;i<valid_animated_properties.size();i++) { + int ti = valid_animated_properties[i]; - int ti = valid_animated_properties[i]; + if (p_clip == -1) { - if (p_clip==-1) { + if (track_filter.has(ti)) + continue; + } + else { - if (track_filter.has(ti)) - continue; - } else { + if (!track_filter.has(ti)) + continue; - if (!track_filter.has(ti)) - continue; + } - } + Collada::AnimationTrack &at = collada.state.animation_tracks[ti]; - Collada::AnimationTrack &at = collada.state.animation_tracks[ ti ]; + // take snapshots + if (!collada.state.scene_map.has(at.target)) + continue; - // take snapshots - if (!collada.state.scene_map.has(at.target)) - continue; + NodeMap &nm = node_map[at.target]; + String path = scene->get_path_to(nm.node); - NodeMap &nm = node_map[at.target]; - String path = scene->get_path_to(nm.node); + animation->add_track(Animation::TYPE_VALUE); + int track = animation->get_track_count() - 1; - animation->add_track(Animation::TYPE_VALUE); - int track = animation->get_track_count() -1; + path = path + ":" + at.param; + animation->track_set_path(track, path); + animation->track_set_imported(track, true); //helps merging later - path = path +":"+at.param; - animation->track_set_path( track , path ); - animation->track_set_imported( track , true ); //helps merging later + for (int i = 0; i < at.keys.size(); i++) { - for(int i=0;i<at.keys.size();i++) { + float time = at.keys[i].time; + Variant value; + Vector<float> data = at.keys[i].data; + if (data.size() == 1) { + //push a float + value = data[0]; - float time = at.keys[i].time; - Variant value; - Vector<float> data = at.keys[i].data; - if (data.size()==1) { - //push a float - value=data[0]; + } + else if (data.size() == 16) { + //matrix + print_line("value keys for matrices not supported"); + } + else { - } else if (data.size()==16) { - //matrix - print_line("value keys for matrices not supported"); - } else { + print_line("don't know what to do with this amount of value keys: " + itos(data.size())); + } - print_line("don't know what to do with this amount of value keys: "+itos(data.size())); + animation->track_insert_key(track, time, value); } - animation->track_insert_key(track,time,value); - } - - tracks_found=true; + tracks_found = true; + } } @@ -2373,7 +2392,7 @@ Node* EditorSceneImporterCollada::import_scene(const String& p_path, uint32_t p_ if (p_flags&IMPORT_ANIMATION) { - state.create_animations(p_flags&IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS); + state.create_animations(p_flags&IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS,p_flags&EditorSceneImporter::IMPORT_ANIMATION_KEEP_VALUE_TRACKS); AnimationPlayer *ap = memnew( AnimationPlayer ); for(int i=0;i<state.animations.size();i++) { String name; @@ -2410,7 +2429,7 @@ Ref<Animation> EditorSceneImporterCollada::import_animation(const String& p_path ERR_FAIL_COND_V(err!=OK,RES()); - state.create_animations(p_flags&EditorSceneImporter::IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS); + state.create_animations(p_flags&EditorSceneImporter::IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS,p_flags&EditorSceneImporter::IMPORT_ANIMATION_KEEP_VALUE_TRACKS); if (state.scene) memdelete(state.scene); diff --git a/tools/editor/io_plugins/editor_import_collada.h b/tools/editor/io_plugins/editor_import_collada.h index de45dc38f4..b98bf18976 100644 --- a/tools/editor/io_plugins/editor_import_collada.h +++ b/tools/editor/io_plugins/editor_import_collada.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp index da608292c1..f74b1b3c7f 100644 --- a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.h b/tools/editor/io_plugins/editor_mesh_import_plugin.h index d200603e6a..3769dd8b0f 100644 --- a/tools/editor/io_plugins/editor_mesh_import_plugin.h +++ b/tools/editor/io_plugins/editor_mesh_import_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index 7dc74e58dd..662f4ffee9 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.h b/tools/editor/io_plugins/editor_sample_import_plugin.h index a2686ebe4f..8c17a8cb6b 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.h +++ b/tools/editor/io_plugins/editor_sample_import_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 56af35c6db..de75bd41a2 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -894,9 +894,9 @@ void EditorSceneImportDialog::_browse() { void EditorSceneImportDialog::_browse_target() { + save_select->popup_centered_ratio(); if (save_path->get_text()!="") save_select->set_current_path(save_path->get_text()); - save_select->popup_centered_ratio(); } @@ -1407,7 +1407,7 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map<Ref<Imag for(List<PropertyInfo>::Element *E=pl.front();E;E=E->next()) { if (E->get().type==Variant::OBJECT || E->get().type==Variant::ARRAY || E->get().type==Variant::DICTIONARY) { - if (E->get().type==Variant::OBJECT && res->cast_to<FixedMaterial>() && (E->get().name=="textures/diffuse" || E->get().name=="textures/detail" || E->get().name=="textures/emission")) { + if (E->get().type==Variant::OBJECT && res->cast_to<FixedSpatialMaterial>() && (E->get().name=="textures/diffuse" || E->get().name=="textures/detail" || E->get().name=="textures/emission")) { Ref<ImageTexture> tex =res->get(E->get().name); if (tex.is_valid()) { @@ -1415,15 +1415,15 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map<Ref<Imag image_map.insert(tex,TEXTURE_ROLE_DIFFUSE); } - } else if (E->get().type==Variant::OBJECT && res->cast_to<FixedMaterial>() && (E->get().name=="textures/normal")) { + } else if (E->get().type==Variant::OBJECT && res->cast_to<FixedSpatialMaterial>() && (E->get().name=="textures/normal")) { Ref<ImageTexture> tex =res->get(E->get().name); if (tex.is_valid()) { image_map.insert(tex,TEXTURE_ROLE_NORMALMAP); - if (p_flags&SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY) - res->cast_to<FixedMaterial>()->set_fixed_flag(FixedMaterial::FLAG_USE_XY_NORMALMAP,true); - } + //if (p_flags&SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY) + // res->cast_to<FixedSpatialMaterial>()->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_XY_NORMALMAP,true); + }// } else { @@ -1529,12 +1529,12 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> Ref<Mesh> m = mi->get_mesh(); for(int i=0;i<m->get_surface_count();i++) { - Ref<FixedMaterial> fm = m->surface_get_material(i); + Ref<FixedSpatialMaterial> fm = m->surface_get_material(i); if (fm.is_valid()) { - fm->set_flag(Material::FLAG_UNSHADED,true); - fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); - fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + // fm->set_flag(Material::FLAG_UNSHADED,true); + // fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); + // fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); + // fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); } } } @@ -1552,23 +1552,23 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> for(int i=0;i<m->get_surface_count();i++) { - Ref<FixedMaterial> mat = m->surface_get_material(i); + Ref<FixedSpatialMaterial> mat = m->surface_get_material(i); if (!mat.is_valid()) continue; if (p_flags&SCENE_FLAG_DETECT_ALPHA && _teststr(mat->get_name(),"alpha")) { - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); - mat->set_name(_fixstr(mat->get_name(),"alpha")); + // mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + // mat->set_name(_fixstr(mat->get_name(),"alpha")); } if (p_flags&SCENE_FLAG_DETECT_VCOLOR && _teststr(mat->get_name(),"vcol")) { - mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); - mat->set_name(_fixstr(mat->get_name(),"vcol")); + //mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true); + //mat->set_name(_fixstr(mat->get_name(),"vcol")); } if (p_flags&SCENE_FLAG_SET_LIGHTMAP_TO_UV2_IF_EXISTS && m->surface_get_format(i)&Mesh::ARRAY_FORMAT_TEX_UV2) { - mat->set_flag(Material::FLAG_LIGHTMAP_ON_UV2,true); + //mat->set_flag(Material::FLAG_LIGHTMAP_ON_UV2,true); } } @@ -1627,23 +1627,23 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> float dist = d.to_double(); mi->set_flag(GeometryInstance::FLAG_BILLBOARD,true); mi->set_flag(GeometryInstance::FLAG_BILLBOARD_FIX_Y,true); - mi->set_draw_range_begin(dist); - mi->set_draw_range_end(100000); + //mi->set_draw_range_begin(dist); + //mi->set_draw_range_end(100000); - mip->set_draw_range_begin(0); - mip->set_draw_range_end(dist); + //mip->set_draw_range_begin(0); + //mip->set_draw_range_end(dist); if (mi->get_mesh().is_valid()) { Ref<Mesh> m = mi->get_mesh(); for(int i=0;i<m->get_surface_count();i++) { - Ref<FixedMaterial> fm = m->surface_get_material(i); + Ref<FixedSpatialMaterial> fm = m->surface_get_material(i); if (fm.is_valid()) { - fm->set_flag(Material::FLAG_UNSHADED,true); - fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); - fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + // fm->set_flag(Material::FLAG_UNSHADED,true); + // fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); + // fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); + // fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); } } } @@ -1675,23 +1675,23 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> d=d.substr(1,d.length()); if (d.length() && d[0]>='0' && d[0]<='9') { float dist = d.to_double(); - mi->set_draw_range_begin(dist); - mi->set_draw_range_end(100000); + /// mi->set_draw_range_begin(dist); + // mi->set_draw_range_end(100000); - mip->set_draw_range_begin(0); - mip->set_draw_range_end(dist); + // mip->set_draw_range_begin(0); + // mip->set_draw_range_end(dist); /*if (mi->get_mesh().is_valid()) { Ref<Mesh> m = mi->get_mesh(); for(int i=0;i<m->get_surface_count();i++) { - Ref<FixedMaterial> fm = m->surface_get_material(i); + Ref<FixedSpatialMaterial> fm = m->surface_get_material(i); if (fm.is_valid()) { fm->set_flag(Material::FLAG_UNSHADED,true); fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); fm->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); } } }*/ @@ -1707,7 +1707,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> String str=name; int layer = str.substr(str.find("lm")+3,str.length()).to_int(); - mi->set_baked_light_texture_id(layer); + //mi->set_baked_light_texture_id(layer); } if (p_flags&SCENE_FLAG_CREATE_COLLISIONS && _teststr(name,"colonly")) { @@ -1903,8 +1903,8 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> BSP_Tree bsptree(faces); Ref<RoomBounds> area = memnew( RoomBounds ); - area->set_bounds(faces); - area->set_geometry_hint(faces); + //area->set_bounds(faces); + //area->set_geometry_hint(faces); Room * room = memnew( Room ); @@ -1932,7 +1932,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> memdelete(p_node); p_node=room; - room->compute_room_from_subtree(); + //room->compute_room_from_subtree(); } else if (p_flags&SCENE_FLAG_CREATE_PORTALS &&_teststr(name,"portal") && p_node->cast_to<MeshInstance>()) { @@ -2059,18 +2059,18 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> for(int i=0;i<mesh->get_surface_count();i++) { - Ref<FixedMaterial> fm = mesh->surface_get_material(i); + Ref<FixedSpatialMaterial> fm = mesh->surface_get_material(i); if (fm.is_valid()) { String name = fm->get_name(); - if (_teststr(name,"alpha")) { - fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + /* if (_teststr(name,"alpha")) { + fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); name=_fixstr(name,"alpha"); } if (_teststr(name,"vcol")) { - fm->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); + fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true); name=_fixstr(name,"vcol"); - } + }*/ fm->set_name(name); } } @@ -2164,6 +2164,8 @@ Error EditorSceneImportPlugin::import1(const Ref<ResourceImportMetadata>& p_from uint32_t import_flags=0; if (animation_flags&EditorSceneAnimationImportPlugin::ANIMATION_DETECT_LOOP) import_flags|=EditorSceneImporter::IMPORT_ANIMATION_DETECT_LOOP; + if (animation_flags&EditorSceneAnimationImportPlugin::ANIMATION_KEEP_VALUE_TRACKS) + import_flags |= EditorSceneImporter::IMPORT_ANIMATION_KEEP_VALUE_TRACKS; if (animation_flags&EditorSceneAnimationImportPlugin::ANIMATION_OPTIMIZE) import_flags|=EditorSceneImporter::IMPORT_ANIMATION_OPTIMIZE; if (animation_flags&EditorSceneAnimationImportPlugin::ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS) diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.h b/tools/editor/io_plugins/editor_scene_import_plugin.h index c31d3a33d3..820e9ce6dd 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.h +++ b/tools/editor/io_plugins/editor_scene_import_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -60,6 +60,7 @@ public: IMPORT_ANIMATION_DETECT_LOOP=4, IMPORT_ANIMATION_OPTIMIZE=8, IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS=16, + IMPORT_ANIMATION_KEEP_VALUE_TRACKS=32, IMPORT_GENERATE_TANGENT_ARRAYS=256, IMPORT_FAIL_ON_MISSING_DEPENDENCIES=512 diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp index ac3c4637c2..1cb16843c5 100644 --- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp +++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -33,7 +33,7 @@ #include "scene/3d/mesh_instance.h" #include "scene/animation/animation_player.h" - +#if 0 String EditorSceneImporterFBXConv::_id(const String& p_id) const { return p_id.replace(":","_").replace("/","_"); @@ -482,29 +482,29 @@ void EditorSceneImporterFBXConv::_parse_materials(State& state) { ERR_CONTINUE(!material.has("id")); String id = _id(material["id"]); - Ref<FixedMaterial> mat = memnew( FixedMaterial ); + Ref<FixedSpatialMaterial> mat = memnew( FixedSpatialMaterial ); if (material.has("diffuse")) { - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,_get_color(material["diffuse"])); + mat->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,_get_color(material["diffuse"])); } if (material.has("specular")) { - mat->set_parameter(FixedMaterial::PARAM_SPECULAR,_get_color(material["specular"])); + mat->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,_get_color(material["specular"])); } if (material.has("emissive")) { - mat->set_parameter(FixedMaterial::PARAM_EMISSION,_get_color(material["emissive"])); + mat->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,_get_color(material["emissive"])); } if (material.has("shininess")) { float exp = material["shininess"]; - mat->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,exp); + mat->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,exp); } if (material.has("opacity")) { - Color c = mat->get_parameter(FixedMaterial::PARAM_DIFFUSE); + Color c = mat->get_parameter(FixedSpatialMaterial::PARAM_DIFFUSE); c.a=material["opacity"]; - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,c); + mat->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,c); } @@ -536,15 +536,15 @@ void EditorSceneImporterFBXConv::_parse_materials(State& state) { String type=texture["type"]; if (type=="DIFFUSE") - mat->set_texture(FixedMaterial::PARAM_DIFFUSE,tex); + mat->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,tex); else if (type=="SPECULAR") - mat->set_texture(FixedMaterial::PARAM_SPECULAR,tex); + mat->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,tex); else if (type=="SHININESS") - mat->set_texture(FixedMaterial::PARAM_SPECULAR_EXP,tex); + mat->set_texture(FixedSpatialMaterial::PARAM_SPECULAR_EXP,tex); else if (type=="NORMAL") - mat->set_texture(FixedMaterial::PARAM_NORMAL,tex); + mat->set_texture(FixedSpatialMaterial::PARAM_NORMAL,tex); else if (type=="EMISSIVE") - mat->set_texture(FixedMaterial::PARAM_EMISSION,tex); + mat->set_texture(FixedSpatialMaterial::PARAM_EMISSION,tex); } } @@ -1132,3 +1132,4 @@ EditorSceneImporterFBXConv::EditorSceneImporterFBXConv() { #endif } +#endif diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.h b/tools/editor/io_plugins/editor_scene_importer_fbxconv.h index b0cbc07ba3..e3ed1dcafe 100644 --- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.h +++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -32,6 +32,7 @@ #include "tools/editor/io_plugins/editor_scene_import_plugin.h" #include "scene/3d/skeleton.h" +#if 0 class EditorSceneImporterFBXConv : public EditorSceneImporter { @@ -107,3 +108,4 @@ public: }; #endif // EDITOR_SCENE_IMPORTER_FBXCONV_H +#endif diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 2935ea8fe2..39ac5ecb16 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -843,33 +843,27 @@ void EditorTextureImportPlugin::compress_image(EditorExportPlatform::ImageCompre //do absolutely nothing - } break; - case EditorExportPlatform::IMAGE_COMPRESSION_INDEXED: { - - //quantize - image.quantize(); - - } break; + } break; case EditorExportPlatform::IMAGE_COMPRESSION_BC: { // for maximum compatibility, BC shall always use mipmaps and be PO2 image.resize_to_po2(); - if (image.get_mipmaps()==0) + if (!image.has_mipmaps()) image.generate_mipmaps(); - image.compress(Image::COMPRESS_BC); + image.compress(Image::COMPRESS_S3TC); /* if (has_alpha) { if (flags&IMAGE_FLAG_ALPHA_BIT) { - image.convert(Image::FORMAT_BC3); + image.convert(Image::FORMAT_DXT5); } else { - image.convert(Image::FORMAT_BC2); + image.convert(Image::FORMAT_DXT3); } } else { - image.convert(Image::FORMAT_BC1); + image.convert(Image::FORMAT_DXT1); }*/ @@ -880,24 +874,24 @@ void EditorTextureImportPlugin::compress_image(EditorExportPlatform::ImageCompre // for maximum compatibility (hi apple!), PVRT shall always // use mipmaps, be PO2 and square - if (image.get_mipmaps()==0) + if (!image.has_mipmaps()) image.generate_mipmaps(); image.resize_to_po2(true); if (p_smaller) { image.compress(Image::COMPRESS_PVRTC2); - //image.convert(has_alpha ? Image::FORMAT_PVRTC2_ALPHA : Image::FORMAT_PVRTC2); + //image.convert(has_alpha ? Image::FORMAT_PVRTC2A : Image::FORMAT_PVRTC2); } else { image.compress(Image::COMPRESS_PVRTC4); - //image.convert(has_alpha ? Image::FORMAT_PVRTC4_ALPHA : Image::FORMAT_PVRTC4); + //image.convert(has_alpha ? Image::FORMAT_PVRTC4A : Image::FORMAT_PVRTC4); } } break; case EditorExportPlatform::IMAGE_COMPRESSION_ETC1: { image.resize_to_po2(); //square or not? - if (image.get_mipmaps()==0) + if (!image.has_mipmaps()) image.generate_mipmaps(); if (!image.detect_alpha()) { //ETC1 is only opaque @@ -930,18 +924,18 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref<ImageTexture> &textur ERR_FAIL_COND_V(image.empty(),ERR_INVALID_DATA); bool has_alpha=image.detect_alpha(); - if (!has_alpha && image.get_format()==Image::FORMAT_RGBA) { + if (!has_alpha && image.get_format()==Image::FORMAT_RGBA8) { - image.convert(Image::FORMAT_RGB); + image.convert(Image::FORMAT_RGB8); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { image.fix_alpha_edges(); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_PREMULT_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_PREMULT_ALPHA) { image.premultiply_alpha(); } @@ -950,7 +944,7 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref<ImageTexture> &textur image.normalmap_to_xy(); } - //if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { + //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { // image.srgb_to_linear(); //} @@ -989,18 +983,18 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref<ImageTexture> &textur bool has_alpha=image.detect_alpha(); - if (!has_alpha && image.get_format()==Image::FORMAT_RGBA) { + if (!has_alpha && image.get_format()==Image::FORMAT_RGBA8) { - image.convert(Image::FORMAT_RGB); + image.convert(Image::FORMAT_RGB8); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { image.fix_alpha_edges(); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_PREMULT_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_PREMULT_ALPHA) { image.premultiply_alpha(); } @@ -1009,7 +1003,7 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref<ImageTexture> &textur image.normalmap_to_xy(); } - //if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { + //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { // // print_line("CONVERT BECAUSE: "+itos(flags)); // image.srgb_to_linear(); @@ -1200,9 +1194,9 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc Image src = tsources[i]; if (alpha) { - src.convert(Image::FORMAT_RGBA); + src.convert(Image::FORMAT_RGBA8); } else { - src.convert(Image::FORMAT_RGB); + src.convert(Image::FORMAT_RGB8); } DVector<uint8_t> data = src.get_data(); @@ -1280,7 +1274,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc atlas_h=nearest_power_of_2(dst_size.height); } Image atlas; - atlas.create(atlas_w,atlas_h,0,alpha?Image::FORMAT_RGBA:Image::FORMAT_RGB); + atlas.create(atlas_w,atlas_h,0,alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8); atlases.resize(from->get_source_count()); @@ -1411,18 +1405,18 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc ERR_FAIL_COND_V(image.empty(),ERR_INVALID_DATA); bool has_alpha=image.detect_alpha(); - if (!has_alpha && image.get_format()==Image::FORMAT_RGBA) { + if (!has_alpha && image.get_format()==Image::FORMAT_RGBA8) { - image.convert(Image::FORMAT_RGB); + image.convert(Image::FORMAT_RGB8); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { image.fix_alpha_edges(); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_PREMULT_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_PREMULT_ALPHA) { image.premultiply_alpha(); } @@ -1431,7 +1425,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc image.normalmap_to_xy(); } - //if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { + //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { // image.srgb_to_linear(); //} @@ -1470,18 +1464,18 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc bool has_alpha=image.detect_alpha(); - if (!has_alpha && image.get_format()==Image::FORMAT_RGBA) { + if (!has_alpha && image.get_format()==Image::FORMAT_RGBA8) { - image.convert(Image::FORMAT_RGB); + image.convert(Image::FORMAT_RGB8); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { image.fix_alpha_edges(); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_PREMULT_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_PREMULT_ALPHA) { image.premultiply_alpha(); } @@ -1490,7 +1484,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc image.normalmap_to_xy(); } - //if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { + //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { // // print_line("CONVERT BECAUSE: "+itos(flags)); // image.srgb_to_linear(); diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.h b/tools/editor/io_plugins/editor_texture_import_plugin.h index 22c10a1a3a..3e20efde34 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.h +++ b/tools/editor/io_plugins/editor_texture_import_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.cpp b/tools/editor/io_plugins/editor_translation_import_plugin.cpp index 9ee3e98486..47670e239f 100644 --- a/tools/editor/io_plugins/editor_translation_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.h b/tools/editor/io_plugins/editor_translation_import_plugin.h index 532f2cedcc..16ad4d6c08 100644 --- a/tools/editor/io_plugins/editor_translation_import_plugin.h +++ b/tools/editor/io_plugins/editor_translation_import_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/multi_node_edit.cpp b/tools/editor/multi_node_edit.cpp index e4ceaf4a8b..47b776ed06 100644 --- a/tools/editor/multi_node_edit.cpp +++ b/tools/editor/multi_node_edit.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/multi_node_edit.h b/tools/editor/multi_node_edit.h index fd50dc5bf4..170a11221a 100644 --- a/tools/editor/multi_node_edit.h +++ b/tools/editor/multi_node_edit.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/output_strings.cpp b/tools/editor/output_strings.cpp index a6126466c4..9e3455afd0 100644 --- a/tools/editor/output_strings.cpp +++ b/tools/editor/output_strings.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/output_strings.h b/tools/editor/output_strings.h index 29c6ea799f..c1e234eb76 100644 --- a/tools/editor/output_strings.h +++ b/tools/editor/output_strings.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/pane_drag.cpp b/tools/editor/pane_drag.cpp index 8e8c2941ec..95806ebe8b 100644 --- a/tools/editor/pane_drag.cpp +++ b/tools/editor/pane_drag.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/pane_drag.h b/tools/editor/pane_drag.h index 24f2ef7ed8..3e8988836f 100644 --- a/tools/editor/pane_drag.h +++ b/tools/editor/pane_drag.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/SCsub b/tools/editor/plugins/SCsub index 6299fd416c..4bf55189cc 100644 --- a/tools/editor/plugins/SCsub +++ b/tools/editor/plugins/SCsub @@ -2,4 +2,4 @@ Import('env') Export('env') -env.add_source_files(env.tool_sources,"*.cpp") +env.add_source_files(env.tool_sources, "*.cpp") diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index d6d452dd72..18a3e98b2f 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/animation_player_editor_plugin.h b/tools/editor/plugins/animation_player_editor_plugin.h index b0c930b66e..ecd0c65cb7 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.h +++ b/tools/editor/plugins/animation_player_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp index 24914e4bc5..3c25bf4596 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.cpp +++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/animation_tree_editor_plugin.h b/tools/editor/plugins/animation_tree_editor_plugin.h index 4884a22d90..90cac65504 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.h +++ b/tools/editor/plugins/animation_tree_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp index f43bec1cd3..2b660c4f94 100644 --- a/tools/editor/plugins/baked_light_baker.cpp +++ b/tools/editor/plugins/baked_light_baker.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -33,7 +33,7 @@ #include "tools/editor/editor_node.h" #include "tools/editor/editor_settings.h" - +#if 0 void baked_light_baker_add_64f(double *dst,double value); void baked_light_baker_add_64i(int64_t *dst,int64_t value); @@ -91,15 +91,15 @@ BakedLightBaker::MeshTexture* BakedLightBaker::_get_mat_tex(const Ref<Texture>& if (image.empty()) return NULL; - if (image.get_format()!=Image::FORMAT_RGBA) { + if (image.get_format()!=Image::FORMAT_RGBA8) { if (image.get_format()>Image::FORMAT_INDEXED_ALPHA) { Error err = image.decompress(); if (err) return NULL; } - if (image.get_format()!=Image::FORMAT_RGBA) - image.convert(Image::FORMAT_RGBA); + if (image.get_format()!=Image::FORMAT_RGBA8) + image.convert(Image::FORMAT_RGBA8); } if (imgtex->get_flags()&Texture::FLAG_CONVERT_TO_LINEAR) { @@ -143,18 +143,18 @@ void BakedLightBaker::_add_mesh(const Ref<Mesh>& p_mesh,const Ref<Material>& p_m MeshMaterial mm; - Ref<FixedMaterial> fm = mat; + Ref<FixedSpatialMaterial> fm = mat; if (fm.is_valid()) { //fixed route - mm.diffuse.color=fm->get_parameter(FixedMaterial::PARAM_DIFFUSE); + mm.diffuse.color=fm->get_parameter(FixedSpatialMaterial::PARAM_DIFFUSE); if (linear_color) mm.diffuse.color=mm.diffuse.color.to_linear(); - mm.diffuse.tex=_get_mat_tex(fm->get_texture(FixedMaterial::PARAM_DIFFUSE)); - mm.specular.color=fm->get_parameter(FixedMaterial::PARAM_SPECULAR); + mm.diffuse.tex=_get_mat_tex(fm->get_texture(FixedSpatialMaterial::PARAM_DIFFUSE)); + mm.specular.color=fm->get_parameter(FixedSpatialMaterial::PARAM_SPECULAR); if (linear_color) mm.specular.color=mm.specular.color.to_linear(); - mm.specular.tex=_get_mat_tex(fm->get_texture(FixedMaterial::PARAM_SPECULAR)); + mm.specular.tex=_get_mat_tex(fm->get_texture(FixedSpatialMaterial::PARAM_SPECULAR)); } else { mm.diffuse.color=Color(1,1,1,1); @@ -2619,7 +2619,7 @@ Error BakedLightBaker::transfer_to_lightmaps() { copymem(w.ptr(),baked_textures[i].data.ptr(),baked_textures[i].data.size()); } - Image img(baked_textures[i].width,baked_textures[i].height,0,Image::FORMAT_RGBA,dv); + Image img(baked_textures[i].width,baked_textures[i].height,0,Image::FORMAT_RGBA8,dv); Ref<ImageTexture> tex = memnew( ImageTexture ); tex->create_from_image(img); baked_light->set_lightmap_texture(i,tex); @@ -2720,3 +2720,4 @@ BakedLightBaker::~BakedLightBaker() { clear(); } +#endif diff --git a/tools/editor/plugins/baked_light_baker.h b/tools/editor/plugins/baked_light_baker.h index d0fddf5563..5616183cb1 100644 --- a/tools/editor/plugins/baked_light_baker.h +++ b/tools/editor/plugins/baked_light_baker.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -34,6 +34,8 @@ #include "scene/3d/mesh_instance.h" #include "os/thread.h" +#if 0 + class BakedLightBaker { public: @@ -375,3 +377,4 @@ public: }; #endif // BAKED_LIGHT_BAKER_H +#endif diff --git a/tools/editor/plugins/baked_light_baker_cmpxchg.cpp b/tools/editor/plugins/baked_light_baker_cmpxchg.cpp index c581995916..5e9228b7de 100644 --- a/tools/editor/plugins/baked_light_baker_cmpxchg.cpp +++ b/tools/editor/plugins/baked_light_baker_cmpxchg.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/baked_light_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp index a58a0c25e2..0b576a2d2c 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.cpp +++ b/tools/editor/plugins/baked_light_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -33,7 +33,7 @@ #include "io/resource_saver.h" - +#if 0 void BakedLightEditor::_end_baking() { @@ -145,7 +145,7 @@ void BakedLightEditor::_notification(int p_option) { #if 1 //debug - Image img(baker->baked_octree_texture_w,baker->baked_octree_texture_h,0,Image::FORMAT_RGBA,octree_texture); + Image img(baker->baked_octree_texture_w,baker->baked_octree_texture_h,0,Image::FORMAT_RGBA8,octree_texture); Ref<ImageTexture> it = memnew( ImageTexture ); it->create_from_image(img); ResourceSaver::save("baked_octree.png",it); @@ -373,3 +373,4 @@ BakedLightEditorPlugin::~BakedLightEditorPlugin() } +#endif diff --git a/tools/editor/plugins/baked_light_editor_plugin.h b/tools/editor/plugins/baked_light_editor_plugin.h index 4985d7513e..64f3295b48 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.h +++ b/tools/editor/plugins/baked_light_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -40,7 +40,7 @@ @author Juan Linietsky <reduzio@gmail.com> */ - +#if 0 class MeshInstance; @@ -116,5 +116,5 @@ public: }; #endif // MULTIMESH_EDITOR_PLUGIN_H - +#endif diff --git a/tools/editor/plugins/camera_editor_plugin.cpp b/tools/editor/plugins/camera_editor_plugin.cpp index 9c25de695c..0881bfd912 100644 --- a/tools/editor/plugins/camera_editor_plugin.cpp +++ b/tools/editor/plugins/camera_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/camera_editor_plugin.h b/tools/editor/plugins/camera_editor_plugin.h index ea016ecb4d..e968028a34 100644 --- a/tools/editor/plugins/camera_editor_plugin.h +++ b/tools/editor/plugins/camera_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index ac39e0687c..a5e388ea90 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -529,17 +529,24 @@ void CanvasItemEditor::_find_canvas_items_at_rect(const Rect2& p_rect,Node* p_no CanvasItem *c=p_node->cast_to<CanvasItem>(); - for (int i=p_node->get_child_count()-1;i>=0;i--) { + bool inherited=p_node!=get_tree()->get_edited_scene_root() && p_node->get_filename()!=""; + bool editable=false; + if (inherited){ + editable=EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(p_node); + } + bool lock_children=p_node->has_meta("_edit_group_") && p_node->get_meta("_edit_group_"); + if (!lock_children && (!inherited || editable)) { + for (int i=p_node->get_child_count()-1;i>=0;i--) { - if (c && !c->is_set_as_toplevel()) - _find_canvas_items_at_rect(p_rect,p_node->get_child(i),p_parent_xform * c->get_transform(),p_canvas_xform,r_items); - else { - CanvasLayer *cl = p_node->cast_to<CanvasLayer>(); - _find_canvas_items_at_rect(p_rect,p_node->get_child(i),transform,cl?cl->get_transform():p_canvas_xform,r_items); + if (c && !c->is_set_as_toplevel()) + _find_canvas_items_at_rect(p_rect,p_node->get_child(i),p_parent_xform * c->get_transform(),p_canvas_xform,r_items); + else { + CanvasLayer *cl = p_node->cast_to<CanvasLayer>(); + _find_canvas_items_at_rect(p_rect,p_node->get_child(i),transform,cl?cl->get_transform():p_canvas_xform,r_items); + } } } - if (c && c->is_visible() && !c->has_meta("_edit_lock_") && !c->cast_to<CanvasLayer>()) { Rect2 rect = c->get_item_rect(); @@ -3327,7 +3334,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { vp_base->set_v_size_flags(SIZE_EXPAND_FILL); palette_split->add_child(vp_base); - Control *vp = memnew (Control); + ViewportContainer *vp = memnew (ViewportContainer); + vp->set_stretch(true); vp_base->add_child(vp); vp->set_area_as_parent_rect(); vp->add_child(p_editor->get_scene_root()); @@ -3681,7 +3689,7 @@ void CanvasItemEditorViewport::_create_preview(const Vector<String>& files) cons Ref<ImageTexture> texture=Ref<ImageTexture> ( ResourceCache::get(path)->cast_to<ImageTexture>() ); Sprite* sprite=memnew(Sprite); sprite->set_texture(texture); - sprite->set_opacity(0.7f); + sprite->set_modulate(Color(1,1,1,0.7f)); preview->add_child(sprite); label->show(); label_desc->show(); @@ -3797,6 +3805,7 @@ bool CanvasItemEditorViewport::_create_instance(Node* parent, String& path, cons if (editor->get_edited_scene()->get_filename()!="") { // cyclical instancing if (_cyclical_dependency_exists(editor->get_edited_scene()->get_filename(), instanced_scene)) { + memdelete(instanced_scene); return false; } } diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h index bbec078e02..00eba68b7e 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.h +++ b/tools/editor/plugins/canvas_item_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 95364e8921..9c3f27162b 100644 --- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h index 431d3651c1..65d3ef4605 100644 --- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h +++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index 0b06b3ba21..bdd1e325b5 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -33,6 +33,8 @@ #include "scene/3d/camera.h" #include "canvas_item_editor_plugin.h" +#if 0 + void CollisionPolygonEditor::_notification(int p_what) { switch(p_what) { @@ -568,25 +570,25 @@ CollisionPolygonEditor::CollisionPolygonEditor(EditorNode *p_editor) { imgeom->set_transform(Transform(Matrix3(),Vector3(0,0,0.00001))); - line_material = Ref<FixedMaterial>( memnew( FixedMaterial )); + line_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1)); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1)); - handle_material = Ref<FixedMaterial>( memnew( FixedMaterial )); + handle_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); handle_material->set_flag(Material::FLAG_UNSHADED, true); - handle_material->set_fixed_flag(FixedMaterial::FLAG_USE_POINT_SIZE, true); - handle_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1)); - handle_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - handle_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, false); + handle_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_POINT_SIZE, true); + handle_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1)); + handle_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + handle_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, false); Ref<Texture> handle=editor->get_gui_base()->get_icon("Editor3DHandle","EditorIcons"); handle_material->set_point_size(handle->get_width()); - handle_material->set_texture(FixedMaterial::PARAM_DIFFUSE,handle); + handle_material->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,handle); pointsm = memnew( MeshInstance ); imgeom->add_child(pointsm); @@ -642,3 +644,4 @@ CollisionPolygonEditorPlugin::~CollisionPolygonEditorPlugin() { } +#endif diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.h b/tools/editor/plugins/collision_polygon_editor_plugin.h index 45e287ef00..43a9f0b5fc 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.h +++ b/tools/editor/plugins/collision_polygon_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -40,6 +40,8 @@ /** @author Juan Linietsky <reduzio@gmail.com> */ + +#if 0 class CanvasItemEditor; class CollisionPolygonEditor : public HBoxContainer { @@ -60,8 +62,8 @@ class CollisionPolygonEditor : public HBoxContainer { ToolButton *button_edit; - Ref<FixedMaterial> line_material; - Ref<FixedMaterial> handle_material; + Ref<FixedSpatialMaterial> line_material; + Ref<FixedSpatialMaterial> handle_material; EditorNode *editor; Panel *panel; @@ -117,5 +119,5 @@ public: ~CollisionPolygonEditorPlugin(); }; - +#endif #endif // COLLISION_POLYGON_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp b/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp index d0cd73dcad..6787aeba0f 100644 --- a/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/collision_shape_2d_editor_plugin.h b/tools/editor/plugins/collision_shape_2d_editor_plugin.h index a8930dc0f2..3dca5e6cab 100644 --- a/tools/editor/plugins/collision_shape_2d_editor_plugin.h +++ b/tools/editor/plugins/collision_shape_2d_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/color_ramp_editor_plugin.cpp b/tools/editor/plugins/color_ramp_editor_plugin.cpp index 4e2045edc6..ad0ed7cef0 100644 --- a/tools/editor/plugins/color_ramp_editor_plugin.cpp +++ b/tools/editor/plugins/color_ramp_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/color_ramp_editor_plugin.h b/tools/editor/plugins/color_ramp_editor_plugin.h index 300a9030b9..64e073086a 100644 --- a/tools/editor/plugins/color_ramp_editor_plugin.h +++ b/tools/editor/plugins/color_ramp_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp index b6f3db73f7..c18f611a49 100644 --- a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp +++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -28,6 +28,7 @@ /*************************************************************************/ #include "cube_grid_theme_editor_plugin.h" +#if 0 #include "scene/3d/mesh_instance.h" #include "scene/3d/physics_body.h" #include "scene/main/viewport.h" @@ -353,4 +354,4 @@ MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) { theme_editor->hide(); } - +#endif diff --git a/tools/editor/plugins/cube_grid_theme_editor_plugin.h b/tools/editor/plugins/cube_grid_theme_editor_plugin.h index 72ee171e19..d50e3156c3 100644 --- a/tools/editor/plugins/cube_grid_theme_editor_plugin.h +++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -32,7 +32,7 @@ #include "scene/resources/mesh_library.h" #include "tools/editor/editor_node.h" - +#if 0 class MeshLibraryEditor : public Control { OBJ_TYPE( MeshLibraryEditor, Control ); @@ -93,3 +93,4 @@ public: #endif // CUBE_GRID_THEME_EDITOR_PLUGIN_H +#endif diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index b1bce60484..0886edb073 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -37,6 +37,7 @@ #include "scene/resources/bit_mask.h" #include "tools/editor/editor_scale.h" +#if 0 bool EditorTexturePreviewPlugin::handles(const String& p_type) const { return (ObjectTypeDB::is_type(p_type,"ImageTexture") || ObjectTypeDB::is_type(p_type, "AtlasTexture")); @@ -69,8 +70,8 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES& p_from) { if (img.is_compressed()) { if (img.decompress()!=OK) return Ref<Texture>(); - } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGBA) { - img.convert(Image::FORMAT_RGBA); + } else if (img.get_format()!=Image::FORMAT_RGB8 && img.get_format()!=Image::FORMAT_RGBA8) { + img.convert(Image::FORMAT_RGBA8); } int width,height; @@ -138,15 +139,15 @@ Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES& p_from) { } - Image img(bm->get_size().width,bm->get_size().height,0,Image::FORMAT_GRAYSCALE,data); + Image img(bm->get_size().width,bm->get_size().height,0,Image::FORMAT_L8,data); int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; if (img.is_compressed()) { if (img.decompress()!=OK) return Ref<Texture>(); - } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGBA) { - img.convert(Image::FORMAT_RGBA); + } else if (img.get_format()!=Image::FORMAT_RGB8 && img.get_format()!=Image::FORMAT_RGBA8) { + img.convert(Image::FORMAT_RGBA8); } int width,height; @@ -434,7 +435,7 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES& p_from) { int col=0; int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; - Image img(thumbnail_size,thumbnail_size,0,Image::FORMAT_RGBA); + Image img(thumbnail_size,thumbnail_size,0,Image::FORMAT_RGBA8); @@ -778,7 +779,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { imgdata = DVector<uint8_t>::Write(); Ref<ImageTexture> ptex = Ref<ImageTexture>( memnew( ImageTexture)); - ptex->create_from_image(Image(w,h,0,Image::FORMAT_RGB,img),0); + ptex->create_from_image(Image(w,h,0,Image::FORMAT_RGB8,img),0); return ptex; } @@ -888,6 +889,7 @@ EditorMeshPreviewPlugin::EditorMeshPreviewPlugin() { } + EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() { //VS::get_singleton()->free(sphere); @@ -901,3 +903,4 @@ EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() { VS::get_singleton()->free(scenario); } +#endif diff --git a/tools/editor/plugins/editor_preview_plugins.h b/tools/editor/plugins/editor_preview_plugins.h index b33aefaa23..3c1689e61e 100644 --- a/tools/editor/plugins/editor_preview_plugins.h +++ b/tools/editor/plugins/editor_preview_plugins.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,6 +31,7 @@ #include "tools/editor/editor_resource_preview.h" +#if 0 class EditorTexturePreviewPlugin : public EditorResourcePreviewGenerator { public: @@ -123,5 +124,5 @@ public: ~EditorMeshPreviewPlugin(); }; - +#endif #endif // EDITORPREVIEWPLUGINS_H diff --git a/tools/editor/plugins/gi_probe_editor_plugin.cpp b/tools/editor/plugins/gi_probe_editor_plugin.cpp new file mode 100644 index 0000000000..4ec95eb8c6 --- /dev/null +++ b/tools/editor/plugins/gi_probe_editor_plugin.cpp @@ -0,0 +1,57 @@ +#include "gi_probe_editor_plugin.h" + + +void GIProbeEditorPlugin::_bake() { + + if (gi_probe) { + gi_probe->bake(); + } +} + + +void GIProbeEditorPlugin::edit(Object *p_object) { + + GIProbe * s = p_object->cast_to<GIProbe>(); + if (!s) + return; + + gi_probe=s; +} + +bool GIProbeEditorPlugin::handles(Object *p_object) const { + + return p_object->is_type("GIProbe"); +} + +void GIProbeEditorPlugin::make_visible(bool p_visible) { + + if (p_visible) { + bake->show(); + } else { + + bake->hide(); + } + +} + +void GIProbeEditorPlugin::_bind_methods() { + + ObjectTypeDB::bind_method("_bake",&GIProbeEditorPlugin::_bake); +} + +GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { + + editor=p_node; + bake = memnew( Button ); + bake->set_icon(editor->get_gui_base()->get_icon("BakedLight","EditorIcons")); + bake->hide();; + bake->connect("pressed",this,"_bake"); + add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU,bake); + gi_probe=NULL; +} + + +GIProbeEditorPlugin::~GIProbeEditorPlugin() { + + memdelete(bake); +} diff --git a/tools/editor/plugins/gi_probe_editor_plugin.h b/tools/editor/plugins/gi_probe_editor_plugin.h new file mode 100644 index 0000000000..7db91bebaf --- /dev/null +++ b/tools/editor/plugins/gi_probe_editor_plugin.h @@ -0,0 +1,37 @@ +#ifndef GIPROBEEDITORPLUGIN_H +#define GIPROBEEDITORPLUGIN_H + +#include "tools/editor/editor_plugin.h" +#include "tools/editor/editor_node.h" +#include "scene/resources/material.h" +#include "scene/3d/gi_probe.h" + + + +class GIProbeEditorPlugin : public EditorPlugin { + + OBJ_TYPE( GIProbeEditorPlugin, EditorPlugin ); + + GIProbe *gi_probe; + + Button *bake; + EditorNode *editor; + + void _bake(); +protected: + + static void _bind_methods(); +public: + + virtual String get_name() const { return "GIProbe"; } + bool has_main_screen() const { return false; } + virtual void edit(Object *p_node); + virtual bool handles(Object *p_node) const; + virtual void make_visible(bool p_visible); + + GIProbeEditorPlugin(EditorNode *p_node); + ~GIProbeEditorPlugin(); + +}; + +#endif // GIPROBEEDITORPLUGIN_H diff --git a/tools/editor/plugins/item_list_editor_plugin.cpp b/tools/editor/plugins/item_list_editor_plugin.cpp index b711e13193..ea29e9ef07 100644 --- a/tools/editor/plugins/item_list_editor_plugin.cpp +++ b/tools/editor/plugins/item_list_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/item_list_editor_plugin.h b/tools/editor/plugins/item_list_editor_plugin.h index 95d316b199..559a295101 100644 --- a/tools/editor/plugins/item_list_editor_plugin.h +++ b/tools/editor/plugins/item_list_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp index 56e58bc983..5367a1c9ef 100644 --- a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp +++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.h b/tools/editor/plugins/light_occluder_2d_editor_plugin.h index 0176eb87dd..4e229618d0 100644 --- a/tools/editor/plugins/light_occluder_2d_editor_plugin.h +++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/material_editor_plugin.cpp b/tools/editor/plugins/material_editor_plugin.cpp index 876fab0d6e..1036016194 100644 --- a/tools/editor/plugins/material_editor_plugin.cpp +++ b/tools/editor/plugins/material_editor_plugin.cpp @@ -1,6 +1,8 @@ #include "material_editor_plugin.h" #include "scene/main/viewport.h" +#if 0 + void MaterialEditor::_input_event(InputEvent p_event) { @@ -379,3 +381,4 @@ MaterialEditorPlugin::~MaterialEditorPlugin() } +#endif diff --git a/tools/editor/plugins/material_editor_plugin.h b/tools/editor/plugins/material_editor_plugin.h index 49e92493b3..68b3b3b1a7 100644 --- a/tools/editor/plugins/material_editor_plugin.h +++ b/tools/editor/plugins/material_editor_plugin.h @@ -8,7 +8,7 @@ #include "scene/3d/mesh_instance.h" #include "scene/3d/camera.h" - +#if 0 class MaterialEditor : public Control { OBJ_TYPE(MaterialEditor, Control); @@ -69,3 +69,4 @@ public: }; #endif // MATERIAL_EDITOR_PLUGIN_H +#endif diff --git a/tools/editor/plugins/mesh_editor_plugin.cpp b/tools/editor/plugins/mesh_editor_plugin.cpp index b70cbad25f..6574bb8e1a 100644 --- a/tools/editor/plugins/mesh_editor_plugin.cpp +++ b/tools/editor/plugins/mesh_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -28,6 +28,7 @@ /*************************************************************************/ #include "mesh_editor_plugin.h" +#if 0 void MeshEditor::_input_event(InputEvent p_event) { @@ -241,3 +242,4 @@ MeshEditorPlugin::MeshEditorPlugin(EditorNode *p_node) { MeshEditorPlugin::~MeshEditorPlugin() { } +#endif diff --git a/tools/editor/plugins/mesh_editor_plugin.h b/tools/editor/plugins/mesh_editor_plugin.h index 0715a96e74..cd52c5c05c 100644 --- a/tools/editor/plugins/mesh_editor_plugin.h +++ b/tools/editor/plugins/mesh_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -29,6 +29,8 @@ #ifndef MESH_EDITOR_PLUGIN_H #define MESH_EDITOR_PLUGIN_H +#if 0 + #include "tools/editor/editor_plugin.h" #include "tools/editor/editor_node.h" #include "scene/resources/material.h" @@ -93,3 +95,4 @@ public: }; #endif // MESH_EDITOR_PLUGIN_H +#endif diff --git a/tools/editor/plugins/multimesh_editor_plugin.cpp b/tools/editor/plugins/multimesh_editor_plugin.cpp index 8a0c6b3fe8..c0f5f6491d 100644 --- a/tools/editor/plugins/multimesh_editor_plugin.cpp +++ b/tools/editor/plugins/multimesh_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -195,6 +195,8 @@ void MultiMeshEditor::_populate() { int instance_count=populate_amount->get_val(); + multimesh->set_transform_format(MultiMesh::TRANSFORM_3D); + multimesh->set_color_format(MultiMesh::COLOR_NONE); multimesh->set_instance_count(instance_count); float _tilt_random = populate_tilt_random->get_val(); @@ -247,10 +249,10 @@ void MultiMeshEditor::_populate() { multimesh->set_instance_transform(i,xform); - multimesh->set_instance_color(i,Color(1,1,1,1)); + } - multimesh->generate_aabb(); + node->set_multimesh(multimesh); @@ -386,6 +388,7 @@ MultiMeshEditor::MultiMeshEditor() { populate_scale_random->set_min(0); populate_scale_random->set_max(1); populate_scale_random->set_val(0); + populate_scale_random->set_step(0.01); vbc->add_margin_child(TTR("Random Scale:"),populate_scale_random); @@ -393,6 +396,7 @@ MultiMeshEditor::MultiMeshEditor() { populate_scale->set_min(0.001); populate_scale->set_max(4096); populate_scale->set_val(1); + populate_scale->set_step(0.01); vbc->add_margin_child(TTR("Scale:"),populate_scale); diff --git a/tools/editor/plugins/multimesh_editor_plugin.h b/tools/editor/plugins/multimesh_editor_plugin.h index 245da1eeb7..c7fa2fc1ad 100644 --- a/tools/editor/plugins/multimesh_editor_plugin.h +++ b/tools/editor/plugins/multimesh_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp index 22546c72f3..c395868ef4 100644 --- a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.h b/tools/editor/plugins/navigation_polygon_editor_plugin.h index defdebbec2..11f5321230 100644 --- a/tools/editor/plugins/navigation_polygon_editor_plugin.h +++ b/tools/editor/plugins/navigation_polygon_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/particles_2d_editor_plugin.cpp b/tools/editor/plugins/particles_2d_editor_plugin.cpp index ce25f34c1f..5ba46dc802 100644 --- a/tools/editor/plugins/particles_2d_editor_plugin.cpp +++ b/tools/editor/plugins/particles_2d_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -69,8 +69,8 @@ void Particles2DEditorPlugin::_file_selected(const String& p_file) { ERR_EXPLAIN(TTR("Error loading image:")+" "+p_file); ERR_FAIL_COND(err!=OK); - img.convert(Image::FORMAT_GRAYSCALE_ALPHA); - ERR_FAIL_COND(img.get_format()!=Image::FORMAT_GRAYSCALE_ALPHA); + img.convert(Image::FORMAT_LA8); + ERR_FAIL_COND(img.get_format()!=Image::FORMAT_LA8); Size2i s = Size2(img.get_width(),img.get_height()); ERR_FAIL_COND(s.width==0 || s.height==0); diff --git a/tools/editor/plugins/particles_2d_editor_plugin.h b/tools/editor/plugins/particles_2d_editor_plugin.h index ce2056b482..01b44c492b 100644 --- a/tools/editor/plugins/particles_2d_editor_plugin.h +++ b/tools/editor/plugins/particles_2d_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/particles_editor_plugin.cpp b/tools/editor/plugins/particles_editor_plugin.cpp index 7e20cc3f54..b17867ffd9 100644 --- a/tools/editor/plugins/particles_editor_plugin.cpp +++ b/tools/editor/plugins/particles_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -26,6 +26,8 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + +#if 0 #include "particles_editor_plugin.h" #include "io/resource_loader.h" #include "servers/visual/particle_system_sw.h" @@ -456,3 +458,4 @@ ParticlesEditorPlugin::~ParticlesEditorPlugin() } +#endif diff --git a/tools/editor/plugins/particles_editor_plugin.h b/tools/editor/plugins/particles_editor_plugin.h index ff80bffc29..0dd759bc75 100644 --- a/tools/editor/plugins/particles_editor_plugin.h +++ b/tools/editor/plugins/particles_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -37,7 +37,7 @@ /** @author Juan Linietsky <reduzio@gmail.com> */ - +#if 0 class ParticlesEditor : public Control { OBJ_TYPE(ParticlesEditor, Control ); @@ -113,3 +113,4 @@ public: }; #endif // PARTICLES_EDITOR_PLUGIN_H +#endif diff --git a/tools/editor/plugins/path_2d_editor_plugin.cpp b/tools/editor/plugins/path_2d_editor_plugin.cpp index 95f330a1d5..4b024bf319 100644 --- a/tools/editor/plugins/path_2d_editor_plugin.cpp +++ b/tools/editor/plugins/path_2d_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/path_2d_editor_plugin.h b/tools/editor/plugins/path_2d_editor_plugin.h index acbc481e09..d4b132cedd 100644 --- a/tools/editor/plugins/path_2d_editor_plugin.h +++ b/tools/editor/plugins/path_2d_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/path_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp index 33ef71efab..c4e88d3aa8 100644 --- a/tools/editor/plugins/path_editor_plugin.cpp +++ b/tools/editor/plugins/path_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,6 +31,7 @@ #include "scene/resources/curve.h" #include "os/keyboard.h" +#if 0 String PathSpatialGizmo::get_handle_name(int p_idx) const { Ref<Curve3D> c = path->get_curve(); @@ -103,6 +104,12 @@ void PathSpatialGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_po if (p.intersects_ray(ray_from,ray_dir,&inters)) { + 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); } @@ -522,16 +529,16 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) { editor=p_node; singleton=this; - path_material = Ref<FixedMaterial>( memnew( FixedMaterial )); - path_material->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.8) ); - path_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); + path_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); + path_material->set_parameter( FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.8) ); + path_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, 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_thin_material = Ref<FixedMaterial>( memnew( FixedMaterial )); - path_thin_material->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.4) ); - path_thin_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); + path_thin_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); + path_thin_material->set_parameter( FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.4) ); + path_thin_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, 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); @@ -593,3 +600,4 @@ PathEditorPlugin::~PathEditorPlugin() { } +#endif diff --git a/tools/editor/plugins/path_editor_plugin.h b/tools/editor/plugins/path_editor_plugin.h index 0afd957af7..55920516a2 100644 --- a/tools/editor/plugins/path_editor_plugin.h +++ b/tools/editor/plugins/path_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -32,6 +32,7 @@ #include "tools/editor/spatial_editor_gizmos.h" #include "scene/3d/path.h" +# if 0 class PathSpatialGizmo : public EditorSpatialGizmo { OBJ_TYPE(PathSpatialGizmo,EditorSpatialGizmo); @@ -78,8 +79,8 @@ public: Path *get_edited_path() { return path; } static PathEditorPlugin* singleton; - Ref<FixedMaterial> path_material; - Ref<FixedMaterial> path_thin_material; + Ref<FixedSpatialMaterial> path_material; + Ref<FixedSpatialMaterial> path_thin_material; virtual bool forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event); // virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); } @@ -95,5 +96,5 @@ public: }; - +#endif #endif // PATH_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index 19d1ccc06f..6949f0256e 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -850,7 +850,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) { uv_edit = memnew( AcceptDialog ); add_child(uv_edit); uv_edit->set_title(TTR("Polygon 2D UV Editor")); - uv_edit->set_self_opacity(0.9); + uv_edit->set_self_modulate(Color(1,1,1,0.9)); VBoxContainer *uv_main_vb = memnew( VBoxContainer ); uv_edit->add_child(uv_main_vb); diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.h b/tools/editor/plugins/polygon_2d_editor_plugin.h index 33bae94340..03de6c3d43 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.h +++ b/tools/editor/plugins/polygon_2d_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/resource_preloader_editor_plugin.cpp b/tools/editor/plugins/resource_preloader_editor_plugin.cpp index cce0ba3d62..4aabb5a90c 100644 --- a/tools/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/tools/editor/plugins/resource_preloader_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/resource_preloader_editor_plugin.h b/tools/editor/plugins/resource_preloader_editor_plugin.h index 4f0cb4be37..8e60976f2e 100644 --- a/tools/editor/plugins/resource_preloader_editor_plugin.h +++ b/tools/editor/plugins/resource_preloader_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/rich_text_editor_plugin.cpp b/tools/editor/plugins/rich_text_editor_plugin.cpp index bec48ca293..f5a6bb6b48 100644 --- a/tools/editor/plugins/rich_text_editor_plugin.cpp +++ b/tools/editor/plugins/rich_text_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/rich_text_editor_plugin.h b/tools/editor/plugins/rich_text_editor_plugin.h index ae1d04be01..e94e6b08ed 100644 --- a/tools/editor/plugins/rich_text_editor_plugin.h +++ b/tools/editor/plugins/rich_text_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index 7965fa54ae..423e6f6f1f 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -311,7 +311,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag imgdata = DVector<uint8_t>::Write(); - p_texture->set_data(Image(w,h,0,Image::FORMAT_RGB,img)); + p_texture->set_data(Image(w,h,0,Image::FORMAT_RGB8,img)); } @@ -392,7 +392,7 @@ SampleEditor::SampleEditor() { add_child(stop); peakdisplay=Ref<ImageTexture>( memnew( ImageTexture) ); - peakdisplay->create( EDITOR_DEF("audio/sample_editor_preview_width",512),EDITOR_DEF("audio/sample_editor_preview_height",128),Image::FORMAT_RGB); + peakdisplay->create( EDITOR_DEF("audio/sample_editor_preview_width",512),EDITOR_DEF("audio/sample_editor_preview_height",128),Image::FORMAT_RGB8); sample_texframe->set_expand(true); sample_texframe->set_texture(peakdisplay); diff --git a/tools/editor/plugins/sample_editor_plugin.h b/tools/editor/plugins/sample_editor_plugin.h index 22dc75b53b..33f1a54f89 100644 --- a/tools/editor/plugins/sample_editor_plugin.h +++ b/tools/editor/plugins/sample_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/sample_library_editor_plugin.cpp b/tools/editor/plugins/sample_library_editor_plugin.cpp index 2a6940332c..82321962eb 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.cpp +++ b/tools/editor/plugins/sample_library_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -236,7 +236,7 @@ void SampleLibraryEditor::_update_library() { // Preview/edit Ref<ImageTexture> preview( memnew( ImageTexture )); - preview->create(128,16,Image::FORMAT_RGB); + preview->create(128,16,Image::FORMAT_RGB8); SampleEditor::generate_preview_texture(smp,preview); ti->set_cell_mode(1,TreeItem::CELL_MODE_ICON); ti->set_selectable(1,false); diff --git a/tools/editor/plugins/sample_library_editor_plugin.h b/tools/editor/plugins/sample_library_editor_plugin.h index f9fb184b7c..415314a9e4 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.h +++ b/tools/editor/plugins/sample_library_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/sample_player_editor_plugin.cpp b/tools/editor/plugins/sample_player_editor_plugin.cpp index 3085ad87d8..d0873a3cec 100644 --- a/tools/editor/plugins/sample_player_editor_plugin.cpp +++ b/tools/editor/plugins/sample_player_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/sample_player_editor_plugin.h b/tools/editor/plugins/sample_player_editor_plugin.h index 013b042487..c84a691682 100644 --- a/tools/editor/plugins/sample_player_editor_plugin.h +++ b/tools/editor/plugins/sample_player_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 99c50efd2f..6988d8c6f2 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -945,7 +945,7 @@ void ScriptEditor::_menu_option(int p_option) { } } - EditorHelp *help = tab_container->get_child(selected)->cast_to<EditorHelp>(); + EditorHelp *help = tab_container->get_current_tab_control()->cast_to<EditorHelp>(); if (help) { switch(p_option) { @@ -1841,6 +1841,8 @@ void ScriptEditor::get_window_layout(Ref<ConfigFile> p_layout) { void ScriptEditor::_help_class_open(const String& p_class) { + if (p_class=="") + return; for(int i=0;i<tab_container->get_child_count();i++) { @@ -1909,19 +1911,14 @@ void ScriptEditor::_update_selected_editor_menu() { se->get_edit_menu()->hide(); } - EditorHelp *eh = tab_container->get_child(i)->cast_to<EditorHelp>(); - - if (eh) { - - if (current) - script_search_menu->show(); - else - script_search_menu->hide(); - } - - } + EditorHelp *eh=tab_container->get_current_tab_control()->cast_to<EditorHelp>(); + if (eh) { + script_search_menu->show(); + } else { + script_search_menu->hide(); + } } void ScriptEditor::_update_history_pos(int p_new_pos) { diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 10f3bce14e..310778c2bd 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/script_text_editor.cpp b/tools/editor/plugins/script_text_editor.cpp index 40fc3a7bda..1811b4fa21 100644 --- a/tools/editor/plugins/script_text_editor.cpp +++ b/tools/editor/plugins/script_text_editor.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -100,7 +100,7 @@ void ScriptTextEditor::_load_theme_settings() { /* keyword color */ - text_edit->set_custom_bg_color(EDITOR_DEF("text_editor/background_color",Color(0,0,0,0))); + text_edit->add_color_override("background_color", EDITOR_DEF("text_editor/background_color",Color(0,0,0,0))); text_edit->add_color_override("completion_background_color", EDITOR_DEF("text_editor/completion_background_color", Color(0,0,0,0))); text_edit->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/completion_selected_color", Color::html("434244"))); text_edit->add_color_override("completion_existing_color", EDITOR_DEF("text_editor/completion_existing_color", Color::html("21dfdfdf"))); @@ -122,6 +122,7 @@ void ScriptTextEditor::_load_theme_settings() { text_edit->add_color_override("breakpoint_color", EDITOR_DEF("text_editor/breakpoint_color", Color(0.8,0.8,0.4,0.2))); text_edit->add_color_override("search_result_color",EDITOR_DEF("text_editor/search_result_color",Color(0.05,0.25,0.05,1))); text_edit->add_color_override("search_result_border_color",EDITOR_DEF("text_editor/search_result_border_color",Color(0.1,0.45,0.1,1))); + text_edit->add_color_override("symbol_color",EDITOR_DEF("text_editor/symbol_color",Color::hex(0x005291ff))); text_edit->add_constant_override("line_spacing", EDITOR_DEF("text_editor/line_spacing",4)); Color keyword_color= EDITOR_DEF("text_editor/keyword_color",Color(0.5,0.0,0.2)); @@ -190,11 +191,6 @@ void ScriptTextEditor::_load_theme_settings() { String end = string.get_slice_count(" ")>1?string.get_slice(" ",1):String(); text_edit->add_color_region(beg,end,string_color,end==""); } - - //colorize symbols - Color symbol_color= EDITOR_DEF("text_editor/symbol_color",Color::hex(0x005291ff)); - text_edit->set_symbol_color(symbol_color); - } diff --git a/tools/editor/plugins/script_text_editor.h b/tools/editor/plugins/script_text_editor.h index ceef50f0bc..37bb880dc8 100644 --- a/tools/editor/plugins/script_text_editor.h +++ b/tools/editor/plugins/script_text_editor.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index 861f5678f6..789fdcd6b0 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -37,7 +37,7 @@ #include "tools/editor/editor_node.h" #include "tools/editor/property_editor.h" #include "os/os.h" - +#include "servers/visual/shader_types.h" /*** SETTINGS EDITOR ****/ @@ -51,19 +51,14 @@ Ref<Shader> ShaderTextEditor::get_edited_shader() const { return shader; } -void ShaderTextEditor::set_edited_shader(const Ref<Shader>& p_shader,ShaderLanguage::ShaderType p_type) { +void ShaderTextEditor::set_edited_shader(const Ref<Shader>& p_shader) { shader=p_shader; - type=p_type; + _load_theme_settings(); - if (p_type==ShaderLanguage::SHADER_MATERIAL_LIGHT || p_type==ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT) - get_text_edit()->set_text(shader->get_light_code()); - else if (p_type==ShaderLanguage::SHADER_MATERIAL_VERTEX || p_type==ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX) - get_text_edit()->set_text(shader->get_vertex_code()); - else - get_text_edit()->set_text(shader->get_fragment_code()); + get_text_edit()->set_text(p_shader->get_code()); _line_col_changed(); @@ -77,7 +72,7 @@ void ShaderTextEditor::_load_theme_settings() { /* keyword color */ - get_text_edit()->set_custom_bg_color(EDITOR_DEF("text_editor/background_color",Color(0,0,0,0))); + get_text_edit()->add_color_override("background_color", EDITOR_DEF("text_editor/background_color",Color(0,0,0,0))); get_text_edit()->add_color_override("completion_background_color", EDITOR_DEF("text_editor/completion_background_color", Color(0,0,0,0))); get_text_edit()->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/completion_selected_color", Color::html("434244"))); get_text_edit()->add_color_override("completion_existing_color", EDITOR_DEF("text_editor/completion_existing_color", Color::html("21dfdfdf"))); @@ -99,12 +94,31 @@ void ShaderTextEditor::_load_theme_settings() { get_text_edit()->add_color_override("breakpoint_color", EDITOR_DEF("text_editor/breakpoint_color", Color(0.8,0.8,0.4,0.2))); get_text_edit()->add_color_override("search_result_color",EDITOR_DEF("text_editor/search_result_color",Color(0.05,0.25,0.05,1))); get_text_edit()->add_color_override("search_result_border_color",EDITOR_DEF("text_editor/search_result_border_color",Color(0.1,0.45,0.1,1))); + get_text_edit()->add_color_override("symbol_color",EDITOR_DEF("text_editor/symbol_color",Color::hex(0x005291ff))); Color keyword_color= EDITOR_DEF("text_editor/keyword_color",Color(0.5,0.0,0.2)); List<String> keywords; - ShaderLanguage::get_keyword_list(type,&keywords); + ShaderLanguage::get_keyword_list(&keywords); + + if (shader.is_valid()) { + + + for(const Map< StringName, Map<StringName,ShaderLanguage::DataType> >::Element *E=ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())).front();E;E=E->next()) { + + for (const Map<StringName,ShaderLanguage::DataType>::Element *F=E->get().front();F;F=F->next()) { + keywords.push_back(F->key()); + } + + } + + for(const Set<String>::Element *E =ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())).front();E;E=E->next()) { + + keywords.push_back(E->get()); + + } + } for(List<String>::Element *E=keywords.front();E;E=E->next()) { @@ -135,29 +149,36 @@ void ShaderTextEditor::_load_theme_settings() { String end = string.get_slice_count(" ")>1?string.get_slice(" ",1):String(); get_text_edit()->add_color_region(beg,end,string_color,end==""); }*/ +} - //colorize symbols - Color symbol_color= EDITOR_DEF("text_editor/symbol_color",Color::hex(0x005291ff)); - get_text_edit()->set_symbol_color(symbol_color); +void ShaderTextEditor::_code_complete_script(const String& p_code, List<String>* r_options) { -} + print_line("code complete"); + ShaderLanguage sl; + String calltip; -void ShaderTextEditor::_validate_script() { + Error err = sl.complete(p_code,ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())),ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())),r_options,calltip); + + if (calltip!="") { + get_text_edit()->set_code_hint(calltip); + } +} - String errortxt; - int line,col; +void ShaderTextEditor::_validate_script() { String code=get_text_edit()->get_text(); //List<StringName> params; //shader->get_param_list(¶ms); - Error err = ShaderLanguage::compile(code,type,NULL,NULL,&errortxt,&line,&col); + ShaderLanguage sl; + + Error err = sl.compile(code,ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())),ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode()))); if (err!=OK) { - String error_text="error("+itos(line+1)+","+itos(col+1)+"): "+errortxt; + String error_text="error("+itos(sl.get_error_line())+"): "+sl.get_error_text(); set_error(error_text); - get_text_edit()->set_line_as_marked(line,true); + get_text_edit()->set_line_as_marked(sl.get_error_line(),true); } else { for(int i=0;i<get_text_edit()->get_line_count();i++) @@ -187,9 +208,7 @@ ShaderTextEditor::ShaderTextEditor() { void ShaderEditor::_menu_option(int p_option) { - ShaderTextEditor *current = tab_container->get_current_tab_control()->cast_to<ShaderTextEditor>(); - if (!current) - return; + ShaderTextEditor *current = shader_editor; switch(p_option) { case EDIT_UNDO: { @@ -245,24 +264,11 @@ void ShaderEditor::_menu_option(int p_option) { } } -void ShaderEditor::_tab_changed(int p_which) { - - ShaderTextEditor *shader_editor = tab_container->get_tab_control(p_which)->cast_to<ShaderTextEditor>(); - - if (shader_editor && is_inside_tree()) - shader_editor->get_text_edit()->grab_focus(); - - ensure_select_current(); -} void ShaderEditor::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { - close->set_normal_texture( get_icon("Close","EditorIcons")); - close->set_hover_texture( get_icon("CloseHover","EditorIcons")); - close->set_pressed_texture( get_icon("Close","EditorIcons")); - close->connect("pressed",this,"_close_callback"); } if (p_what==NOTIFICATION_DRAW) { @@ -365,25 +371,30 @@ void ShaderEditor::clear() { void ShaderEditor::_params_changed() { - fragment_editor->_validate_script(); - vertex_editor->_validate_script(); - light_editor->_validate_script(); + shader_editor->_validate_script(); } void ShaderEditor::_editor_settings_changed() { - vertex_editor->update_editor_settings(); - fragment_editor->update_editor_settings(); - light_editor->update_editor_settings(); + shader_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); + shader_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); + shader_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); + shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); + shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); + shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); + shader_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); + shader_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); + shader_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); + shader_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); + shader_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); } void ShaderEditor::_bind_methods() { ObjectTypeDB::bind_method("_editor_settings_changed",&ShaderEditor::_editor_settings_changed); - ObjectTypeDB::bind_method("_tab_changed",&ShaderEditor::_tab_changed); + ObjectTypeDB::bind_method("_menu_option",&ShaderEditor::_menu_option); ObjectTypeDB::bind_method("_params_changed",&ShaderEditor::_params_changed); - ObjectTypeDB::bind_method("_close_callback",&ShaderEditor::_close_callback); ObjectTypeDB::bind_method("apply_shaders",&ShaderEditor::apply_shaders); // ObjectTypeDB::bind_method("_close_current_tab",&ShaderEditor::_close_current_tab); } @@ -409,16 +420,7 @@ void ShaderEditor::edit(const Ref<Shader>& p_shader) { shader=p_shader; - if (shader->get_mode()==Shader::MODE_MATERIAL) { - vertex_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_MATERIAL_VERTEX); - fragment_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_MATERIAL_FRAGMENT); - light_editor->set_edited_shader(shader,ShaderLanguage::SHADER_MATERIAL_LIGHT); - } else if (shader->get_mode()==Shader::MODE_CANVAS_ITEM) { - - vertex_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX); - fragment_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_CANVAS_ITEM_FRAGMENT); - light_editor->set_edited_shader(shader,ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT); - } + shader_editor->set_edited_shader(p_shader); //vertex_editor->set_edited_shader(shader,ShaderLanguage::SHADER_MATERIAL_VERTEX); // see if already has it @@ -442,35 +444,21 @@ void ShaderEditor::apply_shaders() { if (shader.is_valid()) { - shader->set_code(vertex_editor->get_text_edit()->get_text(),fragment_editor->get_text_edit()->get_text(),light_editor->get_text_edit()->get_text(),0,0); + shader->set_code(shader_editor->get_text_edit()->get_text()); shader->set_edited(true); } } -void ShaderEditor::_close_callback() { - - hide(); -} - ShaderEditor::ShaderEditor() { - tab_container = memnew( TabContainer ); - add_child(tab_container); - tab_container->set_area_as_parent_rect(); - tab_container->set_begin(Point2(0,0)); - //tab_container->set_begin(Point2(0,0)); - - close = memnew( TextureButton ); - close->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_END,20); - close->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,4); - close->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,2); - add_child(close); + HBoxContainer *hbc = memnew( HBoxContainer); + add_child(hbc); edit_menu = memnew( MenuButton ); - add_child(edit_menu); + hbc->add_child(edit_menu); edit_menu->set_pos(Point2(5,-1)); edit_menu->set_text(TTR("Edit")); edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/undo", TTR("Undo"), KEY_MASK_CMD|KEY_Z), EDIT_UNDO); @@ -485,7 +473,7 @@ ShaderEditor::ShaderEditor() { search_menu = memnew( MenuButton ); - add_child(search_menu); + hbc->add_child(search_menu); search_menu->set_pos(Point2(38,-1)); search_menu->set_text(TTR("Search")); search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find.."), KEY_MASK_CMD|KEY_F), SEARCH_FIND); @@ -498,34 +486,15 @@ ShaderEditor::ShaderEditor() { search_menu->get_popup()->connect("item_pressed", this,"_menu_option"); - tab_container->connect("tab_changed", this,"_tab_changed"); - - erase_tab_confirm = memnew( ConfirmationDialog ); - add_child(erase_tab_confirm); - erase_tab_confirm->connect("confirmed", this,"_close_current_tab"); - - goto_line_dialog = memnew(GotoLineDialog); add_child(goto_line_dialog); - vertex_editor = memnew( ShaderTextEditor ); - tab_container->add_child(vertex_editor); - vertex_editor->set_name(TTR("Vertex")); + shader_editor = memnew( ShaderTextEditor ); + add_child(shader_editor); + shader_editor->set_v_size_flags(SIZE_EXPAND_FILL); - fragment_editor = memnew( ShaderTextEditor ); - tab_container->add_child(fragment_editor); - fragment_editor->set_name(TTR("Fragment")); - light_editor = memnew( ShaderTextEditor ); - tab_container->add_child(light_editor); - light_editor->set_name(TTR("Lighting")); - - tab_container->set_current_tab(1); - - - vertex_editor->connect("script_changed", this,"apply_shaders"); - fragment_editor->connect("script_changed", this,"apply_shaders"); - light_editor->connect("script_changed", this,"apply_shaders"); + shader_editor->connect("script_changed", this,"apply_shaders"); EditorSettings::get_singleton()->connect("settings_changed",this,"_editor_settings_changed"); _editor_settings_changed(); @@ -535,15 +504,7 @@ ShaderEditor::ShaderEditor() { void ShaderEditorPlugin::edit(Object *p_object) { Shader* s = p_object->cast_to<Shader>(); - if (!s || s->cast_to<ShaderGraph>()) { - shader_editor->hide(); //Dont edit ShaderGraph - return; - } - - if (_2d && s->get_mode()==Shader::MODE_CANVAS_ITEM) - shader_editor->edit(s); - else if (!_2d && s->get_mode()==Shader::MODE_MATERIAL) - shader_editor->edit(s); + shader_editor->edit(s); } @@ -551,24 +512,25 @@ bool ShaderEditorPlugin::handles(Object *p_object) const { bool handles = true; Shader *shader=p_object->cast_to<Shader>(); - if (!shader || shader->cast_to<ShaderGraph>()) // Dont handle ShaderGraph's - handles = false; - if (handles && _2d) - handles = shader->get_mode()==Shader::MODE_CANVAS_ITEM; - else if (handles && !_2d) - return shader->get_mode()==Shader::MODE_MATERIAL; - - if (!handles) - shader_editor->hide(); - return handles; + //if (!shader || shader->cast_to<ShaderGraph>()) // Dont handle ShaderGraph's + // handles = false; + + return shader!=NULL; } void ShaderEditorPlugin::make_visible(bool p_visible) { if (p_visible) { - shader_editor->show(); + button->show(); + editor->make_bottom_panel_item_visible(shader_editor); + } else { + + button->hide(); + if (shader_editor->is_visible()) + editor->hide_bottom_panel(); shader_editor->apply_shaders(); + } } @@ -602,19 +564,14 @@ void ShaderEditorPlugin::apply_changes() { shader_editor->apply_shaders(); } -ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node, bool p_2d) { +ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node) { + editor=p_node; shader_editor = memnew( ShaderEditor ); - _2d=p_2d; - if (p_2d) - add_control_to_container(CONTAINER_CANVAS_EDITOR_BOTTOM,shader_editor); - else - add_control_to_container(CONTAINER_SPATIAL_EDITOR_BOTTOM,shader_editor); -// editor->get_viewport()->add_child(shader_editor); -// shader_editor->set_area_as_parent_rect(); - shader_editor->hide(); + shader_editor->set_custom_minimum_size(Size2(0,300)); + button=editor->add_bottom_panel_item("Shader",shader_editor); } @@ -622,3 +579,4 @@ ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node, bool p_2d) { ShaderEditorPlugin::~ShaderEditorPlugin() { } + diff --git a/tools/editor/plugins/shader_editor_plugin.h b/tools/editor/plugins/shader_editor_plugin.h index 9219a1fbc2..c13d4256a1 100644 --- a/tools/editor/plugins/shader_editor_plugin.h +++ b/tools/editor/plugins/shader_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -38,33 +38,34 @@ #include "scene/resources/shader.h" #include "servers/visual/shader_language.h" - class ShaderTextEditor : public CodeTextEditor { OBJ_TYPE( ShaderTextEditor, CodeTextEditor ); Ref<Shader> shader; - ShaderLanguage::ShaderType type; protected: static void _bind_methods(); virtual void _load_theme_settings(); + + virtual void _code_complete_script(const String& p_code, List<String>* r_options); + public: virtual void _validate_script(); Ref<Shader> get_edited_shader() const; - void set_edited_shader(const Ref<Shader>& p_shader,ShaderLanguage::ShaderType p_type); + void set_edited_shader(const Ref<Shader>& p_shader); ShaderTextEditor(); }; -class ShaderEditor : public Control { +class ShaderEditor : public VBoxContainer { - OBJ_TYPE(ShaderEditor, Control ); + OBJ_TYPE(ShaderEditor, VBoxContainer ); enum { @@ -88,22 +89,17 @@ class ShaderEditor : public Control { MenuButton *settings_menu; uint64_t idle; - TabContainer *tab_container; GotoLineDialog *goto_line_dialog; ConfirmationDialog *erase_tab_confirm; - TextureButton *close; - ShaderTextEditor *vertex_editor; - ShaderTextEditor *fragment_editor; - ShaderTextEditor *light_editor; + ShaderTextEditor *shader_editor; + - void _tab_changed(int p_which); void _menu_option(int p_optin); void _params_changed(); mutable Ref<Shader> shader; - void _close_callback(); void _editor_settings_changed(); @@ -134,6 +130,8 @@ class ShaderEditorPlugin : public EditorPlugin { bool _2d; ShaderEditor *shader_editor; EditorNode *editor; + Button *button; + public: virtual String get_name() const { return "Shader"; } @@ -150,8 +148,9 @@ public: virtual void save_external_data(); virtual void apply_changes(); - ShaderEditorPlugin(EditorNode *p_node,bool p_2d); + ShaderEditorPlugin(EditorNode *p_node); ~ShaderEditorPlugin(); }; + #endif diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index 3ab906f84e..0a00e47f37 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -28,6 +28,7 @@ /*************************************************************************/ #include "shader_graph_editor_plugin.h" +#if 0 #include "scene/gui/check_box.h" #include "scene/gui/menu_button.h" @@ -1377,7 +1378,7 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int edit->set_icon(ped_popup->get_icon("Matrix", "EditorIcons")); break; case Variant::COLOR: { - Image icon_color = Image(15,15,false,Image::FORMAT_RGB); + Image icon_color = Image(15,15,false,Image::FORMAT_RGB8); Color c = graph->default_get_value(type,p_id,param); for (int x=1;x<14;x++) for (int y=1;y<14;y++) @@ -2945,3 +2946,4 @@ ShaderGraphEditorPlugin::~ShaderGraphEditorPlugin() +#endif diff --git a/tools/editor/plugins/shader_graph_editor_plugin.h b/tools/editor/plugins/shader_graph_editor_plugin.h index 67ee5e2d45..7b33e586b5 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.h +++ b/tools/editor/plugins/shader_graph_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -43,7 +43,7 @@ @author Juan Linietsky <reduzio@gmail.com> */ - +#if 0 class GraphColorRampEdit : public Control { OBJ_TYPE(GraphColorRampEdit,Control); @@ -239,4 +239,4 @@ public: }; #endif - +#endif diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 6dcc71422a..83e3cb77f3 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -274,7 +274,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b Vector3 ray=_get_ray(p_pos); Vector3 pos=_get_ray_pos(p_pos); - Vector<RID> instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); + Vector<ObjectID> instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); Set<Ref<SpatialEditorGizmo> > found_gizmos; //uint32_t closest=0; @@ -286,8 +286,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b for (int i=0;i<instances.size();i++) { - uint32_t id=VisualServer::get_singleton()->instance_get_object_instance_ID(instances[i]); - Object *obj=ObjectDB::get_instance(id); + Object *obj=ObjectDB::get_instance(instances[i]); if (!obj) continue; @@ -405,15 +404,15 @@ void SpatialEditorViewport::_find_items_at_pos(const Point2& p_pos,bool &r_inclu Vector3 ray=_get_ray(p_pos); Vector3 pos=_get_ray_pos(p_pos); - Vector<RID> instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); + Vector<ObjectID> instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); Set<Ref<SpatialEditorGizmo> > found_gizmos; r_includes_current=false; for (int i=0;i<instances.size();i++) { - uint32_t id=VisualServer::get_singleton()->instance_get_object_instance_ID(instances[i]); - Object *obj=ObjectDB::get_instance(id); + Object *obj=ObjectDB::get_instance(instances[i]); + if (!obj) continue; @@ -534,14 +533,12 @@ void SpatialEditorViewport::_select_region() { frustum.push_back( far ); - Vector<RID> instances=VisualServer::get_singleton()->instances_cull_convex(frustum,get_tree()->get_root()->get_world()->get_scenario()); + Vector<ObjectID> instances=VisualServer::get_singleton()->instances_cull_convex(frustum,get_tree()->get_root()->get_world()->get_scenario()); for (int i=0;i<instances.size();i++) { - uint32_t id=VisualServer::get_singleton()->instance_get_object_instance_ID(instances[i]); - - Object *obj=ObjectDB::get_instance(id); + Object *obj=ObjectDB::get_instance(instances[i]); if (!obj) continue; Spatial *sp = obj->cast_to<Spatial>(); @@ -877,7 +874,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (b.mod.control) { - Vector<RID> instances=VisualServer::get_singleton()->instances_cull_ray(ray_origin,ray_dir,get_tree()->get_root()->get_world()->get_scenario() ); + Vector<ObjectID> instances=VisualServer::get_singleton()->instances_cull_ray(ray_origin,ray_dir,get_tree()->get_root()->get_world()->get_scenario() ); Plane p(ray_origin,_get_camera_normal()); @@ -886,8 +883,9 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { for (int i=0;i<instances.size();i++) { - uint32_t id=VisualServer::get_singleton()->instance_get_object_instance_ID(instances[i]); - Object *obj=ObjectDB::get_instance(id); + + Object *obj=ObjectDB::get_instance(instances[i]); + if (!obj) continue; @@ -1825,6 +1823,30 @@ void SpatialEditorViewport::_notification(int p_what) { surface->update(); } + //update shadow atlas if changed + + int shadowmap_size = Globals::get_singleton()->get("rendering/shadow_atlas/size"); + int atlas_q0 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_0_subdiv"); + int atlas_q1 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_1_subdiv"); + int atlas_q2 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_2_subdiv"); + int atlas_q3 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_3_subdiv"); + + + viewport->set_shadow_atlas_size(shadowmap_size); + viewport->set_shadow_atlas_quadrant_subdiv(0,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q0)); + viewport->set_shadow_atlas_quadrant_subdiv(1,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q1)); + viewport->set_shadow_atlas_quadrant_subdiv(2,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q2)); + viewport->set_shadow_atlas_quadrant_subdiv(3,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q3)); + + //update msaa if changed + + int msaa_mode = Globals::get_singleton()->get("rendering/antialias/msaa"); + viewport->set_msaa(Viewport::MSAA(msaa_mode)); + + bool hdr = Globals::get_singleton()->get("rendering/dynamic_range/hdr"); + viewport->set_hdr(hdr); + + } if (p_what==NOTIFICATION_ENTER_TREE) { @@ -2066,9 +2088,9 @@ void SpatialEditorViewport::_menu_option(int p_option) { bool current = view_menu->get_popup()->is_item_checked( idx ); current=!current; if (current) - camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<<GIZMO_EDIT_LAYER)|(1<<GIZMO_GRID_LAYER) ); + camera->set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<<GIZMO_EDIT_LAYER)|(1<<GIZMO_GRID_LAYER) ); else - camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<<GIZMO_GRID_LAYER) ); + camera->set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<<GIZMO_GRID_LAYER) ); view_menu->get_popup()->set_item_checked( idx, current ); } break; @@ -2355,18 +2377,20 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed message_time=0; spatial_editor=p_spatial_editor; - Control *c=memnew(Control); + ViewportContainer *c=memnew(ViewportContainer); + c->set_stretch(true); add_child(c); c->set_area_as_parent_rect(); viewport = memnew( Viewport ); viewport->set_disable_input(true); + c->add_child(viewport); surface = memnew( Control ); add_child(surface); surface->set_area_as_parent_rect(); camera = memnew(Camera); camera->set_disable_gizmo(true); - camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+p_index))|(1<<GIZMO_EDIT_LAYER)|(1<<GIZMO_GRID_LAYER) ); + camera->set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+p_index))|(1<<GIZMO_EDIT_LAYER)|(1<<GIZMO_GRID_LAYER) ); //camera->set_environment(SpatialEditor::get_singleton()->get_viewport_environment()); viewport->add_child(camera); camera->make_current(); @@ -2375,7 +2399,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed view_menu = memnew( MenuButton ); surface->add_child(view_menu); view_menu->set_pos( Point2(4,4)); - view_menu->set_self_opacity(0.5); + view_menu->set_self_modulate(Color(1,1,1,0.5)); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/top_view"), VIEW_TOP); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/bottom_view"), VIEW_BOTTOM); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/left_view"), VIEW_LEFT); @@ -2555,11 +2579,12 @@ void SpatialEditor::_generate_selection_box() { } - Ref<FixedMaterial> mat = memnew( FixedMaterial ); - mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1)); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); + Ref<FixedSpatialMaterial> mat = memnew( FixedSpatialMaterial ); + mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); + mat->set_albedo(Color(1,1,1)); + mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true); + mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); + mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true); st->set_material(mat); selection_box = st->commit(); } @@ -2691,14 +2716,14 @@ void SpatialEditor::set_state(const Dictionary& p_state) { } if (d.has("ambient_light_color")) { settings_ambient_color->set_color(d["ambient_light_color"]); - viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,d["ambient_light_color"]); + //viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,d["ambient_light_color"]); } if (d.has("default_srgb")) { bool use = d["default_srgb"]; - viewport_environment->set_enable_fx(Environment::FX_SRGB,use); - view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_DEFAULT_SRGB), use ); + //viewport_environment->set_enable_fx(Environment::FX_SRGB,use); + //view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_DEFAULT_SRGB), use ); } if (d.has("show_grid")) { bool use = d["show_grid"]; @@ -2898,9 +2923,9 @@ void SpatialEditor::_menu_item_pressed(int p_option) { bool is_checked = view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(p_option) ); if (is_checked) { - viewport_environment->set_enable_fx(Environment::FX_SRGB,false); + //viewport_environment->set_enable_fx(Environment::FX_SRGB,false); } else { - viewport_environment->set_enable_fx(Environment::FX_SRGB,true); + //viewport_environment->set_enable_fx(Environment::FX_SRGB,true); } is_checked = ! is_checked; @@ -3146,11 +3171,13 @@ void SpatialEditor::_init_indicators() { { - indicator_mat = VisualServer::get_singleton()->fixed_material_create(); - VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_UNSHADED, true ); - VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_ONTOP, false ); - VisualServer::get_singleton()->fixed_material_set_flag(indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA,true); - VisualServer::get_singleton()->fixed_material_set_flag(indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true); + indicator_mat.instance();; + indicator_mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); + indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP,true); + indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); + indicator_mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true); + + indicator_mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true); DVector<Color> grid_colors[3]; DVector<Vector3> grid_points[3]; @@ -3192,8 +3219,8 @@ void SpatialEditor::_init_indicators() { d.resize(VS::ARRAY_MAX); d[VisualServer::ARRAY_VERTEX]=grid_points[i]; d[VisualServer::ARRAY_COLOR]=grid_colors[i]; - VisualServer::get_singleton()->mesh_add_surface(grid[i],VisualServer::PRIMITIVE_LINES,d); - VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat); + VisualServer::get_singleton()->mesh_add_surface_from_arrays(grid[i],VisualServer::PRIMITIVE_LINES,d); + VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat->get_rid()); grid_instance[i] = VisualServer::get_singleton()->instance_create2(grid[i],get_tree()->get_root()->get_world()->get_scenario()); grid_visible[i]=false; @@ -3211,8 +3238,8 @@ void SpatialEditor::_init_indicators() { d[VisualServer::ARRAY_VERTEX]=origin_points; d[VisualServer::ARRAY_COLOR]=origin_colors; - VisualServer::get_singleton()->mesh_add_surface(origin,VisualServer::PRIMITIVE_LINES,d); - VisualServer::get_singleton()->mesh_surface_set_material(origin,0,indicator_mat); + VisualServer::get_singleton()->mesh_add_surface_from_arrays(origin,VisualServer::PRIMITIVE_LINES,d); + VisualServer::get_singleton()->mesh_surface_set_material(origin,0,indicator_mat->get_rid()); // origin = VisualServer::get_singleton()->poly_create(); @@ -3243,17 +3270,15 @@ void SpatialEditor::_init_indicators() { cursor_points.push_back(Vector3(0,-cs,0)); cursor_points.push_back(Vector3(0,0,+cs)); cursor_points.push_back(Vector3(0,0,-cs)); - cursor_material=VisualServer::get_singleton()->fixed_material_create(); - VisualServer::get_singleton()->fixed_material_set_param(cursor_material,VS::FIXED_MATERIAL_PARAM_DIFFUSE,Color(0,1,1)); - VisualServer::get_singleton()->material_set_flag( cursor_material, VisualServer::MATERIAL_FLAG_UNSHADED, true ); - VisualServer::get_singleton()->fixed_material_set_flag(cursor_material, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA,true); - VisualServer::get_singleton()->fixed_material_set_flag(cursor_material, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true); + cursor_material.instance(); + cursor_material->set_albedo(Color(0,1,1)); + cursor_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); Array d; d.resize(VS::ARRAY_MAX); d[VS::ARRAY_VERTEX]=cursor_points; - VisualServer::get_singleton()->mesh_add_surface(cursor_mesh,VS::PRIMITIVE_LINES,d); - VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh,0,cursor_material); + VisualServer::get_singleton()->mesh_add_surface_from_arrays(cursor_mesh,VS::PRIMITIVE_LINES,d); + VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh,0,cursor_material->get_rid()); cursor_instance = VisualServer::get_singleton()->instance_create2(cursor_mesh,get_tree()->get_root()->get_world()->get_scenario()); VS::get_singleton()->instance_set_layer_mask(cursor_instance,1<<SpatialEditorViewport::GIZMO_GRID_LAYER); @@ -3271,11 +3296,11 @@ void SpatialEditor::_init_indicators() { float gizmo_alph = EditorSettings::get_singleton()->get("3d_editor/manipulator_gizmo_opacity"); - gizmo_hl = Ref<FixedMaterial>( memnew( FixedMaterial ) ); - gizmo_hl->set_flag(Material::FLAG_UNSHADED, true); - gizmo_hl->set_flag(Material::FLAG_ONTOP, true); - gizmo_hl->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - gizmo_hl->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,gizmo_alph+0.2f)); + gizmo_hl = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial ) ); + gizmo_hl->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + gizmo_hl->set_flag(FixedSpatialMaterial::FLAG_ONTOP, true); + gizmo_hl->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + gizmo_hl->set_albedo(Color(1,1,1,gizmo_alph+0.2f)); for(int i=0;i<3;i++) { @@ -3283,14 +3308,14 @@ void SpatialEditor::_init_indicators() { rotate_gizmo[i]=Ref<Mesh>( memnew( Mesh ) ); - Ref<FixedMaterial> mat = memnew( FixedMaterial ); - mat->set_flag(Material::FLAG_UNSHADED, true); - mat->set_flag(Material::FLAG_ONTOP, true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); + Ref<FixedSpatialMaterial> mat = memnew( FixedSpatialMaterial ); + mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP, true); + mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); Color col; col[i]=1.0; col.a= gizmo_alph; - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,col); + mat->set_albedo(col); gizmo_color[i]=mat; @@ -3436,8 +3461,6 @@ void SpatialEditor::_finish_indicators() { VisualServer::get_singleton()->free(cursor_instance); VisualServer::get_singleton()->free(cursor_mesh); - VisualServer::get_singleton()->free(indicator_mat); - VisualServer::get_singleton()->free(cursor_material); } void SpatialEditor::_instance_scene() { @@ -3730,7 +3753,7 @@ void SpatialEditor::clear() { settings_default_light_rot_x=Math_PI*0.3; settings_default_light_rot_y=Math_PI*0.2; - viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15)); + //viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15)); settings_ambient_color->set_color(Color(0.15,0.15,0.15)); if (!light_instance.is_valid()) _menu_item_pressed(MENU_VIEW_USE_DEFAULT_LIGHT); @@ -3743,7 +3766,7 @@ void SpatialEditor::clear() { void SpatialEditor::_update_ambient_light_color(const Color& p_color) { - viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,settings_ambient_color->get_color()); +// viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,settings_ambient_color->get_color()); } @@ -3982,7 +4005,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { - settings_light_base = memnew( Control ); + settings_light_base = memnew( ViewportContainer ); settings_light_base->set_custom_minimum_size(Size2(128,128)); settings_light_base->connect("input_event",this,"_default_light_angle_input"); settings_vbc->add_margin_child(TTR("Default Light Normal:"),settings_light_base); @@ -4013,8 +4036,8 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { settings_vbc->add_margin_child(TTR("Ambient Light Color:"),settings_ambient_color); settings_ambient_color->connect("color_changed",this,"_update_ambient_light_color"); - viewport_environment->set_enable_fx(Environment::FX_AMBIENT_LIGHT,true); - viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15)); +// viewport_environment->set_enable_fx(Environment::FX_AMBIENT_LIGHT,true); +// viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15)); settings_ambient_color->set_color(Color(0.15,0.15,0.15)); diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index 89587526ee..deed5072d4 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -332,8 +332,8 @@ private: bool grid_enabled; Ref<Mesh> move_gizmo[3], rotate_gizmo[3]; - Ref<FixedMaterial> gizmo_color[3]; - Ref<FixedMaterial> gizmo_hl; + Ref<FixedSpatialMaterial> gizmo_color[3]; + Ref<FixedSpatialMaterial> gizmo_hl; int over_gizmo_handle; @@ -345,8 +345,8 @@ private: RID indicators_instance; RID cursor_mesh; RID cursor_instance; - RID indicator_mat; - RID cursor_material; + Ref<FixedSpatialMaterial> indicator_mat; + Ref<FixedSpatialMaterial> cursor_material; /* struct Selected { @@ -431,7 +431,7 @@ private: float settings_default_light_rot_x; float settings_default_light_rot_y; - Control *settings_light_base; + ViewportContainer *settings_light_base; Viewport *settings_light_vp; ColorPickerButton *settings_ambient_color; Image settings_light_dir_image; diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp index 41beaa96a1..161b7bbdf6 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.h b/tools/editor/plugins/sprite_frames_editor_plugin.h index f0aa84c23a..e4cd8884d6 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.h +++ b/tools/editor/plugins/sprite_frames_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/stream_editor_plugin.cpp b/tools/editor/plugins/stream_editor_plugin.cpp index d896784074..06ae4c33cf 100644 --- a/tools/editor/plugins/stream_editor_plugin.cpp +++ b/tools/editor/plugins/stream_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/stream_editor_plugin.h b/tools/editor/plugins/stream_editor_plugin.h index 5730612d61..13fb558a71 100644 --- a/tools/editor/plugins/stream_editor_plugin.h +++ b/tools/editor/plugins/stream_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/style_box_editor_plugin.cpp b/tools/editor/plugins/style_box_editor_plugin.cpp index d5c885bd55..b14046ff03 100644 --- a/tools/editor/plugins/style_box_editor_plugin.cpp +++ b/tools/editor/plugins/style_box_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/style_box_editor_plugin.h b/tools/editor/plugins/style_box_editor_plugin.h index 737f830bbb..c4649bcbb8 100644 --- a/tools/editor/plugins/style_box_editor_plugin.h +++ b/tools/editor/plugins/style_box_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp index 6b918e6e8f..3b9b387001 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.cpp +++ b/tools/editor/plugins/texture_region_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Author: Mariano Suligoy */ /* */ @@ -388,9 +388,9 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input) drag_index = -1; } } - } else if (mb.button_index == BUTTON_WHEEL_UP) { + } else if (mb.button_index == BUTTON_WHEEL_UP && mb.pressed) { _zoom_in(); - } else if (mb.button_index == BUTTON_WHEEL_DOWN) { + } else if (mb.button_index == BUTTON_WHEEL_DOWN && mb.pressed) { _zoom_out(); } } else if (p_input.type==InputEvent::MOUSE_MOTION) { @@ -507,8 +507,8 @@ void TextureRegionEditor::_scroll_changed(float) void TextureRegionEditor::_set_snap_mode(int p_mode) { - snap_mode = p_mode; snap_mode_button->get_popup()->set_item_checked(snap_mode,false); + snap_mode = p_mode; snap_mode_button->set_text(snap_mode_button->get_popup()->get_item_text(p_mode)); snap_mode_button->get_popup()->set_item_checked(snap_mode,true); diff --git a/tools/editor/plugins/texture_region_editor_plugin.h b/tools/editor/plugins/texture_region_editor_plugin.h index f0bb7c9bc2..35eb7d06bc 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.h +++ b/tools/editor/plugins/texture_region_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Author: Mariano Suligoy */ /* */ diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index 84568aa8c0..3f5064b86a 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/theme_editor_plugin.h b/tools/editor/plugins/theme_editor_plugin.h index ea8f8c1d3c..e8f37e265f 100644 --- a/tools/editor/plugins/theme_editor_plugin.h +++ b/tools/editor/plugins/theme_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index 43fe7d7ea9..5d4e3fd874 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -289,7 +289,7 @@ void TileMapEditor::_pick_tile(const Point2& p_pos) { canvas_item_editor->update(); } -DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase) { +DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase, bool preview) { int prev_id = node->get_cell(p_start.x, p_start.y); int id = TileMap::INVALID_CELL; @@ -300,10 +300,39 @@ DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase) return DVector<Vector2>(); } - Rect2 r = node->get_item_rect(); + Rect2i r = node->get_item_rect(); r.pos = r.pos/node->get_cell_size(); r.size = r.size/node->get_cell_size(); + int area = r.get_area(); + if(preview) { + // Test if we can re-use the result from preview bucket fill + bool invalidate_cache = false; + // Area changed + if(r != bucket_cache_rect) + _clear_bucket_cache(); + // Cache grid is not initialized + if(bucket_cache_visited == 0) { + bucket_cache_visited = new bool[area]; + invalidate_cache = true; + } + // Tile ID changed or position wasn't visited by the previous fill + int loc = (p_start.x - r.get_pos().x) + (p_start.y - r.get_pos().y) * r.get_size().x; + if(prev_id != bucket_cache_tile || !bucket_cache_visited[loc]) { + invalidate_cache = true; + } + if(invalidate_cache) { + for(int i = 0; i < area; ++i) + bucket_cache_visited[i] = false; + bucket_cache = DVector<Vector2>(); + bucket_cache_tile = prev_id; + bucket_cache_rect = r; + } + else { + return bucket_cache; + } + } + DVector<Vector2> points; List<Point2i> queue; @@ -319,9 +348,17 @@ DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase) if (node->get_cell(n.x, n.y) == prev_id) { - node->set_cellv(n, id, flip_h, flip_v, transpose); - - points.push_back(n); + if(preview) { + int loc = (n.x - r.get_pos().x) + (n.y - r.get_pos().y) * r.get_size().x; + if(bucket_cache_visited[loc]) + continue; + bucket_cache_visited[loc] = true; + bucket_cache.push_back(n); + } + else { + node->set_cellv(n, id, flip_h, flip_v, transpose); + points.push_back(n); + } queue.push_back(n + Point2i(0, 1)); queue.push_back(n + Point2i(0, -1)); @@ -330,7 +367,7 @@ DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase) } } - return points; + return preview ? bucket_cache : points; } void TileMapEditor::_fill_points(const DVector<Vector2> p_points, const Dictionary& p_op) { @@ -468,6 +505,25 @@ void TileMapEditor::_draw_cell(int p_cell, const Point2i& p_point, bool p_flip_h canvas_item_editor->draw_texture_rect_region(t, rect, r, Color(1,1,1,0.5), p_transpose); } +void TileMapEditor::_draw_fill_preview(int p_cell, const Point2i& p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Matrix32& p_xform) { + + DVector<Vector2> points = _bucket_fill(p_point, false, true); + DVector<Vector2>::Read pr = points.read(); + int len = points.size(); + int time_after = OS::get_singleton()->get_ticks_msec(); + + for(int i = 0; i < len; ++i) { + _draw_cell(p_cell, pr[i], p_flip_h, p_flip_v, p_transpose, p_xform); + } +} + +void TileMapEditor::_clear_bucket_cache() { + if(bucket_cache_visited) { + delete[] bucket_cache_visited; + bucket_cache_visited = 0; + } +} + void TileMapEditor::_update_copydata() { copydata.clear(); @@ -1148,8 +1204,8 @@ void TileMapEditor::_canvas_draw() { canvas_item_editor->draw_line(endpoints[i],endpoints[(i+1)%4],col,2); - if (tool==TOOL_SELECTING || tool==TOOL_PICKING || tool==TOOL_BUCKET) { - + bool bucket_preview = EditorSettings::get_singleton()->get("tile_map/bucket_fill_preview"); + if (tool==TOOL_SELECTING || tool==TOOL_PICKING || !bucket_preview) { return; } @@ -1214,6 +1270,11 @@ void TileMapEditor::_canvas_draw() { canvas_item_editor->draw_colored_polygon(points, Color(0.2,1.0,0.8,0.2)); + } else if(tool == TOOL_BUCKET) { + + int tile = get_selected_tile(); + _draw_fill_preview(tile, over_tile, flip_h, flip_v, transpose, xform); + } else { int st = get_selected_tile(); @@ -1264,6 +1325,8 @@ void TileMapEditor::edit(Node *p_tile_map) { if (node) node->connect("settings_changed",this,"_tileset_settings_changed"); + _clear_bucket_cache(); + } void TileMapEditor::_tileset_settings_changed() { @@ -1365,6 +1428,9 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { flip_v=false; transpose=false; + bucket_cache_tile = -1; + bucket_cache_visited = 0; + ED_SHORTCUT("tile_map_editor/erase_selection", TTR("Erase selection"), KEY_DELETE); ED_SHORTCUT("tile_map_editor/find_tile", TTR("Find tile"), KEY_MASK_CMD+KEY_F); ED_SHORTCUT("tile_map_editor/transpose", TTR("Transpose")); @@ -1479,6 +1545,10 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { rotate_0->set_pressed(true); } +TileMapEditor::~TileMapEditor() { + _clear_bucket_cache(); +} + /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// @@ -1512,6 +1582,7 @@ TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) { EDITOR_DEF("tile_map/preview_size",64); EDITOR_DEF("tile_map/palette_item_hseparation",8); EDITOR_DEF("tile_map/show_tile_names", true); + EDITOR_DEF("tile_map/bucket_fill_preview", true); tile_map_editor = memnew( TileMapEditor(p_node) ); add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE, tile_map_editor); diff --git a/tools/editor/plugins/tile_map_editor_plugin.h b/tools/editor/plugins/tile_map_editor_plugin.h index 2f24002770..44b83fe745 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.h +++ b/tools/editor/plugins/tile_map_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -106,6 +106,11 @@ class TileMapEditor : public VBoxContainer { Point2i over_tile; + bool * bucket_cache_visited; + Rect2i bucket_cache_rect; + int bucket_cache_tile; + DVector<Vector2> bucket_cache; + struct CellOp { int idx; bool xf; @@ -129,7 +134,7 @@ class TileMapEditor : public VBoxContainer { void _pick_tile(const Point2& p_pos); - DVector<Vector2> _bucket_fill(const Point2i& p_start, bool erase=false); + DVector<Vector2> _bucket_fill(const Point2i& p_start, bool erase=false, bool preview=false); void _fill_points(const DVector<Vector2> p_points, const Dictionary& p_op); void _erase_points(const DVector<Vector2> p_points); @@ -137,6 +142,9 @@ class TileMapEditor : public VBoxContainer { void _select(const Point2i& p_from, const Point2i& p_to); void _draw_cell(int p_cell, const Point2i& p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Matrix32& p_xform); + void _draw_fill_preview(int p_cell, const Point2i& p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Matrix32& p_xform); + void _clear_bucket_cache(); + void _update_copydata(); int get_selected_tile() const; @@ -171,6 +179,7 @@ public: void edit(Node *p_tile_map); TileMapEditor(EditorNode *p_editor); + ~TileMapEditor(); }; class TileMapEditorPlugin : public EditorPlugin { diff --git a/tools/editor/plugins/tile_set_editor_plugin.cpp b/tools/editor/plugins/tile_set_editor_plugin.cpp index 39a15189e7..9172e0fc54 100644 --- a/tools/editor/plugins/tile_set_editor_plugin.cpp +++ b/tools/editor/plugins/tile_set_editor_plugin.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/plugins/tile_set_editor_plugin.h b/tools/editor/plugins/tile_set_editor_plugin.h index 3f47520e2a..36573c0e85 100644 --- a/tools/editor/plugins/tile_set_editor_plugin.h +++ b/tools/editor/plugins/tile_set_editor_plugin.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/progress_dialog.cpp b/tools/editor/progress_dialog.cpp index a950f7acfc..25cf0bdf01 100644 --- a/tools/editor/progress_dialog.cpp +++ b/tools/editor/progress_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/progress_dialog.h b/tools/editor/progress_dialog.h index c254d45753..8a6ab7696b 100644 --- a/tools/editor/progress_dialog.h +++ b/tools/editor/progress_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index 103962716b..afcd82644a 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -589,6 +589,11 @@ void ProjectExportDialog::custom_action(const String&) { return; } + if (platform.to_lower()=="android" && _check_android_setting(exporter)==false){ + // not filled all field for Android release + return; + } + String extension = exporter->get_binary_extension(); file_export_password->set_editable( exporter->requires_password(exporter->is_debugging_enabled()) ); @@ -602,6 +607,204 @@ void ProjectExportDialog::custom_action(const String&) { } +LineEdit* ProjectExportDialog::_create_keystore_input(Control* container, const String& p_label, const String& name) { + + HBoxContainer* hb=memnew(HBoxContainer); + Label* lb=memnew(Label); + LineEdit* input=memnew(LineEdit); + + lb->set_text(p_label); + lb->set_custom_minimum_size(Size2(140*EDSCALE,0)); + lb->set_align(Label::ALIGN_RIGHT); + + input->set_custom_minimum_size(Size2(170*EDSCALE,0)); + input->set_name(name); + + hb->add_constant_override("separation", 10*EDSCALE); + hb->add_child(lb); + hb->add_child(input); + container->add_child(hb); + + return input; + +} + +void ProjectExportDialog::_create_android_keystore_window() { + + keystore_file_dialog = memnew( EditorFileDialog ); + add_child(keystore_file_dialog); + keystore_file_dialog->set_mode(EditorFileDialog::MODE_OPEN_DIR); + keystore_file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); + keystore_file_dialog->set_current_dir( "res://" ); + + keystore_file_dialog->set_title(TTR("Target Path:")); + keystore_file_dialog->connect("dir_selected", this,"_keystore_dir_selected"); + + keystore_create_dialog=memnew(ConfirmationDialog); + VBoxContainer* vb=memnew(VBoxContainer); + vb->set_size(Size2(340*EDSCALE,0)); + keystore_create_dialog->set_title(TTR("Create Android keystore")); + + _create_keystore_input(vb, TTR("Full name"), "name"); + _create_keystore_input(vb, TTR("Organizational unit"), "unit"); + _create_keystore_input(vb, TTR("Organization"), "org"); + _create_keystore_input(vb, TTR("City"), "city"); + _create_keystore_input(vb, TTR("State"), "state"); + _create_keystore_input(vb, TTR("2 letter country code"), "code"); + _create_keystore_input(vb, TTR("User alias"), "alias"); + LineEdit* pass=_create_keystore_input(vb, TTR("Password"), "pass"); + pass->set_placeholder(TTR("at least 6 characters")); + _create_keystore_input(vb, TTR("File name"), "file"); + + Label* lb_path=memnew(Label); + LineEdit* path=memnew(LineEdit); + Button* btn=memnew(Button); + HBoxContainer* hb=memnew(HBoxContainer); + + lb_path->set_text(TTR("Path : (better to save outside of project)")); + path->set_h_size_flags(SIZE_EXPAND_FILL); + path->set_name("path"); + btn->set_text(" .. "); + btn->connect("pressed", keystore_file_dialog, "popup_centered_ratio"); + + vb->add_spacer(); + vb->add_child(lb_path); + hb->add_child(path); + hb->add_child(btn); + vb->add_child(hb); + + keystore_create_dialog->add_child(vb); + keystore_create_dialog->set_child_rect(vb); + add_child(keystore_create_dialog); + + keystore_create_dialog->connect("confirmed", this, "_create_android_keystore"); + path->connect("text_changed", this, "_check_keystore_path"); + + confirm_keystore = memnew(ConfirmationDialog); + confirm_keystore->connect("confirmed", keystore_create_dialog, "popup_centered_minsize"); + add_child(confirm_keystore); + +} + +void ProjectExportDialog::_keystore_dir_selected(const String& path) { + + LineEdit* edit=keystore_create_dialog->find_node("path", true, false)->cast_to<LineEdit>(); + edit->set_text(path.simplify_path()); + +} + +void ProjectExportDialog::_keystore_created() { + + if (error->is_connected("popup_hide", this, "_keystore_created")){ + error->disconnect("popup_hide", this, "_keystore_created"); + } + custom_action("export_pck"); + +} + +void ProjectExportDialog::_check_keystore_path(const String& path) { + + LineEdit* edit=keystore_create_dialog->find_node("path", true, false)->cast_to<LineEdit>(); + bool exists = DirAccess::exists(path); + if (!exists) { + edit->add_color_override("font_color", Color(1,0,0,1)); + } else { + edit->add_color_override("font_color", Color(0,1,0,1)); + } + +} + +void ProjectExportDialog::_create_android_keystore() { + + Vector<String> names=String("name,unit,org,city,state,code,alias,pass").split(","); + String path=keystore_create_dialog->find_node("path", true, false)->cast_to<LineEdit>()->get_text(); + String file=keystore_create_dialog->find_node("file", true, false)->cast_to<LineEdit>()->get_text(); + + if (file.ends_with(".keystore")==false) { + file+=".keystore"; + } + String fullpath=path.plus_file(file); + String info="CN=$name, OU=$unit, O=$org, L=$city, S=$state, C=$code"; + Dictionary dic; + + for (int i=0;i<names.size();i++){ + LineEdit* edit = keystore_create_dialog->find_node(names[i], true, false)->cast_to<LineEdit>(); + dic[names[i]]=edit->get_text(); + info=info.replace("$"+names[i], edit->get_text()); + } + + String jarsigner=EditorSettings::get_singleton()->get("android/jarsigner"); + String keytool=jarsigner.get_base_dir().plus_file("keytool"); + String os_name=OS::get_singleton()->get_name(); + if (os_name.to_lower()=="windows") { + keytool+=".exe"; + } + + bool exist=FileAccess::exists(keytool); + if (!exist) { + error->set_text("Can't find 'keytool'"); + error->popup_centered_minsize(); + return; + } + + List<String> args; + args.push_back("-genkey"); + args.push_back("-v"); + args.push_back("-keystore"); + args.push_back(fullpath); + args.push_back("-alias"); + args.push_back(dic["alias"]); + args.push_back("-storepass"); + args.push_back(dic["pass"]); + args.push_back("-keypass"); + args.push_back(dic["pass"]); + args.push_back("-keyalg"); + args.push_back("RSA"); + args.push_back("-keysize"); + args.push_back("2048"); + args.push_back("-validity"); + args.push_back("10000"); + args.push_back("-dname"); + args.push_back(info); + int retval; + OS::get_singleton()->execute(keytool,args,true,NULL,NULL,&retval); + + if (retval==0) { // success + platform_options->_edit_set("keystore/release", fullpath); + platform_options->_edit_set("keystore/release_user", dic["alias"]); + platform_options->_edit_set("keystore/release_password", dic["pass"]); + + error->set_text("Android keystore created at \n"+fullpath); + error->connect("popup_hide", this, "_keystore_created"); + error->popup_centered_minsize(); + } else { // fail + error->set_text("Fail to create android keystore at \n"+fullpath); + error->popup_centered_minsize(); + } + +} + +bool ProjectExportDialog::_check_android_setting(const Ref<EditorExportPlatform>& exporter) { + + bool is_debugging = exporter->get("debug/debugging_enabled"); + String release = exporter->get("keystore/release"); + String user = exporter->get("keystore/release_user"); + String password = exporter->get("keystore/release_password"); + + if (!is_debugging && (release=="" || user=="" || password=="")){ + if (release==""){ + confirm_keystore->set_text(TTR("Release keystore is not set.\nDo you want to create one?")); + confirm_keystore->popup_centered_minsize(); + } else { + error->set_text(TTR("Fill Keystore/Release User and Release Password")); + error->popup_centered_minsize(); + } + return false; + } + + return true; + +} void ProjectExportDialog::_group_selected() { @@ -1123,6 +1326,10 @@ void ProjectExportDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("export_platform"),&ProjectExportDialog::export_platform); + ObjectTypeDB::bind_method(_MD("_create_android_keystore"),&ProjectExportDialog::_create_android_keystore); + ObjectTypeDB::bind_method(_MD("_check_keystore_path"),&ProjectExportDialog::_check_keystore_path); + ObjectTypeDB::bind_method(_MD("_keystore_dir_selected"),&ProjectExportDialog::_keystore_dir_selected); + ObjectTypeDB::bind_method(_MD("_keystore_created"),&ProjectExportDialog::_keystore_created); // ADD_SIGNAL(MethodInfo("instance")); @@ -1479,6 +1686,8 @@ ProjectExportDialog::ProjectExportDialog(EditorNode *p_editor) { ei="EditorIcons"; ot="Object"; pending_update_tree=true; + + _create_android_keystore_window(); } diff --git a/tools/editor/project_export.h b/tools/editor/project_export.h index 8cf2bf3afc..cd790ea42f 100644 --- a/tools/editor/project_export.h +++ b/tools/editor/project_export.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -73,6 +73,7 @@ private: bool pending_update_tree; AcceptDialog *error; ConfirmationDialog *confirm; + ConfirmationDialog *confirm_keystore; Button *button_reload; LineEdit *filters, *filters_exclude; @@ -145,6 +146,9 @@ private: SpinBox *sample_max_hz; CheckButton *sample_trim; + ConfirmationDialog* keystore_create_dialog; + EditorFileDialog* keystore_file_dialog; + void _export_mode_changed(int p_idx); void _prop_edited(String what); @@ -190,6 +194,13 @@ private: void _export_action_pck(const String& p_file); void ok_pressed(); void custom_action(const String&); + LineEdit* _create_keystore_input(Control* container, const String& p_label, const String& name); + void _create_android_keystore_window(); + void _create_android_keystore(); + bool _check_android_setting(const Ref<EditorExportPlatform>& exporter); + void _check_keystore_path(const String& path); + void _keystore_dir_selected(const String& path); + void _keystore_created(); void _save_export_cfg(); void _format_toggled(); diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index 1c99982155..af2a18ce2b 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -75,15 +75,22 @@ private: String zip_title; AcceptDialog *dialog_error; - bool _test_path() { + String _test_path() { error->set_text(""); get_ok()->set_disabled(true); DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - if (project_path->get_text() != "" && d->change_dir(project_path->get_text())!=OK) { + String valid_path; + if (d->change_dir(project_path->get_text())==OK){ + valid_path=project_path->get_text(); + } else if (d->change_dir(project_path->get_text().strip_edges())==OK) { + valid_path=project_path->get_text().strip_edges(); + } + + if (valid_path == "") { error->set_text(TTR("Invalid project path, the path must exist!")); memdelete(d); - return false; + return ""; } if (mode!=MODE_IMPORT) { @@ -92,30 +99,29 @@ private: error->set_text(TTR("Invalid project path, engine.cfg must not exist.")); memdelete(d); - return false; + return ""; } } else { - if (project_path->get_text() != "" && !d->file_exists("engine.cfg")) { + if (valid_path != "" && !d->file_exists("engine.cfg")) { error->set_text(TTR("Invalid project path, engine.cfg must exist.")); memdelete(d); - return false; + return ""; } } memdelete(d); get_ok()->set_disabled(false); - return true; + return valid_path; } void _path_text_changed(const String& p_path) { - if ( _test_path() ) { - - String sp=p_path; + String sp=_test_path(); + if ( sp!="" ) { sp=sp.replace("\\","/"); int lidx=sp.find_last("/"); @@ -141,7 +147,7 @@ private: } String sp = p.simplify_path(); project_path->set_text(sp); - _path_text_changed(p); + _path_text_changed(sp); get_ok()->call_deferred("grab_focus"); } @@ -150,7 +156,7 @@ private: String p = p_path; String sp = p.simplify_path(); project_path->set_text(sp); - _path_text_changed(p); + _path_text_changed(sp); get_ok()->call_deferred("grab_focus"); } @@ -173,27 +179,15 @@ private: void ok_pressed() { - if (!_test_path()) + String dir=_test_path(); + if (dir=="") { + error->set_text(TTR("Invalid project path (changed anything?).")); return; - - String dir; + } if (mode==MODE_IMPORT) { - dir=project_path->get_text(); - - + // nothing to do } else { - DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - - if (d->change_dir(project_path->get_text())!=OK) { - error->set_text(TTR("Invalid project path (changed anything?).")); - memdelete(d); - return; - } - - dir=d->get_current_dir(); - memdelete(d); - if (mode==MODE_NEW) { @@ -321,8 +315,6 @@ private: } - - } dir=dir.replace("\\","/"); @@ -335,7 +327,7 @@ private: hide(); - emit_signal("project_created"); + emit_signal("project_created", dir); } @@ -402,7 +394,7 @@ public: popup_centered(Size2(500,125)*EDSCALE); } - + project_path->grab_focus(); _test_path(); } @@ -871,7 +863,7 @@ void ProjectManager::_load_recent_projects() { TextureButton *favorite = memnew( TextureButton ); favorite->set_normal_texture(favorite_icon); if (!is_favorite) - favorite->set_opacity(0.2); + favorite->set_modulate(Color(1,1,1,0.2)); favorite->set_v_size_flags(SIZE_EXPAND); favorite->connect("pressed",this,"_favorite_pressed",varray(hb)); favorite_box->add_child(favorite); @@ -882,6 +874,7 @@ void ProjectManager::_load_recent_projects() { hb->add_child(tf); VBoxContainer *vb = memnew(VBoxContainer); + vb->set_name("project"); hb->add_child(vb); Control *ec = memnew( Control ); ec->set_custom_minimum_size(Size2(0,1)); @@ -891,8 +884,9 @@ void ProjectManager::_load_recent_projects() { title->add_color_override("font_color",font_color); vb->add_child(title); Label *fpath = memnew( Label(path) ); + fpath->set_name("path"); vb->add_child(fpath); - fpath->set_opacity(0.5); + fpath->set_modulate(Color(1,1,1,0.5)); fpath->add_color_override("font_color",font_color); scroll_childs->add_child(hb); @@ -912,6 +906,43 @@ void ProjectManager::_load_recent_projects() { tabs->set_current_tab(0); } +void ProjectManager::_on_project_created(const String& dir) { + bool has_already=false; + for (int i=0;i<scroll_childs->get_child_count();i++) { + HBoxContainer *hb=scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + Label *fpath=hb->get_node(NodePath("project/path"))->cast_to<Label>(); + if (fpath->get_text()==dir) { + has_already=true; + break; + } + } + if (has_already) { + _update_scroll_pos(dir); + } else { + _load_recent_projects(); + scroll->connect("draw", this, "_update_scroll_pos", varray(dir), CONNECT_ONESHOT); + } +} + +void ProjectManager::_update_scroll_pos(const String& dir) { + for (int i=0;i<scroll_childs->get_child_count();i++) { + HBoxContainer *hb=scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + Label *fpath=hb->get_node(NodePath("project/path"))->cast_to<Label>(); + if (fpath->get_text()==dir) { + last_clicked=hb->get_meta("name"); + selected_list.clear(); + selected_list.insert(hb->get_meta("name"), hb->get_meta("main_scene")); + _update_project_buttons(); + int last_y_visible=scroll->get_v_scroll()+scroll->get_size().y; + int offset_diff=(hb->get_pos().y + hb->get_size().y)-last_y_visible; + + if (offset_diff>0) + scroll->set_v_scroll(scroll->get_v_scroll()+offset_diff); + break; + } + } +} + void ProjectManager::_open_project_confirm() { for (Map<String,String>::Element *E=selected_list.front(); E; E=E->next()) { @@ -1123,7 +1154,7 @@ void ProjectManager::_files_dropped(StringArray p_files, int p_screen) { dir->list_dir_begin(); String file = dir->get_next(); while(confirm && file!=String()) { - if (!da->current_is_dir() && file.ends_with("engine.cfg")) { + if (!dir->current_is_dir() && file.ends_with("engine.cfg")) { confirm = false; } file = dir->get_next(); @@ -1164,6 +1195,8 @@ void ProjectManager::_bind_methods() { ObjectTypeDB::bind_method("_erase_project_confirm",&ProjectManager::_erase_project_confirm); ObjectTypeDB::bind_method("_exit_dialog",&ProjectManager::_exit_dialog); ObjectTypeDB::bind_method("_load_recent_projects",&ProjectManager::_load_recent_projects); + ObjectTypeDB::bind_method("_on_project_created",&ProjectManager::_on_project_created); + ObjectTypeDB::bind_method("_update_scroll_pos",&ProjectManager::_update_scroll_pos); ObjectTypeDB::bind_method("_panel_draw",&ProjectManager::_panel_draw); ObjectTypeDB::bind_method("_panel_input",&ProjectManager::_panel_input); ObjectTypeDB::bind_method("_unhandled_input",&ProjectManager::_unhandled_input); @@ -1223,7 +1256,7 @@ ProjectManager::ProjectManager() { String cp; cp.push_back(0xA9); cp.push_back(0); - OS::get_singleton()->set_window_title(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")+" - "+cp+" 2008-2016 Juan Linietsky, Ariel Manzur."); + OS::get_singleton()->set_window_title(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")+" - "+cp+" 2008-2017 Juan Linietsky, Ariel Manzur."); HBoxContainer *top_hb = memnew( HBoxContainer); vb->add_child(top_hb); @@ -1382,7 +1415,7 @@ ProjectManager::ProjectManager() { npdialog = memnew( NewProjectDialog ); gui_base->add_child(npdialog); - npdialog->connect("project_created", this,"_load_recent_projects"); + npdialog->connect("project_created", this,"_on_project_created"); _load_recent_projects(); if ( EditorSettings::get_singleton()->get("global/autoscan_project_path") ) { diff --git a/tools/editor/project_manager.h b/tools/editor/project_manager.h index 46f7aea3a5..d30d1afd83 100644 --- a/tools/editor/project_manager.h +++ b/tools/editor/project_manager.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -85,6 +85,8 @@ class ProjectManager : public Control { void _scan_begin(const String& p_base); void _load_recent_projects(); + void _on_project_created(const String& dir); + void _update_scroll_pos(const String& dir); void _scan_dir(DirAccess *da,float pos, float total,List<String> *r_projects); void _install_project(const String& p_zip_path,const String& p_title); diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 02d95abfa2..7cf99c51fe 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h index 61ad094d00..e3b7a5eba9 100644 --- a/tools/editor/project_settings.h +++ b/tools/editor/project_settings.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index ef6b1aa47c..f50128ee28 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index 3fe332bf87..1792b34d60 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -219,6 +219,8 @@ class PropertyEditor : public Control { void _edit_button(Object *p_item, int p_column, int p_button); void _node_removed(Node *p_node); + +friend class ProjectExportDialog; void _edit_set(const String& p_name, const Variant& p_value); void _draw_flags(Object *ti,const Rect2& p_rect); diff --git a/tools/editor/pvrtc_compress.cpp b/tools/editor/pvrtc_compress.cpp index 75b5c69bc2..e9ef311e79 100644 --- a/tools/editor/pvrtc_compress.cpp +++ b/tools/editor/pvrtc_compress.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -85,7 +85,7 @@ static void _compress_image(Image::CompressMode p_mode,Image *p_image) { if (EditorSettings::get_singleton()->get("PVRTC/fast_conversion").operator bool()) { args.push_back("-pvrtcfast"); } - if (p_image->get_mipmaps()>0) + if (p_image->has_mipmaps()) args.push_back("-m"); Ref<ImageTexture> t = memnew( ImageTexture ); diff --git a/tools/editor/pvrtc_compress.h b/tools/editor/pvrtc_compress.h index 129faee080..4ba29026c5 100644 --- a/tools/editor/pvrtc_compress.h +++ b/tools/editor/pvrtc_compress.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/quick_open.cpp b/tools/editor/quick_open.cpp index e18dc584d5..5339705ccf 100644 --- a/tools/editor/quick_open.cpp +++ b/tools/editor/quick_open.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/quick_open.h b/tools/editor/quick_open.h index c253f7606e..6177fc735e 100644 --- a/tools/editor/quick_open.h +++ b/tools/editor/quick_open.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/register_exporters.h b/tools/editor/register_exporters.h index dccaa0641f..30ec522a00 100644 --- a/tools/editor/register_exporters.h +++ b/tools/editor/register_exporters.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/reparent_dialog.cpp b/tools/editor/reparent_dialog.cpp index 38b0372232..fb2ecae55a 100644 --- a/tools/editor/reparent_dialog.cpp +++ b/tools/editor/reparent_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/reparent_dialog.h b/tools/editor/reparent_dialog.h index 1c0fbd2459..0d67b38daa 100644 --- a/tools/editor/reparent_dialog.h +++ b/tools/editor/reparent_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/resources_dock.cpp b/tools/editor/resources_dock.cpp index c73c8c081c..f3909db1a5 100644 --- a/tools/editor/resources_dock.cpp +++ b/tools/editor/resources_dock.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/resources_dock.h b/tools/editor/resources_dock.h index 978291fc3f..6340863a61 100644 --- a/tools/editor/resources_dock.h +++ b/tools/editor/resources_dock.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/run_settings_dialog.cpp b/tools/editor/run_settings_dialog.cpp index abcfe125f3..437c43e83c 100644 --- a/tools/editor/run_settings_dialog.cpp +++ b/tools/editor/run_settings_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/run_settings_dialog.h b/tools/editor/run_settings_dialog.h index 09319702f3..b632e0eda4 100644 --- a/tools/editor/run_settings_dialog.h +++ b/tools/editor/run_settings_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 16f06c7ac9..293329f440 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -80,11 +80,11 @@ void SceneTreeDock::_unhandled_key_input(InputEvent p_event) { else if (ED_IS_SHORTCUT("scene_tree/duplicate", p_event)) { _tool_selected(TOOL_DUPLICATE); } - else if (ED_IS_SHORTCUT("scene_tree/add_script", p_event)) { - _tool_selected(TOOL_CREATE_SCRIPT); + else if (ED_IS_SHORTCUT("scene_tree/attach_script", p_event)) { + _tool_selected(TOOL_ATTACH_SCRIPT); } - else if (ED_IS_SHORTCUT("scene_tree/load_script", p_event)) { - _tool_selected(TOOL_LOAD_SCRIPT); + else if(ED_IS_SHORTCUT("scene_tree/clear_script", p_event)) { + _tool_selected(TOOL_CLEAR_SCRIPT); } else if (ED_IS_SHORTCUT("scene_tree/move_up", p_event)) { _tool_selected(TOOL_MOVE_UP); @@ -269,24 +269,6 @@ void SceneTreeDock::_replace_with_branch_scene(const String& p_file,Node* base) scene_tree->set_selected(instanced_scene); } - -void SceneTreeDock::_file_selected(String p_file) { - RES p_script = ResourceLoader::load(p_file, "Script"); - if (p_script.is_null()) { - accept->get_ok()->set_text(TTR("Ugh")); - accept->set_text(vformat(TTR("Error loading script from %s"), p_file)); - accept->popup_centered_minsize(); - return; - } - - Node *selected = scene_tree->get_selected(); - if (!selected) - return; - selected->set_script(p_script.get_ref_ptr()); - editor->push_item(p_script.operator->()); - file_dialog->hide(); -} - bool SceneTreeDock::_cyclical_dependency_exists(const String& p_target_scene_path, Node* p_desired_node) { int childCount = p_desired_node->get_child_count(); @@ -379,22 +361,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { //groups_editor->set_current(current); //groups_editor->popup_centered_ratio(); } break; - case TOOL_LOAD_SCRIPT: { - Node *selected = scene_tree->get_selected(); - if (!selected) - break; - - file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); - - List<String> extensions; - ResourceLoader::get_recognized_extensions_for_type("Script", &extensions); - file_dialog->clear_filters(); - for (List<String>::Element *E = extensions.front(); E; E = E->next()) - file_dialog->add_filter("*." + E->get() + " ; " + E->get().to_upper()); - - file_dialog->popup_centered_ratio(); - } break; - case TOOL_CREATE_SCRIPT: { + case TOOL_ATTACH_SCRIPT: { Node *selected = scene_tree->get_selected(); if (!selected) @@ -415,6 +382,18 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } } break; + case TOOL_CLEAR_SCRIPT: { + Node *selected = scene_tree->get_selected(); + if(!selected) + break; + + Ref<Script> existing = selected->get_script(); + if(existing.is_valid()) { + const RefPtr empty; + selected->set_script(empty); + } + + } break; case TOOL_MOVE_UP: case TOOL_MOVE_DOWN: { @@ -502,6 +481,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; List<Node*> selection = editor_selection->get_selected_node_list(); + if (selection.size()==0) + break; List<Node*> reselect; @@ -707,8 +688,8 @@ void SceneTreeDock::_notification(int p_what) { } button_add->set_icon(get_icon("Add","EditorIcons")); button_instance->set_icon(get_icon("Instance","EditorIcons")); - button_create_script->set_icon(get_icon("Script","EditorIcons")); - button_load_script->set_icon(get_icon("Script", "EditorIcons")); + button_create_script->set_icon(get_icon("ScriptCreate","EditorIcons")); + button_clear_script->set_icon(get_icon("Remove", "EditorIcons")); filter_icon->set_texture(get_icon("Zoom","EditorIcons")); @@ -1338,12 +1319,18 @@ void SceneTreeDock::_selection_changed() { _tool_selected(TOOL_MULTI_EDIT); } - if (selection_size==1 && EditorNode::get_singleton()->get_editor_selection()->get_selection().front()->key()->get_script().is_null()) { - button_create_script->show(); - button_load_script->show(); + if (selection_size==1) { + if(EditorNode::get_singleton()->get_editor_selection()->get_selection().front()->key()->get_script().is_null()) { + button_create_script->show(); + button_clear_script->hide(); + } + else { + button_create_script->hide(); + button_clear_script->show(); + } } else { button_create_script->hide(); - button_load_script->hide(); + button_clear_script->hide(); } //tool_buttons[TOOL_MULTI_EDIT]->set_disabled(EditorNode::get_singleton()->get_editor_selection()->get_selection().size()<2); @@ -1603,7 +1590,7 @@ static bool _is_node_visible(Node* p_node) { static bool _has_visible_children(Node* p_node) { - bool collapsed = p_node->has_meta("_editor_collapsed") ? (bool)p_node->get_meta("_editor_collapsed") : false; + bool collapsed = p_node->is_displayed_folded(); if (collapsed) return false; @@ -1626,7 +1613,7 @@ static Node* _find_last_visible(Node* p_node) { Node* last=NULL; - bool collapsed = p_node->has_meta("_editor_collapsed") ? (bool)p_node->get_meta("_editor_collapsed") : false; + bool collapsed = p_node->is_displayed_folded(); if (!collapsed) { for(int i=0;i<p_node->get_child_count();i++) { @@ -1661,36 +1648,9 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos, int p_type) { ERR_EXPLAIN("Cannot perform drop above the root node!"); ERR_FAIL(); } - Node* upper_sibling=NULL; - - for(int i=0;i<to_node->get_index();i++) { - Node *c =to_node->get_parent()->get_child(i); - if (_is_node_visible(c)) { - upper_sibling=c; - } - } - - if (upper_sibling) { - //quite complicated, look for next visible in tree - upper_sibling=_find_last_visible(upper_sibling); - - if (upper_sibling->get_parent()==to_node->get_parent()) { - //just insert over this node because nothing is above at an upper level - to_pos=to_node->get_index(); - to_node=to_node->get_parent(); - } else { - to_pos=-1; //insert last in whathever is up - to_node=upper_sibling->get_parent(); //insert at a parent of whathever is up - } - - - } else { - //just insert over this node because nothing is above at the same level - to_pos=to_node->get_index(); - to_node=to_node->get_parent(); - - } + to_pos=to_node->get_index(); + to_node=to_node->get_parent(); } else if (p_type==1) { //drop at below selected node @@ -1823,8 +1783,8 @@ void SceneTreeDock::_tree_rmb(const Vector2& p_menu_pos) { //menu->add_icon_item(get_icon("Groups","EditorIcons"),TTR("Edit Groups"),TOOL_GROUP); //menu->add_icon_item(get_icon("Connect","EditorIcons"),TTR("Edit Connections"),TOOL_CONNECT); menu->add_separator(); - menu->add_icon_shortcut(get_icon("Script", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_script"), TOOL_CREATE_SCRIPT); - menu->add_icon_shortcut(get_icon("Script", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/load_script"), TOOL_LOAD_SCRIPT); + menu->add_icon_shortcut(get_icon("ScriptCreate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT); + menu->add_icon_shortcut(get_icon("Remove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT); menu->add_separator(); } @@ -1883,7 +1843,7 @@ void SceneTreeDock::_focus_node() { void SceneTreeDock::open_script_dialog(Node* p_for_node) { scene_tree->set_selected(p_for_node,false); - _tool_selected(TOOL_CREATE_SCRIPT); + _tool_selected(TOOL_ATTACH_SCRIPT); } void SceneTreeDock::_bind_methods() { @@ -1912,7 +1872,6 @@ void SceneTreeDock::_bind_methods() { ObjectTypeDB::bind_method(_MD("_tree_rmb"),&SceneTreeDock::_tree_rmb); ObjectTypeDB::bind_method(_MD("_filter_changed"),&SceneTreeDock::_filter_changed); ObjectTypeDB::bind_method(_MD("_focus_node"),&SceneTreeDock::_focus_node); - ObjectTypeDB::bind_method(_MD("_file_selected"), &SceneTreeDock::_file_selected); ObjectTypeDB::bind_method(_MD("instance"),&SceneTreeDock::instance); @@ -1936,8 +1895,8 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec ED_SHORTCUT("scene_tree/add_child_node",TTR("Add Child Node"), KEY_MASK_CMD|KEY_A); ED_SHORTCUT("scene_tree/instance_scene",TTR("Instance Child Scene")); ED_SHORTCUT("scene_tree/change_node_type", TTR("Change Type")); - ED_SHORTCUT("scene_tree/add_script", TTR("Add Script")); - ED_SHORTCUT("scene_tree/load_script", TTR("Load Script")); + ED_SHORTCUT("scene_tree/attach_script", TTR("Attach Script")); + ED_SHORTCUT("scene_tree/clear_script", TTR("Clear Script")); ED_SHORTCUT("scene_tree/move_up", TTR("Move Up"), KEY_MASK_CMD | KEY_UP); ED_SHORTCUT("scene_tree/move_down", TTR("Move Down"), KEY_MASK_CMD | KEY_DOWN); ED_SHORTCUT("scene_tree/duplicate", TTR("Duplicate"),KEY_MASK_CMD | KEY_D); @@ -1974,18 +1933,18 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec tb = memnew( ToolButton ); - tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_CREATE_SCRIPT, false)); - tb->set_tooltip(TTR("Create a new script for the selected node.")); - tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/add_script")); + tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_ATTACH_SCRIPT, false)); + tb->set_tooltip(TTR("Attach a new or existing script for the selected node.")); + tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/attach_script")); filter_hbc->add_child(tb); button_create_script=tb; tb = memnew(ToolButton); - tb->connect("pressed", this, "_tool_selected", make_binds(TOOL_LOAD_SCRIPT, false)); - tb->set_tooltip(TTR("Load a script for the selected node.")); - tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/load_script")); + tb->connect("pressed", this, "_tool_selected", make_binds(TOOL_CLEAR_SCRIPT, false)); + tb->set_tooltip(TTR("Clear a script for the selected node.")); + tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/clear_script")); filter_hbc->add_child(tb); - button_load_script = tb; + button_clear_script = tb; scene_tree = memnew( SceneTreeEditor(false,true,true )); @@ -2004,7 +1963,6 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec scene_tree->connect("nodes_dragged",this,"_nodes_drag_begin"); scene_tree->get_scene_tree()->connect("item_double_clicked", this, "_focus_node"); - scene_tree->get_scene_tree()->set_delayed_text_editor(true); scene_tree->set_undo_redo(&editor_data->get_undo_redo()); scene_tree->set_editor_selection(editor_selection); @@ -2015,11 +1973,6 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec add_child(create_dialog); create_dialog->connect("create",this,"_create"); - file_dialog = memnew(EditorFileDialog); - add_child(file_dialog); - file_dialog->hide(); - file_dialog->connect("file_selected", this, "_file_selected"); - //groups_editor = memnew( GroupsEditor ); //add_child(groups_editor); //groups_editor->set_undo_redo(&editor_data->get_undo_redo()); diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h index 36d4a6d208..0990437395 100644 --- a/tools/editor/scene_tree_dock.h +++ b/tools/editor/scene_tree_dock.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -58,8 +58,8 @@ class SceneTreeDock : public VBoxContainer { TOOL_REPLACE, TOOL_CONNECT, TOOL_GROUP, - TOOL_CREATE_SCRIPT, - TOOL_LOAD_SCRIPT, + TOOL_ATTACH_SCRIPT, + TOOL_CLEAR_SCRIPT, TOOL_MOVE_UP, TOOL_MOVE_DOWN, TOOL_DUPLICATE, @@ -76,12 +76,11 @@ class SceneTreeDock : public VBoxContainer { int current_option; CreateDialog *create_dialog; - EditorFileDialog *file_dialog; ToolButton *button_add; ToolButton *button_instance; ToolButton *button_create_script; - ToolButton *button_load_script; + ToolButton *button_clear_script; SceneTreeEditor *scene_tree; diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index f5628d0c8f..e0cc9573cd 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -208,13 +208,6 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id) if (n->is_type("Spatial")) { - Spatial *ci = n->cast_to<Spatial>(); - if (!ci->is_visible() && ci->get_parent_spatial() && !ci->get_parent_spatial()->is_visible()) { - error->set_text(TTR("This item cannot be made visible because the parent is hidden. Unhide the parent first.")); - error->popup_centered_minsize(); - return; - } - bool v = !bool(n->call("is_hidden")); undo_redo->create_action(TTR("Toggle Spatial Visible")); undo_redo->add_do_method(n,"_set_visible_",!v); @@ -222,12 +215,6 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id) undo_redo->commit_action(); } else if (n->is_type("CanvasItem")) { - CanvasItem *ci = n->cast_to<CanvasItem>(); - if (!ci->is_visible() && ci->get_parent_item() && !ci->get_parent_item()->is_visible()) { - error->set_text(TTR("This item cannot be made visible because the parent is hidden. Unhide the parent first.")); - error->popup_centered_minsize(); - return; - } bool v = !bool(n->call("is_hidden")); undo_redo->create_action(TTR("Toggle CanvasItem Visible")); undo_redo->add_do_method(n,v?"hide":"show"); @@ -415,6 +402,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { if (!p_node->is_connected("visibility_changed",this,"_node_visibility_changed")) p_node->connect("visibility_changed",this,"_node_visibility_changed",varray(p_node)); + _update_visibility_color(p_node, item); } else if (p_node->is_type("Spatial")) { bool h = p_node->call("is_hidden"); @@ -426,6 +414,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { if (!p_node->is_connected("visibility_changed",this,"_node_visibility_changed")) p_node->connect("visibility_changed",this,"_node_visibility_changed",varray(p_node)); + _update_visibility_color(p_node, item); } } @@ -491,9 +480,20 @@ void SceneTreeEditor::_node_visibility_changed(Node *p_node) { else item->set_button(0,idx,get_icon("Visible","EditorIcons")); - + _update_visibility_color(p_node, item); } +void SceneTreeEditor::_update_visibility_color(Node *p_node, TreeItem *p_item) { + if (p_node->is_type("CanvasItem") || p_node->is_type("Spatial")) { + Color color(1,1,1,1); + bool visible_on_screen = p_node->call("is_visible"); + if (!visible_on_screen) { + color = Color(0.6,0.6,0.6,1); + } + int idx=p_item->get_button_by_id(0,BUTTON_VISIBILITY); + p_item->set_button_color(0,idx,color); + } +} void SceneTreeEditor::_node_script_changed(Node *p_node) { @@ -725,6 +725,12 @@ void SceneTreeEditor::set_selected(Node *p_node,bool p_emit_selected) { TreeItem* item=p_node?_find(tree->get_root(),p_node->get_path()):NULL; if (item) { + // make visible when it's collapsed + TreeItem* node=item->get_parent(); + while (node && node!=tree->get_root()) { + node->set_collapsed(false); + node=node->get_parent(); + } item->select(0); item->set_as_cursor(0); selected=p_node; @@ -953,7 +959,7 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2& p_point,Control* p_from) Label *label = memnew( Label( selected[i]->get_name() ) ); hb->add_child(label); vb->add_child(hb); - hb->set_opacity(opacity_item); + hb->set_modulate(Color(1,1,1,opacity_item)); opacity_item -= opacity_step; } NodePath p = selected[i]->get_path(); diff --git a/tools/editor/scene_tree_editor.h b/tools/editor/scene_tree_editor.h index 12d85ecdeb..3e0e2f1677 100644 --- a/tools/editor/scene_tree_editor.h +++ b/tools/editor/scene_tree_editor.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -117,6 +117,7 @@ class SceneTreeEditor : public Control { void _update_selection(TreeItem *item); void _node_script_changed(Node *p_node); void _node_visibility_changed(Node *p_node); + void _update_visibility_color(Node *p_node, TreeItem *p_item); void _subscene_option(int p_idx); void _node_replace_owner(Node* p_base,Node* p_node,Node* p_root); diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp index 62d5c7cd84..bb67dede5a 100644 --- a/tools/editor/script_create_dialog.cpp +++ b/tools/editor/script_create_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -96,8 +96,20 @@ void ScriptCreateDialog::_class_name_changed(const String& p_name) { void ScriptCreateDialog::ok_pressed() { - if (class_name->is_editable() && !_validate(class_name->get_text())) { + if (create_new){ + _create_new(); + } else { + _load_exist(); + } + + create_new=true; + _update_controls(); + +} + +void ScriptCreateDialog::_create_new() { + if (class_name->is_editable() && !_validate(class_name->get_text())) { alert->set_text(TTR("Class name is invalid!")); alert->popup_centered_minsize(); return; @@ -105,21 +117,14 @@ void ScriptCreateDialog::ok_pressed() { if (!_validate(parent_name->get_text())) { alert->set_text(TTR("Parent class name is invalid!")); alert->popup_centered_minsize(); - return; - } - String cname; if (class_name->is_editable()) cname=class_name->get_text(); - - - Ref<Script> scr = ScriptServer::get_language( language_menu->get_selected() )->get_template(cname,parent_name->get_text()); - //scr->set_source_code(text); String selected_language = language_menu->get_item_text(language_menu->get_selected()); editor_settings->set_last_selected_language(selected_language); @@ -127,34 +132,40 @@ void ScriptCreateDialog::ok_pressed() { if (cname!="") scr->set_name(cname); - if (!internal->is_pressed()) { - - String lpath = Globals::get_singleton()->localize_path(file_path->get_text()); scr->set_path(lpath); if (!path_valid) { - alert->set_text(TTR("Invalid path!")); alert->popup_centered_minsize(); return; - } Error err = ResourceSaver::save(lpath,scr,ResourceSaver::FLAG_CHANGE_PATH); if (err!=OK) { - alert->set_text(TTR("Could not create script in filesystem.")); alert->popup_centered_minsize(); return; } - //scr->set_path(lpath); - //EditorFileSystem::get_singleton()->update_file(lpath,scr->get_type()); + } + hide(); + emit_signal("script_created",scr); + +} +void ScriptCreateDialog::_load_exist() { + + String path=file_path->get_text(); + RES p_script = ResourceLoader::load(path, "Script"); + if (p_script.is_null()) { + alert->get_ok()->set_text(TTR("Ugh")); + alert->set_text(vformat(TTR("Error loading script from %s"), path)); + alert->popup_centered_minsize(); + return; } hide(); - emit_signal("script_created",scr); + emit_signal("script_created",p_script.get_ref_ptr()); } @@ -166,10 +177,35 @@ void ScriptCreateDialog::_lang_changed(int l) { } else { class_name->set_editable(false); } - if (file_path->get_text().basename()==initial_bp) { - file_path->set_text(initial_bp+"."+ScriptServer::get_language( l )->get_extension()); - _path_changed(file_path->get_text()); + + String selected_ext="."+ScriptServer::get_language( l )->get_extension(); + String path=file_path->get_text(); + String extension=""; + if (path.find(".")>=0) { + extension=path.extension(); + } + + if (extension.length()==0) { + // add extension if none + path+=selected_ext; + _path_changed(path); + } else { + // change extension by selected language + List<String> extensions; + // get all possible extensions for script + for (int l=0;l<language_menu->get_item_count();l++) { + ScriptServer::get_language( l )->get_recognized_extensions(&extensions); + } + + for(List<String>::Element *E=extensions.front();E;E=E->next()) { + if (E->get().nocasecmp_to(extension)==0) { + path=path.basename()+selected_ext; + _path_changed(path); + break; + } + } } + file_path->set_text(path); _class_name_changed(class_name->get_text()); } @@ -191,8 +227,10 @@ void ScriptCreateDialog::_browse_path() { file_browse->clear_filters(); List<String> extensions; - int l=language_menu->get_selected(); - ScriptServer::get_language( l )->get_recognized_extensions(&extensions); + // get all possible extensions for script + for (int l=0;l<language_menu->get_item_count();l++) { + ScriptServer::get_language( l )->get_recognized_extensions(&extensions); + } for(List<String>::Element *E=extensions.front();E;E=E->next()) { file_browse->add_filter("*."+E->get()); @@ -246,49 +284,57 @@ void ScriptCreateDialog::_path_changed(const String& p_path) { memdelete(d); } - - FileAccess *f = FileAccess::create(FileAccess::ACCESS_RESOURCES); - - if (f->file_exists(p)) { - - path_error_label->set_text(TTR("File exists")); - path_error_label->add_color_override("font_color",Color(1,0.4,0.0,0.8)); - memdelete(f); - return; - } - + create_new=!f->file_exists(p); memdelete(f); String extension=p.extension(); List<String> extensions; - int l=language_menu->get_selected(); - ScriptServer::get_language( l )->get_recognized_extensions(&extensions); + // get all possible extensions for script + for (int l=0;l<language_menu->get_item_count();l++) { + ScriptServer::get_language( l )->get_recognized_extensions(&extensions); + } bool found=false; + int index=0; for(List<String>::Element *E=extensions.front();E;E=E->next()) { if (E->get().nocasecmp_to(extension)==0) { + language_menu->select(index); // change Language option by extension found=true; break; } + index++; } if (!found) { - path_error_label->set_text(TTR("Invalid extension")); path_error_label->add_color_override("font_color",Color(1,0.4,0.0,0.8)); return; } + _update_controls(); - path_error_label->set_text(TTR("Valid path")); path_error_label->add_color_override("font_color",Color(0,1.0,0.8,0.8)); path_valid=true; } +void ScriptCreateDialog::_update_controls() { + + if (create_new) { + path_error_label->set_text(TTR("Create new script")); + get_ok()->set_text(TTR("Create")); + } else { + path_error_label->set_text(TTR("Load existing script")); + get_ok()->set_text(TTR("Load")); + } + parent_name->set_editable(create_new); + internal->set_disabled(!create_new); + +} + void ScriptCreateDialog::_bind_methods() { @@ -376,7 +422,7 @@ ScriptCreateDialog::ScriptCreateDialog() { set_size(Size2(200,150)); set_hide_on_ok(false); - set_title(TTR("Create Node Script")); + set_title(TTR("Attach Node Script")); file_browse = memnew( EditorFileDialog ); file_browse->connect("file_selected",this,"_file_selected"); @@ -385,4 +431,6 @@ ScriptCreateDialog::ScriptCreateDialog() { alert = memnew( AcceptDialog ); add_child(alert); _lang_changed(0); + + create_new=true; } diff --git a/tools/editor/script_create_dialog.h b/tools/editor/script_create_dialog.h index c71ea16d39..db40710cdc 100644 --- a/tools/editor/script_create_dialog.h +++ b/tools/editor/script_create_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -50,6 +50,7 @@ class ScriptCreateDialog : public ConfirmationDialog { VBoxContainer *path_vb; AcceptDialog *alert; bool path_valid; + bool create_new; String initial_bp; EditorSettings *editor_settings; @@ -62,6 +63,9 @@ class ScriptCreateDialog : public ConfirmationDialog { void _browse_path(); void _file_selected(const String& p_file); virtual void ok_pressed(); + void _create_new(); + void _load_exist(); + void _update_controls(); protected: static void _bind_methods(); diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index c8170ca9a3..88cb357148 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -581,7 +581,6 @@ void ScriptEditorDebugger::_parse_message(const String& p_msg,const Array& p_dat //LOG if (EditorNode::get_log()->is_hidden()) { - log_forced_visible=true; if (EditorNode::get_singleton()->are_bottom_panels_hidden()) { EditorNode::get_singleton()->make_bottom_panel_item_visible(EditorNode::get_log()); } @@ -957,7 +956,6 @@ void ScriptEditorDebugger::_notification(int p_what) { break; EditorNode::get_log()->add_message("** Debug Process Started **"); - log_forced_visible=false; ppeer->set_stream_peer(connection); @@ -1089,8 +1087,8 @@ void ScriptEditorDebugger::start() { stop(); - if (!EditorNode::get_log()->is_visible()) { - EditorNode::get_singleton()->make_bottom_panel_item_visible(EditorNode::get_log()); + if (is_visible()) { + EditorNode::get_singleton()->make_bottom_panel_item_visible(this); } uint16_t port = GLOBAL_DEF("debug/remote_port",6007); @@ -1132,13 +1130,6 @@ void ScriptEditorDebugger::stop(){ pending_in_queue=0; message.clear(); - if (log_forced_visible) { - //EditorNode::get_singleton()->make_bottom_panel_item_visible(this); - if (EditorNode::get_log()->is_visible()) - EditorNode::get_singleton()->hide_bottom_panel(); - log_forced_visible=false; - } - node_path_cache.clear(); res_path_cache.clear(); profiler_signature.clear(); @@ -1980,8 +1971,6 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){ msgdialog = memnew( AcceptDialog ); add_child(msgdialog); - log_forced_visible=false; - p_editor->get_undo_redo()->set_method_notify_callback(_method_changeds,this); p_editor->get_undo_redo()->set_property_notify_callback(_property_changeds,this); live_debug=false; diff --git a/tools/editor/script_editor_debugger.h b/tools/editor/script_editor_debugger.h index c4a7cea1b7..985edd8df3 100644 --- a/tools/editor/script_editor_debugger.h +++ b/tools/editor/script_editor_debugger.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -96,7 +96,6 @@ class ScriptEditorDebugger : public Control { TabContainer *tabs; LineEdit *reason; - bool log_forced_visible; ScriptEditorDebuggerVariables *variables; Button *step; diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp index 50989ea5cb..476a2ed693 100644 --- a/tools/editor/settings_config_dialog.cpp +++ b/tools/editor/settings_config_dialog.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/settings_config_dialog.h b/tools/editor/settings_config_dialog.h index 3b91c7f019..8a4bdc3b8c 100644 --- a/tools/editor/settings_config_dialog.h +++ b/tools/editor/settings_config_dialog.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 84803eb6db..f170c9b717 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -41,6 +41,8 @@ // Keep small children away from this file. // It's so ugly it will eat them alive + + #define HANDLE_HALF_SIZE 0.05 void EditorSpatialGizmo::clear() { @@ -82,7 +84,6 @@ void EditorSpatialGizmo::Instance::create_instance(Spatial *p_base) { if (extra_margin) VS::get_singleton()->instance_set_extra_visibility_margin(instance,1); VS::get_singleton()->instance_geometry_set_cast_shadows_setting(instance,VS::SHADOW_CASTING_SETTING_OFF); - VS::get_singleton()->instance_geometry_set_flag(instance,VS::INSTANCE_FLAG_RECEIVE_SHADOWS,false); VS::get_singleton()->instance_set_layer_mask(instance,1<<SpatialEditorViewport::GIZMO_EDIT_LAYER); //gizmos are 26 } @@ -132,7 +133,7 @@ void EditorSpatialGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Mat a[Mesh::ARRAY_COLOR]=color; - mesh->add_surface(Mesh::PRIMITIVE_LINES,a); + mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES,a); mesh->surface_set_material(0,p_material); if (p_billboard) { @@ -181,7 +182,7 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material>& p_material, a.resize(Mesh::ARRAY_MAX); a[Mesh::ARRAY_VERTEX]=vs; a[Mesh::ARRAY_TEX_UV]=uv; - mesh->add_surface(Mesh::PRIMITIVE_TRIANGLE_FAN,a); + mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLE_FAN,a); mesh->surface_set_material(0,p_material); if (true) { @@ -244,6 +245,7 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_bi Array a; a.resize(VS::ARRAY_MAX); a[VS::ARRAY_VERTEX]=p_handles; + print_line("handles?: "+itos(p_handles.size())); DVector<Color> colors; { colors.resize(p_handles.size()); @@ -258,7 +260,7 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_bi } a[VS::ARRAY_COLOR]=colors; - mesh->add_surface(Mesh::PRIMITIVE_POINTS,a); + mesh->add_surface_from_arrays(Mesh::PRIMITIVE_POINTS,a); mesh->surface_set_material(0,SpatialEditorGizmos::singleton->handle2_material); if (p_billboard) { @@ -667,9 +669,9 @@ String LightSpatialGizmo::get_handle_name(int p_idx) const { Variant LightSpatialGizmo::get_handle_value(int p_idx) const{ if (p_idx==0) - return light->get_parameter(Light::PARAM_RADIUS); + return light->get_param(Light::PARAM_RANGE); if (p_idx==1) - return light->get_parameter(Light::PARAM_SPOT_ANGLE); + return light->get_param(Light::PARAM_SPOT_ANGLE); return Variant(); } @@ -727,7 +729,7 @@ void LightSpatialGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_p if (d<0) d=0; - light->set_parameter(Light::PARAM_RADIUS,d); + light->set_param(Light::PARAM_RANGE,d); } else if (light->cast_to<OmniLight>()) { Plane cp=Plane( gt.origin, p_camera->get_transform().basis.get_axis(2)); @@ -736,15 +738,15 @@ void LightSpatialGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_p if (cp.intersects_ray(ray_from,ray_dir,&inters)) { float r = inters.distance_to(gt.origin); - light->set_parameter(Light::PARAM_RADIUS,r); + light->set_param(Light::PARAM_RANGE,r); } } } else if (p_idx==1) { - float a = _find_closest_angle_to_half_pi_arc(s[0],s[1],light->get_parameter(Light::PARAM_RADIUS),gt); - light->set_parameter(Light::PARAM_SPOT_ANGLE,CLAMP(a,0.01,89.99)); + float a = _find_closest_angle_to_half_pi_arc(s[0],s[1],light->get_param(Light::PARAM_RANGE),gt); + light->set_param(Light::PARAM_SPOT_ANGLE,CLAMP(a,0.01,89.99)); } } @@ -752,21 +754,21 @@ void LightSpatialGizmo::commit_handle(int p_idx,const Variant& p_restore,bool p_ if (p_cancel) { - light->set_parameter(p_idx==0?Light::PARAM_RADIUS:Light::PARAM_SPOT_ANGLE,p_restore); + light->set_param(p_idx==0?Light::PARAM_RANGE:Light::PARAM_SPOT_ANGLE,p_restore); } else if (p_idx==0) { UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); ur->create_action(TTR("Change Light Radius")); - ur->add_do_method(light,"set_parameter",Light::PARAM_RADIUS,light->get_parameter(Light::PARAM_RADIUS)); - ur->add_undo_method(light,"set_parameter",Light::PARAM_RADIUS,p_restore); + ur->add_do_method(light,"set_param",Light::PARAM_RANGE,light->get_param(Light::PARAM_RANGE)); + ur->add_undo_method(light,"set_param",Light::PARAM_RANGE,p_restore); ur->commit_action(); } else if (p_idx==1) { UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); ur->create_action(TTR("Change Light Radius")); - ur->add_do_method(light,"set_parameter",Light::PARAM_SPOT_ANGLE,light->get_parameter(Light::PARAM_SPOT_ANGLE)); - ur->add_undo_method(light,"set_parameter",Light::PARAM_SPOT_ANGLE,p_restore); + ur->add_do_method(light,"set_param",Light::PARAM_SPOT_ANGLE,light->get_param(Light::PARAM_SPOT_ANGLE)); + ur->add_undo_method(light,"set_param",Light::PARAM_SPOT_ANGLE,p_restore); ur->commit_action(); } @@ -829,7 +831,7 @@ void LightSpatialGizmo::redraw() { OmniLight *on = light->cast_to<OmniLight>(); - float r = on->get_parameter(Light::PARAM_RADIUS); + float r = on->get_param(Light::PARAM_RANGE); Vector<Vector3> points; @@ -869,9 +871,9 @@ void LightSpatialGizmo::redraw() { Vector<Vector3> points; SpotLight *on = light->cast_to<SpotLight>(); - float r = on->get_parameter(Light::PARAM_RADIUS); - float w = r*Math::sin(Math::deg2rad(on->get_parameter(Light::PARAM_SPOT_ANGLE))); - float d = r*Math::cos(Math::deg2rad(on->get_parameter(Light::PARAM_SPOT_ANGLE))); + float r = on->get_param(Light::PARAM_RANGE); + float w = r*Math::sin(Math::deg2rad(on->get_param(Light::PARAM_SPOT_ANGLE))); + float d = r*Math::cos(Math::deg2rad(on->get_param(Light::PARAM_SPOT_ANGLE))); @@ -1541,7 +1543,7 @@ void RayCastSpatialGizmo::redraw() { } -RayCastSpatialGizmo::RayCastSpatialGizmo(RayCast* p_raycast){ +RayCastSpatialGizmo::RayCastSpatialGizmo(RayCast* p_raycast) { set_spatial_node(p_raycast); raycast=p_raycast; @@ -2237,6 +2239,321 @@ VisibilityNotifierGizmo::VisibilityNotifierGizmo(VisibilityNotifier* p_notifier) //////// +/// + + +String ReflectionProbeGizmo::get_handle_name(int p_idx) const { + + switch(p_idx) { + case 0: return "Extents X"; + case 1: return "Extents Y"; + case 2: return "Extents Z"; + case 3: return "Origin X"; + case 4: return "Origin Y"; + case 5: return "Origin Z"; + } + + return ""; +} +Variant ReflectionProbeGizmo::get_handle_value(int p_idx) const{ + + return AABB(probe->get_extents(),probe->get_origin_offset()); +} +void ReflectionProbeGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_point){ + + Transform gt = probe->get_global_transform(); + //gt.orthonormalize(); + Transform gi = gt.affine_inverse(); + + + if (p_idx<3) { + Vector3 extents = probe->get_extents(); + + Vector3 ray_from = p_camera->project_ray_origin(p_point); + Vector3 ray_dir = p_camera->project_ray_normal(p_point); + + Vector3 sg[2]={gi.xform(ray_from),gi.xform(ray_from+ray_dir*16384)}; + + Vector3 axis; + axis[p_idx]=1.0; + + Vector3 ra,rb; + Geometry::get_closest_points_between_segments(Vector3(),axis*16384,sg[0],sg[1],ra,rb); + float d = ra[p_idx]; + if (d<0.001) + d=0.001; + + extents[p_idx]=d; + probe->set_extents(extents); + } else { + + p_idx-=3; + + Vector3 origin = probe->get_origin_offset(); + origin[p_idx]=0; + + Vector3 ray_from = p_camera->project_ray_origin(p_point); + Vector3 ray_dir = p_camera->project_ray_normal(p_point); + + Vector3 sg[2]={gi.xform(ray_from),gi.xform(ray_from+ray_dir*16384)}; + + Vector3 axis; + axis[p_idx]=1.0; + + Vector3 ra,rb; + Geometry::get_closest_points_between_segments(origin-axis*16384,origin+axis*16384,sg[0],sg[1],ra,rb); + float d = ra[p_idx]; + d+=0.25; + + origin[p_idx]=d; + probe->set_origin_offset(origin); + + } +} + +void ReflectionProbeGizmo::commit_handle(int p_idx,const Variant& p_restore,bool p_cancel){ + + AABB restore = p_restore; + + if (p_cancel) { + probe->set_extents(restore.pos); + probe->set_origin_offset(restore.size); + return; + } + + UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); + ur->create_action(TTR("Change Probe Extents")); + ur->add_do_method(probe,"set_extents",probe->get_extents()); + ur->add_do_method(probe,"set_origin_offset",probe->get_origin_offset()); + ur->add_undo_method(probe,"set_extents",restore.pos); + ur->add_undo_method(probe,"set_origin_offset",restore.size); + ur->commit_action(); + +} + +void ReflectionProbeGizmo::redraw(){ + + clear(); + + Vector<Vector3> lines; + Vector<Vector3> internal_lines; + Vector3 extents = probe->get_extents(); + + AABB aabb; + aabb.pos=-extents; + aabb.size=extents*2; + + for(int i=0;i<12;i++) { + Vector3 a,b; + aabb.get_edge(i,a,b); + lines.push_back(a); + lines.push_back(b); + } + + for(int i=0;i<8;i++) { + Vector3 ep = aabb.get_endpoint(i); + internal_lines.push_back(probe->get_origin_offset()); + internal_lines.push_back(ep); + + + } + + Vector<Vector3> handles; + + + for(int i=0;i<3;i++) { + + Vector3 ax; + ax[i]=aabb.pos[i]+aabb.size[i]; + handles.push_back(ax); + } + + for(int i=0;i<3;i++) { + + + Vector3 orig_handle=probe->get_origin_offset(); + orig_handle[i]-=0.25; + lines.push_back(orig_handle); + handles.push_back(orig_handle); + + orig_handle[i]+=0.5; + lines.push_back(orig_handle); + } + + add_lines(lines,SpatialEditorGizmos::singleton->reflection_probe_material); + add_lines(internal_lines,SpatialEditorGizmos::singleton->reflection_probe_material_internal); + //add_unscaled_billboard(SpatialEditorGizmos::singleton->visi,0.05); + add_collision_segments(lines); + add_handles(handles); + +} +ReflectionProbeGizmo::ReflectionProbeGizmo(ReflectionProbe* p_probe){ + + probe=p_probe; + set_spatial_node(p_probe); +} + +//////// + + + +/// + + +String GIProbeGizmo::get_handle_name(int p_idx) const { + + switch(p_idx) { + case 0: return "Extents X"; + case 1: return "Extents Y"; + case 2: return "Extents Z"; + } + + return ""; +} +Variant GIProbeGizmo::get_handle_value(int p_idx) const{ + + return probe->get_extents(); +} +void GIProbeGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_point){ + + Transform gt = probe->get_global_transform(); + //gt.orthonormalize(); + Transform gi = gt.affine_inverse(); + + + Vector3 extents = probe->get_extents(); + + Vector3 ray_from = p_camera->project_ray_origin(p_point); + Vector3 ray_dir = p_camera->project_ray_normal(p_point); + + Vector3 sg[2]={gi.xform(ray_from),gi.xform(ray_from+ray_dir*16384)}; + + Vector3 axis; + axis[p_idx]=1.0; + + Vector3 ra,rb; + Geometry::get_closest_points_between_segments(Vector3(),axis*16384,sg[0],sg[1],ra,rb); + float d = ra[p_idx]; + if (d<0.001) + d=0.001; + + extents[p_idx]=d; + probe->set_extents(extents); + +} + +void GIProbeGizmo::commit_handle(int p_idx,const Variant& p_restore,bool p_cancel){ + + Vector3 restore = p_restore; + + if (p_cancel) { + probe->set_extents(restore); + return; + } + + UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); + ur->create_action(TTR("Change Probe Extents")); + ur->add_do_method(probe,"set_extents",probe->get_extents()); + ur->add_undo_method(probe,"set_extents",restore); + ur->commit_action(); + +} + +void GIProbeGizmo::redraw(){ + + clear(); + + Vector<Vector3> lines; + Vector3 extents = probe->get_extents(); + + static const int subdivs[GIProbe::SUBDIV_MAX]={64,128,256,512}; + + AABB aabb = AABB(-extents,extents*2); + int subdiv = subdivs[probe->get_subdiv()]; + float cell_size = aabb.get_longest_axis_size()/subdiv; + + + for(int i=0;i<12;i++) { + Vector3 a,b; + aabb.get_edge(i,a,b); + lines.push_back(a); + lines.push_back(b); + } + + add_lines(lines,SpatialEditorGizmos::singleton->gi_probe_material); + add_collision_segments(lines); + + lines.clear(); + + for(int i=1;i<subdiv;i++) { + + for(int j=0;j<3;j++) { + + + + if (cell_size*i>aabb.size[j]) { + continue; + } + + Vector2 dir; + dir[j]=1.0; + Vector2 ta,tb; + int j_n1=(j+1)%3; + int j_n2=(j+2)%3; + ta[j_n1]=1.0; + tb[j_n2]=1.0; + + + for(int k=0;k<4;k++) { + + Vector3 from=aabb.pos,to=aabb.pos; + from[j]+= cell_size*i; + to[j]+=cell_size*i; + + if (k&1) { + to[j_n1]+=aabb.size[j_n1]; + } else { + + to[j_n2]+=aabb.size[j_n2]; + } + + if (k&2) { + from[j_n1]+=aabb.size[j_n1]; + from[j_n2]+=aabb.size[j_n2]; + } + + lines.push_back(from); + lines.push_back(to); + } + + } + + } + + add_lines(lines,SpatialEditorGizmos::singleton->reflection_probe_material_internal); + + Vector<Vector3> handles; + + + for(int i=0;i<3;i++) { + + Vector3 ax; + ax[i]=aabb.pos[i]+aabb.size[i]; + handles.push_back(ax); + } + + + add_handles(handles); + +} +GIProbeGizmo::GIProbeGizmo(GIProbe* p_probe){ + + probe=p_probe; + set_spatial_node(p_probe); +} + +//////// + void NavigationMeshSpatialGizmo::redraw() { @@ -2320,7 +2637,7 @@ void NavigationMeshSpatialGizmo::redraw() { Array a; a.resize(Mesh::ARRAY_MAX); a[0]=tmeshfaces; - m->add_surface(Mesh::PRIMITIVE_TRIANGLES,a); + m->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,a); m->surface_set_material(0,navmesh->is_enabled()?SpatialEditorGizmos::singleton->navmesh_solid_material:SpatialEditorGizmos::singleton->navmesh_solid_material_disabled); add_mesh(m); add_collision_segments(lines); @@ -2928,6 +3245,17 @@ Ref<SpatialEditorGizmo> SpatialEditorGizmos::get_gizmo(Spatial *p_spatial) { return misg; } + if (p_spatial->cast_to<ReflectionProbe>()) { + + Ref<ReflectionProbeGizmo> misg = memnew( ReflectionProbeGizmo(p_spatial->cast_to<ReflectionProbe>()) ); + return misg; + } + if (p_spatial->cast_to<GIProbe>()) { + + Ref<GIProbeGizmo> misg = memnew( GIProbeGizmo(p_spatial->cast_to<GIProbe>()) ); + return misg; + } + if (p_spatial->cast_to<VehicleWheel>()) { Ref<VehicleWheelSpatialGizmo> misg = memnew( VehicleWheelSpatialGizmo(p_spatial->cast_to<VehicleWheel>()) ); @@ -2974,25 +3302,26 @@ Ref<SpatialEditorGizmo> SpatialEditorGizmos::get_gizmo(Spatial *p_spatial) { } -Ref<FixedMaterial> SpatialEditorGizmos::create_line_material(const Color& p_base_color) { +Ref<FixedSpatialMaterial> SpatialEditorGizmos::create_line_material(const Color& p_base_color) { - Ref<FixedMaterial> line_material = Ref<FixedMaterial>( memnew( FixedMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); + Ref<FixedSpatialMaterial> line_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); + line_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,p_base_color); + line_material->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + //line_material->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + //->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + line_material->set_albedo(p_base_color); return line_material; } -Ref<FixedMaterial> SpatialEditorGizmos::create_solid_material(const Color& p_base_color) { +Ref<FixedSpatialMaterial> SpatialEditorGizmos::create_solid_material(const Color& p_base_color) { - Ref<FixedMaterial> line_material = Ref<FixedMaterial>( memnew( FixedMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,p_base_color); + Ref<FixedSpatialMaterial> line_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); + line_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + line_material->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + line_material->set_albedo(p_base_color); return line_material; @@ -3002,57 +3331,60 @@ SpatialEditorGizmos::SpatialEditorGizmos() { singleton=this; - handle_material = Ref<FixedMaterial>( memnew( FixedMaterial )); - handle_material->set_flag(Material::FLAG_UNSHADED, true); - handle_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(0.8,0.8,0.8)); + handle_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); + handle_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + handle_material->set_albedo(Color(0.8,0.8,0.8)); - handle2_material = Ref<FixedMaterial>( memnew( FixedMaterial )); - handle2_material->set_flag(Material::FLAG_UNSHADED, true); - handle2_material->set_fixed_flag(FixedMaterial::FLAG_USE_POINT_SIZE, true); + handle2_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); + handle2_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + handle2_material->set_flag(FixedSpatialMaterial::FLAG_USE_POINT_SIZE, true); handle_t = SpatialEditor::get_singleton()->get_icon("Editor3DHandle","EditorIcons"); handle2_material->set_point_size(handle_t->get_width()); - handle2_material->set_texture(FixedMaterial::PARAM_DIFFUSE,handle_t); - handle2_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1)); - handle2_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - handle2_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); + handle2_material->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,handle_t); + handle2_material->set_albedo(Color(1,1,1)); + handle2_material->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + handle2_material->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + handle2_material->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); light_material = create_line_material(Color(1,1,0.2)); - light_material_omni_icon = Ref<FixedMaterial>( memnew( FixedMaterial )); - light_material_omni_icon->set_flag(Material::FLAG_UNSHADED, true); - light_material_omni_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - light_material_omni_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - light_material_omni_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - light_material_omni_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - light_material_omni_icon->set_texture(FixedMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoLight","EditorIcons")); + light_material_omni_icon = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); + light_material_omni_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + light_material_omni_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + light_material_omni_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + light_material_omni_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + light_material_omni_icon->set_albedo(Color(1,1,1,0.9)); + light_material_omni_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,SpatialEditor::get_singleton()->get_icon("GizmoLight","EditorIcons")); - light_material_directional_icon = Ref<FixedMaterial>( memnew( FixedMaterial )); - light_material_directional_icon->set_flag(Material::FLAG_UNSHADED, true); - light_material_directional_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - light_material_directional_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - light_material_directional_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - light_material_directional_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - light_material_directional_icon->set_texture(FixedMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoDirectionalLight","EditorIcons")); + light_material_directional_icon = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); + light_material_directional_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + light_material_directional_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + light_material_directional_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + light_material_directional_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + light_material_directional_icon->set_albedo(Color(1,1,1,0.9)); + light_material_directional_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,SpatialEditor::get_singleton()->get_icon("GizmoDirectionalLight","EditorIcons")); camera_material = create_line_material(Color(1.0,0.5,1.0)); navmesh_edge_material = create_line_material(Color(0.1,0.8,1.0)); navmesh_solid_material = create_solid_material(Color(0.1,0.8,1.0,0.4)); - navmesh_edge_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, false); - navmesh_solid_material->set_flag(Material::FLAG_DOUBLE_SIDED,true); + navmesh_edge_material->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, false); + navmesh_edge_material->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, false); + navmesh_solid_material->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); navmesh_edge_material_disabled = create_line_material(Color(1.0,0.8,0.1)); navmesh_solid_material_disabled = create_solid_material(Color(1.0,0.8,0.1,0.4)); - navmesh_edge_material_disabled->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, false); - navmesh_solid_material_disabled->set_flag(Material::FLAG_DOUBLE_SIDED,true); + navmesh_edge_material_disabled->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, false); + navmesh_edge_material_disabled->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, false); + navmesh_solid_material_disabled->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); skeleton_material = create_line_material(Color(0.6,1.0,0.3)); - skeleton_material->set_flag(Material::FLAG_DOUBLE_SIDED,true); - skeleton_material->set_flag(Material::FLAG_UNSHADED,true); - skeleton_material->set_flag(Material::FLAG_ONTOP,true); - skeleton_material->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); + skeleton_material->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + skeleton_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); + skeleton_material->set_flag(FixedSpatialMaterial::FLAG_ONTOP,true); + skeleton_material->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); //position 3D Shared mesh @@ -3075,16 +3407,17 @@ SpatialEditorGizmos::SpatialEditorGizmos() { cursor_colors.push_back(Color(0.5,0.5,1,0.7)); cursor_colors.push_back(Color(0.5,0.5,1,0.7)); - Ref<FixedMaterial> mat = memnew( FixedMaterial ); - mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + Ref<FixedSpatialMaterial> mat = memnew( FixedSpatialMaterial ); + mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); + mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); + mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true); + mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true); mat->set_line_width(3); Array d; d.resize(VS::ARRAY_MAX); d[Mesh::ARRAY_VERTEX]=cursor_points; d[Mesh::ARRAY_COLOR]=cursor_colors; - pos3d_mesh->add_surface(Mesh::PRIMITIVE_LINES,d); + pos3d_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES,d); pos3d_mesh->surface_set_material(0,mat); } @@ -3098,58 +3431,63 @@ SpatialEditorGizmos::SpatialEditorGizmos() { cursor_colors.push_back(Color(0.5, 0.5, 0.5, 0.7)); cursor_colors.push_back(Color(0.5, 0.5, 0.5, 0.7)); - Ref<FixedMaterial> mat = memnew(FixedMaterial); - mat->set_flag(Material::FLAG_UNSHADED, true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); + Ref<FixedSpatialMaterial> mat = memnew(FixedSpatialMaterial); + mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); mat->set_line_width(3); Array d; d.resize(VS::ARRAY_MAX); d[Mesh::ARRAY_VERTEX] = cursor_points; d[Mesh::ARRAY_COLOR] = cursor_colors; - listener_line_mesh->add_surface(Mesh::PRIMITIVE_LINES, d); + listener_line_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES, d); listener_line_mesh->surface_set_material(0, mat); } - sample_player_icon = Ref<FixedMaterial>( memnew( FixedMaterial )); - sample_player_icon->set_flag(Material::FLAG_UNSHADED, true); - sample_player_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - sample_player_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - sample_player_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - sample_player_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - sample_player_icon->set_texture(FixedMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoSpatialSamplePlayer","EditorIcons")); + sample_player_icon = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); + sample_player_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + sample_player_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + sample_player_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + sample_player_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + sample_player_icon->set_albedo(Color(1,1,1,0.9)); + sample_player_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,SpatialEditor::get_singleton()->get_icon("GizmoSpatialSamplePlayer","EditorIcons")); room_material = create_line_material(Color(1.0,0.6,0.9)); portal_material = create_line_material(Color(1.0,0.8,0.6)); raycast_material = create_line_material(Color(1.0,0.8,0.6)); car_wheel_material = create_line_material(Color(0.6,0.8,1.0)); visibility_notifier_material = create_line_material(Color(1.0,0.5,1.0)); + reflection_probe_material = create_line_material(Color(0.5,1.0,0.7)); + reflection_probe_material_internal = create_line_material(Color(0.3,0.8,0.5,0.15)); + gi_probe_material = create_line_material(Color(0.7,1.0,0.5)); + gi_probe_material_internal = create_line_material(Color(0.5,0.8,0.3,0.4)); joint_material = create_line_material(Color(0.6,0.8,1.0)); - stream_player_icon = Ref<FixedMaterial>( memnew( FixedMaterial )); - stream_player_icon->set_flag(Material::FLAG_UNSHADED, true); - stream_player_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - stream_player_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - stream_player_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - stream_player_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - stream_player_icon->set_texture(FixedMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoSpatialStreamPlayer","EditorIcons")); - - visibility_notifier_icon = Ref<FixedMaterial>( memnew( FixedMaterial )); - visibility_notifier_icon->set_flag(Material::FLAG_UNSHADED, true); - visibility_notifier_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - visibility_notifier_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - visibility_notifier_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - visibility_notifier_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - visibility_notifier_icon->set_texture(FixedMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("Visible","EditorIcons")); - - listener_icon = Ref<FixedMaterial>(memnew(FixedMaterial)); - listener_icon->set_flag(Material::FLAG_UNSHADED, true); - listener_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - listener_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - listener_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - listener_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE, Color(1, 1, 1, 0.9)); - listener_icon->set_texture(FixedMaterial::PARAM_DIFFUSE, SpatialEditor::get_singleton()->get_icon("GizmoListener", "EditorIcons")); + stream_player_icon = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); + stream_player_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + stream_player_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + stream_player_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + stream_player_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + stream_player_icon->set_albedo(Color(1,1,1,0.9)); + stream_player_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,SpatialEditor::get_singleton()->get_icon("GizmoSpatialStreamPlayer","EditorIcons")); + + visibility_notifier_icon = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); + visibility_notifier_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + visibility_notifier_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + visibility_notifier_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + visibility_notifier_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + visibility_notifier_icon->set_albedo(Color(1,1,1,0.9)); + visibility_notifier_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,SpatialEditor::get_singleton()->get_icon("Visible","EditorIcons")); + + listener_icon = Ref<FixedSpatialMaterial>(memnew(FixedSpatialMaterial)); + listener_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + listener_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + listener_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + listener_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + listener_icon->set_albedo( Color(1, 1, 1, 0.9)); + listener_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO, SpatialEditor::get_singleton()->get_icon("GizmoListener", "EditorIcons")); { @@ -3198,3 +3536,4 @@ SpatialEditorGizmos::SpatialEditorGizmos() { } + diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index 3d7272f522..d6bdb39481 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -45,6 +45,8 @@ #include "scene/3d/portal.h" #include "scene/3d/ray_cast.h" #include "scene/3d/navigation_mesh.h" +#include "scene/3d/reflection_probe.h" +#include "scene/3d/gi_probe.h" #include "scene/3d/vehicle_body.h" #include "scene/3d/collision_polygon.h" @@ -307,6 +309,44 @@ public: }; +class ReflectionProbeGizmo : public EditorSpatialGizmo { + + OBJ_TYPE(ReflectionProbeGizmo ,EditorSpatialGizmo); + + + ReflectionProbe* probe; + +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); + + void redraw(); + ReflectionProbeGizmo(ReflectionProbe* p_notifier=NULL); + +}; + +class GIProbeGizmo : public EditorSpatialGizmo { + + OBJ_TYPE(GIProbeGizmo ,EditorSpatialGizmo); + + + GIProbe* probe; + +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); + + void redraw(); + GIProbeGizmo(GIProbe* p_notifier=NULL); + +}; + class CollisionShapeSpatialGizmo : public EditorSpatialGizmo { @@ -339,6 +379,7 @@ public: }; + class RayCastSpatialGizmo : public EditorSpatialGizmo { OBJ_TYPE(RayCastSpatialGizmo,EditorSpatialGizmo); @@ -464,34 +505,38 @@ public: class SpatialEditorGizmos { public: - Ref<FixedMaterial> create_line_material(const Color& p_base_color); - Ref<FixedMaterial> create_solid_material(const Color& p_base_color); - Ref<FixedMaterial> handle2_material; - Ref<FixedMaterial> handle_material; - Ref<FixedMaterial> light_material; - Ref<FixedMaterial> light_material_omni_icon; - Ref<FixedMaterial> light_material_directional_icon; - Ref<FixedMaterial> camera_material; - Ref<FixedMaterial> skeleton_material; - Ref<FixedMaterial> room_material; - Ref<FixedMaterial> portal_material; - Ref<FixedMaterial> raycast_material; - Ref<FixedMaterial> visibility_notifier_material; - Ref<FixedMaterial> car_wheel_material; - Ref<FixedMaterial> joint_material; - - Ref<FixedMaterial> navmesh_edge_material; - Ref<FixedMaterial> navmesh_solid_material; - Ref<FixedMaterial> navmesh_edge_material_disabled; - Ref<FixedMaterial> navmesh_solid_material_disabled; - - Ref<FixedMaterial> listener_icon; - - Ref<FixedMaterial> sample_player_icon; - Ref<FixedMaterial> stream_player_icon; - Ref<FixedMaterial> visibility_notifier_icon; - - Ref<FixedMaterial> shape_material; + Ref<FixedSpatialMaterial> create_line_material(const Color& p_base_color); + Ref<FixedSpatialMaterial> create_solid_material(const Color& p_base_color); + Ref<FixedSpatialMaterial> handle2_material; + Ref<FixedSpatialMaterial> handle_material; + Ref<FixedSpatialMaterial> light_material; + Ref<FixedSpatialMaterial> light_material_omni_icon; + Ref<FixedSpatialMaterial> light_material_directional_icon; + Ref<FixedSpatialMaterial> camera_material; + Ref<FixedSpatialMaterial> skeleton_material; + Ref<FixedSpatialMaterial> reflection_probe_material; + Ref<FixedSpatialMaterial> reflection_probe_material_internal; + Ref<FixedSpatialMaterial> gi_probe_material; + Ref<FixedSpatialMaterial> gi_probe_material_internal; + Ref<FixedSpatialMaterial> room_material; + Ref<FixedSpatialMaterial> portal_material; + Ref<FixedSpatialMaterial> raycast_material; + Ref<FixedSpatialMaterial> visibility_notifier_material; + Ref<FixedSpatialMaterial> car_wheel_material; + Ref<FixedSpatialMaterial> joint_material; + + Ref<FixedSpatialMaterial> navmesh_edge_material; + Ref<FixedSpatialMaterial> navmesh_solid_material; + Ref<FixedSpatialMaterial> navmesh_edge_material_disabled; + Ref<FixedSpatialMaterial> navmesh_solid_material_disabled; + + Ref<FixedSpatialMaterial> listener_icon; + + Ref<FixedSpatialMaterial> sample_player_icon; + Ref<FixedSpatialMaterial> stream_player_icon; + Ref<FixedSpatialMaterial> visibility_notifier_icon; + + Ref<FixedSpatialMaterial> shape_material; Ref<Texture> handle_t; Ref<Mesh> pos3d_mesh; @@ -505,5 +550,4 @@ public: SpatialEditorGizmos(); }; - #endif // SPATIAL_EDITOR_GIZMOS_H |