赞
踩
- FString InstancesID = Materials + '/' + MaterialId + '/' + MaterialId + "." + MaterialId;
- FName BaseMaterialObjectPath = FName(*InstancesID);
- Packages.AddUnique(CreatePackage(nullptr, *(Materials + "/" + MaterialId + '/' + MaterialIndex)));
- FAssetData BaseMateial = AssetRegistryModule.Get().GetAssetByObjectPath(BaseMaterialObjectPath);
- UMaterialInstanceConstantFactoryNew* Factory = NewObject<UMaterialInstanceConstantFactoryNew>();
- UObject* Mat = AssetToolsModule.Get().CreateAsset(MaterialIndex, Materials + '/' + MaterialId, UMaterialInstanceConstant::StaticClass(), Factory, FName("CreateMaterial"));
- UMaterialInstanceConstant* MatInst = static_cast<UMaterialInstanceConstant*>(Mat);
- MatInst->Parent = static_cast<UMaterialInterface*>(BaseMateial.GetAsset());
- UObject* LoadedAsset = AssetRegistryModule.Get().GetAssetByObjectPath(*BPPhysicalActorPath).GetAsset();
- UBlueprint* Blueprint = Cast<UBlueprint>(LoadedAsset);
- UClass* InClass = Blueprint->GeneratedClass.Get();
- UBlueprintFactory* Factory = NewObject<UBlueprintFactory>();
- Factory->ParentClass = InClass;
- UObject* BP = AssetToolsModule.Get().CreateAsset(AssetName, PackagePath, nullptr, Factory, FName("BlueprintPhyscialActor"));
- for (UObject* StaticMesh : StaticMeshes)
- {
- AddBlueprintComponent(StaticMesh, Cast<UBlueprint>(BP));
- }
- Packages.Add(CreatePackage(NULL, *(PackagePath + "/" + AssetName)));
- FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
- FAssetToolsModule& AssetToolsModule = FModuleManager::Get().LoadModuleChecked<FAssetToolsModule>("AssetTools");
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。