Skip to content

Commit 07bff81

Browse files
committed
0_7_0
1 parent 8323594 commit 07bff81

9 files changed

Lines changed: 71 additions & 59 deletions

File tree

0 Bytes
Binary file not shown.
0 Bytes
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.6.0",
4+
"VersionName": "0.7.0",
55
"FriendlyName": "Blender Importer",
66
"Description": "Blender Addon UE Importer",
77
"Category": "Importers",

Blender_Importer/Source/Blender_Importer/Blender_Importer.Build.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ public Blender_Importer(ReadOnlyTargetRules Target) : base(Target)
2727
new string[]
2828
{
2929
"Core",
30-
// ... add other public dependencies that you statically link with here ...
31-
}
30+
"Engine",
31+
}
3232
);
3333

3434

3535
PrivateDependencyModuleNames.AddRange(
3636
new string[]
3737
{
38-
"Projects",
38+
"Projects",
3939
"InputCore",
4040
"UnrealEd",
4141
"LevelEditor",
@@ -48,7 +48,11 @@ public Blender_Importer(ReadOnlyTargetRules Target) : base(Target)
4848
"ContentBrowser",
4949
"MaterialEditor",
5050
"MeshUtilities",
51+
"MeshUtilitiesCommon",
52+
"MeshDescription",
5153
"MessageLog",
54+
"OutputLog",
55+
"AssetRegistry",
5256
// ... add private dependencies that you statically link with here ...
5357
}
5458
);
@@ -60,5 +64,10 @@ public Blender_Importer(ReadOnlyTargetRules Target) : base(Target)
6064
// ... add any modules that your module loads dynamically here ...
6165
}
6266
);
63-
}
67+
68+
AddEngineThirdPartyPrivateStaticDependencies(Target,
69+
"FBX"
70+
);
71+
72+
}
6473
}

Blender_Importer/Source/Blender_Importer/Private/Import_Processer.cpp renamed to Blender_Importer/Source/Blender_Importer/Private/BJD_Processer.cpp

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
22

3-
#include "Import_Processer.h"
3+
#include "BJD_Processer.h"
4+
45
#include "AssetRegistryModule.h"
56
#include "Editor/UnrealEd/Public/Editor.h"
67
#include "Misc/FeedbackContext.h"
8+
#include "Misc/MessageDialog.h"
79
#include "Logging/LogMacros.h"
810
#include "Logging/TokenizedMessage.h"
911
#include "MessageLogModule.h"
@@ -17,14 +19,10 @@
1719
#include "Materials/MaterialExpressionTextureSample.h"
1820
#include "Materials/Material.h"
1921
#include "Materials/MaterialExpressionConstant.h"
20-
#include "Factories/FbxImportUI.h"
21-
#include "Factories/FbxStaticMeshImportData.h"
22-
#include "Factories/FbxSkeletalMeshImportData.h"
23-
#include "Factories/FbxAnimSequenceImportData.h"
2422

2523
#define LOCTEXT_NAMESPACE "FBlender_ImporterModule"
2624

27-
bool FImport_Processer::Process_JSON_Open(const FString& Filename)
25+
bool FBJD_Processer::Process_JSON_Open(const FString& Filename)
2826
{
2927

3028
FString JsonString;
@@ -50,14 +48,14 @@ bool FImport_Processer::Process_JSON_Open(const FString& Filename)
5048

5149
}
5250

53-
UFbxImportUI* FImport_Processer::Process_Options() {
51+
UFbxImportUI* FBJD_Processer::Process_Options() {
5452

5553
UFbxImportUI* FBX_Options = NewObject<UFbxImportUI>();
5654

57-
TSharedPtr<FJsonObject> json = JsonObject->GetObjectField(TEXT("options"));
58-
59-
FBX_Options->bImportTextures = false;
55+
TSharedPtr<FJsonObject> json = JsonObject->GetObjectField(TEXT("Options"));
6056

57+
FBX_Options->bImportTextures = false;
58+
6159
FBX_Options->bImportMesh = json->GetBoolField(TEXT("ImportMesh"));
6260
FBX_Options->bImportMaterials = json->GetBoolField(TEXT("ImportMaterials"));
6361
FBX_Options->bImportAnimations = json->GetBoolField(TEXT("ImportAnimations"));
@@ -66,7 +64,7 @@ UFbxImportUI* FImport_Processer::Process_Options() {
6664

6765
// Static Mesh
6866

69-
TSharedPtr<FJsonObject> json_static_mesh = json->GetObjectField(TEXT("static_mesh"));
67+
TSharedPtr<FJsonObject> json_static_mesh = json->GetObjectField(TEXT("Static_Mesh"));
7068

7169
FBX_Options->StaticMeshImportData->bImportMeshLODs = json_static_mesh->GetBoolField(TEXT("ImportMeshLODs"));
7270
FBX_Options->StaticMeshImportData->bCombineMeshes = json_static_mesh->GetBoolField(TEXT("CombineMeshes"));
@@ -83,7 +81,7 @@ UFbxImportUI* FImport_Processer::Process_Options() {
8381

8482
// Skeletal Mesh
8583

86-
TSharedPtr<FJsonObject> json_skeletal_mesh = json->GetObjectField(TEXT("skeletal_mesh"));
84+
TSharedPtr<FJsonObject> json_skeletal_mesh = json->GetObjectField(TEXT("Skeletal_Mesh"));
8785

8886
FBX_Options->SkeletalMeshImportData->bImportMeshLODs = json_skeletal_mesh->GetBoolField(TEXT("ImportMeshLODs"));
8987
FBX_Options->SkeletalMeshImportData->bUseT0AsRefPose = json_skeletal_mesh->GetBoolField(TEXT("UseT0AsRefPose"));
@@ -101,48 +99,48 @@ UFbxImportUI* FImport_Processer::Process_Options() {
10199

102100
// Animation
103101

104-
TSharedPtr<FJsonObject> json_animation = json->GetObjectField(TEXT("animation"));
102+
TSharedPtr<FJsonObject> json_animation = json->GetObjectField(TEXT("Animation"));
105103

106104
FBX_Options->AnimSequenceImportData->bImportMeshesInBoneHierarchy = json_animation->GetBoolField(TEXT("ImportMeshesInBoneHierarchy"));
107105
FBX_Options->AnimSequenceImportData->bUseDefaultSampleRate = json_animation->GetBoolField(TEXT("UseDefaultSampleRate"));
108106
FBX_Options->AnimSequenceImportData->CustomSampleRate = json_animation->GetNumberField(TEXT("CustomSampleRate"));
109107
FBX_Options->AnimSequenceImportData->bConvertScene = json_animation->GetBoolField(TEXT("ConvertScene"));
110108

111-
const FString options_animation_time = json_animation->GetStringField(TEXT("animation_time"));
112-
if (options_animation_time == "AnimatedKey") {
109+
const FString options_animation_length = json_animation->GetStringField(TEXT("AnimationLength"));
110+
if (options_animation_length == "AnimatedKey") {
113111
FBX_Options->AnimSequenceImportData->AnimationLength = EFBXAnimationLengthImportType::FBXALIT_AnimatedKey;
114-
} else if (options_animation_time == "ExportedTime") {
112+
} else if (options_animation_length == "ExportedTime") {
115113
FBX_Options->AnimSequenceImportData->AnimationLength = EFBXAnimationLengthImportType::FBXALIT_ExportedTime;
116-
} else if (options_animation_time == "SetRange") {
114+
} else if (options_animation_length == "SetRange") {
117115
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")));
116+
FBX_Options->AnimSequenceImportData->FrameImportRange = FInt32Interval(json_animation->GetNumberField(TEXT("FrameRangeMin")), json_animation->GetNumberField(TEXT("FrameRangeMax")));
119117
}
120118

121119
return FBX_Options;
122120

123121
}
124-
bool FImport_Processer::Process_Materials()
122+
bool FBJD_Processer::Process_Materials()
125123
{
126124

127-
const FString data_path = JsonObject->GetStringField(TEXT("path"));
125+
const FString data_path = JsonObject->GetStringField(TEXT("Path"));
128126

129127
// Process Materials
130128

131-
TArray<TSharedPtr<FJsonValue>> objArray = JsonObject->GetArrayField(TEXT("materials"));
129+
TArray<TSharedPtr<FJsonValue>> objArray = JsonObject->GetArrayField(TEXT("Materials"));
132130

133131
for (int32 i = 0; i < objArray.Num(); i++)
134132
{
135133
TSharedPtr<FJsonValue> value = objArray[i];
136134
TSharedPtr<FJsonObject> json = value->AsObject();
137135

138-
const FString data_name = json->GetStringField(TEXT("name"));
139-
const FString data_base_color = json->GetStringField(TEXT("base_color"));
140-
const FString data_orm = json->GetStringField(TEXT("orm"));
141-
const FString data_normal = json->GetStringField(TEXT("normal"));
142-
const FString data_ambient_occlusion = json->GetStringField(TEXT("ambient_occlusion"));
143-
const FString data_metallic = json->GetStringField(TEXT("metallic"));
144-
const FString data_roughness = json->GetStringField(TEXT("roughness"));
145-
const FString data_emissive = json->GetStringField(TEXT("emissive"));
136+
const FString data_name = json->GetStringField(TEXT("Name"));
137+
const FString data_base_color = json->GetStringField(TEXT("BaseColor"));
138+
const FString data_orm = json->GetStringField(TEXT("ORM"));
139+
const FString data_normal = json->GetStringField(TEXT("Normal"));
140+
const FString data_ambient_occlusion = json->GetStringField(TEXT("AmbientOcclusion"));
141+
const FString data_metallic = json->GetStringField(TEXT("Metallic"));
142+
const FString data_roughness = json->GetStringField(TEXT("Roughness"));
143+
const FString data_emissive = json->GetStringField(TEXT("Emissive"));
146144

147145
FString PackageName = TEXT("/Game/") + data_path + data_name;
148146

Blender_Importer/Source/Blender_Importer/Private/Import_FBX_Factory.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
22

33
#include "Import_FBX_Factory.h"
4-
#include "Import_Processer.h"
4+
#include "BJD_Processer.h"
55
#include "Misc/Paths.h"
66
#include "AssetImportTask.h"
77
#include "Factories/FbxImportUI.h"
@@ -32,7 +32,7 @@ bool UImport_FBX_Factory::FactoryCanImport(const FString& Filename)
3232
const FString Extension = FPaths::GetExtension(Filename);
3333
const FString JSON_Filename = Filename.Replace(TEXT(".fbx"), TEXT(".bjd"));
3434

35-
if (Extension == TEXT("fbx") && IFileManager::Get().FileExists(*JSON_Filename)){
35+
if (Extension == TEXT("fbx") && IFileManager::Get().FileExists(*JSON_Filename)) {
3636
return true;
3737
}
3838

@@ -45,20 +45,20 @@ UObject* UImport_FBX_Factory::FactoryCreateFile(UClass* InClass, UObject* InPare
4545

4646
UObject* CreatedObject = NULL;
4747

48-
FImport_Processer Import_Processer;
48+
FBJD_Processer BJD_Processer;
4949

5050
const FString JSON_Filename = Filename.Replace(TEXT(".fbx"), TEXT(".bjd"));
5151

52-
if (Import_Processer.Process_JSON_Open(JSON_Filename)) {
52+
if (BJD_Processer.Process_JSON_Open(JSON_Filename)) {
5353

5454
UAssetImportTask* Task = NewObject<UAssetImportTask>();
5555
Task->bAutomated = true;
56-
Task->Options = Import_Processer.Process_Options();;
56+
Task->Options = BJD_Processer.Process_Options();;
5757
SetAssetImportTask(Task);
5858

5959
CreatedObject = Super::FactoryCreateFile(InClass, InParent, InName, Flags, Filename, Parms, Warn, bOutOperationCanceled);
6060

61-
const bool _processed_materials = Import_Processer.Process_Materials();
61+
const bool _processed_materials = BJD_Processer.Process_Materials();
6262

6363
remove(TCHAR_TO_ANSI(*JSON_Filename));
6464

Blender_Importer/Source/Blender_Importer/Public/Import_Processer.h renamed to Blender_Importer/Source/Blender_Importer/Public/BJD_Processer.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
#pragma once
44

5-
class FImport_Processer
5+
#include "Factories/FbxStaticMeshImportData.h"
6+
#include "Factories/FbxSkeletalMeshImportData.h"
7+
#include "Factories/FbxAnimSequenceImportData.h"
8+
#include "Factories/FbxImportUI.h"
9+
10+
class FBJD_Processer
611
{
712

813
public:

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,47 +29,47 @@ 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":{
32+
"Path":"Meshes/Test/",
33+
"Options":{
3434
"ImportMesh":true,
3535
"ImportMaterials":true,
3636
"ImportAnimations":true,
3737
"CreatePhysicsAsset":true,
3838
"AutoComputeLodDistances":true,
39-
"static_mesh":{
39+
"Static_Mesh":{
4040
"NormalImportMethod":"ImportNormalsAndTangents",
4141
"ImportMeshLODs":false,
4242
"CombineMeshes":false,
4343
"AutoGenerateCollision":true
4444
},
45-
"skeletal_mesh":{
45+
"Skeletal_Mesh":{
4646
"NormalImportMethod":"ImportNormalsAndTangents",
4747
"ImportMeshLODs":false,
4848
"UseT0AsRefPose":true,
4949
"PreserveSmoothingGroups":true,
5050
"ImportMorphTargets":false
5151
},
52-
"animation":{
53-
"animation_length":"ExportedTime",
54-
"frame_range_min":0,
55-
"frame_range_max":0,
52+
"Animation":{
53+
"AnimationLength":"ExportedTime",
54+
"FrameRangeMin":0,
55+
"FrameRangeMax":0,
5656
"ImportMeshesInBoneHierarchy":true,
5757
"UseDefaultSampleRate":false,
5858
"CustomSampleRate":0,
5959
"ConvertScene":true
6060
}
6161
},
62-
"materials":[
62+
"Materials":[
6363
{
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"
64+
"Name":"Material",
65+
"BaseColor":"Textures/Cube_Material_BaseColor",
66+
"Normal":"Textures/Cube_Material_Normal",
67+
"Orm":"Textures/Cube_Material_OcclusionRoughnessMetallic",
68+
"Opacity":"",
69+
"AmbientOcclusion":"",
70+
"Metallic":"",
71+
"Roughness":"",
72+
"Emissive":"Textures/Cube_Material_Emissive"
7373
}
7474
]
7575
}

0 commit comments

Comments
 (0)