Skip to content
James Lott edited this page Mar 10, 2018 · 4 revisions

Synopsis

from mkpython.dumper import BaseDumper
from mkpython.dumper import DumperError

class MyDumper(BaseDumper):
  def dump(self, pack):
    try:
      for path in pack.paths():
        data = pack.data(path)
        self._write_asset(path, data)
    except EnvironmentError as e:
      raise DumperError(e)
  def _write_asset(self, path, data):
    full_path = '%s/%s' % (self.location, path)
    # Some other business logic to write the data to its destination

BaseDumper.location

This value represents the base location which the write destination of all other assets should be relative to. It is populated by __init__().

BaseDumper.dump

Spec

instance.dump(pack)

Description

This method must be implemented by each dumper class. Its job is to determine the write destination for each asset in the AssetPack passed in pack and write the asset data to that destination. If any asset fails to write for any reason, this method is expected to raise a DumperError.

Clone this wiki locally