Add Open Asset Import Library to Godot.

FBX support and MMD (pmx) support.

Normals, Albedo, Metallic, and Roughness through Arnold 5 Materials for Maya FBX.

Maya FBX Stingray PBS support.

Importing FBX static meshes work.

Importing FBX animations is a work in progress.

Supports FBX 4 bone influence animations.

Supports FBX blend shapes.

MMDs do not have an associated animation import yet.

Sponsored by IMVU Inc.
This commit is contained in:
K. S. Ernest (iFire) Lee 2019-04-03 10:24:00 -07:00
parent 793b0de197
commit e3ef7f214a
10 changed files with 2873 additions and 2 deletions

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorSceneImporterAssimp" inherits="EditorSceneImporter" category="Core" version="3.2">
<brief_description>
This is a multi-format 3d asset importer.
</brief_description>
<description>
This is a multi-format 3d asset importer.
Use these FBX export settings from Autodesk Maya.
[codeblock]
* Smoothing Groups
* Smooth Mesh
* Triangluate (For mesh with blendshapes)
* Bake Animation
* Resample All
* Deformed Models
* Skins
* Blend Shapes
* Curve Filters
* Constant Key Reducer
* Auto Tangents Only
* DO NOT CHECK Constraints (Will Break File)
* Can check Embed Media (Embeds textures into FBX file to import)
-- Note: When importing embed media, texture and mesh will be a un-alterable file.
-- Reimport of fbx with updated texture is need if texture is updated.
* Units: Centimeters
* Up Axis: Y
* Binary format in FBX 2017
[/codeblock]
</description>
<tutorials>
</tutorials>
<demos>
</demos>
<methods>
</methods>
<constants>
</constants>
</class>

View File

@ -4131,7 +4131,7 @@ void RasterizerStorageGLES3::mesh_render_blend_shapes(Surface *s, const float *p
for (int ti = 0; ti < mtc; ti++) {
float weight = p_weights[ti];
if (weight < 0.001) //not bother with this one
if (weight < 0.00001) //not bother with this one
continue;
glBindVertexArray(s->blend_shapes[ti].array_id);

95
modules/assimp/SCsub Normal file
View File

@ -0,0 +1,95 @@
#!/usr/bin/env python
Import('env')
Import('env_modules')
env_assimp = env_modules.Clone()
env_assimp.Append(CPPPATH=['#thirdparty/assimp'])
env_assimp.Append(CPPPATH=['#thirdparty/assimp/include'])
env_assimp.Append(CPPPATH=['#thirdparty/assimp/code/Importer/IFC'])
env_assimp.Append(CPPPATH=['#thirdparty/misc'])
env_assimp.Append(CPPPATH=['#thirdparty/assimp/code'])
env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/irrXML/'])
env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/unzip/'])
env_assimp.Append(CPPPATH=['#thirdparty/assimp/code/Importer/STEPParser'])
env_assimp.Append(CPPPATH=['#thirdparty/assimp/'])
env_assimp.Append(CPPPATH=['#thirdparty/zlib/'])
env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/openddlparser/include'])
env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/rapidjson/include'])
env_assimp.Append(CPPPATH=['.'])
#env_assimp.Append(CPPFLAGS=['-DASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_BOOST_WORKAROUND'])
env_assimp.Append(CPPFLAGS=['-DOPENDDLPARSER_BUILD'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_OWN_ZLIB'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_EXPORT'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_X_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_AMF_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_3DS_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_MD3_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_MD5_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_MDL_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_MD2_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_PLY_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_ASE_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_OBJ_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_HMP_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_SMD_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_MDC_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_MD5_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_STL_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_LWO_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_DXF_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_NFF_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_RAW_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_SIB_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_OFF_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_AC_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_BVH_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_IRRMESH_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_IRR_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_Q3D_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_B3D_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_COLLADA_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_TERRAGEN_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_CSM_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_3D_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_LWS_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_OGRE_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_OPENGEX_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_MS3D_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_COB_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_BLEND_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_Q3BSP_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_NDO_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_STEP_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_IFC_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_XGL_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_ASSBIN_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_GLTF_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_C4D_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_3MF_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_NO_X3D_IMPORTER'])
env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_SINGLETHREADED'])
if (not env.msvc):
env_assimp.Append(CXXFLAGS=['-std=c++11'])
elif (env.msvc == False and env['platform'] == 'windows'):
env_assimp.Append(LDFLAGS=['-pthread'])
if(env['platform'] == 'windows'):
env_assimp.Append(CPPFLAGS=['-DPLATFORM_WINDOWS'])
env_assimp.Append(CPPFLAGS=['-DPLATFORM=WINDOWS'])
elif(env['platform'] == 'x11'):
env_assimp.Append(CPPFLAGS=['-DPLATFORM_LINUX'])
env_assimp.Append(CPPFLAGS=['-DPLATFORM=LINUX'])
elif(env['platform'] == 'osx'):
env_assimp.Append(CPPFLAGS=['-DPLATFORM_DARWIN'])
env_assimp.Append(CPPFLAGS=['-DPLATFORM=DARWIN'])
env_thirdparty = env_assimp.Clone()
env_thirdparty.disable_warnings()
env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/*.cpp'))
# Godot's own source files
env_assimp.add_source_files(env.modules_sources, "*.cpp")

5
modules/assimp/config.py Normal file
View File

@ -0,0 +1,5 @@
def can_build(env, platform):
return env['tools']
def configure(env):
pass

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,206 @@
/*************************************************************************/
/* editor_scene_importer_assimp.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef EDITOR_SCENE_IMPORTER_ASSIMP_H
#define EDITOR_SCENE_IMPORTER_ASSIMP_H
#ifdef TOOLS_ENABLED
#include "core/bind/core_bind.h"
#include "core/io/resource_importer.h"
#include "core/vector.h"
#include "editor/import/resource_importer_scene.h"
#include "editor/project_settings_editor.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/skeleton.h"
#include "scene/3d/spatial.h"
#include "scene/animation/animation_player.h"
#include "scene/resources/animation.h"
#include "scene/resources/surface_tool.h"
#include "assimp/DefaultLogger.hpp"
#include "assimp/LogStream.hpp"
#include "assimp/Logger.hpp"
#include "assimp/matrix4x4.h"
#include "assimp/scene.h"
#include "assimp/types.h"
class AssimpStream : public Assimp::LogStream {
public:
// Constructor
AssimpStream();
// Destructor
~AssimpStream();
// Write something using your own functionality
void write(const char *message);
};
#define AI_MATKEY_FBX_MAYA_BASE_COLOR_FACTOR "$raw.Maya|baseColor", 0, 0
#define AI_MATKEY_FBX_MAYA_METALNESS_FACTOR "$raw.Maya|metalness", 0, 0
#define AI_MATKEY_FBX_MAYA_DIFFUSE_ROUGHNESS_FACTOR "$raw.Maya|diffuseRoughness", 0, 0
#define AI_MATKEY_FBX_MAYA_METALNESS_TEXTURE "$raw.Maya|metalness|file", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_METALNESS_UV_XFORM "$raw.Maya|metalness|uvtrafo", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_DIFFUSE_ROUGHNESS_TEXTURE "$raw.Maya|diffuseRoughness|file", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_DIFFUSE_ROUGHNESS_UV_XFORM "$raw.Maya|diffuseRoughness|uvtrafo", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_BASE_COLOR_TEXTURE "$raw.Maya|baseColor|file", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_BASE_COLOR_UV_XFORM "$raw.Maya|baseColor|uvtrafo", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_NORMAL_TEXTURE "$raw.Maya|normalCamera|file", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_NORMAL_UV_XFORM "$raw.Maya|normalCamera|uvtrafo", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_NORMAL_TEXTURE "$raw.Maya|normalCamera|file", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_NORMAL_UV_XFORM "$raw.Maya|normalCamera|uvtrafo", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_DISPLACEMENT_SCALING_FACTOR "$raw.Maya|displacementscaling", 0, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_BASE_COLOR_FACTOR "$raw.Maya|base_color", 0, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_EMISSIVE_FACTOR "$raw.Maya|emissive", 0, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_METALLIC_FACTOR "$raw.Maya|metallic", 0, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_ROUGHNESS_FACTOR "$raw.Maya|roughness", 0, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_EMISSIVE_INTENSITY_FACTOR "$raw.Maya|emissive_intensity", 0, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_NORMAL_TEXTURE "$raw.Maya|TEX_normal_map|file", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_NORMAL_UV_XFORM "$raw.Maya|TEX_normal_map|uvtrafo", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_COLOR_TEXTURE "$raw.Maya|TEX_color_map|file", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_COLOR_UV_XFORM "$raw.Maya|TEX_color_map|uvtrafo", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_METALLIC_TEXTURE "$raw.Maya|TEX_metallic_map|file", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_METALLIC_UV_XFORM "$raw.Maya|TEX_metallic_map|uvtrafo", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_ROUGHNESS_TEXTURE "$raw.Maya|TEX_roughness_map|file", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_ROUGHNESS_UV_XFORM "$raw.Maya|TEX_roughness_map|uvtrafo", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_EMISSIVE_TEXTURE "$raw.Maya|TEX_emissive_map|file", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_EMISSIVE_UV_XFORM "$raw.Maya|TEX_emissive_map|uvtrafo", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_AO_TEXTURE "$raw.Maya|TEX_ao_map|file", aiTextureType_UNKNOWN, 0
#define AI_MATKEY_FBX_MAYA_STINGRAY_AO_UV_XFORM "$raw.Maya|TEX_ao_map|uvtrafo", aiTextureType_UNKNOWN, 0
class EditorSceneImporterAssimp : public EditorSceneImporter {
private:
GDCLASS(EditorSceneImporterAssimp, EditorSceneImporter);
const String ASSIMP_FBX_KEY = "_$AssimpFbx$";
struct AssetImportAnimation {
enum Interpolation {
INTERP_LINEAR,
INTERP_STEP,
INTERP_CATMULLROMSPLINE,
INTERP_CUBIC_SPLINE
};
};
struct AssetImportFbx {
enum ETimeMode {
TIME_MODE_DEFAULT = 0,
TIME_MODE_120 = 1,
TIME_MODE_100 = 2,
TIME_MODE_60 = 3,
TIME_MODE_50 = 4,
TIME_MODE_48 = 5,
TIME_MODE_30 = 6,
TIME_MODE_30_DROP = 7,
TIME_MODE_NTSC_DROP_FRAME = 8,
TIME_MODE_NTSC_FULL_FRAME = 9,
TIME_MODE_PAL = 10,
TIME_MODE_CINEMA = 11,
TIME_MODE_1000 = 12,
TIME_MODE_CINEMA_ND = 13,
TIME_MODE_CUSTOM = 14,
TIME_MODE_TIME_MODE_COUNT = 15
};
enum UpAxis {
UP_VECTOR_AXIS_X = 1,
UP_VECTOR_AXIS_Y = 2,
UP_VECTOR_AXIS_Z = 3
};
enum FrontAxis {
FRONT_PARITY_EVEN = 1,
FRONT_PARITY_ODD = 2,
};
enum CoordAxis {
COORD_RIGHT = 0,
COORD_LEFT = 1
};
};
Spatial *_generate_scene(const String &p_path, const aiScene *scene, const uint32_t p_flags, int p_bake_fps, const int32_t p_max_bone_weights);
void _fill_kept_node(Set<Node *> &keep_nodes);
String _find_skeleton_bone_root(Map<Skeleton *, MeshInstance *> &skeletons, Map<MeshInstance *, String> &meshes, Spatial *root);
void _set_bone_parent(Skeleton *s, Node *p_owner, aiNode *p_node);
Transform _get_global_ai_node_transform(const aiScene *p_scene, const aiNode *p_current_node);
void _generate_node_bone(const aiScene *p_scene, const aiNode *p_node, Map<String, bool> &p_mesh_bones, Skeleton *p_skeleton, const String p_path, const int32_t p_max_bone_weights);
void _generate_node_bone_parents(const aiScene *p_scene, const aiNode *p_node, Map<String, bool> &p_mesh_bones, Skeleton *p_skeleton, const MeshInstance *p_mi);
void _calculate_skeleton_root(Skeleton *s, const aiScene *p_scene, aiNode *&p_ai_skeleton_root, Map<String, bool> &mesh_bones, const aiNode *p_node);
void _fill_skeleton(const aiScene *p_scene, const aiNode *p_node, Spatial *p_current, Node *p_owner, Skeleton *p_skeleton, const Map<String, bool> p_mesh_bones, const Map<String, Transform> &p_bone_rests, Set<String> p_tracks, const String p_path, Set<String> &r_removed_bones);
void _keep_node(const String &p_path, Node *p_current, Node *p_owner, Set<Node *> &r_keep_nodes);
void _filter_node(const String &p_path, Node *p_current, Node *p_owner, const Set<Node *> p_keep_nodes, Set<String> &r_removed_nodes);
void _generate_node(const String &p_path, const aiScene *p_scene, const aiNode *p_node, Node *p_parent, Node *p_owner, Set<String> &r_bone_name, Set<String> p_light_names, Set<String> p_camera_names, Map<Skeleton *, MeshInstance *> &r_skeletons, const Map<String, Transform> &p_bone_rests, Vector<MeshInstance *> &r_mesh_instances, int32_t &r_mesh_count, Skeleton *p_skeleton, const int32_t p_max_bone_weights, Set<String> &r_removed_bones, Map<String, Map<uint32_t, String> > &r_name_morph_mesh_names);
aiNode *_ai_find_node(aiNode *ai_child_node, const String bone_name);
Transform _format_rot_xform(const String p_path, const aiScene *p_scene);
void _get_track_set(const aiScene *p_scene, Set<String> &tracks);
void _insert_animation_track(const aiScene *p_scene, const String p_path, int p_bake_fps, Ref<Animation> animation, float ticks_per_second, float length, const Skeleton *sk, const aiNodeAnim *track, String node_name, NodePath node_path);
void _add_mesh_to_mesh_instance(const aiNode *p_node, const aiScene *p_scene, Skeleton *s, const String &p_path, MeshInstance *p_mesh_instance, Node *p_owner, Set<String> &r_bone_name, int32_t &r_mesh_count, int32_t p_max_bone_weights, Map<String, Map<uint32_t, String> > &r_name_morph_mesh_names);
Ref<Texture> _load_texture(const aiScene *p_scene, String p_path);
void _calc_tangent_from_mesh(const aiMesh *ai_mesh, int i, int tri_index, int index, PoolColorArray::Write &w);
void _set_texture_mapping_mode(aiTextureMapMode *map_mode, Ref<Texture> texture);
void _find_texture_path(const String &p_path, String &path, bool &r_found);
void _find_texture_path(const String &p_path, _Directory &dir, String &path, bool &found, String extension);
String _ai_string_to_string(const aiString p_string) const;
String _ai_anim_string_to_string(const aiString p_string) const;
String _ai_raw_string_to_string(const aiString p_string) const;
void _import_animation(const String p_path, const Vector<MeshInstance *> p_meshes, const aiScene *p_scene, AnimationPlayer *ap, int32_t p_index, int p_bake_fps, Map<Skeleton *, MeshInstance *> p_skeletons, const Set<String> p_removed_nodes, const Set<String> removed_bones, const Map<String, Map<uint32_t, String> > p_path_morph_mesh_names);
void _insert_pivot_anim_track(const Vector<MeshInstance *> p_meshes, const String p_node_name, Vector<const aiNodeAnim *> F, AnimationPlayer *ap, Skeleton *sk, float &length, float ticks_per_second, Ref<Animation> animation, int p_bake_fps, const String &p_path, const aiScene *p_scene);
float _get_fbx_fps(int32_t time_mode, const aiScene *p_scene);
template <class T>
T _interpolate_track(const Vector<float> &p_times, const Vector<T> &p_values, float p_time, AssetImportAnimation::Interpolation p_interp);
const Transform _ai_matrix_transform(const aiMatrix4x4 p_matrix);
void _register_project_setting_import(const String generic, const String import_setting_string, const Vector<String> &exts, List<String> *r_extensions, const bool p_enabled) const;
struct ImportFormat {
Vector<String> extensions;
bool is_default;
};
protected:
static void _bind_methods();
public:
EditorSceneImporterAssimp() {
Assimp::DefaultLogger::create("", Assimp::Logger::VERBOSE);
unsigned int severity = Assimp::Logger::Info | Assimp::Logger::Err | Assimp::Logger::Warn;
Assimp::DefaultLogger::get()->attachStream(new AssimpStream(), severity);
}
~EditorSceneImporterAssimp() {
Assimp::DefaultLogger::kill();
}
virtual void get_extensions(List<String> *r_extensions) const;
virtual uint32_t get_import_flags() const;
virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL);
virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps);
};
#endif
#endif

View File

@ -0,0 +1,261 @@
rm -rf ../../thirdparty/assimp
cd ../../thirdparty/
git clone https://github.com/assimp/assimp.git
cd assimp
rm -rf code/3DSExporter.h
rm -rf code/3DSLoader.h
rm -rf code/3MFXmlTags.h
rm -rf code/ABCImporter.h
rm -rf code/ACLoader.h
rm -rf code/AMFImporter_Macro.hpp
rm -rf code/ASELoader.h
rm -rf code/assbin_chunks.h
rm -rf code/AssbinExporter.h
rm -rf code/AssbinLoader.h
rm -rf code/AssimpCExport.cpp
rm -rf code/AssxmlExporter.h
rm -rf code/B3DImporter.h
# rm -rf code/BaseProcess.cpp
# rm -rf code/BaseProcess.h
# rm -rf code/Bitmap.cpp
rm -rf code/BlenderBMesh.cpp
rm -rf code/BlenderBMesh.h
rm -rf code/BlenderCustomData.cpp
rm -rf code/BlenderCustomData.h
rm -rf code/BlenderIntermediate.h
rm -rf code/BlenderLoader.h
rm -rf code/BlenderModifier.h
rm -rf code/BlenderSceneGen.h
rm -rf code/BlenderTessellator.h
rm -rf code/BVHLoader.h
rm -rf code/C4DImporter.h
# rm -rf code/CalcTangentsProcess.h
# rm -rf code/CInterfaceIOWrapper.cpp
# rm -rf code/CInterfaceIOWrapper.h
rm -rf code/COBLoader.h
rm -rf code/COBScene.h
rm -rf code/ColladaExporter.h
rm -rf code/ColladaLoader.h
# rm -rf code/ComputeUVMappingProcess.h
# rm -rf code/ConvertToLHProcess.h
# rm -rf code/CreateAnimMesh.cpp
rm -rf code/CSMLoader.h
rm -rf code/D3MFExporter.h
rm -rf code/D3MFImporter.h
rm -rf code/D3MFOpcPackage.h
# rm -rf code/DeboneProcess.h
# rm -rf code/DefaultIOStream.cpp
# rm -rf code/DefaultIOSystem.cpp
# rm -rf code/DefaultProgressHandler.h
# rm -rf code/DropFaceNormalsProcess.cpp
# rm -rf code/DropFaceNormalsProcess.h
rm -rf code/DXFHelper.h
rm -rf code/DXFLoader.h
# rm -rf code/EmbedTexturesProcess.cpp
# rm -rf code/EmbedTexturesProcess.h
# rm -rf code/FBXCommon.h
# rm -rf code/FBXCompileConfig.h
# rm -rf code/FBXDeformer.cpp
# rm -rf code/FBXDocumentUtil.cpp
# rm -rf code/FBXDocumentUtil.h
# rm -rf code/FBXExporter.h
# rm -rf code/FBXExportNode.h
# rm -rf code/FBXExportProperty.h
# rm -rf code/FBXImporter.cpp
# rm -rf code/FBXImporter.h
# rm -rf code/FBXImportSettings.h
# rm -rf code/FBXMeshGeometry.h
# rm -rf code/FBXModel.cpp
# rm -rf code/FBXNodeAttribute.cpp
# rm -rf code/FBXParser.h
# rm -rf code/FBXProperties.cpp
# rm -rf code/FBXProperties.h
# rm -rf code/FBXTokenizer.cpp
# rm -rf code/FBXTokenizer.h
# rm -rf code/FBXUtil.cpp
# rm -rf code/FBXUtil.h
# rm -rf code/FileLogStream.h
# rm -rf code/FindDegenerates.h
# rm -rf code/FindInstancesProcess.h
# rm -rf code/FindInvalidDataProcess.h
rm -rf code/FIReader.hpp
# rm -rf code/FixNormalsStep.cpp
# rm -rf code/FixNormalsStep.h
# rm -rf code/GenFaceNormalsProcess.cpp
# rm -rf code/GenFaceNormalsProcess.h
# rm -rf code/GenVertexNormalsProcess.cpp
# rm -rf code/GenVertexNormalsProcess.h
rm -rf code/glTF2Asset.h
rm -rf code/glTF2Asset.inl
rm -rf code/glTF2AssetWriter.inl
rm -rf code/glTF2Exporter.cpp
rm -rf code/glTF2Importer.cpp
rm -rf code/glTF2AssetWriter.h
rm -rf code/glTFAsset.h
rm -rf code/glTFAsset.inl
rm -rf code/glTFAssetWriter.inl
rm -rf code/glTFExporter.cpp
rm -rf code/glTFImporter.cpp
rm -rf code/glTF2Exporter.h
rm -rf code/glTF2Importer.h
rm -rf code/glTFAssetWriter.h
rm -rf code/glTFExporter.h
rm -rf code/glTFImporter.h
rm -rf code/HalfLifeFileData.h
rm -rf code/HMPFileData.h
rm -rf code/HMPLoader.h
rm -rf code/HMPLoader.cpp
rm -rf code/IFF.h
# rm -rf code/Importer.h
# rm -rf code/ImproveCacheLocality.h
rm -rf code/IRRLoader.h
rm -rf code/IRRMeshLoader.h
rm -rf code/IRRShared.h
# rm -rf code/JoinVerticesProcess.h
# rm -rf code/LimitBoneWeightsProcess.cpp
# rm -rf code/LimitBoneWeightsProcess.h
rm -rf code/LWSLoader.h
rm -rf code/makefile.mingw
# rm -rf code/MakeVerboseFormat.cpp
# rm -rf code/MakeVerboseFormat.h
# rm -rf code/MaterialSystem.h
rm -rf code/MD2FileData.h
rm -rf code/MD2Loader.h
rm -rf code/MD2NormalTable.h
rm -rf code/MD3FileData.h
rm -rf code/MD3Loader.h
rm -rf code/MD4FileData.h
rm -rf code/MD5Loader.h
rm -rf code/MD5Parser.cpp
rm -rf code/MDCFileData.h
rm -rf code/MDCLoader.h
rm -rf code/MDLDefaultColorMap.h
# rm -rf code/MMDCpp14.h
# rm -rf code/MMDImporter.h
rm -rf code/MS3DLoader.h
rm -rf code/NDOLoader.h
rm -rf code/NFFLoader.h
rm -rf code/ObjExporter.h
rm -rf code/ObjFileImporter.h
rm -rf code/ObjFileMtlImporter.h
rm -rf code/ObjFileParser.h
rm -rf code/ObjTools.h
rm -rf code/ObjExporter.cpp
rm -rf code/ObjFileImporter.cpp
rm -rf code/ObjFileMtlImporter.cpp
rm -rf code/ObjFileParser.cpp
rm -rf code/OFFLoader.h
rm -rf code/OFFLoader.cpp
rm -rf code/OgreImporter.cpp
rm -rf code/OgreImporter.h
rm -rf code/OgreParsingUtils.h
rm -rf code/OgreXmlSerializer.h
rm -rf code/OgreXmlSerializer.cpp
rm -rf code/OgreBinarySerializer.cpp
rm -rf code/OpenGEXExporter.cpp
rm -rf code/OpenGEXExporter.h
rm -rf code/OpenGEXImporter.h
rm -rf code/OpenGEXStructs.h
rm -rf code/OpenGEXImporter.cpp
# rm -rf code/OptimizeGraph.h
# rm -rf code/OptimizeMeshes.cpp
# rm -rf code/OptimizeMeshes.h
rm -rf code/PlyExporter.h
rm -rf code/PlyLoader.h
# rm -rf code/PolyTools.h
# rm -rf code/PostStepRegistry.cpp
# rm -rf code/PretransformVertices.h
rm -rf code/Q3BSPFileData.h
rm -rf code/Q3BSPFileImporter.h
rm -rf code/Q3BSPFileParser.cpp
rm -rf code/Q3BSPFileParser.h
rm -rf code/Q3BSPZipArchive.cpp
rm -rf code/Q3BSPZipArchive.h
rm -rf code/Q3DLoader.h
rm -rf code/Q3DLoader.cpp
rm -rf code/Q3BSPFileImporter.cpp
rm -rf code/RawLoader.h
# rm -rf code/RemoveComments.cpp
# rm -rf code/RemoveRedundantMaterials.cpp
# rm -rf code/RemoveRedundantMaterials.h
# rm -rf code/RemoveVCProcess.h
# rm -rf code/ScaleProcess.cpp
# rm -rf code/ScaleProcess.h
# rm -rf code/scene.cpp
# rm -rf code/ScenePreprocessor.cpp
# rm -rf code/ScenePreprocessor.h
# rm -rf code/ScenePrivate.h
# rm -rf code/SGSpatialSort.cpp
rm -rf code/SIBImporter.h
rm -rf code/SMDLoader.cpp
# rm -rf code/simd.cpp
# rm -rf code/simd.h
# rm -rf code/SortByPTypeProcess.h
# rm -rf code/SplitByBoneCountProcess.h
# rm -rf code/SplitLargeMeshes.h
# rm -rf code/StdOStreamLogStream.h
rm -rf code/StepExporter.h
rm -rf code/StepExporter.cpp
rm -rf code/STLExporter.cpp
rm -rf code/STLExporter.h
rm -rf code/STLLoader.h
rm -rf code/STLLoader.cpp
# rm -rf code/TargetAnimation.cpp
# rm -rf code/TargetAnimation.h
rm -rf code/TerragenLoader.h
rm -rf code/TerragenLoader.cpp
# rm -rf code/TextureTransform.h
# rm -rf code/TriangulateProcess.h
rm -rf code/UnrealLoader.h
# rm -rf code/ValidateDataStructure.h
# rm -rf code/Version.cpp
# rm -rf code/VertexTriangleAdjacency.cpp
# rm -rf code/VertexTriangleAdjacency.h
# rm -rf code/Win32DebugLogStream.h
rm -rf code/X3DImporter_Macro.hpp
rm -rf code/X3DImporter_Metadata.cpp
rm -rf code/X3DImporter_Networking.cpp
rm -rf code/X3DImporter_Texturing.cpp
rm -rf code/X3DImporter_Shape.cpp
rm -rf code/X3DImporter_Rendering.cpp
rm -rf code/X3DImporter_Postprocess.cpp
rm -rf code/X3DImporter_Light.cpp
rm -rf code/X3DImporter_Group.cpp
rm -rf code/X3DImporter_Geometry3D.cpp
rm -rf code/X3DImporter_Geometry2D.cpp
rm -rf code/X3DImporter.cpp
rm -rf code/X3DExporter.cpp
rm -rf code/X3DVocabulary.cpp
rm -rf code/XFileExporter.h
rm -rf code/XFileExporter.cpp
rm -rf code/XFileHelper.h
rm -rf code/XFileHelper.cpp
rm -rf code/XFileImporter.h
rm -rf code/XFileImporter.cpp
rm -rf code/XFileParser.h
rm -rf code/XFileParser.cpp
rm -rf code/XGLLoader.h
rm -rf code/XGLLoader.cpp
rm -rf code/Importer
rm -rf .git
rm -rf cmake-modules
rm -rf doc
rm -rf packaging
rm -rf port
rm -rf samples
rm -rf scripts
rm -rf test
rm -rf tools
rm -rf contrib/zlib
rm -rf contrib/android-cmake
rm -rf contrib/gtest
rm -rf contrib/clipper
rm -rf contrib/irrXML
rm -rf contrib/Open3DGC
rm -rf contrib/openddlparser
rm -rf contrib/poly2tri
rm -rf contrib/rapidjson
rm -rf contrib/unzip
rm -rf contrib/zip
rm -rf contrib/stb_image
rm .travis*

View File

@ -0,0 +1,53 @@
/*************************************************************************/
/* register_types.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
#include "editor/editor_node.h"
#include "editor_scene_importer_assimp.h"
#ifdef TOOLS_ENABLED
static void _editor_init() {
Ref<EditorSceneImporterAssimp> import_assimp;
import_assimp.instance();
ResourceImporterScene::get_singleton()->add_importer(import_assimp);
}
#endif
void register_assimp_types() {
#ifdef TOOLS_ENABLED
ClassDB::register_class<EditorSceneImporterAssimp>();
EditorNode::add_init_callback(_editor_init);
#endif
}
void unregister_assimp_types() {
}

View File

@ -0,0 +1,32 @@
/*************************************************************************/
/* register_types.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
void register_assimp_types();
void unregister_assimp_types();

View File

@ -96,7 +96,7 @@ void MeshInstance::_get_property_list(List<PropertyInfo> *p_list) const {
ls.sort();
for (List<String>::Element *E = ls.front(); E; E = E->next()) {
p_list->push_back(PropertyInfo(Variant::REAL, E->get(), PROPERTY_HINT_RANGE, "0,1,0.01"));
p_list->push_back(PropertyInfo(Variant::REAL, E->get(), PROPERTY_HINT_RANGE, "0,1,0.00001"));
}
if (mesh.is_valid()) {