Skip to content

Commit

Permalink
Fix truncation on UV edit dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
soopercool101 committed Dec 22, 2020
1 parent 0cbf824 commit 494ed63
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Loaders/Utility/Shift UVs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,27 @@ def GetInstance(self):
return UVWrapper()

def shiftUV_handler(sender, event_args):
scaleX = BrawlAPI.UserFloatInput("X-Scale", "X Scale multiplier to apply to the UVs (Applied first)", 1.0)
scaleY = BrawlAPI.UserFloatInput("Y-Scale", "Y Scale multiplier to apply to the UVs (Applied first)", 1.0)
transX = BrawlAPI.UserFloatInput("X-Translation", "X Translation offset to apply to the UVs (Applied second)", 0.0)
transY = BrawlAPI.UserFloatInput("Y-Translation", "Y Translation offset to apply to the UVs (Applied second)", 0.0)
# Gather the required inputs from the user
scaleX = BrawlAPI.UserFloatInput("X Scale multiplier to apply to the UVs (Applied first)", "X-Scale", 1.0)
scaleY = BrawlAPI.UserFloatInput("Y Scale multiplier to apply to the UVs (Applied first)", "Y-Scale", 1.0)
transX = BrawlAPI.UserFloatInput("X Translation offset to apply to the UVs (Applied second)", "X-Translation", 0.0)
transY = BrawlAPI.UserFloatInput("Y Translation offset to apply to the UVs (Applied second)", "Y-Translation", 0.0)
shiftUV(scaleX, scaleY, transX, transY)

def shiftUV(scaleX, scaleY, transX, transY):
i = 0
# Apply the modifiers to each UV point
for vec2 in BrawlAPI.SelectedNode.Points:
vec2.X = vec2.X * scaleX
vec2.X = vec2.X + transX
vec2.Y = vec2.Y * scaleY
vec2.Y = vec2.Y + transY
# Due to some quirk, necessary to set this manually to ensure saving works
BrawlAPI.SelectedNode.Points[i] = vec2
i += 1
# Due to some quirk, necessary to set this manually to ensure saving works
BrawlAPI.SelectedNode.Points = BrawlAPI.SelectedNode.Points
# Flag node as needing saving
BrawlAPI.SelectedNode.SignalPropertyChange()

# Create an instance of our wrapper class and add it to the API wrapper cache
Expand Down

0 comments on commit 494ed63

Please sign in to comment.