void ParticleDef::parseFromTokens(parser::DefTokeniser& tok) { // Clear out the particle def (except the name) before parsing clear(); // Any global keywords will come first, after which we get a series of // brace-delimited stages. std::string token = tok.nextToken(); while (token != "}") { if (token == "depthHack") { setDepthHack(string::convert<float>(tok.nextToken())); } else if (token == "{") { // Construct/Parse the stage from the tokens StageDefPtr stage = make_shared<StageDef>(ref(tok)); // Append to the ParticleDef appendStage(stage); } // Get next token token = tok.nextToken(); } _changedSignal.emit(); }
void Sculptor::finishStage() { if(!currentStage()->isEmpty() ) { sdb::Array<int, VertexP> * stg = m_stages[m_activeStageId]; stg->begin(); while(!stg->end()) { VertexP * vert = stg->value(); /// N <- P *(vert->index->t2) = *(vert->index->t1); stg->next(); } m_activeStageId++; if(m_activeStageId >= m_stages.size()) appendStage(); else m_stages[m_activeStageId]->clear(); if(m_stages.size() > 200) { /// limit num stages delete m_stages[0]; m_stages.erase(m_stages.begin() ); m_activeStageId--; } std::cout<<"\n finish stage "<<m_activeStageId-1 <<" add "<<m_activeStageId; } }
Sculptor::Sculptor() { m_tree = new WorldGrid<Array<int, VertexP>, VertexP >; m_active = new ActiveGroup; m_active->reset(); m_strength = 0.5f; m_topo = NULL; m_activeStageId = 0; appendStage(); m_refP = new Array<int, Vector3F >; }
void Sculptor::redo() { if(currentStage()->isEmpty() ) return; sdb::Array<int, VertexP> * stg = m_stages[m_activeStageId]; revertStage(stg, false); m_lastStage = stg; m_activeStageId++; if(m_activeStageId>=m_stages.size() ) appendStage(); std::cout<<"\n redo stage "<<m_activeStageId-1<<" current "<<m_activeStageId; }
CSMTools::SearchOperation::SearchOperation (CSMDoc::Document& document) : CSMDoc::Operation (CSMDoc::State_Searching, false) { std::vector<CSMWorld::UniversalId::Type> types = CSMWorld::UniversalId::listTypes ( CSMWorld::UniversalId::Class_RecordList | CSMWorld::UniversalId::Class_ResourceList ); for (std::vector<CSMWorld::UniversalId::Type>::const_iterator iter (types.begin()); iter!=types.end(); ++iter) appendStage (new SearchStage (&dynamic_cast<CSMWorld::IdTableBase&> ( *document.getData().getTableModel (*iter)))); setDefaultSeverity (CSMDoc::Message::Severity_Info); }
CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& projectPath, ToUTF8::FromType encoding) : Operation (State_Saving, true, true), mDocument (document), mState (*this, projectPath, encoding) { // save project file appendStage (new OpenSaveStage (mDocument, mState, true)); appendStage (new WriteHeaderStage (mDocument, mState, true)); appendStage (new WriteFilterStage (mDocument, mState, CSMFilter::Filter::Scope_Project)); appendStage (new CloseSaveStage (mState)); // save content file appendStage (new OpenSaveStage (mDocument, mState, false)); appendStage (new WriteHeaderStage (mDocument, mState, false)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Global> > (mDocument.getData().getGlobals(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::GameSetting> > (mDocument.getData().getGmsts(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Skill> > (mDocument.getData().getSkills(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Class> > (mDocument.getData().getClasses(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Faction> > (mDocument.getData().getFactions(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Race> > (mDocument.getData().getRaces(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Sound> > (mDocument.getData().getSounds(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Script> > (mDocument.getData().getScripts(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Region> > (mDocument.getData().getRegions(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::BirthSign> > (mDocument.getData().getBirthsigns(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Spell> > (mDocument.getData().getSpells(), mState)); appendStage (new WriteDialogueCollectionStage (mDocument, mState, false)); appendStage (new WriteDialogueCollectionStage (mDocument, mState, true)); appendStage (new WriteRefIdCollectionStage (mDocument, mState)); appendStage (new CloseSaveStage (mState)); appendStage (new FinalSavingStage (mDocument, mState)); }
CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& projectPath, ToUTF8::FromType encoding) : Operation (State_Saving, true, true), mDocument (document), mState (*this, projectPath, encoding) { // save project file appendStage (new OpenSaveStage (mDocument, mState, true)); appendStage (new WriteHeaderStage (mDocument, mState, true)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Filter> > ( mDocument.getData().getFilters(), mState, CSMWorld::Scope_Project)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::DebugProfile> > ( mDocument.getData().getDebugProfiles(), mState, CSMWorld::Scope_Project)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Script> > ( mDocument.getData().getScripts(), mState, CSMWorld::Scope_Project)); appendStage (new CloseSaveStage (mState)); // save content file appendStage (new OpenSaveStage (mDocument, mState, false)); appendStage (new WriteHeaderStage (mDocument, mState, false)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Global> > (mDocument.getData().getGlobals(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::GameSetting> > (mDocument.getData().getGmsts(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Skill> > (mDocument.getData().getSkills(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Class> > (mDocument.getData().getClasses(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Faction> > (mDocument.getData().getFactions(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Race> > (mDocument.getData().getRaces(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Sound> > (mDocument.getData().getSounds(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Script> > (mDocument.getData().getScripts(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Region> > (mDocument.getData().getRegions(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::BirthSign> > (mDocument.getData().getBirthsigns(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Spell> > (mDocument.getData().getSpells(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::Enchantment> > (mDocument.getData().getEnchantments(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::BodyPart> > (mDocument.getData().getBodyParts(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::SoundGenerator> > (mDocument.getData().getSoundGens(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::MagicEffect> > (mDocument.getData().getMagicEffects(), mState)); appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::StartScript> > (mDocument.getData().getStartScripts(), mState)); appendStage (new WriteDialogueCollectionStage (mDocument, mState, false)); appendStage (new WriteDialogueCollectionStage (mDocument, mState, true)); appendStage (new WriteRefIdCollectionStage (mDocument, mState)); appendStage (new CollectionReferencesStage (mDocument, mState)); appendStage (new WriteCellCollectionStage (mDocument, mState)); appendStage (new WritePathgridCollectionStage (mDocument, mState)); appendStage (new WriteLandCollectionStage (mDocument, mState)); appendStage (new WriteLandTextureCollectionStage (mDocument, mState)); // close file and clean up appendStage (new CloseSaveStage (mState)); appendStage (new FinalSavingStage (mDocument, mState)); }