Take full advantage of the Insert menu
HowTo

From POV-Wiki
Jump to: navigation, search
This article is for users of all levels of experience, and applies to Win32-bit and Win64-bit POV-Ray

As noted in the documentation, it is possible to edit the Insert Menu. This is not an insignificant thing! Adding your own code to the Insert Menu or changing existing code to better suit your needs can make setting up a scene much easier.


Contents

About the Insert Menu

From the documentation:

Editing the Insert Menu

The Insert Menu is built dynamically from a directory called 'Insert Menu', which is in the POV-Ray for Windows installation directory. Each sub-menu in the Insert Menu is a directory (also called a 'folder' these days). To create a new sub-menu, just create a new directory. The submenu will have the same name as the directory.

The actual items that you can insert in your scene files are simply text files. POVWIN recognizes them by the extension .TXT. Any .TXT file in the Insert Menu directory tree will appear in the Insert Menu. The name shown in the Insert Menu will be the filename of the .TXT file, minus the .TXT extension. If you select this file from the Insert Menu, the contents of the corresponding text file will be inserted into your scene file at the current cursor location.

You can edit the Insert Menu at any time, even while POVWIN is running, and POVWIN will automatically pick up the fact that it's been changed and re-load it.

Sorting Your Menu Items

It is possible to order the insert menu entries any way you like, both for folders and for the files (or sub-folders) within them. Normally, the entries are added to the menu in alphabetical order, with all folders being added before files. However, you can influence the ordering of each group (folders and files) by prepending a 'NN - ' to a folder or file, where 'NN' is any letter or digit (note however that this does not permit you to place a file before a folder).

When the editor code builds the insert menu (which happens each time you change it), any file or folder that starts with a prefix of 'NN - ' (note the trailing space) will be sorted using the prefix, but displayed without the prefix.

Adding a Separator

Creating a file called '-.txt' (a hyphen followed by .txt) usually prefixed by a 'NN - ' (e.g. '30 - -.txt'), will cause a menu separator to be drawn instead of inserting a new item into the menu. The contents of the file are ignored. To create a separator between sub-menus, do the same thing as above, but create a folder instead of a file and leave off the '.txt' extension.

Insert Menu Pictures

Each Insert Menu text file may optionally have an associated BMP file that provides a preview of the item that the text file can generate. To add this for your own changes, place a BMP file that shares the same name as the text file for your menu item.

Preview images can be of any bit-depth, but if you want to distribute them we strongly recommend that they be no more than 8-bit. Additionally, they should be no larger than 640x480 pixels.



Changes You Should Consider Making

If you use POV-Ray frequently or just want to save time while composing scenes, here are some areas that you might benefit from changing.

Making Changes to Fit Your Coding Style

Over time I've developed some strong preferences when it comes to coding styles that I feel enhances a scene's readability, and I am sure others have also. When adding a lot of things to your code at once, reorganizing and cleaning up your code can take a while. With that in mind, why not change the code you frequently insert to fit your style?

Example: Insert Menu's standard version of a point light_source

// create a regular point light source
light_source {
  0*x                  // light's position (translated below)
  color rgb <1,1,1>    // light's color
  translate <-20, 40, -20>
}

My version of a point light_source, changed to match my coding style and the way I typically use them in a scene:

//****  SUN  (light source name)
light_source
{
	<100, 100, 100> * 10
	color rgb <1,1,1>
}

I prefer to use tabs instead of spaces for indents and I don't need the comments anymore because I know what the parameters do.

This may seem like a very minor change, but cleanliness and uniformity in code helps to increase readability. If you change all of the code you frequently insert to match your style, it will be much easier to rapidly enter understandable code.

Adding Your Own Blocks of Code

For starters, I recommend either adding your own top level menu item with submenus, or appropriating the Scene Templates menu.

Open the most recent POV-Ray scene you were working on and look it over. How much of it is reused code from previous scenes? How much of it can be reused for other scenes? Wouldn't it be better to take that really nice looking sky you have now and put it in the Insert Menu instead of trying to find it later to copy and paste it?

Personal tools
Namespaces
Variants
Actions
Content
Other Pages
Toolbox