URCHN Arkipelago Reference desk

Reference desk

From URCHN Arkipelago
Revision as of 09:13, 1 September 2015 by Bassam (talk | contribs) (→‎JSON file format)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Reference Desk is a Blender Addon developed for tube by Christopher Allan Webber, of Mediagoblin fame, and further tweaked by Bassam Kurdali.

Theory of operation

Reference Desk uses a JSON file 'library.json' to store a list of tasks per linked asset :

- groups to link and instance - groups to link only - scripts to link - scripts to run after linking all of the above.

It presents an interface in the Toolbox area of the 3D view (left side panels), with a search box and a set of buttons for each asset. For each button pressed, it will look up the asset in the JSON file, link in all items, and then run the post install script on them. This allows you to link e.g. the entire station by one button press.

Installation and Usage

  1. install the addon: file->user preferences->addons tab->Install addon: $SVNROOT/lib/python/addons/reference_desk.py - If installing from another location, just use the file referencedesk.py .
    Refdesk addon.png
  2. enable the addon, and save your user preferences, you'll get a rather useless panel in your toolbar.
    Blank refdesk.png
  3. There will be a new Tab in the toolbar called 'Assets' with a panel called Reference Desk
  4. In a scene file: There is now a button in the called "Select Library" that opens a file browser. In tube the library is called "library.json" and resides in the top level of the project SVN tree.
  5. the buttons will appear in the reference desk panel in the toolbar. Add library assets at will.
    Refdesk.png
  6. For people creating Assets, it is now possible to add directly the asset in the reference desk panel. See below.


Creating Assets

Refdesk unlocked.png
  1. Press Select Library and pick the library file to add to.
  2. Press the unlock Icon in the Reference Desk Header
  3. Fill in the case sensitive Category for your asset.
  4. Fill in the case sensitive Name for your asset (how it will appear on the button). Make sure it is not taken
  5. Now you can add multiple items to the asset - text files, groups, actions, materials, or objects. to add a new item, simply click on the approprate item on the right of the list box.
  6. To add python scripts to your asset press the script icon. clicking the checkbox will run the script instantly on add.
  7. To add groups to your asset press the group icon. clicking the checkbox will make the group added to the scene, otherwise, it only shows up in the outliner.
  8. To add Actions press the action icon. the checkbox causes the action to be linked rather than appended (Recommended)
  9. To add Materials press the material icon. The checkbox works like the action checkbox. (on means link)
  10. To add Objects press the object icon.
  11. Press the Store New Asset button
  12. When adding a new asset *make sure you use an unused name* or all hell will break loose :)
  13. Make sure you commit the library.json file or nobody will see your changes.


Editing Assets

Not done yet! For now you'll need to edit the .json file directly

Deleting Assets

Not done yet! For now you'll need to edit the .json file directly

JSON file format

The library file uses JSON to point to the various items to be linked. An example is listed below. Note that JSON is a very easy format, indeed, it looks a lot like python lists/dictionary data structures, so shouldn't be too hard to figure out. Future enhancements could be an interface for editing the JSON directly for removing or editing existing assets.


{"Characters": {
    "Gilgamesh": {
        "instance_groups": [
            ["lib/models/chars/gilgamesh.blend", "gilga_HI"]],
        "noninstance_groups": [
            ["lib/models/chars/gilgamesh.blend", "gilga_PROX"]],
        "noninstance_groups": [
            ["lib/models/chars/gilgamesh.blend", "gilga_FACP"]],
        "require_python_texts": [
            ["lib/models/chars/gilgamesh.blend", "tuberigUI.py"]],
        "exec_python_posthooks": [
            ["lib/models/chars/gilgamesh.blend", "__gilgamesh_post.py"]]},
    "Gilga Roach Close": {
        "instance_groups": [
            ["lib/models/chars/gilga_roach.blend", "Roach_HI"]],
        "require_python_texts": [
            ["lib/models/chars/roach.blend", "tube_roach_rigui.py"]],
        "exec_python_posthooks": [
            ["lib/models/chars/gilga_roach.blend", "__groach_post.py"]]},
    "Enkidu Roach Close": {
        "instance_groups": [
            ["lib/models/chars/enkidu_roach.blend", "Roach_HI"]],
        "require_python_texts": [
            ["lib/models/chars/roach.blend", "tube_roach_rigui.py"]],
        "exec_python_posthooks": [
            ["lib/models/chars/enkidu_roach.blend", "__eroach_post.py"]]},
    "Roach Close": {
        "instance_groups": [
            ["lib/models/chars/roach.blend", "Roach_HI"]],
        "noninstance_groups": [
            ["lib/models/chars/roach.blend", "Roach_LO"]],
        "require_python_texts": [
            ["lib/models/chars/roach.blend", "tube_roach_rigui.py"]],
        "exec_python_posthooks": [
            ["lib/models/chars/roach.blend", "__roach_post.py"]]},
    "Roach Medium": {
        "instance_groups": [
            ["lib/models/chars/roach.blend", "Roach_MED_HI"]],
        "noninstance_groups": [
            ["lib/models/chars/roach.blend", "Roach_LO"]],
        "require_python_texts": [
            ["lib/models/chars/roach.blend", "tube_roach_rigUI.py"]],
        "exec_python_posthooks": [
            ["lib/models/chars/roach.blend", "__roach_post.py"]]},
    "Roach Far": {
        "instance_groups": [
            ["lib/models/chars/roach.blend", "Roach_FAR_HI"]],
        "noninstance_groups": [
            ["lib/models/chars/roach.blend", "Roach_LO"]],
        "require_python_texts": [
            ["lib/models/chars/roach.blend", "tube_roach_rigUI.py"]],
        "exec_python_posthooks": [
            ["lib/models/chars/roach.blend", "__roach_post.py"]]}},
"Sets": {
    "Full Station": {
        "instance_groups": [
            ["lib/models/sets/pedestal_details.blend", "pedestal_details_V"],
            ["lib/models/sets/station.blend", "station_HI"],
            ["lib/models/sets/ground.blend", "ground_HI"]],
        "noninstance_groups": [
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_HI_1"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_HI_2"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_HI_3"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_HI_gap"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_LO_1"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_LO_2"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_LO_3"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_LO_gap"],
            ["lib/models/sets/track_mid.blend", "track_mid_HI"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_box"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_box_line"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_concrete"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_tubes"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_wires_1"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_wires_2"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_wires_3"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_rail"],
            ["lib/models/sets/track_mid.blend", "track_mid_LO"],
            ["lib/models/sets/column.blend", "base_HI"],
            ["lib/models/sets/column.blend", "base_LO"],
            ["lib/models/sets/column.blend", "base2_HI"],
            ["lib/models/sets/column.blend", "base2_LO"],
            ["lib/models/sets/platform.blend", "platform_HI_1"],
            ["lib/models/sets/platform.blend", "platform_V_boxes"],
            ["lib/models/sets/platform.blend", "platform_V_escalator"],
            ["lib/models/sets/platform.blend", "platform_V_papers"],
            ["lib/models/sets/platform.blend", "platform_V_tubes"],
            ["lib/models/sets/platform.blend", "platform_V_wire"],
            ["lib/models/sets/platform.blend", "platform_HI_2"],
            ["lib/models/sets/platform.blend", "platform_LO"],
            ["lib/models/sets/station.blend", "station_LO"],
            ["lib/models/sets/ground.blend", "ground_LO"]],
        "exec_python_posthooks": [
            ["lib/models/sets/pedestal_messy.blend", "__pedestal_messy.py"],
            ["lib/models/sets/track_mid.blend", "__trackmid_post.py"],
            ["lib/models/sets/column.blend", "__column_post.py"],
            ["lib/models/sets/platform.blend", "__platform_post.py"]]},
    "Escalator": {
        "instance_groups": [
            ["lib/models/sets/escalator.blend", "escalator_HI"]],
        "noninstance_groups": [
            ["lib/models/sets/escalator.blend", "escalator_LO"]]},

    "Station": {
        "instance_groups": [
            ["lib/models/sets/station.blend", "station_HI"]],
        "noninstance_groups": [
            ["lib/models/sets/station.blend", "station_LO"]]},
    "Ground": {
        "instance_groups": [
            ["lib/models/sets/ground.blend", "ground_HI"]],
        "noninstance_groups": [
            ["lib/models/sets/ground.blend", "ground_LO"]]},
    "Platform sides": {
        "noninstance_groups": [
            ["lib/models/sets/column.blend", "base_HI"],
            ["lib/models/sets/column.blend", "base_LO"],
            ["lib/models/sets/column.blend", "base2_HI"],
            ["lib/models/sets/column.blend", "base2_LO"],
            ["lib/models/sets/platform.blend", "platform_HI_1"],
            ["lib/models/sets/platform.blend", "platform_V_boxes"],
            ["lib/models/sets/platform.blend", "platform_V_escalator"],
            ["lib/models/sets/platform.blend", "platform_V_papers"],
            ["lib/models/sets/platform.blend", "platform_V_tubes"],
            ["lib/models/sets/platform.blend", "platform_V_wire"],
            ["lib/models/sets/platform.blend", "platform_HI_2"],
            ["lib/models/sets/platform.blend", "platform_LO"]],
        "exec_python_posthooks": [
            ["lib/models/sets/column.blend", "__column_post.py"],
            ["lib/models/sets/platform.blend", "__platform_post.py"]]},
    "Station Rails": {
        "noninstance_groups": [
            ["lib/models/sets/track_mid.blend", "track_mid_HI"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_box"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_box_line"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_concrete"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_tubes"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_wires_1"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_wires_2"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_wires_3"],
            ["lib/models/sets/track_mid.blend", "track_mid_V_rail"],
            ["lib/models/sets/track_mid.blend", "track_mid_LO"]],
        "exec_python_posthooks": [
            ["lib/models/sets/track_mid.blend", "__trackmid_post.py"]]},
    "Messy Pedestals": {
        "instance_groups": [
            ["lib/models/sets/pedestal_details.blend", "pedestal_details_V"]],
        "noninstance_groups": [
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_HI_1"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_HI_2"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_HI_3"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_HI_gap"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_LO_1"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_LO_2"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_LO_3"],
            ["lib/models/sets/pedestal_messy.blend", "pedestal_messy_LO_gap"]],
        "exec_python_posthooks": [
            ["lib/models/sets/pedestal_messy.blend", "__pedestal_messy.py"]]}},
"Props": {
    "telephone": {
        "instance_groups": [
            ["lib/models/props/phone.blend", "telephone"]]},
    "gearbox": {
        "instance_groups": [
            ["lib/models/props/gearbox.blend", "gearbox"]]},
    "paper one hand": {
        "instance_groups": [
            ["lib/models/props/paper_hands_3.blend", "paper_inhand3"]],
        "require_python_texts": [
            ["lib/models/props/paper_hands_3.blend", "tube_pnh3_rigui.py"]],
        "exec_python_posthooks": [
            ["lib/models/props/paper_hands_3.blend", "__PNH_3_post.py"]]},
    "paper two hands": {
        "instance_groups": [
            ["lib/models/props/paper_hands_2.blend", "paperinhand_2_HI"]],
        "require_python_texts": [
            ["lib/models/props/paper_hands_2.blend", "tube_pnh2_rigui.py"]],
        "exec_python_posthooks": [
            ["lib/models/props/paper_hands_2.blend", "__PNH_2_post.py"]]},
    "gearbox_noninstance": {
        "noninstance_groups": [
            ["lib/models/props/gearbox.blend", "gearbox"]]},
    "gearbox_and_telephone": {
        "instance_groups": [
            ["lib/models/props/phone.blend", "telephone"],
            ["lib/models/props/gearbox.blend", "gearbox"]]}},
"Vehicles": {
    "Train Interior": {
        "instance_groups": [
            ["lib/models/vehicles/train_interior.blend", "train_int_HI"]],
        "noninstance_groups": [
            ["lib/models/vehicles/train_interior.blend", "train_int_LO"]]},
    "Train": {
        "noninstance_groups": [
            ["lib/models/vehicles/train.blend", "engine_HI"],
            ["lib/models/vehicles/train.blend", "engine_LO"],
            ["lib/models/vehicles/train.blend", "train_HI"],
            ["lib/models/vehicles/train.blend", "train_LO"],
            ["lib/models/vehicles/train.blend", "rearengine_HI"],
            ["lib/models/vehicles/train.blend", "rearengine_LO"]],
        "require_python_texts": [
            ["lib/models/vehicles/train.blend", "trainmaker.py"]],
       "exec_python_posthooks": [
            ["lib/models/vehicles/train.blend", "__train_post.py"]]}}}