This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
This gist contains: | |
- Function to close all currently opened Node Editors | |
- Python context that allows to disable new nodes addition to Node Editor while a function is being executed | |
""" | |
import contextlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
"Hacky" example that shows how to use OnUIIdle callback to defer a function call until MotionBuilder UI is properly | |
""" | |
from __future__ import print_function, division, absolute_import | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import pyfbsdk | |
def get_mobu_version_as_year(): | |
""" | |
Returns current MotionBuilder instance version as year | |
:return: MotionBuilder year version (2019, 2020, 2022 ...) | |
:rtype: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def force_new_scene(): | |
""" | |
Forces the creation of a new 3ds Max scene without prompting any UI | |
""" | |
mxs_function = """fn mf = ( | |
local windowHandle = DialogMonitorOPS.GetWindowHandle() | |
if (windowHandle != 0) then ( | |
UIAccessor.PressButtonByName windowHandle "Do&n't Save" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MaxPlus | |
def find_skin_influences(skin_modifier): | |
""" | |
Return influence nodes of a given skin modifier | |
:param skin_modifier: MaxPlus.Modifier (Skin) | |
:return: generator<INode> | |
""" | |
for ref in skin_modifier.Refs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MaxPlus | |
def get_scene_nodes(): | |
""" | |
Return all nodes in current scene | |
:return: generator<INode> | |
""" | |
stack = [MaxPlus.Core.GetRootNode()] | |
while stack: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MaxPlus | |
def get_scene_nodes(): | |
""" | |
Return all nodes in current scene | |
:return: generator<INode> | |
""" | |
stack = [MaxPlus.Core.GetRootNode()] | |
while stack: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opt = QStyleOptionSlider() | |
self.view.horizontalScrollBar().initStyleOption(opt) | |
style = self.view.horizontalScrollBar().style() | |
handle = style.subControlRect(style.CC_ScrollBar, opt, style.SC_ScrollBarSlider) | |
sliderPos = handle.center() |
NewerOlder