Tuesday, 20 October 2020

Disable viewport while running code

 Hello hello,

I just found a really cool bit of code to temporarily disable the Maya viewport whilst running code. Very useful for potentially 'heavy' stuff like caching, baking etc:


cmds.refresh(suspend=True)
doYourFunc()
cmds.refresh(suspend=False)

Tuesday, 22 September 2020

Maya Custom Hotkeys

 I feel it's about time to share my custom Maya hotkeys because I've been using them everyday for the past 4+ years in every job I've been in, and they were gifted to me by a friend who gave them to me on my first day, on my first job.

They'll save you hours days of your life! Days i tell you.

# Show geo only (alt+1)
import maya.cmds as mc
currentPanel = mc.getPanel(withFocus = True)
getStatus = mc.modelEditor(currentPanel, q=True, cameras=True)
if getStatus == True:
    mc.modelEditor(currentPanel, e=True, allObjects=False)
    mc.modelEditor(currentPanel, e=True, polymeshes=True)
else:
    mc.modelEditor(currentPanel, e=True, allObjects=True)
# Show joints only (alt+2)
import maya.cmds as mc
currentPanel = mc.getPanel(withFocus = True)
getStatus = mc.modelEditor(currentPanel, q=True, cameras=True)
if getStatus == True:
    mc.modelEditor(currentPanel, e=True, allObjects=False)
    mc.modelEditor(currentPanel, e=True, joints=True)
    mc.modelEditor(currentPanel, e=True, handles=True)
else:
    mc.modelEditor(currentPanel, e=True, allObjects=True)
#Show joints and geo only (alt+3)
import maya.cmds as mc
currentPanel = mc.getPanel(withFocus = True)
getStatus = mc.modelEditor(currentPanel, q=True, cameras=True)
if getStatus == True:
    mc.modelEditor(currentPanel, e=True, allObjects=False)
    mc.modelEditor(currentPanel, e=True, joints=True)
    mc.modelEditor(currentPanel, e=True, polymeshes=True)
else:
    mc.modelEditor(currentPanel, e=True, allObjects=True)
#Show curves and geo only (alt+4)
import maya.cmds as mc
currentPanel = mc.getPanel(withFocus = True)
getStatus = mc.modelEditor(currentPanel, q=True, cameras=True)
if getStatus == True:
    mc.modelEditor(currentPanel, e=True, allObjects=False)
    mc.modelEditor(currentPanel, e=True, nurbsCurves=True)
    mc.modelEditor(currentPanel, e=True, polymeshes=True)
    mc.modelEditor(currentPanel, e=True, cv=True)
    mc.modelEditor(currentPanel, e=True, nurbsSurfaces=True)
else:
    mc.modelEditor(currentPanel, e=True, allObjects=True)
# Show curves only (alt+5)
import maya.cmds as mc
currentPanel = mc.getPanel(withFocus = True)
getStatus = mc.modelEditor(currentPanel, q=True, cameras=True)
if getStatus == True:
    mc.modelEditor(currentPanel, e=True, allObjects=False)
    mc.modelEditor(currentPanel, e=True, nurbsCurves=True)
    mc.modelEditor(currentPanel, e=True, cv=True)
    mc.modelEditor(currentPanel, e=True, nurbsSurfaces=True)
    mc.modelEditor(currentPanel, e=True, locators=True)
else:
    mc.modelEditor(currentPanel, e=True, allObjects=True)

Wednesday, 9 September 2020

3ds Max, Maya Camera Settings

Yeaaah let's bring our stuff into max! Noooo the camera movement settings are woefully different from that of Maya!

Fear not, there's a setting that is going to save you hours of headache and muscle memory confusion! This will make 3dsMax viewport camera movement settings/hotkeys mirror that of Maya.

File>Preferences>Interaction Mode:

Oddly, all I got from many different forums after many different Google results, was "You shouldn't! Just learn the new hotkeys!", but.. there's a setting for this exact thing so.. i'm going to use it.

Joined Creative Assembly

The end of this week marks the first month that I have been at Creative Assembly; Total War Team!

It has been fantastic to work with DNEG over the past 3.5 years, but I felt that change was due. It's excellent to learn new things, but also to pass on knowledge that I have learnt in the VFX industry to the games industry.


 

Friday, 6 March 2020

Interactive interpolation visualisation tool

Here's a nice tool for visualising bezier curves, and how they're made.
This was really helpful when coding up my own lerp (linear interpolation) python library and writing a recursive bezier function.
http://acegikmo.com/bezier/

Here's the main lerp algorithm in a python function to start you off:

def lerp(input1, input2, step):
    """ Linearly interpolation between input1 and input2 given
    a value between 0.0 and 1.0.
    Args:
        input1 (int): starting integer to lerp from.
        input2 (int): destination integer to lerp towards.
        step (float): float value between 0.0 and 1.0
    """
    return (1 - step) * input1 + step * input2