Skip to content

Instantly share code, notes, and snippets.

@Swordslayer
Last active February 11, 2022 16:35
Show Gist options
  • Save Swordslayer/15f03c746afc0b334deb4a1e0737e923 to your computer and use it in GitHub Desktop.
Save Swordslayer/15f03c746afc0b334deb4a1e0737e923 to your computer and use it in GitHub Desktop.
Setting points of the painter interface curve
(
local iGlobal = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
local refTargID = (dotNetClass "Autodesk.Max.SClass_ID").RefTarget
local painterID = iGlobal.Class_ID.Create PainterInterface.classID[1] PainterInterface.classID[2]
local painterID_V5 = (dotNetClass "System.Enum").ToObject (dotNet.getType (dotNetClass "Autodesk.Max.InterfaceID")) (dotNetObject "System.Int32" painterID.PartB)
local painterRefTarg = (iGlobal.UtilGetCOREInterface.CreateInstance refTargID painterID).GetInterface painterID_V5
local painterMarshaler = (dotNetClass "Autodesk.Max.Wrappers.CustomMarshalerIPainterInterface_V5").GetInstance ""
local painter = painterMarshaler.MarshalNativeToManaged painterRefTarg.NativePointer
local curve = painter.FalloffGraph
local ptA = curve.GetPoint currentTime.ticks 0
local ptB = curve.GetPoint currentTime.ticks 1
ptA.Out.X = 0
ptB.In.X = 0
curve.SetPoint currentTime.ticks 0 ptA on on
curve.SetPoint currentTime.ticks 1 ptB on on
painter.MinSize = painter.MinSize -- needed to force update
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment