Esempio n. 1
0
void EditableSceneBodyImpl::restoreProperties(const Archive& archive)
{
    Listing& states = *archive["editableSceneBodies"].toListing();
    for(int i=0; i < states.size(); ++i){
        Mapping* state = states[i].toMapping();
        BodyItem* bodyItem = archive.findItem<BodyItem>(state->find("bodyItem"));
        if(bodyItem){
            EditableSceneBodyImpl* impl = bodyItem->sceneBody()->impl;
            impl->showCenterOfMass(state->get("showCenterOfMass", impl->isCmVisible));
            impl->showZmp(state->get("showZmp", impl->isZmpVisible));
        }
    }
}
Esempio n. 2
0
bool PoseSeq::restore(const Mapping& archive, const BodyPtr body)
{
    setTargetBodyName(archive.get("targetBody", body->name()));
                                   
    const Listing& refs = *archive.findListing("refs");

    if(!refs.isValid()){
        return false;
    }
        
    PoseSeq::iterator current = begin();
    
    for(int i=0; i < refs.size(); ++i){
        const Mapping& ref = *refs[i].toMapping();

        bool isInserted = false;

        double time = ref["time"].toDouble();
        
        const ValueNode& referred = ref["refer"];

        if(referred.isScalar()){
            const string& name = referred;
            if(!name.empty()){
                current = insert(current, time, name);
                isInserted = true;
            }
        } else if(referred.isMapping()){
            const Mapping& mReferred = *referred.toMapping();
            const string& type = mReferred["type"];
            PoseUnitPtr poseUnit;
            if(type == "Pose"){
                poseUnit = new Pose();
            } else if(type == "PronunSymbol"){
                poseUnit = new PronunSymbol();
            }
            /*
              else if(type == "PoseSeq"){
              poseUnit = createLocalPoseSeq();
              }
            */
            if(poseUnit && poseUnit->restore(mReferred, body)){
                poseUnit->name_ = mReferred["name"];
                current = insert(current, time, poseUnit);
                isInserted = true;
            }
        }

        if(isInserted){
            current->setMaxTransitionTime(ref.get("maxTransitionTime", 0.0));
        }
    }

    return true;
}
Esempio n. 3
0
void Archive::readOverrides() {
  // Iterate over all files in the directory and override the table of contents
  // if there is a free SEENXXXX.TXT file.
  fs::path seen_dir = fs::path(name).branch_path();
  fs::directory_iterator end;
  for (fs::directory_iterator it(seen_dir); it != end; ++it) {
    string filename = it->leaf();
    if (filename.size() == 12 &&
        istarts_with(filename, "seen") &&
        iends_with(filename, ".txt") &&
        isdigit(filename[4]) &&
        isdigit(filename[5]) &&
        isdigit(filename[6]) &&
        isdigit(filename[7])) {
      Mapping* mapping = new Mapping((seen_dir / filename).string(), Read);
      maps_to_delete_.push_back(mapping);

      int index = lexical_cast<int>(filename.substr(4, 4));
      scenarios[index] = FilePos(mapping->get(), mapping->size());
    }
  }

}
Esempio n. 4
0
void ConfigDialog::restore(const Mapping& archive)
{
    viewMarkerCheck.setChecked(archive.get("showViewMarker", viewMarkerCheck.isChecked()));
    directoryEntry.setText(archive.get("directory", directoryEntry.string()));
    basenameEntry.setText(archive.get("basename", basenameEntry.string()));
    startTimeCheck.setChecked(archive.get("checkStartTime", startTimeCheck.isChecked()));
    startTimeSpin.setValue(archive.get("startTime", startTimeSpin.value()));
    finishTimeCheck.setChecked(archive.get("checkFinishTime", finishTimeCheck.isChecked()));
    finishTimeSpin.setValue(archive.get("finishTime", finishTimeSpin.value()));
    fpsSpin.setValue(archive.get("fps", fpsSpin.value()));
    imageSizeCheck.setChecked(archive.get("setSize", imageSizeCheck.isChecked()));
    imageWidthSpin.setValue(archive.get("width", imageWidthSpin.value()));
    imageHeightSpin.setValue(archive.get("height", imageHeightSpin.value()));
    mouseCursorCheck.setChecked(archive.get("mouseCursor", mouseCursorCheck.isChecked()));
}
Esempio n. 5
0
bool Task::restoreState(AbstractTaskSequencer* sequencer, const Mapping& archive)
{
    sequencer->setCurrentPhase(archive.get("phaseIndex", 0));
    return true;
}