diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-06-27 23:21:45 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-06-27 23:21:45 -0300 |
commit | 2af2a84a03fd707cfa4c682aff34d722343d8985 (patch) | |
tree | 50d064e8bba7d5efb5974e3fa3a67e076fb5ef8b /tools/editor | |
parent | 1cc96a4d7440d9e8a20f7dbf17cf5771170de83d (diff) |
Misc Fixes
==========
-NOTIFICATION_WM_QUIT fixed on android (seems tha way this is reported changed in newer sdk)
-WIP implementation of APK Expansion APIs for publishing games larger than 50mb in Play Store
-Feaures in the new tutorials are all present in the sourcecode
-This (hopefully) should get rid of the animation list order getting corrupted
-Improved 3D Scene Importer (Skeletons, Animations and other stuff were not being merged). Anything missing?
-In code editor, the automatic syntax checker will only use file_exists() to check preload() else it might freeze the editor too much while typing if the preload is a big resource
-Fixed bugs in PolygonPathFinder, stil pending to do a node and a demo
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/editor_node.cpp | 1 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_import_collada.cpp | 8 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_scene_import_plugin.cpp | 47 | ||||
-rw-r--r-- | tools/editor/plugins/shader_editor_plugin.cpp | 17 | ||||
-rw-r--r-- | tools/editor/plugins/shader_editor_plugin.h | 1 | ||||
-rw-r--r-- | tools/editor/resources_dock.cpp | 2 | ||||
-rw-r--r-- | tools/editor/spatial_editor_gizmos.cpp | 12 |
7 files changed, 66 insertions, 22 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index afd5ee66c5..9132abcb6e 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -734,6 +734,7 @@ void EditorNode::_save_scene(String p_file) { flg|=ResourceSaver::FLAG_COMPRESS; if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) flg|=ResourceSaver::FLAG_RELATIVE_PATHS; + flg|=ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS; err = ResourceSaver::save(p_file,sdata,flg); diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 6cd6170bb6..5b4f9960a3 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -199,7 +199,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) { return OK; //well, it's an ambient light.. Light *l = memnew( DirectionalLight ); - l->set_color(Light::COLOR_AMBIENT,ld.color); +// 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)); node = l; @@ -208,8 +208,8 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) { //well, it's an ambient light.. Light *l = memnew( DirectionalLight ); - if (found_ambient) //use it here - l->set_color(Light::COLOR_AMBIENT,ambient); + //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)); @@ -661,7 +661,7 @@ Error ColladaImport::_create_mesh_surfaces(Ref<Mesh>& p_mesh,const Map<String,Co const Collada::MeshData::Source *color_src=NULL; int color_ofs=0; - if (false && p.sources.has("COLOR")) { + if (p.sources.has("COLOR")) { String color_source_id = p.sources["COLOR"].source; color_ofs = p.sources["COLOR"].offset; diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 78280c32fa..0b7ffd55f0 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -173,7 +173,7 @@ public: static const char *anim_flag_names[]={ - "Detect Loop", + "Detect Loop (-loop,-cycle)", "Keep Value Tracks", "Optimize", NULL @@ -680,7 +680,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce import_choose->connect("pressed", this,"_browse"); hbc = memnew( HBoxContainer ); - vbc->add_margin_child("Target Scene:",hbc); + vbc->add_margin_child("Target Path:",hbc); save_path = memnew( LineEdit ); save_path->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1024,7 +1024,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> 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_depth_draw_mode(Material::DEPTH_DRAW_NEVER); fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); } } @@ -1129,7 +1129,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> 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_depth_draw_mode(Material::DEPTH_DRAW_NEVER); fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); } } @@ -1501,6 +1501,37 @@ void EditorSceneImportPlugin::_merge_existing_node(Node *p_node,Node *p_imported room_node->set_room( room_imported->get_room() ); + } else if (p_node->get_type()=="Skeleton") { + //for paths, overwrite path + + Skeleton *skeleton_imported =imported_node->cast_to<Skeleton>(); + Skeleton *skeleton_node =p_node->cast_to<Skeleton>(); + + //use imported bones, obviously + skeleton_node->clear_bones(); + for(int i=0;i<skeleton_imported->get_bone_count();i++) { + + skeleton_node->add_bone(skeleton_imported->get_bone_name(i)); + skeleton_node->set_bone_parent(i,skeleton_imported->get_bone_parent(i)); + skeleton_node->set_bone_rest(i,skeleton_imported->get_bone_rest(i)); + skeleton_node->set_bone_pose(i,skeleton_imported->get_bone_pose(i)); + } + } else if (p_node->get_type()=="AnimationPlayer") { + //for paths, overwrite path + + AnimationPlayer *aplayer_imported =imported_node->cast_to<AnimationPlayer>(); + AnimationPlayer *aplayer_node =p_node->cast_to<AnimationPlayer>(); + + //use imported bones, obviously + List<StringName> anims; + aplayer_imported->get_animation_list(&anims); + //use imported animations, could merge some stuff though + for (List<StringName>::Element *E=anims.front();E;E=E->next()) { + + + aplayer_node->add_animation(E->get(),aplayer_imported->get_animation(E->get())); + } + } else if (p_node->get_type()=="CollisionShape") { //for paths, overwrite path @@ -1877,14 +1908,14 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c if (merge) { - print_line("MERGING?????"); + progress.step("Merging..",103); FileAccess *fa = FileAccess::create(FileAccess::ACCESS_RESOURCES); - print_line("OPEN IN FS: "+p_dest_path); + if (fa->file_exists(p_dest_path)) { - print_line("TRY REALLY TO MERGE?"); + //try to merge Ref<PackedScene> s = ResourceLoader::load(p_dest_path); @@ -1915,7 +1946,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c packer->set_import_metadata(from); print_line("SAVING TO: "+p_dest_path); - err = ResourceSaver::save(p_dest_path,packer); + err = ResourceSaver::save(p_dest_path,packer,ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); //EditorFileSystem::get_singleton()->update_resource(packer); diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index 9b6b07dc2e..73b6265819 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -57,7 +57,9 @@ void ShaderTextEditor::set_edited_shader(const Ref<Shader>& p_shader,ShaderLangu _load_theme_settings(); - if (p_type==ShaderLanguage::SHADER_MATERIAL_VERTEX) + if (p_type==ShaderLanguage::SHADER_MATERIAL_LIGHT) + get_text_edit()->set_text(shader->get_light_code()); + else if (p_type==ShaderLanguage::SHADER_MATERIAL_VERTEX) get_text_edit()->set_text(shader->get_vertex_code()); else get_text_edit()->set_text(shader->get_fragment_code()); @@ -129,7 +131,9 @@ void ShaderTextEditor::_validate_script() { int line,col; String code; - if (type==ShaderLanguage::SHADER_MATERIAL_VERTEX) + if (type==ShaderLanguage::SHADER_MATERIAL_LIGHT) + code=get_text_edit()->get_text(); + else if (type==ShaderLanguage::SHADER_MATERIAL_VERTEX) code=get_text_edit()->get_text(); else code=get_text_edit()->get_text(); @@ -364,6 +368,7 @@ void ShaderEditor::_params_changed() { fragment_editor->_validate_script(); vertex_editor->_validate_script(); + light_editor->_validate_script(); } @@ -400,6 +405,7 @@ void ShaderEditor::edit(const Ref<Shader>& p_shader) { if (shader->get_mode()==Shader::MODE_MATERIAL) { fragment_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_MATERIAL_FRAGMENT); + light_editor->set_edited_shader(shader,ShaderLanguage::SHADER_MATERIAL_LIGHT); settings_menu->get_popup()->set_item_checked( settings_menu->get_popup()->get_item_index(SHADER_MATERIAL_MODE), true); settings_menu->get_popup()->set_item_checked( settings_menu->get_popup()->get_item_index(SHADER_POST_PROCESS_MODE), false); } else { @@ -431,7 +437,7 @@ 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(),0,0); + 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); } void ShaderEditor::_close_callback() { @@ -514,11 +520,16 @@ ShaderEditor::ShaderEditor() { tab_container->add_child(fragment_editor); fragment_editor->set_name("Fragment"); + light_editor = memnew( ShaderTextEditor ); + tab_container->add_child(light_editor); + light_editor->set_name("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"); } diff --git a/tools/editor/plugins/shader_editor_plugin.h b/tools/editor/plugins/shader_editor_plugin.h index 8d5f2dae42..49caee5da6 100644 --- a/tools/editor/plugins/shader_editor_plugin.h +++ b/tools/editor/plugins/shader_editor_plugin.h @@ -99,6 +99,7 @@ class ShaderEditor : public Control { ShaderTextEditor *vertex_editor; ShaderTextEditor *fragment_editor; + ShaderTextEditor *light_editor; void _tab_changed(int p_which); void _menu_option(int p_optin); diff --git a/tools/editor/resources_dock.cpp b/tools/editor/resources_dock.cpp index eb2e526d71..d0284056bb 100644 --- a/tools/editor/resources_dock.cpp +++ b/tools/editor/resources_dock.cpp @@ -158,7 +158,7 @@ void ResourcesDock::save_resource(const String& p_path,const Ref<Resource>& p_re flg|=ResourceSaver::FLAG_RELATIVE_PATHS; String path = Globals::get_singleton()->localize_path(p_path); - Error err = ResourceSaver::save(path,p_resource,flg); + Error err = ResourceSaver::save(path,p_resource,flg|ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); if (err!=OK) { accept->set_text("Error saving resource!"); diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 71a5ae3d3c..83efb48bd3 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -2232,7 +2232,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() { 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_hint(Material::HINT_NO_DEPTH_DRAW, 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"));
@@ -2241,7 +2241,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() { 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_hint(Material::HINT_NO_DEPTH_DRAW, 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"));
@@ -2253,7 +2253,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() { 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_hint(Material::HINT_NO_DEPTH_DRAW,true);
+ skeleton_material->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER);
//position 3D Shared mesh
@@ -2293,7 +2293,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() { 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_hint(Material::HINT_NO_DEPTH_DRAW, 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"));
@@ -2307,7 +2307,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() { 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_hint(Material::HINT_NO_DEPTH_DRAW, 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"));
@@ -2315,7 +2315,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() { 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_hint(Material::HINT_NO_DEPTH_DRAW, 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"));
|