How to open a max file from c++

How to open a max file from c++

Anonymous
Not applicable
1,086 Views
4 Replies
Message 1 of 5

How to open a max file from c++

Anonymous
Not applicable

Hi everyone,

I have a seemingly very elementary question. I want to open a .max file from my c++ plugin code without an open file dialog.

No matter what I do this code crashes 3ds Max:

ip->LoadFromFile((_T("C:\\thescene.max"), TRUE);

No error message details. Max just crashes whenever I invoke this code. I can open the file manually.

Is there any obvious mistake anyone can see? I am using Max 2014 and everything else is working OK.

0 Likes
1,087 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

If ip is valid then the code should work.
At least it works for me in 3dsMax 2018 when calling from custom MaxScript extensions.

0 Likes
Message 3 of 5

istan
Advisor
Advisor

why should ip  be valid? what was assigned to ip  ? could also be a NULL pointer ?!

0 Likes
Message 4 of 5

Anonymous
Not applicable

Oh, we've got a comedian here 🙂

0 Likes
Message 5 of 5

Anonymous
Not applicable

You are right that any pointer is invalid until it is assigned an object to refer to. But *ip is a pointer to the scene interface that the SDK passes to your plugin whenever you start your plugin (BeginEditParams (), if I am not mistaken.) I use the pointer throughout my code for different purposes such as creating and grouping nodes. And it works ok.  The problem is when I use it to open a scene file,  as recommended in the documentation.

0 Likes