Implement adaptive inspector and responsive canvas controls for 1.12.1
这个提交包含在:
1 父节点
91b66eb2d8
当前提交
585c83c8a1
21 个文件已更改
+316
-68
没有与搜索条件相匹配的文件
@@ -15,16 +15,20 @@
|
||||
// incomplete samples are rejected as a unit, before the first host write.
|
||||
- (void)changeValues:(NSDictionary<NSString*,NSNumber*>*)values;
|
||||
- (void)endGesture;
|
||||
- (uint64_t)endCurveGesture;
|
||||
- (BOOL)gesturePending:(uint64_t)gesture;
|
||||
// Call before the owning plug-in releases this object during teardown.
|
||||
- (void)invalidate;
|
||||
- (void)requestWorkspace;
|
||||
- (void)requestWorkspacePage:(NSString *)page;
|
||||
- (void)requestMask:(NSInteger)kind;
|
||||
- (void)requestTool:(NSString*)type;
|
||||
- (void)publishAssets:(DYAssetState*)assets histogram:(NSData*)histogram atTime:(CMTime)time;
|
||||
- (void)requestWhiteBalanceAtTime:(CMTime)time;
|
||||
@property(nonatomic,retain) DYRenderer *renderer;
|
||||
- (NSData*)canvasHistogramAtTime:(CMTime)time;
|
||||
- (void)publishAssets:(DYAssetState*)assets atTime:(CMTime)time;
|
||||
- (void)beginSpider:(NSData*)mesh node:(NSString*)node enabled:(double)enabled atTime:(CMTime)time;
|
||||
- (void)changeSpider:(NSData*)mesh;
|
||||
- (void)publishHistogram:(NSData*)histogram atTime:(CMTime)time;
|
||||
@end
|
||||
|
||||
static BOOL DYViewerSameValue(double a,double b) {
|
||||
@@ -61,7 +65,7 @@ static BOOL DYViewerSanitizeValue(NSDictionary *d,double input,double *output) {
|
||||
NSDictionary *_snapshot,*_sourceDocument;NSString *_selectedNode;
|
||||
CMTime _snapshotTime;
|
||||
BOOL _invalidated,_validationScheduled;
|
||||
uint64_t _requestSequence,_requestedGesture;
|
||||
uint64_t _requestSequence,_requestedGesture,_completedGesture;
|
||||
|
||||
// The fields below are confined to the main queue.
|
||||
id<PROAPIAccessing> _writerHost,_writerTarget;
|
||||
@@ -72,6 +76,7 @@ static BOOL DYViewerSanitizeValue(NSDictionary *d,double input,double *output) {
|
||||
uint64_t _writerGesture;
|
||||
BOOL _writerUndoOpen,_writerSpider; NSData *_writerLastMesh;
|
||||
}
|
||||
@synthesize renderer=_renderer;
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager {
|
||||
if((self=[super init])){_apiManager=manager;_snapshotTime=kCMTimeInvalid;_writerTime=kCMTimeInvalid;[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(workspaceSelected:) name:@"DYWorkspaceToolSelection" object:manager];}return self;
|
||||
}
|
||||
@@ -79,14 +84,21 @@ static BOOL DYViewerSanitizeValue(NSDictionary *d,double input,double *output) {
|
||||
// invalidate enqueues closure before the owner releases its final reference;
|
||||
// the queued block keeps the bridge alive until its host group is closed.
|
||||
NSCAssert(!_writerUndoOpen,@"Viewer parameter group must be closed before teardown");
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self];[_selectedNode release];[_snapshot release];[_sourceDocument release];[_writerHost release];[_writerTarget release];
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self];[_renderer release];[_selectedNode release];[_snapshot release];[_sourceDocument release];[_writerHost release];[_writerTarget release];
|
||||
[_writerDescriptors release];[_writerLastValues release];[_writerCompanions release];[_writerNode release];[_writerType release];[super dealloc];
|
||||
}
|
||||
- (void)publishAssets:(DYAssetState*)assets histogram:(NSData*)histogram atTime:(CMTime)time {
|
||||
@synchronized(self){if(_invalidated||!_snapshot||CMTimeCompare(time,_snapshotTime)!=0)return;NSMutableDictionary *next=[[_snapshot mutableCopy]autorelease];next[@"spider"]=assets.spiderMesh?:[NSData data];if(histogram)next[@"histogram"]=histogram;[_snapshot release];_snapshot=[next copy];}
|
||||
- (void)publishAssets:(DYAssetState*)assets atTime:(CMTime)time {
|
||||
@synchronized(self){if(_invalidated||!_snapshot||CMTimeCompare(time,_snapshotTime)!=0)return;NSMutableDictionary *next=[[_snapshot mutableCopy]autorelease];next[@"spider"]=assets.spiderMesh?:[NSData data];[_snapshot release];_snapshot=[next copy];}
|
||||
}
|
||||
- (void)publishHistogram:(NSData*)histogram atTime:(CMTime)time {
|
||||
if(histogram.length!=sizeof(DYHistogram))return;@synchronized(self){if(_invalidated||!_snapshot||CMTimeCompare(time,_snapshotTime)!=0)return;NSMutableDictionary *next=[[_snapshot mutableCopy]autorelease];next[@"histogram"]=histogram;[_snapshot release];_snapshot=[next copy];}
|
||||
- (NSData*)canvasHistogramAtTime:(CMTime)time {
|
||||
return [_renderer canvasHistogramAtTime:time];
|
||||
}
|
||||
- (void)requestWhiteBalanceAtTime:(CMTime)time {
|
||||
if(!CMTIME_IS_NUMERIC(time))return;
|
||||
dispatch_async(dispatch_get_main_queue(),^{
|
||||
id manager=nil;@synchronized(self){if(!self->_invalidated)manager=self->_apiManager;}
|
||||
if(manager)[NSNotificationCenter.defaultCenter postNotificationName:@"DYViewerWhiteBalanceRequested" object:manager userInfo:@{@"time":[NSValue valueWithCMTime:time]}];
|
||||
});
|
||||
}
|
||||
- (void)requestTool:(NSString*)type {
|
||||
if(![DYToolTypes()containsObject:type])return;
|
||||
@@ -121,9 +133,7 @@ static BOOL DYViewerSanitizeValue(NSDictionary *d,double input,double *output) {
|
||||
NSData *bytes=[NSData dataWithBytes:uniforms length:sizeof(*uniforms)];BOOL validate=NO;
|
||||
@synchronized(self){
|
||||
if(!_invalidated){
|
||||
NSData *sameHistogram=CMTimeCompare(_snapshotTime,time)==0?[_snapshot[@"histogram"]retain]:nil;
|
||||
[_snapshot release];_snapshot=[@{@"uniforms":bytes,@"document":frozen,@"timeValue":@(time.value),@"timeScale":@(time.timescale),@"timeEpoch":@(time.epoch)}copy];
|
||||
if(sameHistogram){NSMutableDictionary *withHistogram=[[_snapshot mutableCopy]autorelease];withHistogram[@"histogram"]=sameHistogram;[_snapshot release];_snapshot=[withHistogram copy];[sameHistogram release];}
|
||||
[_sourceDocument release];_sourceDocument=[document retain];_snapshotTime=time;
|
||||
if(_requestedGesture&&!_validationScheduled){_validationScheduled=YES;validate=YES;}
|
||||
}
|
||||
@@ -329,9 +339,55 @@ static BOOL DYViewerSanitizeValue(NSDictionary *d,double input,double *output) {
|
||||
if(gesture)dispatch_async(dispatch_get_main_queue(),^{[self writeValues:frozen gesture:gesture];});
|
||||
[frozen release];
|
||||
}
|
||||
- (void)endGesture {
|
||||
- (void)refreshSavedCurve {
|
||||
if(![_writerType isEqual:@"curve"])return;
|
||||
id<FxCustomParameterActionAPI_v4> action=[_writerHost apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];
|
||||
id<FxParameterRetrievalAPI_v6> get=[_writerHost apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];
|
||||
BOOL base=[_writerNode hasPrefix:@"base:"];
|
||||
NSMutableDictionary *values=[NSMutableDictionary dictionary];
|
||||
NSDictionary *document=nil;
|
||||
[action startAction:self];@try{
|
||||
if(CMTimeCompare(DYHostDisplayedFrameTime(_writerHost,action.currentTime),_writerTime)!=0)return;
|
||||
if(base)for(NSDictionary *d in _writerDescriptors){
|
||||
double value=NAN;
|
||||
if(![get getFloatValue:&value fromParameter:[d[@"pid"]unsignedIntValue] atTime:_writerTime]||!std::isfinite(value))return;
|
||||
values[d[@"offset"]]=@(value);
|
||||
}else document=DYReadTools(_writerHost,_writerTime).document;
|
||||
}@finally{[action endAction:self];}
|
||||
@synchronized(self){
|
||||
if(_invalidated||!_snapshot||CMTimeCompare(_snapshotTime,_writerTime)!=0)return;
|
||||
NSMutableDictionary *next=[[_snapshot mutableCopy]autorelease];
|
||||
if(base){
|
||||
DYUniforms uniforms;
|
||||
[next[@"uniforms"] getBytes:&uniforms length:sizeof(uniforms)];
|
||||
for(NSNumber *offset in values)*(float*)((uint8_t*)&uniforms+offset.unsignedIntegerValue)=[values[offset]floatValue];
|
||||
next[@"uniforms"]=[NSData dataWithBytes:&uniforms length:sizeof(uniforms)];
|
||||
}else if(document){
|
||||
next[@"document"]=document;
|
||||
[_sourceDocument release];_sourceDocument=nil;
|
||||
}
|
||||
[_snapshot release];_snapshot=[next copy];
|
||||
}
|
||||
}
|
||||
- (uint64_t)finishGestureRefreshingCurve:(BOOL)refresh {
|
||||
uint64_t gesture;@synchronized(self){gesture=_requestedGesture;_requestedGesture=0;}
|
||||
if(gesture)dispatch_async(dispatch_get_main_queue(),^{if(self->_writerGesture==gesture)[self closeWriter];});
|
||||
if(gesture)dispatch_async(dispatch_get_main_queue(),^{
|
||||
if(self->_writerGesture==gesture){
|
||||
if(refresh)[self refreshSavedCurve];
|
||||
[self closeWriter];
|
||||
}
|
||||
@synchronized(self){self->_completedGesture=MAX(self->_completedGesture,gesture);}
|
||||
});
|
||||
return gesture;
|
||||
}
|
||||
- (void)endGesture {
|
||||
[self finishGestureRefreshingCurve:NO];
|
||||
}
|
||||
- (uint64_t)endCurveGesture {
|
||||
return [self finishGestureRefreshingCurve:YES];
|
||||
}
|
||||
- (BOOL)gesturePending:(uint64_t)gesture {
|
||||
@synchronized(self){return !_invalidated&&gesture>_completedGesture;}
|
||||
}
|
||||
- (void)invalidate {
|
||||
@synchronized(self){if(_invalidated)return;_invalidated=YES;_requestedGesture=0;_apiManager=nil;}
|
||||
|
||||
在新工单中引用
屏蔽一个用户