c# get vertex paint modifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm investigating using c# vs. maxscript or maxplus
As a test I'm trying to set vertex colors using the VertexPaint modifier, would like to achieve a less destructive workflow than collapsing stacks and setting color values etc.
So far I've either got the existing modifier from the stack
dObj = (IIDerivedObject)obj;
IModifier tMod = dObj.GetModifier(0);
or added one
IModifier tMod = (IModifier)ip.CreateInstance(SClass_ID.Osm, global.Class_ID.Create(0x7ebb4645, 0x7be2044b)); // PAINTLAYERMOD_CLASS_ID
dObj.AddModifier(tMod, null, 0);
but when I try and cast the modifier
IIVertexPaint vp = (IIVertexPaint)tMod.GetInterface(global.Interface_ID.Create(0x3e262ef9, 0x220e7190)); // IVERTEXPAINT_INTERFACE_ID
I get ..
System.AccessViolationException
HResult=0x80004003
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=<Cannot evaluate the exception source>
StackTrace:
<Cannot evaluate the exception stack trace>
Can anyone help with what I'm doing wrong ?
Any help appreciated, thanks.
