ASPECT2D EDITOR

USER GUIDE

 

 

Firstly, I have to explain that my editor consists of 2 interfaces : script (setting up nodes) and visual interface (changing node's transform only). It means, in your script, you have to mark the nodes which you want to edit visually. Next, during runtime, if you enable edit session, you would be able to change their transform visually.

 

 

PART 1 (SCRIPT INTERFACE) :

MARKING THE NODES

 

I already included a World class which implements this. You could open World.py to see the entire details.

 

1. You have to create only 1 instance of AutoSaveAspect2d class.

In World.py, I simply put the instance (A2Ded) in builtins dictionary, so it can be used by any class you have.

 

# start AutoSaveAspect2d up, load previously saved dictionary

# from file : "project_A2D.abc" (ASCII) or "project_A2D.bin" (binary).

# If you don't want to enable edit session,

# set enableEditSession = False

__builtins__.A2Ded = AutoSaveAspect2d(

myFile='project_A2D',

enterEditSessionKey='f5',

loadASCII=1, saveBinaryToo=1,

enableEditSession=True )

 

The arguments are :

It's the filename (without extension) to save the transform setting of the nodes.

It's the button key to start edit session. You could change it if you need that key for something else.

It means to load the setting from the ASCII file, rather than the binary one. If the ASCII file not found, it would try to load the binary one, and if both not found, it uses the transform as it is (from script only). Set this argument to 0 to load the binary one.

By default, the transform setting always stored as ASCII file. If this argument is set to 1, the transform setting also stored as binary file.

If set to 0 or False, you wouldn't be able to start edit session.

 

2. Once you want to save your node's transform, call :

 

A2Ded.save( yourNodePath, hardcoded_ID )

 

The arguments are :

        yourNodePath

The NodePath you wish to edit visually.

        hardcoded_ID

It's a unique everlasting identification number or string, which is used to mark the node. It acts as a link between the node and the saved transform in file. I just don't want to use the node's name, since there could be multiple nodes having the same name, and I'd like to use node's name for more general purposes. In fact, that ID is used as tag on the node.

Any children node under yourNodePath, if is not tagged already, will be tagged according to its parent's tag.

Example : if the parent is tagged with "1234" number, the not-tagged children will be tagged with "1234-#", which # means child's index. It will be "1234-0", "1234-1", "1234-2", and so on.

WARNING : if there are several nodes having the same ID, they would share the same transform. It's your own responsibility to avoid that.

Additional arguments :

The default is 1 (True), which means to use the saved transform in file. Set it to 0 to use the transform from script only.

The default behaviour is recursive, so you should use this argument only if you don't want yourNodePath's child(ren) to be editable.

You could pass :

  1 (True) : if you want to exclude all yourNodePath's children, or

  the children's index list : only children with those index are excluded (pack the index in a list).

Example in World.py is Dialog3 :

A2Ded.save(dialog3,87546,excludeChildren=1) # don't save buttons' transform

 

 

 

 

 

 

 

 

 

PART 2 (VISUAL INTERFACE) :

EDIT SESSION

 

To enter Edit Session, press the passed enterEditSessionKey when creating AutoSaveAspect2d instance, the default is F5.

 

Edit session started with some preparation process, which may takes 1 second or 2. Once completed, you would see something like this :

 

 

indicating that you can start changing the transform of previously marked nodes visually.

 

Press F1 to read the main help.

 

 

A. SELECTING THE NODE

What you just saw is the Select Mode. In this mode, you could select which node you want to edit, just by pointing your mouse on the node. Then, the node would be highlighted (changing color to red) and the bounding box would be drawn (the cycling dashed-line box), also itself and its parents would be displayed on a selectable list. On the list, the red-highlighted button is the currently selected node. The selected node's relative position (to render2d) is displayed on the screen edges.

 

 

You can select one of the parent node in the list by clicking the button, or using keyboard :

 

Alternatively, you could use the Aspect2dSceneGraph tree, press CapsLock to toggle. The hover-on-node select is disabled when you're using it. The non-editable nodes are grayed.

 

 

You still able to use keyboard keys to select node/parent. To scroll the window, drag the white thumb bar on the left, or use Ctrl-MouseWheel.

 

 

 

B. EDITING THE NODE

Once you have selected the desired node, you can start editing them in Edit Mode. To enter Edit Mode, press SPACE, or click the highlighted button on the list. Once in the Edit Mode, the node's highlight changes from red to green. The node's origin is represented by the intersection of the yellow-black lines. There is additional help for Edit Mode, displayed following the mouse cursor, press H to toggle.

 

Currently, the editable node's transform are only translation and scale.

 

1. TRANSFORMING USING MOUSE

To drag the node around, use LeftMouseButton.

To scale it, use Ctrl-LeftMouseButton.

Once you're satisfied with the transform, you can keep it by pressing SPACE, or discard it by pressing ESCAPE. Both would bring you back to Select Mode.

 

SNAP !

There are several snap targets available :

SNAP MARKER

SNAP TARGET

TOGGLE KEY

grid

grid

1

Other Node's

Edited Node's

On snap

 

Other-type node origin

2

GeomNode origin

3

GeomNode bounding box corner

4

GeomNode bounding box mid-point

5

Other-type node bounding box corner

6

Other-type node bounding box mid-point

7

 

You can snap to these markers both for dragging and scaling.

For all snapped target during Edit Mode, there are also extension lines and point-marker (to distinguish which target has extension lines). The extension lines extend from the snap point to 2 directions, horisontal & vertical, displayed only when your "dropping-point" is close to them. It's the black and white dashed line.

If the "dropping-point" is close to the intersection of 2 extension lines, it would be snapped to the intersection point, which would be marked with red cross.

 

The rules :

Example (dragging) :

 

Example (dragging) :

 

Example (scaling) :

(For scaling, if you snap to node's corner or mid-point marker, the scale anchor would be automatically set on the opposite snap target. Don't be confused with the corner & mid-point markers of the node's children, since once you press Ctrl, all snap markers of the node's children would be temporarily hidden, and re-drawed once you release Ctrl.)

 

Example (scaling & snap to grid) :

 

You also able to enable/disable snap target's extension lines by clicking inside the marker, using RightMouseButton.

 

 

2. USING PROPERTIES PANEL

There is other way in editing the node's transform, which is by typing the transform numbers directly. You can do this using Properties Panel, press ~ (tilde) to toggle.

 

You could input the numbers as you like. The input box (customized DirectEntry) has value validity-check, so if your input is invalid (in this case e.g. a string), an "INVALID" notification text would be displayed, as well as the expected value-type reminder.

You can cancel the input by pressing ESCAPE.

 

You also able to copy & paste the transform to other node. The copy process copies the whole transform, while the paste process uses the XYZ filters. Only the checked filters transform would be overriden. You could use the COPY & PASTE button on the panel, as well as Ctrl-C and Ctrl-V.

 

Properties Panel is available both in Select Mode and Edit Mode, so transferring the transform is this easy :

 

 

 

 

 

 

......end...of...file