Exporting from blender

Long time no post, I have a question for a much newer version of blender than I usually talk about.

So I may be doing some exporting through blender 2.83, I have one script to export to a specific game, and that works. But I will also need an export option which maintains textures, materials and rigging. I seem to remember .3ds allowed rigging and textures as well. (EDIT: and I found out the rest of the dev team is using Max 2015, so, yeah a 3ds import/export is important). However I cannot for the life of me find a copy of the 3ds import export addon that actually installs at all. I mean they say they install but they donā€™t show up. I was reading here on this forum that the import option works but the export doesnā€™t yet for me nothing would install not import nor export.

does anyone have any information about this?

OK I kept working at it, it seems that for some reason it needs to be in a folder named 3dspy for it to show up. now Iā€™m working on errors in it. someone left these 3DS script littered with non python comments with triple quotations ā€œā€" rather than #.

OK, ā€œSome Assembly Requiredā€ I got it to stop giving errors and output the file.
now the question becomes ā€œwill anything be able to open it?ā€

The answer to that, is ā€œYesā€ now to test with something textured and rigged.

The Answer to Textured is ā€œNOā€ there are errors on import. which means something isnā€™t right. oh well maybe Iā€™ll look at it again tomorrow. It appears to be a cutoff material name when it tries to do makeMeshMaterialCopy, not sure why. oh well. As for rigged, it doesnā€™t like objects named armature. gave a key error when it asked for the meshā€™s parent and it was an armature named armature, Oh, I see itā€™s trying to save the armature as a mesh. lol that wont work. nope, itā€™s trying to get the translation difference between the armature and the mesh. in otherwords itā€™s not getting the offset.

OK, found 1 problem with the export script, its modifying image names the materials are looking for but not modifying the actual image names to match, it seems to have a max length too so 12 characters including the file extension. However, thatā€™s not the only issue, I caught it renaming short texture names with things like ā€œFace.pngTex.000ā€ on the model but leaving it as ā€œFace.pngā€ on the actual file name, and this throws a key error in the importing software because there is no such texture name. so at least I know where to look in the script for these things. Ideasman42 is usually really good about leaving comments, so if itā€™s necessary I can work around it.

I should go over that diff fileā€™s contents before I try anything. the diff file has already been applied to the current 3ds export doc. so at this point Iā€™ll have to monkey with it. given it has no errors on Export, but has errors on Import I can know that a few definitions are already predefined such as;
name_unique = [] # stores str, ascii only
name_mapping = {} # stores {orig: byte} mapping
because at no point in the code does it fill this list and dictionary with info from a given file. therefore the init imports must have information about what to slip in there.

the problem seems to be found at

while new_name in name_unique:
        new_name = new_name_clean + ".%.3d" % i

where ā€˜new_nameā€™ at this point has already been converted to ascii and limited to 12 characters. so why on earth itā€™s adding ANYTHING to the file name is beyond me. I mean thatā€™ll just break it.

the order of bends @.@ thats enough for today. names are converted to ascii thrice then get a Tex.00# added onto them, perhaps if the names wereall exactly 12 characters it might work? thats the last thing Iā€™ll try.

Oh I see why everyone gave up. the textures MUST be saved externally in the same folder, but in blender 2.83 the textures are packed into the Shader editor which feeds the outcome to the material. that will definitely make 3ds importers mad as all they want is the actual file location not a node.

Ramblings of a madman

and it looks like you can only actually add 1 texture file for all models in the whole program in 2.83 facepalm. I was trying to replace the packed textures with file locations, but it only accepts 1 file location in the texture buttons, no more, it also does not change when selecting a different model even though I told it to make a single user copy.

this is why I donā€™t usually work in blender 2.8+ā€¦ things are just difficult.

GAHHHHHHHHHJH all the textures need to be applied from the Shader editor not the textures buttons. no wonder the export script isnā€™t getting them, the export script is not looking in the Shader editor to grab imagesā€¦ and the material does not have direct access to the files, the shader does. which means the export script needs to wrestle that info away from the shader to save the texture file location to the 3ds material. and thats why it keeps complaining. sigh, i have no idea how to get info from the shader by python code.

at this point to make this work because of the changes that were made to the way textures are applied in 2.8+ itā€™d be better for me to abandon the normal export operations built into blenderā€™s code as those are incompatible. instead Iā€™ll have to get the scene list and grab info from things directly that way then fill in the blanks in the script so it knows where to find textures.

Hopefully itā€™s less complicated that I think to merely modify the export script, Iā€™m getting a bit frustrated, especially seeing as itā€™s not even seeing modifications to the script any more. I broke it on purpose to see, and the outcome was the same. so this project will now take a short break while I cool off and do some actual work.

one cooldown later, I need to see if bpy.data.images has the file locations in the data somewhere

it appears it does have it under bpy.types.Image(image ID).filepath , so to get the image ID weā€™ll do

for image in bpy.data.images:
    filepath = bpy.types.Image(image).filepath
    filename = filepath.split("/")[-1]

thats enough progress for now.

the current issue is blender 2.83 is not seeing changes to the scripts. so, I probably need to uninstall the scripts and reinstall them from the newest modified version. If I have to do that for each revision of the code that could be painful for trial and error.

Stupid question:
Do you need the 3DS plugin at all costs for your game engine? That sounds like a very ancient format to me. There are other much more modern formats that support rigging and animation as well as embedded textures. FBX and GLTF2 for example.

modern fbx does not import sadly, and that other format and all the ones on the 2.83 export list (except maybe collada and obj) arenā€™t even on the list.

Iā€™m not even sure 3ds allows armature data, so I might have to make another custom script.

Here are details on what 3DS supports:

As noted by SD, it does not sound like the optimal format for your purpose; it wasnā€™t even a popular format 20 years ago, as OBJ offered far more flexibility for general use, and of course FBX. I have no further advice on what steps you should take next, as I donā€™t work with game engines.

1 Like

Indeed, some applications work with 3DS better than with OBJ or FBX.
There was actual activity about bringing 3ds file format I/O back.

I mean ā€¦ it surely depends on the game engine, who wrote it, when and for what purpose. Many halfway recent engines probably are either geared towards and FBX pipeline for animated meshes and optional OBJ for statics or with Open Engines probably also Collada or a native file version via Plugin (GameBryo for example used a native format via Plugin). I remember Blender 2.79 and earlier used to have a pretty decent Plugin for Quakeā€™s file format. A current engin like Godot will very likely support GLTF2 but FBX unfortunately is still in very high demand among users.

I have a bit of experience with game engines but mostly from an artists and user side less so from programming. But still - what engine do you want to use it with and why is 3DS your preferred format, there? Maybe itā€™s one Iā€™m at least a bit familiar with.

Thomneverwake, that saves me a search this morning, so it does support animation. I thought it did.

SpookyDoom, Iā€™ve been using OBJ but as far as I can see it doesnā€™t save rigging info. lets just say Iā€™m getting a chance to provide new content for an old game with a custom engine and custome editing software, I canā€™t really say more. Right now I can make do as so long as I keep the bones and parent rig named correctly in that software, I can easily get it into 2.83 to refine it further then export it back to the actual game rather than the software.

my goal here is to be able to transfer it back to the editing software, rather than the game directly.

Why 3DS? I know I kinda hated it too, you know that; 3DS was the industry standard and for a long time the game industry practically only accepted that and maya. However the point is it can contain, Models, Rigging, Animation Keyframes, movement curves, and textures in layered channels, supporting practically every map type, bump, normal, color, alpha etc. so if the software has a list of 2 or 3 import and export options and 3DS is on the list then rather than attempt to hack the program to include a newer format, itā€™s just easier to work with whatever is available that covers what I need. writing from one applicationā€™s memory to another is kinda difficult.

For now using careful methods I can get around needing 3ds export, but. itā€™d save some steps in the trial and error process of working on rigged models, soā€¦ Itā€™s something Iā€™ll poke at. given itā€™s in python and Iā€™ve managed to get it running for single meshes alone thatā€™s uplifting enough for me to find out whats wrong with these 2 functions, parenting offsets, and truncated material/object names I seem to remember seeing notes by Ideasman42 in the code saying something about controlling the length of names so 3DS can see it and doesnā€™t crash, so it might be just the names are too long, which can more or less be fixed.

Blockquote # So 3ds max can open files, limit names to 12 in length

Blockquote # this is very annoying for filenames!

I hear you and see what youā€™re saying.

I wont spend all day on it, but Iā€™ll check a few sections of code and give them a good logic assesment. If it works, this script should be able to transfer something to 3ds much closer to the newest blender mesh format, so +1 import export option is a good thing, right?

One thing I can tell you for sure is that you are 100% right about OBJ. That is a mesh format only. No animation or bones/skinning. Material definition usually also doesnā€™t get carried over via any generic exchange format but if your engine assigns materials based on given names that will probably work in any readable format, then.

Otherwise, I mean if you have to keep it vague and are pretty much forced to use 3DS then - best of luck. If a plugin as native solution isnā€™t working out for you maybe you find a converter to work for you.

Got any good suggestions on converting software? all I could find was nchsoftware 3dspin but that seemed to not like a 2.83 .blend , gave a red x next to the file, and though it exported to 3ds it was broken because the software couldnā€™t read the initial blend.

Nope sorry. Got nothing in this regard. Blender would have been my first go to. :sweat_smile:
If itā€™s that old of a game engine maybe try Blender 2.79?
Or post on BlenderArtists. If you donā€™t plan on programming a 3DS or engine specific plugin this question is probably better asked, there.

I donā€™t know if I can be any help here, Iā€™m not a programmer. I have used 3D Studio since the old Dos version. I currently have a working version of Max 3.1 on an old XP computer that I have kept. I have years of models etc. that I created in Max. I have always wished I had a tool that could bring my older work into the Blender environment. The .3ds importer currently available in Blender 3.6 only works on some of my files. Most of them are disjoint after import and scattered throughout the Blender scene. I may be of some help as a tester since I can create, export and import into an original working version of Max 3.1

1 Like

sounds good. I will need a tester. but right now blender isnā€™t seeing changes to the scripts at all, I know some of whats wrong with the current scripts and how to fix it.

so itā€™ll be a while.

Sometimes reverse import of 3ds back in max can produce similar result.