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.