NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

ccUtil.py (4046B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\login\charcreation_new\ccUtil.py
      2 import charactercreator.const as ccConst
      3 import telemetry
      4 import trinity
      5 import evegraphics.settings as gfxsettings
      6 from carbonui.uicore import uicore
      7 from eve.common.script.paperDoll.paperDollDefinitions import GENDER
      8 from eve.common.script.paperDoll.yamlPreloader import LoadYamlFileNicely
      9 
     10 @telemetry.ZONE_FUNCTION
     11 def GenderIDToPaperDollGender(genderID):
     12     if genderID == ccConst.GENDERID_FEMALE:
     13         return GENDER.FEMALE
     14     if genderID == ccConst.GENDERID_MALE:
     15         return GENDER.MALE
     16     raise RuntimeError('GenderIDToPaperDollGender: Invalid genderID!')
     17 
     18 
     19 @telemetry.ZONE_FUNCTION
     20 def PaperDollGenderToGenderID(gender):
     21     if gender == GENDER.MALE:
     22         return ccConst.GENDERID_MALE
     23     if gender == GENDER.FEMALE:
     24         return ccConst.GENDERID_FEMALE
     25     raise RuntimeError('PaperDollGenderToGenderID: Invalid gender!')
     26 
     27 
     28 @telemetry.ZONE_FUNCTION
     29 def SetupLighting(scene, lightScene, lightColorScene, lightIntensity = 0.5):
     30     intensityMultiplier = 0.75 + lightIntensity / 2.0
     31     if scene is not None:
     32         lightList = []
     33         for l in scene.lights:
     34             lightList.append(l)
     35 
     36         for l in lightList:
     37             scene.RemoveLightSource(l)
     38 
     39         for index in range(len(lightScene.lights)):
     40             light = lightScene.lights[index]
     41             for l in lightColorScene.lights:
     42                 if l.name == light.name:
     43                     light.color = l.color
     44 
     45             light.color = (light.color[0] * intensityMultiplier,
     46              light.color[1] * intensityMultiplier,
     47              light.color[2] * intensityMultiplier,
     48              1.0)
     49             scene.AddLightSource(light)
     50 
     51 
     52 @telemetry.ZONE_FUNCTION
     53 def LoadFromYaml(path):
     54     return LoadYamlFileNicely(path)
     55 
     56 
     57 def HasUserDefinedWeight(category):
     58     return ccConst.COLORMAPPING.get(category, (0, 0))[0]
     59 
     60 
     61 def HasUserDefinedSpecularity(category):
     62     return ccConst.COLORMAPPING.get(category, (0, 0))[1]
     63 
     64 
     65 def CreateCategoryFolderIfNeeded(outputroot, folderName):
     66     import os
     67     folderName = os.path.normpath(folderName)
     68     if os.path.isdir(outputroot + folderName):
     69         return
     70     os.mkdir(outputroot + folderName)
     71 
     72 
     73 def IsFactionSelectionDisabled(factionID):
     74     disabledFactionIDs = sm.GetService('machoNet').GetGlobalConfig().get('disabled_faction_ids', '')
     75     if not disabledFactionIDs:
     76         return False
     77     return factionID in [ int(disabledFactionID) for disabledFactionID in disabledFactionIDs.split(',') ]
     78 
     79 
     80 def IsSchoolDisabled(schoolID):
     81     disabledSchoolIDs = sm.GetService('machoNet').GetGlobalConfig().get('disabled_school_ids', '')
     82     if not disabledSchoolIDs:
     83         return False
     84     return schoolID in [ int(disabledSchoolID) for disabledSchoolID in disabledSchoolIDs.split(',') ]
     85 
     86 
     87 @telemetry.ZONE_FUNCTION
     88 def IsSlowMachine():
     89     if gfxsettings.Get(gfxsettings.GFX_CHAR_FAST_CHARACTER_CREATION):
     90         return True
     91     if gfxsettings.Get(gfxsettings.GFX_SHADER_QUALITY) < 2:
     92         return True
     93     return False
     94 
     95 
     96 def GetDpiScaledWidthAndHeight():
     97     desktopWidth = int(uicore.desktop.width * uicore.desktop.dpiScaling)
     98     desktopHeight = int(uicore.desktop.height * uicore.desktop.dpiScaling)
     99     return (desktopWidth, desktopHeight)
    100 
    101 
    102 @telemetry.ZONE_FUNCTION
    103 def CreatePerlinCurve(curveSet, scale = 1.0, offset = 6.0, speed = 1.1, alpha = 1.0, beta = 1.1):
    104     curve = trinity.TriPerlinCurve()
    105     curve.scale = scale
    106     curve.offset = offset
    107     curve.speed = speed
    108     curve.alpha = alpha
    109     curve.beta = beta
    110     curveSet.curves.append(curve)
    111     return curve
    112 
    113 
    114 @telemetry.ZONE_METHOD
    115 def CreateBinding(curveSet, curve, destinationObject, attribute, sourceAttribute = 'currentValue'):
    116     binding = trinity.TriValueBinding()
    117     curveSet.bindings.append(binding)
    118     binding.destinationObject = destinationObject
    119     binding.destinationAttribute = attribute
    120     binding.sourceObject = curve
    121     binding.sourceAttribute = sourceAttribute
    122     return binding