twhl-community / halflife-updated

Half-Life SDK updated to compile under VS2019 and 2022. Check README.md for more information.
Other
382 stars 146 forks source link

smdlexp for 3DS Max 2023 #149

Closed fel1x-developer closed 2 years ago

fel1x-developer commented 2 years ago

3DS Max Plugins requires 64 bit dlls, so I added 64 bit configuration to the project.

SamVanheer commented 2 years ago

I took a look at your changes and it looks like you're using wchar_t in a lot of places that require char when the character set is not unicode.

Try switching the character set and then compile, you'll get a lot of errors.

You probably won't get errors with some wsprintf calls since it doesn't check the parameter types but it will fail at runtime.

Printf functions require that you use %ls for wide character strings (%S works on Windows but it's not standard syntax, and the behavior changes depending on whether you're using printf or wprintf) so be careful with that.

3DS Max's documentation has some information on how to make your code use TCHAR instead: https://help.autodesk.com/view/MAXDEV/2021/ENU/?guid=__developer_3ds_max_sdk_features_user_interface_guidelines_for_handling_characte_html

Do note that this documentation appears to be outdated (it references Windows NT not fully supporting Unicode), the getting started tutorial notes that you should be using the Unicode character set but since they are still using TCHAR everywhere the other character set should also work properly.

There is newer documentation pertaining to Unicode support available here: https://help.autodesk.com/view/MAXDEV/2021/ENU/?guid=__developer_what_s_new_archive_what_s_new_3ds_max_2013_sdk_unicode_html

Since i don't have 3DS Max 2023 i can't test if this works. Make sure you run the plugin and use it to see if it works as expected.

There are other 3DS Max plugins available here: https://the303.org/tutorials/gold_mdl_3ds.htm

Compare the output of those to this version to see if there's anything wrong. You'll need older versions of 3DS Max to run those plugins.

The changelog for Neil Jed's plugins also show quite a number of changes that were made from the original code to 3DS Max 2020: https://github.com/NeilJed/3DSMax-SMD-Exporter-Plugin/blob/master/CHANGELOG.md

The complexity of upgrading this plugin is why i left it as-is. It takes quite a bit of work to upgrade the plugin to work properly in newer versions of 3DS Max, and there appear to be bugs in the original version as well. It's also a bit out of scope to update plugins in an SDK geared towards updating the source code for mods and not the tools themselves.

It might be better to to find an existing already-fixed version and upgrading that instead. Perhaps ask Game Zombie if you can help upgrade their version to 2023: https://knockout.chat/thread/806/1

I can't find the source code for any of the upgraded plugins (WallWorm, Game Zombie and Neil Jed's) so i don't know if any of them would be willing to let anyone work on them, but i'd expect one or more of them to provide a 2023 version sooner or later.