summaryrefslogtreecommitdiff
path: root/tools/editor/io_plugins
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/io_plugins')
-rw-r--r--tools/editor/io_plugins/editor_font_import_plugin.cpp10
-rw-r--r--tools/editor/io_plugins/editor_import_collada.cpp91
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.cpp80
-rw-r--r--tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp27
-rw-r--r--tools/editor/io_plugins/editor_scene_importer_fbxconv.h2
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp72
6 files changed, 147 insertions, 135 deletions
diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp
index 71aca8dc6f..0bf9b32b08 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<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe
if (err==OK) {
for(int i=0;i<height;i++){
- color[i]=img.get_pixel(0,i*img.get_height()/height);
+ //color[i]=img.get_pixel(0,i*img.get_height()/height);
}
} else {
@@ -1514,7 +1514,7 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe
w=DVector<uint8_t>::Write();
- Image img(s.width,s.height,0,Image::FORMAT_RGBA,pixels);
+ Image img(s.width,s.height,0,Image::FORMAT_RGBA8,pixels);
font_data_list[i]->blit=img;
font_data_list[i]->blit_ofs=o;
@@ -1537,7 +1537,7 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe
res_size.y=nearest_power_of_2(res_size.y);
print_line("Atlas size: "+res_size);
- Image atlas(res_size.x,res_size.y,0,Image::FORMAT_RGBA);
+ Image atlas(res_size.x,res_size.y,0,Image::FORMAT_RGBA8);
for(int i=0;i<font_data_list.size();i++) {
@@ -1565,12 +1565,12 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe
}
}
- atlas=Image(res_size.x,res_size.y,0,Image::FORMAT_RGBA,data);
+ atlas=Image(res_size.x,res_size.y,0,Image::FORMAT_RGBA8,data);
}
if (from->has_option("color/monochrome") && bool(from->get_option("color/monochrome"))) {
- atlas.convert(Image::FORMAT_GRAYSCALE_ALPHA);
+ atlas.convert(Image::FORMAT_LA8);
}
diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp
index 299b74cedc..c1830bf118 100644
--- a/tools/editor/io_plugins/editor_import_collada.cpp
+++ b/tools/editor/io_plugins/editor_import_collada.cpp
@@ -85,7 +85,7 @@ struct ColladaImport {
Error _create_scene(Collada::Node *p_node, Spatial *p_parent);
Error _create_resources(Collada::Node *p_node);
Error _create_material(const String& p_material);
- Error _create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data,Vector<Ref<Mesh> > p_morph_meshes=Vector<Ref<Mesh> >());
+ Error _create_mesh_surfaces(bool p_optimize, Ref<Mesh>& p_mesh, const Map<String,Collada::NodeGeometry::Material>& p_material_map, const Collada::MeshData &meshdata, const Transform& p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data, Vector<Ref<Mesh> > p_morph_meshes=Vector<Ref<Mesh> >(), bool p_for_morph=false);
Error load(const String& p_path, int p_flags, bool p_force_make_tangents=false);
void _fix_param_animation_tracks();
void create_animation(int p_clip,bool p_make_tracks_in_all_bones, bool p_import_value_tracks);
@@ -237,8 +237,8 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
//well, it's an ambient light..
Light *l = memnew( DirectionalLight );
// l->set_color(Light::COLOR_AMBIENT,ld.color);
- l->set_color(Light::COLOR_DIFFUSE,Color(0,0,0));
- l->set_color(Light::COLOR_SPECULAR,Color(0,0,0));
+// l->set_color(Light::COLOR_DIFFUSE,Color(0,0,0));
+// l->set_color(Light::COLOR_SPECULAR,Color(0,0,0));
node = l;
} else if (ld.mode==Collada::LightData::MODE_DIRECTIONAL) {
@@ -248,8 +248,8 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
//if (found_ambient) //use it here
// l->set_color(Light::COLOR_AMBIENT,ambient);
- l->set_color(Light::COLOR_DIFFUSE,ld.color);
- l->set_color(Light::COLOR_SPECULAR,Color(1,1,1));
+// l->set_color(Light::COLOR_DIFFUSE,ld.color);
+// l->set_color(Light::COLOR_SPECULAR,Color(1,1,1));
node = l;
} else {
@@ -259,14 +259,14 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
l=memnew( OmniLight );
else {
l=memnew( SpotLight );
- l->set_parameter(Light::PARAM_SPOT_ANGLE,ld.spot_angle);
- l->set_parameter(Light::PARAM_SPOT_ATTENUATION,ld.spot_exp);
+// l->set_parameter(Light::PARAM_SPOT_ANGLE,ld.spot_angle);
+// l->set_parameter(Light::PARAM_SPOT_ATTENUATION,ld.spot_exp);
}
//
- l->set_color(Light::COLOR_DIFFUSE,ld.color);
- l->set_color(Light::COLOR_SPECULAR,Color(1,1,1));
- l->approximate_opengl_attenuation(ld.constant_att,ld.linear_att,ld.quad_att);
+// l->set_color(Light::COLOR_DIFFUSE,ld.color);
+// l->set_color(Light::COLOR_SPECULAR,Color(1,1,1));
+// l->approximate_opengl_attenuation(ld.constant_att,ld.linear_att,ld.quad_att);
node=l;
}
@@ -377,7 +377,7 @@ Error ColladaImport::_create_material(const String& p_target) {
ERR_FAIL_COND_V(!collada.state.effect_map.has(src_mat.instance_effect),ERR_INVALID_PARAMETER);
Collada::Effect &effect=collada.state.effect_map[src_mat.instance_effect];
- Ref<FixedMaterial> material= memnew( FixedMaterial );
+ Ref<FixedSpatialMaterial> material= memnew( FixedSpatialMaterial );
if (src_mat.name!="")
material->set_name(src_mat.name);
@@ -394,14 +394,15 @@ Error ColladaImport::_create_material(const String& p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile,"Texture");
if (texture.is_valid()) {
- material->set_texture(FixedMaterial::PARAM_DIFFUSE,texture);
- material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,1));
+ material->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,texture);
+ material->set_albedo(Color(1,1,1,1));
+// material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,1));
} else {
missing_textures.push_back(texfile.get_file());
}
}
} else {
- material->set_parameter(FixedMaterial::PARAM_DIFFUSE,effect.diffuse.color);
+// material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,effect.diffuse.color);
}
// SPECULAR
@@ -413,16 +414,18 @@ Error ColladaImport::_create_material(const String& p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile,"Texture");
if (texture.is_valid()) {
+ material->set_texture(FixedSpatialMaterial::TEXTURE_SPECULAR,texture);
+ material->set_specular(Color(1,1,1,1));
- material->set_texture(FixedMaterial::PARAM_SPECULAR,texture);
- material->set_parameter(FixedMaterial::PARAM_SPECULAR,Color(1,1,1,1));
+// material->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,texture);
+// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,Color(1,1,1,1));
} else {
missing_textures.push_back(texfile.get_file());
}
}
} else {
- material->set_parameter(FixedMaterial::PARAM_SPECULAR,effect.specular.color);
+// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,effect.specular.color);
}
// EMISSION
@@ -435,15 +438,17 @@ Error ColladaImport::_create_material(const String& p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile,"Texture");
if (texture.is_valid()) {
- material->set_texture(FixedMaterial::PARAM_EMISSION,texture);
- material->set_parameter(FixedMaterial::PARAM_EMISSION,Color(1,1,1,1));
+ material->set_texture(FixedSpatialMaterial::TEXTURE_EMISSION,texture);
+ material->set_emission(Color(1,1,1,1));
+
+// material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,Color(1,1,1,1));
}else {
- missing_textures.push_back(texfile.get_file());
+// missing_textures.push_back(texfile.get_file());
}
}
} else {
- material->set_parameter(FixedMaterial::PARAM_EMISSION,effect.emission.color);
+// material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,effect.emission.color);
}
// NORMAL
@@ -455,19 +460,23 @@ Error ColladaImport::_create_material(const String& p_target) {
Ref<Texture> texture = ResourceLoader::load(texfile,"Texture");
if (texture.is_valid()) {
+ material->set_texture(FixedSpatialMaterial::TEXTURE_NORMAL,texture);
+// material->set_emission(Color(1,1,1,1));
- material->set_texture(FixedMaterial::PARAM_NORMAL,texture);
+ // material->set_texture(FixedSpatialMaterial::PARAM_NORMAL,texture);
}else {
- missing_textures.push_back(texfile.get_file());
+// missing_textures.push_back(texfile.get_file());
}
}
}
- material->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess);
- material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided);
- material->set_flag(Material::FLAG_UNSHADED,effect.unshaded);
+// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,effect.shininess);
+ if (effect.double_sided) {
+ material->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED);
+ }
+ material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,effect.unshaded);
@@ -597,7 +606,7 @@ static void _generate_tangents_and_binormals(const DVector<int>& p_indices,const
}
}
-Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data,Vector<Ref<Mesh> > p_morph_meshes) {
+Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data,Vector<Ref<Mesh> > p_morph_meshes,bool p_for_morph) {
bool local_xform_mirror=p_local_xform.basis.determinant() < 0;
@@ -1042,7 +1051,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con
{
- Ref<FixedMaterial> material;
+ Ref<FixedSpatialMaterial> material;
//find material
Mesh::PrimitiveType primitive=Mesh::PRIMITIVE_TRIANGLES;
@@ -1072,7 +1081,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con
DVector<Color> final_color_array;
DVector<Vector3> final_uv_array;
DVector<Vector3> final_uv2_array;
- DVector<float> final_bone_array;
+ DVector<int> final_bone_array;
DVector<float> final_weight_array;
uint32_t final_format=0;
@@ -1196,7 +1205,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con
tarrayw = DVector<real_t>::Write();
final_tangent_array=tarray;
- } else if (final_normal_array.size() && primitive==Mesh::PRIMITIVE_TRIANGLES && final_uv_array.size() && (force_make_tangents || (material.is_valid() && material->get_texture(FixedMaterial::PARAM_NORMAL).is_valid()))){
+ } else if (final_normal_array.size() && primitive==Mesh::PRIMITIVE_TRIANGLES && final_uv_array.size() && (force_make_tangents || (material.is_valid()))){
//if this uses triangles, there are uvs and the material is using a normalmap, generate tangents and binormals, because they WILL be needed
//generate binormals/tangents
_generate_tangents_and_binormals(index_array,final_vertex_array,final_uv_array,final_normal_array,final_tangent_array);
@@ -1223,12 +1232,12 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con
if (has_weights) {
DVector<float> weightarray;
- DVector<float> bonearray;
+ DVector<int> bonearray;
weightarray.resize(vertex_array.size()*4);
DVector<float>::Write weightarrayw = weightarray.write();
bonearray.resize(vertex_array.size()*4);
- DVector<float>::Write bonearrayw = bonearray.write();
+ DVector<int>::Write bonearrayw = bonearray.write();
for(int k=0;k<vlen;k++) {
float sum=0;
@@ -1237,7 +1246,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con
if (l<vertex_array[k].weights.size()) {
weightarrayw[k*VS::ARRAY_WEIGHTS_SIZE+l]=vertex_array[k].weights[l].weight;
sum+=weightarrayw[k*VS::ARRAY_WEIGHTS_SIZE+l];
- bonearrayw[k*VS::ARRAY_WEIGHTS_SIZE+l]=vertex_array[k].weights[l].bone_idx;
+ bonearrayw[k*VS::ARRAY_WEIGHTS_SIZE+l]=int(vertex_array[k].weights[l].bone_idx);
//COLLADA_PRINT(itos(k)+": "+rtos(bonearrayw[k*VS::ARRAY_WEIGHTS_SIZE+l])+":"+rtos(weightarray[k*VS::ARRAY_WEIGHTS_SIZE+l]));
} else {
@@ -1254,7 +1263,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con
}
weightarrayw = DVector<float>::Write();
- bonearrayw = DVector<float>::Write();
+ bonearrayw = DVector<int>::Write();
final_weight_array = weightarray;
final_bone_array = bonearray;
@@ -1461,14 +1470,20 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con
// print_line("want surface "+itos(mi)+" has "+itos(p_morph_meshes[mi]->get_surface_count()));
Array a = p_morph_meshes[mi]->surface_get_arrays(surface);
- a[Mesh::ARRAY_BONES]=Variant();
- a[Mesh::ARRAY_WEIGHTS]=Variant();
+ //add valid weight and bone arrays if they exist, TODO check if they are unique to shape (generally not)
+
+ if (final_weight_array.size())
+ a[Mesh::ARRAY_WEIGHTS]=final_weight_array;
+ if (final_bone_array.size())
+ a[Mesh::ARRAY_BONES]=final_bone_array;
+
a[Mesh::ARRAY_INDEX]=Variant();
//a.resize(Mesh::ARRAY_MAX); //no need for index
mr.push_back(a);
}
- p_mesh->add_surface(Mesh::PRIMITIVE_TRIANGLES,d,mr);
+
+ p_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,d,mr,p_for_morph?0:Mesh::ARRAY_COMPRESS_DEFAULT);
if (material.is_valid()) {
p_mesh->surface_set_material(surface, material);
@@ -1692,7 +1707,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) {
if (collada.state.mesh_data_map.has(meshid)) {
Ref<Mesh> mesh=Ref<Mesh>(memnew( Mesh ));
const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid];
- Error err = _create_mesh_surfaces(false,mesh,ng->material_map,meshdata,apply_xform,bone_remap,skin,NULL);
+ Error err = _create_mesh_surfaces(false,mesh,ng->material_map,meshdata,apply_xform,bone_remap,skin,NULL,Vector<Ref<Mesh> >(),true);
ERR_FAIL_COND_V(err,err);
morphs.push_back(mesh);
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
index fa46128a7b..de75bd41a2 100644
--- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -1407,7 +1407,7 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map<Ref<Imag
for(List<PropertyInfo>::Element *E=pl.front();E;E=E->next()) {
if (E->get().type==Variant::OBJECT || E->get().type==Variant::ARRAY || E->get().type==Variant::DICTIONARY) {
- if (E->get().type==Variant::OBJECT && res->cast_to<FixedMaterial>() && (E->get().name=="textures/diffuse" || E->get().name=="textures/detail" || E->get().name=="textures/emission")) {
+ if (E->get().type==Variant::OBJECT && res->cast_to<FixedSpatialMaterial>() && (E->get().name=="textures/diffuse" || E->get().name=="textures/detail" || E->get().name=="textures/emission")) {
Ref<ImageTexture> tex =res->get(E->get().name);
if (tex.is_valid()) {
@@ -1415,15 +1415,15 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map<Ref<Imag
image_map.insert(tex,TEXTURE_ROLE_DIFFUSE);
}
- } else if (E->get().type==Variant::OBJECT && res->cast_to<FixedMaterial>() && (E->get().name=="textures/normal")) {
+ } else if (E->get().type==Variant::OBJECT && res->cast_to<FixedSpatialMaterial>() && (E->get().name=="textures/normal")) {
Ref<ImageTexture> tex =res->get(E->get().name);
if (tex.is_valid()) {
image_map.insert(tex,TEXTURE_ROLE_NORMALMAP);
- if (p_flags&SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY)
- res->cast_to<FixedMaterial>()->set_fixed_flag(FixedMaterial::FLAG_USE_XY_NORMALMAP,true);
- }
+ //if (p_flags&SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY)
+ // res->cast_to<FixedSpatialMaterial>()->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_XY_NORMALMAP,true);
+ }//
} else {
@@ -1529,12 +1529,12 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
Ref<Mesh> m = mi->get_mesh();
for(int i=0;i<m->get_surface_count();i++) {
- Ref<FixedMaterial> fm = m->surface_get_material(i);
+ Ref<FixedSpatialMaterial> fm = m->surface_get_material(i);
if (fm.is_valid()) {
- fm->set_flag(Material::FLAG_UNSHADED,true);
- fm->set_flag(Material::FLAG_DOUBLE_SIDED,true);
- fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER);
- fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
+ // fm->set_flag(Material::FLAG_UNSHADED,true);
+ // fm->set_flag(Material::FLAG_DOUBLE_SIDED,true);
+ // fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER);
+ // fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
}
}
}
@@ -1552,23 +1552,23 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
for(int i=0;i<m->get_surface_count();i++) {
- Ref<FixedMaterial> mat = m->surface_get_material(i);
+ Ref<FixedSpatialMaterial> mat = m->surface_get_material(i);
if (!mat.is_valid())
continue;
if (p_flags&SCENE_FLAG_DETECT_ALPHA && _teststr(mat->get_name(),"alpha")) {
- mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
- mat->set_name(_fixstr(mat->get_name(),"alpha"));
+ // mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
+ // mat->set_name(_fixstr(mat->get_name(),"alpha"));
}
if (p_flags&SCENE_FLAG_DETECT_VCOLOR && _teststr(mat->get_name(),"vcol")) {
- mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true);
- mat->set_name(_fixstr(mat->get_name(),"vcol"));
+ //mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true);
+ //mat->set_name(_fixstr(mat->get_name(),"vcol"));
}
if (p_flags&SCENE_FLAG_SET_LIGHTMAP_TO_UV2_IF_EXISTS && m->surface_get_format(i)&Mesh::ARRAY_FORMAT_TEX_UV2) {
- mat->set_flag(Material::FLAG_LIGHTMAP_ON_UV2,true);
+ //mat->set_flag(Material::FLAG_LIGHTMAP_ON_UV2,true);
}
}
@@ -1627,23 +1627,23 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
float dist = d.to_double();
mi->set_flag(GeometryInstance::FLAG_BILLBOARD,true);
mi->set_flag(GeometryInstance::FLAG_BILLBOARD_FIX_Y,true);
- mi->set_draw_range_begin(dist);
- mi->set_draw_range_end(100000);
+ //mi->set_draw_range_begin(dist);
+ //mi->set_draw_range_end(100000);
- mip->set_draw_range_begin(0);
- mip->set_draw_range_end(dist);
+ //mip->set_draw_range_begin(0);
+ //mip->set_draw_range_end(dist);
if (mi->get_mesh().is_valid()) {
Ref<Mesh> m = mi->get_mesh();
for(int i=0;i<m->get_surface_count();i++) {
- Ref<FixedMaterial> fm = m->surface_get_material(i);
+ Ref<FixedSpatialMaterial> fm = m->surface_get_material(i);
if (fm.is_valid()) {
- fm->set_flag(Material::FLAG_UNSHADED,true);
- fm->set_flag(Material::FLAG_DOUBLE_SIDED,true);
- fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER);
- fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
+ // fm->set_flag(Material::FLAG_UNSHADED,true);
+ // fm->set_flag(Material::FLAG_DOUBLE_SIDED,true);
+ // fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER);
+ // fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
}
}
}
@@ -1675,23 +1675,23 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
d=d.substr(1,d.length());
if (d.length() && d[0]>='0' && d[0]<='9') {
float dist = d.to_double();
- mi->set_draw_range_begin(dist);
- mi->set_draw_range_end(100000);
+ /// mi->set_draw_range_begin(dist);
+ // mi->set_draw_range_end(100000);
- mip->set_draw_range_begin(0);
- mip->set_draw_range_end(dist);
+ // mip->set_draw_range_begin(0);
+ // mip->set_draw_range_end(dist);
/*if (mi->get_mesh().is_valid()) {
Ref<Mesh> m = mi->get_mesh();
for(int i=0;i<m->get_surface_count();i++) {
- Ref<FixedMaterial> fm = m->surface_get_material(i);
+ Ref<FixedSpatialMaterial> fm = m->surface_get_material(i);
if (fm.is_valid()) {
fm->set_flag(Material::FLAG_UNSHADED,true);
fm->set_flag(Material::FLAG_DOUBLE_SIDED,true);
fm->set_hint(Material::HINT_NO_DEPTH_DRAW,true);
- fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
+ fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
}
}
}*/
@@ -1707,7 +1707,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
String str=name;
int layer = str.substr(str.find("lm")+3,str.length()).to_int();
- mi->set_baked_light_texture_id(layer);
+ //mi->set_baked_light_texture_id(layer);
}
if (p_flags&SCENE_FLAG_CREATE_COLLISIONS && _teststr(name,"colonly")) {
@@ -1903,8 +1903,8 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
BSP_Tree bsptree(faces);
Ref<RoomBounds> area = memnew( RoomBounds );
- area->set_bounds(faces);
- area->set_geometry_hint(faces);
+ //area->set_bounds(faces);
+ //area->set_geometry_hint(faces);
Room * room = memnew( Room );
@@ -1932,7 +1932,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
memdelete(p_node);
p_node=room;
- room->compute_room_from_subtree();
+ //room->compute_room_from_subtree();
} else if (p_flags&SCENE_FLAG_CREATE_PORTALS &&_teststr(name,"portal") && p_node->cast_to<MeshInstance>()) {
@@ -2059,18 +2059,18 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
for(int i=0;i<mesh->get_surface_count();i++) {
- Ref<FixedMaterial> fm = mesh->surface_get_material(i);
+ Ref<FixedSpatialMaterial> fm = mesh->surface_get_material(i);
if (fm.is_valid()) {
String name = fm->get_name();
- if (_teststr(name,"alpha")) {
- fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
+ /* if (_teststr(name,"alpha")) {
+ fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
name=_fixstr(name,"alpha");
}
if (_teststr(name,"vcol")) {
- fm->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true);
+ fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true);
name=_fixstr(name,"vcol");
- }
+ }*/
fm->set_name(name);
}
}
diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp
index 0e4f10df0f..1cb16843c5 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("/","_");
@@ -482,29 +482,29 @@ void EditorSceneImporterFBXConv::_parse_materials(State& state) {
ERR_CONTINUE(!material.has("id"));
String id = _id(material["id"]);
- Ref<FixedMaterial> mat = memnew( FixedMaterial );
+ Ref<FixedSpatialMaterial> mat = memnew( FixedSpatialMaterial );
if (material.has("diffuse")) {
- mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,_get_color(material["diffuse"]));
+ mat->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,_get_color(material["diffuse"]));
}
if (material.has("specular")) {
- mat->set_parameter(FixedMaterial::PARAM_SPECULAR,_get_color(material["specular"]));
+ mat->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,_get_color(material["specular"]));
}
if (material.has("emissive")) {
- mat->set_parameter(FixedMaterial::PARAM_EMISSION,_get_color(material["emissive"]));
+ mat->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,_get_color(material["emissive"]));
}
if (material.has("shininess")) {
float exp = material["shininess"];
- mat->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,exp);
+ mat->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,exp);
}
if (material.has("opacity")) {
- Color c = mat->get_parameter(FixedMaterial::PARAM_DIFFUSE);
+ Color c = mat->get_parameter(FixedSpatialMaterial::PARAM_DIFFUSE);
c.a=material["opacity"];
- mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,c);
+ mat->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,c);
}
@@ -536,15 +536,15 @@ void EditorSceneImporterFBXConv::_parse_materials(State& state) {
String type=texture["type"];
if (type=="DIFFUSE")
- mat->set_texture(FixedMaterial::PARAM_DIFFUSE,tex);
+ mat->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,tex);
else if (type=="SPECULAR")
- mat->set_texture(FixedMaterial::PARAM_SPECULAR,tex);
+ mat->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,tex);
else if (type=="SHININESS")
- mat->set_texture(FixedMaterial::PARAM_SPECULAR_EXP,tex);
+ mat->set_texture(FixedSpatialMaterial::PARAM_SPECULAR_EXP,tex);
else if (type=="NORMAL")
- mat->set_texture(FixedMaterial::PARAM_NORMAL,tex);
+ mat->set_texture(FixedSpatialMaterial::PARAM_NORMAL,tex);
else if (type=="EMISSIVE")
- mat->set_texture(FixedMaterial::PARAM_EMISSION,tex);
+ mat->set_texture(FixedSpatialMaterial::PARAM_EMISSION,tex);
}
}
@@ -1132,3 +1132,4 @@ EditorSceneImporterFBXConv::EditorSceneImporterFBXConv() {
#endif
}
+#endif
diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.h b/tools/editor/io_plugins/editor_scene_importer_fbxconv.h
index 488616a1ad..e3ed1dcafe 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 b862edc8ce..39ac5ecb16 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<ImageTexture> &textur
ERR_FAIL_COND_V(image.empty(),ERR_INVALID_DATA);
bool has_alpha=image.detect_alpha();
- if (!has_alpha && image.get_format()==Image::FORMAT_RGBA) {
+ if (!has_alpha && image.get_format()==Image::FORMAT_RGBA8) {
- image.convert(Image::FORMAT_RGB);
+ image.convert(Image::FORMAT_RGB8);
}
- if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) {
+ if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) {
image.fix_alpha_edges();
}
- if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_PREMULT_ALPHA) {
+ if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_PREMULT_ALPHA) {
image.premultiply_alpha();
}
@@ -950,7 +944,7 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref<ImageTexture> &textur
image.normalmap_to_xy();
}
- //if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) {
+ //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) {
// image.srgb_to_linear();
//}
@@ -989,18 +983,18 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref<ImageTexture> &textur
bool has_alpha=image.detect_alpha();
- if (!has_alpha && image.get_format()==Image::FORMAT_RGBA) {
+ if (!has_alpha && image.get_format()==Image::FORMAT_RGBA8) {
- image.convert(Image::FORMAT_RGB);
+ image.convert(Image::FORMAT_RGB8);
}
- if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) {
+ if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) {
image.fix_alpha_edges();
}
- if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_PREMULT_ALPHA) {
+ if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_PREMULT_ALPHA) {
image.premultiply_alpha();
}
@@ -1009,7 +1003,7 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref<ImageTexture> &textur
image.normalmap_to_xy();
}
- //if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) {
+ //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) {
//
// print_line("CONVERT BECAUSE: "+itos(flags));
// image.srgb_to_linear();
@@ -1200,9 +1194,9 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
Image src = tsources[i];
if (alpha) {
- src.convert(Image::FORMAT_RGBA);
+ src.convert(Image::FORMAT_RGBA8);
} else {
- src.convert(Image::FORMAT_RGB);
+ src.convert(Image::FORMAT_RGB8);
}
DVector<uint8_t> data = src.get_data();
@@ -1280,7 +1274,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
atlas_h=nearest_power_of_2(dst_size.height);
}
Image atlas;
- atlas.create(atlas_w,atlas_h,0,alpha?Image::FORMAT_RGBA:Image::FORMAT_RGB);
+ atlas.create(atlas_w,atlas_h,0,alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8);
atlases.resize(from->get_source_count());
@@ -1411,18 +1405,18 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
ERR_FAIL_COND_V(image.empty(),ERR_INVALID_DATA);
bool has_alpha=image.detect_alpha();
- if (!has_alpha && image.get_format()==Image::FORMAT_RGBA) {
+ if (!has_alpha && image.get_format()==Image::FORMAT_RGBA8) {
- image.convert(Image::FORMAT_RGB);
+ image.convert(Image::FORMAT_RGB8);
}
- if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) {
+ if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) {
image.fix_alpha_edges();
}
- if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_PREMULT_ALPHA) {
+ if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_PREMULT_ALPHA) {
image.premultiply_alpha();
}
@@ -1431,7 +1425,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
image.normalmap_to_xy();
}
- //if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) {
+ //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) {
// image.srgb_to_linear();
//}
@@ -1470,18 +1464,18 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
bool has_alpha=image.detect_alpha();
- if (!has_alpha && image.get_format()==Image::FORMAT_RGBA) {
+ if (!has_alpha && image.get_format()==Image::FORMAT_RGBA8) {
- image.convert(Image::FORMAT_RGB);
+ image.convert(Image::FORMAT_RGB8);
}
- if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) {
+ if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) {
image.fix_alpha_edges();
}
- if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_PREMULT_ALPHA) {
+ if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_PREMULT_ALPHA) {
image.premultiply_alpha();
}
@@ -1490,7 +1484,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
image.normalmap_to_xy();
}
- //if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) {
+ //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) {
//
// print_line("CONVERT BECAUSE: "+itos(flags));
// image.srgb_to_linear();