Some code examples:
PHP Code:
bool SetBodyGroup(int entity, int part, int value)
{
// Get the current entity body.
int body = GetEntProp(entity, Prop_Send, "m_nBody");
// Get the StudioHDR
StudioHdr studiohdr = GetEntityStudioHdr(entity);
// Get the new body value
if (!studiohdr.CalculateNewBodyGroup(body, part, value))
{
return false;
}
// Set the new body value
SetEntProp(entity, Prop_Send, "m_nBody", body);
return true;
}
int GetEntitySkinCount(int entity)
{
return GetEntityStudioHdr(entity).SkinFamiliesCount;
}
bool GetEntityPoseParameterBounds(int entity, int pose_parameter_index, float bounds[2])
{
// Get the StudioHDR
StudioHdr studiohdr = GetEntityStudioHdr(entity);
// Get entity pose parameter.
PoseParameter pose_parameter = studiohdr.GetPoseParameter(pose_parameter_index);
if (pose_parameter == NULL_POSE_PARAMETER)
{
return false;
}
bounds[0] = pose_parameter.start;
bounds[1] = pose_parameter.end;
return true;
}
bool GetEntityAttachmentName(int entity, int attachment_index, char[] name, int name_length)
{
// Get the StudioHDR
StudioHdr studiohdr = GetEntityStudioHdr(entity);
// Get attachment
Attachment attachment = studiohdr.GetAttachment(attachment_index);
// if the `.GetName` function executed successfully.
return attachment.GetName(name, name_length);
}
void ResetPoseParameters(int entity)
{
// Get the StudioHDR
StudioHdr studiohdr = GetEntityStudioHdr(entity);
// Buffers
char name[64];
PoseParameter pose_parameter;
for (int current_pose, max_pose = studio_hdr.NumPoseParameters; current_pose < max_pose; current_pose++)
{
// Get pose parameter by
pose_parameter = studio_hdr.GetPoseParameter(current_pose);
// Set pose parameter to the start value.
SetEntPropFloat(entity, Prop_Data, "m_flPoseParameter", pose_parameter.start, current_pose);
}
}
PoseParameter GetPoseParameterByName(int entity, const char[] pose_parameter_name)
{
// Get the StudioHDR
StudioHdr studiohdr = GetEntityStudioHdr(entity);
// Find it by the name.
int index = studio_hdr.FindPoseParameter(pose_parameter_name);
if (index == -1)
{
return NULL_POSE_PARAMETER;
}
return studio_hdr.GetPoseParameter(index);
}
__________________