Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Demos/Locomotion/Biped/Sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def GetIndexPair(self, timestamp: float):
0.0,
self.Timestamps.size - 1,
)
ratio = Tensor.Clamp(ratio, 0.0, self.Timestamps.size - 1)
ratio = Tensor.Clamp(ratio, 0.0, self.Timestamps.size - 1).item()
a = int(math.floor(ratio))
b = int(math.ceil(ratio))
w = Utility.Ratio(timestamp, self.Timestamps[a], self.Timestamps[b])
w = Tensor.Clamp(w, 0.0, 1.0)
w = Tensor.Clamp(w, 0.0, 1.0).item()
return a, b, w

def GetLength(self):
Expand Down
4 changes: 2 additions & 2 deletions Demos/Locomotion/Quadruped/Sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def GetIndexPair(self, timestamp: float):
0.0,
self.Timestamps.size - 1,
)
ratio = Tensor.Clamp(ratio, 0.0, self.Timestamps.size - 1)
ratio = Tensor.Clamp(ratio, 0.0, self.Timestamps.size - 1).item()
a = int(math.floor(ratio))
b = int(math.ceil(ratio))
w = Utility.Ratio(timestamp, self.Timestamps[a], self.Timestamps[b])
w = Tensor.Clamp(w, 0.0, 1.0)
w = Tensor.Clamp(w, 0.0, 1.0).item()
return a, b, w

def GetLength(self):
Expand Down
6 changes: 5 additions & 1 deletion ai4animation/Standalone/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,11 @@ def Screen(self):
return Rectangle(x, y, w, h)

def Tuple(self):
return (self.x, self.y, self.width, self.height)
def to_scalar(v):
if hasattr(v, "item"):
return v.item()
return float(v)
return (to_scalar(self.x), to_scalar(self.y), to_scalar(self.width), to_scalar(self.height))

def Copy(self):
return Rectangle(self.x, self.y, self.width, self.height)
Expand Down