Get BMAP's filename...?

Posted By: Superku

Get BMAP's filename...? - 06/21/18 19:34

Is it possible to retrieve a BMAP's original filename - somehow?
Recently I've made a post saying that it cannot be done but still, asking does not hurt.
I've written a function (for an in-game editor) that combines multiple entities into one. Now I want to save that entity/ mesh as an MDL. That's working to some degree already (mesh + skin points) but now I'm stuck at the skin. All entities use external files as skin textures.

Maybe via some BMAP.d3dtex(or ptr?) pointer offset (or GetPrivateData maybe...)? Or some other function that I'm not aware of?
Posted By: jcl

Re: Get BMAP's filename...? - 06/22/18 10:40

No, I believe the original file name is nowhere stored. So you need some other solution, a file list or something like that, for storing the file name.
Posted By: Superku

Re: Get BMAP's filename...? - 06/22/18 11:24

Alright, thanks.
Posted By: Evo

Re: Get BMAP's filename...? - 06/22/18 18:51

Quote:

Is it possible to retrieve a BMAP's original filename - somehow?

I'm not sure if this is what you're looking for, but I had a similar problem when developing my 2d game builder and EFX animation editor. To get original file names of external BMAP files, I had to use text_for_dir :
Code:
txt_for_dir(TEXT*name, "*.*");


You'll find a basic example in the manual. Just create a TEXT array for reading the strings. It will read the original names of all files within the selected folder and store it all into a TEXT array. Then you can just loop through the array and define/create/point to whatever is needed. I used this to read from a folder and create auto generated lists for external files in my EFX editor.
Posted By: Superku

Re: Get BMAP's filename...? - 06/22/18 19:29

Yeah thanks, I got something like this already.

The issue is that theoretically I'd have to iterate over all textures, bmap_create them, compare their content with the source skin and return that on match as the source file. That's suboptimal of course, so I guess it won't be fully automatic and require you to select a skin texture manually.
Posted By: FBL

Re: Get BMAP's filename...? - 06/23/18 15:51

I'm not sure if I fully understood what you're up to.

But if it's ingame... can't you just load the models, copy the bitmap buffers, and when exporting, choose and reference your own bitmap names and save them from your buffers?
It will still have you loading and saving bitmaps, which sounds like extra work at first glance. But it gives you more options for ingame bitmap modification on the other hand. My experience is, that bitmap manipulation/instructions are not THAT slow - unless you need it to happen realtime, which does not appear to be the case.

Of course the export folder should be a different one than the import folder in that case.
Posted By: Superku

Re: Get BMAP's filename...? - 06/24/18 12:48

Yeah I could do that but... I don't want to create new bitmaps, the main usage right now is combining entities.
Have a look at the following scenario for example: http://superku.de/entCombine.jpg
I wrote a code to automatically place thousands of leaf entities around the base mesh (as I couldn't get it to look right in Blender after some time). I actually have a video of that from an earlier version: https://i.gyazo.com/aa7ec68b29ba24c413bc58459aa7f7f5.mp4
Another scenario was where I had a bunch of coconuts covering the floor, which I replaced with the click of a button (or 2) by just one entity instead.

Having to input the texture files is a little bothersome to me but oh well.
Btw. I'd probably compare the buffers directly instead of using pixel instructions, *should* work if you grab the right BMAP member.
Posted By: Quad

Re: Get BMAP's filename...? - 06/24/18 14:00

Oooh, i was once writing a general purpose editor. What i did was, read extern skin names from MDL7 files, write those to a metadata file(json) along with model name and content/model browser would use those files(also had thumbnail/preview images and other data about files) to show the list of available models. I think you can use a similar approach, either create those files if you have small amount of models or create them with a little script automatically. And use one of the entity skills/strings to remember which metadata file that entity came from and use that to get skin names.

I also remember converting internal skins to extern. But i remember some of those was not available in mdl7 sdk so i manually did some stuff, which ones were missing i do not remember.
Posted By: Superku

Re: Get BMAP's filename...? - 06/24/18 14:08

Oh right, that's a neat idea, I will do that! Thanks!
I couldn't really figure out the mdl7 SDK so I did it manually as well.
Posted By: FBL

Re: Get BMAP's filename...? - 06/25/18 19:18

Ah I see. Ok, then exporting the bitmaps is not so much of a useful choice.

I remember having my problems with MDL7 as well, mainly not understanding the SDK while wanting to write MDL7 files from Lite-C.
I ended up exporting a D3D compatible vertex and triangle dump, together with a texture table, so I could easily create a loader and use the D3D mesh functions... grin
Posted By: Superku

Re: Get BMAP's filename...? - 06/25/18 19:26

I was doing something like that before as well, or rather I wrote an OBJ exporter/ save entity mesh as OBJ using the regular file_str_write instructions. If you don't need skins (which I didn't at first) this is quick and easy to do, as ent_create works with OBJ files as well!
Posted By: FBL

Re: Get BMAP's filename...? - 06/25/18 19:28

I needed skins and some extra stuff, but unlike you I had the bitmap filenames, as my source was not a MDL file.

Apart from that, I totally forgot about obj.
© 2024 lite-C Forums