Interactive/EnablePreviewCustom.py

# (C) Copyright 2012 Autodesk, Inc.  All rights reserved.
#
# Use of this software is subject to the terms of the Autodesk license
# agreement provided at the time of installation or download, or which
# otherwise accompanies this software in either electronic or hard copy
# form.


# Enable different preview features

from UserCustomization       import UserCustomBase, CustomInfo
from RTFapi                  import SystemInformation
from ParameterGroupUtilities import Parameters


class EnablePreview( UserCustomBase ):
    def __init__( self ):
        SystemInformation.instance().setConfigSwitch("preview-shots",True)
        SystemInformation.instance().setConfigSwitch("preview-directional-light",True)
        SystemInformation.instance().setConfigSwitch("preview-import-image",True)
        SystemInformation.instance().setConfigSwitch("preview-save-image-sidebyside",True)
        SystemInformation.instance().setConfigSwitch("preview-measure-presentation",True)
        SystemInformation.instance().setConfigSwitch("preview-animation",True)
        SystemInformation.instance().setConfigSwitch("preview-primitives",True)
        SystemInformation.instance().setConfigSwitch("preview-style-properties",True)
        SystemInformation.instance().setConfigSwitch("preview-object-priorities",True)

        lineLength = 0
        msg = ""
        for par in Parameters(SystemInformation.instance().configuration()):
            name = par.getName()
            if name.startswith('preview-'):
                if 'true' == par.getValueAsString():
                    if "" == msg:
                        msg = "Preview features: %s" % (name[8:])
                        lineLength = len(msg)
                    else:
                        if lineLength > 72:
                            # Why doesn't this work:
                            # msg += ",\n%18s" % (name[8:])
                            c = "                  %s" % (name[8:])
                            msg += ",\n" + c
                            lineLength = len(c)
                        else:
                            c = ", %s" % (name[8:])
                            lineLength += len(c)
                            msg += c
        print msg


def instantiate():
    return EnablePreview()

def info():
    customInfo = CustomInfo()
    customInfo.vendor = 'Autodesk'
    customInfo.version = '2.0'
    customInfo.api = '2013'
    customInfo.shortInfo = "Enable unsupported features."
    customInfo.longInfo = \
"""Enable some unsupported features:
    Cut, copy, paste for shots.
    Record navigation into shots.
    Create directional lights.
    Manual scene optimize.
    Import image directly into the scene.
    Save image or movie while in side-by-side mode.
    Allow measurement while in presentation mode.
    Allow setting the direction for imported FBX animation.
    Allow partial localization.
    Allow access to style properties window.
"""
    return customInfo