Molecule Viewer

From Blue Mars Developer Guidebook

Jump to: navigation, search
There are security restrictions on this article

Here's a molecule visualization level in which a script downloads a data file describing a molecule and then displays it.

Image:Moleculedownload.JPG

And here's the download state in the script. The download is initiated in OnBeginState, the download progress is monitored and displayed in OnUpdate and the downloaded file is processed in OnEndState.

ARMoleculeViewer.Download =
{
  OnBeginState = function(self)
    ARDownloadFile(self.url,self.file);
  end,
  OnUpdate = function(self,delta)
    ARPrintReset();
    if Game.IsDownloading() then
      ARDownloadProgress();
    else
      ARPrint("Download complete - rebuilding molecule");
      self:GotoState(Show);
    end
  end,
  OnEndState = function(self)
    if self.molecule then
      self.molecule.Properties.sFile=self.file;
      self.molecule:OnInit(); -- force recreation of molecule
    end
  end,
}

Problems with this wiki page? Contact us either by: Support Email or Support Ticket System

Blue Mars Guidebook Privacy Policy
Blue Mars Guidebook Community Guidelines

Personal tools