标签:efi dev icm cin 编辑器 设置 就会 war uri
【目标】
UE4的Import
【思路】
1 FNewAssetOrClassContextMenu.MakeContextMenu
FNewAssetOrClassContextMenu.ExecuteImportAsset
2 UFactory.StaticImportObject
3 居然有自动Import
FAssetTools.ImportAssetsAutomated
还有Commandlet
UImportAssetsCommandlet.Main
试一下指令
UE4Editor.exe DemonHunter.uproject ImportAssets
发现 UE4的Commandlet参数不同
eg.
UE4Editor.exe DemonHunter.uproject -run=ImportAssets
出来了
答:是将UAutomatedAssetImportData 类转成Json来配置
/** * Contains data for a group of assets to import */ UCLASS(Transient)class UNREALED_API UAutomatedAssetImportData : public UObject{ GENERATED_BODY()public: UAutomatedAssetImportData(); /** @return true if this group contains enough valid data to import*/ bool IsValid() const; /** Initalizes the group */ void Initialize(TSharedPtr<FJsonObject> InImportGroupJsonData); /** @return the display name of the group */ FString GetDisplayName() const; public: /** Display name of the group. This is for logging purposes only. */ UPROPERTY() FString GroupName; /** Filenames to import */ UPROPERTY() TArray<FString> Filenames; /** Content path in the projects content directory where assets will be imported */ UPROPERTY() FString DestinationPath; /** Name of the factory to use when importing these assets. If not specified the factory type will be auto detected */ UPROPERTY() FString FactoryName; /** Whether or not to replace existing assets */ UPROPERTY() bool bReplaceExisting; /** Whether or not to skip importing over read only assets that could not be checked out */ UPROPERTY() bool bSkipReadOnly; /** Pointer to the factory currently being sued */ UPROPERTY() UFactory* Factory; /** Json data to be read when importing this group */ TSharedPtr<FJsonObject> ImportGroupJsonData;};
那尝试新建一个json文件
{ "ImportGroups":[ { "GroupName": "Filenames":"F:\A_Works\trunk_C\DevEnv\ue3\Binaries\Win32\EEE\ExampleGame\Content\Characters\daoju\daoju_rw_092\daoju_rw_092.fbx" "DestinationPath":"ttt" "FactoryName":"ReimportFbxStaticMeshFactory" "bReplaceExisting":1 "bSkipReadOnly":0 } ]}
查找到错误
{ "ImportGroups": [ { "GroupName": "Group11", "Filenames": [ "F:\\A_Works\\trunk_C\\DevEnv\\ue3\\Binaries\\Win32\\EEE\\ExampleGame\\Content\\Characters\\daoju\\daoju_rw_092\\daoju_rw_092.fbx" ], "DestinationPath": "ttt", "FactoryName": "FbxFactory", "bReplaceExisting": 1, "bSkipReadOnly": 0 } ]}
测试指令
DemonHunter.uproject -run=ImportAssets -importsettings=G:\Import.json
跟踪发现可以生成资源,但是没保存到文件
修改一下UImportAssetsCommandlet.ImportAndSave.
bool bIsReadOnly = IFileManager::Get().IsReadOnly(*PackageFilename); if(bIsReadOnly && ImportData->bSkipReadOnly) { bShouldAttemptToSave = ImportData->bSkipReadOnly; if(bIsReadOnly) { UE_LOG(LogAutomatedImport, Error, TEXT("%s is read only and -skipreadonly was specified. Will not save"), *PackageFilename); bImportAndSaveSucceeded = false; } } else if (bIsReadOnly) { bShouldAttemptToSave = FPlatformFileManager::Get().GetPlatformFile().SetReadOnly(*PackageFilename, false); if (!bShouldAttemptToSave) { UE_LOG(LogAutomatedImport, Error, TEXT("%s is read only and could not be made writable. Will not save"), *PackageFilename); bImportAndSaveSucceeded = false; } } else bShouldAttemptToSave = true;
可以保存了
导入成功!!
/** Type of asset to import from the FBX file */ UPROPERTY() TEnumAsByte<enum EFBXImportType> MeshTypeToImport;
....
修改Json文件
{ "ImportGroups": [ { "GroupName": "Group11", "Filenames": [ "F:\\A_Works\\trunk_C\\DevEnv\\ue3\\Binaries\\Win32\\EEE\\ExampleGame\\Content\\Characters\\daoju\\daoju_rw_092\\daoju_rw_092.fbx" ], "DestinationPath": "ttt", "FactoryName": "FbxFactory", "bReplaceExisting": 1, "bSkipReadOnly": 0, "ImportSettings": { "MeshTypeToImport": 1 } } ]}
{ "ImportGroups": [ { "GroupName": "Group11", "Filenames": [ "F:\\A_Works\\trunk_C\\DevEnv\\ue3\\Binaries\\Win32\\EEE\\ExampleGame\\Content\\Characters\\daoju\\daoju_rw_092\\Mesh\\Anim\\skill01.fbx" ], "DestinationPath": "ttt", "FactoryName": "FbxFactory", "bReplaceExisting": 1, "bSkipReadOnly": 0, "ImportSettings": { "OriginalImportType": 2, "MeshTypeToImport": 2, "Skeleton": "/Game/ttt/daoju_rw_092_Skeleton.daoju_rw_092_Skeleton" } } ]}
{ "ImportGroups": [ { "GroupName": "Group1", "Filenames": [ "F:\\A_Works\\trunk_C\\DevEnv\\ue3\\Binaries\\Win32\\EEE\\ExampleGame\\Content\\Characters\\daoju\\daoju_rw_092\\Mesh\\daoju_rw_092.fbx" ], "DestinationPath": "ttt", "FactoryName": "FbxFactory", "bReplaceExisting": 1, "bSkipReadOnly": 0, "ImportSettings": { "MeshTypeToImport": 1 } }, { "GroupName": "Group11", "Filenames": [ "F:\\A_Works\\trunk_C\\DevEnv\\ue3\\Binaries\\Win32\\EEE\\ExampleGame\\Content\\Characters\\daoju\\daoju_rw_092\\Mesh\\Anim\\skill01.fbx" ], "DestinationPath": "/Game/ttt/Anim", "FactoryName": "FbxFactory", "bReplaceExisting": 1, "bSkipReadOnly": 0, "ImportSettings": { "OriginalImportType": 2, "MeshTypeToImport": 2, "Skeleton": "/Game/ttt/daoju_rw_092_Skeleton.daoju_rw_092_Skeleton" } } ]}
【步骤】
1 修改
ErrorWarningList->InsertColumn( 3, *LocalizeUnrealEd("FullName"), wxLIST_FORMAT_LEFT, 100 );...
....
2 修改
if (ewi->Object)
... ErrorWarningList->SetItem( Index, 3, *ObjectName );
3
void USkelControlHitPlacement::CalculateNewBoneTransforms(INT BoneIndex, USkeletalMeshComponent* SkelComp, TArray<FBoneAtom>& OutBoneTransforms)
{
....
}
【运行】
3
标签:efi dev icm cin 编辑器 设置 就会 war uri
原文地址:http://www.cnblogs.com/username/p/7483340.html