From d0e5fd8b909789b108973b2d92c616a1bd4b23c1 Mon Sep 17 00:00:00 2001 From: Star Brilliant Date: Wed, 11 Jun 2014 00:01:45 +0800 Subject: [PATCH] Handle the situation that rotation makes object behind the camera --- danmaku2ass.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/danmaku2ass.py b/danmaku2ass.py index de38bf2..29448f0 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -538,11 +538,13 @@ def ConvertFlashRotation(rotY, rotZ, X, Y, width, height): except ZeroDivisionError: logging.error('Rotation makes object behind the camera: trZ == %.0f' % trZ); scaleXY = 1 - if scaleXY < 0: - scaleXY = -scaleXY - logging.error('Rotation makes object behind the camera: trZ == %.0f < %.0f' % (trZ, FOV)); trX = (trX-width/2)*scaleXY+width/2 trY = (trY-height/2)*scaleXY+height/2 + if scaleXY < 0: + scaleXY = -scaleXY + outX += 180 + outY += 180 + logging.error('Rotation makes object behind the camera: trZ == %.0f < %.0f' % (trZ, FOV)); return (trX, trY, WrapAngle(outX), WrapAngle(outY), WrapAngle(outZ), scaleXY*100, scaleXY*100)