Cover the seventh canvas tool and handle FCP callback timing
这个提交包含在:
1 父节点
320f4c5f91
当前提交
a2a6e57c13
4 个文件已更改
+23
-10
没有与搜索条件相匹配的文件
+11
-8
@@ -23,12 +23,11 @@
|
||||
_levelHasFirst=_levelDown=_levelSecondPress=NO;
|
||||
[_levelFailure release];_levelFailure=nil;
|
||||
}
|
||||
- (void)updateLevelFrom:(DYPlugIn *)plugin time:(CMTime)time {
|
||||
- (void)updateLevelFrom:(DYPlugIn *)plugin {
|
||||
double angle=0;
|
||||
double fallback=NSWidth(_imageRect)>0&&NSHeight(_imageRect)>0?NSWidth(_imageRect)/NSHeight(_imageRect):1;
|
||||
_level=plugin?[plugin toolCanvasLevelForAspect:fallback rotation:&angle]:DYLevelTransform(0,fallback);
|
||||
if(_levelMode!=_viewerControls.levelMode||_levelAngle!=angle||
|
||||
(_levelHasFirst&&CMTIME_IS_NUMERIC(time)&&CMTimeCompare(time,_levelTime)!=0))[self clearLevelLine];
|
||||
if(_levelMode!=_viewerControls.levelMode||_levelAngle!=angle)[self clearLevelLine];
|
||||
_levelMode=_viewerControls.levelMode;_levelAngle=angle;
|
||||
}
|
||||
- (NSPoint)displayUV:(NSPoint)point {
|
||||
@@ -59,6 +58,10 @@
|
||||
if(type==NSEventTypeKeyDown&&key==27){
|
||||
_viewerControls.levelMode=0;[self clearLevelLine];return YES;
|
||||
}
|
||||
// FCP's drawing and event callbacks may report different sample times.
|
||||
// Compare events only and leave room for the host's sub-frame drift.
|
||||
if(_levelHasFirst&&(type==NSEventTypeLeftMouseDown||type==NSEventTypeLeftMouseUp)&&
|
||||
(time.epoch!=_levelTime.epoch||fabs(CMTimeGetSeconds(CMTimeSubtract(time,_levelTime)))>.05))[self clearLevelLine];
|
||||
if(type==NSEventTypeLeftMouseDown&&part==10015){
|
||||
if(_levelSaving)return YES;
|
||||
[_levelFailure release];_levelFailure=nil;
|
||||
@@ -172,7 +175,7 @@
|
||||
id<FxOnScreenControlAPI_v4>api=[_apiManager apiForProtocol:@protocol(FxOnScreenControlAPI_v4)];double lx=0,ly=0,ux=0,uy=0;[api convertPointFromSpace:kFxDrawingCoordinates_OBJECT fromX:0 fromY:0 toSpace:kFxDrawingCoordinates_CANVAS toX:&lx toY:&ly];[api convertPointFromSpace:kFxDrawingCoordinates_OBJECT fromX:1 fromY:1 toSpace:kFxDrawingCoordinates_CANVAS toX:&ux toY:&uy];_imageRect=NSMakeRect(lx,_height-uy,ux-lx,uy-ly);_uiScale=[api respondsToSelector:@selector(backingScaleFactor)]?MAX(1.,MIN(3.,[api backingScaleFactor])):1.;
|
||||
DYPlugIn *plugin=[self pluginAtTime:time];NSDictionary *mask=[plugin toolCanvasMaskAtTime:time];NSInteger route=(plugin?1:0)+(mask?2:0);if(route!=_lastRoute||_drawCount++<2){_lastRoute=route;os_log(OS_LOG_DEFAULT,"dayu_tool_osc_route plugin=%{public}d mask=%{public}d width=%{public}.2f height=%{public}.2f",plugin!=nil,mask!=nil,_imageRect.size.width,_imageRect.size.height);}[_mask release];_mask=[mask copy];[_handles removeAllObjects];[_outline release];_outline=nil;
|
||||
[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(canvasWidth,_height) scale:_uiScale atTime:time];
|
||||
[self updateLevelFrom:plugin time:time];
|
||||
[self updateLevelFrom:plugin];
|
||||
if(_levelMode)mask=nil;
|
||||
if(plugin&&canvasWidth>0&&_height>0&&canvasWidth<16384&&_height<16384&&_imageRect.size.width>0&&_imageRect.size.height>0){
|
||||
NSRect region=mask||_viewerControls.stampArmed||_levelMode?NSMakeRect(0,0,canvasWidth,_height):NSIntegralRect([_viewerControls drawingBounds]);
|
||||
@@ -223,11 +226,11 @@
|
||||
for(NSDictionary *h in _handles){NSPoint q=[h[@"point"]pointValue];if(hypot(q.x-point.x,q.y-point.y)<=9*_uiScale)return [h[@"part"]integerValue];}
|
||||
if(p.kind==DYMaskBezier||p.kind==DYMaskLinearGradient||[_outline containsPoint:point])return 1;return 0;
|
||||
}
|
||||
- (void)hitTestOSCAtMousePositionX:(double)x mousePositionY:(double)y activePart:(NSInteger*)part atTime:(CMTime)time{@synchronized(self){DYPlugIn*plugin=[self pluginAtTime:time];[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(_canvasWidth,_height) scale:_uiScale atTime:time];NSDictionary *fresh=[plugin toolCanvasMaskAtTime:time];[_mask release];_mask=[fresh copy];[self updateLevelFrom:plugin time:time];NSInteger hit=[self partAtPoint:NSMakePoint(x,_height-y)];if(part)*part=hit;if(_hitDiagnostics++<16)os_log(OS_LOG_DEFAULT,"dayu_tool_osc_hit x=%{public}.2f y=%{public}.2f height=%{public}.2f rect=%{public}.2f,%{public}.2f,%{public}.2f,%{public}.2f mask=%{public}d hit=%{public}ld",x,y,_height,_imageRect.origin.x,_imageRect.origin.y,_imageRect.size.width,_imageRect.size.height,_mask!=nil,(long)hit);}}
|
||||
- (void)hitTestOSCAtMousePositionX:(double)x mousePositionY:(double)y activePart:(NSInteger*)part atTime:(CMTime)time{@synchronized(self){DYPlugIn*plugin=[self pluginAtTime:time];[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(_canvasWidth,_height) scale:_uiScale atTime:time];NSDictionary *fresh=[plugin toolCanvasMaskAtTime:time];[_mask release];_mask=[fresh copy];[self updateLevelFrom:plugin];NSInteger hit=[self partAtPoint:NSMakePoint(x,_height-y)];if(part)*part=hit;if(_hitDiagnostics++<16)os_log(OS_LOG_DEFAULT,"dayu_tool_osc_hit x=%{public}.2f y=%{public}.2f height=%{public}.2f rect=%{public}.2f,%{public}.2f,%{public}.2f,%{public}.2f mask=%{public}d hit=%{public}ld",x,y,_height,_imageRect.origin.x,_imageRect.origin.y,_imageRect.size.width,_imageRect.size.height,_mask!=nil,(long)hit);}}
|
||||
- (BOOL)event:(NSEventType)type x:(double)x y:(double)y part:(NSInteger)part modifiers:(FxModifierKeys)modifiers key:(unichar)key time:(CMTime)time {@synchronized(self){
|
||||
DYPlugIn *plugin=[self pluginAtTime:time];if(_eventDiagnostics++<12)os_log(OS_LOG_DEFAULT,"dayu_tool_osc_event type=%{public}ld part=%{public}ld x=%{public}.2f y=%{public}.2f plugin=%{public}d",(long)type,(long)part,x,y,plugin!=nil);[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(_canvasWidth,_height) scale:_uiScale atTime:time];NSPoint canvasPoint=NSMakePoint(x,_height-y);
|
||||
if(_maskCapturing&&plugin!=_maskCaptureOwner){_maskCapturing=NO;_maskCaptureOwner=nil;return NO;}
|
||||
[self updateLevelFrom:plugin time:time];
|
||||
[self updateLevelFrom:plugin];
|
||||
if(_stampSaving)return YES;
|
||||
if([self handleLevelEvent:type point:canvasPoint part:part key:key time:time plugin:plugin])return YES;
|
||||
if(!_viewerControls.stampArmed)[self clearStampCreation];
|
||||
@@ -276,7 +279,7 @@
|
||||
if(type==NSEventTypeKeyDown&&key==27&&[_viewerControls capturing])return [_viewerControls finishCapture];
|
||||
BOOL penAction=type==NSEventTypeLeftMouseDown&&(part==10009||part==10010);
|
||||
if(!ownedMask&&!penAction&&type!=NSEventTypeKeyDown&&[_viewerControls event:type point:canvasPoint atTime:time]){
|
||||
[self updateLevelFrom:plugin time:time];
|
||||
[self updateLevelFrom:plugin];
|
||||
if(_viewerControls.levelResetRequested){_viewerControls.levelResetRequested=NO;[self commitLevel:0 plugin:plugin];}
|
||||
return YES;
|
||||
}
|
||||
@@ -291,7 +294,7 @@
|
||||
- (void)mouseUpAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{BOOL result=[self event:NSEventTypeLeftMouseUp x:x y:y part:part modifiers:m key:0 time:t];if(update)*update=result;}
|
||||
- (void)keyDownAtPositionX:(double)x positionY:(double)y keyPressed:(unsigned short)key modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update didHandle:(BOOL*)handled atTime:(CMTime)t{BOOL result=(key==27||key==13||key==10||key==3||key==8||key==127)&&[self event:NSEventTypeKeyDown x:x y:y part:1 modifiers:m key:key time:t];if(update)*update=result;if(handled)*handled=result;}
|
||||
- (void)mouseMovedAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{@synchronized(self){
|
||||
DYPlugIn*plugin=[self pluginAtTime:t];[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(_canvasWidth,_height) scale:_uiScale atTime:t];[self updateLevelFrom:plugin time:t];NSPoint point=NSMakePoint(x,_height-y);NSInteger viewerHit=[_viewerControls partAtPoint:point];BOOL redraw=[_viewerControls mouseMoved:point];NSDictionary *mask=[plugin toolCanvasMaskAtTime:t];BOOL drawing=[mask[@"drawing"]boolValue]||[mask[@"drawShape"]boolValue];NSCursor *cursor=[_viewerControls headerAtPoint:point]?([_viewerControls capturing]?NSCursor.closedHandCursor:NSCursor.openHandCursor):viewerHit?NSCursor.pointingHandCursor:(part==10014||part==10015)?NSCursor.crosshairCursor:part>=10000?NSCursor.pointingHandCursor:(drawing||part>=1000)?NSCursor.crosshairCursor:part?NSCursor.openHandCursor:NSCursor.arrowCursor;[[_apiManager apiForProtocol:@protocol(FxOnScreenControlAPI_v4)]setCursor:cursor];if(_levelMode&&_levelHasFirst&&!_levelDown&&!_levelSaving&&!viewerHit&&part==10015){
|
||||
DYPlugIn*plugin=[self pluginAtTime:t];[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(_canvasWidth,_height) scale:_uiScale atTime:t];[self updateLevelFrom:plugin];NSPoint point=NSMakePoint(x,_height-y);NSInteger viewerHit=[_viewerControls partAtPoint:point];BOOL redraw=[_viewerControls mouseMoved:point];NSDictionary *mask=[plugin toolCanvasMaskAtTime:t];BOOL drawing=[mask[@"drawing"]boolValue]||[mask[@"drawShape"]boolValue];NSCursor *cursor=[_viewerControls headerAtPoint:point]?([_viewerControls capturing]?NSCursor.closedHandCursor:NSCursor.openHandCursor):viewerHit?NSCursor.pointingHandCursor:(part==10014||part==10015)?NSCursor.crosshairCursor:part>=10000?NSCursor.pointingHandCursor:(drawing||part>=1000)?NSCursor.crosshairCursor:part?NSCursor.openHandCursor:NSCursor.arrowCursor;[[_apiManager apiForProtocol:@protocol(FxOnScreenControlAPI_v4)]setCursor:cursor];if(_levelMode&&_levelHasFirst&&!_levelDown&&!_levelSaving&&!viewerHit&&part==10015){
|
||||
_levelLast=[self clampedDisplayUV:point];redraw=YES;
|
||||
}else if(!_levelMode&&[mask[@"drawing"]boolValue]&&!viewerHit)[self event:NSEventTypeMouseMoved x:x y:y part:part modifiers:m key:0 time:t];
|
||||
if(update)*update=redraw||(!_levelMode&&[mask[@"drawing"]boolValue])||_stampNeedsRedraw;_stampNeedsRedraw=NO;
|
||||
|
||||
在新工单中引用
屏蔽一个用户