Author Topic: OE: object batch convert?  (Read 2078 times)

Offline USRanger

  • AvA Staff Member
  • Plutonium Member
  • *******
  • Posts: 10325
      • BoP Home
OE: object batch convert?
« Reply #15 on: October 07, 2007, 09:50:17 PM »
Axis vs Allies Staff Member
☩ JG11 Sonderstaffel ☩
Flying 'Black[Death] 10' ☩JG11☩

Only the Proud, Only the Strong Ne Desit Virtus

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10891
OE: object batch convert?
« Reply #16 on: October 08, 2007, 04:08:58 AM »
Just for clarification, are you converting a large batch of .ac files into separate .shp files and dropping them into the texsrc folder all at once, or have you worked out a way to combine several .ac files together?
Easy in-game again.
Since Tour 19 - 2001

Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #17 on: October 08, 2007, 12:57:14 PM »
Quote
Originally posted by Easyscor
Just for clarification, are you converting a large batch of .ac files into separate .shp files

Yes, this is what script is doing currently.

Quote
Originally posted by Easyscor
and dropping them into the texsrc folder all at once

No, but it's possible to code a user dialog about target texsrc-folder, to where script will copy just converted *.shp & *.htx files. User just need to delete the cache folder before open the TE.

Quote
Originally posted by Easyscor
or have you worked out a way to combine several .ac files together?

I think, it's possible to do.
I already made a script which allow user to reorganize hierarchy tree and edit the properties inside of the .ac file without AC3D program.
http://forums.hitechcreations.com/forums/showthread.php?s=&threadid=192932&highlight=python

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10891
OE: object batch convert?
« Reply #18 on: October 08, 2007, 01:52:19 PM »
Thanks
Easy in-game again.
Since Tour 19 - 2001

Offline BlauK

  • Platinum Member
  • ******
  • Posts: 5091
      • http://www.virtualpilots.fi/LLv34/
OE: object batch convert?
« Reply #19 on: October 08, 2007, 04:24:30 PM »
Quote
Originally posted by Xjazz

No, but it's possible to code a user dialog about target texsrc-folder, to where script will copy just converted *.shp & *.htx files. User just need to delete the cache folder before open the TE.


I have actually always been using a batch file for copying the newly created res file to texsrc and deleting the cache at the same time. It is very simple.


  BlauKreuz - Lentolaivue 34      


Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10891
OE: object batch convert?
« Reply #20 on: October 08, 2007, 06:11:37 PM »
Here all this time I thought both of you were from Finland.  I know now that can't be true because the Finns all meet in a big conference hall and talk while they work on terrains and drink lots of alcohol. :lol
Easy in-game again.
Since Tour 19 - 2001

Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
The pre-convert batch checking script(beta)
« Reply #21 on: October 15, 2007, 03:40:54 PM »
Hi

Here is a pre-convert batch checking script(beta):
http://www.warezhouze.1g.fi/Here/Blender3d/AH_scripts/Batch_check_ob1.zip

The script is checking following issues:
- All .ac file assigned textures are present in same folder with .ac file.
- The *.bmp and *_a.bmp textures have correct modes: index / gray scale.
- The *_a.txt file index value match with target texture index value of  R255G0B255 color (ah default alpha ch.).

Requirements:
python 2.5+
Python Imaging Library 1.1.6 for Python 2.5 (windows only) from
http://www.pythonware.com/products/pil/

Installation:
The zip file need to unzip to the AHedit Tiles folder.

If you already have the Batch_convert_04b.py script, then you don't need to unzip the 'oe_bc.txt' file.

The 'oe.bc.txt' must contain correct path to the /Tiles/ folder.


Run it:
Start the python, open the 'Batch_check_beta.py' file and execute it  with F5 key.
The script will list checked .ac files and possible error message to the python shell window.

Report

Offline BlauK

  • Platinum Member
  • ******
  • Posts: 5091
      • http://www.virtualpilots.fi/LLv34/
OE: object batch convert?
« Reply #22 on: October 15, 2007, 04:24:43 PM »
XJazz,
how would the program now the correct *_a.txt value?
AFAIK, it can be anything between 0 and 255 for each and every file.


  BlauKreuz - Lentolaivue 34      


Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #23 on: October 16, 2007, 01:10:37 PM »
Quote
Originally posted by BlauK
XJazz,
how would the program now the correct *_a.txt value?
AFAIK, it can be anything between 0 and 255 for each and every file.


It's possible if we have .bmp name and intent alpha channel color value.

If we use a global alpha channel color value, like I do in Batch_check script, then possible solutions could be:
- User creates empty (texture file name)_a.txt files and script will write the index data to them.
- If sub-object texture has a 'StencilAlpha=*' flag, the script will create the (texture file name)_a.txt file with index data.

Untested idea:
- the .ac file sub-object has in property field a intent alpha channel color value for the script in certain format, like r255g0b255.

Blauk
If you have a idea about functional solution for you, let know about it. I like to take a shot and try to code it.

Offline BlauK

  • Platinum Member
  • ******
  • Posts: 5091
      • http://www.virtualpilots.fi/LLv34/
OE: object batch convert?
« Reply #24 on: October 16, 2007, 03:17:05 PM »
XJazz,
.. u going too fast for me being able to follow :)

What I meant is that when I make some texture in PhotoShop and use some color which I intend to present the transparent color, I have no control on which position that color will take in the color map when I covert the texture to indexed color. Never even tried to change the color map to get a certain value for it. Dunno whether it is possible.
Sometimes it is 0 or 1, sometimes around 2-4, sometimes around 16. I just check its position from the color map and type the number to the *_a.txt file.


  BlauKreuz - Lentolaivue 34      


Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #25 on: October 17, 2007, 11:19:42 AM »
Quote
Originally posted by BlauK
XJazz,
.. u going too fast for me being able to follow :)

What I meant is that when I make some texture in PhotoShop and use some color which I intend to present the transparent color, I have no control on which position that color will take in the color map when I covert the texture to indexed color. Never even tried to change the color map to get a certain value for it. Dunno whether it is possible.
Sometimes it is 0 or 1, sometimes around 2-4, sometimes around 16. I just check its position from the color map and type the number to the *_a.txt file.


Hee hee

Dump that PS and start to use GIMP.

http://www.warezhouze.1g.fi/Here/AH/pics/GIMP_index.jpg

I can assign any color(256) to any index.

Offline BlauK

  • Platinum Member
  • ******
  • Posts: 5091
      • http://www.virtualpilots.fi/LLv34/
OE: object batch convert?
« Reply #26 on: October 17, 2007, 12:08:53 PM »
The point was that there has been no reason so far to force the transparent color to some certain number ;)

If this error checking would be the only reason, I don't think I would change my work process just for that. There is enough error checking for that issue when one sees the actual object with or without the odd colored areas.


  BlauKreuz - Lentolaivue 34      


Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #27 on: October 17, 2007, 02:37:54 PM »
Okey...

I misunderstand you. I though, somehow, you want to see a forced color index. I was wondering why :D


Currently the checking script is assuming the user ONLY use a pink (r255 g0 b255) as alpha channel color I.E. global alpha channel color. This will make the automated *_a.txt value checking & fixing possible. Also the automated *_a.txt file creation is possible for the 'StencilAlpha' flagged textures.

The main reason for the checking is to ensure error free batch convert run. Checking also saves from the nasty dead shape alpha channel/layer texture appearing surprises.


There is enough error checking for that issue when one sees the actual object with or without the odd colored areas.

My wild guess
Two different textures in different maps with same name. Last game cached texture appear in two maps... Maybe.

Offline BlauK

  • Platinum Member
  • ******
  • Posts: 5091
      • http://www.virtualpilots.fi/LLv34/
OE: object batch convert?
« Reply #28 on: October 17, 2007, 03:30:18 PM »
So you can somehow detect that "pink" RGB value from teh BMP files? Or will you always have it in a certain color index number... thus checking only what number is in the txt file?


  BlauKreuz - Lentolaivue 34      


Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #29 on: October 20, 2007, 04:51:08 PM »
Hi

Here is the latest Batch_check
http://www.warezhouze.1g.fi/Here/Blender3d/AH_scripts/Batch_check_0b4.zip

The requirements, installation and execution are same as before*.

Features:
- Missing  .bmp texture file notifying.
- Wrong .bmp texture file color mode notifying.**
- Automated *_a.bmp alpha layer texture file color mode fixing.
- Automated *_a.txt file alpha channel R255 G0 B255 index value fixing.
- Automated *_a.txt file creation with alpha channel R255 G0 B255 index value for the 'StencilAlpha' flagged textures.
- Report to the python shell and to the 'BATCH_CHECK_REPORT.txt' text file about the checked .ac files and possible errors.

* You create the short-cut to the script if you don't want to execute script from python (F5) and read the report from python shell.
* * The PIL RGB to Index conversion don't work too well yet and that's why I left it out. User must take care of this task.