View Single Post
LuqS
AlliedModders Donor
Join Date: Jun 2019
Location: Israel
Old 08-10-2021 , 16:39   Re: [INC] StudioHdr - Entity Model Information
Reply With Quote #2

Some code examples:

PHP Code:
bool SetBodyGroup(int entityint partint value)
{
    
// Get the current entity body.
    
int body GetEntProp(entityProp_Send"m_nBody");
    
    
// Get the StudioHDR
    
StudioHdr studiohdr GetEntityStudioHdr(entity);
    
    
// Get the new body value
    
if (!studiohdr.CalculateNewBodyGroup(bodypartvalue))
    {
        return 
false;
    }
    
    
// Set the new body value
    
SetEntProp(entityProp_Send"m_nBody"body);
    
    return 
true;
}

int GetEntitySkinCount(int entity)
{
    return 
GetEntityStudioHdr(entity).SkinFamiliesCount;
}

bool GetEntityPoseParameterBounds(int entityint pose_parameter_indexfloat 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 entityint attachment_indexchar[] nameint 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(namename_length);
}

void ResetPoseParameters(int entity)
{
    
// Get the StudioHDR
    
StudioHdr studiohdr GetEntityStudioHdr(entity);
    
    
// Buffers
    
char name[64];
    
PoseParameter pose_parameter;
    
    for (
int current_posemax_pose studio_hdr.NumPoseParameterscurrent_pose max_posecurrent_pose++)
    {
        
// Get pose parameter by 
        
pose_parameter studio_hdr.GetPoseParameter(current_pose);
        
        
// Set pose parameter to the start value.
        
SetEntPropFloat(entityProp_Data"m_flPoseParameter"pose_parameter.startcurrent_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);

__________________
You like my work? You want to support?
Consider Donating!

Need signatures / offsets for CS:GO?
Contact me:

Last edited by LuqS; 08-21-2021 at 06:06. Reason: 21/08/2021 Incompatible API change.
LuqS is offline