PaperdollSculptingGhost.py (3067B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\paperDoll\PaperdollSculptingGhost.py 2 import math 3 from eve.client.script.paperDoll.AvatarGhost import AvatarGhost 4 from eve.client.script.paperDoll.commonClientFunctions import SetOrAddMap 5 from eve.common.script.paperDoll.paperDollCommonFunctions import BeFrameNice 6 7 class PaperdollSculptingGhost(AvatarGhost): 8 9 def __init__(self, zonePath, texturePath, noisePath, meshFilter = [], tiling = 40, ignoreZ = False): 10 self.fx = None 11 self.zonePath = zonePath 12 self.texturePath = texturePath 13 self.noisePath = noisePath 14 self.tiling = tiling 15 self.ignoreZ = ignoreZ 16 self.meshFilter = meshFilter 17 self.isStarting = False 18 19 def Start(self, avatar): 20 if self.isStarting: 21 return 22 self.isStarting = True 23 24 def Filter(mesh): 25 for f in self.meshFilter: 26 if mesh.name.lower().startswith(f): 27 return True 28 29 return False 30 31 fxPath = 'res:/Graphics/Effect/Managed/Interior/Avatar/SculptingOverlay.fx' 32 if self.ignoreZ: 33 fxPath = 'res:/Graphics/Effect/Managed/Interior/Avatar/SculptingOverlay_NoZ.fx' 34 self.fx = self.StartGhostRenderJob(avatar, fxPath, rjName='Sculpting Overlay', meshFilter=Filter, insertFront=False) 35 BeFrameNice() 36 if self.fx: 37 for f in self.fx: 38 SetOrAddMap(f, 'ZoneMap', self.zonePath) 39 SetOrAddMap(f, 'HexGridMap', self.texturePath) 40 SetOrAddMap(f, 'NoiseMap', self.noisePath) 41 for tp in f.parameters: 42 if tp.name == 'SculptingTexture': 43 tp.v1 = self.tiling 44 tp.v2 = 0.0 45 tp.v3 = 0.0 46 tp.v4 = 0.0 47 48 mouseRed = 113 49 mouseGreen = 153 50 mouseBlue = 184 51 mouseRed = math.pow(mouseRed / 255.0, 2.2) 52 mouseGreen = math.pow(mouseGreen / 255.0, 2.2) 53 mouseBlue = math.pow(mouseBlue / 255.0, 2.2) 54 self.SetMouseColor((mouseRed, 55 mouseGreen, 56 mouseBlue, 57 1.0)) 58 self.isStarting = False 59 60 def Stop(self): 61 self.StopGhostRenderJob() 62 self.fx = None 63 64 def IsActive(self): 65 return self.fx is not None 66 67 def SetMousePos(self, pos, radius): 68 self.UpdateParam('SculptingMousePos', (pos[0], 69 pos[1], 70 pos[2], 71 radius)) 72 73 def SetMouseColor(self, rgba): 74 self.UpdateParam('SculptingMouseColor', rgba) 75 76 def SetActiveZonePos(self, pos, radius): 77 self.UpdateParam('SculptingActiveZone', (pos[0], 78 pos[1], 79 pos[2], 80 radius)) 81 82 def SetActiveZoneColor(self, rgba): 83 self.UpdateParam('SculptingZoneColor', rgba) 84 85 def UpdateParam(self, name, value): 86 if self.fx: 87 for f in self.fx: 88 for p in f.parameters: 89 if p.name == name: 90 p.value = value