Score::FileError MasterScore::read300(XmlReader& e) { while (e.readNextStartElement()) { const QStringRef& tag(e.name()); if (tag == "programVersion") { setMscoreVersion(e.readElementText()); parseVersion(mscoreVersion()); } else if (tag == "programRevision") setMscoreRevision(e.readInt()); else if (tag == "Score") { if (!read(e)) return FileError::FILE_BAD_FORMAT; } else if (tag == "Revision") { Revision* revision = new Revision; revision->read(e); revisions()->add(revision); } } int id = 1; for (LinkedElements* le : e.linkIds()) le->setLid(this, id++); for (Staff* s : staves()) s->updateOttava(); setCreated(false); return FileError::FILE_NO_ERROR; }
bool MasterScore::read(XmlReader& e) { if (!Score::read(e)) return false; for (Staff* s : staves()) s->updateOttava(); setCreated(false); return true; }
//-------------------------------------------------------------- void ofxBulletSoftTriMesh::create( ofxBulletWorldSoft* a_world, ofMesh& aMesh, btTransform &a_bt_tr, float a_mass ) { if(a_world == NULL) { ofLogError("ofxBulletSoftTriMesh") << "create(): a_world param is NULL"; return; } if( aMesh.getMode() != OF_PRIMITIVE_TRIANGLES ) { ofLogError("ofxBulletSoftTriMesh") << " only excepts meshes that are triangles"; return; } _world = a_world; _cachedMesh.clear(); _cachedMesh = aMesh; if( bullet_vertices != NULL ) { delete bullet_vertices; bullet_vertices = NULL; } int vertStride = sizeof(btVector3); int indexStride = 3*sizeof(int); int totalVerts = (int)aMesh.getNumVertices(); int totalIndices = (int)aMesh.getNumIndices(); bullet_vertices = new btScalar[ totalVerts * 3 ]; int* bullet_indices = new int[ totalIndices ]; auto& tverts = aMesh.getVertices(); vector< ofIndexType >& tindices = aMesh.getIndices(); for( int i = 0; i < totalVerts; i++ ) { bullet_vertices[i*3+0] = tverts[i].x; bullet_vertices[i*3+1] = tverts[i].y; bullet_vertices[i*3+2] = tverts[i].z; } for( int i = 0; i < totalIndices; i++ ) { bullet_indices[i] = tindices[i]; } _softBody = btSoftBodyHelpers::CreateFromTriMesh( _world->getInfo(), bullet_vertices, bullet_indices, totalIndices/3 ); _softBody->transform( a_bt_tr ); setMass( a_mass, true ); setCreated(_softBody); createInternalUserData(); delete [] bullet_indices; }
//------------------------------------------------------------- void ConeGeometry::init(DolfinGui *ui) { setPointCount(6); setRadiusCount(2); setCreated(false); setGuiWindow(ui); setPoints(new double[getPointCount()]); setPoints(new double[getRadiusCount()]); setMyType("Cone"); }
void EntryData::resetCreation() { if (!isEmpty()) { qDebug() << "EntryData::resetCreation: Refusing because not empty"; return; } setCreated(QDateTime::currentDateTime()); setModified(QDateTime::currentDateTime()); foreach (BlockData *b, blocks()) { b->setCreated(QDateTime::currentDateTime()); b->setModified(QDateTime::currentDateTime()); }
//-------------------------------------------------------------- void ofxBulletEllipsoid::create(ofxBulletWorldSoft* a_world, const ofVec3f& a_center, const ofVec3f& a_radius, int a_res) { if(a_world == NULL) { ofLogError("ofxBulletEllipsoid") << "create(): a_world param is NULL"; return; } _radius = a_radius; _world = a_world; _softBody = btSoftBodyHelpers::CreateEllipsoid(_world->getInfo(), btVector3(a_center.x, a_center.y, a_center.z), btVector3(a_radius.x, a_radius.y, a_radius.z), a_res); setCreated(_softBody); createInternalUserData(); }
//-------------------------------------------------------------- void ofxBulletPatch::create(ofxBulletWorldSoft* a_world, const ofVec3f& a_p0, const ofVec3f& a_p1, const ofVec3f& a_p2, const ofVec3f& a_p3, int a_resx, int a_resy) { if(a_world == NULL) { ofLogError("ofxBulletPatch") << "create(): a_world param is NULL"; return; } _resx = a_resx; _resy = a_resy; _world = a_world; _softBody = btSoftBodyHelpers::CreatePatch(_world->getInfo(), btVector3(a_p0.x, a_p0.y, a_p0.z), btVector3(a_p1.x, a_p1.y, a_p1.z), btVector3(a_p2.x, a_p2.y, a_p2.z), btVector3(a_p3.x, a_p3.y, a_p3.z), a_resx, a_resy, 0, true ); setCreated(_softBody); createInternalUserData(); }
void AbstractGraphicsRectItem::createShape(const QPointF &start, const QPointF &end) { QPointF tl, br; QPointF d = end-start; if (d.x() > 0 && d.y() > 0) { tl = start; br = end; } else if (d.x() < 0 && d.y() < 0) { tl = end; br = start; } else if (d.x() > 0 && d.y() < 0) { tl = QPointF(start.x(), end.y()); br = QPointF(end.x(), start.y()); } else if (d.x() < 0 && d.y() > 0) { tl = QPointF(end.x(), start.y()); br = QPointF(start.x(), end.y()); } updateRect(QRectF(tl, br)); setCreated(true); }
//-------------------------------------------------------------- void ofxBulletCustomShape::add() { _bAdded = true; btTransform trans; trans.setIdentity(); for(int i = 0; i < centroids.size(); i++) { _centroid += centroids[i]; } if(centroids.size() > 0) _centroid /= (float)centroids.size(); btVector3 shiftCentroid; for(int i = 0; i < shapes.size(); i++) { shiftCentroid = btVector3(centroids[i].x, centroids[i].y, centroids[i].z); shiftCentroid -= btVector3(_centroid.x, _centroid.y, _centroid.z); trans.setOrigin( ( shiftCentroid ) ); ((btCompoundShape*)_shape)->addChildShape( trans, shapes[i]); } _rigidBody = ofGetBtRigidBodyFromCollisionShape( _shape, _startTrans, _mass); setCreated(_rigidBody); createInternalUserData(); _world->addRigidBody(_rigidBody); setProperties(.4, .75); setDamping( .25 ); }