Confusing with deriving from IObjectDisplay2 class

Confusing with deriving from IObjectDisplay2 class

steff3d2JA5W
Contributor Contributor
820 Views
7 Replies
Message 1 of 8

Confusing with deriving from IObjectDisplay2 class

steff3d2JA5W
Contributor
Contributor

I'm trying to add custom mesh display in viewport for my SimpleObject2 plugin. As I understood for this case, the plugin class should also be derived from IObjectDisplay2, like:

 

 

#include <Graphics/IObjectDisplay2.h>

class maxProject24 : public SimpleObject2, public MaxSDK::Graphics::IObjectDisplay2
{...
protected:		

		virtual bool PrepareDisplay(
			const UpdateDisplayContext& prepareDisplayContext);

		virtual bool UpdatePerNodeItems(
			const UpdateDisplayContext& updateDisplayContext,
			UpdateNodeContext& nodeContext,
			IRenderItemContainer& targetRenderItemContainer);
};

 

 

But when I try to do this, I get the error "object of abstract class type "maxProject24" is not allowed"

Also, when I trying to use just a class name without a MaxSDK::Graphics namespace, VS underlines it in red and says that "'IObjectDisplay2': base class undefined", although it opens IObjectDisplay2.h without any problem when contextually selected ("Go To Definition").

Please help me figure out what I'm doing wrong, and what could be the problem? Thx!

 

0 Likes
Accepted solutions (1)
821 Views
7 Replies
Replies (7)
Message 2 of 8

steff3d2JA5W
Contributor
Contributor

I think I'm starting to understand the reason, although I haven't found a solution yet. The examples in the "howto" section compile and run without problems. At the same time, plugin generated through the wizard cause an error with an undefined class.Looks like my question is not related to the SDK, but rather to the VS project-setup. Although it seemed to me that I indicated the paths to all the includes and libraries in the project properties.
I also realized the incorrectness of my original question. BaseObject from which SimpleObject2 inherits already has IObjectDisplay2 methods. 

 

UPD: I checked all the project settings line by line, and changed the wizard's settings to match the settings from the "howto" block, but that didn't work. I still get "Error LNK2001 unresolved external symbol".. It's very strange, I can't understand why one project loads all the libraries and the other doesn't.

0 Likes
Message 3 of 8

istan
Advisor
Advisor

For giving an answer, it would have been helpful, to provide more information. E.g. which linker error exactly shows up? Are you probably only missing some libraries to link with? You have to check all compiler and linker settings - this is neither rocket science nor a miracle 😉

0 Likes
Message 4 of 8

steff3d2JA5W
Contributor
Contributor

Thank you, I really appreciate any help as the issue is still relevant.
For some reason, I can't add an answer to the forum, it probably contains a lot of text, so I'll break it into several posts
I am using VS 2017(v141) 10.0.17134.0 Windows SDK and 2020 version of 3ds max SDK
The problem occurs when I create a new project in the user directory through the wizard.Static libraries not linking for some reason.
Here's an example of that error:

1.JPG

0 Likes
Message 5 of 8

steff3d2JA5W
Contributor
Contributor

Log:

1>------ Build started: Project: testObject, Configuration: Hybrid x64 ------
1>testObject.cpp
1>DllEntry.cpp
1>c:\users\steff\source\repos\testobject\testobject\dllentry.cpp(78): TODO: Perform initialization here.
1>c:\users\steff\source\repos\testobject\testobject\dllentry.cpp(87): TODO: Perform un-initialization here.
1>c:\users\steff\source\repos\testobject\testobject\testobject.cpp(67): error C2259: 'testObject': cannot instantiate abstract class
1>c:\users\steff\source\repos\testobject\testobject\testobject.cpp(67): note: due to following members:
1>c:\users\steff\source\repos\testobject\testobject\testobject.cpp(67): note: 'bool MaxSDK::Graphics::IObjectDisplay2::PrepareDisplay(const MaxSDK::Graphics::UpdateDisplayContext &)': is abstract
1>c:\program files\autodesk\3ds max 2020 sdk\maxsdk\include\graphics\iobjectdisplay2.h(77): note: see declaration of 'MaxSDK::Graphics::IObjectDisplay2::PrepareDisplay'
1>c:\users\steff\source\repos\testobject\testobject\testobject.cpp(67): note: 'bool MaxSDK::Graphics::IObjectDisplay2::UpdatePerNodeItems(const MaxSDK::Graphics::UpdateDisplayContext &,MaxSDK::Graphics::UpdateNodeContext &,MaxSDK::Graphics::IRenderItemContainer &)': is abstract
1>c:\program files\autodesk\3ds max 2020 sdk\maxsdk\include\graphics\iobjectdisplay2.h(93): note: see declaration of 'MaxSDK::Graphics::IObjectDisplay2::UpdatePerNodeItems'
1>c:\users\steff\source\repos\testobject\testobject\testobject.cpp(241): error C2259: 'testObject': cannot instantiate abstract class
1>c:\users\steff\source\repos\testobject\testobject\testobject.cpp(241): note: due to following members:
1>c:\users\steff\source\repos\testobject\testobject\testobject.cpp(241): note: 'bool MaxSDK::Graphics::IObjectDisplay2::PrepareDisplay(const MaxSDK::Graphics::UpdateDisplayContext &)': is abstract
1>c:\program files\autodesk\3ds max 2020 sdk\maxsdk\include\graphics\iobjectdisplay2.h(77): note: see declaration of 'MaxSDK::Graphics::IObjectDisplay2::PrepareDisplay'
1>c:\users\steff\source\repos\testobject\testobject\testobject.cpp(241): note: 'bool MaxSDK::Graphics::IObjectDisplay2::UpdatePerNodeItems(const MaxSDK::Graphics::UpdateDisplayContext &,MaxSDK::Graphics::UpdateNodeContext &,MaxSDK::Graphics::IRenderItemContainer &)': is abstract
1>c:\program files\autodesk\3ds max 2020 sdk\maxsdk\include\graphics\iobjectdisplay2.h(93): note: see declaration of 'MaxSDK::Graphics::IObjectDisplay2::UpdatePerNodeItems'
1>Done building project "testObject.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

As far as I can tell, the paths to the libraries and includes are correct, the name and order of the loaded libraries are also the same. But for some reason, in a custom project, the "IObjectDisplay2" class is considered abstract. At the same time, the "howto" examples compile and run without any problems. Perhaps there are some additional VS settings responsible for importing libraries that I don't know about. I will be glad to any advice.

0 Likes
Message 6 of 8

steff3d2JA5W
Contributor
Contributor

Unfortunately not all messages were posted, here is the missing part:

This is the base Wizard template created via Procedural Objects->SimpleObject2, the only thing I did for the example was to add an extra inheritance from MaxSDK::Graphics::IObjectDisplay2 class.

At the same time, this action in the project from "howto" does not cause any problems.

Here are the linker and compiler options, from "howto" and from my custom project:

0 Likes
Message 7 of 8

steff3d2JA5W
Contributor
Contributor

Many attempts to upload compiler properties as text to the forum failed, so I'm attaching a screenshot. And a link to the text: https://sharetext.me/ki3ir2iz0g

2JPG.JPG

The bottom line is that the external paths and lib names and order are the same, but the libraries in the user project for some reason does not work..

 

0 Likes
Message 8 of 8

steff3d2JA5W
Contributor
Contributor
Accepted solution

I finally got it! For some reason, I thought that libraries are responsible for the implementation of all IObjectDisplay2 methods.
But the PrepareDisplay and UpdatePerNodeItems methods are completely virtual and I myself have to declare and implement them in my class.  Sorry for misleading, question closed.

0 Likes