How to convert muliple files at once?

Hello,
I want to convert some .bam files to an other extension with the P3D Tools.

But it seems that I have to convert all files manually one by one.

Is there an easier way?

You can just write a shell script (or batch script on Windows) containing all your commands.

But there are hunderds of files to convert… that would take for ever. is there not a drag and drop option?

You can use shell scripting (or a few lines of Python code) to enumerate all the files in a directory and run a command on each of them. I’m not exactly sure what the problem is here. There is no drag and drop way to do this because it is even easier to automate it using a script.

How would such a script look like?
An example please

  1. Create a text file converting.bat
  2. Insert the following lines:
SetLocal EnableDelayedExpansion

for %%f in (*.bam) do (

    set file=%%f
    set str=!file:~0,-4!
    
    D:\Panda3d\Panda3D-1.9.4-x64\bin\bam2egg.exe %%f !str!.egg
)
pause
  1. Place it in the .bam files folder
  2. Replace the path to the utility bam2egg.exe
  3. Run, click on the file (Window)

converting.zip (277 Bytes)

P.S. The preformatted button does not work correctly

Thanks it worked, BUT I will lose my textures… how do I keep them?

It is necessary to use additional parameters.

https://www.panda3d.org/manual/index.php/Converting_Egg_to_Bam

Ok… It sees the textures now, but when I open the new file it still has no textures. The texture path has beem found in the etc folder inside the P3D Engine Folder, so I guess I don’t understand the code part… you have an other example?

Thanks for helping me.

Looks like bam2egg does not have any additional options. And keeps the full path to the texture, I do not know what can be done with this. It’s like a converter error, it would be better that it does not change the texture record.

Is there an other solution?

The textures should be in a location where bam2egg can see them.

However, keep in mind that bam2egg is not a very good tool. I am not sure why you want to convert them to .egg as keeping them in .bam is generally a better idea in order not to lose data.

I’d like to get them running in an other engine, there are already some models converted, so I wondered how to do it.

When you create assets, you should generally keep the original asset files so that you are able to reexport them to any desired format when needed.

bam2egg is not a very good tool, since it is not a lossless process to convert from .bam to .egg. It is not really a supported conversion route since the pipeline was designed to go from modelling program to .egg to .bam, not the other way around. If you have somehow lost the original assets that your art team has produced, you are better off making your own conversion script to a desired format that is custom-tailored to your models.

If you are really committed to switching engines without the original artwork, then you have to be prepared to do significant retooling work, or you should ask your art team to recreate the assets from scratch.

Ah ok. Thank you kindly for the help.
I think I know a guy who is capable and willing to help me.