From 22d83bc9f655d5ae7a1b49709c4c1b663725daf5 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 3 Oct 2016 16:33:42 -0300 Subject: Begining of GLES3 renderer: -Most 2D drawing is implemented -Missing shaders -Missing all 3D -Editor needs to be set on update always to be used, otherwise it does not refresh -Large parts of editor not working --- tools/editor/code_editor.cpp | 2 +- tools/editor/editor_autoload_settings.cpp | 2 +- tools/editor/editor_help.cpp | 2 +- tools/editor/editor_node.cpp | 35 ++++----- tools/editor/editor_profiler.cpp | 2 +- tools/editor/icons/SCsub | 2 +- .../io_plugins/editor_font_import_plugin.cpp | 10 +-- tools/editor/io_plugins/editor_import_collada.cpp | 50 ++++++------- .../io_plugins/editor_scene_import_plugin.cpp | 58 +++++++-------- .../io_plugins/editor_scene_importer_fbxconv.cpp | 3 +- .../io_plugins/editor_scene_importer_fbxconv.h | 2 + .../io_plugins/editor_texture_import_plugin.cpp | 72 +++++++++--------- tools/editor/plugins/baked_light_baker.cpp | 11 +-- tools/editor/plugins/baked_light_baker.h | 3 + tools/editor/plugins/baked_light_editor_plugin.cpp | 5 +- tools/editor/plugins/baked_light_editor_plugin.h | 4 +- .../plugins/collision_polygon_editor_plugin.cpp | 3 + .../plugins/collision_polygon_editor_plugin.h | 4 +- .../plugins/cube_grid_theme_editor_plugin.cpp | 3 +- .../editor/plugins/cube_grid_theme_editor_plugin.h | 3 +- tools/editor/plugins/editor_preview_plugins.cpp | 17 +++-- tools/editor/plugins/editor_preview_plugins.h | 3 +- tools/editor/plugins/material_editor_plugin.cpp | 3 + tools/editor/plugins/material_editor_plugin.h | 3 +- tools/editor/plugins/mesh_editor_plugin.cpp | 2 + tools/editor/plugins/mesh_editor_plugin.h | 3 + .../editor/plugins/particles_2d_editor_plugin.cpp | 4 +- tools/editor/plugins/particles_editor_plugin.cpp | 3 + tools/editor/plugins/particles_editor_plugin.h | 3 +- tools/editor/plugins/path_editor_plugin.cpp | 2 + tools/editor/plugins/path_editor_plugin.h | 3 +- tools/editor/plugins/polygon_2d_editor_plugin.cpp | 2 +- tools/editor/plugins/sample_editor_plugin.cpp | 4 +- .../plugins/sample_library_editor_plugin.cpp | 2 +- tools/editor/plugins/shader_editor_plugin.cpp | 3 +- tools/editor/plugins/shader_editor_plugin.h | 4 +- .../editor/plugins/shader_graph_editor_plugin.cpp | 4 +- tools/editor/plugins/shader_graph_editor_plugin.h | 4 +- tools/editor/plugins/spatial_editor_plugin.cpp | 86 +++++++++++----------- tools/editor/plugins/spatial_editor_plugin.h | 2 +- tools/editor/project_manager.cpp | 4 +- tools/editor/pvrtc_compress.cpp | 2 +- tools/editor/scene_tree_editor.cpp | 2 +- tools/editor/spatial_editor_gizmos.cpp | 3 + tools/editor/spatial_editor_gizmos.h | 4 +- 45 files changed, 242 insertions(+), 206 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index 9240e3527c..6fb796ae6a 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -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/editor_autoload_settings.cpp b/tools/editor/editor_autoload_settings.cpp index 97062b1480..bf8a891247 100644 --- a/tools/editor/editor_autoload_settings.cpp +++ b/tools/editor/editor_autoload_settings.cpp @@ -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_help.cpp b/tools/editor/editor_help.cpp index 4f83dc2f66..628870c70f 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -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_node.cpp b/tools/editor/editor_node.cpp index 8274272a7e..7f02624107 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -907,10 +907,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; @@ -928,7 +929,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"); @@ -940,7 +941,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( memnew( ResourceImportMetadata ) ) ); editor_data.get_edited_scene_import_metadata()->set_option("thumbnail",imgdata); - +#endif //tamanio tel thumbnail if (screen!=-1) { _editor_select(screen); @@ -1243,7 +1244,7 @@ void EditorNode::_dialog_action(String p_file) { ml = Ref( 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) { @@ -4145,7 +4146,7 @@ void EditorNode::register_editor_types() { ObjectTypeDB::register_type(); //ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); +// ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); @@ -6537,10 +6538,10 @@ 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( 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) ) ); @@ -6549,14 +6550,14 @@ 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) ) ); @@ -6564,16 +6565,16 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( TextureRegionEditorPlugin(this) ) ); add_editor_plugin( memnew( Particles2DEditorPlugin(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;iadd_preview_generator( Ref( memnew(EditorTexturePreviewPlugin ))); + /*resource_preview->add_preview_generator( Ref( memnew(EditorTexturePreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorPackedScenePreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorMaterialPreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorScriptPreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorSamplePreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorMeshPreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorBitmapPreviewPlugin ))); - +*/ circle_step_msec=OS::get_singleton()->get_ticks_msec(); 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::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/icons/SCsub b/tools/editor/icons/SCsub index 44e28f49e6..e9054f30d9 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -63,7 +63,7 @@ def make_editor_icons_action(target, source, env): s.write("\tRef 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("\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") diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index df3741f0d4..0a3b0d4917 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -1330,7 +1330,7 @@ Ref EditorFontImportPlugin::generate_font(const Ref EditorFontImportPlugin::generate_font(const Ref::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 EditorFontImportPlugin::generate_font(const Ref EditorFontImportPlugin::generate_font(const Refhas_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_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 1130e2be30..6b1873d49a 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -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; } @@ -394,14 +394,14 @@ Error ColladaImport::_create_material(const String& p_target) { Ref 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(FixedMaterial::PARAM_DIFFUSE,texture); +// material->set_parameter(FixedMaterial::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(FixedMaterial::PARAM_DIFFUSE,effect.diffuse.color); } // SPECULAR @@ -414,15 +414,15 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { - material->set_texture(FixedMaterial::PARAM_SPECULAR,texture); - material->set_parameter(FixedMaterial::PARAM_SPECULAR,Color(1,1,1,1)); +// material->set_texture(FixedMaterial::PARAM_SPECULAR,texture); +// material->set_parameter(FixedMaterial::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(FixedMaterial::PARAM_SPECULAR,effect.specular.color); } // EMISSION @@ -435,15 +435,15 @@ Error ColladaImport::_create_material(const String& p_target) { Ref 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(FixedMaterial::PARAM_EMISSION,texture); +// material->set_parameter(FixedMaterial::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(FixedMaterial::PARAM_EMISSION,effect.emission.color); } // NORMAL @@ -456,18 +456,18 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { - material->set_texture(FixedMaterial::PARAM_NORMAL,texture); + // material->set_texture(FixedMaterial::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(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess); +// material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided); +// material->set_flag(Material::FLAG_UNSHADED,effect.unshaded); @@ -1196,7 +1196,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref& p_mesh,con tarrayw = DVector::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); diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 190b56faba..9d68807c46 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1406,9 +1406,9 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Mapcast_to()->set_fixed_flag(FixedMaterial::FLAG_USE_XY_NORMALMAP,true); - } + //if (p_flags&SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY) + // res->cast_to()->set_fixed_flag(FixedMaterial::FLAG_USE_XY_NORMALMAP,true); + }// } else { @@ -1516,10 +1516,10 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref 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(FixedMaterial::FLAG_USE_ALPHA,true); } } } @@ -1543,17 +1543,17 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map 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(FixedMaterial::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(FixedMaterial::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); } } @@ -1612,11 +1612,11 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map 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()) { @@ -1625,10 +1625,10 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref 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(FixedMaterial::FLAG_USE_ALPHA,true); } } } @@ -1660,11 +1660,11 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map 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()) { @@ -1888,8 +1888,8 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map BSP_Tree bsptree(faces); Ref 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 ); @@ -1917,7 +1917,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map 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()) { @@ -2047,7 +2047,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref fm = mesh->surface_get_material(i); if (fm.is_valid()) { String name = fm->get_name(); - if (_teststr(name,"alpha")) { + /* if (_teststr(name,"alpha")) { fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); name=_fixstr(name,"alpha"); } @@ -2055,7 +2055,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map if (_teststr(name,"vcol")) { fm->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); name=_fixstr(name,"vcol"); - } + }*/ fm->set_name(name); } } diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp index ac3c4637c2..f117182365 100644 --- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp +++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp @@ -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("/","_"); @@ -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..e23c0e2faa 100644 --- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.h +++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.h @@ -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..4397956be7 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -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 &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 &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 &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 &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 data = src.get_data(); @@ -1280,7 +1274,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Refget_source_count()); @@ -1411,18 +1405,18 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref& 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) { @@ -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 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..99340fcbe8 100644 --- a/tools/editor/plugins/baked_light_baker.h +++ b/tools/editor/plugins/baked_light_baker.h @@ -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_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp index a58a0c25e2..ed5aafeba0 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.cpp +++ b/tools/editor/plugins/baked_light_editor_plugin.cpp @@ -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 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..a556bd447a 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.h +++ b/tools/editor/plugins/baked_light_editor_plugin.h @@ -40,7 +40,7 @@ @author Juan Linietsky */ - +#if 0 class MeshInstance; @@ -116,5 +116,5 @@ public: }; #endif // MULTIMESH_EDITOR_PLUGIN_H - +#endif diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index 0b06b3ba21..ccec7eaed1 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -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) { @@ -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..4c1f45eca9 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.h +++ b/tools/editor/plugins/collision_polygon_editor_plugin.h @@ -40,6 +40,8 @@ /** @author Juan Linietsky */ + +#if 0 class CanvasItemEditor; class CollisionPolygonEditor : public HBoxContainer { @@ -117,5 +119,5 @@ public: ~CollisionPolygonEditorPlugin(); }; - +#endif #endif // COLLISION_POLYGON_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp index b6f3db73f7..9bc624ef65 100644 --- a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp +++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp @@ -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..a2875d24c2 100644 --- a/tools/editor/plugins/cube_grid_theme_editor_plugin.h +++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.h @@ -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..66f766a0be 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -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 EditorTexturePreviewPlugin::generate(const RES& p_from) { if (img.is_compressed()) { if (img.decompress()!=OK) return Ref(); - } 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 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(); - } 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 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 EditorSamplePreviewPlugin::generate(const RES& p_from) { imgdata = DVector::Write(); Ref ptex = Ref( 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..9807d835a2 100644 --- a/tools/editor/plugins/editor_preview_plugins.h +++ b/tools/editor/plugins/editor_preview_plugins.h @@ -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/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..cd7860bcab 100644 --- a/tools/editor/plugins/mesh_editor_plugin.cpp +++ b/tools/editor/plugins/mesh_editor_plugin.cpp @@ -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..97fd9ae771 100644 --- a/tools/editor/plugins/mesh_editor_plugin.h +++ b/tools/editor/plugins/mesh_editor_plugin.h @@ -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/particles_2d_editor_plugin.cpp b/tools/editor/plugins/particles_2d_editor_plugin.cpp index ce25f34c1f..4d93f2019e 100644 --- a/tools/editor/plugins/particles_2d_editor_plugin.cpp +++ b/tools/editor/plugins/particles_2d_editor_plugin.cpp @@ -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_editor_plugin.cpp b/tools/editor/plugins/particles_editor_plugin.cpp index 7e20cc3f54..d8330c4b0c 100644 --- a/tools/editor/plugins/particles_editor_plugin.cpp +++ b/tools/editor/plugins/particles_editor_plugin.cpp @@ -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..eec01d03a1 100644 --- a/tools/editor/plugins/particles_editor_plugin.h +++ b/tools/editor/plugins/particles_editor_plugin.h @@ -37,7 +37,7 @@ /** @author Juan Linietsky */ - +#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_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp index 33ef71efab..aa7071298a 100644 --- a/tools/editor/plugins/path_editor_plugin.cpp +++ b/tools/editor/plugins/path_editor_plugin.cpp @@ -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 c = path->get_curve(); @@ -593,3 +594,4 @@ PathEditorPlugin::~PathEditorPlugin() { } +#endif diff --git a/tools/editor/plugins/path_editor_plugin.h b/tools/editor/plugins/path_editor_plugin.h index 0afd957af7..ee2196b47f 100644 --- a/tools/editor/plugins/path_editor_plugin.h +++ b/tools/editor/plugins/path_editor_plugin.h @@ -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); @@ -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..cd19a908a8 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -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/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index 7965fa54ae..5bdd7c4e61 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -311,7 +311,7 @@ void SampleEditor::generate_preview_texture(const Ref& p_sample,Ref::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( 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_library_editor_plugin.cpp b/tools/editor/plugins/sample_library_editor_plugin.cpp index 2a6940332c..ade0c475e1 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.cpp +++ b/tools/editor/plugins/sample_library_editor_plugin.cpp @@ -236,7 +236,7 @@ void SampleLibraryEditor::_update_library() { // Preview/edit Ref 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/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index b3317e8313..5541ae987f 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -38,7 +38,7 @@ #include "tools/editor/property_editor.h" #include "os/os.h" - +#if 0 /*** SETTINGS EDITOR ****/ @@ -654,3 +654,4 @@ ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node, bool p_2d) { ShaderEditorPlugin::~ShaderEditorPlugin() { } +#endif diff --git a/tools/editor/plugins/shader_editor_plugin.h b/tools/editor/plugins/shader_editor_plugin.h index 9219a1fbc2..ef7cc6772e 100644 --- a/tools/editor/plugins/shader_editor_plugin.h +++ b/tools/editor/plugins/shader_editor_plugin.h @@ -38,7 +38,7 @@ #include "scene/resources/shader.h" #include "servers/visual/shader_language.h" - +#if 0 class ShaderTextEditor : public CodeTextEditor { OBJ_TYPE( ShaderTextEditor, CodeTextEditor ); @@ -154,4 +154,6 @@ public: ~ShaderEditorPlugin(); }; + +#endif #endif diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index 3ab906f84e..f864c6885f 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -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..dafafdd1c8 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.h +++ b/tools/editor/plugins/shader_graph_editor_plugin.h @@ -43,7 +43,7 @@ @author Juan Linietsky */ - +#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 9701b8030d..afea6f93dd 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -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 instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); + Vector instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); Set > 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;iinstance_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 instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); + Vector instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); Set > found_gizmos; r_includes_current=false; for (int i=0;iinstance_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 instances=VisualServer::get_singleton()->instances_cull_convex(frustum,get_tree()->get_root()->get_world()->get_scenario()); + Vector instances=VisualServer::get_singleton()->instances_cull_convex(frustum,get_tree()->get_root()->get_world()->get_scenario()); for (int i=0;iinstance_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(); @@ -877,7 +874,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (b.mod.control) { - Vector instances=VisualServer::get_singleton()->instances_cull_ray(ray_origin,ray_dir,get_tree()->get_root()->get_world()->get_scenario() ); + Vector 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;iinstance_get_object_instance_ID(instances[i]); - Object *obj=ObjectDB::get_instance(id); + + Object *obj=ObjectDB::get_instance(instances[i]); + if (!obj) continue; @@ -2061,9 +2059,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<set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<get_popup()->set_item_checked( idx, current ); } break; @@ -2361,7 +2359,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed 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<set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+p_index))|(1<set_environment(SpatialEditor::get_singleton()->get_viewport_environment()); viewport->add_child(camera); camera->make_current(); @@ -2370,7 +2368,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); @@ -2550,10 +2548,10 @@ void SpatialEditor::_generate_selection_box() { } Ref mat = memnew( FixedMaterial ); - mat->set_flag(Material::FLAG_UNSHADED,true); + /*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); + mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true);*/ st->set_material(mat); selection_box = st->commit(); } @@ -2685,14 +2683,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"]; @@ -2892,9 +2890,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; @@ -3140,11 +3138,11 @@ 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 ); + indicator_mat = VisualServer::get_singleton()->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); + VisualServer::get_singleton()->fixed_material_set_flag(indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true);*/ DVector grid_colors[3]; DVector grid_points[3]; @@ -3186,7 +3184,7 @@ 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_add_surface_from_arrays(grid[i],VisualServer::PRIMITIVE_LINES,d); VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat); grid_instance[i] = VisualServer::get_singleton()->instance_create2(grid[i],get_tree()->get_root()->get_world()->get_scenario()); @@ -3205,7 +3203,7 @@ 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_add_surface_from_arrays(origin,VisualServer::PRIMITIVE_LINES,d); VisualServer::get_singleton()->mesh_surface_set_material(origin,0,indicator_mat); @@ -3237,16 +3235,16 @@ 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)); + cursor_material=VisualServer::get_singleton()->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); + VisualServer::get_singleton()->fixed_material_set_flag(cursor_material, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,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_add_surface_from_arrays(cursor_mesh,VS::PRIMITIVE_LINES,d); VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh,0,cursor_material); cursor_instance = VisualServer::get_singleton()->instance_create2(cursor_mesh,get_tree()->get_root()->get_world()->get_scenario()); @@ -3266,10 +3264,10 @@ void SpatialEditor::_init_indicators() { float gizmo_alph = EditorSettings::get_singleton()->get("3d_editor/manipulator_gizmo_opacity"); gizmo_hl = Ref( memnew( FixedMaterial ) ); - gizmo_hl->set_flag(Material::FLAG_UNSHADED, true); + /* 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->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,gizmo_alph+0.2f));*/ for(int i=0;i<3;i++) { @@ -3278,13 +3276,13 @@ void SpatialEditor::_init_indicators() { Ref mat = memnew( FixedMaterial ); - mat->set_flag(Material::FLAG_UNSHADED, true); + /* mat->set_flag(Material::FLAG_UNSHADED, true); mat->set_flag(Material::FLAG_ONTOP, true); mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); Color col; col[i]=1.0; col.a= gizmo_alph; - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,col); + mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,col);*/ gizmo_color[i]=mat; @@ -3548,7 +3546,7 @@ void SpatialEditor::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { - gizmos = memnew( SpatialEditorGizmos ); + //gizmos = memnew( SpatialEditorGizmos ); _init_indicators(); _update_default_light_angle(); } @@ -3556,7 +3554,7 @@ void SpatialEditor::_notification(int p_what) { if (p_what==NOTIFICATION_EXIT_TREE) { _finish_indicators(); - memdelete( gizmos ); +// memdelete( gizmos ); } } @@ -3602,7 +3600,7 @@ void SpatialEditor::_request_gizmo(Object* p_obj) { } if (!seg.is_valid()) { - seg = gizmos->get_gizmo(sp); + // seg = gizmos->get_gizmo(sp); } if (seg.is_valid()) { @@ -3724,7 +3722,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); @@ -3737,7 +3735,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()); } @@ -4006,8 +4004,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 975092a01d..2a52eab777 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -467,7 +467,7 @@ private: static SpatialEditor *singleton; void _node_removed(Node* p_node); - SpatialEditorGizmos *gizmos; + //SpatialEditorGizmos *gizmos; SpatialEditor(); void _update_ambient_light_color(const Color& p_color); diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index 18a4e845a0..4f6f624b1e 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -870,7 +870,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); @@ -891,7 +891,7 @@ void ProjectManager::_load_recent_projects() { vb->add_child(title); Label *fpath = memnew( Label(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); diff --git a/tools/editor/pvrtc_compress.cpp b/tools/editor/pvrtc_compress.cpp index 75b5c69bc2..bda06e1706 100644 --- a/tools/editor/pvrtc_compress.cpp +++ b/tools/editor/pvrtc_compress.cpp @@ -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 t = memnew( ImageTexture ); diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index 53bfe8cc57..fdcced2fa6 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -953,7 +953,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/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 84803eb6db..716b03b7b7 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -41,6 +41,8 @@ // Keep small children away from this file. // It's so ugly it will eat them alive +#if 0 + #define HANDLE_HALF_SIZE 0.05 void EditorSpatialGizmo::clear() { @@ -3198,3 +3200,4 @@ SpatialEditorGizmos::SpatialEditorGizmos() { } +#endif diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index 3d7272f522..a7a6af4b18 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -52,7 +52,7 @@ class Camera; - +#if 0 class EditorSpatialGizmo : public SpatialEditorGizmo { OBJ_TYPE(EditorSpatialGizmo,SpatialGizmo); @@ -505,5 +505,5 @@ public: SpatialEditorGizmos(); }; - +#endif #endif // SPATIAL_EDITOR_GIZMOS_H -- cgit v1.2.3 From cf5778e51a883936ffc896231da8259e5ebabc0a Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 5 Oct 2016 01:26:35 -0300 Subject: -Added ViewportContainer, this is the only way to make viewports show up in GUI now -2D editing now seems to work -Added some functions and refactoring to Viewport --- tools/editor/editor_node.cpp | 13 ++++++++----- tools/editor/editor_node.h | 4 ++-- tools/editor/plugins/canvas_item_editor_plugin.cpp | 3 ++- tools/editor/plugins/spatial_editor_plugin.cpp | 4 ++-- tools/editor/plugins/spatial_editor_plugin.h | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 7f02624107..9b5ed422c5 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -266,14 +266,12 @@ void EditorNode::_notification(int p_what) { circle_step=0; circle_step_msec=tick; - circle_step_frame=frame+1; + circle_step_frame=frame+1; 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(); { @@ -300,7 +298,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); @@ -5663,6 +5661,7 @@ EditorNode::EditorNode() { scene_root_parent->set_custom_minimum_size(Size2(0,80)*EDSCALE); + //Ref sp = scene_root_parent->get_stylebox("panel","TabContainer"); //scene_root_parent->add_style_override("panel",sp); @@ -5676,6 +5675,8 @@ EditorNode::EditorNode() { scene_root = memnew( Viewport ); + scene_root->set_disable_3d(true); + //scene_root_base->add_child(scene_root); @@ -5683,7 +5684,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( memnew( World2D )) ); @@ -5696,6 +5697,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 ); @@ -6673,6 +6675,7 @@ EditorNode::EditorNode() { load_error_dialog->set_child_rect(load_errors); gui_base->add_child(load_error_dialog); + //EditorImport::add_importer( Ref( 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 0393cd19a9..c5271860eb 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -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" @@ -207,7 +207,7 @@ private: //Ref scene_import_metadata; - Control* scene_root_parent; + PanelContainer* scene_root_parent; Control *gui_base; VBoxContainer *main_vbox; diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index b0e002ba44..2025fe825e 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -3320,7 +3320,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()); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index afea6f93dd..55a4c6c934 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2348,7 +2348,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed message_time=0; spatial_editor=p_spatial_editor; - Control *c=memnew(Control); + ViewportContainer *c=memnew(ViewportContainer); add_child(c); c->set_area_as_parent_rect(); viewport = memnew( Viewport ); @@ -3973,7 +3973,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); diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index 2a52eab777..4751cf7071 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -430,7 +430,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; -- cgit v1.2.3 From 850eaf7ed796d2f2d9a35c6bc4ba9a4e69f5ca1d Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 7 Oct 2016 11:31:18 -0300 Subject: -the new shader language seems to work -shader editor plugin can edit shaders -code completion in shader editor plugin --- tools/editor/editor_node.cpp | 3 +- tools/editor/plugins/shader_editor_plugin.cpp | 238 +++++++++----------------- tools/editor/plugins/shader_editor_plugin.h | 25 ++- 3 files changed, 97 insertions(+), 169 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 9b5ed422c5..a4ee102aed 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -6540,9 +6540,10 @@ EditorNode::EditorNode() { //more visually meaningful to have this later raise_bottom_panel_item(AnimationPlayerEditor::singleton); + 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( CameraEditorPlugin(this) ) ); add_editor_plugin( memnew( SampleEditorPlugin(this) ) ); diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index 5541ae987f..9c8aa3c85d 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -37,8 +37,8 @@ #include "tools/editor/editor_node.h" #include "tools/editor/property_editor.h" #include "os/os.h" +#include "servers/visual/shader_types.h" -#if 0 /*** SETTINGS EDITOR ****/ @@ -51,19 +51,14 @@ Ref ShaderTextEditor::get_edited_shader() const { return shader; } -void ShaderTextEditor::set_edited_shader(const Ref& p_shader,ShaderLanguage::ShaderType p_type) { +void ShaderTextEditor::set_edited_shader(const Ref& 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(); @@ -104,7 +99,25 @@ void ShaderTextEditor::_load_theme_settings() { List keywords; - ShaderLanguage::get_keyword_list(type,&keywords); + ShaderLanguage::get_keyword_list(&keywords); + + if (shader.is_valid()) { + + + for(const Map< StringName, Map >::Element *E=ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())).front();E;E=E->next()) { + + for (const Map::Element *F=E->get().front();F;F=F->next()) { + keywords.push_back(F->key()); + } + + } + + for(const Set::Element *E =ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())).front();E;E=E->next()) { + + keywords.push_back(E->get()); + + } + } for(List::Element *E=keywords.front();E;E=E->next()) { @@ -142,22 +155,34 @@ void ShaderTextEditor::_load_theme_settings() { } +void ShaderTextEditor::_code_complete_script(const String& p_code, List* r_options) { -void ShaderTextEditor::_validate_script() { + print_line("code complete"); - String errortxt; - int line,col; + ShaderLanguage sl; + String calltip; + + 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); + } +} + +void ShaderTextEditor::_validate_script() { String code=get_text_edit()->get_text(); //List 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)+"): "+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;iget_line_count();i++) @@ -187,9 +212,7 @@ ShaderTextEditor::ShaderTextEditor() { void ShaderEditor::_menu_option(int p_option) { - ShaderTextEditor *current = tab_container->get_current_tab_control()->cast_to(); - if (!current) - return; + ShaderTextEditor *current = shader_editor; switch(p_option) { case EDIT_UNDO: { @@ -245,24 +268,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(); - - 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,57 +375,31 @@ 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->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); - vertex_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); - vertex_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); - vertex_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); - vertex_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); - vertex_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); - vertex_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); - vertex_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); - vertex_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); - vertex_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); - vertex_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); - - fragment_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); - fragment_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); - fragment_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); - fragment_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); - fragment_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); - fragment_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); - fragment_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); - fragment_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); - fragment_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); - fragment_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); - fragment_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); - - light_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); - light_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); - light_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); - light_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); - light_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); - light_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); - light_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); - light_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); - light_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); - light_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); - light_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); + 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); } @@ -441,16 +425,7 @@ void ShaderEditor::edit(const Ref& 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 @@ -474,35 +449,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); @@ -517,7 +478,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); @@ -530,34 +491,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")); - - fragment_editor = memnew( ShaderTextEditor ); - tab_container->add_child(fragment_editor); - fragment_editor->set_name(TTR("Fragment")); + shader_editor = memnew( ShaderTextEditor ); + add_child(shader_editor); + shader_editor->set_v_size_flags(SIZE_EXPAND_FILL); - 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(); @@ -567,15 +509,7 @@ ShaderEditor::ShaderEditor() { void ShaderEditorPlugin::edit(Object *p_object) { Shader* s = p_object->cast_to(); - if (!s || s->cast_to()) { - 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); } @@ -583,24 +517,25 @@ bool ShaderEditorPlugin::handles(Object *p_object) const { bool handles = true; Shader *shader=p_object->cast_to(); - if (!shader || shader->cast_to()) // 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()) // 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(); + } } @@ -634,19 +569,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); } @@ -654,4 +584,4 @@ ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node, bool p_2d) { ShaderEditorPlugin::~ShaderEditorPlugin() { } -#endif + diff --git a/tools/editor/plugins/shader_editor_plugin.h b/tools/editor/plugins/shader_editor_plugin.h index ef7cc6772e..ffe6a42e88 100644 --- a/tools/editor/plugins/shader_editor_plugin.h +++ b/tools/editor/plugins/shader_editor_plugin.h @@ -38,33 +38,34 @@ #include "scene/resources/shader.h" #include "servers/visual/shader_language.h" -#if 0 class ShaderTextEditor : public CodeTextEditor { OBJ_TYPE( ShaderTextEditor, CodeTextEditor ); Ref shader; - ShaderLanguage::ShaderType type; protected: static void _bind_methods(); virtual void _load_theme_settings(); + + virtual void _code_complete_script(const String& p_code, List* r_options); + public: virtual void _validate_script(); Ref get_edited_shader() const; - void set_edited_shader(const Ref& p_shader,ShaderLanguage::ShaderType p_type); + void set_edited_shader(const Ref& 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; - 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,10 +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 -#endif -- cgit v1.2.3 From 1527cf8c0d17891dd0ebf99d484f83daa46eba3c Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 10 Oct 2016 18:31:01 -0300 Subject: 2D Shaders are working again using the new syntax, though all is buggy in general --- tools/editor/editor_log.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/editor') diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp index 02af9712a8..f69b7ba3e1 100644 --- a/tools/editor/editor_log.cpp +++ b/tools/editor/editor_log.cpp @@ -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; } -- cgit v1.2.3 From 4428115916144b45c4697cd65d9c8c093631bec6 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 19 Oct 2016 11:14:41 -0300 Subject: Everything returning to normal in 3D, still a long way to go -implemented the scene part of visual server and rasterizer, objects without lighting and material are rendererd only --- tools/editor/plugins/spatial_editor_plugin.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/editor') diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 55a4c6c934..38a7706acc 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2349,6 +2349,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed spatial_editor=p_spatial_editor; ViewportContainer *c=memnew(ViewportContainer); + c->set_stretch(true); add_child(c); c->set_area_as_parent_rect(); viewport = memnew( Viewport ); -- cgit v1.2.3 From 53d8f2b1ec1d86b189800b7fe156c464fdf9e380 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 27 Oct 2016 11:50:26 -0300 Subject: PBR more or less working, still working on bringing gizmos back --- tools/editor/io_plugins/editor_import_collada.cpp | 26 +++--- .../io_plugins/editor_scene_import_plugin.cpp | 30 +++---- .../io_plugins/editor_scene_importer_fbxconv.cpp | 24 +++--- tools/editor/plugins/baked_light_baker.cpp | 10 +-- .../plugins/collision_polygon_editor_plugin.cpp | 20 ++--- .../plugins/collision_polygon_editor_plugin.h | 4 +- tools/editor/plugins/path_editor_plugin.cpp | 12 +-- tools/editor/plugins/path_editor_plugin.h | 4 +- tools/editor/plugins/spatial_editor_plugin.cpp | 56 ++++++------- tools/editor/plugins/spatial_editor_plugin.h | 8 +- tools/editor/spatial_editor_gizmos.cpp | 98 +++++++++++----------- tools/editor/spatial_editor_gizmos.h | 56 ++++++------- 12 files changed, 172 insertions(+), 176 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 6b1873d49a..e8207c9575 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -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 material= memnew( FixedMaterial ); + Ref material= memnew( FixedSpatialMaterial ); if (src_mat.name!="") material->set_name(src_mat.name); @@ -394,14 +394,14 @@ Error ColladaImport::_create_material(const String& p_target) { Ref 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::PARAM_DIFFUSE,texture); +// 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 @@ -414,15 +414,15 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { -// 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 +435,15 @@ Error ColladaImport::_create_material(const String& p_target) { Ref 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::PARAM_EMISSION,texture); +// material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,Color(1,1,1,1)); }else { // 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 @@ -456,7 +456,7 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { - // material->set_texture(FixedMaterial::PARAM_NORMAL,texture); + // material->set_texture(FixedSpatialMaterial::PARAM_NORMAL,texture); }else { // missing_textures.push_back(texfile.get_file()); } @@ -465,7 +465,7 @@ Error ColladaImport::_create_material(const String& p_target) { } -// material->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess); +// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,effect.shininess); // material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided); // material->set_flag(Material::FLAG_UNSHADED,effect.unshaded); @@ -1042,7 +1042,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref& p_mesh,con { - Ref material; + Ref material; //find material Mesh::PrimitiveType primitive=Mesh::PRIMITIVE_TRIANGLES; diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 9d68807c46..41b245eb7d 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1392,7 +1392,7 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map::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() && (E->get().name=="textures/diffuse" || E->get().name=="textures/detail" || E->get().name=="textures/emission")) { + if (E->get().type==Variant::OBJECT && res->cast_to() && (E->get().name=="textures/diffuse" || E->get().name=="textures/detail" || E->get().name=="textures/emission")) { Ref tex =res->get(E->get().name); if (tex.is_valid()) { @@ -1400,14 +1400,14 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Mapget().type==Variant::OBJECT && res->cast_to() && (E->get().name=="textures/normal")) { + } else if (E->get().type==Variant::OBJECT && res->cast_to() && (E->get().name=="textures/normal")) { Ref 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()->set_fixed_flag(FixedMaterial::FLAG_USE_XY_NORMALMAP,true); + // res->cast_to()->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_XY_NORMALMAP,true); }// @@ -1514,12 +1514,12 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref m = mi->get_mesh(); for(int i=0;iget_surface_count();i++) { - Ref fm = m->surface_get_material(i); + Ref 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_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); } } } @@ -1537,18 +1537,18 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map for(int i=0;iget_surface_count();i++) { - Ref mat = m->surface_get_material(i); + Ref 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_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_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true); //mat->set_name(_fixstr(mat->get_name(),"vcol")); } @@ -1623,12 +1623,12 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref m = mi->get_mesh(); for(int i=0;iget_surface_count();i++) { - Ref fm = m->surface_get_material(i); + Ref 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_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); } } } @@ -1671,12 +1671,12 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref m = mi->get_mesh(); for(int i=0;iget_surface_count();i++) { - Ref fm = m->surface_get_material(i); + Ref 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); } } }*/ @@ -2044,16 +2044,16 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map for(int i=0;iget_surface_count();i++) { - Ref fm = mesh->surface_get_material(i); + Ref 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); + 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); diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp index f117182365..a954db829d 100644 --- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp +++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp @@ -482,29 +482,29 @@ void EditorSceneImporterFBXConv::_parse_materials(State& state) { ERR_CONTINUE(!material.has("id")); String id = _id(material["id"]); - Ref mat = memnew( FixedMaterial ); + Ref 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); } } diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp index 5cdae6aff3..f31c8adf86 100644 --- a/tools/editor/plugins/baked_light_baker.cpp +++ b/tools/editor/plugins/baked_light_baker.cpp @@ -143,18 +143,18 @@ void BakedLightBaker::_add_mesh(const Ref& p_mesh,const Ref& p_m MeshMaterial mm; - Ref fm = mat; + Ref 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); diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index ccec7eaed1..472ada116d 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -570,25 +570,25 @@ CollisionPolygonEditor::CollisionPolygonEditor(EditorNode *p_editor) { imgeom->set_transform(Transform(Matrix3(),Vector3(0,0,0.00001))); - line_material = Ref( memnew( FixedMaterial )); + line_material = Ref( 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( memnew( FixedMaterial )); + handle_material = Ref( 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 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); diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.h b/tools/editor/plugins/collision_polygon_editor_plugin.h index 4c1f45eca9..ed371e81b2 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.h +++ b/tools/editor/plugins/collision_polygon_editor_plugin.h @@ -62,8 +62,8 @@ class CollisionPolygonEditor : public HBoxContainer { ToolButton *button_edit; - Ref line_material; - Ref handle_material; + Ref line_material; + Ref handle_material; EditorNode *editor; Panel *panel; diff --git a/tools/editor/plugins/path_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp index aa7071298a..c56d526de8 100644 --- a/tools/editor/plugins/path_editor_plugin.cpp +++ b/tools/editor/plugins/path_editor_plugin.cpp @@ -523,16 +523,16 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) { editor=p_node; singleton=this; - path_material = Ref( 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( 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( 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( 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); diff --git a/tools/editor/plugins/path_editor_plugin.h b/tools/editor/plugins/path_editor_plugin.h index ee2196b47f..ab9474f38d 100644 --- a/tools/editor/plugins/path_editor_plugin.h +++ b/tools/editor/plugins/path_editor_plugin.h @@ -79,8 +79,8 @@ public: Path *get_edited_path() { return path; } static PathEditorPlugin* singleton; - Ref path_material; - Ref path_thin_material; + Ref path_material; + Ref 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); } diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 38a7706acc..7a24ab4180 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2548,11 +2548,11 @@ void SpatialEditor::_generate_selection_box() { } - Ref 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 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); st->set_material(mat); selection_box = st->commit(); } @@ -3139,11 +3139,11 @@ void SpatialEditor::_init_indicators() { { - indicator_mat = VisualServer::get_singleton()->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_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true); DVector grid_colors[3]; DVector grid_points[3]; @@ -3186,7 +3186,7 @@ void SpatialEditor::_init_indicators() { d[VisualServer::ARRAY_VERTEX]=grid_points[i]; d[VisualServer::ARRAY_COLOR]=grid_colors[i]; 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); + 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; @@ -3205,7 +3205,7 @@ void SpatialEditor::_init_indicators() { d[VisualServer::ARRAY_COLOR]=origin_colors; VisualServer::get_singleton()->mesh_add_surface_from_arrays(origin,VisualServer::PRIMITIVE_LINES,d); - VisualServer::get_singleton()->mesh_surface_set_material(origin,0,indicator_mat); + VisualServer::get_singleton()->mesh_surface_set_material(origin,0,indicator_mat->get_rid()); // origin = VisualServer::get_singleton()->poly_create(); @@ -3236,17 +3236,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()->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_from_arrays(cursor_mesh,VS::PRIMITIVE_LINES,d); - VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh,0,cursor_material); + 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<get("3d_editor/manipulator_gizmo_opacity"); - gizmo_hl = Ref( 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( 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++) { @@ -3276,14 +3274,14 @@ void SpatialEditor::_init_indicators() { rotate_gizmo[i]=Ref( memnew( Mesh ) ); - Ref 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 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; @@ -3429,8 +3427,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() { diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index 4751cf7071..8c8a80bc3a 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -331,8 +331,8 @@ private: bool grid_enabled; Ref move_gizmo[3], rotate_gizmo[3]; - Ref gizmo_color[3]; - Ref gizmo_hl; + Ref gizmo_color[3]; + Ref gizmo_hl; int over_gizmo_handle; @@ -344,8 +344,8 @@ private: RID indicators_instance; RID cursor_mesh; RID cursor_instance; - RID indicator_mat; - RID cursor_material; + Ref indicator_mat; + Ref cursor_material; /* struct Selected { diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 716b03b7b7..bc76f6c20c 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -2976,25 +2976,25 @@ Ref SpatialEditorGizmos::get_gizmo(Spatial *p_spatial) { } -Ref SpatialEditorGizmos::create_line_material(const Color& p_base_color) { +Ref SpatialEditorGizmos::create_line_material(const Color& p_base_color) { - Ref line_material = Ref( memnew( FixedMaterial )); + Ref line_material = Ref( 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,p_base_color); + 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,p_base_color); return line_material; } -Ref SpatialEditorGizmos::create_solid_material(const Color& p_base_color) { +Ref SpatialEditorGizmos::create_solid_material(const Color& p_base_color) { - Ref line_material = Ref( memnew( FixedMaterial )); + Ref line_material = Ref( memnew( FixedSpatialMaterial )); 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); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,p_base_color); return line_material; @@ -3004,50 +3004,50 @@ SpatialEditorGizmos::SpatialEditorGizmos() { singleton=this; - handle_material = Ref( memnew( FixedMaterial )); + handle_material = Ref( memnew( FixedSpatialMaterial )); handle_material->set_flag(Material::FLAG_UNSHADED, true); - handle_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(0.8,0.8,0.8)); + handle_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.8,0.8,0.8)); - handle2_material = Ref( memnew( FixedMaterial )); + handle2_material = Ref( memnew( FixedSpatialMaterial )); handle2_material->set_flag(Material::FLAG_UNSHADED, true); - handle2_material->set_fixed_flag(FixedMaterial::FLAG_USE_POINT_SIZE, true); + handle2_material->set_fixed_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::PARAM_DIFFUSE,handle_t); + handle2_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1)); + handle2_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + handle2_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); light_material = create_line_material(Color(1,1,0.2)); - light_material_omni_icon = Ref( memnew( FixedMaterial )); + light_material_omni_icon = Ref( memnew( FixedSpatialMaterial )); 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->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + light_material_omni_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); + light_material_omni_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoLight","EditorIcons")); - light_material_directional_icon = Ref( memnew( FixedMaterial )); + light_material_directional_icon = Ref( memnew( FixedSpatialMaterial )); 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->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + light_material_directional_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); + light_material_directional_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,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_edge_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, false); navmesh_solid_material->set_flag(Material::FLAG_DOUBLE_SIDED,true); 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_edge_material_disabled->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, false); navmesh_solid_material_disabled->set_flag(Material::FLAG_DOUBLE_SIDED,true); skeleton_material = create_line_material(Color(0.6,1.0,0.3)); @@ -3077,10 +3077,10 @@ 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 mat = memnew( FixedMaterial ); + Ref mat = memnew( FixedSpatialMaterial ); 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); + mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true); + mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); mat->set_line_width(3); Array d; d.resize(VS::ARRAY_MAX); @@ -3100,10 +3100,10 @@ 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 mat = memnew(FixedMaterial); + Ref mat = memnew(FixedSpatialMaterial); 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); + mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); mat->set_line_width(3); Array d; d.resize(VS::ARRAY_MAX); @@ -3114,13 +3114,13 @@ SpatialEditorGizmos::SpatialEditorGizmos() { } - sample_player_icon = Ref( memnew( FixedMaterial )); + sample_player_icon = Ref( memnew( FixedSpatialMaterial )); 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->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + sample_player_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); + sample_player_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,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)); @@ -3129,29 +3129,29 @@ SpatialEditorGizmos::SpatialEditorGizmos() { visibility_notifier_material = create_line_material(Color(1.0,0.5,1.0)); joint_material = create_line_material(Color(0.6,0.8,1.0)); - stream_player_icon = Ref( memnew( FixedMaterial )); + stream_player_icon = Ref( memnew( FixedSpatialMaterial )); 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")); + stream_player_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + stream_player_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); + stream_player_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoSpatialStreamPlayer","EditorIcons")); - visibility_notifier_icon = Ref( memnew( FixedMaterial )); + visibility_notifier_icon = Ref( memnew( FixedSpatialMaterial )); 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")); + visibility_notifier_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + visibility_notifier_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); + visibility_notifier_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("Visible","EditorIcons")); - listener_icon = Ref(memnew(FixedMaterial)); + listener_icon = Ref(memnew(FixedSpatialMaterial)); 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")); + listener_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + listener_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE, Color(1, 1, 1, 0.9)); + listener_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE, SpatialEditor::get_singleton()->get_icon("GizmoListener", "EditorIcons")); { diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index a7a6af4b18..64c6a6e824 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -464,34 +464,34 @@ public: class SpatialEditorGizmos { public: - Ref create_line_material(const Color& p_base_color); - Ref create_solid_material(const Color& p_base_color); - Ref handle2_material; - Ref handle_material; - Ref light_material; - Ref light_material_omni_icon; - Ref light_material_directional_icon; - Ref camera_material; - Ref skeleton_material; - Ref room_material; - Ref portal_material; - Ref raycast_material; - Ref visibility_notifier_material; - Ref car_wheel_material; - Ref joint_material; - - Ref navmesh_edge_material; - Ref navmesh_solid_material; - Ref navmesh_edge_material_disabled; - Ref navmesh_solid_material_disabled; - - Ref listener_icon; - - Ref sample_player_icon; - Ref stream_player_icon; - Ref visibility_notifier_icon; - - Ref shape_material; + Ref create_line_material(const Color& p_base_color); + Ref create_solid_material(const Color& p_base_color); + Ref handle2_material; + Ref handle_material; + Ref light_material; + Ref light_material_omni_icon; + Ref light_material_directional_icon; + Ref camera_material; + Ref skeleton_material; + Ref room_material; + Ref portal_material; + Ref raycast_material; + Ref visibility_notifier_material; + Ref car_wheel_material; + Ref joint_material; + + Ref navmesh_edge_material; + Ref navmesh_solid_material; + Ref navmesh_edge_material_disabled; + Ref navmesh_solid_material_disabled; + + Ref listener_icon; + + Ref sample_player_icon; + Ref stream_player_icon; + Ref visibility_notifier_icon; + + Ref shape_material; Ref handle_t; Ref pos3d_mesh; -- cgit v1.2.3 From d6567010bf1c65abcbe09b959cde63664778d923 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 29 Oct 2016 20:48:09 -0300 Subject: -Many many fixes -Gizmos work again --- tools/editor/editor_node.cpp | 2 +- tools/editor/plugins/spatial_editor_plugin.cpp | 9 +- tools/editor/plugins/spatial_editor_plugin.h | 2 +- tools/editor/spatial_editor_gizmos.cpp | 173 +++++++++++++------------ tools/editor/spatial_editor_gizmos.h | 3 +- 5 files changed, 98 insertions(+), 91 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index a4ee102aed..99c2b468fa 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -4144,7 +4144,7 @@ void EditorNode::register_editor_types() { ObjectTypeDB::register_type(); //ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); -// ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 7a24ab4180..13c69692c7 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2553,6 +2553,7 @@ void SpatialEditor::_generate_selection_box() { 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(); } @@ -3143,6 +3144,8 @@ void SpatialEditor::_init_indicators() { 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 grid_colors[3]; @@ -3543,7 +3546,7 @@ void SpatialEditor::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { - //gizmos = memnew( SpatialEditorGizmos ); + gizmos = memnew( SpatialEditorGizmos ); _init_indicators(); _update_default_light_angle(); } @@ -3551,7 +3554,7 @@ void SpatialEditor::_notification(int p_what) { if (p_what==NOTIFICATION_EXIT_TREE) { _finish_indicators(); -// memdelete( gizmos ); + memdelete( gizmos ); } } @@ -3597,7 +3600,7 @@ void SpatialEditor::_request_gizmo(Object* p_obj) { } if (!seg.is_valid()) { - // seg = gizmos->get_gizmo(sp); + seg = gizmos->get_gizmo(sp); } if (seg.is_valid()) { diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index 8c8a80bc3a..1617acaefb 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -467,7 +467,7 @@ private: static SpatialEditor *singleton; void _node_removed(Node* p_node); - //SpatialEditorGizmos *gizmos; + SpatialEditorGizmos *gizmos; SpatialEditor(); void _update_ambient_light_color(const Color& p_color); diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index bc76f6c20c..b1accac762 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -41,7 +41,7 @@ // Keep small children away from this file. // It's so ugly it will eat them alive -#if 0 + #define HANDLE_HALF_SIZE 0.05 @@ -84,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<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(); } @@ -729,7 +728,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()) { Plane cp=Plane( gt.origin, p_camera->get_transform().basis.get_axis(2)); @@ -738,15 +737,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)); } } @@ -754,21 +753,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(); } @@ -831,7 +830,7 @@ void LightSpatialGizmo::redraw() { OmniLight *on = light->cast_to(); - float r = on->get_parameter(Light::PARAM_RADIUS); + float r = on->get_param(Light::PARAM_RANGE); Vector points; @@ -871,9 +870,9 @@ void LightSpatialGizmo::redraw() { Vector points; SpotLight *on = light->cast_to(); - 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))); @@ -1543,7 +1542,7 @@ void RayCastSpatialGizmo::redraw() { } -RayCastSpatialGizmo::RayCastSpatialGizmo(RayCast* p_raycast){ +RayCastSpatialGizmo::RayCastSpatialGizmo(RayCast* p_raycast) { set_spatial_node(p_raycast); raycast=p_raycast; @@ -2979,11 +2978,12 @@ Ref SpatialEditorGizmos::get_gizmo(Spatial *p_spatial) { Ref SpatialEditorGizmos::create_line_material(const Color& p_base_color) { Ref line_material = Ref( memnew( FixedSpatialMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); + line_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - 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,p_base_color); + line_material->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + line_material->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + line_material->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + line_material->set_albedo(p_base_color); return line_material; @@ -2992,9 +2992,9 @@ Ref SpatialEditorGizmos::create_line_material(const Color& Ref SpatialEditorGizmos::create_solid_material(const Color& p_base_color) { Ref line_material = Ref( memnew( FixedSpatialMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); - line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,p_base_color); + 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; @@ -3005,56 +3005,59 @@ SpatialEditorGizmos::SpatialEditorGizmos() { singleton=this; handle_material = Ref( memnew( FixedSpatialMaterial )); - handle_material->set_flag(Material::FLAG_UNSHADED, true); - handle_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.8,0.8,0.8)); + handle_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + handle_material->set_albedo(Color(0.8,0.8,0.8)); handle2_material = Ref( memnew( FixedSpatialMaterial )); - handle2_material->set_flag(Material::FLAG_UNSHADED, true); - handle2_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_POINT_SIZE, true); + 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(FixedSpatialMaterial::PARAM_DIFFUSE,handle_t); - handle2_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1)); - handle2_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - handle2_material->set_fixed_flag(FixedSpatialMaterial::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( memnew( FixedSpatialMaterial )); - 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(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - light_material_omni_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - light_material_omni_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoLight","EditorIcons")); + 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( memnew( FixedSpatialMaterial )); - 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(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - light_material_directional_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - light_material_directional_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoDirectionalLight","EditorIcons")); + 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(FixedSpatialMaterial::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(FixedSpatialMaterial::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 @@ -3078,9 +3081,10 @@ SpatialEditorGizmos::SpatialEditorGizmos() { cursor_colors.push_back(Color(0.5,0.5,1,0.7)); Ref mat = memnew( FixedSpatialMaterial ); - mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true); - mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + 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); @@ -3101,9 +3105,10 @@ SpatialEditorGizmos::SpatialEditorGizmos() { cursor_colors.push_back(Color(0.5, 0.5, 0.5, 0.7)); Ref mat = memnew(FixedSpatialMaterial); - mat->set_flag(Material::FLAG_UNSHADED, true); - mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); - mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + 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); @@ -3115,12 +3120,12 @@ SpatialEditorGizmos::SpatialEditorGizmos() { sample_player_icon = Ref( memnew( FixedSpatialMaterial )); - 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(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - sample_player_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - sample_player_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoSpatialSamplePlayer","EditorIcons")); + 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)); @@ -3130,28 +3135,28 @@ SpatialEditorGizmos::SpatialEditorGizmos() { joint_material = create_line_material(Color(0.6,0.8,1.0)); stream_player_icon = Ref( memnew( FixedSpatialMaterial )); - 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(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - stream_player_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - stream_player_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoSpatialStreamPlayer","EditorIcons")); + 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( memnew( FixedSpatialMaterial )); - 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(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - visibility_notifier_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - visibility_notifier_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("Visible","EditorIcons")); + 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(memnew(FixedSpatialMaterial)); - 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(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - listener_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE, Color(1, 1, 1, 0.9)); - listener_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE, SpatialEditor::get_singleton()->get_icon("GizmoListener", "EditorIcons")); + 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")); { @@ -3200,4 +3205,4 @@ SpatialEditorGizmos::SpatialEditorGizmos() { } -#endif + diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index 64c6a6e824..2c0033cdca 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -52,7 +52,7 @@ class Camera; -#if 0 + class EditorSpatialGizmo : public SpatialEditorGizmo { OBJ_TYPE(EditorSpatialGizmo,SpatialGizmo); @@ -505,5 +505,4 @@ public: SpatialEditorGizmos(); }; -#endif #endif // SPATIAL_EDITOR_GIZMOS_H -- cgit v1.2.3 From 696c47d9aba44edb5ca55f8c6a27381170eb4237 Mon Sep 17 00:00:00 2001 From: volzhs Date: Sun, 30 Oct 2016 23:21:59 +0900 Subject: Fix bug with saving last select language and remove warning --- tools/editor/editor_settings.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index f5741c4a9e..78bfd7cf25 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -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 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); } -- cgit v1.2.3 From 513820ab276e06b7a5f14b3437dc21d9a320c1a2 Mon Sep 17 00:00:00 2001 From: volzhs Date: Mon, 31 Oct 2016 00:07:16 +0900 Subject: Fix 2 search menus are shown --- tools/editor/plugins/script_editor_plugin.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 99c50efd2f..b6ce3e89eb 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1909,19 +1909,14 @@ void ScriptEditor::_update_selected_editor_menu() { se->get_edit_menu()->hide(); } - EditorHelp *eh = tab_container->get_child(i)->cast_to(); - - if (eh) { - - if (current) - script_search_menu->show(); - else - script_search_menu->hide(); - } - - } + EditorHelp *eh=tab_container->get_current_tab_control()->cast_to(); + if (eh) { + script_search_menu->show(); + } else { + script_search_menu->hide(); + } } void ScriptEditor::_update_history_pos(int p_new_pos) { -- cgit v1.2.3 From 707185d9d8a273c1bf2a70dcba707045295427a9 Mon Sep 17 00:00:00 2001 From: volzhs Date: Mon, 31 Oct 2016 06:20:54 +0900 Subject: Fix p_index out of size error when closing script --- tools/editor/plugins/script_editor_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/editor') diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index b6ce3e89eb..e7170a23f3 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -945,7 +945,7 @@ void ScriptEditor::_menu_option(int p_option) { } } - EditorHelp *help = tab_container->get_child(selected)->cast_to(); + EditorHelp *help = tab_container->get_current_tab_control()->cast_to(); if (help) { switch(p_option) { -- cgit v1.2.3 From a7d492eb53489083181682839c6d7f83a888ad46 Mon Sep 17 00:00:00 2001 From: volzhs Date: Mon, 31 Oct 2016 11:50:34 +0900 Subject: Fix memory leak with drag & drop on 2D viewport --- tools/editor/plugins/canvas_item_editor_plugin.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/editor') diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index ac39e0687c..af9fd69ae7 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -3797,6 +3797,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; } } -- cgit v1.2.3 From 70cce6152d32b8a4e5fdfee52e2bb873c92551e5 Mon Sep 17 00:00:00 2001 From: volzhs Date: Tue, 1 Nov 2016 01:51:34 +0900 Subject: Fix resetting to default value in EditorSettings --- tools/editor/editor_settings.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'tools/editor') diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 78bfd7cf25..2a355d95f3 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -1098,7 +1098,6 @@ EditorSettings::EditorSettings() { } _load_defaults(); - save_changed_setting=false; } -- cgit v1.2.3 From 97c8508f5e4f57b1048830d44e76e1f4517fd449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 30 Oct 2016 18:44:57 +0100 Subject: style: Start applying PEP8 to Python files, indentation issues Done with `autopep8 --select=E1`, fixes: - E101 - Reindent all lines. - E112 - Fix under-indented comments. - E113 - Fix over-indented comments. - E115 - Fix under-indented comments. - E116 - Fix over-indented comments. - E121 - Fix a badly indented line. - E122 - Fix a badly indented line. - E123 - Fix a badly indented line. - E124 - Fix a badly indented line. - E125 - Fix indentation undistinguish from the next logical line. - E126 - Fix a badly indented line. - E127 - Fix a badly indented line. - E128 - Fix a badly indented line. - E129 - Fix a badly indented line. --- tools/editor/SCsub | 126 +++++++++++++++++++++++------------------------ tools/editor/icons/SCsub | 120 ++++++++++++++++++++++---------------------- 2 files changed, 123 insertions(+), 123 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/SCsub b/tools/editor/SCsub index f6cb16dc24..41b4386e21 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -5,51 +5,51 @@ 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) + 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") + 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) + 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") + 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") @@ -59,30 +59,30 @@ def make_certs_header(target,source,env): 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'); + 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/icons/SCsub b/tools/editor/icons/SCsub index 9e05d8f391..4806a89df2 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -4,93 +4,93 @@ Import('env') def make_editor_icons_action(target, source, env): - import os - import cStringIO + import os + import cStringIO - dst = target[0].srcnode().abspath - pixmaps = source + dst = target[0].srcnode().abspath + pixmaps = source - s = cStringIO.StringIO() + s = cStringIO.StringIO() - 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("#include \"editor_icons.h\"\n\n") + s.write("#include \"editor_scale.h\"\n\n") + s.write("#include \"scene/resources/theme.h\"\n\n") - hidpi_list=[] + hidpi_list=[] - for x in pixmaps: + for x in pixmaps: - x=str(x) - var_str=os.path.basename(x)[:-4]+"_png"; - #print(var_str) + x=str(x) + var_str=os.path.basename(x)[:-4]+"_png"; + #print(var_str) - s.write("static const unsigned char "+ var_str +"[]={\n"); + s.write("static const unsigned char "+ var_str +"[]={\n"); - pngf=open(x,"rb"); + pngf=open(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(",") + 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"); + s.write("\n};\n\n"); - pngf.close(); - var_str=os.path.basename(x)[:-4]+"_hidpi_png"; - try: + pngf.close(); + var_str=os.path.basename(x)[:-4]+"_hidpi_png"; + try: - pngf = open(os.path.dirname(x)+"/2x/"+os.path.basename(x), "rb") + pngf = open(os.path.dirname(x)+"/2x/"+os.path.basename(x), "rb") - s.write("static const unsigned char "+ var_str +"[]={\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(",") + 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) + s.write("\n};\n\n\n"); + hidpi_list.append(x) - except: - s.write("static const unsigned char* "+ var_str +"=NULL;\n\n\n"); + except: + s.write("static const unsigned char* "+ var_str +"=NULL;\n\n\n"); - s.write("static Ref make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") - s.write("\tRef 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 make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") + s.write("\tRef 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("void editor_register_icons(Ref p_theme) {\n\n") + s.write("void editor_register_icons(Ref 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') + 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"))]) -- cgit v1.2.3 From d4c17700aa2f36f69978beda04e42ff2749de270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 30 Oct 2016 18:57:40 +0100 Subject: style: Fix PEP8 whitespace issues in Python files Done with `autopep8 --select=E2,W2`, fixes: - E201 - Remove extraneous whitespace. - E202 - Remove extraneous whitespace. - E203 - Remove extraneous whitespace. - E211 - Remove extraneous whitespace. - E221 - Fix extraneous whitespace around keywords. - E222 - Fix extraneous whitespace around keywords. - E223 - Fix extraneous whitespace around keywords. - E224 - Remove extraneous whitespace around operator. - E225 - Fix missing whitespace around operator. - E226 - Fix missing whitespace around operator. - E227 - Fix missing whitespace around operator. - E228 - Fix missing whitespace around operator. - E231 - Add missing whitespace. - E231 - Fix various deprecated code (via lib2to3). - E241 - Fix extraneous whitespace around keywords. - E242 - Remove extraneous whitespace around operator. - E251 - Remove whitespace around parameter '=' sign. - E261 - Fix spacing after comment hash. - E262 - Fix spacing after comment hash. - E265 - Format block comments. - E271 - Fix extraneous whitespace around keywords. - E272 - Fix extraneous whitespace around keywords. - E273 - Fix extraneous whitespace around keywords. - E274 - Fix extraneous whitespace around keywords. - W291 - Remove trailing whitespace. - W293 - Remove trailing whitespace. --- tools/editor/SCsub | 52 ++++++++++++++++++++-------------------- tools/editor/fileserver/SCsub | 2 +- tools/editor/icons/SCsub | 56 +++++++++++++++++++++---------------------- tools/editor/io_plugins/SCsub | 2 +- tools/editor/plugins/SCsub | 2 +- 5 files changed, 57 insertions(+), 57 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/SCsub b/tools/editor/SCsub index 41b4386e21..0dbb7d3f20 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -3,12 +3,12 @@ Import('env') -def make_doc_header(target,source,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") + f = open(src, "rb") + g = open(dst, "wb") buf = f.read() decomp_size = len(buf) import zlib @@ -18,22 +18,22 @@ def make_doc_header(target,source,env): 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 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(str(ord(buf[i])) + ",\n") g.write("};\n") g.write("#endif") -def make_certs_header(target,source,env): +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") + f = open(src, "rb") + g = open(dst, "wb") buf = f.read() decomp_size = len(buf) import zlib @@ -43,11 +43,11 @@ def make_certs_header(target,source,env): 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 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(str(ord(buf[i])) + ",\n") g.write("};\n") g.write("#endif") @@ -57,29 +57,29 @@ def make_certs_header(target,source,env): -if (env["tools"]=="yes"): +if (env["tools"] == "yes"): - reg_exporters_inc='#include "register_exporters.h"\n' - reg_exporters='void register_exporters() {\n' + 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") + 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/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) + 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) + # 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") + env.add_source_files(env.tool_sources, "*.cpp") Export('env') SConscript('icons/SCsub'); 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/icons/SCsub b/tools/editor/icons/SCsub index 4806a89df2..ac942b20e3 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -16,47 +16,47 @@ def make_editor_icons_action(target, source, env): s.write("#include \"editor_scale.h\"\n\n") s.write("#include \"scene/resources/theme.h\"\n\n") - hidpi_list=[] + hidpi_list = [] for x in pixmaps: - x=str(x) - var_str=os.path.basename(x)[:-4]+"_png"; - #print(var_str) + x = str(x) + var_str = os.path.basename(x)[:-4] + "_png"; + # print(var_str) - s.write("static const unsigned char "+ var_str +"[]={\n"); + s.write("static const unsigned char " + var_str + "[]={\n"); - pngf=open(x,"rb"); + pngf = open(x, "rb"); - b=pngf.read(1); - while(len(b)==1): + b = pngf.read(1); + while(len(b) == 1): s.write(hex(ord(b))) - b=pngf.read(1); - if (len(b)==1): + b = pngf.read(1); + if (len(b) == 1): s.write(",") s.write("\n};\n\n"); pngf.close(); - var_str=os.path.basename(x)[:-4]+"_hidpi_png"; + var_str = os.path.basename(x)[:-4] + "_hidpi_png"; try: - pngf = open(os.path.dirname(x)+"/2x/"+os.path.basename(x), "rb") + pngf = open(os.path.dirname(x) + "/2x/" + os.path.basename(x), "rb") - s.write("static const unsigned char "+ var_str +"[]={\n"); + s.write("static const unsigned char " + var_str + "[]={\n"); - b=pngf.read(1); - while(len(b)==1): + b = pngf.read(1); + while(len(b) == 1): s.write(hex(ord(b))) - b=pngf.read(1); - if (len(b)==1): + 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 const unsigned char* " + var_str + "=NULL;\n\n\n"); @@ -75,24 +75,24 @@ def make_editor_icons_action(target, source, env): 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"); - f = open(dst,"wb") + 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/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/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") -- cgit v1.2.3 From 817dd7ccbb166b27c93706dffc5c0c0d59fd87f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 30 Oct 2016 19:05:14 +0100 Subject: style: Fix PEP8 blank lines issues in Python files Done with `autopep8 --select=E3,W3`, fixes: - E301 - Add missing blank line. - E302 - Add missing 2 blank lines. - E303 - Remove extra blank lines. - E304 - Remove blank line following function decorator. - E309 - Add missing blank line. - W391 - Remove trailing blank lines. --- tools/editor/SCsub | 8 -------- tools/editor/icons/SCsub | 4 +--- 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/SCsub b/tools/editor/SCsub index 0dbb7d3f20..625103eaee 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -14,7 +14,6 @@ def make_doc_header(target, source, env): 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") @@ -27,7 +26,6 @@ def make_doc_header(target, source, env): g.write("#endif") - def make_certs_header(target, source, env): src = source[0].srcnode().abspath @@ -39,7 +37,6 @@ def make_certs_header(target, source, env): 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") @@ -52,11 +49,6 @@ def make_certs_header(target, source, env): g.write("#endif") - - - - - if (env["tools"] == "yes"): reg_exporters_inc = '#include "register_exporters.h"\n' diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index ac942b20e3..f27350a184 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -2,6 +2,7 @@ Import('env') + def make_editor_icons_action(target, source, env): import os @@ -58,9 +59,6 @@ def make_editor_icons_action(target, source, env): except: s.write("static const unsigned char* " + var_str + "=NULL;\n\n\n"); - - - s.write("static Ref make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") s.write("\tRef texture( memnew( ImageTexture ) );\n") s.write("\tbool use_hidpi_image=(editor_get_scale()>1.0&&p_hidpi_png);\n") -- cgit v1.2.3 From f34151ff0f91e8f0df8eaf829334b2205eb7da3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 1 Nov 2016 00:24:30 +0100 Subject: style: Various other PEP8 fixes in Python files Done with `autopep8 --select=E7`, fixes: - E701 - Put colon-separated compound statement on separate lines. - E702 - Put semicolon-separated compound statement on separate lines. - E703 - Put semicolon-separated compound statement on separate lines. - E711 - Fix comparison with None. - E712 - Fix (trivial case of) comparison with boolean. - E713 - Fix (trivial case of) non-membership check. - E721 - Fix various deprecated code (via lib2to3). --- tools/editor/SCsub | 8 ++++---- tools/editor/icons/SCsub | 36 ++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/SCsub b/tools/editor/SCsub index 625103eaee..caf45d25be 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -74,7 +74,7 @@ if (env["tools"] == "yes"): env.add_source_files(env.tool_sources, "*.cpp") Export('env') - SConscript('icons/SCsub'); - SConscript('plugins/SCsub'); - SConscript('fileserver/SCsub'); - SConscript('io_plugins/SCsub'); + SConscript('icons/SCsub') + SConscript('plugins/SCsub') + SConscript('fileserver/SCsub') + SConscript('io_plugins/SCsub') diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index f27350a184..af6ebd67fd 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -22,42 +22,42 @@ def make_editor_icons_action(target, source, env): for x in pixmaps: x = str(x) - var_str = os.path.basename(x)[:-4] + "_png"; + var_str = os.path.basename(x)[:-4] + "_png" # print(var_str) - s.write("static const unsigned char " + var_str + "[]={\n"); + s.write("static const unsigned char " + var_str + "[]={\n") - pngf = open(x, "rb"); + pngf = open(x, "rb") - b = pngf.read(1); + b = pngf.read(1) while(len(b) == 1): s.write(hex(ord(b))) - b = pngf.read(1); + b = pngf.read(1) if (len(b) == 1): s.write(",") - s.write("\n};\n\n"); + s.write("\n};\n\n") - pngf.close(); - var_str = os.path.basename(x)[:-4] + "_hidpi_png"; + pngf.close() + var_str = os.path.basename(x)[:-4] + "_hidpi_png" try: pngf = open(os.path.dirname(x) + "/2x/" + os.path.basename(x), "rb") - s.write("static const unsigned char " + var_str + "[]={\n"); + s.write("static const unsigned char " + var_str + "[]={\n") - b = pngf.read(1); + b = pngf.read(1) while(len(b) == 1): s.write(hex(ord(b))) - b = pngf.read(1); + b = pngf.read(1) if (len(b) == 1): s.write(",") - s.write("\n};\n\n\n"); + 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 const unsigned char* " + var_str + "=NULL;\n\n\n") s.write("static Ref make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n") s.write("\tRef texture( memnew( ImageTexture ) );\n") @@ -74,12 +74,12 @@ def make_editor_icons_action(target, source, env): 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"); + 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()) -- cgit v1.2.3 From fd9aebd4fa37965ec307b87742f1d88aa8be37ca Mon Sep 17 00:00:00 2001 From: volzhs Date: Tue, 1 Nov 2016 22:26:29 +0900 Subject: Fix to focus or rename node by double click --- tools/editor/scene_tree_dock.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'tools/editor') diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 16f06c7ac9..49db321d4d 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -2004,7 +2004,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); -- cgit v1.2.3 From ce5200b30e6d262905912c6571d51ba6f5979bd7 Mon Sep 17 00:00:00 2001 From: Mateusz Adamczyk Date: Mon, 31 Oct 2016 15:45:20 +0100 Subject: Option for detaching script from node (#6934). --- tools/editor/scene_tree_dock.cpp | 40 +++++++++++++++++++++++++++++++++++++--- tools/editor/scene_tree_dock.h | 2 ++ 2 files changed, 39 insertions(+), 3 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 16f06c7ac9..b4d32eb5c2 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -86,6 +86,9 @@ void SceneTreeDock::_unhandled_key_input(InputEvent p_event) { 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); } @@ -414,6 +417,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