Ejemplo n.º 1
0
def SoftCryDelayedStartupEvent_OnEvent(in_ctxt):
    add_to_path()
    import crycore
    config = crycore.load_settings(xsi)
    try:
        check = config['check_version_on_startup']
    except KeyError:
        crycore.default_settings(xsi)
        check = crycore.load_settings(xsi)['check_version_on_startup']
    if check:
        check_version(True)
    return False
Ejemplo n.º 2
0
def reload_settings():
    cfg = crycore.load_settings(xsi)
    params = PPG.Inspected(0).Parameters
    params('rcpath').Value = cfg['rcpath']
    params('check_version_timeout').Value = cfg['check_version_timeout']
    params('check_version_on_startup').Value = cfg['check_version_on_startup']
    params('gamefolder_name').Value = cfg['gamefolder_name']
Ejemplo n.º 3
0
def reload_settings():
    cfg = crycore.load_settings(xsi)
    params = PPG.Inspected(0).Parameters
    params('rcpath').Value = cfg['rcpath']
    params('check_version_timeout').Value = cfg['check_version_timeout']
    params('check_version_on_startup').Value = cfg['check_version_on_startup']
    params('gamefolder_name').Value = cfg['gamefolder_name']
Ejemplo n.º 4
0
def save_OnClicked():
    cfg = crycore.load_settings(xsi)
    params = PPG.Inspected(0).Parameters
    cfg['rcpath'] = params('rcpath').Value
    cfg['check_version_on_startup'] = params('check_version_on_startup').Value
    cfg['check_version_timeout'] = params('check_version_timeout').Value
    cfg['gamefolder_name'] = params('gamefolder_name').Value
    crycore.save_settings(xsi, cfg)
Ejemplo n.º 5
0
def save_OnClicked():
    cfg = crycore.load_settings(xsi)
    params = PPG.Inspected(0).Parameters
    cfg['rcpath'] = params('rcpath').Value
    cfg['check_version_on_startup'] = params('check_version_on_startup').Value
    cfg['check_version_timeout'] = params('check_version_timeout').Value
    cfg['gamefolder_name'] = params('gamefolder_name').Value
    crycore.save_settings(xsi, cfg)
Ejemplo n.º 6
0
def get_relative_sdk_path(path):
    import crycore
    gamefolder_name = crycore.load_settings(xsi)['gamefolder_name']
    rel_path = path.split('\\')
    for index, item in enumerate(rel_path):
        if item.lower() == gamefolder_name.lower():
            rel_path = rel_path[index + 1:]
            break
    rel_path = '\\'.join(rel_path).split('.')[0]
    return rel_path
Ejemplo n.º 7
0
def get_relative_sdk_path(path):
    import crycore
    gamefolder_name = crycore.load_settings(xsi)['gamefolder_name']
    rel_path = path.split('\\')
    for index, item in enumerate(rel_path):
        if item.lower() == gamefolder_name.lower():
            rel_path = rel_path[index + 1:]
            break
    rel_path = '\\'.join(rel_path).split('.')[0]
    return rel_path
Ejemplo n.º 8
0
def check_version(quiet=False):
    add_to_path()
    import requests as req
    import webbrowser
    import crycore
    config = crycore.load_settings(xsi)
    try:
        timeout = config['check_version_timeout']
    except KeyError:
        crycore.default_settings(xsi)
        config = crycore.load_settings(xsi)
        timeout = config['check_version_timeout']
    pb = uitk.ProgressBar
    pb.Caption = 'Checking SoftCry Version...'
    pb.Visible = True
    pb.Maximum = 1

    origin = get_origin()
    verdir = os.path.abspath(os.path.join(origin, 'softcry.ver'))
    with open(verdir, 'r') as fh:
        local_major, local_minor, local_build = fh.readline().split('.')
    try:
        latest = req.get('http://raw.github.com/Schlechtwetterfront/softcry/master/softcry.ver', timeout=timeout)
    except (req.ConnectionError, req.Timeout):
        if quiet:
            pb.Visible = False
            return
        uitk.MsgBox(CHECK_VERSION_ERROR_MSG)
        pb.Visible = False
        return
    major, minor, build = latest.text.split('.')
    pb.Value = 1
    if build > local_build:
        if uitk.MsgBox(OLD_VERSION_MSG.format(local_major, local_minor, local_build, major, minor, build), 4) == 6:
            webbrowser.open('http://github.com/Schlechtwetterfront/softcry')
    else:
        if quiet:
            pb.Visible = False
            return
        uitk.MsgBox(UP_TO_DATE_MSG.format(local_major, local_minor,
                                          local_build, major, minor, build))
    pb.Visible = False
Ejemplo n.º 9
0
def SoftCryShowRCLog_Execute():
    add_to_path()
    import webbrowser
    import os
    import crycore
    reload(crycore)
    config = crycore.load_settings(xsi)
    logpath = os.path.join(config['rcpath'], 'rc_log.log')
    if os.path.isfile(logpath):
        webbrowser.open(logpath)
    return True
Ejemplo n.º 10
0
def Export_OnClicked():
    params = PPG.Inspected(0).Parameters
    config = crycore.load_settings(xsi)
    config['path'] = params('path').Value
    config['customnormals'] = params('customnormals').Value
    config['donotmerge'] = params('donotmerge').Value
    config['filetype'] = params('filetype').Value
    config['batch'] = params('batch').Value
    config['unit'] = params('unit').Value
    config['deluncompiled'] = params('deluncompiled').Value
    config['debugdump'] = params('debugdump').Value
    config['verbose'] = params('verbose').Value
    config['usespaces'] = params('usespaces').Value
    config['keyforspace'] = params('keyforspace').Value
    config['f32'] = params('f32').Value
    crycore.save_settings(xsi, config)
    export = andecryexport.Export(xsi, config)
    try:
        export.export()
    except SystemExit:
        return
    return
Ejemplo n.º 11
0
def Export_OnClicked():
    params = PPG.Inspected(0).Parameters
    config = crycore.load_settings(xsi)
    config['path'] = params('path').Value
    config['customnormals'] = params('customnormals').Value
    config['donotmerge'] = params('donotmerge').Value
    config['filetype'] = params('filetype').Value
    config['batch'] = params('batch').Value
    config['unit'] = params('unit').Value
    config['deluncompiled'] = params('deluncompiled').Value
    config['debugdump'] = params('debugdump').Value
    config['verbose'] = params('verbose').Value
    config['usespaces'] = params('usespaces').Value
    config['keyforspace'] = params('keyforspace').Value
    config['f32'] = params('f32').Value
    crycore.save_settings(xsi, config)
    export = andecryexport.Export(xsi, config)
    try:
        export.export()
    except SystemExit:
        return
    return
Ejemplo n.º 12
0
def SoftCrySettings_Execute():
    add_to_path()
    import crycore
    reload(crycore)
    config = crycore.load_settings(xsi)

    for prop in xsi.ActiveSceneRoot.Properties:
        if prop.Name == 'SoftCrySettings':
            xsi.DeleteObj('SoftCrySettings')
    try:
        pS = xsi.ActiveSceneRoot.AddProperty('CustomProperty', False, 'SoftCrySettings')
        pS.AddParameter3('rcpath', const.siString, config['rcpath'])
        pS.AddParameter3('gamefolder_name', const.siString, config['gamefolder_name'], '', '', 0, 0)
        pS.AddParameter3('check_version_on_startup', const.siBool, config['check_version_on_startup'], 0, 1, 0, 0)
        pS.AddParameter3('check_version_timeout', const.siDouble, config['check_version_timeout'], 0, 10, 0, 0)
    except KeyError:
        crycore.default_settings(xsi)
        xsi.SoftCryExport()
        return

    mLay = pS.PPGLayout
    mLay.SetAttribute(const.siUILogicFile, get_origin() + '\\Application\\Logic\\settings.py')
    mLay.Language = 'pythonscript'

    btn = mLay.AddButton
    item = mLay.AddItem
    r = mLay.AddRow
    er = mLay.EndRow
    enum = mLay.AddEnumControl
    text = mLay.AddStaticText
    g = mLay.AddGroup
    eg = mLay.EndGroup
    tab = mLay.AddTab
    spacer = mLay.AddSpacer

    g('Settings')

    path_ctrl = item('rcpath', 'RC Path', const.siControlFolder)
    path_ctrl.SetAttribute(const.siUILabelPercentage, 70)
    r()
    folder_ctrl = item('gamefolder_name', 'Game Folder Name')
    folder_ctrl.SetAttribute(const.siUILabelPercentage, 80)
    help_btn = btn('helpgamefolder', '?')
    help_btn.SetAttribute(const.siUICX, 40)
    er()
    spacer(100, 5)
    r()
    item('check_version_on_startup', 'Check Version on Startup')
    item('check_version_timeout', 'Timeout')
    er()

    r()
    spacer(190, 5)
    reload_btn = btn('reload', 'Reload')
    reload_btn.SetAttribute(const.siUICX, 60)
    reload_btn.SetAttribute(const.siUICY, 22)
    def_btn = btn('default', 'Default')
    def_btn.SetAttribute(const.siUICX, 60)
    def_btn.SetAttribute(const.siUICY, 22)
    save_btn = btn('save', 'Save')
    save_btn.SetAttribute(const.siUICX, 60)
    save_btn.SetAttribute(const.siUICY, 22)
    er()

    eg()

    desk = xsi.Desktop.ActiveLayout
    view = desk.CreateView('Property Panel', 'SoftCrySettings')
    view.BeginEdit()
    view.Resize(400, 150)
    view.SetAttributeValue('targetcontent', pS.FullName)
    view.EndEdit()
    return True
Ejemplo n.º 13
0
def SoftCryExport_Execute():
    add_to_path()
    import crycore
    reload(crycore)
    config = crycore.load_settings(xsi)

    for prop in xsi.ActiveSceneRoot.Properties:
        if prop.Name == 'SoftCryExport':
            xsi.DeleteObj('SoftCryExport')
    try:
        pS = xsi.ActiveSceneRoot.AddProperty('CustomProperty', False, 'SoftCryExport')
        pS.AddParameter3('path', const.siString, config['path'])
        pS.AddParameter3('customnormals', const.siBool, config['customnormals'], '', 0, 0)
        pS.AddParameter3('donotmerge', const.siBool, config['donotmerge'], '', 0, 0)
        pS.AddParameter3('filetype', const.siString, config['filetype'], '', 0, 0)
        file_types = ('CGF', 'cgf', 'CGA ANM', 'cgaanm', 'CHR CAF', 'chrcaf', 'SKIN', 'skin', 'Material', 'matlib')

        pS.AddParameter3('unit', const.siString, config['unit'], '', 0, 0)
        units = 'Meter', 'meter', 'Centimeter', 'centimeter'

        pS.AddParameter3('deluncompiled', const.siBool, config['deluncompiled'], '', '', 0)
        pS.AddParameter3('debugdump', const.siBool, config['debugdump'], '', '', 0)
        pS.AddParameter3('batch', const.siBool, config['batch'], '', '', 0)
        pS.AddParameter3('verbose', const.siInt4, config['verbose'], 0, 2, 0)
        pS.AddParameter3('usespaces', const.siBool, config['usespaces'], '', '', 0)
        pS.AddParameter3('keyforspace', const.siString, config['keyforspace'], '', '', 0, 1)
        pS.AddParameter3('f32', const.siBool, False, '', '', 0, 0)
    except KeyError:
        crycore.default_settings(xsi)
        xsi.SoftCryExport()
        return

    mLay = pS.PPGLayout
    mLay.SetAttribute(const.siUILogicFile, get_origin() + '\\Application\\Logic\\exporter.py')
    mLay.Language = 'pythonscript'

    btn = mLay.AddButton
    item = mLay.AddItem
    row = mLay.AddRow
    erow = mLay.EndRow
    enum = mLay.AddEnumControl
    text = mLay.AddStaticText
    grp = mLay.AddGroup
    egrp = mLay.EndGroup
    tab = mLay.AddTab
    spacer = mLay.AddSpacer

    tab('Export')
    path_ctrl = item('path', 'File', const.siControlFilePath)
    path_ctrl.SetAttribute(const.siUINoLabel, 1)
    path_ctrl.SetAttribute(const.siUIFileFilter, 'CRYENGINE Files (*.cgf, *.cga, *.chr)|*.cgf:*.cga:*.chr')
    path_ctrl.SetAttribute(const.siUIOpenFile, False)
    path_ctrl.SetAttribute(const.siUIFileMustExist, False)

    '''texPathI = mLay.AddItem('rcpath', 'Resource Compiler', const.siControlFolder)
    texPathI.SetAttribute(const.siUINoLabel, 1)
    texPathI.SetAttribute(const.siUIWidthPercentage, 55)'''


    exgrp = grp('Export', 1)
    row()
    item('deluncompiled', 'Delete Uncompiled')
    item('donotmerge', 'Do Not Merge')
    bf32 = item('f32', 'F32')
    bf32.SetAttribute(const.siUIWidthPercentage, 15.5)
    erow()

    row()
    item('batch', 'Batch Export')
    item('customnormals', 'Custom Normals')
    b = btn('help', 'Help')
    b.SetAttribute(const.siUICX, 80)
    erow()

    row()
    unit = enum('unit', units, 'Unit', const.siControlCombo)
    unit.SetAttribute('NoLabel', True)
    filetype = enum('filetype', file_types, 'File Type', const.siControlCombo)
    filetype.SetAttribute('NoLabel', True)
    b = btn('Export', 'Export')
    b.SetAttribute(const.siUICX, 80)
    erow()
    egrp()

    tab('Special Settings')
    grp('Debug', 1)
    row()
    bdebugdump = item('debugdump', 'Debug Dump CGF')
    bdebugdump.SetAttribute(const.siUIWidthPercentage, 20)
    iverbose = item('verbose', 'Verbose Level')
    iverbose.SetAttribute(const.siUILabelPercentage, 90)
    erow()
    egrp()

    grp('Spaces', 1)
    row()
    bspaces = item('usespaces', 'Enable Spaces')
    bspaces.SetAttribute(const.siUIWidthPercentage, 20)
    skeyforspace = item('keyforspace', 'Replace With Space')
    skeyforspace.SetAttribute(const.siUILabelPercentage, 90)
    erow()
    egrp()

    desk = xsi.Desktop.ActiveLayout
    view = desk.CreateView('Property Panel', 'SoftCryExport')
    view.BeginEdit()
    view.Resize(400, 165)
    view.SetAttributeValue('targetcontent', pS.FullName)
    view.EndEdit()
    return True