Author Topic: Perl script regquest. Two actually.  (Read 1745 times)

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Perl script regquest. Two actually.
« Reply #30 on: June 29, 2011, 08:28:51 pm »


               What text editor? And was it able to search for regular expressions (GREP)? I've got BBedit in os x but it would handy to see what is used on the windows side.
               
               

               
            

Legacy_Bannor Bloodfist

  • Hero Member
  • *****
  • Posts: 1578
  • Karma: +0/-0
Perl script regquest. Two actually.
« Reply #31 on: June 29, 2011, 08:47:57 pm »


               

henesua wrote...

What text editor? And was it able to search for regular expressions (GREP)? I've got BBedit in os x but it would handy to see what is used on the windows side.


I don't know what the program actually is, but I was told that the single seat license cost is well over 10,000.  So it is not likely something that can be found on the net.

It does a lot more than grep though, it allows batching, and sub-functions like any normal prgramming language.  Olias claimed he was able to find the mdl's in the folder, search inside each one, find the nodes that had the proper bitmap assigned, then back process that entire node to find the specific Alpha line and make the necessary changes.

That is why I was originally requesting a perl script, because I know that can be done in a full programming language like perl.
               
               

               
            

Legacy_Calvinthesneak

  • Hero Member
  • *****
  • Posts: 1159
  • Karma: +0/-0
Perl script regquest. Two actually.
« Reply #32 on: June 29, 2011, 09:17:03 pm »


               You could probably program in GREP, though finding the correct sub strings and such might get tricky.  GREP is pretty simple, much like REGEX and not really capable of handling advanced search functionality.  I'm sure you could loop enough to do it, but trying to catch all the cases... would be difficult.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Perl script regquest. Two actually.
« Reply #33 on: June 29, 2011, 10:27:26 pm »


               BBedit and textmate can do all of that. And they each cost less than $100. OSX only unfortunately. I just wanted a windows tool so that I didn't have to hop between OS's when working on MDLs for NWN. I am really weak in windows command line and so don't know how to script it to use regular expressions.

[edit] Stupid question - but do any windows flavors have *nix style text editor apps ported to their command line? vi emacs or the like?
               
               

               


                     Modifié par henesua, 29 juin 2011 - 09:29 .
                     
                  


            

Legacy_Bannor Bloodfist

  • Hero Member
  • *****
  • Posts: 1578
  • Karma: +0/-0
Perl script regquest. Two actually.
« Reply #34 on: June 29, 2011, 10:33:37 pm »


               GNU Emacs for windows
               
               

               
            

Legacy_eeriegeek

  • Jr. Member
  • **
  • Posts: 75
  • Karma: +0/-0
Perl script regquest. Two actually.
« Reply #35 on: June 29, 2011, 10:34:46 pm »


               henesua, google the cygwin project, it's a port of the gnu tools to windows and gives you a bash shell window with access to many of the most useful tools (including vi, emacs, and perl!)
               
               

               
            

Legacy_eeriegeek

  • Jr. Member
  • **
  • Posts: 75
  • Karma: +0/-0
Perl script regquest. Two actually.
« Reply #36 on: June 29, 2011, 10:37:23 pm »


               also, bannor, it sounds like it might be a generally useful tool, if you would like to pm me a couple of before and after mdl files i can take a shot at writing a perl script.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Perl script regquest. Two actually.
« Reply #37 on: June 29, 2011, 11:06:27 pm »


               Thanks eeriegeek, that sounds exactly like what i need to avoid learning the command line for windows.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Perl script regquest. Two actually.
« Reply #38 on: July 04, 2011, 07:00:20 pm »


               

Bannor Bloodfist wrote...

 Actually, having a script would still be useful, but I don't think nwscript can handle it ShaDoOow, I really appreciate you attempting it, but we found too many inconsistancies in the various mdls. IT seems that things can change easily, and are affected by access order/link order in the individual mdl file. So, if I were to open a tile, edit an object, it would change placement of the various options for the graphics bits, the alpha, luminosity, shininess etc... and put those lines in different locations....

  IF you are still interested in attempting this, I can maybe help identify what lines are actually required for each instance, and just make it a quick search for node with bitmap, and replace everything between node and verts in the mdl. Everything after the vert can NOT be changed as it affects the uvw-mapping on the object, and is encoded somehow.



The system I am still working on writing has no problem with the placements of the KeyWords, As long as the Key Word is the first text on the line.    It basicly searches for the KeyWord in this case 'bitmap',    then checks to see if the text after it is the correct value.  If the value is correct it then searches forward for the end of the node.  Then back for the begining of the node.   It then searches for the second Key and Value,  once the second key if found  it checks the value. if it does not match it replaces it. 

The current problem that I have ran into is that not all nodes, that have a 'bitmap' key,, have an 'alpha' key.  This raises the question.  IF the bitmap is found with no alpha in the same node what should be done?  Should a Alpha key be added?  Would this hurt something that I do not know about?  

I do not think it would.  I guess the question would be where to add it.  In some of the bioware tile sets I have noticed that the alpha key is after the verts with the bitmap key being before them.   A verry broad assumption I have is that I could add the key anwhere into the node as long as it is after the bitmap key.   Does that sound like a safe assumption to you?
               
               

               
            

Legacy_Bannor Bloodfist

  • Hero Member
  • *****
  • Posts: 1578
  • Karma: +0/-0
Perl script regquest. Two actually.
« Reply #39 on: July 04, 2011, 08:31:24 pm »


               So far, I have never found the alpha AFTER the bitmap, but that doesn't mean it can't be there.  In every mdl I have specifically looked for it, the alpha was somewhere before the Bitmap, and always before the verts etc... But you may be right in the assumption that specific location doesn't matter, as long as you don't place it inside some of the sub sections, IE, don't place alpha line in between the many different lines for verts, faces, etc...

The alpha line is not a required field, and only shows up on those tiles that have had some sort of adjustment made to the texture, either re-uvw mapping it, or changing one of the other various settings.  By default, alpha is "assumed" to be 1.0 by the engine so if the line doesn't exist in the mdl, it just takes the assumed 1.0 state.

There are other lines similar to Alpha that likely could use the same sort of treatment, but I have not investigated them at this stage of things yet.  
Code:
scale 1
  render 1
  shadow 0
  beaming 0
  inheritcolor 0
  rotatetexture 1
  alpha 0.8
  transparencyhint 1
  selfillumcolor 0 0 0
  ambient 1 1 1
  diffuse 1 1 1
  specular 0 0 0
  shininess 26
  center 0 0 0
  bitmap tctl0_water01
endcode

I believe several of those are usefull, diffuse settings, shininess, ambient, selfillumcolor, abd inheritcolor all affect the way the texture is rendered.  But I also believe that they tend to be defaulted to whatever Bioware originally used.  Meaning they may not be required to get a texture to paint.
               
               

               


                     Modifié par Bannor Bloodfist, 04 juillet 2011 - 07:32 .