Merge pull request #1 from AndrewMeadows/edit-model-ui

fix bug where some model shapes are momentarily incorrect
This commit is contained in:
Zander Otavka 2016-07-19 18:07:19 -07:00 committed by GitHub
commit 4a11e4accc
3 changed files with 7 additions and 8 deletions

View file

@ -347,7 +347,6 @@ void RenderableModelEntityItem::updateModelBounds() {
return; return;
} }
bool movingOrAnimating = isMovingRelativeToParent() || isAnimatingSomething(); bool movingOrAnimating = isMovingRelativeToParent() || isAnimatingSomething();
glm::vec3 dimensions = getDimensions(); glm::vec3 dimensions = getDimensions();
bool success; bool success;
@ -701,11 +700,12 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
} }
info.setParams(type, dimensions, _compoundShapeURL); info.setParams(type, dimensions, _compoundShapeURL);
} else if (type >= SHAPE_TYPE_SIMPLE_HULL && type <= SHAPE_TYPE_STATIC_MESH) { } else if (type >= SHAPE_TYPE_SIMPLE_HULL && type <= SHAPE_TYPE_STATIC_MESH) {
updateModelBounds();
// should never fall in here when model not fully loaded // should never fall in here when model not fully loaded
assert(_model && _model->isLoaded()); assert(_model && _model->isLoaded());
updateModelBounds();
_model->updateGeometry();
// compute meshPart local transforms // compute meshPart local transforms
QVector<glm::mat4> localTransforms; QVector<glm::mat4> localTransforms;
const FBXGeometry& fbxGeometry = _model->getFBXGeometry(); const FBXGeometry& fbxGeometry = _model->getFBXGeometry();

View file

@ -69,7 +69,6 @@ static const btVector3 _unitSphereDirections[NUM_UNIT_SPHERE_DIRECTIONS] = {
// util method // util method
btConvexHullShape* createConvexHull(const ShapeInfo::PointList& points) { btConvexHullShape* createConvexHull(const ShapeInfo::PointList& points) {
//std::cout << "adebug createConvexHull() points.size() = " << points.size() << std::endl; // adebug
assert(points.size() > 0); assert(points.size() > 0);
btConvexHullShape* hull = new btConvexHullShape(); btConvexHullShape* hull = new btConvexHullShape();
@ -241,7 +240,6 @@ void deleteStaticMeshArray(btTriangleIndexVertexArray* dataArray) {
btCollisionShape* ShapeFactory::createShapeFromInfo(const ShapeInfo& info) { btCollisionShape* ShapeFactory::createShapeFromInfo(const ShapeInfo& info) {
btCollisionShape* shape = NULL; btCollisionShape* shape = NULL;
int type = info.getType(); int type = info.getType();
//std::cout << "adebug createShapeFromInfo() type = " << type << std::endl; // adebug
switch(type) { switch(type) {
case SHAPE_TYPE_BOX: { case SHAPE_TYPE_BOX: {
shape = new btBoxShape(glmToBullet(info.getHalfExtents())); shape = new btBoxShape(glmToBullet(info.getHalfExtents()));

View file

@ -84,6 +84,7 @@ public:
bool readyToAddToScene(RenderArgs* renderArgs = nullptr) const { bool readyToAddToScene(RenderArgs* renderArgs = nullptr) const {
return !_needsReload && isRenderable() && isActive(); return !_needsReload && isRenderable() && isActive();
} }
bool needsReload() const { return _needsReload; }
bool initWhenReady(render::ScenePointer scene); bool initWhenReady(render::ScenePointer scene);
bool addToScene(std::shared_ptr<render::Scene> scene, bool addToScene(std::shared_ptr<render::Scene> scene,
render::PendingChanges& pendingChanges, render::PendingChanges& pendingChanges,
@ -232,6 +233,9 @@ public:
const glm::vec3& getRegistrationPoint() const { return _registrationPoint; } const glm::vec3& getRegistrationPoint() const { return _registrationPoint; }
// returns 'true' if needs fullUpdate after geometry change
bool updateGeometry();
protected: protected:
void setPupilDilation(float dilation) { _pupilDilation = dilation; } void setPupilDilation(float dilation) { _pupilDilation = dilation; }
@ -297,9 +301,6 @@ protected:
std::unordered_set<int> _cauterizeBoneSet; std::unordered_set<int> _cauterizeBoneSet;
bool _cauterizeBones; bool _cauterizeBones;
// returns 'true' if needs fullUpdate after geometry change
bool updateGeometry();
virtual void initJointStates(); virtual void initJointStates();
void setScaleInternal(const glm::vec3& scale); void setScaleInternal(const glm::vec3& scale);