Corona Converter

Maxscript Documentation

www.racoon-artworks.de

Prerequisites:

To use the Converter methods you have to define the global variables CoronaConverterSuppressGui, CoronaProxyConverter and CoronaConverter and use a fileIn with the scriptfile. After that you can simply access all methods by either using "CoronaConverter" or "CoronaProxyConverter". You will find more examples at the end of the page.


::CoronaConverterSuppressGui = true  /* this will suppress the converter dialog */
::CoronaProxyConverter  /* proxy converter instance */ 
::CoronaConverter  /* converter instance */ 
fileIn @"C:\coronaConverter_v1.20.ms"
/* your code goes here... */
CoronaConverterSuppressGui = false  /* turn the suppression off, so the dialog can pop up later */
    
    

Methods:

High-level converter functionality:

<CoronaConverter>.convertScene()

Converts the whole scene (materials, texturemaps and lights) to Corona

<CoronaConverter>.convertSceneLights()

Converts all lights in the scene to Corona

<CoronaConverter>.convertSceneMtlsMaps()

Converts all materials and texturemaps in the scene to Corona

<CoronaConverter>.convertNodeArray <node_array>

Takes an array of scene objects and converts their materials (and texturemaps) to Corona

<CoronaConverter>.convertMaterialArray <material_array>

Takes an array of materials and converts them (texturemaps incl.) to Corona

<CoronaConverter>.openGui()

Creates a standard Converter Dialog

<CoronaConverter>.destroyGui()

Destroys the Dialog if open
Converter Tools:

<CoronaConverter>.converterTools.showMapsInVP <boolean>

Tries to enable/disable texturemap previews of all CoronaMtl diffuse maps in the Viewport. Optional selected parameter to use only selected objects - default is false.

<CoronaConverter>.converterTools.SetMaxDisplacementLevel <float>

Sets the displacment maximum level of all CoronaMtls to value in worldunits

<CoronaConverter>.converterTools.DisableDisplacementTex()

Disables displacment maps of all CoronaMtls

<CoronaConverter>.converterTools.setLegacyMode <boolean>

Sets the Legacy mode of all CoronaMtls . true = legacy, false = standard

<CoronaConverter>.converterTools.setPBRMode <boolean>

Sets the PBR mode (1.5) of all CoronaMtls

<CoronaConverter>.converterTools.convertClass()

Opens the convert class tool dialog

<CoronaConverter>.converterTools.CoronaMtlStats()

Opens the Statistics dialog

<CoronaConverter>.converterTools.resetMtlEdit()

Resets the 24 material editor slots to new CoronaMtls

<CoronaConverter>.converterTools.fixOpacityMapsUsingMonoChannel()

Opacity bitmaps that are using the "Mono Channel Output" option are rendered using the RGB channels (not the alpha) in Corona. This tool tries to fix those issue where possible.

<CoronaConverter>.converterTools.fixCoronaNormalGamma()

Loops through all CoronaNormal maps, checks if the gamma warning is displayed and switches the "Add gamma to input" checkbox on or off. Only works if input gamma is either 1.0 or 2.2

<CoronaConverter>.converterTools.convertBitmapToCoronaBitmap()

Converts all bitmaptexture instances to CoronaBitmap instances

<CoronaConverter>.converterTools.convertCoronaBitmapToBitmap()

Converts all CoronaBitmap instances to bitmaptexture instances

<CoronaConverter>.converterTools.convertVrayDisplacementMods()

Converts all VrayDisplacementMod modifiers to CoronaDisplacementMod modifiers

<CoronaConverter>.converterTools.getVersion()

Returns the converter version as a string

<CoronaConverter>.converterTools.checkForNewVersion()

Checks online for the converter versions on the server. Returns an array:     #(#("public", "0.22"), #("daily", "0.34"))
Proxy Converter:

<CoronaProxyConverter>.convertProxies() [location:<string>] [overwrite:<boolean>]

Exports all Proxies that are present in the Scene. Optional argument "location" can be provided to set a different export location. If it is not provided, .cgeo files will be saved in the same location as the original proxy files. The other optional argument "overwrite" lets you suppress the overwrite dialog popup and decide if you want to overwrite files or not.

Settings:

<CoronaConverter>.converterSettings.<property> = <value>

A list of possible settings with default values:

standardMatSpecToRefl = true
vrayUseAdvBlinnToCoronaGgxConversion = true
VrayHDRIToBitmaptexture = true
addCoronaPrefix = false
userPrefixStr = "CRN."
clampDisp = false
clampDispAmount = 5.0
clampIor = false
clampIorAmount = 25.0
miLightsToCrnLights = false
convertProxies = false /* opens the proxy converter dialog if conversion button is pressed */
switchRenderEngine = false
printInfo = true /* prints conversion statistics in the listener */
silent = false /* Corona converter in silent mode will not open warning message boxes */
useTryCatchBugReporting = true /* won't fail on conversion bugs, proceeds and opens a bug report window instead */
vrayBumpMultiplier = 3.5 /* a different multiplier for bump conversion can be set here */

Example Code:


            
::CoronaConverterSuppressGui = true  /* this will suppress the converter dialog */
::CoronaProxyConverter  /* proxy converter instance */ 
::CoronaConverter  /* converter instance  */ 
fileIn @"C:\coronaConverter_v1.20.ms"

CoronaConverter.converterSettings.switchRenderEngine = true
CoronaConverter.converterSettings.printInfo = false
CoronaConverter.converterSettings.silent = false

CoronaConverter.convertScene()
CoronaProxyConverter.convertProxies location:@"C:\myProxyLocation" overwrite:true

CoronaConverter.converterTools.DisableDisplacementTex()
    
CoronaConverterSuppressGui = false  /* turn the suppression off, so the dialog can pop up later */
        

 


macroScript ConvertSelectionToCorona
category: "Corona Renderer"
(
    ::CoronaConverterSuppressGui = true  /* this will suppress the converter dialog */
    ::CoronaProxyConverter  /* proxy converter instance */ 
    ::CoronaConverter  /* converter instance  */ 
    fileIn @"C:\coronaConverter_v1.20.ms"
    
    CoronaConverter.convertNodeArray (selection as array)
    
    CoronaConverterSuppressGui = false  /* turn the suppression off, so the dialog can pop up later */
)