lib
Library of functions useful for 3dsmax pipeline.
convert_unit_scale()
Convert system unit scale in 3dsMax for fbx export
Returns:
| Name | Type | Description |
|---|---|---|
str | unit scale |
Source code in client/ayon_max/api/lib.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | |
ensure_sme_editor_active()
Ensure that Slate Material Editor is active during context
Source code in client/ayon_max/api/lib.py
736 737 738 739 740 741 742 743 744 745 746 747 | |
find_plugins(search_string)
Find if a plugin is loaded in 3dsMax
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
search_string | str | string to search for | required |
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if found, False otherwise |
Source code in client/ayon_max/api/lib.py
620 621 622 623 624 625 626 627 628 629 630 631 | |
get_all_children(parent, node_type=None)
Handy function to get all the children of a given node
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent | 3dsmax Node1 | Node to get all children of. | required |
node_type | None, runtime.class | give class to check for e.g. rt.FFDBox/rt.GeometryClass etc. | None |
Returns:
| Name | Type | Description |
|---|---|---|
list | list of all children of the parent node |
Source code in client/ayon_max/api/lib.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
get_current_renderer()
Notes
Get current renderer for Max
Returns:
| Type | Description |
|---|---|
| "{Current Renderer}:{Current Renderer}" | |
| e.g. "Redshift_Renderer:Redshift_Renderer" |
Source code in client/ayon_max/api/lib.py
181 182 183 184 185 186 187 188 189 190 | |
get_fps_for_current_context()
Get fps that should be set for current context.
Todos
- Skip project value.
- Merge logic with 'get_frame_range' and 'reset_scene_resolution' -> all the values in the functions can be collected at one place as they have same requirements.
Returns:
| Type | Description |
|---|---|
| Union[int, float]: FPS value. |
Source code in client/ayon_max/api/lib.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
get_frame_range(task_entity=None)
Get the current task frame range and handles
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_entity | dict | Task Entity. | None |
Returns:
| Name | Type | Description |
|---|---|---|
dict | Union[Dict[str, Any], None] | with frame start, frame end, handle start, handle end. |
Source code in client/ayon_max/api/lib.py
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 | |
get_main_window()
Acquire Max's main window
Source code in client/ayon_max/api/lib.py
29 30 31 32 33 34 35 36 37 38 39 40 | |
get_max_version()
Args: get max version date for deadline
Returns:
| Type | Description |
|---|---|
(25000, 62, 0, 25, 0, 0, 997, 2023, "") | |
| max_info[7] = max version date |
Source code in client/ayon_max/api/lib.py
436 437 438 439 440 441 442 443 444 445 446 | |
get_multipass_setting(renderer, project_setting=None)
Get the multipass setting for the given renderer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
renderer | str | The name of the renderer. | required |
project_setting | dict | The project settings. Defaults to None. | None |
Returns:
| Name | Type | Description |
|---|---|---|
bool | True if multipass is enabled, False otherwise. |
Source code in client/ayon_max/api/lib.py
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 | |
get_namespace(container_name)
Get the namespace and name of the sub-container
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
container_name | str | the name of master container | required |
Raises:
| Type | Description |
|---|---|
RuntimeError | when there is no master container found |
Returns:
| Name | Type | Description |
|---|---|---|
namespace | str | namespace of the sub-container |
name | str | name of the sub-container |
Source code in client/ayon_max/api/lib.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | |
get_plugins()
Get all loaded plugins in 3dsMax
Returns:
| Name | Type | Description |
|---|---|---|
plugin_info_list | list | a list of loaded plugins |
Source code in client/ayon_max/api/lib.py
604 605 606 607 608 609 610 611 612 613 614 615 616 617 | |
get_target_sme_view(target_view)
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_view | int | active SME view | required |
Returns: IObject: SME View object
Source code in client/ayon_max/api/lib.py
725 726 727 728 729 730 731 732 733 | |
get_tyflow_export_operators()
Get Tyflow Export Particles Operators.
Returns:
| Name | Type | Description |
|---|---|---|
list | Particle operators |
Source code in client/ayon_max/api/lib.py
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | |
get_view_node_from_sme_view(sme_view, view_node_name)
Get view node from SME view
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sme_view | IFP_NodeViewImp | Target SME View | required |
view_node_name | str | view node name | required |
Returns: IObject: view node object
Source code in client/ayon_max/api/lib.py
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | |
is_headless()
Check if 3dsMax runs in batch mode. If it returns True, it runs in 3dsbatch.exe If it returns False, it runs in 3dsmax.exe
Source code in client/ayon_max/api/lib.py
449 450 451 452 453 454 | |
lsattr(attr, value=None, root=None)
List nodes having attribute with specified value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr | str | Attribute name to match. | required |
value | (str, Optional) | Value to match, of omitted, all nodes with specified attribute are returned no matter of value. | None |
root | (str, Optional) | Root node name. If omitted, scene root is used. | None |
Returns:
| Type | Description |
|---|---|
list | list of nodes. |
Source code in client/ayon_max/api/lib.py
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 | |
maintained_sme_view_nodes_selection(current_sme_view, texture_node)
Maintain selection of nodes in SME view during context
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_node_name | IFP_NodeViewImp | SNE View Node Object | required |
texture_node | Node | Texture Node Object | required |
Source code in client/ayon_max/api/lib.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
object_transform_set(container_children)
A function which allows to store the transform of previous loaded object(s) Args: container_children(list): A list of nodes
Returns:
| Name | Type | Description |
|---|---|---|
transform_set | dict | A dict with all transform data of |
| the previous loaded object(s) |
Source code in client/ayon_max/api/lib.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | |
render_resolution(width, height)
Set render resolution option during context
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width | int | render width | required |
height | int | render height | required |
Source code in client/ayon_max/api/lib.py
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 | |
reset_colorspace()
OCIO Configuration Supports in 3dsMax 2024+
Source code in client/ayon_max/api/lib.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | |
reset_frame_range(fps=True)
Set frame range to current folder. This is part of 3dsmax documentation:
A System Global variable which lets you get and
set an Interval value that defines the start and end frames of the Active Time Segment.
frameRate: A System Global variable which lets you get and set an Integer value that defines the current scene frame rate in frames-per-second.
Source code in client/ayon_max/api/lib.py
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 | |
reset_scene_resolution(task_entity=None)
Apply the scene resolution from the project definition
scene resolution can be overwritten by a folder if the folder.attrib contains any information regarding scene resolution.
Source code in client/ayon_max/api/lib.py
269 270 271 272 273 274 275 276 277 278 279 280 281 | |
set_context_setting()
Apply the project settings from the project definition
Settings can be overwritten by an folder if the folder.attrib contains any information regarding those settings.
Examples of settings
frame range resolution
Returns:
| Type | Description |
|---|---|
| None |
Source code in client/ayon_max/api/lib.py
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
set_render_frame_range(start_frame, end_frame)
Note
Frame range can be specified in different types. Possible values are: * 1 - Single frame. * 2 - Active time segment ( animationRange ). * 3 - User specified Range. * 4 - User specified Frame pickup string (for example 1,3,5-12).
Todo
Current type is hard-coded, there should be a custom setting for this.
Source code in client/ayon_max/api/lib.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
set_scene_resolution(width, height)
Set the render resolution
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width | int | value of the width | required |
height | int | value of the height | required |
Returns:
| Type | Description |
|---|---|
| None |
Source code in client/ayon_max/api/lib.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
set_timeline(frameStart, frameEnd)
Set frame range for timeline editor in Max
Source code in client/ayon_max/api/lib.py
457 458 459 460 461 | |
set_unit_scale(project_settings=None)
Function to set unit scale in Metric
Source code in client/ayon_max/api/lib.py
389 390 391 392 393 394 395 396 397 | |
set_viewport_type(viewport_type=rt.Name('view_camera'))
Set viewport type during context
Source code in client/ayon_max/api/lib.py
750 751 752 753 754 755 756 757 758 | |
suspended_refresh()
Suspended refresh for scene and modify panel redraw.
Source code in client/ayon_max/api/lib.py
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | |
unique_namespace(namespace, format='%02d', prefix='', suffix='', con_suffix='CON')
Return unique namespace
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace | str | Name of namespace to consider | required |
format | str | Formatting of the given iteration number | '%02d' |
suffix | str | Only consider namespaces with this suffix. | '' |
con_suffix | max only, for finding the name of the master container | 'CON' |
unique_namespace("bar")
bar01
unique_namespace(":hello")
:hello01
unique_namespace("bar:", suffix="_NS")
bar01_NS:
Source code in client/ayon_max/api/lib.py
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 | |
update_modifier_node_names(event, node)
Update the name of the nodes after renaming
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event | MXSWrapperBase | Event Name ( Mandatory argument for rt.NodeEventCallback) | required |
node | list | Event Number ( Mandatory argument for rt.NodeEventCallback) | required |
Source code in client/ayon_max/api/lib.py
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 | |
validate_unit_scale(project_settings=None)
Apply the unit scale setting to 3dsMax
Source code in client/ayon_max/api/lib.py
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 | |