本文整理汇总了C++中USkeletalMesh::GetImportedResource方法的典型用法代码示例。如果您正苦于以下问题:C++ USkeletalMesh::GetImportedResource方法的具体用法?C++ USkeletalMesh::GetImportedResource怎么用?C++ USkeletalMesh::GetImportedResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USkeletalMesh
的用法示例。
在下文中一共展示了USkeletalMesh::GetImportedResource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveLOD
void FLODUtilities::RemoveLOD(FSkeletalMeshUpdateContext& UpdateContext, int32 DesiredLOD )
{
USkeletalMesh* SkeletalMesh = UpdateContext.SkeletalMesh;
FSkeletalMeshResource* SkelMeshResource = SkeletalMesh->GetImportedResource();
if( SkelMeshResource->LODModels.Num() == 1 )
{
FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "NoLODToRemove", "No LODs to remove!") );
return;
}
// Now display combo to choose which LOD to remove.
TArray<FString> LODStrings;
LODStrings.AddZeroed( SkelMeshResource->LODModels.Num()-1 );
for(int32 i=0; i<SkelMeshResource->LODModels.Num()-1; i++)
{
LODStrings[i] = FString::Printf( TEXT("%d"), i+1 );
}
check( SkeletalMesh->LODInfo.Num() == SkelMeshResource->LODModels.Num() );
// If its a valid LOD, kill it.
if( DesiredLOD > 0 && DesiredLOD < SkelMeshResource->LODModels.Num() )
{
//We'll be modifying the skel mesh data so reregister
//TODO - do we need to reregister something else instead?
FMultiComponentReregisterContext ReregisterContext(UpdateContext.AssociatedComponents);
// Release rendering resources before deleting LOD
SkelMeshResource->ReleaseResources();
// Block until this is done
FlushRenderingCommands();
SkelMeshResource->LODModels.RemoveAt(DesiredLOD);
SkeletalMesh->LODInfo.RemoveAt(DesiredLOD);
SkeletalMesh->InitResources();
RefreshLODChange(SkeletalMesh);
// Set the forced LOD to Auto.
for(auto Iter = UpdateContext.AssociatedComponents.CreateIterator(); Iter; ++Iter)
{
USkinnedMeshComponent* SkinnedComponent = Cast<USkinnedMeshComponent>(*Iter);
if(SkinnedComponent)
{
SkinnedComponent->ForcedLodModel = 0;
}
}
//Notify calling system of change
UpdateContext.OnLODChanged.ExecuteIfBound();
// Mark things for saving.
SkeletalMesh->MarkPackageDirty();
}
}
示例2: PyErr_Format
PyObject *py_ue_skeletal_mesh_lods_num(ue_PyUObject *self, PyObject * args)
{
ue_py_check(self);
USkeletalMesh *mesh = ue_py_check_type<USkeletalMesh>(self);
if (!mesh)
return PyErr_Format(PyExc_Exception, "uobject is not a USkeletalMesh");
#if ENGINE_MINOR_VERSION < 19
FSkeletalMeshResource *resource = mesh->GetImportedResource();
#else
FSkeletalMeshModel *resource = mesh->GetImportedModel();
#endif
return PyLong_FromLong(resource->LODModels.Num());
}
示例3: FactoryCreateText
//.........这里部分代码省略.........
else if (File.FileType == ESpriterFileType::Sound)
{
// Import the sound
const FString TargetAssetPath = LongPackagePath / RelativeDestPath;
UObject* ImportedSound = ImportAsset(SourceSpriterFilePath, TargetAssetPath);
}
else if (File.FileType != ESpriterFileType::INVALID)
{
ensureMsgf(false, TEXT("Importer was not updated when a new entry was added to ESpriterFileType"));
}
// TMap<FString, class UTexture2D*> ImportedTextures;
// TMap<FString, class UPaperSprite> ImportedSprites;
}
}
for (const FSpriterEntity& Entity : DataModel.Entities)
{
// Extract the common/shared skeleton
FBoneHierarchyBuilder HierarchyBuilder;
HierarchyBuilder.ProcessHierarchy(Entity);
// Create the skeletal mesh
const FString TargetMeshName = Entity.Name + TEXT("_SkelMesh");
const FString TargetMeshPath = LongPackagePath;
USkeletalMesh* SkeletalMesh = CastChecked<USkeletalMesh>(CreateNewAsset(USkeletalMesh::StaticClass(), TargetMeshPath, TargetMeshName, Flags));
// Create the skeleton
const FString TargetSkeletonName = Entity.Name + TEXT("_Skeleton");
const FString TargetSkeletonPath = LongPackagePath;
USkeleton* EntitySkeleton = CastChecked<USkeleton>(CreateNewAsset(USkeleton::StaticClass(), TargetSkeletonPath, TargetSkeletonName, Flags));
// Initialize the mesh asset
FSkeletalMeshResource* ImportedResource = SkeletalMesh->GetImportedResource();
check(ImportedResource->LODModels.Num() == 0);
ImportedResource->LODModels.Empty();
FStaticLODModel& LODModel = *new (ImportedResource->LODModels) FStaticLODModel();
SkeletalMesh->LODInfo.Empty();
SkeletalMesh->LODInfo.AddZeroed();
SkeletalMesh->LODInfo[0].LODHysteresis = 0.02f;
FSkeletalMeshOptimizationSettings Settings;
// set default reduction settings values
SkeletalMesh->LODInfo[0].ReductionSettings = Settings;
// Create initial bounding box based on expanded version of reference pose for meshes without physics assets. Can be overridden by artist.
// FBox BoundingBox(SkelMeshImportDataPtr->Points.GetData(), SkelMeshImportDataPtr->Points.Num());
// FBox Temp = BoundingBox;
// FVector MidMesh = 0.5f*(Temp.Min + Temp.Max);
// BoundingBox.Min = Temp.Min + 1.0f*(Temp.Min - MidMesh);
// BoundingBox.Max = Temp.Max + 1.0f*(Temp.Max - MidMesh);
// // Tuck up the bottom as this rarely extends lower than a reference pose's (e.g. having its feet on the floor).
// // Maya has Y in the vertical, other packages have Z.
// //BEN const int32 CoordToTuck = bAssumeMayaCoordinates ? 1 : 2;
// //BEN BoundingBox.Min[CoordToTuck] = Temp.Min[CoordToTuck] + 0.1f*(Temp.Min[CoordToTuck] - MidMesh[CoordToTuck]);
// BoundingBox.Min[2] = Temp.Min[2] + 0.1f*(Temp.Min[2] - MidMesh[2]);
// SkeletalMesh->Bounds = FBoxSphereBounds(BoundingBox);
// Store whether or not this mesh has vertex colors
// SkeletalMesh->bHasVertexColors = SkelMeshImportDataPtr->bHasVertexColors;
// Pass the number of texture coordinate sets to the LODModel. Ensure there is at least one UV coord
LODModel.NumTexCoords = 1;// FMath::Max<uint32>(1, SkelMeshImportDataPtr->NumTexCoords);
// Create the reference skeleton and update LOD0