Customizing the Library

Overview

RailClone includes an extensive library of presets, but often you will need to modify the built in styles or create your own. Creating a new library is a quick and easy way to reuse and share Railclone objects in your projects. In this section you will learn the procedures to create your own libraries in RailClone. The library browser allows you to easily organise and edit your libraries and create new preset styles. In this section you will find instructions for common procedures and a reference guide to the interface.

All libraries are stored in disk as XML files and can also be edited with a text editor or XML editor.

In this section:

 

Procedures

Adding and Modifying Library Locations

RailClone can access styles from a number of different libraries. These are located automatically from a list of folder paths defined in the preferences. Folders can be stored locally or in a shared network location.

The RailClone libraries are divided into several types, the standard libraries included with the plugin and third-party packages and user generated Libraries. These are stored by default in "My Documents\RailClone."

the libraries included with RailClone cannot be modified. If you want to edit them, make a copy of the files to your own user folder. See below for a reference of the libraries' file structure.

To add locations follow these simple steps:

  1. With the library editor open go to File>Preferences… or click the preferences button from the top toolbar.
  2. The Library Paths rollout shows a list of all the locations currently being used. To add a new location click on the Add… button and navigate to the folder for your libraries.
  3. In the Label field enter a location name to display in the tree navigator.
  4. Click Use Path to add the location to the library and return to the preferences. 
  5. Click OK and you should now see all the sub folders and libraries displayed in the tree navigator on the left hand side of library browser.

Alternatively to modify or update an existing location:

  1. With the library editor open go to File>Preferences… or click the preferences button from the top toolbar. 
  2. To modify a location select it from the library paths list and click Modify.
  3. Navigate to the root folder of the new location and select Use Path.

Organising and Creating New Libraries.

Each library location path (set from the preferences - see above) can be further organised into sub folders. RailClone will scan these subfolders and replicate the directory in the tree navigator found on the left hand side of the library browser window. From this panel folders and libraries can be created and deleted using the procedures outline below, and the directory structure easily reorganised using drag and drop.
 

To create a subfolder:

  1. With the Library Browser open, in the tree navigator on the left hand side, right click on a user library and select Create Folder.
  2. A new folder has been created. The name will be highlighted, type in a new name for the folder.

Alternatively to create the subfolders directly in Windows Explorer:

  1. Navigate to the library location in Windows Explorer or locate it automatically using the Library Browser by right clicking its name from the tree navigator and selecting Open in Shell…
  2. Create your directory structure in the usual way using Windows Explorer
  3. When you are done, update the view in the Library Browser to reflect the new directory tree by clicking on the Refresh button (  )from the top toolbar or select from the View menu.

To create a new library:

When you create a library RailClone generates a new folder that includes an XML file and sub folders for thumbnails. This and any other sub folders found in the library location will not be displayed. This allows you to add additional directories for models, maps and materials used by the library without them cluttering up the tree navigator.

  1. In the tree navigator, right click on the folder where you would like to save your new library and select Create Library...
  2. The library name will be highlighted, enter a title and press return
  3. If you need to rename your library at a later date, simply right click on it and select Rename.

To delete a library or folder

  1. To delete a folder or library, simply right click and select Delete.

Adding a new Style to a Library

Styles can be added to any library saved in a user location (represented in the tree navigator as a green folder). Style are created from existing RailClone objects, stored in .max files located anywhere on your computer or network. However sharing is simplified if the files and any material libraries and bitmaps use relative paths and are located in the library folder. If images with the same name as the object are placed in the thumbnails folder, these will be used automatically.

To add a new Style:

  1. From the navigator on the left, select a user's library.
  2. Right click in the browser and select Create Item>RailClone Object
  3. A new blank Style will be created in the item browser. To edit, right click on the item and select Properties…
  4. Fill in the Name, Family and Description values. Note that the Name field is the text displayed by default in the library browser, other values can be left blank if not required
  5. Click on the folder item next to the Max File field to select the .max scene file that contains the new Style.
  6. A list will open containing the objects in the scene, pick the RailClone object you wish to add to the library.
  7. If the object had a material applied this will be also be used in RailClone. It is also possible to override the material from an external material library. In order to do this enable the Override Material tick box.
  8. Select the material library by clicking the folder icon next to the Mat. Library field. Find the library and click Open
  9. Next click the Select Material button, this brings up a list of the contents of the material library. Highlight the material to be used and click OK.
  10. Add a thumbnail by clicking the image file button below the thumbnail preview window. Select an image file and click OK.
  11. Click OK to accept the changes
  12. Save the library by going to File>Save… or selecting the save library button from the top toolbar. 

Adding a Macro to Assign a Material According to Renderer

When creating libraries it is possible to use macros to add variables to an item's property fields. This is very useful for creating flexible libraries that can dynamically respond to individual installations or changeable 3DS Max settings. One common usage is the creation of library items that automatically load appropriate materials based on the active renderer.

Prerequisites:

  • Items are created in the usual way but materials are taken from a separate material library. In this example we assume three libraries, one for each of the three supported renderers: Mental Ray, V-Ray, and scanline.
  • Each material library's name should have two sections, one part that will be identical for all three files and a second part that matches the variable names assigned by RailClone''s macro. [libraryName][macroValue].mat
  • RailClone uses "mental", "vray", and "standard" as values for the renderer macro. The following three file names demonstrate appropriate file names. 

    MaterialLibraryName-mental.mat
    MaterialLibraryName-vray.mat
    MaterialLibraryName-standard.mat
  • The actual materials contained in each library should have identical names irrespective of the render. This allows you to dynamically switch between materials by automatically loading a different library for each renderer.

Auto-loading a material library by renderer:

  1. Either create a new object as described above, or right click and select Properties to edit an existing item.
  2. Turn on Override Material, this allows you to use a separate material library to texture the object. In this example it will automatically select a different material library according to the current renderer.
  3. In the Max File field type the parts of your material library name that is common to all files. In the examples given above you would type MaterialLibraryName-.mat
  4. Position the cursor where you want to add the renderer variable, in this case it would after MaterialLibraryName- and before .mat
  5. Click on Macros… and select hdfreerenderer from the subsequent list. Click OK to add the variable to the filename. The material filename should now read MaterialLibraryName-$(HDFREERENDERER).mat.
  6. Select an appropriate material by clicking the select material button and picking one from the list. If the materials are identically named in each library, this macro will change the material depending on the currently selected renderer.

Interface

Library Browser Preferences

To access the Library Browers go to File>Preferences... or click the preferences button from the toolbar 

NameDescription
Use scene materialWhen selected in the event of a a duplicate material the version already in the scene will be used
Replace material from libraryWhen selected in the event of a a duplicate material the version in the library will be used
Ask userWhen selected in the event of a a duplicate material the which of the two options above should be used
Add...Adds a new library location.
Modify...Modifies the location of an existing library.
DeleteDeletes a library location.
EvaluateShows the currect values for all macros.

Library Addition

Use the context menu accessible by right clicking in the tree navigator to create new sub folders and libraries, and reorganise your directory using the mouse to drag and drop folders and libraries.

Commands available in the tree context menu:

NameDescription
Create LibraryCreates a folder and a new "index.xml" file.
Create FolderCreates an empty folder on the disk, to organize folders or libraries.
RenameRenames a Folder or Library, this commands changes the name of the folder on the disk.
DeleteDeletes a Folder or Library with all its contents. Use with caution!

Item Editing

To access the commands to edit a library's content, right click anywhere in the item grid. Note that changes are only stored in the system memory until the library is saved to disk.

Commands available in the item context menu :

Commands available in the item context menu:

NameDescription
Create ItemCreates a new empty item in the current library.
PropertiesShows the Item Settings dialog box.
DeleteDeletes the selected item.

To commit your changes to disk, click the Save Changes button in the toolbar.

Style Properties

This window is used to set the properties for a library style. The RailClone plugin uses these settings to construct an object based on the properties of a reference object in a .max file.

Settings available for Styles:

NameDescription
NameStyle name.
FamilyFamily or catrgory.
DescriptionTextual description of the style.
Max File3DSMax scene where the reference object is stored.
ObjectName of the reference object. Choose one of the scene contents in the reference scene.
Override MaterialOverride the reference object material, and apply a supplied one.
Material Lib.3DSMax material library containing the material.
MaterialName of the override material, choose one from the selected library.
ThumbnailPreview image of object.
Thumbnail Selector buttonPress this button to change the thumbnail image.

File Structure

A library is a special folder on the disk which contains an index.xml file, where the items are listed. This file points to the files necesary to define a library item. The browser stops to scan directories when an index.xml file is found, so a library folder can't contain other libraries and all subfolders are hidden in the interface, this permits to you to organize the data in several subfolders.

Each library item points to a single template object in a .max file or to a material in a .mat file. Each time you select a library item, all settings in the template object are loaded and applied to the current RailClone object. You can group several objects in a single file, or have separate files for each one. You can also use macro substituion (see section below) to use conditions or complex structures.

Each library item also has an associated image file, typically stored in the thumbnails folder. This image is used to show the image preview in the library and you should have one image for each library item. If you name the files using the same name of the object, the image is automatically selected in the editor.

Additionally, you can have materials libraries to override the object's default material. This way you can have several library items with the same geometric base, but with different materials and textures.

Macros

In some fields, such as filenames and object or material names, you can use macro sustituions to add more flexibility to your library structures. These macros represent the library root location, current folder, or 3dsmax state values. The macros are instanced using the $(NAME) format.

To open the Insert Macro window, press the Macros... button in the properties window, select a macro and click OK, the selected macro will be inserted in the current field of the property