/
SHGlobalVar.m
executable file
·104 lines (87 loc) · 2.59 KB
/
SHGlobalVar.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//
// SHGlobalVar.m
// BBExtras
//
// Created by Steve Hooley on 02/09/2006.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "SHGlobalVar.h"
#import "SHNumberPort.h"
@implementation SHGlobalVar
#pragma mark -
#pragma mark class methods
//===========================================================
// + timeMode:
//===========================================================
+ (int)timeMode {
return 1; //Forces continuous execution
}
//===========================================================
// + executionMode:
//===========================================================
+ (int)executionMode
{
// I have found the following execution modes:
// 1 - Renderer, Environment - pink title bar
// 2 - Source, Tool, Controller - blue title bar
// 3 - Numeric, Modifier, Generator - green title bar
return 3;
}
//===========================================================
// + allowsSubpatches:
//===========================================================
+ (BOOL)allowsSubpatches {
return FALSE;
}
#pragma mark init methods
//===========================================================
// - initWithIdentifier:
//===========================================================
- (id)initWithIdentifier:(id)fp8
{
if (![super initWithIdentifier:fp8])
return nil;
// BBLog(@"SHGlobalVar.. initWithIdentifier");
[inputKeyForVariable setStringValue:@"default"];
[inputTakeSampleSignal setBooleanValue:NO];
[inputSignal setDoubleValue:0];
[outputValue setDoubleValue:0];
return self;
}
- (void)dealloc
{
[super dealloc];
}
//===========================================================
// - setup:
//===========================================================
- (id)setup:(id)fp8
{
//BBLog(@"SHGlobalVar.. setup");
[super setup:fp8];
return fp8;
}
//===========================================================
// - cleanup:
//===========================================================
- (void)cleanup:(id)fp8
{
//BBLog(@"SHGlobalVar.. cleanup");
[super cleanup:fp8];
}
#pragma mark action methods
//===========================================================
// - execute:
//===========================================================
- (BOOL)execute:(id)openGLContext_ptr time:(double)currentTime arguments:(id)fp20
{
[outputValue setKey:[inputKeyForVariable stringValue]];
if ([inputTakeSampleSignal booleanValue] == YES)
{
//BBLog(@"SHGlobalVar.. execute: key:%@, val:%f", key, (float)[inputSignal doubleValue]);
[inputTakeSampleSignal setBooleanValue:NO]; // signal like behavoir
[outputValue setDoubleValue:[inputSignal doubleValue]];
}
return TRUE;
}
@end