[SDK] SimpleObject2 - Display() or PrepareDisplay() are never called...

[SDK] SimpleObject2 - Display() or PrepareDisplay() are never called...

mateusz_s
Enthusiast Enthusiast
760 Views
3 Replies
Message 1 of 4

[SDK] SimpleObject2 - Display() or PrepareDisplay() are never called...

mateusz_s
Enthusiast
Enthusiast

Hello,

I tried to draw something in viewport or render custom Mesh, but I noticed that Display() or PrepareDisplay() methods are never called (I put a DebugPrint info inside to track them).. What is wrong? I am making SimpleObject2 plugin from PluginWizard.. any ideas?

0 Likes
Accepted solutions (1)
761 Views
3 Replies
Replies (3)
Message 2 of 4

istan
Advisor
Advisor
0 Likes
Message 3 of 4

mateusz_s
Enthusiast
Enthusiast

Thanks,

Yes I read it, I know that using Display() is deprecated, and should not work when Nitrous is used.. although it works in Modifier plugin, and is still being used in SDK example codes and help files (very confusing)

 

But the Nitrous functions PrepareDisplay() and UpdatePerNode() are also not called.. its weird..

0 Likes
Message 4 of 4

mateusz_s
Enthusiast
Enthusiast
Accepted solution

Yes, I finally figure out..

 

The problem was in overriding this virtual method:

BaseInterface* myObject::GetInterface(Interface_ID iid)

 

but I was following Max SDK help file:

http://help.autodesk.com/cloudhelp/2017/ENU/Max-SDK/files/GUID-A7262BEC-A063-4E70-A1D9-7971DBF2E883.... I

 

I should not ovrride it and everything works. Overriding this virtual method:

unsigned long myObject::GetObjectDisplayRequirement() const

by returning for ex: MaxSDK::Graphics::ObjectDisplayRequireLegacyDisplayMode; will call Display() method

returning 0 will call PrepareDisplay() and UpdatePerNodeItems()

 

Now drawing meshes and lines in viewport works great..

 

0 Likes