diff options
author | reduz <juan@okamstudio.com> | 2015-12-26 10:27:04 -0300 |
---|---|---|
committer | reduz <juan@okamstudio.com> | 2015-12-26 10:27:04 -0300 |
commit | 9d9520f227d58c2499e906d72002cf631e40f4c8 (patch) | |
tree | d2f238c5048c4aeb199e28b39117559ccd42318c /tools | |
parent | 13964f59c1359473980916ea1f930fef1c28331a (diff) | |
parent | dfd7bdb00528eb9a45e21a5c99d0e76bd642e74c (diff) |
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/editor_import_export.cpp | 9 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 4 | ||||
-rw-r--r-- | tools/editor/editor_node.h | 4 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_import_collada.cpp | 43 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | tools/editor/progress_dialog.cpp | 12 | ||||
-rw-r--r-- | tools/editor/progress_dialog.h | 3 |
7 files changed, 57 insertions, 22 deletions
diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index b6c68d05be..c50a95a93d 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -1064,7 +1064,7 @@ Error EditorExportPlatform::save_pack_file(void *p_userdata,const String& p_path MD5Final(&ctx); pd->f->store_buffer(ctx.digest,16); } - pd->ep->step("Storing File: "+p_path,2+p_file*100/p_total); + pd->ep->step("Storing File: "+p_path,2+p_file*100/p_total,false); pd->count++; pd->ftmp->store_buffer(p_data.ptr(),p_data.size()); if (pd->alignment > 1) { @@ -1102,7 +1102,7 @@ Error EditorExportPlatform::save_zip_file(void *p_userdata,const String& p_path, zipWriteInFileInZip(zip,p_data.ptr(),p_data.size()); zipCloseFileInZip(zip); - zd->ep->step("Storing File: "+p_path,2+p_file*100/p_total); + zd->ep->step("Storing File: "+p_path,2+p_file*100/p_total,false); zd->count++; return OK; @@ -1128,10 +1128,7 @@ Error EditorExportPlatform::save_zip(const String& p_path, bool p_make_bundles) zipClose(zip,NULL); - if (err) - return err; - - + return err; } Error EditorExportPlatform::save_pack(FileAccess *dst,bool p_make_bundles, int p_alignment) { diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 6352a235f7..b30c875866 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -4040,9 +4040,9 @@ void EditorNode::progress_add_task(const String& p_task,const String& p_label, i singleton->progress_dialog->add_task(p_task,p_label,p_steps); } -void EditorNode::progress_task_step(const String& p_task, const String& p_state, int p_step) { +void EditorNode::progress_task_step(const String& p_task, const String& p_state, int p_step,bool p_force_redraw) { - singleton->progress_dialog->task_step(p_task,p_state,p_step); + singleton->progress_dialog->task_step(p_task,p_state,p_step,p_force_redraw); } diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 113d897eee..0a087eb1ed 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -647,7 +647,7 @@ public: static void add_io_error(const String& p_error); static void progress_add_task(const String& p_task,const String& p_label, int p_steps); - static void progress_task_step(const String& p_task,const String& p_state, int p_step=-1); + static void progress_task_step(const String& p_task,const String& p_state, int p_step=-1,bool p_force_refresh=true); static void progress_end_task(const String& p_task); static void progress_add_task_bg(const String& p_task,const String& p_label, int p_steps); @@ -674,7 +674,7 @@ public: struct EditorProgress { String task; - void step(const String& p_state, int p_step=-1) { EditorNode::progress_task_step(task,p_state,p_step); } + void step(const String& p_state, int p_step=-1,bool p_force_refresh=true) { EditorNode::progress_task_step(task,p_state,p_step,p_force_refresh); } EditorProgress(const String& p_task,const String& p_label,int p_amount) { EditorNode::progress_add_task(p_task,p_label,p_amount); task=p_task; } ~EditorProgress() { EditorNode::progress_end_task(task); } }; diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index d57cff850e..ffc2d057e3 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -68,6 +68,7 @@ struct ColladaImport { Map<String,NodeMap> node_map; //map from collada node to engine node + Map<String,String> node_name_map; //map from collada node to engine node Map<String, Ref<Mesh> > mesh_cache; Map<String, Ref<Curve3D> > curve_cache; Map<String, Ref<Material> > material_cache; @@ -124,6 +125,7 @@ Error ColladaImport::_populate_skeleton(Skeleton *p_skeleton,Collada::Node *p_no nm.node=p_skeleton; nm.bone = r_bone; node_map[p_node->id]=nm; + node_name_map[p_node->name]=p_node->id; skeleton_bone_map[p_skeleton][joint->sid]=r_bone; @@ -345,6 +347,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) { NodeMap nm; nm.node=node; node_map[p_node->id]=nm; + node_name_map[p_node->name]=p_node->id; Transform xf = p_node->default_transform; xf = collada.fix_transform( xf ) * p_node->post_transform; @@ -1906,9 +1909,20 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones) { Collada::AnimationTrack &at = collada.state.animation_tracks[i]; //print_line("CHANNEL: "+at.target+" PARAM: "+at.param); + + String node; + if (!node_map.has(at.target)) { - print_line("Coudlnt find node: "+at.target); - continue; + + if (node_name_map.has(at.target)) { + + node=node_name_map[at.target]; + } else { + print_line("Coudlnt find node: "+at.target); + continue; + } + } else { + node=at.target; } @@ -1917,8 +1931,9 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones) { valid_animated_properties.push_back(i); } else { - node_map[at.target].anim_tracks.push_back(i); - valid_animated_nodes.insert(at.target); + + node_map[node].anim_tracks.push_back(i); + valid_animated_nodes.insert(node); } } @@ -1934,6 +1949,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones Ref<Animation> animation = Ref<Animation>( memnew( Animation )); + if (p_clip==-1) { //print_line("default"); @@ -2007,10 +2023,12 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones while(f<anim_length) { base_snapshots.push_back(f); + f+=snapshot_interval; if (f>=anim_length) { base_snapshots.push_back(anim_length); + } } @@ -2019,11 +2037,17 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones bool tracks_found=false; + + for(Set<String>::Element* E=valid_animated_nodes.front();E;E=E->next()) { // take snapshots - if (!collada.state.scene_map.has(E->get())) + + + if (!collada.state.scene_map.has(E->get())) { + continue; + } NodeMap &nm = node_map[E->get()]; String path = scene->get_path_to(nm.node); @@ -2039,7 +2063,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones Collada::Node *cn = collada.state.scene_map[E->get()]; if (cn->ignore_anim) { - //print_line("warning, ignoring animation on node: "+path); + continue; } @@ -2058,20 +2082,23 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones for(int i=0;i<at.keys.size();i++) snapshots.push_back(at.keys[i].time); - print_line("using anim snapshots"); } for(int i=0;i<snapshots.size();i++) { + for(List<int>::Element *ET=nm.anim_tracks.front();ET;ET=ET->next()) { //apply tracks + if (p_clip==-1) { - if (track_filter.has(ET->get())) + if (track_filter.has(ET->get())) { + continue; + } } else { if (!track_filter.has(ET->get())) diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 178871ea75..59f5d89073 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -316,6 +316,8 @@ void ScriptTextEditor::_load_theme_settings() { get_text_edit()->add_keyword_color("Color",basetype_color); get_text_edit()->add_keyword_color("Image",basetype_color); get_text_edit()->add_keyword_color("InputEvent",basetype_color); + get_text_edit()->add_keyword_color("Rect2",basetype_color); + get_text_edit()->add_keyword_color("NodePath",basetype_color); //colorize engine types Color type_color= EDITOR_DEF("text_editor/engine_type_color",Color(0.0,0.2,0.4)); @@ -1773,7 +1775,7 @@ void ScriptEditor::_update_script_colors() { if (h>hist_size) { continue; } - float v = Math::ease((edit_pass-pass)/float_t(hist_size),0.4); + float v = Math::ease((edit_pass-pass)/float(hist_size),0.4); script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v)); diff --git a/tools/editor/progress_dialog.cpp b/tools/editor/progress_dialog.cpp index c8b87486c0..90398767ea 100644 --- a/tools/editor/progress_dialog.cpp +++ b/tools/editor/progress_dialog.cpp @@ -29,7 +29,7 @@ #include "progress_dialog.h" #include "main/main.h" #include "message_queue.h" - +#include "os/os.h" void BackgroundProgress::_add_task(const String& p_task,const String& p_label, int p_steps) { @@ -191,10 +191,16 @@ void ProgressDialog::add_task(const String& p_task,const String& p_label,int p_s } -void ProgressDialog::task_step(const String& p_task, const String& p_state, int p_step){ +void ProgressDialog::task_step(const String& p_task, const String& p_state, int p_step,bool p_force_redraw){ ERR_FAIL_COND(!tasks.has(p_task)); + if (!p_force_redraw) { + uint64_t tus = OS::get_singleton()->get_ticks_usec(); + if (tus-last_progress_tick < 50000) //50ms + return; + } + Task &t=tasks[p_task]; if (p_step<0) t.progress->set_val(t.progress->get_val()+1); @@ -202,6 +208,7 @@ void ProgressDialog::task_step(const String& p_task, const String& p_state, int t.progress->set_val(p_step); t.state->set_text(p_state); + last_progress_tick=OS::get_singleton()->get_ticks_usec(); Main::iteration(); // this will not work on a lot of platforms, so it's only meant for the editor } @@ -229,4 +236,5 @@ ProgressDialog::ProgressDialog() { add_child(main); main->set_area_as_parent_rect(); set_exclusive(true); + last_progress_tick=0; } diff --git a/tools/editor/progress_dialog.h b/tools/editor/progress_dialog.h index 7f1cc4cb2d..8c75948fda 100644 --- a/tools/editor/progress_dialog.h +++ b/tools/editor/progress_dialog.h @@ -84,6 +84,7 @@ class ProgressDialog : public Popup { Map<String,Task> tasks; VBoxContainer *main; + uint64_t last_progress_tick; void _popup(); protected: @@ -92,7 +93,7 @@ protected: public: void add_task(const String& p_task,const String& p_label, int p_steps); - void task_step(const String& p_task,const String& p_state, int p_step=-1); + void task_step(const String& p_task, const String& p_state, int p_step=-1, bool p_force_redraw=true); void end_task(const String& p_task); |