mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Fix the logic in llDetectedTouchST/UV.
They were returning TOUCH_INVALID_TEXCOORD for num <= idx <= 15 in detection events which were not touch events. That is incorrect. Now it correctly returns: - ZERO_VECTOR when idx < 0 or idx > 15 or the event is known not to be a detection event. - TOUCH_INVALID_TEXCOORD when idx == 0 and the event is known to be a detection event that is not a touch event. - Raises ELSLCantCompute otherwise.
This commit is contained in:
parent
028b244a9e
commit
96a0aebe3a
1 changed files with 16 additions and 6 deletions
|
@ -142,17 +142,27 @@ def llDetectedTouchPos(idx, event=None):
|
|||
|
||||
def llDetectedTouchST(idx, event=None):
|
||||
idx = fi(idx)
|
||||
if 0 <= idx <= 15 and (event in TouchEvents or event is None):
|
||||
if 0 <= idx <= 15 and (event is None or event in DetectionEvents):
|
||||
# In detection events that are not touch events, it returns
|
||||
# TOUCH_INVALID_TEXCOORD if idx < num, else ZERO_VECTOR,
|
||||
# but we only know that num >= 1.
|
||||
if idx == 0 and event is not None and event not in TouchEvents:
|
||||
# index 0 always exists, so we know the result
|
||||
return TOUCH_INVALID_TEXCOORD
|
||||
raise ELSLCantCompute
|
||||
return TOUCH_INVALID_TEXCOORD if event in DetectionEvents \
|
||||
and 0 <= idx <= 15 else ZERO_VECTOR
|
||||
return ZERO_VECTOR
|
||||
|
||||
def llDetectedTouchUV(idx, event=None):
|
||||
idx = fi(idx)
|
||||
if 0 <= idx <= 15 and (event in TouchEvents or event is None):
|
||||
if 0 <= idx <= 15 and (event is None or event in DetectionEvents):
|
||||
# In detection events that are not touch events, it returns
|
||||
# TOUCH_INVALID_TEXCOORD if idx < num, else ZERO_VECTOR,
|
||||
# but we only know that num >= 1.
|
||||
if idx == 0 and event is not None and event not in TouchEvents:
|
||||
# index 0 always exists, so we know the result
|
||||
return TOUCH_INVALID_TEXCOORD
|
||||
raise ELSLCantCompute
|
||||
return TOUCH_INVALID_TEXCOORD if event in DetectionEvents \
|
||||
and 0 <= idx <= 15 else ZERO_VECTOR
|
||||
return ZERO_VECTOR
|
||||
|
||||
def llDetectedType(idx, event=None):
|
||||
idx = fi(idx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue