本文整理汇总了C++中USkeletalMesh::CalculateInvRefMatrices方法的典型用法代码示例。如果您正苦于以下问题:C++ USkeletalMesh::CalculateInvRefMatrices方法的具体用法?C++ USkeletalMesh::CalculateInvRefMatrices怎么用?C++ USkeletalMesh::CalculateInvRefMatrices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USkeletalMesh
的用法示例。
在下文中一共展示了USkeletalMesh::CalculateInvRefMatrices方法的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: FactoryCreateText
//.........这里部分代码省略.........
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
FReferenceSkeleton& RefSkeleton = SkeletalMesh->RefSkeleton;
HierarchyBuilder.CopyToRefSkeleton(RefSkeleton);
SkeletalMesh->CalculateRequiredBones(LODModel, RefSkeleton, /*BonesToRemove=*/ nullptr);
SkeletalMesh->CalculateInvRefMatrices();
// Initialize the skeleton asset
EntitySkeleton->MergeAllBonesToBoneTree(SkeletalMesh);
// Point the mesh and skeleton at each other
SkeletalMesh->Skeleton = EntitySkeleton;
EntitySkeleton->SetPreviewMesh(SkeletalMesh);
// Create the animations
for (const FSpriterAnimation& Animation : Entity.Animations)
{
//@TODO: That thing I said...
const FString TargetAnimationName = Animation.Name;
const FString TargetAnimationPath = LongPackagePath / TEXT("Animations");
UAnimSequence* AnimationAsset = CastChecked<UAnimSequence>(CreateNewAsset(UAnimSequence::StaticClass(), TargetAnimationPath, TargetAnimationName, Flags));
AnimationAsset->SetSkeleton(EntitySkeleton);
// if you have one pose(thus 0.f duration), it still contains animation, so we'll need to consider that as MINIMUM_ANIMATION_LENGTH time length
const float DurationInSeconds = Animation.LengthInMS * 0.001f;
AnimationAsset->SequenceLength = FMath::Max<float>(DurationInSeconds, MINIMUM_ANIMATION_LENGTH);
const bool bSourceDataExists = (AnimationAsset->SourceRawAnimationData.Num() > 0);
TArray<struct FRawAnimSequenceTrack>& RawAnimationData = bSourceDataExists ? AnimationAsset->SourceRawAnimationData : AnimationAsset->RawAnimationData;
int32 TotalNumKeys = 0;
for (const FSpriterTimeline& Timeline : Animation.Timelines)
{