-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathREADME
50 lines (36 loc) · 1.59 KB
/
README
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
# Various usages
sgServer = "https://demo.shotgunstudio.com"
sgScriptName = "demo_script"
sgScriptKey = "abcdefghijklmnopqrstuvwxyz1234567890abcd"
sg = sg_wrapper.Shotgun(sgServer, sgScriptName, sgScriptKey)
projects = sg.Projects()
for project in projects:
print "%(name)s (%(code)s : %(id)d)" % project
p = sg.Project("my_project")
p = sg.Project(name = "My Project")
shots = sg.Shots(project = p)
for shot in shots:
if shot.sg_status_list == "ip":
shot.sg_status_list = "cmpt"
shot.commit() # Actually write any changes to Shotgun
# Find all the complete shots from this project
shots = sg.Shots(project = p, sg_status_list = "cmpt")
people = sg.People() # Find all people
me = sg.Person(name = "Hugh Macdonald") # Find just me
me = sg.Person("hughmacdonald")
# If no field is specified as a kwarg, and it's a string, looks for either 'code' or 'login'.
# If the argument is an integer, then it looks for that ID
for proj in me.projects:
print "%(id)d : %(name)s" % proj
me.email = "some.other@email.com"
me.revert("email") # Reverts back to what was last pulled from Shotgun
me.revert(["email", "name"]) # Revert multiple at onece
me.revert() # Reverts everything that's been changed
sg.commit_all() # Commits any entities with changes
# If we think it might have changed in shotgun
me.reload()
# Any entities found are cached, and it will use the cached version if we search by ID (or
# try to get the same entity through a link)
# Also, any searches are cached, and will return the same result if searched for again
# To clear the cache, and force any requests to update from the server:
sg.clear_cache()