This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
shotgun_fields_example_E.mu
224 lines (201 loc) · 8.87 KB
/
shotgun_fields_example_E.mu
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
require runtime;
module: shotgun_fields_config_E
{
require shotgun_stringMap;
StringMap := shotgun_stringMap.StringMap;
function: serverMap (string; )
{
//
// If you decide to store your servers and script keys here
// instead of in an environment variable, edit the below to
// return a string of pairs of server urls and corresponding
// script keys separated by spaces, like this:
//
// return "https://tweak.shotgunstudio.com 4b1676497a208c845b12f5c6734daf9d6e7c6274 http://blah.shotgunstudio.com 4b1676497a208c845b12f5c6734daf9d6e7c6274"
//
// You can have as many server/key pairs as you want, and the
// first will be considered the default.
//
return nil;
}
function: fieldDescriptors((string, string, string, string, string, bool)[]; )
{
//
// In all the below, do NOT change the values in the "name"
// column. These are the keys, by which RV will index these
// arrays of information.
//
(string, string, string, string, string, bool)[] descriptors = {
//
// Entity fields. These may be any number of hops away from
// the Version. Note the shot/asset fields. The "link"field
// may point to either a Shot or an Asset. Both are supported
// by specifying the Link field and then that the Shot and Asset
// fields are computed from the Link field. The computation is
// internal and not part of the "compute" function defined
// below.
//
// name prettyName fieldName fieldType entityType compute
("link", "Link", "entity", "entity", "Version", false),
("shot", "Shot", "link", "entity", "Version", true),
("asset", "Asset", "link", "entity", "Version", true),
("sequence", "Sequence", "sg_sequence", "entity", "Shot", false),
("project", "Project", "project", "entity", "Version", false),
("humanUser", "HumanUser", "user", "entity", "Version", false),
//("scene", "Scene", "sg_scene", "entity", "Shot", false),
//("tankRev", "Tank Revision", "sg_tank_revision", "entity", "Version", false),
//("publishEvent", "PublishEvent", "tankRev", "entity", "Version", true),
//
// Media types. For each media type whose path is stored
// per version, you must specify path, pixel aspect, and slate boolian.
// Corresponding "swap to" menu items and prefs will be
// generated accordingly.
//
// name prettyName fieldName fieldType entityType compute
("mt_Movie", "Path To Movie", "sg_qt", "text", "Version", false),
("mt_Movie_aspect", "none", "none", "float", "Version", true),
("mt_Movie_hasSlate", "none", "sg_has_slate", "checkbox", "Version", false),
("mt_Frames", "Path To Frames","sg_path_to_frames", "text", "Version", false),
("mt_Frames_aspect", "none", "none", "float", "Version", true),
("mt_Frames_hasSlate", "none", "none", "checkbox", "Version", true),
//
// Editorial information. Can be stored on any entity, or computed
// from other information.
//
// name prettyName fieldName fieldType entityType compute
("frameMin", "Min Frame", "sg_first_frame", "number", "Version", false),
("frameMax", "Max Frame", "sg_last_frame", "number", "Version", false),
("frameIn", "In Frame", "sg_cut_in", "number", "Shot", false),
("frameOut", "Out Frame", "sg_cut_out", "number", "Shot", false),
//
// Unlike the above, the "cutOrder" must be a field on the
// Shot entity. It can be any name or type, but the
// "actualCutOrder" function defined below must be able to
// generate an int from this field.
//
("cutOrder", "Cut Order", "sg_cut_order", "number", "Shot", false),
//
// Essential.
//
// name prettyName fieldName fieldType entityType compute
("id", "ID", "id", "number", "Version", false),
//
// Arbitrary fields for the info widget can go here. Can be
// fields on any entity "reachable" from the Version enitity.
// But any entity that appears in the entityType field below
// must appear as a fieldType entry above.
//
// name prettyName fieldName fieldType entityType compute
("name", "Name", "code", "text", "Version", false),
("description", "Description", "description", "text", "Version", false),
("created", "Created", "created_at", "date_time", "Version", false),
("department", "Department", "sg_department", "text", "Version", false),
("status", "Status", "sg_status_list", "status_list", "Version", false),
("shotStatus", "Shot Status", "sg_status_list", "status_list", "Shot", false),
("seqStatus", "Sequence Status", "sg_status_list", "status_list", "Sequence",false),
("assetStatus", "Asset Status", "sg_status_list", "status_list", "Asset", false),
//("userEmail", "Artist Email", "email", "text", "HumanUser",false),
("userLogin", "Person", "login", "text", "HumanUser",false)
//("tankRevDesc", "Tank Rev Description", "description","text", "PublishEvent",false),
//("tags", "Tags", "tag_list", "multi_entity","Version", false),
//("cameraType", "Camera Type", "sg_cameratype", "text", "Shot", false)
};
return descriptors;
};
function: actualCutOrder (int; string cutOrderValue)
{
return int(cutOrderValue);
}
function: displayOrder (string[]; )
{
string[] fo = string [] {
"name",
"description",
"status",
"userLogin",
"created",
"department",
"shot",
"shotStatus",
"sequence",
"seqStatus",
"asset",
"assetStatus",
//"tags",
"mt_Movie",
"mt_Frames"
};
}
function: fieldsCompute (void; StringMap data, bool incremental)
{
//
// When 'incremental' is true, we only want to compute fields
// that "lead" to other fields (like entity fields). In
// general, we only need to compute field values after all
// entities are queried, ie when 'incremental' is false.
//
if (incremental) return;
//
// Here you can compute any fields that are not stored on
// entities, but which can be computed from fields which _are_
// stored on entities.
//
// Pull the movie path out of the url:
//
let mov = data.find("mt_Movie");
if (mov neq nil)
{
let path = regex.smatch("_file://(.*)", mov);
if (path neq nil) data.add ("mt_Movie", path.back());
else
{
print ("ERROR: cant find movie path in '%s'\n" % mov);
data.add ("mt_Movie", nil);
}
}
//
// Assume pixel aspect is always 1.0
//
data.add ("mt_Movie_aspect", "1.0");
data.add ("mt_Frames_aspect", "1.0");
//
// Frames have a slate iff movie has a slate.
//
data.add ("mt_Frames_hasSlate", data.find("mt_Movie_hasSlate"));
//
// Uncomment to dump the shotgun data to terminal
//
/*
print ("***********************************INFO\n");
print ("%s" % data.toString());
print ("***************************************\n");
*/
/*
//
// Example: you can localize your paths this way, or by using
// RV_PATH_SWAP_* environment variables (ask alan).
//
if (runtime.build_os() == "WINDOWS")
{
let frames = data.find("mt_Frames"),
altframes = data.find("mt_AltFrames"),
movie = data.find("mt_Movie");
if (frames neq nil && !regex.match("^[a-zA-Z]:", frames))
{
frames = "c:" + frames;
data.add("mt_Frames", frames);
}
if (altframes neq nil && !regex.match("^[a-zA-Z]:", altframes))
{
altframes = "c:" + altframes;
data.add("mt_AltFrames", altframes);
}
if (movie neq nil && !regex.match("^[a-zA-Z]:", movie))
{
movie = "c:" + movie;
data.add("mt_Movie", movie);
}
}
*/
}
}