void PlotWidget::saveMarkers (DataBase &db) { // save plot markers QHashIterator<QString, Plot *> pit(_plots); while (pit.hasNext()) { pit.next(); Plot *p = pit.value(); QHash<QString, Marker *> markers = p->markers(); QHashIterator<QString, Marker *> mit(markers); while (mit.hasNext()) { mit.next(); Marker *m = mit.value(); if (m->readOnly()) continue; if (! m->modified()) continue; Entity *e = m->settings(); e->setName(mit.key()); db.transaction(); db.set(e); db.commit(); m->setModified(FALSE); } } }
// ***************************************************************************** MStatus GtoIO::reader( const MFileObject &file, const MString &optionsString, MPxFileTranslator::FileAccessMode mode ) { MString filename = file.fullName(); bool readAsDifference = false; int fs = 0; int fe = 0; MStringArray args; optionsString.split( ';', args ); for( size_t i = 0; i < args.length(); ++i ) { MStringArray thisArg; args[i].split( '=', thisArg ); MString argName( thisArg[0] ); MString argValue( thisArg[1] ); if( argName == "readDiff" && argValue == "1" ) { readAsDifference = true; } else if( argName == "fs" ) { fs = argValue.asInt(); } else if( argName == "fe" ) { fe = argValue.asInt(); } } if( readAsDifference ) { MGlobal::displayInfo( "PreMunge name: " + filename ); if( filename.index( '#' ) < 0 ) { // By this point, Maya will have already appended a // ".gto" to the filename if the user didn't include it, // so we're guaranteed to find a '.' in the filename filename = filename.substring( 0, filename.index( '.' ) ) + "#.gto"; } for( int f = fs; f <= fe; ++f ) { MGlobal::viewFrame( MTime( double(f) ) ); MString fname = replaceFrameCookies( filename, f ); MGlobal::displayInfo( "Reading " + fname ); DataBase dataBase; Set *set = dataBase.set( fname.asChar() ); if( set == NULL ) { MGlobal::displayError( "Unable to open file for some " "reason. Permissions?" ); return MS::kFailure; } set->computeLocalTransforms(); set->declareMayaDiff(); dataBase.destroyAll(); } } else { DataBase dataBase; Set *set = dataBase.set( filename.asChar() ); if( set == NULL ) { MGlobal::displayError( "Unable to open file for some " "reason. Permissions?" ); return MS::kFailure; } set->computeLocalTransforms(); set->declareMaya(); set->reparentAll(); dataBase.destroyAll(); } return MS::kSuccess; }