Ejemplo n.º 1
0
void btCompoundShape::freeChildrenShapes()
{
	// Vodin fix: free child shapes as well
	while(m_children.size()) 
	{
		btCollisionShape *s = getChildShape(0);
		removeChildShapeByIndex(0);
		delete s;
	}
	m_children.clear();
}
Ejemplo n.º 2
0
bool ListShapeSetter::parseShape(const hkpShape* s)
{
	auto shape = dynamic_cast<const hkpListShape*>(s);
	if(!shape) return false;
	
	ui->listWidget->clear();
	for(int i=0; i<children.getSize(); ++i)
		children[i]->removeReference();
	children.clear();
	
	hkpShapeBuffer buffer;
	for(hkpShapeKey key = shape->getFirstKey(); key!=HK_INVALID_SHAPE_KEY; key = shape->getNextKey(key))
	{
		auto child = shape->getChildShape(key, buffer);
		child->addReference();
		auto shapeClass = getHavokClass(child);
		ui->listWidget->addItem(new QListWidgetItem(shapeClass->getName()));
		children.pushBack(child);
	}
	return true;
}