Posted by: | zarusz | |
Data created: | 30 November 2010 |
Hello, I am having a reference IControl icontrol wich is a "Transform: Position/Rotation/Scale" of ClassId(PRS_CONTROL_CLASS_ID, 0). The icontrol.PositionController contains "Position: Linear Positition" of ClassId(LININTERP_POSITION_CLASS_ID, 0). I am trying to obtain the IIKeyControl interface in the following way: var keys = (IIKeyControl)icontrol.PositionController.GetInterface(InterfaceID.Keycontrol); but I always get null from GetInterface. I have also tried InterfaceID.Keycontrol2 and IIKeyControl2 respectively with the same result. Can anyone give me a clue how can I obtain access to IIKeyControl from a IControl? My versions are MAX.NET1.2.7.0 and 3ds max 2011 x64. Thanks, zarusz | |
11 December 2010
#2586 | |
Marsel any ideas how can I get IIKeyControl object from IControl? | |
17 December 2010
#2590 | |
Hi Tomasz, I notice you use InterfaceID.Keycontrol, which is incorrect. In the SDK docs I_KEYCONTROL is 0x00001060, while InterfaceID.Keycontrol = 0x00001100. So try: var keys = (IIKeyControl)icontrol.PositionController.GetInterface(0x00001100); instead and see if that works.
Marsel Khadiyev (Software Developer, EPHERE Inc.) | |
17 December 2010
#2592 | |
Hi Marsell, Thanks for help, unfortunatley I tried both var keys = (IIKeyControl)icontrol.PositionController.GetInterface((InterfaceID)0x00001060); and var keys = (IIKeyControl)icontrol.PositionController.GetInterface((InterfaceID)0x00001100); with the same result - a null value in keys. I noticed that ((InterfaceID)0x00001060 in the debugger says InterfaceID.Keycontrol, so I am afraid the problem lays somewhere else. Are you sure the MAX.NET wrapper in version 1.2.7 supports the IIKeyControl interface? Marsel have you got any more ideas what the solution may look like? | |
22 December 2010
#2599 | |
Hi Tomasz, Yes that is strange indeed (that it'd return null). Perhaps the upcasting code is using the wrong interface ID, I will check that. Meanwhile you can use MaxScript functions to access keys. I had to tackle the same problem in ZK and ended up using maxscript for most of the key handling. For example, to get number of keys I use:
You do need to make sure that {reference} is replaced with your control (you need to be able to get to the control either through the node or object you're editing). Other examples, to get key time:
to delete keys:
etc. Hope this helps. Marsel Khadiyev (Software Developer, EPHERE Inc.) | |
12 January 2011
#2613 | |
Hi Marsel, Thanks for the workaround. By the way I would like to say that the problem still exists in the newest MAX.NET 1.2.8.0 | |
17 January 2011
#2619 | |
Thanks Tomasz, I guess this requires more tweaking. Marsel Khadiyev (Software Developer, EPHERE Inc.) |