Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to have 3ds Max recognize my custom file type?

18 REPLIES 18
SOLVED
Reply
Message 1 of 19
martim.grosner
817 Views, 18 Replies

How to have 3ds Max recognize my custom file type?

I'm using the image plugin samples as an example to make a plugin for my custom file type. The plugin works and I can load it to 3ds Max with no errors. But when I open a file dialog, through bitmap selection, I don't see my custom file type extension under the file type selection. What virtual functions of BitmapIO class should I be overriding? What other functionality from BitmapIO is essential? Maybe that's what I am missing. I have already overridden Ext() and ExtCount().

Tags (2)
18 REPLIES 18
Message 2 of 19
klvnk
in reply to: martim.grosner

think its probably Ext() and ExtCount()

Message 3 of 19
martim.grosner
in reply to: klvnk

Then why isn't it working? It doesn't add the custom file type to the file type selection list on the dialog. Should I expect this to happen?

Message 4 of 19
klvnk
in reply to: martim.grosner

have you implemented 

 

int Capability ( )

 

?

 

to honest without any code it's just pure guess work.

 

Message 5 of 19
martim.grosner
in reply to: klvnk

Here is the source and header file. I haven't implemented "int Capability()". How should I do it, what should be on it's body?

 

Let me know if you need something like the DllEntry.cpp or a resource file.

Message 6 of 19
klvnk
in reply to: martim.grosner

Capability() is implemented

 

nothing jumps out what does your .def file look like ?

 

also not sure why CanAutoDefer() isnt in Dllentry.cpp

 

 

 

ClassDesc2* GetFDRSImageIODesc()
{
	static FDRSImageIOClassDesc FDRSImageIOClassDesc;
	return &FDRSImageIOClassDesc;
}

 

 

 

this is wrong you can't use a class name as a Variable name.... would have thought the compiler would have complained 🙁

 

try something like....

 

 

ClassDesc2* GetFDRSImageIODesc()
{
	static FDRSImageIOClassDesc FDRSImageDesc;
	return &FDRSImageDesc;
}

 

 

 

Message 7 of 19
martim.grosner
in reply to: klvnk

I corrected the variable's name, thanks for pointing it out.

 

.def looks like this: 

LIBRARY FDRSImageIO.bmi
EXPORTS
   LibDescription       @1       PRIVATE
   LibNumberClasses     @2       PRIVATE
   LibClassDesc         @3       PRIVATE
   LibVersion           @4       PRIVATE
   LibInitialize        @6       PRIVATE
   LibShutdown          @7       PRIVATE
SECTIONS
   .data READ WRITE

 

DllEntry.cpp is automatically generated by the Wizard so I couldn't know either, am I supposed to include CanAutoDefer() manually?

Message 8 of 19
klvnk
in reply to: martim.grosner

move CanAutoDefer() to dllentry.cpp

 

and add

 

CanAutoDefer          @5       PRIVATE

 

 

to your def file

 

also you could remove LibInitialize & LibShutdown  and delete the functions from dllentry.cpp if they exist.

Message 9 of 19
martim.grosner
in reply to: klvnk

Deleted those two without issues, but adding CanAutoDefer() gave me the link error LNK2005 saying that CanAutoDefer() is already defined in .obj.

Message 10 of 19
klvnk
in reply to: martim.grosner

you need to delete the one in FDRSImageIO.cpp

Message 11 of 19
martim.grosner
in reply to: klvnk

Oh yes of course, I should've just ctrl F from the start.

 

It builds fine, but I still don't get the file type in the drop list.

Message 12 of 19
klvnk
in reply to: martim.grosner

is your plugin listed in the plugin manager ?

 

if it is, you could try running under the debugger with a breakpoint in Ext() or something

Message 13 of 19
martim.grosner
in reply to: klvnk

Yes, it is. It is also loaded by default. I'm gonna try that.

Message 14 of 19
klvnk
in reply to: martim.grosner

try changing Capability()

 

to

 

 

        int            Capability         ( )       { return BMMIO_READER    | 
                                                             BMMIO_WRITER    |
                                                             BMMIO_INFODLG   |
                                                             BMMIO_EXTENSION |
                                                             BMMIO_CONTROLWRITE; }

 

think you may need the extension flag set, delete the BMMIO_CONTROLWRITE flag if you don't have a custom control panel for write ops

 

Message 15 of 19
martim.grosner
in reply to: klvnk

I get this when I use a breakpoint in Ext(): the breakpoint will not currently be hit no symbols have been loaded for this document. 

Is this normal? Does the breakpoint hit if I try to select a bitmap?

 

Edit: It doesn't hit when I select a bitmap, I'm not sure what's wrong here.

Message 16 of 19
klvnk
in reply to: martim.grosner

have you fixed the Capability yet adding  | BMMIO_EXTENSION ?

Message 17 of 19
martim.grosner
in reply to: klvnk

My bad, I was confused, give me a second.

 

Edit: Well that did it, thank you so much. How can I find more information about this?

Message 18 of 19
klvnk
in reply to: martim.grosner

glad we got there in the end 😁

 

3ds Max 2022 Developer Help | 3ds Max C++ API Reference: BitmapIO Capability Flags | Autodesk

 

having the flag and ExtCount() function is kind of belt and braces programming 😏

Message 19 of 19
martim.grosner
in reply to: klvnk

Thanks a lot!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report