lib
create_bin(name, root=None, set_as_current=True)
Create media pool's folder.
Return folder object and if the name does not exist it will create a new. If the input name is with forward or backward slashes then it will create all parents and return the last child bin object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | name of folder / bin, or hierarchycal name "parent/name" | required |
root (resolve.Folder)[optional] | root folder / bin object | required | |
set_as_current (resolve.Folder)[optional] | Whether to set the resulting bin as current folder or not. | required |
Returns:
| Name | Type | Description |
|---|---|---|
object | object | resolve.Folder |
Source code in client/ayon_resolve/api/lib.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
create_compound_clip(clip_data, name, folder)
Convert timeline object into nested timeline object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
clip_data | dict | timeline item object packed into dict with project, timeline (sequence) | required |
folder | Folder | media pool folder object, | required |
name | str | name for compound clip | required |
Returns:
| Type | Description |
|---|---|
| resolve.MediaPoolItem: media pool item with compound clip timeline(cct) |
Source code in client/ayon_resolve/api/lib.py
841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 | |
create_media_pool_item(files, root=None)
Create media pool item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files | list | absolute path to a file | required |
root (resolve.Folder)[optional] | root folder / bin object | required |
Returns:
| Name | Type | Description |
|---|---|---|
object | object | resolve.MediaPoolItem |
Source code in client/ayon_resolve/api/lib.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
create_timeline_item(media_pool_item, timeline=None, timeline_in=None, source_start=None, source_end=None, track_name=None)
Add media pool item to current or defined timeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
media_pool_item | MediaPoolItem | resolve's object | required |
timeline | Optional[Timeline] | resolve's object | None |
timeline_in | Optional[int] | timeline input frame (sequence frame) | None |
source_start | Optional[int] | media source input frame (sequence frame) | None |
source_end | Optional[int] | media source output frame (sequence frame) | None |
track_name | Optional[str] | video track to add the item to. Track is created if it does not exist or is not free in item's range. Default video track is used if not set. | None |
Returns:
| Name | Type | Description |
|---|---|---|
object | object | resolve.TimelineItem |
Source code in client/ayon_resolve/api/lib.py
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | |
detect_project_fps_mismatch(task_entity=None)
Detect potential fps mismatch between project settings and task entity. Return any mismatch as a information string to be displayed to the user.
Source code in client/ayon_resolve/api/lib.py
1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | |
detect_project_resolution_mismatch(task_entity=None)
Detect potential resolution mismatch between project settings and task entity. Return any mismatch as a information string to be displayed to the user.
Source code in client/ayon_resolve/api/lib.py
1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 | |
export_timeline_otio(timeline)
Export timeline as otio.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline | Timeline | resolve's timeline | required |
Returns:
| Name | Type | Description |
|---|---|---|
otio_timeline | Timeline | Otio timeline. |
Source code in client/ayon_resolve/api/lib.py
1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | |
export_timeline_otio_native(timeline, filepath)
Get timeline otio filepath.
Only supported from Resolve 18.5
Example
Native otio export is available from Resolve 18.5
[major, minor, patch, build, suffix]
resolve_version = bmdvr.GetVersion() if tuple(resolve_version[:2]) < (18, 5): # if it is lower then use ayon's otio exporter otio_timeline = davinci_export.create_otio_timeline( resolve_project, timeline=timeline) davinci_export.write_to_file(otio_timeline, filepath) else: # use native otio export export_timeline_otio_native(timeline, filepath)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline | Timeline | resolve's object | required |
filepath | str | otio file path | required |
Returns:
| Name | Type | Description |
|---|---|---|
bool | True if success |
Source code in client/ayon_resolve/api/lib.py
1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 | |
export_timeline_otio_to_file(timeline, filepath)
Export timeline as otio filepath.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline | Timeline | resolve's timeline | required |
filepath | str | otio file path | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | temporary otio filepath |
Source code in client/ayon_resolve/api/lib.py
1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | |
get_any_timeline()
Get any timeline object.
Returns:
| Type | Description |
|---|---|
| object | None: resolve.Timeline |
Source code in client/ayon_resolve/api/lib.py
191 192 193 194 195 196 197 198 199 200 | |
get_clip_attributes(clip)
Collect basic attributes from resolve timeline item
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
clip | TimelineItem | timeline item object | required |
Returns:
| Name | Type | Description |
|---|---|---|
dict | all collected attributres as key: values |
Source code in client/ayon_resolve/api/lib.py
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | |
get_clip_resolution_from_media_pool(timeline_item_data)
Return the clip resolution from media pool data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline_item_data | dict | Timeline item to investigate. | required |
Returns:
| Name | Type | Description |
|---|---|---|
resolution_info | dict | The parsed resolution data. |
Source code in client/ayon_resolve/api/lib.py
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 | |
get_current_resolve_project()
Get current resolve project object.
Returns:
| Type | Description |
|---|---|
| resolve.Project |
Source code in client/ayon_resolve/api/lib.py
159 160 161 162 163 164 165 166 | |
get_current_timeline(new=False)
Get current timeline object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new (bool)[optional] | [DEPRECATED] if True it will create new timeline if none exists | required |
Returns:
| Type | Description |
|---|---|
| object | None: resolve.Timeline |
Source code in client/ayon_resolve/api/lib.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
get_current_timeline_items(filter=False, track_type=None, track_name=None, selecting_color=None)
Get all available current timeline track items
Source code in client/ayon_resolve/api/lib.py
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | |
get_media_pool_item(filepath, root=None)
Return clip if found in folder with use of input file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath | str | absolute path to a file | required |
root (resolve.Folder)[optional] | root folder / bin object | required |
Returns:
| Name | Type | Description |
|---|---|---|
object | object | resolve.MediaPoolItem |
Source code in client/ayon_resolve/api/lib.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
get_media_storage()
Get media storage object.
Returns:
| Type | Description |
|---|---|
| resolve.MediaStorage |
Source code in client/ayon_resolve/api/lib.py
147 148 149 150 151 152 153 154 155 156 | |
get_new_timeline(timeline_name=None)
Get new timeline object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline_name | str | New timeline name. | None |
Returns:
| Name | Type | Description |
|---|---|---|
object | resolve.Timeline |
Source code in client/ayon_resolve/api/lib.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
get_or_create_video_track(timeline, name, start=None, end=None)
Get video track by name, create it if missing.
Existing track is used only if it is unlocked and, when start and end are given, free in that range. Otherwise the next numbered track (<name>_2, <name>_3, ...) is tried or created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline | Timeline | resolve's object | required |
name | str | base track name | required |
start | Optional[int] | first timeline frame required to be free | None |
end | Optional[int] | timeline frame after the last required frame | None |
Returns:
| Name | Type | Description |
|---|---|---|
int | int | 1-based track index |
Source code in client/ayon_resolve/api/lib.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | |
get_otio_clip_instance_data(otio_timeline, timeline_item_data)
Return otio objects for timeline, track and clip
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline_item_data | dict | timeline_item_data from list returned by resolve.get_current_timeline_items() | required |
otio_timeline | Timeline | otio object | required |
Returns:
| Name | Type | Description |
|---|---|---|
dict | otio clip object |
Source code in client/ayon_resolve/api/lib.py
1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 | |
get_project_manager()
Get project manager object.
Returns:
| Type | Description |
|---|---|
| resolve.ProjectManager |
Source code in client/ayon_resolve/api/lib.py
134 135 136 137 138 139 140 141 142 143 144 | |
get_publish_attribute(timeline_item)
Get Publish attribute from marker on timeline item
Attribute
timeline_item (resolve.TimelineItem): resolve's object
Source code in client/ayon_resolve/api/lib.py
788 789 790 791 792 793 794 795 | |
get_pype_clip_metadata(clip)
Get AYON metadata created by creator plugin
Attributes:
| Name | Type | Description |
|---|---|---|
clip | TimelineItem | resolve's object |
Returns:
| Name | Type | Description |
|---|---|---|
dict | hierarchy, orig clip attributes |
Source code in client/ayon_resolve/api/lib.py
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 | |
get_reformated_path(path, padded=False, first=False)
Return fixed python expression path
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | path url or simple file name | required |
Returns:
| Name | Type | Description |
|---|---|---|
type | string with reformatted path |
Example
get_reformated_path("plate.[0001-1008].exr") > plate.%04d.exr
Source code in client/ayon_resolve/api/lib.py
1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 | |
get_timeline_item(media_pool_item, timeline=None)
Returns clips related to input mediaPoolItem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
media_pool_item | MediaPoolItem | resolve's object | required |
timeline (resolve.Timeline)[optional] | resolve's object | required |
Returns:
| Name | Type | Description |
|---|---|---|
object | object | resolve.TimelineItem |
Source code in client/ayon_resolve/api/lib.py
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | |
get_timeline_item_ayon_tag(timeline_item)
Get ayon track item tag created by creator or loader plugin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline_item | TimelineItem | resolve object | required |
Returns:
| Name | Type | Description |
|---|---|---|
dict | ayon tag data |
Source code in client/ayon_resolve/api/lib.py
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | |
get_timeline_item_by_name(name)
Get timeline item by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | name of timeline item | required |
Returns:
| Name | Type | Description |
|---|---|---|
object | object | resolve.TimelineItem |
Source code in client/ayon_resolve/api/lib.py
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | |
get_timeline_media_pool_item(timeline, root=None)
Return MediaPoolItem from Timeline
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline | Timeline | timeline object | required |
root | Folder | root folder / bin object | None |
Returns:
| Type | Description |
|---|---|
object | resolve.MediaPoolItem: media pool item from timeline |
Source code in client/ayon_resolve/api/lib.py
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 | |
get_track_end_frame(timeline, track_index, track_type='video')
Return the first timeline frame after the last item of the track.
Returns:
| Type | Description |
|---|---|
int | None | Optional[int]: None if the track has no items. |
Source code in client/ayon_resolve/api/lib.py
357 358 359 360 361 362 363 364 365 366 | |
get_video_track_index_by_name(timeline, name)
Return index of the first video track with given name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline | Timeline | resolve's object | required |
name | str | track name | required |
Returns:
| Type | Description |
|---|---|
int | Optional[int]: 1-based track index, None if there is no such track. |
Source code in client/ayon_resolve/api/lib.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
imprint(timeline_item, data=None)
Adding AYON data into a timeline item track item tag.
Also including publish attribute into tag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline_item | TimelineItem | resolve's object | required |
data | dict | Any data which needs to be imprinted | None |
Examples:
data = { 'folderPath': '/shots/sq020sh0280', 'productBaseType': 'render', 'productName': 'renderMain' }
Source code in client/ayon_resolve/api/lib.py
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | |
is_track_range_free(timeline, track_index, start, end, track_type='video')
Check that no item of the track overlaps with start - end range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeline | Timeline | resolve's object | required |
track_index | int | 1-based track index | required |
start | int | first timeline frame of the range | required |
end | int | timeline frame after the last frame of the range | required |
track_type | str | resolve's track type | 'video' |
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if the range is not used by any item. |
Source code in client/ayon_resolve/api/lib.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | |
iter_all_media_pool_clips(root=None)
Recursively iterate all media pool clips in current project
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root | Optional[Folder] | root folder / bin object. When None, defaults to media pool root folder. | None |
Source code in client/ayon_resolve/api/lib.py
1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 | |
maintain_current_timeline(to_timeline, from_timeline=None)
Maintain current timeline selection during context
Attributes:
| Name | Type | Description |
|---|---|---|
from_timeline | resolve.Timeline)[optional] | |
Example: >>> print(from_timeline.GetName()) timeline1 >>> print(to_timeline.GetName()) timeline2
>>> with maintain_current_timeline(to_timeline):
... print(get_current_timeline().GetName())
timeline2
>>> print(get_current_timeline().GetName())
timeline1
Source code in client/ayon_resolve/api/lib.py
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 | |
maintain_page_by_name(page_name)
Maintain specific page by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page_name | str | name of the page | required |
Example
with maintain_page_by_name("Deliver"): ... print("Deliver page is open") Deliver page is open
Source code in client/ayon_resolve/api/lib.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
remove_media_pool_item(media_pool_item)
Remove media pool item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
media_pool_item | MediaPoolItem | resolve's object | required |
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if success |
Source code in client/ayon_resolve/api/lib.py
267 268 269 270 271 272 273 274 275 276 277 278 | |
set_project_fps(task_entity=None)
Attempt to set project frame rate from AYON current task. This might not be possible if a timeline already exists within the project. Return a error string if any issue so it can be displayed to the user.
Source code in client/ayon_resolve/api/lib.py
1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 | |
set_project_manager_to_folder_name(folder_name)
Sets context of Project manager to given folder by name.
Searching for folder by given name from root folder to nested. If no existing folder by name it will create one in root folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_name | str | name of searched folder | required |
Returns:
| Name | Type | Description |
|---|---|---|
bool | True if success |
Raises:
| Type | Description |
|---|---|
Exception | Cannot create folder in root |
Source code in client/ayon_resolve/api/lib.py
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | |
set_project_resolution(task_entity=None)
Attempt to set project resolution from AYON current task. Return a error string if any issue so it can be displayed to the user.
Source code in client/ayon_resolve/api/lib.py
1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 | |
set_publish_attribute(timeline_item, value)
Set Publish attribute to marker on timeline item
Attribute
timeline_item (resolve.TimelineItem): resolve's object
Source code in client/ayon_resolve/api/lib.py
776 777 778 779 780 781 782 783 784 785 | |
set_timeline_item_ayon_tag(timeline_item, data=None)
Set ayon track item tag to input timeline_item.
Attributes:
| Name | Type | Description |
|---|---|---|
trackItem | TimelineItem | resolve api object |
Returns:
| Name | Type | Description |
|---|---|---|
dict | json loaded data |
Source code in client/ayon_resolve/api/lib.py
712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | |
swap_clips(from_clip, to_clip, to_in_frame, to_out_frame)
Swapping clips on timeline in timelineItem
It will add take and activate it to the frame range which is inputted
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_clip_name | str | name of to_clip | required |
to_in_frame | float | cut in frame, usually | required |
to_out_frame | float | cut out frame, usually left offset plus duration | required |
Returns:
| Name | Type | Description |
|---|---|---|
bool | True if successfully replaced |
Source code in client/ayon_resolve/api/lib.py
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 | |