当前位置:   article > 正文

UE4 createasset_ue uassettoolsimpl::createasset

ue uassettoolsimpl::createasset
  1. FString InstancesID = Materials + '/' + MaterialId + '/' + MaterialId + "." + MaterialId;
  2. FName BaseMaterialObjectPath = FName(*InstancesID);
  3. Packages.AddUnique(CreatePackage(nullptr, *(Materials + "/" + MaterialId + '/' + MaterialIndex)));
  4. FAssetData BaseMateial = AssetRegistryModule.Get().GetAssetByObjectPath(BaseMaterialObjectPath);
  5. UMaterialInstanceConstantFactoryNew* Factory = NewObject<UMaterialInstanceConstantFactoryNew>();
  6. UObject* Mat = AssetToolsModule.Get().CreateAsset(MaterialIndex, Materials + '/' + MaterialId, UMaterialInstanceConstant::StaticClass(), Factory, FName("CreateMaterial"));
  7. UMaterialInstanceConstant* MatInst = static_cast<UMaterialInstanceConstant*>(Mat);
  8. MatInst->Parent = static_cast<UMaterialInterface*>(BaseMateial.GetAsset());
  1. UObject* LoadedAsset = AssetRegistryModule.Get().GetAssetByObjectPath(*BPPhysicalActorPath).GetAsset();
  2. UBlueprint* Blueprint = Cast<UBlueprint>(LoadedAsset);
  3. UClass* InClass = Blueprint->GeneratedClass.Get();
  4. UBlueprintFactory* Factory = NewObject<UBlueprintFactory>();
  5. Factory->ParentClass = InClass;
  6. UObject* BP = AssetToolsModule.Get().CreateAsset(AssetName, PackagePath, nullptr, Factory, FName("BlueprintPhyscialActor"));
  7. for (UObject* StaticMesh : StaticMeshes)
  8. {
  9. AddBlueprintComponent(StaticMesh, Cast<UBlueprint>(BP));
  10. }
  11. Packages.Add(CreatePackage(NULL, *(PackagePath + "/" + AssetName)));
  1. FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
  2. FAssetToolsModule& AssetToolsModule = FModuleManager::Get().LoadModuleChecked<FAssetToolsModule>("AssetTools");

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/81938
推荐阅读
相关标签
  

闽ICP备14008679号