Skip to content

Commit 8323594

Browse files
committed
0_6_0
1 parent b594b49 commit 8323594

6 files changed

Lines changed: 101 additions & 21 deletions

File tree

6.5 KB
Binary file not shown.
Binary file not shown.

Blender_Importer/Blender_Importer.uplugin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion": 3,
33
"Version": 1,
4-
"VersionName": "0.5.0",
4+
"VersionName": "0.6.0",
55
"FriendlyName": "Blender Importer",
66
"Description": "Blender Addon UE Importer",
77
"Category": "Importers",

Blender_Importer/Source/Blender_Importer/Private/Import_Processer.cpp

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "Materials/MaterialExpressionConstant.h"
2020
#include "Factories/FbxImportUI.h"
2121
#include "Factories/FbxStaticMeshImportData.h"
22+
#include "Factories/FbxSkeletalMeshImportData.h"
23+
#include "Factories/FbxAnimSequenceImportData.h"
2224

2325
#define LOCTEXT_NAMESPACE "FBlender_ImporterModule"
2426

@@ -56,11 +58,65 @@ UFbxImportUI* FImport_Processer::Process_Options() {
5658

5759
FBX_Options->bImportTextures = false;
5860

61+
FBX_Options->bImportMesh = json->GetBoolField(TEXT("ImportMesh"));
5962
FBX_Options->bImportMaterials = json->GetBoolField(TEXT("ImportMaterials"));
6063
FBX_Options->bImportAnimations = json->GetBoolField(TEXT("ImportAnimations"));
6164
FBX_Options->bCreatePhysicsAsset = json->GetBoolField(TEXT("CreatePhysicsAsset"));
65+
FBX_Options->bAutoComputeLodDistances = json->GetBoolField(TEXT("AutoComputeLodDistances"));
6266

63-
FBX_Options->StaticMeshImportData->NormalImportMethod = EFBXNormalImportMethod::FBXNIM_ImportNormalsAndTangents;
67+
// Static Mesh
68+
69+
TSharedPtr<FJsonObject> json_static_mesh = json->GetObjectField(TEXT("static_mesh"));
70+
71+
FBX_Options->StaticMeshImportData->bImportMeshLODs = json_static_mesh->GetBoolField(TEXT("ImportMeshLODs"));
72+
FBX_Options->StaticMeshImportData->bCombineMeshes = json_static_mesh->GetBoolField(TEXT("CombineMeshes"));
73+
FBX_Options->StaticMeshImportData->bAutoGenerateCollision = json_static_mesh->GetBoolField(TEXT("AutoGenerateCollision"));
74+
75+
const FString options_static_mesh_normal_import_method = json_static_mesh->GetStringField(TEXT("NormalImportMethod"));
76+
if (options_static_mesh_normal_import_method == "ImportNormalsAndTangents") {
77+
FBX_Options->StaticMeshImportData->NormalImportMethod = EFBXNormalImportMethod::FBXNIM_ImportNormalsAndTangents;
78+
} else if (options_static_mesh_normal_import_method == "ComputeNormals") {
79+
FBX_Options->StaticMeshImportData->NormalImportMethod = EFBXNormalImportMethod::FBXNIM_ComputeNormals;
80+
} else if (options_static_mesh_normal_import_method == "ImportNormals") {
81+
FBX_Options->StaticMeshImportData->NormalImportMethod = EFBXNormalImportMethod::FBXNIM_ImportNormals;
82+
}
83+
84+
// Skeletal Mesh
85+
86+
TSharedPtr<FJsonObject> json_skeletal_mesh = json->GetObjectField(TEXT("skeletal_mesh"));
87+
88+
FBX_Options->SkeletalMeshImportData->bImportMeshLODs = json_skeletal_mesh->GetBoolField(TEXT("ImportMeshLODs"));
89+
FBX_Options->SkeletalMeshImportData->bUseT0AsRefPose = json_skeletal_mesh->GetBoolField(TEXT("UseT0AsRefPose"));
90+
FBX_Options->SkeletalMeshImportData->bPreserveSmoothingGroups = json_skeletal_mesh->GetBoolField(TEXT("PreserveSmoothingGroups"));
91+
FBX_Options->SkeletalMeshImportData->bImportMorphTargets = json_skeletal_mesh->GetBoolField(TEXT("ImportMorphTargets"));
92+
93+
const FString options_skeletal_mesh_normal_import_method = json_skeletal_mesh->GetStringField(TEXT("NormalImportMethod"));
94+
if (options_skeletal_mesh_normal_import_method == "ImportNormalsAndTangents") {
95+
FBX_Options->SkeletalMeshImportData->NormalImportMethod = EFBXNormalImportMethod::FBXNIM_ImportNormalsAndTangents;
96+
} else if (options_skeletal_mesh_normal_import_method == "ComputeNormals") {
97+
FBX_Options->SkeletalMeshImportData->NormalImportMethod = EFBXNormalImportMethod::FBXNIM_ComputeNormals;
98+
} else if (options_skeletal_mesh_normal_import_method == "ImportNormals") {
99+
FBX_Options->SkeletalMeshImportData->NormalImportMethod = EFBXNormalImportMethod::FBXNIM_ImportNormals;
100+
}
101+
102+
// Animation
103+
104+
TSharedPtr<FJsonObject> json_animation = json->GetObjectField(TEXT("animation"));
105+
106+
FBX_Options->AnimSequenceImportData->bImportMeshesInBoneHierarchy = json_animation->GetBoolField(TEXT("ImportMeshesInBoneHierarchy"));
107+
FBX_Options->AnimSequenceImportData->bUseDefaultSampleRate = json_animation->GetBoolField(TEXT("UseDefaultSampleRate"));
108+
FBX_Options->AnimSequenceImportData->CustomSampleRate = json_animation->GetNumberField(TEXT("CustomSampleRate"));
109+
FBX_Options->AnimSequenceImportData->bConvertScene = json_animation->GetBoolField(TEXT("ConvertScene"));
110+
111+
const FString options_animation_time = json_animation->GetStringField(TEXT("animation_time"));
112+
if (options_animation_time == "AnimatedKey") {
113+
FBX_Options->AnimSequenceImportData->AnimationLength = EFBXAnimationLengthImportType::FBXALIT_AnimatedKey;
114+
} else if (options_animation_time == "ExportedTime") {
115+
FBX_Options->AnimSequenceImportData->AnimationLength = EFBXAnimationLengthImportType::FBXALIT_ExportedTime;
116+
} else if (options_animation_time == "SetRange") {
117+
FBX_Options->AnimSequenceImportData->AnimationLength = EFBXAnimationLengthImportType::FBXALIT_SetRange;
118+
FBX_Options->AnimSequenceImportData->FrameImportRange = FInt32Interval(json_animation->GetNumberField(TEXT("frame_range_min")), json_animation->GetNumberField(TEXT("frame_range_max")));
119+
}
64120

65121
return FBX_Options;
66122

README.md

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,49 @@ This plugin utilises the standard built in FBX import by using "UFbxFactory" as
2929
### {fbx_file_name}.bjd
3030
~~~
3131
{
32-
"path": "Meshes/Test/",
33-
"options": {
34-
"ImportMaterials": true,
35-
"ImportAnimations": true,
36-
"CreatePhysicsAsset": true
37-
},
38-
"materials": [
39-
{
40-
"name": "Material",
41-
"base_color": "Textures/Cube_Material_BaseColor",
42-
"normal": "Textures/Cube_Material_Normal",
43-
"orm": "Textures/Cube_Material_OcclusionRoughnessMetallic",
44-
"opacity": "",
45-
"ambient_occlusion": "",
46-
"metallic": "",
47-
"roughness": "",
48-
"emissive": "Textures/Cube_Material_Emissive"
49-
}
50-
]
32+
"path":"Meshes/Test/",
33+
"options":{
34+
"ImportMesh":true,
35+
"ImportMaterials":true,
36+
"ImportAnimations":true,
37+
"CreatePhysicsAsset":true,
38+
"AutoComputeLodDistances":true,
39+
"static_mesh":{
40+
"NormalImportMethod":"ImportNormalsAndTangents",
41+
"ImportMeshLODs":false,
42+
"CombineMeshes":false,
43+
"AutoGenerateCollision":true
44+
},
45+
"skeletal_mesh":{
46+
"NormalImportMethod":"ImportNormalsAndTangents",
47+
"ImportMeshLODs":false,
48+
"UseT0AsRefPose":true,
49+
"PreserveSmoothingGroups":true,
50+
"ImportMorphTargets":false
51+
},
52+
"animation":{
53+
"animation_length":"ExportedTime",
54+
"frame_range_min":0,
55+
"frame_range_max":0,
56+
"ImportMeshesInBoneHierarchy":true,
57+
"UseDefaultSampleRate":false,
58+
"CustomSampleRate":0,
59+
"ConvertScene":true
60+
}
61+
},
62+
"materials":[
63+
{
64+
"name":"Material",
65+
"base_color":"Textures/Cube_Material_BaseColor",
66+
"normal":"Textures/Cube_Material_Normal",
67+
"orm":"Textures/Cube_Material_OcclusionRoughnessMetallic",
68+
"opacity":"",
69+
"ambient_occlusion":"",
70+
"metallic":"",
71+
"roughness":"",
72+
"emissive":"Textures/Cube_Material_Emissive"
73+
}
74+
]
5175
}
5276
~~~
5377

0 commit comments

Comments
 (0)