Example #1
0
def init_cvars(type):
    '''Set any cvars that'''
    # Display info is often in the way when displaying debug views, so just disable it always
    set_auxiliary_cvar('r_displayinfo', int(general.get_cvar('r_displayinfo')),
                       0)

    # If the user has switched from one debug view type to a different one before switching,
    # Return the previous debug view type to its default value along with all auxiliary cvars
    reset = False

    if int(general.get_cvar('r_debugGBuffer')) and type != 'gbuffers':
        reset = True
    if int(general.get_cvar('r_stats')) and type != 'profiling': reset = True
    if int(general.get_cvar('ai_DebugDraw')) != -1 and type != 'ai':
        reset = True
    if int(general.get_cvar('e_debugdraw')) and type != 'art': reset = True
    if int(general.get_cvar('mfx_debug')) and type != 'materialfx':
        reset = True
    # to be reinstated using ATL
    # if int(general.get_cvar('s_SoundInfo')) and type != 'soundfx': reset = True

    if int(general.get_cvar('r_wireframe')):
        try:
            general.set_cvar('r_wireframe', 0)
        except:
            pass

    if int(general.get_cvar('r_showlines')):
        try:
            general.set_cvar('r_showlines', 0)
        except:
            pass

    if reset:
        reset_cvars()
Example #2
0
    def __init__(self, name, default, category, description=None):
        self.name = name
        self.default = default
        self.description = description
        self.category = category
        self.values = []

        CVARS['current'][self.name] = default

        try:
            self.curValue = eval(general.get_cvar(name))
        except:
            self.curValue = general.get_cvar(name)
        if self.category in CVARS:
            if self not in CVARS[self.category]:
                CVARS[self.category].append(self)
def cycleCvarsIntValue(cVars, cycleList):
    currentValueAsString = general.get_cvar(cVars)
    try:
        currentValue = int(currentValueAsString)
    except:
        currentValue = 0

    saveDefaultValue(cVars, currentValue)

    # find out what index we're on already
    # default to -1 so that when we increment to the next, we'll be at 0
    newIndex = -1
    for x in cycleList:
        if (currentValue == x):
            break
        newIndex = newIndex + 1

    # move to the next item
    newIndex = newIndex + 1

    # validate
    if newIndex >= len(cycleList):
        newIndex = 0

    general.set_cvar(cVars, cycleList[newIndex])
Example #4
0
def profiling():
    '''Profiling related debug views.'''
    rStats = cvar('r_stats', 0, 'profiling',
                  'R_STATS - Review CPU \ GPU \ Frame \ Asset Timings.')
    rStats.add_value(1, 'Frame Timings.')
    rStats.add_value(3, 'Object Timings.')
    rStats.add_value(6, 'Per Instance Draw Calls.')
    rStats.add_value(16, 'GPU Sync Timings.')

    # Disable GI when profiling as it causes unnecessary jittering in the threads output
    set_auxiliary_cvar('e_gi', int(general.get_cvar('e_gi')), 0)

    rStats.next_value()
def toggleCvarsValue(mode, cVars, onValue, offValue):
    currentValue = general.get_cvar(cVars)

    if type(onValue) is str:
        saveDefaultValue(cVars, currentValue)
    elif type(onValue) is int:
        saveDefaultValue(cVars, int(currentValue))
    elif type(onValue) is float:
        saveDefaultValue(cVars, float(currentValue))
    else:
        general.log('Failed to store default value for {0}'.format(cVars))

    if currentValue == str(onValue):
        general.set_cvar(cVars, offValue)
    else:
        general.set_cvar(cVars, onValue)
Example #6
0
def gbuffers():
    '''GBuffer related debug views.'''
    # Init the current cvar and add all desired values.
    rGBuffers = cvar(
        'r_debugGBuffer', 0, 'gbuffers',
        'R_DebugGBuffers - Filter all gbuffers down via a given buffer.')
    rGBuffers.add_value(1, 'Normals')
    rGBuffers.add_value(2, 'Gloss')
    rGBuffers.add_value(3, 'Specular')
    rGBuffers.add_value(4, 'Diffuse')
    rGBuffers.add_value(5, 'Translucency')
    rGBuffers.add_value(6, 'Baked AO')
    rGBuffers.add_value(7, 'Subsurface Scattering')
    rGBuffers.add_value(8, 'Specular Validation Overlay')

    # Set default values for the cvars in-case we need to reset_cvars() back to original values
    # Set any other manditory cvars to display buffers.
    set_auxiliary_cvar('r_AntialiasingMode',
                       int(general.get_cvar('r_AntialiasingMode')), 0)

    # Display the first or next gbuffer, if exception met, or we have reached the final buffers, stop the update function and reset all changed cvars.
    rGBuffers.next_value()
def cycleCvarsFloatValue(cVars, cycleList):
    currentValueAsString = general.get_cvar(cVars)
    try:
        currentValue = float(currentValueAsString)
    except:
        currentValue = -1.0

    saveDefaultValue(cVars, currentValue)

    # make sure we sort the list in ascending fashion
    cycleList = sorted(cycleList)

    # find out what the next closest index is
    newIndex = 0
    for x in cycleList:
        if (currentValue < x):
            break
        newIndex = newIndex + 1

    # loop around, if we need to
    if newIndex >= len(cycleList):
        newIndex = 0

    general.set_cvar(cVars, cycleList[newIndex])
Example #8
0
 def get_value(self):
     try:
         return eval(general.get_cvar(self.name))
     except:
         return general.get_cvar(self.name)