ws_stub
Stub handling connection from server to client. Used anywhere solution is calling client methods.
AEItem
Bases: object
Object denoting Item in AE. Each item is created in AE by any Loader, but contains same fields, which are being used in later processing.
Source code in client/ayon_aftereffects/api/ws_stub.py
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 |
|
AfterEffectsServerStub
Stub for calling function on client (After Effects js) side.
Expects that client is already connected (started when AYON menu is opened)
'self.websocketserver.call' is used as async wrapper
Source code in client/ayon_aftereffects/api/ws_stub.py
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 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 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 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 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 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 395 396 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 443 444 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 551 552 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 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 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 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 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 710 711 712 713 714 715 716 717 |
|
add_item(name, item_type)
Adds either composition or folder to project item list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item_type | str | COMP|FOLDER | required |
Source code in client/ayon_aftereffects/api/ws_stub.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
|
add_item_as_layer(comp_id, item_id)
Adds already imported FootageItem ('item_id') as a new layer to composition ('comp_id').
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comp_id | int | id of target composition | required |
item_id | int | FootageItem.id | required |
Source code in client/ayon_aftereffects/api/ws_stub.py
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
|
add_item_instead_placeholder(placeholder_item_id, item_id)
Adds item_id to layers where plaeholder_item_id is present.
1 placeholder could result in multiple loaded containers (eg items)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
placeholder_item_id | int | id of placeholder item | required |
item_id | int | loaded FootageItem id | required |
Source code in client/ayon_aftereffects/api/ws_stub.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
|
add_placeholder(name, width, height, fps, duration)
Adds new FootageItem as a placeholder for workfile builder
Placeholder requires width etc, currently probably only hardcoded values.
Source code in client/ayon_aftereffects/api/ws_stub.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 |
|
delete_item(item_id)
Deletes *Item in a file Args: item_id (int):
Source code in client/ayon_aftereffects/api/ws_stub.py
338 339 340 341 342 343 344 345 346 347 348 |
|
get_active_document_full_name()
Returns absolute path of active document via ws call
Returns(string): file name
Source code in client/ayon_aftereffects/api/ws_stub.py
184 185 186 187 188 189 190 191 192 |
|
get_active_document_name()
Returns just a name of active document via ws call
Returns(string): file name
Source code in client/ayon_aftereffects/api/ws_stub.py
194 195 196 197 198 199 200 201 202 |
|
get_app_version()
Returns version number of installed application (17.5...).
Source code in client/ayon_aftereffects/api/ws_stub.py
632 633 634 635 636 637 |
|
get_audio_url(item_id)
Get audio layer absolute url for comp
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item_id | int | composition id | required |
Returns: (str): absolute path url
Source code in client/ayon_aftereffects/api/ws_stub.py
480 481 482 483 484 485 486 487 488 489 490 491 492 |
|
get_client()
staticmethod
Return first connected client to WebSocket
TODO implement selection by Route
:return:
Source code in client/ayon_aftereffects/api/ws_stub.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
get_comp_properties(comp_id)
Get composition information for render purposes
Returns startFrame, frameDuration, fps, width, height.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comp_id | int | | required |
Returns:
Type | Description |
---|---|
(AEItem) |
Source code in client/ayon_aftereffects/api/ws_stub.py
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
|
get_extension_version()
Returns version number of installed extension.
Source code in client/ayon_aftereffects/api/ws_stub.py
625 626 627 628 629 630 |
|
get_item(item_id)
Returns metadata for particular 'item_id' or None
Source code in client/ayon_aftereffects/api/ws_stub.py
274 275 276 277 278 279 280 281 282 283 284 285 |
|
get_items(comps, folders=False, footages=False)
Get all items from Project panel according to arguments.
There are multiple different types:
CompItem (could have multiple layers - source for Creator,
will be rendered)
FolderItem (collection type, currently used for Background
loading)
FootageItem (imported file - created by Loader)
Args: comps (bool): return CompItems folders (bool): return FolderItem footages (bool: return FootageItem
Returns:
Type | Description |
---|---|
(list) of namedtuples |
Source code in client/ayon_aftereffects/api/ws_stub.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
get_metadata()
Get complete stored JSON with metadata from AE.Metadata.Label
field.
It contains containers loaded by any Loader OR instances created
by Creator.
Returns:
Type | Description |
---|---|
(list) |
Source code in client/ayon_aftereffects/api/ws_stub.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
get_render_info(comp_id)
Get render queue info for render purposes
Returns:
Type | Description |
---|---|
list) of (AEItem | with 'file_name' field |
Source code in client/ayon_aftereffects/api/ws_stub.py
467 468 469 470 471 472 473 474 475 476 477 478 |
|
get_selected_items(comps, folders=False, footages=False)
Same as get_items but using selected items only
Args: comps (bool): return CompItems folders (bool): return FolderItem footages (bool: return FootageItem
Returns:
Type | Description |
---|---|
(list) of namedtuples |
Source code in client/ayon_aftereffects/api/ws_stub.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
|
import_background(comp_id, comp_name, files)
Imports backgrounds images to existing or new composition.
If comp_id is not provided, new composition is created, basic values (width, heights, frameRatio) takes from first imported image.
All images from background json are imported as a FootageItem and separate layer is created for each of them under composition.
Order of imported 'files' is important.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comp_id | int | id of existing composition (null if new) | required |
comp_name | str | used when new composition | required |
files | list | list of absolute paths to import and | required |
Returns:
Type | Description |
---|---|
AEItem | object with id of created folder, all imported images |
Source code in client/ayon_aftereffects/api/ws_stub.py
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 |
|
import_file(path, item_name, import_options=None)
Imports file as a FootageItem. Used in Loader
Args: path (string): absolute path for asset file item_name (string): label for created FootageItem import_options (dict): different files (img vs psd) need different config
Source code in client/ayon_aftereffects/api/ws_stub.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
|
imprint(item_id, data, all_items=None, items_meta=None)
Save item metadata to Label field of metadata of active document
Args: item_id (int|str): id of FootageItem or instance_id for workfiles data(string): json representation for single layer all_items (list of item): for performance, could be injected for usage in loop, if not, single call will be triggered items_meta(string): json representation from Headline (for performance - provide only if imprint is in loop - value should be same) Returns: None
Source code in client/ayon_aftereffects/api/ws_stub.py
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 |
|
open(path)
Open file located at 'path' (local).
Args: path(string): file path locally Returns: None
Source code in client/ayon_aftereffects/api/ws_stub.py
76 77 78 79 80 81 82 83 84 85 86 |
|
print_msg(msg)
Triggers Javascript alert dialog.
Source code in client/ayon_aftereffects/api/ws_stub.py
644 645 646 647 648 |
|
read(item, layers_meta=None)
Parses item metadata from Label field of active document.
Used as filter to pick metadata for specific 'item' only.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item | AEItem | pulled info from AE | required |
layers_meta | dict | full list from Headline (load and inject for better performance in loops) | None |
Returns: (dict):
Source code in client/ayon_aftereffects/api/ws_stub.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
reload_background(comp_id, comp_name, files)
Reloads backgrounds images to existing composition.
It actually deletes complete folder with imported images and created composition for safety.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comp_id | int | id of existing composition to be overwritten | required |
comp_name | str | new name of composition (could be same as old if version up only) | required |
files | list | list of absolute paths to import and add as layers | required |
Returns: (AEItem): object with id of created folder, all imported images
Source code in client/ayon_aftereffects/api/ws_stub.py
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 |
|
remove_instance(instance_id, metadata=None)
Removes instance with 'instance_id' from file's metadata and saves them.
Keep matching item in file though.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instance_id(string) | instance id | required |
Source code in client/ayon_aftereffects/api/ws_stub.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
|
rename_item(item_id, item_name)
Replace item with item_name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item_id | int | | required |
item_name | string | label on item in Project list | required |
Source code in client/ayon_aftereffects/api/ws_stub.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
|
render(folder_url, comp_id)
Render all renderqueueitem to 'folder_url'
Args: folder_url(string): local folder path for collecting Returns: None
Source code in client/ayon_aftereffects/api/ws_stub.py
612 613 614 615 616 617 618 619 620 621 622 623 |
|
replace_item(item_id, path, item_name)
Replace FootageItem with new file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item_id | int | | required |
path | string | absolute path | required |
item_name | string | label on item in Project list | required |
Source code in client/ayon_aftereffects/api/ws_stub.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
|
save()
Saves active document
Returns: None
Source code in client/ayon_aftereffects/api/ws_stub.py
442 443 444 445 446 447 448 449 450 |
|
saveAs(project_path, as_copy)
Saves active project to aep (copy) or png or jpg
Args: project_path(string): full local path as_copy:
Source code in client/ayon_aftereffects/api/ws_stub.py
452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
|
select_items(items)
Select items in Project list
Args: items (list): of int item ids
Source code in client/ayon_aftereffects/api/ws_stub.py
229 230 231 232 233 234 235 236 |
|
set_comp_properties(comp_id, start, duration, frame_rate, width, height)
Set work area to predefined values (from Ftrack).
Work area directs what gets rendered.
Beware of rounding, AE expects seconds, not frames directly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comp_id | int | | required |
start | int | workAreaStart in frames | required |
duration | int | in frames | required |
frame_rate | float | frames in seconds | required |
width | int | resolution width | required |
height | int | resolution height | required |
Source code in client/ayon_aftereffects/api/ws_stub.py
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
|
set_label_color(item_id, color_idx)
Used for highlight additional information in Project panel.
Green color is loaded asset, blue is created asset
Args: item_id (int): color_idx (int): 0-16 Label colors from AE Project view
Source code in client/ayon_aftereffects/api/ws_stub.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
|
get_stub()
Convenience function to get server RPC stub to call methods directed
for host (Photoshop).
It expects already created connection, started from client.
Currently, created when panel is opened (PS: Window>Extensions>AYON)
:return:
Source code in client/ayon_aftereffects/api/ws_stub.py
720 721 722 723 724 725 726 727 728 729 730 731 732 |
|