diff options
Diffstat (limited to 'tools')
23 files changed, 462 insertions, 300 deletions
diff --git a/tools/Godot.app/Contents/Info.plist b/tools/Godot.app/Contents/Info.plist index e2a6489782..2b58162ae8 100755 --- a/tools/Godot.app/Contents/Info.plist +++ b/tools/Godot.app/Contents/Info.plist @@ -19,11 +19,11 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>2.0.1</string> + <string>2.1-dev</string> <key>CFBundleSignature</key> <string>godot</string> <key>CFBundleVersion</key> - <string>2.0.1</string> + <string>2.1-dev</string> <key>NSHumanReadableCopyright</key> <string>© 2007-2016 Juan Linietsky, Ariel Manzur</string> <key>LSMinimumSystemVersion</key> diff --git a/tools/addheader/addheader.py b/tools/addheader/addheader.py index 0252eb396d..d040d8b5d6 100644 --- a/tools/addheader/addheader.py +++ b/tools/addheader/addheader.py @@ -38,7 +38,7 @@ while (fname!=""): l = fr.readline() bc=False fsingle = fname.strip() - + if (fsingle.find("/")!=-1): fsingle=fsingle[fsingle.rfind("/")+1:] rep_fl="$filename" @@ -51,19 +51,19 @@ while (fname!=""): elif (len_fl<len_fi): for x in range(len_fi-len_fl): rep_fl+=" " - if (header.find(rep_fl)!=-1): + if (header.find(rep_fl)!=-1): text=header.replace(rep_fl,rep_fi) else: text=header.replace("$filename",fsingle) - - + + while (l!=""): if ((l.find("//")!=0 and l.find("/*")!=0 and l.strip()!="") or bc): text+=l bc=True l=fr.readline() - fr.close() + fr.close() fr=open(fname.strip(),"wb") fr.write(text) fr.close() diff --git a/tools/bmfhdr/makehdr.py b/tools/bmfhdr/makehdr.py index c09c59c55d..0f6f453004 100644 --- a/tools/bmfhdr/makehdr.py +++ b/tools/bmfhdr/makehdr.py @@ -4,7 +4,7 @@ import sys if (len(sys.argv)!=2): print("Pass me a .fnt argument!") - + f = open(sys.argv[1],"rb") name = sys.argv[1].lower().replace(".fnt","") @@ -24,7 +24,7 @@ while(l!=""): l=f.readline() continue t = l[0:fs] - + dv = l[fs+1:].split(" ") d = {} for x in dv: @@ -32,12 +32,12 @@ while(l!=""): continue s = x.split("=") d[ s[0] ] = s[1] - - + + if (t=="common"): font_height=d["lineHeight"] font_ascent=d["base"] - + if (t=="char"): font_chars.append(d["id"]) font_chars.append(d["x"]) @@ -48,11 +48,11 @@ while(l!=""): font_chars.append(d["yoffset"]) font_chars.append(d["xadvance"]) font_cc+=1 - - - + + + l = f.readline() - + print("static const int _bi_font_"+name+"_height="+str(font_height)+";") print("static const int _bi_font_"+name+"_ascent="+str(font_ascent)+";") @@ -60,11 +60,11 @@ print("static const int _bi_font_"+name+"_charcount="+str(font_cc)+";") cstr="static const int _bi_font_"+name+"_characters={" for i in range(len(font_chars)): - c=font_chars[i] + c=font_chars[i] if (i>0): cstr+=", " cstr+=c - + cstr+=("};") - + print(cstr)
\ No newline at end of file diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index 968d02dfa5..cf8f40430b 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -148,6 +148,7 @@ void FindReplaceDialog::_replace_skip_callback() { void FindReplaceDialog::_replace() { + text_edit->begin_complex_operation(); if (is_replace_all_mode()) { //line as x so it gets priority in comparison, column as y @@ -228,7 +229,7 @@ void FindReplaceDialog::_replace() { _search(); } - + text_edit->end_complex_operation(); } diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index f78ab93c30..8bb2d60cab 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -260,6 +260,16 @@ EditorPlugin* EditorData::get_subeditor(Object *p_object) { return NULL; } +Vector<EditorPlugin*> EditorData::get_subeditors(Object* p_object) { + Vector<EditorPlugin*> sub_plugins; + for (int i = 0; i < editor_plugins.size(); i++) { + if (!editor_plugins[i]->has_main_screen() && editor_plugins[i]->handles(p_object)) { + sub_plugins.push_back(editor_plugins[i]); + } + } + return sub_plugins; +} + EditorPlugin* EditorData::get_editor(String p_name) { for(int i=0;i<editor_plugins.size();i++) { diff --git a/tools/editor/editor_data.h b/tools/editor/editor_data.h index 5814ae8f5c..79843c4df5 100644 --- a/tools/editor/editor_data.h +++ b/tools/editor/editor_data.h @@ -150,6 +150,7 @@ public: EditorPlugin* get_editor(Object *p_object); EditorPlugin* get_subeditor(Object *p_object); + Vector<EditorPlugin*> get_subeditors(Object *p_object); EditorPlugin* get_editor(String p_name); void copy_object_params(Object *p_object); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 02b0e9447a..316485f42a 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1571,15 +1571,27 @@ void EditorNode::_imported(Node *p_node) { } +void EditorNode::_hide_top_editors() { + _display_top_editors(false); -void EditorNode::_hide_top_editors() { + editor_plugins_over->clear(); +} + +void EditorNode::_display_top_editors(bool p_display) { + editor_plugins_over->make_visible(p_display); +} + +void EditorNode::_set_top_editors(Vector<EditorPlugin*> p_editor_plugins_over) { + editor_plugins_over->set_plugins_list(p_editor_plugins_over); +} - if (editor_plugin_over) - editor_plugin_over->make_visible(false); - editor_plugin_over=NULL; +void EditorNode::_set_editing_top_editors(Object* p_current_object) { + editor_plugins_over->edit(p_current_object); } + + void EditorNode::_edit_current() { uint32_t current = editor_history.get_current(); @@ -1598,8 +1610,7 @@ void EditorNode::_edit_current() { property_editor->edit( NULL ); object_menu->set_disabled(true); - if (editor_plugin_over) - editor_plugin_over->make_visible(false); + _display_top_editors(false); return; } @@ -1679,20 +1690,18 @@ void EditorNode::_edit_current() { } - EditorPlugin *sub_plugin = editor_data.get_subeditor(current_obj); + Vector<EditorPlugin*> sub_plugins = editor_data.get_subeditors(current_obj); - if (sub_plugin) { + if (!sub_plugins.empty()) { + _display_top_editors(false); + _set_top_editors(sub_plugins); + _set_editing_top_editors(current_obj); + _display_top_editors(true); + + } else if (!editor_plugins_over->get_plugins_list().empty()) { - if (editor_plugin_over) - editor_plugin_over->make_visible(false); - editor_plugin_over=sub_plugin; - editor_plugin_over->edit(current_obj); - editor_plugin_over->make_visible(true); - } else if (editor_plugin_over) { - - editor_plugin_over->make_visible(false); - editor_plugin_over=NULL; + _hide_top_editors(); } /* @@ -2076,8 +2085,12 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { Node *scene = editor_data.get_edited_scene_root(); if (scene && scene->get_filename()!="") { - //_save_scene(scene->get_filename()); - _save_scene_with_preview(scene->get_filename()); + // save in background if in the script editor + if (_get_current_main_editor() == EDITOR_SCRIPT) { + _save_scene(scene->get_filename()); + } else { + _save_scene_with_preview(scene->get_filename()); + } return; }; // fallthrough to save_as @@ -2579,10 +2592,9 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } editor_data.get_undo_redo().clear_history(); - if (editor_plugin_over) { //reload editor plugin - editor_plugin_over->edit(NULL); - editor_plugin_over->edit(current); - } + + _set_editing_top_editors(NULL); + _set_editing_top_editors(current); } break; case OBJECT_CALL_METHOD: { @@ -2660,6 +2672,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { break; } + _menu_option_confirm(RUN_STOP,true); get_tree()->quit(); String exec = OS::get_singleton()->get_executable_path(); @@ -6134,7 +6147,7 @@ EditorNode::EditorNode() { _rebuild_import_menu(); editor_plugin_screen=NULL; - editor_plugin_over=NULL; + editor_plugins_over = memnew(EditorPluginList); // force_top_viewport(true); _edit_current(); @@ -6266,12 +6279,72 @@ EditorNode::EditorNode() { EditorNode::~EditorNode() { - - + memdelete( EditorHelp::get_doc_data() ); memdelete(editor_selection); + memdelete(editor_plugins_over); memdelete(file_server); EditorSettings::destroy(); } +/* + * EDITOR PLUGIN LIST + */ + + +void EditorPluginList::make_visible(bool p_visible) { + if (!plugins_list.empty()) { + for (int i = 0; i < plugins_list.size(); i++) { + plugins_list[i]->make_visible(p_visible); + } + } +} + +void EditorPluginList::edit(Object* p_object) { + if (!plugins_list.empty()) { + for (int i = 0; i < plugins_list.size(); i++) { + plugins_list[i]->edit(p_object); + } + } +} + +bool EditorPluginList::forward_input_event(const InputEvent& p_event) { + bool discard = false; + if (!plugins_list.empty()) { + for (int i = 0; i < plugins_list.size(); i++) { + if (plugins_list[i]->forward_input_event(p_event)) { + discard = true; + } + } + } + return discard; +} + +bool EditorPluginList::forward_spatial_input_event(Camera* p_camera, const InputEvent& p_event) { + bool discard = false; + if (!plugins_list.empty()) { + for (int i = 0; i < plugins_list.size(); i++) { + if (plugins_list[i]->forward_spatial_input_event(p_camera, p_event)) { + discard = true; + } + } + } + return discard; +} + +bool EditorPluginList::empty() { + return plugins_list.empty(); +} + +void EditorPluginList::clear() { + plugins_list.clear(); +} + +EditorPluginList::EditorPluginList() { +} + +EditorPluginList::~EditorPluginList() { +} + + diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index b8fabb4c55..e4939afd34 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -95,7 +95,7 @@ typedef void (*EditorNodeInitCallback)(); - +class EditorPluginList; class EditorNode : public Node { @@ -372,7 +372,7 @@ private: Vector<EditorPlugin*> editor_plugins; EditorPlugin *editor_plugin_screen; - EditorPlugin *editor_plugin_over; + EditorPluginList *editor_plugins_over; EditorHistory editor_history; EditorData editor_data; @@ -449,6 +449,10 @@ private: void _transform_keyed(Object *sp,const String& p_sub,const Transform& p_key); void _hide_top_editors(); + void _display_top_editors(bool p_display); + void _set_top_editors(Vector<EditorPlugin*> p_editor_plugins_over); + void _set_editing_top_editors(Object * p_current_object); + void _quick_opened(); void _quick_run(); @@ -575,7 +579,7 @@ public: EditorPlugin *get_editor_plugin_screen() { return editor_plugin_screen; } - EditorPlugin *get_editor_plugin_over() { return editor_plugin_over; } + EditorPluginList *get_editor_plugins_over() { return editor_plugins_over; } PropertyEditor *get_property_editor() { return property_editor; } static void add_editor_plugin(EditorPlugin *p_editor); @@ -710,6 +714,32 @@ struct EditorProgress { ~EditorProgress() { EditorNode::progress_end_task(task); } }; +class EditorPluginList : public Object { +private: + Vector<EditorPlugin*> plugins_list; + +public: + + void set_plugins_list(Vector<EditorPlugin*> p_plugins_list) { + plugins_list = p_plugins_list; + } + + Vector<EditorPlugin*> get_plugins_list() { + return plugins_list; + } + + void make_visible(bool p_visible); + void edit(Object *p_object); + bool forward_input_event(const InputEvent& p_event); + bool forward_spatial_input_event(Camera* p_camera, const InputEvent& p_event); + void clear(); + bool empty(); + + EditorPluginList(); + ~EditorPluginList(); + +} ; + struct EditorProgressBG { String task; diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index b86e4cc51f..06e92028c7 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -392,11 +392,15 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["global/default_project_export_path"]=PropertyInfo(Variant::STRING,"global/default_project_export_path",PROPERTY_HINT_GLOBAL_DIR); set("global/show_script_in_scene_tabs",false); set("text_editor/background_color",Color::html("3b000000")); + set("text_editor/caret_color",Color::html("aaaaaa")); + set("text_editor/line_number_color",Color::html("66aaaaaa")); set("text_editor/text_color",Color::html("aaaaaa")); set("text_editor/text_selected_color",Color::html("000000")); set("text_editor/keyword_color",Color::html("ffffb3")); set("text_editor/base_type_color",Color::html("a4ffd4")); set("text_editor/engine_type_color",Color::html("83d3ff")); + set("text_editor/function_color",Color::html("66a2ce")); + set("text_editor/member_variable_color",Color::html("e64e59")); set("text_editor/comment_color",Color::html("983d1b")); set("text_editor/string_color",Color::html("ef6ebe")); set("text_editor/number_color",Color::html("EB9532")); @@ -406,6 +410,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("text_editor/current_line_color",Color(0.3,0.5,0.8,0.15)); set("text_editor/word_highlighted_color",Color(0.8,0.9,0.9,0.15)); + set("text_editor/syntax_highlighting", true); + set("text_editor/highlight_all_occurrences", true); set("text_editor/scroll_past_end_of_file", false); @@ -413,6 +419,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["text_editor/tab_size"]=PropertyInfo(Variant::INT,"text_editor/tab_size",PROPERTY_HINT_RANGE,"1, 64, 1"); // size of 0 crashes. set("text_editor/draw_tabs", true); + set("text_editor/show_line_numbers", true); + set("text_editor/idle_parse_delay",2); set("text_editor/create_signal_callbacks",true); set("text_editor/autosave_interval_secs",0); @@ -443,6 +451,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("3d_editor/zoom_modifier",4); hints["3d_editor/zoom_modifier"]=PropertyInfo(Variant::INT,"3d_editor/zoom_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl"); set("3d_editor/emulate_numpad",false); + set("3d_editor/trackpad_hint", false); set("2d_editor/bone_width",5); set("2d_editor/bone_color1",Color(1.0,1.0,1.0,0.9)); diff --git a/tools/editor/icons/make_icons.py b/tools/editor/icons/make_icons.py index 9752fef6fe..e06cbac720 100644 --- a/tools/editor/icons/make_icons.py +++ b/tools/editor/icons/make_icons.py @@ -10,29 +10,29 @@ f.write("#include \"editor_icons.h\"\n\n") f.write("#include \"scene/resources/theme.h\"\n\n") for x in pixmaps: - + var_str=x[:-4]+"_png"; - + f.write("static const unsigned char "+ var_str +"[]={\n"); - + pngf=open(x,"rb"); - + b=pngf.read(1); while(len(b)==1): f.write(hex(ord(b))) b=pngf.read(1); if (len(b)==1): f.write(",") - + f.write("\n};\n\n\n"); pngf.close(); - + f.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png) {\n") f.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n") f.write("\ttexture->create_from_image( Image(p_png),ImageTexture::FLAG_FILTER );\n") f.write("\treturn texture;\n") f.write("}\n\n") - + f.write("void editor_register_icons(Ref<Theme> p_theme) {\n\n") diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 15e7a70111..af6ae561df 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1164,14 +1164,14 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce this_import = memnew( OptionButton ); this_import->add_item("Overwrite Existing Scene"); - this_import->add_item("Owerwrite Existing, Keep Materials"); + this_import->add_item("Overwrite Existing, Keep Materials"); this_import->add_item("Keep Existing, Merge with New"); this_import->add_item("Keep Existing, Ignore New"); vbc->add_margin_child("This Time:",this_import); next_import = memnew( OptionButton ); next_import->add_item("Overwrite Existing Scene"); - next_import->add_item("Owerwrite Existing, Keep Materials"); + next_import->add_item("Overwrite Existing, Keep Materials"); next_import->add_item("Keep Existing, Merge with New"); next_import->add_item("Keep Existing, Ignore New"); vbc->add_margin_child("Next Time:",next_import); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 6eb26542be..91c26d9d59 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -39,6 +39,7 @@ #include "scene/gui/grid_container.h" #include "tools/editor/animation_editor.h" #include "tools/editor/plugins/animation_player_editor_plugin.h" +#include "scene/resources/packed_scene.h" class SnapDialog : public ConfirmationDialog { @@ -415,6 +416,14 @@ void CanvasItemEditor::_keying_changed() { animation_hb->hide(); } +bool CanvasItemEditor::_is_part_of_subscene(CanvasItem *p_item) { + + Node* scene_node = get_tree()->get_edited_scene_root(); + Node* item_owner = p_item->get_owner(); + + return item_owner && item_owner!=scene_node && p_item!=scene_node && item_owner->get_filename()!=""; +} + // slow but modern computers should have no problem CanvasItem* CanvasItemEditor::_select_canvas_item_at_pos(const Point2& p_pos,Node* p_node,const Matrix32& p_parent_xform,const Matrix32& p_canvas_xform) { @@ -441,8 +450,7 @@ CanvasItem* CanvasItemEditor::_select_canvas_item_at_pos(const Point2& p_pos,Nod return r; } - - if (c && c->is_visible() && !c->has_meta("_edit_lock_") && !c->cast_to<CanvasLayer>()) { + if (c && c->is_visible() && !c->has_meta("_edit_lock_") && !_is_part_of_subscene(c) && !c->cast_to<CanvasLayer>()) { Rect2 rect = c->get_item_rect(); Point2 local_pos = (p_parent_xform * p_canvas_xform * c->get_transform()).affine_inverse().xform(p_pos); @@ -1037,10 +1045,10 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { { EditorNode *en = editor; - EditorPlugin *over_plugin = en->get_editor_plugin_over(); + EditorPluginList *over_plugin_list = en->get_editor_plugins_over(); - if (over_plugin) { - bool discard = over_plugin->forward_input_event(p_event); + if (!over_plugin_list->empty()) { + bool discard = over_plugin_list->forward_input_event(p_event); if (discard) { accept_event(); return; @@ -3345,7 +3353,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { PopupMenu *p2 = memnew(PopupMenu); p->add_child(p2); p2->set_name("skeleton"); - p2->add_item("Make Bones",SKELETON_MAKE_BONES,KEY_MASK_CMD|KEY_SHIFT|KEY_B); + p2->add_item("Make Bones",SKELETON_MAKE_BONES,KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_B); p2->add_item("Clear Bones",SKELETON_CLEAR_BONES); p2->add_separator(); p2->add_item("Make IK Chain",SKELETON_SET_IK_CHAIN); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h index 301c67756c..22acfceed0 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.h +++ b/tools/editor/plugins/canvas_item_editor_plugin.h @@ -295,6 +295,7 @@ class CanvasItemEditor : public VBoxContainer { int handle_len; + bool _is_part_of_subscene(CanvasItem *p_item); CanvasItem* _select_canvas_item_at_pos(const Point2 &p_pos,Node* p_node,const Matrix32& p_parent_xform,const Matrix32& p_canvas_xform); void _find_canvas_items_at_pos(const Point2 &p_pos,Node* p_node,const Matrix32& p_parent_xform,const Matrix32& p_canvas_xform, Vector<_SelectResult> &r_items); void _find_canvas_items_at_rect(const Rect2& p_rect,Node* p_node,const Matrix32& p_parent_xform,const Matrix32& p_canvas_xform,List<CanvasItem*> *r_items); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 4772583c55..6ed44901f1 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -288,16 +288,19 @@ void ScriptTextEditor::_load_theme_settings() { get_text_edit()->set_custom_bg_color(EDITOR_DEF("text_editor/background_color",Color(0,0,0,0))); get_text_edit()->add_color_override("font_color",EDITOR_DEF("text_editor/text_color",Color(0,0,0))); + get_text_edit()->add_color_override("line_number_color",EDITOR_DEF("text_editor/line_number_color",Color(0,0,0))); + get_text_edit()->add_color_override("caret_color",EDITOR_DEF("text_editor/caret_color",Color(0,0,0))); get_text_edit()->add_color_override("font_selected_color",EDITOR_DEF("text_editor/text_selected_color",Color(1,1,1))); get_text_edit()->add_color_override("selection_color",EDITOR_DEF("text_editor/selection_color",Color(0.2,0.2,1))); get_text_edit()->add_color_override("brace_mismatch_color",EDITOR_DEF("text_editor/brace_mismatch_color",Color(1,0.2,0.2))); get_text_edit()->add_color_override("current_line_color",EDITOR_DEF("text_editor/current_line_color",Color(0.3,0.5,0.8,0.15))); get_text_edit()->add_color_override("word_highlighted_color",EDITOR_DEF("text_editor/word_highlighted_color",Color(0.8,0.9,0.9,0.15))); get_text_edit()->add_color_override("number_color",EDITOR_DEF("text_editor/number_color",Color(0.9,0.6,0.0,2))); + get_text_edit()->add_color_override("function_color",EDITOR_DEF("text_editor/function_color",Color(0.4,0.6,0.8))); + get_text_edit()->add_color_override("member_variable_color",EDITOR_DEF("text_editor/member_variable_color",Color(0.9,0.3,0.3))); Color keyword_color= EDITOR_DEF("text_editor/keyword_color",Color(0.5,0.0,0.2)); - get_text_edit()->set_syntax_coloring(true); List<String> keywords; script->get_language()->get_reserved_words(&keywords); for(List<String>::Element *E=keywords.front();E;E=E->next()) { @@ -1070,6 +1073,7 @@ void ScriptEditor::_menu_option(int p_option) { if (scr.is_null()) return; + tx->begin_complex_operation(); if (tx->is_selection_active()) { int from_line = tx->get_selection_from_line(); @@ -1101,6 +1105,7 @@ void ScriptEditor::_menu_option(int p_option) { swap_lines(tx, line_id, next_id); } + tx->end_complex_operation(); tx->update(); } break; @@ -1111,6 +1116,7 @@ void ScriptEditor::_menu_option(int p_option) { if (scr.is_null()) return; + tx->begin_complex_operation(); if (tx->is_selection_active()) { int from_line = tx->get_selection_from_line(); @@ -1142,6 +1148,7 @@ void ScriptEditor::_menu_option(int p_option) { swap_lines(tx, line_id, next_id); } + tx->end_complex_operation(); tx->update(); } break; @@ -1152,27 +1159,10 @@ void ScriptEditor::_menu_option(int p_option) { if (scr.is_null()) return; - + tx->begin_complex_operation(); if (tx->is_selection_active()) { - int begin = tx->get_selection_from_line(); - int end = tx->get_selection_to_line(); - for (int i = begin; i <= end; i++) - { - String line_text = tx->get_line(i); - // begins with tab - if (line_text.begins_with("\t")) - { - line_text = line_text.substr(1, line_text.length()); - tx->set_line(i, line_text); - } - // begins with 4 spaces - else if (line_text.begins_with(" ")) - { - line_text = line_text.substr(4, line_text.length()); - tx->set_line(i, line_text); - } - } + tx->indent_selection_left(); } else { @@ -1191,6 +1181,7 @@ void ScriptEditor::_menu_option(int p_option) { tx->set_line(begin, line_text); } } + tx->end_complex_operation(); tx->update(); //tx->deselect(); @@ -1202,16 +1193,10 @@ void ScriptEditor::_menu_option(int p_option) { if (scr.is_null()) return; + tx->begin_complex_operation(); if (tx->is_selection_active()) { - int begin = tx->get_selection_from_line(); - int end = tx->get_selection_to_line(); - for (int i = begin; i <= end; i++) - { - String line_text = tx->get_line(i); - line_text = '\t' + line_text; - tx->set_line(i, line_text); - } + tx->indent_selection_right(); } else { @@ -1220,6 +1205,7 @@ void ScriptEditor::_menu_option(int p_option) { line_text = '\t' + line_text; tx->set_line(begin, line_text); } + tx->end_complex_operation(); tx->update(); //tx->deselect(); @@ -1251,11 +1237,16 @@ void ScriptEditor::_menu_option(int p_option) { return; - + tx->begin_complex_operation(); if (tx->is_selection_active()) { int begin = tx->get_selection_from_line(); int end = tx->get_selection_to_line(); + + // End of selection ends on the first column of the last line, ignore it. + if(tx->get_selection_to_column() == 0) + end -= 1; + for (int i = begin; i <= end; i++) { String line_text = tx->get_line(i); @@ -1278,6 +1269,7 @@ void ScriptEditor::_menu_option(int p_option) { line_text = "#" + line_text; tx->set_line(begin, line_text); } + tx->end_complex_operation(); tx->update(); //tx->deselect(); @@ -1933,6 +1925,8 @@ void ScriptEditor::edit(const Ref<Script>& p_script) { ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); ste->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); ste->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); + ste->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); + ste->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); ste->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); ste->get_text_edit()->set_callhint_settings( EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"), @@ -2073,6 +2067,8 @@ void ScriptEditor::_editor_settings_changed() { ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); ste->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); ste->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); + ste->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); + ste->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); ste->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); } @@ -2702,7 +2698,7 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { EDITOR_DEF("text_editor/script_temperature_history_size",15); EDITOR_DEF("text_editor/script_temperature_hot_color",Color(1,0,0,0.3)); EDITOR_DEF("text_editor/script_temperature_cold_color",Color(0,0,1,0.3)); - EDITOR_DEF("text_editor/group_help_pages",false); + EDITOR_DEF("text_editor/group_help_pages",true); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_GLOBAL_FILE)); EDITOR_DEF("external_editor/exec_flags",""); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 79ff78ca0d..c4d3f7282e 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -51,7 +51,31 @@ #define GIZMO_SCALE_DEFAULT 0.15 -//void SpatialEditorViewport::_update_camera(); +void SpatialEditorViewport::_update_camera() { + if (orthogonal) { + Size2 size = get_size(); + Size2 vpsize = Point2(cursor.distance*size.get_aspect(), cursor.distance / size.get_aspect()); + //camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar()); + camera->set_orthogonal(2 * cursor.distance, 0.1, 8192); + } + else + camera->set_perspective(get_fov(), get_znear(), get_zfar()); + + Transform camera_transform; + camera_transform.translate(cursor.pos); + camera_transform.basis.rotate(Vector3(0, 1, 0), cursor.y_rot); + camera_transform.basis.rotate(Vector3(1, 0, 0), cursor.x_rot); + + if (orthogonal) + camera_transform.translate(0, 0, 4096); + else + camera_transform.translate(0, 0, cursor.distance); + + if (camera->get_global_transform() != camera_transform) { + camera->set_global_transform(camera_transform); + update_transform_gizmo_view(); + } +} String SpatialEditorGizmo::get_handle_name(int p_idx) const { @@ -810,16 +834,15 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { { EditorNode *en = editor; - EditorPlugin *over_plugin = en->get_editor_plugin_over(); + EditorPluginList *over_plugin_list = en->get_editor_plugins_over(); - if (over_plugin) { - bool discard = over_plugin->forward_spatial_input_event(camera,p_event); + if (!over_plugin_list->empty()) { + bool discard = over_plugin_list->forward_spatial_input_event(camera,p_event); if (discard) return; } } - switch(p_event.type) { case InputEvent::MOUSE_BUTTON: { @@ -1204,11 +1227,9 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { } } break; case InputEvent::MOUSE_MOTION: { - const InputEventMouseMotion &m=p_event.mouse_motion; _edit.mouse_pos=Point2(p_event.mouse_motion.x,p_event.mouse_motion.y); - - + if (spatial_editor->get_selected()) { @@ -1244,7 +1265,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { NavigationScheme nav_scheme = _get_navigation_schema("3d_editor/navigation_scheme"); NavigationMode nav_mode = NAVIGATION_NONE; - + if (_edit.gizmo.is_valid()) { Plane plane=Plane(_edit.gizmo_initial_pos,_get_camera_normal()); @@ -1558,6 +1579,27 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (m.mod.alt) nav_mode = NAVIGATION_PAN; } + + } else if (EditorSettings::get_singleton()->get("3d_editor/trackpad_hint")) { + // Handle trackpad (no external mouse) use case + int mod = 0; + if (m.mod.shift) + mod=KEY_SHIFT; + if (m.mod.alt) + mod=KEY_ALT; + if (m.mod.control) + mod=KEY_CONTROL; + if (m.mod.meta) + mod=KEY_META; + + if(mod){ + if (mod == _get_key_modifier("3d_editor/pan_modifier")) + nav_mode = NAVIGATION_PAN; + else if (mod == _get_key_modifier("3d_editor/zoom_modifier")) + nav_mode = NAVIGATION_ZOOM; + else if (mod == _get_key_modifier("3d_editor/orbit_modifier")) + nav_mode = NAVIGATION_ORBIT; + } } switch(nav_mode) { @@ -1770,6 +1812,10 @@ void SpatialEditorViewport::_notification(int p_what) { bool visible=is_visible(); set_process(visible); + + if (visible) + _update_camera(); + call_deferred("update_transform_gizmo_view"); } @@ -1791,28 +1837,7 @@ void SpatialEditorViewport::_notification(int p_what) { } */ - if (orthogonal) { - Size2 size=get_size(); - Size2 vpsize = Point2(cursor.distance*size.get_aspect(),cursor.distance/size.get_aspect()); - //camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar()); - camera->set_orthogonal(2*cursor.distance,0.1,8192); - } else - camera->set_perspective(get_fov(),get_znear(),get_zfar()); - - Transform camera_transform; - camera_transform.translate( cursor.pos ); - camera_transform.basis.rotate(Vector3(0,1,0),cursor.y_rot); - camera_transform.basis.rotate(Vector3(1,0,0),cursor.x_rot); - - if (orthogonal) - camera_transform.translate(0,0,4096); - else - camera_transform.translate(0,0,cursor.distance); - - if (camera->get_global_transform()!=camera_transform) { - camera->set_global_transform( camera_transform ); - update_transform_gizmo_view(); - } + _update_camera(); Map<Node*,Object*> &selection = editor_selection->get_selection(); @@ -1915,7 +1940,6 @@ void SpatialEditorViewport::_notification(int p_what) { surface->connect("mouse_enter",this,"_smouseenter"); preview_camera->set_icon(get_icon("Camera","EditorIcons")); _init_gizmo_instance(index); - } if (p_what==NOTIFICATION_EXIT_TREE) { @@ -3553,9 +3577,9 @@ void SpatialEditor::_unhandled_key_input(InputEvent p_event) { { EditorNode *en = editor; - EditorPlugin *over_plugin = en->get_editor_plugin_over(); + EditorPluginList *over_plugin_list = en->get_editor_plugins_over(); - if (over_plugin && over_plugin->forward_input_event(p_event)) { + if (!over_plugin_list->empty() && over_plugin_list->forward_input_event(p_event)) { return; //ate the over input event } @@ -3579,6 +3603,17 @@ void SpatialEditor::_unhandled_key_input(InputEvent p_event) { case KEY_E: _menu_item_pressed(MENU_TOOL_ROTATE); break; case KEY_R: _menu_item_pressed(MENU_TOOL_SCALE); break; + case KEY_Z: { + if (k.mod.shift || k.mod.control || k.mod.command) + break; + + if (view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_WIREFRAME))) { + _menu_item_pressed(MENU_VIEW_DISPLAY_NORMAL); + } else { + _menu_item_pressed(MENU_VIEW_DISPLAY_WIREFRAME); + } + } break; + #if 0 #endif } diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 5877ce1a43..c6115ba87a 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -1098,8 +1098,7 @@ void SceneTreeDock::_delete_confirm() { return; - if (editor->get_editor_plugin_over()) - editor->get_editor_plugin_over()->make_visible(false); + editor->get_editor_plugins_over()->make_visible(false); editor_data->get_undo_redo().create_action("Remove Node(s)"); @@ -1318,6 +1317,7 @@ void SceneTreeDock::_create() { if (n==edited_scene) { edited_scene=newnode; editor->set_edited_scene(newnode); + newnode->set_editable_instances(n->get_editable_instances()); } //small hack to make collisionshapes and other kind of nodes to work diff --git a/tools/export/blender25/godot_export_manager.py b/tools/export/blender25/godot_export_manager.py index 582d76f94f..a249611c71 100644 --- a/tools/export/blender25/godot_export_manager.py +++ b/tools/export/blender25/godot_export_manager.py @@ -41,9 +41,9 @@ class godot_export_manager(bpy.types.Panel): bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "scene" - + bpy.types.Scene.godot_export_on_save = BoolProperty(default=False) - + ### draw function for all ui elements def draw(self, context): layout = self.layout @@ -51,56 +51,56 @@ class godot_export_manager(bpy.types.Panel): scene = bpy.data.scenes[0] ob = context.object scene = context.scene - + row = layout.row() col = row.column() col.prop(scene,"godot_export_on_save",text="Export Groups on save") - + row = layout.row() col = row.column(align=True) op = col.operator("scene.godot_add_objects_to_group",text="Add selected objects to Group",icon="COPYDOWN") - + op = col.operator("scene.godot_delete_objects_from_group",text="Delete selected objects from Group",icon="PASTEDOWN") - - - + + + row = layout.row() col = row.column() col.label(text="Export Groups:") - - + + row = layout.row() col = row.column() - + col.template_list("UI_List_Godot","dummy",scene, "godot_export_groups", scene, "godot_export_groups_index",rows=1,maxrows=10,type='DEFAULT') - + col = row.column(align=True) col.operator("scene.godot_add_export_group",text="",icon="ZOOMIN") col.operator("scene.godot_delete_export_group",text="",icon="ZOOMOUT") col.operator("scene.godot_export_all_groups",text="",icon="EXPORT") - - if len(scene.godot_export_groups) > 0: + + if len(scene.godot_export_groups) > 0: row = layout.row() col = row.column() group = scene.godot_export_groups[scene.godot_export_groups_index] col.prop(group,"name",text="Group Name") col.prop(group,"export_name",text="Export Name") col.prop(group,"export_path",text="Export Filepath") - + row = layout.row() col = row.column() row = layout.row() col = row.column() col.label(text="Export Settings:") - + col = col.row(align=True) col.prop(group,"apply_loc",toggle=True,icon="MAN_TRANS") col.prop(group,"apply_rot",toggle=True,icon="MAN_ROT") col.prop(group,"apply_scale",toggle=True,icon="MAN_SCALE") - + row = layout.row() col = row.column() - + col.prop(group,"use_include_particle_duplicates") col.prop(group,"use_mesh_modifiers") col.prop(group,"use_tangent_arrays") @@ -120,25 +120,25 @@ class UI_List_Godot(bpy.types.UIList): ob = data slot = item col = layout.row(align=True) - + col.label(text=item.name,icon="GROUP") col.prop(item,"active",text="") - + op = col.operator("scene.godot_select_group_objects",text="",emboss=False,icon="RESTRICT_SELECT_OFF") op.idx = index op = col.operator("scene.godot_export_group",text="",emboss=False,icon="EXPORT") op.idx = index - + class add_objects_to_group(bpy.types.Operator): bl_idname = "scene.godot_add_objects_to_group" bl_label = "Add Objects to Group" bl_description = "Adds the selected Objects to the active group below." - + undo = BoolProperty(default=True) - + def execute(self,context): scene = context.scene - + objects_str = "" if len(scene.godot_export_groups) > 0: for i,object in enumerate(context.selected_objects): @@ -148,57 +148,57 @@ class add_objects_to_group(bpy.types.Operator): if i == 0: objects_str += object.name else: - objects_str += ", "+object.name - - + objects_str += ", "+object.name + + self.report({'INFO'}, objects_str + " added to group." ) if self.undo: bpy.ops.ed.undo_push(message="Objects added to group") else: - self.report({'WARNING'}, "Create a group first." ) + self.report({'WARNING'}, "Create a group first." ) return{'FINISHED'} class del_objects_from_group(bpy.types.Operator): bl_idname = "scene.godot_delete_objects_from_group" bl_label = "Delete Objects from Group" bl_description = "Delets the selected Objects from the active group below." - + def execute(self,context): scene = context.scene - + if len(scene.godot_export_groups) > 0: - + selected_objects = [] for object in context.selected_objects: selected_objects.append(object.name) - + objects_str = "" j = 0 for i,node in enumerate(scene.godot_export_groups[scene.godot_export_groups_index].nodes): if node.name in selected_objects: scene.godot_export_groups[scene.godot_export_groups_index].nodes.remove(i) - + if j == 0: objects_str += object.name else: - objects_str += ", "+object.name + objects_str += ", "+object.name j+=1 - - - self.report({'INFO'}, objects_str + " deleted from group." ) + + + self.report({'INFO'}, objects_str + " deleted from group." ) bpy.ops.ed.undo_push(message="Objects deleted from group") else: - self.report({'WARNING'}, "There is no group to delete from." ) + self.report({'WARNING'}, "There is no group to delete from." ) return{'FINISHED'} class select_group_objects(bpy.types.Operator): bl_idname = "scene.godot_select_group_objects" bl_label = "Select Group Objects" bl_description = "Will select all group Objects in the scene." - + idx = IntProperty() - + def execute(self,context): scene = context.scene for object in context.scene.objects: @@ -208,12 +208,12 @@ class select_group_objects(bpy.types.Operator): bpy.data.objects[node.name].select = True context.scene.objects.active = bpy.data.objects[node.name] return{'FINISHED'} - + class export_groups_autosave(bpy.types.Operator): bl_idname = "scene.godot_export_groups_autosave" bl_label = "Export All Groups" bl_description = "Exports all groups to Collada." - + def execute(self,context): scene = context.scene if scene.godot_export_on_save: @@ -221,57 +221,57 @@ class export_groups_autosave(bpy.types.Operator): if scene.godot_export_groups[i].active: bpy.ops.scene.godot_export_group(idx=i) self.report({'INFO'}, "All Groups exported." ) - bpy.ops.ed.undo_push(message="Export all Groups") + bpy.ops.ed.undo_push(message="Export all Groups") return{'FINISHED'} - + class export_all_groups(bpy.types.Operator): bl_idname = "scene.godot_export_all_groups" bl_label = "Export All Groups" bl_description = "Exports all groups to Collada." - + def execute(self,context): scene = context.scene - + for i in range(0,len(scene.godot_export_groups)): bpy.ops.scene.godot_export_group(idx=i,export_all=True) - + self.report({'INFO'}, "All Groups exported." ) - return{'FINISHED'} - - + return{'FINISHED'} + + class export_group(bpy.types.Operator): bl_idname = "scene.godot_export_group" bl_label = "Export Group" bl_description = "Exports the active group to destination folder as Collada file." - + idx = IntProperty(default=0) export_all = BoolProperty(default=False) - + def copy_object_recursive(self,ob,parent,single_user = True): new_ob = bpy.data.objects[ob.name].copy() if single_user or ob.type=="ARMATURE": new_mesh_data = new_ob.data.copy() new_ob.data = new_mesh_data bpy.context.scene.objects.link(new_ob) - + if ob != parent: new_ob.parent = parent else: - new_ob.parent = None - - for child in ob.children: + new_ob.parent = None + + for child in ob.children: self.copy_object_recursive(child,new_ob,single_user) - new_ob.select = True + new_ob.select = True return new_ob - + def delete_object(self,ob): if ob != None: for child in ob.children: self.delete_object(child) bpy.context.scene.objects.unlink(ob) - bpy.data.objects.remove(ob) - + bpy.data.objects.remove(ob) + def convert_group_to_node(self,group): if group.dupli_group != None: for object in group.dupli_group.objects: @@ -281,48 +281,48 @@ class export_group(bpy.types.Operator): object.matrix_local = Matrix() object.matrix_local *= group.matrix_local object.matrix_local *= matrix - - self.delete_object(group) - + + self.delete_object(group) + def execute(self,context): - + scene = context.scene group = context.scene.godot_export_groups - + if not group[self.idx].active and self.export_all: return{'FINISHED'} - + for i,object in enumerate(group[self.idx].nodes): if object.name in bpy.data.objects: pass else: group[self.idx].nodes.remove(i) bpy.ops.ed.undo_push(message="Clear not existent Group Nodes.") - + path = group[self.idx].export_path if (path.find("//")==0 or path.find("\\\\")==0): #if relative, convert to absolute path = bpy.path.abspath(path) path = path.replace("\\","/") - - ### if path exists and group export name is set the group will be exported + + ### if path exists and group export name is set the group will be exported if os.path.exists(path) and group[self.idx].export_name != "": - + context.scene.layers = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True] - - + + if group[self.idx].export_name.endswith(".dae"): path = os.path.join(path,group[self.idx].export_name) - else: + else: path = os.path.join(path,group[self.idx].export_name+".dae") - - hide_select = [] + + hide_select = [] for object in context.scene.objects: hide_select.append(object.hide_select) object.hide_select = False object.select = False context.scene.objects.active = None - + ### make particle duplicates, parent and select them nodes_to_be_added = [] if group[self.idx].use_include_particle_duplicates: @@ -341,79 +341,79 @@ class export_group(bpy.types.Operator): context.scene.objects.active = None for object in nodes_to_be_added: object.select = True - + ### select all other nodes from the group for i,object in enumerate(group[self.idx].nodes): if bpy.data.objects[object.name].type == "EMPTY": self.convert_group_to_node(bpy.data.objects[object.name]) - else: + else: bpy.data.objects[object.name].select = True - + bpy.ops.object.transform_apply(location=group[self.idx].apply_loc, rotation=group[self.idx].apply_rot, scale=group[self.idx].apply_scale) - bpy.ops.export_scene.dae(check_existing=True, filepath=path, filter_glob="*.dae", object_types=group[self.idx].object_types, use_export_selected=group[self.idx].use_export_selected, use_mesh_modifiers=group[self.idx].use_mesh_modifiers, use_tangent_arrays=group[self.idx].use_tangent_arrays, use_triangles=group[self.idx].use_triangles, use_copy_images=group[self.idx].use_copy_images, use_active_layers=group[self.idx].use_active_layers, use_anim=group[self.idx].use_anim, use_anim_action_all=group[self.idx].use_anim_action_all, use_anim_skip_noexp=group[self.idx].use_anim_skip_noexp, use_anim_optimize=group[self.idx].use_anim_optimize, anim_optimize_precision=group[self.idx].anim_optimize_precision, use_metadata=group[self.idx].use_metadata) - - self.report({'INFO'}, '"'+group[self.idx].name+'"' + " Group exported." ) + bpy.ops.export_scene.dae(check_existing=True, filepath=path, filter_glob="*.dae", object_types=group[self.idx].object_types, use_export_selected=group[self.idx].use_export_selected, use_mesh_modifiers=group[self.idx].use_mesh_modifiers, use_tangent_arrays=group[self.idx].use_tangent_arrays, use_triangles=group[self.idx].use_triangles, use_copy_images=group[self.idx].use_copy_images, use_active_layers=group[self.idx].use_active_layers, use_anim=group[self.idx].use_anim, use_anim_action_all=group[self.idx].use_anim_action_all, use_anim_skip_noexp=group[self.idx].use_anim_skip_noexp, use_anim_optimize=group[self.idx].use_anim_optimize, anim_optimize_precision=group[self.idx].anim_optimize_precision, use_metadata=group[self.idx].use_metadata) + + self.report({'INFO'}, '"'+group[self.idx].name+'"' + " Group exported." ) msg = "Export Group "+group[self.idx].name - + bpy.ops.ed.undo_push(message="") bpy.ops.ed.undo() bpy.ops.ed.undo_push(message=msg) - + else: - self.report({'INFO'}, "Define Export Name and Export Path." ) + self.report({'INFO'}, "Define Export Name and Export Path." ) return{'FINISHED'} class add_export_group(bpy.types.Operator): bl_idname = "scene.godot_add_export_group" bl_label = "Adds a new export Group" bl_description = "Creates a new Export Group with the selected Objects assigned to it." - + def execute(self,context): scene = context.scene - + item = scene.godot_export_groups.add() item.name = "New Group" for object in context.selected_objects: node = item.nodes.add() node.name = object.name - scene.godot_export_groups_index = len(scene.godot_export_groups)-1 + scene.godot_export_groups_index = len(scene.godot_export_groups)-1 bpy.ops.ed.undo_push(message="Create New Export Group") return{'FINISHED'} - + class del_export_group(bpy.types.Operator): bl_idname = "scene.godot_delete_export_group" bl_label = "Delets the selected export Group" bl_description = "Delets the active Export Group." - + def invoke(self, context, event): - wm = context.window_manager + wm = context.window_manager return wm.invoke_confirm(self,event) - + def execute(self,context): scene = context.scene - + scene.godot_export_groups.remove(scene.godot_export_groups_index) if scene.godot_export_groups_index > 0: scene.godot_export_groups_index -= 1 bpy.ops.ed.undo_push(message="Delete Export Group") - return{'FINISHED'} + return{'FINISHED'} class godot_node_list(bpy.types.PropertyGroup): name = StringProperty() - + class godot_export_groups(bpy.types.PropertyGroup): name = StringProperty(name="Group Name") export_name = StringProperty(name="scene_name") nodes = CollectionProperty(type=godot_node_list) export_path = StringProperty(subtype="DIR_PATH") active = BoolProperty(default=True,description="Export Group") - + object_types = EnumProperty(name="Object Types",options={'ENUM_FLAG'},items=(('EMPTY', "Empty", ""),('CAMERA', "Camera", ""),('LAMP', "Lamp", ""),('ARMATURE', "Armature", ""),('MESH', "Mesh", ""),('CURVE', "Curve", ""),),default={'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH','CURVE'}) - + apply_scale = BoolProperty(name="Apply Scale",description="Apply Scale before export.",default=False) apply_rot = BoolProperty(name="Apply Rotation",description="Apply Rotation before export.",default=False) apply_loc = BoolProperty(name="Apply Location",description="Apply Location before export.",default=False) - + use_export_selected = BoolProperty(name="Selected Objects",description="Export only selected objects (and visible in active layers if that applies).",default=True) use_mesh_modifiers = BoolProperty(name="Apply Modifiers",description="Apply modifiers to mesh objects (on a copy!).",default=True) use_tangent_arrays = BoolProperty(name="Tangent Arrays",description="Export Tangent and Binormal arrays (for normalmapping).",default=False) @@ -431,7 +431,7 @@ class godot_export_groups(bpy.types.PropertyGroup): use_metadata = BoolProperty(name="Use Metadata",default=True,options={'HIDDEN'}) use_include_particle_duplicates = BoolProperty(name="Include Particle Duplicates",default=True) -def register(): +def register(): bpy.utils.register_class(godot_export_manager) bpy.utils.register_class(godot_node_list) bpy.utils.register_class(godot_export_groups) @@ -465,7 +465,7 @@ def unregister(): @persistent def auto_export(dummy): bpy.ops.scene.godot_export_groups_autosave() - + bpy.app.handlers.save_post.append(auto_export) if __name__ == "__main__": diff --git a/tools/export/blender25/io_scene_dae/__init__.py b/tools/export/blender25/io_scene_dae/__init__.py index 182ec21e63..a1a0eabbbe 100644 --- a/tools/export/blender25/io_scene_dae/__init__.py +++ b/tools/export/blender25/io_scene_dae/__init__.py @@ -59,7 +59,7 @@ class ExportDAE(bpy.types.Operator, ExportHelper): # List of operator properties, the attributes will be assigned # to the class instance from the operator settings before calling. - + object_types = EnumProperty( name="Object Types", options={'ENUM_FLAG'}, diff --git a/tools/export/blender25/io_scene_dae/export_dae.py b/tools/export/blender25/io_scene_dae/export_dae.py index 370dc359b5..cdd845e384 100644 --- a/tools/export/blender25/io_scene_dae/export_dae.py +++ b/tools/export/blender25/io_scene_dae/export_dae.py @@ -171,38 +171,38 @@ class DaeExporter: def export_image(self,image): if (image in self.image_cache): return self.image_cache[image] - + imgpath = image.filepath if (imgpath.find("//")==0 or imgpath.find("\\\\")==0): #if relative, convert to absolute imgpath = bpy.path.abspath(imgpath) #path is absolute, now do something! - + if (self.config["use_copy_images"]): #copy image basedir = os.path.dirname(self.path)+"/images" if (not os.path.isdir(basedir)): os.makedirs(basedir) - + if os.path.isfile(imgpath): dstfile=basedir+"/"+os.path.basename(imgpath) - + if (not os.path.isfile(dstfile)): shutil.copy(imgpath,dstfile) imgpath="images/"+os.path.basename(imgpath) else: ### if file is not found save it as png file in the destination folder - img_tmp_path = image.filepath + img_tmp_path = image.filepath if img_tmp_path.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")): image.filepath = basedir+"/"+os.path.basename(img_tmp_path) - else: + else: image.filepath = basedir+"/"+image.name+".png" - + dstfile=basedir+"/"+os.path.basename(image.filepath) - + if (not os.path.isfile(dstfile)): - + image.save() imgpath="images/"+os.path.basename(image.filepath) image.filepath = img_tmp_path @@ -211,15 +211,15 @@ class DaeExporter: #export relative, always, no one wants absolute paths. try: imgpath = os.path.relpath(imgpath,os.path.dirname(self.path)).replace("\\","/") # export unix compatible always - + except: pass #fails sometimes, not sure why - + imgid = self.new_id("image") print("FOR: "+imgpath) - + # if (not os.path.isfile(imgpath)): # print("NOT FILE?") # if imgpath.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")): @@ -956,7 +956,7 @@ class DaeExporter: self.writel(S_NODES,il,'<instance_controller url="#'+meshdata["morph_id"]+'">') close_controller=True elif (armature==None): - self.writel(S_NODES,il,'<instance_geometry url="#'+meshdata["id"]+'">') + self.writel(S_NODES,il,'<instance_geometry url="#'+meshdata["id"]+'">') if (len(meshdata["material_assign"])>0): @@ -1520,7 +1520,7 @@ class DaeExporter: tmp_bone_mat.append(Matrix(bone.matrix_basis)) bone.matrix_basis = Matrix() tmp_mat.append([Matrix(s.matrix_local),tmp_bone_mat]) - + self.writel(S_ANIM,0,'<library_animations>') @@ -1561,11 +1561,11 @@ class DaeExporter: if (not y in allowed_skeletons): allowed_skeletons.append(y) y.animation_data.action=x; - + y.matrix_local = tmp_mat[i][0] for j,bone in enumerate(s.pose.bones): bone.matrix_basis = Matrix() - + #print("allowed skeletons "+str(allowed_skeletons)) @@ -1600,9 +1600,9 @@ class DaeExporter: else: self.export_animation(self.scene.frame_start,self.scene.frame_end) - - - + + + self.writel(S_ANIM,0,'</library_animations>') def export(self): @@ -1684,7 +1684,7 @@ class DaeExporter: self.valid_nodes=[] self.armature_for_morph={} self.used_bones=[] - self.wrongvtx_report=False + self.wrongvtx_report=False diff --git a/tools/glwrapper/makewrapper.py b/tools/glwrapper/makewrapper.py index cde976d5f9..2e5f06be12 100644 --- a/tools/glwrapper/makewrapper.py +++ b/tools/glwrapper/makewrapper.py @@ -4,27 +4,27 @@ import sys if (len(sys.argv)<2): print("usage: makewrapper.py <headers>") sys.exit(255) - + functions=[] types=[] constants=[] - + READ_FUNCTIONS=0 READ_TYPES=1 READ_CONSTANTS=2 - + read_what=READ_TYPES - + for x in (range(len(sys.argv)-1)): f=open(sys.argv[x+1],"r") - + while(True): - + line=f.readline() if (line==""): break - + line=line.replace("\n","").strip() """ if (line.find("[types]")!=-1): @@ -37,7 +37,7 @@ for x in (range(len(sys.argv)-1)): read_what=READ_FUNCTIONS continue """ - + if (line.find("#define")!=-1): if (line.find("0x")==-1 and line.find("GL_VERSION")==-1): continue @@ -51,48 +51,48 @@ for x in (range(len(sys.argv)-1)): if (line.find("ARB")!=-1 or line.find("EXT")!=-1 or line.find("NV")!=-1): continue - line=line.replace("APIENTRY","") - line=line.replace("GLAPI","") - + line=line.replace("APIENTRY","") + line=line.replace("GLAPI","") + glpos=line.find(" gl") if (glpos==-1): - + glpos=line.find("\tgl") if (glpos==-1): continue - + ret=line[:glpos].strip(); - + line=line[glpos:].strip() namepos=line.find("(") - + if (namepos==-1): continue - + name=line[:namepos].strip() line=line[namepos:] - + argpos=line.rfind(")") if (argpos==-1): continue - + args=line[1:argpos] - + funcdata={} funcdata["ret"]=ret funcdata["name"]=name funcdata["args"]=args - + functions.append(funcdata) print(funcdata) - - - + + + #print(types) #print(constants) #print(functions) - - + + f=open("glwrapper.h","w") f.write("#ifndef GL_WRAPPER\n") @@ -109,10 +109,10 @@ header_code="""\ #error glATI.h included before glwrapper.h #endif -#define __gl_h_ -#define __GL_H__ -#define __glext_h_ -#define __GLEXT_H_ +#define __gl_h_ +#define __GL_H__ +#define __glext_h_ +#define __GLEXT_H_ #define __gl_ATI_h_ #define GL_TRUE 1 @@ -138,7 +138,7 @@ f.write("#define GLWRP_APIENTRY \n") f.write("#endif\n\n"); for x in types: f.write(x+"\n") - + f.write("\n\n") for x in constants: @@ -153,24 +153,24 @@ for x in functions: f.write("\n\n") f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n"); f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) );\n") - + f.write("#ifdef __cplusplus\n}\n#endif\n") f.write("#endif\n\n") - + f=open("glwrapper.c","w") f.write("\n\n") f.write("#include \"glwrapper.h\"\n") f.write("\n\n") - + for x in functions: f.write(x["ret"]+" GLWRP_APIENTRY (*__wrapper_"+x["name"]+")("+x["args"]+")=NULL;\n") - + f.write("\n\n") f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) ) {\n") f.write("\n") - + for x in functions: f.write("\t__wrapper_"+x["name"]+"=("+x["ret"]+" GLWRP_APIENTRY (*)("+x["args"]+"))wrapperFunc(\""+x["name"]+"\");\n") @@ -180,5 +180,4 @@ f.write("\n\n") - -
\ No newline at end of file + diff --git a/tools/html_fs/godotfs.js b/tools/html_fs/godotfs.js index 93cc30556b..2c59344cf5 100644 --- a/tools/html_fs/godotfs.js +++ b/tools/html_fs/godotfs.js @@ -50,7 +50,7 @@ Module.expectedDataFileDownloads++; function handleError(error) { console.error('package error:', error); }; - + var fetched = null, fetchedCallback = null; fetchRemotePackage('data.pck', function(data) { if (fetchedCallback) { @@ -60,7 +60,7 @@ Module.expectedDataFileDownloads++; fetched = data; } }, handleError); - + function runWithFS() { function assert(check, msg) { @@ -113,13 +113,13 @@ function assert(check, msg) { var PACKAGE_NAME = 'data.pck'; var REMOTE_PACKAGE_NAME = 'data.pck'; var PACKAGE_UUID = 'b39761ce-0348-4959-9b16-302ed8e1592e'; - + function processPackageData(arrayBuffer) { Module.finishedDataFileDownloads++; assert(arrayBuffer, 'Loading data file failed.'); var byteArray = new Uint8Array(arrayBuffer); var curr; - + // Reuse the bytearray from the XHR as the source for file reads. DataRequest.prototype.byteArray = byteArray; DataRequest.prototype.requests["/data.pck"].onload(); @@ -127,9 +127,9 @@ function assert(check, msg) { }; Module['addRunDependency']('datafile_datapack'); - + if (!Module.preloadResults) Module.preloadResults = {}; - + Module.preloadResults[PACKAGE_NAME] = {fromCache: false}; if (fetched) { processPackageData(fetched); @@ -137,7 +137,7 @@ function assert(check, msg) { } else { fetchedCallback = processPackageData; } - + } if (Module['calledRun']) { runWithFS(); diff --git a/tools/memsort.py b/tools/memsort.py index 8ecccae8bd..d2e4fe0226 100644 --- a/tools/memsort.py +++ b/tools/memsort.py @@ -33,4 +33,3 @@ while(l!=""): for x in sum: print(x.strip()+"("+str(cnt[x])+"):\n: "+str(sum[x])) -
\ No newline at end of file diff --git a/tools/scripts/makeargs.py b/tools/scripts/makeargs.py index 6f7afa6328..8c5539c5fe 100644 --- a/tools/scripts/makeargs.py +++ b/tools/scripts/makeargs.py @@ -40,7 +40,7 @@ text=""" visual_server->m_func($argp);\\ }\\ } - + #define FUNC$num(m_func,$argt)\\ virtual void m_func($argtp) { \\ @@ -59,8 +59,8 @@ text=""" visual_server->m_func($argp);\\ }\\ } - - + + """ @@ -81,7 +81,7 @@ for i in range(1,8): t = text.replace("$argtp",tp).replace("$argp",p).replace("$argt",t).replace("$num",str(i)) print(t) - + |