• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PredatorCZ / HavokLib / 89

06 Nov 2025 01:09PM UTC coverage: 63.837% (-3.2%) from 67.014%
89

push

github

PredatorCZ
s

3354 of 5254 relevant lines covered (63.84%)

129082.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.73
/python/hka_skeleton.cpp
1
#include "hka_skeleton.hpp"
2
#include <structmember.h>
3
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
4

5
static PyMemberDef hkaPartitionPyMembers[] = {
6
    {"name", T_OBJECT_EX, offsetof(hkaPartitionPy, name), 0, "Partition name."},
7
    {"start_bone_index", T_UINT, offsetof(hkaPartitionPy, startBoneIndex), 0,
8
     "Partition starts from bone index."},
9
    {"num_bones", T_UINT, offsetof(hkaPartitionPy, numBones), 0,
10
     "Number bones within parition."},
11
    {NULL},
12
};
13

14
PyTypeObject *hkaPartitionPy::GetType() {
1✔
15
  static PyTypeObject hkaPartitionPyType{
16
      .tp_name = "hkaPartition",
17
      .tp_basicsize = sizeof(hkaPartitionPy),
18
      .tp_flags = Py_TPFLAGS_DEFAULT,
19
      .tp_doc = "Havok Skeleton Partition",
20
      .tp_members = (PyMemberDef *)hkaPartitionPyMembers,
21
      .tp_init = (initproc)hkaPartitionPy::Init,
22
      .tp_new = hkaPartitionPy::New,
23
  };
24

25
  return &hkaPartitionPyType;
1✔
26
}
27

28
PyObject *hkaPartitionPy::New(PyTypeObject *type, PyObject *, PyObject *) {
2✔
29
  hkaPartitionPy *self = (hkaPartitionPy *)type->tp_alloc(type, 0);
2✔
30

31
  if (self) {
2✔
32
    self->name = PyUnicode_FromString("");
2✔
33
    if (!self->name) {
2✔
34
      Py_DECREF(self);
×
35
      return nullptr;
×
36
    }
37
  }
38

39
  return (PyObject *)self;
2✔
40
}
41

42
int hkaPartitionPy::Init(hkaPartitionPy *self, PyObject *args, PyObject *kwds) {
2✔
43
  static char *kwList[] = {"name", "start_bone_index", "num_bones", nullptr};
44

45
  if (!PyArg_ParseTupleAndKeywords(args, kwds, "|UII", kwList, &self->name,
2✔
46
                                   &self->startBoneIndex, &self->numBones)) {
47
    return -1;
×
48
  }
49

50
  return 0;
2✔
51
}
52

53
hkaPartitionPy *hkaPartitionPy::Create(const hkaPartition &tp) {
×
54
  hkaPartitionPy *self = (hkaPartitionPy *)GetType()->tp_alloc(GetType(), 0);
×
55
  self->name = PyUnicode_FromStringAndSize(tp.name.data(), tp.name.size());
×
56
  self->startBoneIndex = tp.startBoneIndex;
×
57
  self->numBones = tp.numBones;
×
58

59
  return self;
×
60
}
61

62
PyTypeObject *hkaSkeletonPy::GetType() {
2✔
63
  static PyTypeObject hkaSkeletonPyType{
64
      .tp_name = "hkaSkeleton",
65
      .tp_basicsize = sizeof(hkaSkeletonPy),
66
      .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
67
      .tp_doc = "Havok Animation Skeleton",
68
      .tp_base = UniPy::Skeleton::GetType(),
2✔
69
  };
2✔
70

71
  return &hkaSkeletonPyType;
2✔
72
}
73

74
PyObject *hkaSkeletonPy::Alloc(const IhkVirtualClass *cls) {
1✔
75
  auto cted = reinterpret_cast<hkaSkeletonPy *>(
76
      PyType_GenericAlloc(hkaSkeletonPy::GetType(), 0));
1✔
77
  cted->hkClass = checked_deref_cast<const hkaSkeleton>(cls);
1✔
78
  cted->base.item = {static_cast<const uni::Skeleton *>(cted->hkClass), false};
1✔
79

80
  return reinterpret_cast<PyObject *>(cted);
1✔
81
}
82

83
void hkaSkeletonPy::InitType(PyObject *module) {
1✔
84
  UniPy::Skeleton::InitType(module);
1✔
85
  PyAddTypes<hkaSkeletonPy, hkaPartitionPy>(module);
1✔
86
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc