CVEI II

Sometimes the file-management part of extraction is better kept separate.

In this example, we will:

  1. Simulate an Autodesk Maya environment

  2. Extract some data from it

  3. Integrate this data with a server

  4. Without making reference to the simulated environment

Our environment.

import sys

disk = {}
server = {}

class cmds:
  @staticmethod
  def ls(type, assemblies):
    return maya.scene.keys()

  @staticmethod
  def file(path, exportSelected):
    disk[path] = maya.scene[maya.selected]

  @staticmethod
  def select(node):
    maya.selected = node

class maya:
  selected = None
  cmds = cmds
  scene = {
    "john": 0xb3513451, # Binary
    "door": 0x516b481f,
  }

sys.modules["maya"] = maya

We can now from maya import cmds, which we will use during collection and extraction.

Now let's integrate the data from temp on disk into our server.

Putting it all together, this is the full source code.

The key point to take away from this example is that file-management is independent of serialisation.

Last updated

Was this helpful?