Custom Viewer: Area Editor

From WiCWiki

Revision as of 22:12, 20 December 2007 by anchelito (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Contents

by the Insane Bastards & A New Hope

Overview

Version: 0.4 (2007-12-20)
Download: [1]
Requirements: Custom Viewer 0.6

Visit us on Sourceforge: [2]
SVN: https://wiccustomviewer.svn.sourceforge.net/svnroot/wiccustomviewer/CustomViewer/Editors/AreaEditor (you have to join us to upload to the svn)

Wanna help developing?

Visit the Sourceforge-Site and join us!

This is an extension for the Custom Viewer.

About

With the help of the AreaEditor you can place areas in your world and visualize those. Afterwards you can manipulate those and use the areas for other actions, f. ex. creating units.

Instructions

1. Download "areaeditor.py" and put it into the "cust_viewer"-folder 2. Open "cviewer.py" and change the following

2.1 add the following imports somewhere before initViewer is executed:

# from areaeditor.py
from cust_viewer.areaeditor import printAreas
from cust_viewer.areaeditor import initializeAreaEditor

2.2 in "initViewer()" add the following at the end:

# AreaEditor
initializeAreaEditor(myViewer)

2.3.1 If the following methods don't exist, then create those:

def key_act_NUM_PLUS_hold():
    selectedEntry = myViewer.getSelectedEntry()
    selectedEntry.executeActions("plus")
   
def key_act_NUM_MINUS_hold():
    selectedEntry = myViewer.getSelectedEntry()
    selectedEntry.executeActions("minus")

And in the "update()"-method add those four lines:

# check if user holds num-plus-key
checkHoldingKey(KEY_NUM_PLUS, Action(key_act_NUM_PLUS_hold), 0.4, 0.01)

# check if user holds num-minus-key
checkHoldingKey(KEY_NUM_MINUS, Action(key_act_NUM_MINUS_hold), 0.4, 0.01)

2.3.2 If the methods already existed, then adjust those, so that they execute the "plus" and "minus"-actions

2.4 in "update()" add the following in the printing-part:

# print Areas in World
printAreas()

Usage

Navigate as normal. You can manipulate the 3 coordinates of the position and the radius with your num-pads plus- and minus-keys.

API

Members

addedAreas = Container in which the areas are saved (Dictionary<String,Area>), key is "Area" + number

Changelog

Version 0.4 (2007-12-20)

  • restructed CustomViewer - needed for compatibility

Version 0.3 (2007-12-17)

  • added ability to load and save areas (thanks to A new Hope)
  • added ability to remove areas (thanks to A new Hope)

Version 0.2 (2007-12-16)

  • official release
Personal tools
User Created Content