mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-05-08 18:10:39 +00:00
GetBoneIndex/GetBoneCount
This commit is contained in:
parent
a2be3e8f50
commit
dff2e64d00
2 changed files with 36 additions and 0 deletions
|
@ -5558,6 +5558,17 @@ static int GetBoneNameNative(AActor * self, int bone_index)
|
|||
return mdl->GetJointName(bone_index).GetIndex();
|
||||
}
|
||||
|
||||
static int GetBoneIndexNative(AActor * self, int boneName_i)
|
||||
{
|
||||
FName bone_name {ENamedName(boneName_i)};
|
||||
|
||||
int bone_index;
|
||||
|
||||
FModel * mdl = GetBoneShared(self, 0, bone_index, &bone_name);
|
||||
|
||||
return bone_index;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetBoneName, GetBoneNameNative)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
@ -5566,6 +5577,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetBoneName, GetBoneNameNative)
|
|||
ACTION_RETURN_INT(GetBoneNameNative(self, boneindex));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetBoneIndex, GetBoneIndexNative)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_NAME(bonename);
|
||||
|
||||
ACTION_RETURN_INT(GetBoneIndexNative(self, bonename.GetIndex()));
|
||||
}
|
||||
|
||||
static int GetBoneParentNative(AActor * self, int bone_index)
|
||||
{
|
||||
FModel * mdl = GetBoneShared(self, 0, bone_index, nullptr);
|
||||
|
@ -5702,6 +5721,19 @@ DEFINE_ACTION_FUNCTION(AActor, GetNamedBoneDir)
|
|||
ACTION_RETURN_VEC3(DVector3(mdl->GetJointDir(bone_index)));
|
||||
}
|
||||
|
||||
static int GetBoneCountNative(AActor * self)
|
||||
{
|
||||
FModel * mdl = SetGetBoneShared<false, false>(self, 0);
|
||||
|
||||
return mdl->NumJoints();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetBoneCount, GetBoneCountNative)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
ACTION_RETURN_INT(GetBoneCountNative(self));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1395,6 +1395,7 @@ class Actor : Thinker native
|
|||
native version("4.15.1") void GetRootBones(out Array<int> rootBones);
|
||||
|
||||
native version("4.15.1") Name GetBoneName(int boneIndex);
|
||||
native version("4.15.1") int GetBoneIndex(Name boneName);
|
||||
|
||||
native version("4.15.1") int GetBoneParent(int boneIndex);
|
||||
native version("4.15.1") int GetNamedBoneParent(Name boneName); // return value lower than 0 means it's a root bone, and as such has no parent
|
||||
|
@ -1409,6 +1410,9 @@ class Actor : Thinker native
|
|||
// this is the direction of the bone in the armature, does not take the current animation or offset into account at all
|
||||
native version("4.15.1") Vector3 GetBoneDir(int boneIndex);
|
||||
native version("4.15.1") Vector3 GetNamedBoneDir(Name boneName);
|
||||
|
||||
native version("4.15.1") int GetBoneCount();
|
||||
|
||||
|
||||
//================================================
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue