Пример #1
0
def get_installation_path():
    """
    Returns 3ds Max installation folder
    NOTE: This function is added here to avoid some errors related with 3ds Max PATH env var setup
    This functionality is available in dcclib for each specific DCC
    :return: str
    """

    version_id = MaxPlus.Application_Get3DSMAXVersion()
    version_number = (version_id >> 16) & 0xffff
    year = 2000 + (math.ceil(version_number / 1000.0) - 2)
    max_version = str(float(str(version_number)[:2]))

    if not win32.get_reg_key(
            'HKEY_LOCAL_MACHINE',
            'SOFTWARE\\Autodesk\\3dsMax\\{}'.format(max_version)):
        logger.error(
            '3ds Max "{}" is not installed in your computer!'.format(year))
        return None

    key = win32.list_reg_key_values(
        'HKEY_LOCAL_MACHINE',
        'SOFTWARE\\Autodesk\\3dsMax\\{}'.format(max_version))
    for keys in key:
        if keys[0] == 'Installdir':
            return keys[1]
Пример #2
0
def get_max_version(as_year=True):
    """
    Returns the current version of 3ds Max

    :param  bool as_year: Whether to return version as a year or not
    :return: Current version of your 3ds Max
    :rtype: long or float

    >>> print(get_max_version())
    2018.0

    >>> print(get_max_version(False))
    20000L
    """

    # 3dsMax Version returns a number which contains max version, sdk version, etc...
    version_id = MaxPlus.Application_Get3DSMAXVersion()

    # Transform it to a version id
    # (Macro to get 3ds max release from version id)
    # NOTE: 17000 = 2015, 17900 = 2016, etc
    version_number = (version_id >> 16) & 0xffff

    if as_year:
        year = 2000 + (math.ceil(version_number / 1000.0) - 2)
        return year

    return version_number