本文整理汇总了C++中USkeletalMesh::InitResources方法的典型用法代码示例。如果您正苦于以下问题:C++ USkeletalMesh::InitResources方法的具体用法?C++ USkeletalMesh::InitResources怎么用?C++ USkeletalMesh::InitResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USkeletalMesh
的用法示例。
在下文中一共展示了USkeletalMesh::InitResources方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PyErr_Format
PyObject *py_ue_skeletal_mesh_set_skeleton(ue_PyUObject * self, PyObject * args)
{
ue_py_check(self);
PyObject *py_skeleton;
if (!PyArg_ParseTuple(args, "O:skeletal_mesh_set_skeleton", &py_skeleton))
return nullptr;
USkeletalMesh *mesh = ue_py_check_type<USkeletalMesh>(self);
if (!mesh)
return PyErr_Format(PyExc_Exception, "UObject is not a USkeletalMesh.");
USkeleton *skeleton = ue_py_check_type<USkeleton>(py_skeleton);
if (!skeleton)
return PyErr_Format(PyExc_Exception, "argument is not a USkeleton.");
mesh->ReleaseResources();
mesh->ReleaseResourcesFence.Wait();
mesh->Skeleton = skeleton;
mesh->RefSkeleton = skeleton->GetReferenceSkeleton();
mesh->RefBasesInvMatrix.Empty();
mesh->CalculateInvRefMatrices();
#if WITH_EDITOR
mesh->PostEditChange();
#endif
mesh->InitResources();
mesh->MarkPackageDirty();
Py_RETURN_NONE;
}
示例2: 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();
}
}