Skip to content

Instantly share code, notes, and snippets.

@oliviano
Last active April 6, 2025 10:09
Show Gist options
  • Save oliviano/78751010eea52e8ccd7905106932fefe to your computer and use it in GitHub Desktop.
Save oliviano/78751010eea52e8ccd7905106932fefe to your computer and use it in GitHub Desktop.
# TD SNIPS
A collection of usefull snippets.
## COMPS
- `me.inputComps` Gets connected Parent ( top connector )
- list of childrens of a comp or containers:
```
a = op('Floating_01')
childsList = a.panelChildren
for c in childsList:
print(c)
```
- New Item
- New Item 2
## Project
## Storage
- store `op("myOp").store('myKey', 3.0)`
- fetch `value = op("myOp").fetch('myKey')`
- delete `value = op("myOp").unstore('*') #deletes all, unstore('Cue*')`
## DAT
## Comments
```
print('=====================')
debug('timerScreen: goto {}'.format(myNextSegment))
print('=====================')
```
```
print('=====================')
print(me.path + 'timerScreen: goto {}'.format(myNextSegment))
print('=====================')
```
## Json Examples
```
# create heartbeat dictionary
heartbeat = {}
heartbeat['stats'] = {}
heartbeat['info'] = {}
heartbeat['message_type'] = 'heartbeat'
heartbeat['epoch_time'] = epoch_time
heartbeat['date_time'] = current_time
heartbeat['info']['project_name'] = project_name
heartbeat['info']['project_path'] = project_path
heartbeat['info']['pid'] = process_id
heartbeat['stats']['fps'] = fps
heartbeat['stats']['frametime'] = frametime
heartbeat['stats']['gpu_mem_used'] = gpu_mem_used
heartbeat['stats']['total_gpu_mem'] = total_gpu_mem
heartbeat['stats']['cpu_mem_used'] = cpu_mem_used
# create json object and send it
json_object = json.dumps(heartbeat)
op('../tcpip1').send(json_object, terminator='\r\n')
```
rough
```
# Load Settings to Storage:
for settings_key , settings_value in settings.items():
debug(settings_key)
op.System.store(settings_key , settings_value)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment