Jump to content
Korean Random
Sign in to follow this  
aks1983

Переключение режимов битвы через onControlModeChanged

Recommended Posts

Пробую сделать переключение свободной камеры в привязанную, 'video' -> 'postmortem', и наткнулся на переполнение стека рекурсией

# switch between modes
def switchFreeCamera():
    pih = BigWorld.player().inputHandler
    if pih.ctrlModeName == 'video':
        mode = 'postmortem' if BigWorld.player().isObserver() else 'arcade'
        pih.onControlModeChanged(mode, prevModeName=pih.ctrlModeName)
    else:
        cam_matrix = Math.Matrix(BigWorld.camera().matrix)
        pih.onControlModeChanged('video', prevModeName=pih.ctrlModeName, camMatrix=cam_matrix)
    pih.ctrl.setForcedGuiControlMode(False)

# switch to player from any mode
def switchToPlayer():
    pih = BigWorld.player().inputHandler
    if pih.ctrlModeName != 'postmortem':
        pih._AvatarInputHandler__observerVehicle = vid
        pih.onControlModeChanged('postmortem', prevModeName=pih.ctrlModeName)
    else:
        pih.selectPlayer(vid)

"""
python.log:


2016-08-29 15:14:59.824: ERROR: [EXCEPTION] (scripts/common/Event.py, 46):
Traceback (most recent call last):
  File "scripts/common/Event.py", line 44, in __call__
  File "scripts/client/AvatarInputHandler/__init__.py", line 582, in __onVehicleChanged
  File "scripts/client/AvatarInputHandler/__init__.py", line 610, in onControlModeChanged
  File "scripts/client/AvatarPositionControl.py", line 130, in bindToVehicle
  File "scripts/client/AvatarPositionControl.py", line 63, in notifyPreBind
  File "scripts/client/AvatarPositionControl.py", line 86, in __setTarget
  File "scripts/common/Event.py", line 46, in __call__
  File "scripts/common/debug_utils.py", line 158, in LOG_CURRENT_EXCEPTION
  File "scripts/common/Lib/traceback.py", line 141, in format_exception
  File "scripts/common/Lib/traceback.py", line 76, in format_tb
  File "scripts/common/Lib/traceback.py", line 100, in extract_tb
RuntimeError: maximum recursion depth exceeded
"""

Такое происходит при отлете свободной камерой далеко от танка, при этом BigWorld выгружает модели танка (BigWorld.entity(vid) == None), а при переключении ждет их загрузки. Я бы понял, если бы оно одинаково падало, однако в чистом клиенте возврат из свободной камеры по CAPS + F3 срабатывает всегда, а у меня - нет.
Во время проигрывания реплея - та же картина.

recursion_overflow.wotreplay

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...