Visual VM Blocks

Top  Previous  Next

Edit VM Commands using Visual Block Editor

Depending on your settings, the Edit button in Customize VM commands will take you to Visual block Editor or Script Editor.

clip0104

You can switch between these editors directly on the Customize VM commands dialog. By default Block editor is selected, but you can change the default settings in Project Properties - tab Advanced:

properties

You can even switch between these editors if already a VM Script or VM blocks exist. The Software will inform you that

Blocks to Script, the blocks will be translated to VM Commands code
Script to Blocks, the script can either expand to blocks, or create single Script Block.

Visual Block Editor

The VM Block editor is a special aid in writing VM commands. It overcome the old programming problem with static script code where for example having Goto 15 or Link PGC 10 works as long as we don't change the code in first case or order of objects in second case. If we do, then Goto may point to wrong line or Link command can point to object that is no longer the one we wanted.

VM Blocks will simplify writing VM commands by creating a dynamic code. Goto commands simply point to a block and keep the relation even if we reorder, add or delete blocks. Link commands will point to a named object like Menu 2 or Movie 10 and we don't have to worry that this will ever change if we reorder our objects. Also we don't have to remember what type of command is needed to execute such link, it may be JumpSS, LinkPGC, CallSS etc, the block editor will take care of using the correct one.

blocks2

Block Editor is a very unique tool in DVD-lab PRO, that is both visual and highly functional.

There are five basic blocks:

Operator
Link
Script
if-Goto
if-Link

You add the block by clicking on the top buttons with these basic names. A properties window will open with options how to set the block. For example Operator will open properties like the below:

blocks6

A Script Block will open the old known VM Script Editor

Editing Blocks

If you want to edit the blocks simply double-click on it.

Rearrange Blocks

You can simply drag any block and move it up or down.

Registers Alias

The GPRM registers can have alias in Block editor. So for example instead of GPRM0 = 4 we can use Counter = 100 if we change alias of GPRM0 to Counter. Simply double click on the green area of the register alias and type new name.

blockalias

This is dynamic, any time we change the name, all registers in VM Blocks will reflect the changes:

block5

Simplify and Expand

Blocks can be simplified to one Script block or a Script block can expand into normal blocks (if possible)

blocks7

For example we can simplify the larger block diagram from above to one Script Block:

blocks8

Then we can double click and edit it in VM Script editor.

In reverse we can select the Script Block and Expand it back to the diagram. Of course some VM blocks cannot be expanded further beyond VM Script and will remain as Script Block.

Save Graph Image

You can save the blocks into an image and then use it directly for example on web, in documentation or on forums for explanation. Just click on the Save to Image button.

vmblock8

Some notes

When you write a Script Block and use Goto command inside it, you have to make it correct only locally, and don't care where this script block actually is between other blocks.

For example we write on line 4 in our Script Block that we want to go to line 6. That's it. It doesn't matter if this Script Block will be first in front of other blocks or down below many others.

blocks71

The actual line with Goto will be adjusted accordingly in the final stage in regard of the total position. Of course such if- goto command as we used above can be actually itself expanded to If-Goto block so there is really no need to write goto in Script Block.