Skip to content

Commit

Permalink
Fix for Vector3.FromStr for strings containing less than 3 numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
myuce committed Sep 6, 2024
1 parent 5149e84 commit 99b9ff7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/Vector3.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ def Forward() -> 'Vector3':
@staticmethod
def FromStr(string: str):
string = string.replace("[","").replace("]","").replace("{","").replace("}","").replace(" ", " ").strip()
tok = [i for i in string.split(" ") if i != ""]
tok = [float(i) for i in string.split()]

if len(tok) < 3:
for _ in range(0, 3 - len(tok)):
tok.append(0)

return Vector3(tok[0], tok[1], tok[2])

@staticmethod
Expand Down

0 comments on commit 99b9ff7

Please sign in to comment.