Menu

LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Dependencies
Chat
Welcome, Guest. Please login or register.
Did you miss your activation email?

October 22, 2021, 04:10:49 AM

Login with username, password and session length

Author Topic: Script in Reader  (Read 13461 times)

0 Members and 1 Guest are viewing this topic.

Offline Nique

  • CityMania Development Team
  • Forums Governor
  • *
  • Posts: 288
  • Total likes: 0
  • Reputation: 6
  • The dutch will do it ;)
Re: Script in Reader
« Reply #20 on: September 01, 2014, 11:49:03 AM »
Durfsurn, lol i just posted something similar, take a look at my code (above) ( or click http://codetidy.com/4934/ )

Look at lines 39~45:

flags, alphafunc, depthfunc,srcBlendFactor,dstBlendFactor,alphaThreshold = reader:s3dmat_GetInfo(block)
-- (change settings here) --
reader:s3dmat_SetInfo(block, flags, alphafunc, depthfunc,srcBlendFactor, dstBlendFactor,alphaThreshold)


Change it to something like this

id, wrapModeS, wrapModeT,magFilter, minFilter,name = reader:s3dtext_GetInfo(s3dtext)
-- (change settings here) --
reader:s3dtext_SetInfo(s3dtext, id, wrapModeS, wrapModeT,magFilter, minFilter,name)
Proudly developer of

Offline Durfsurn

  • Modding Apprentice
  • NAM Team
  • Forums Senator
  • *
  • Posts: 513
  • Total likes: 166
  • Reputation: 5
  • Textures!
Re: Script in Reader
« Reply #21 on: September 14, 2014, 01:25:37 AM »
Cheers Nique, that really helped :).

I suppose I should share it all here with you.

This script changes the following settings for all S3D's in the dat (so also Preview Models);
- wrapModeS   = Clamb
- wrapMode T  = Clamb
- magFilter      = Bilinear
- minFilter       = Bilinear, no mipmapping

This is useful for changing lots of S3D's at once to PP specs so they don't look fuzzy :)

Code: [Select]
function reader.main (this) 
       
        pos = reader:entries_GetHeadPosition() 
 
        while pos ~= 0 do
               
                entry,pos = reader:entries_GetNext(pos)
                flag      = reader:entry_GetFlag(entry)
 
                if (flag == 2) then
                       
                        s3d    = reader:s3d_Decode(entry)
                        count  = reader:s3d_Count(s3d, 4)-1

                        for i=0,count do

                                block  = reader:s3d_GetBlock(s3d, 4, i)
                                s3dpos = reader:s3dtext_GetHeadPosition(block)         
                         
                                while s3dpos ~= 0 do                   
                                        s3dtext, s3dpos = reader:s3dtext_GetNext(block,s3dpos)
                         
id, wrapModeS, wrapModeT,magFilter, minFilter,name = reader:s3dtext_GetInfo(s3dtext)
wrapModeS = 2
wrapModeT = 2
magFilter = 1
minFilter = 1
reader:s3dtext_SetInfo(s3dtext, id, wrapModeS, wrapModeT,magFilter, minFilter,name)
end                   
                         
                                reader:s3d_SetBlock(s3d, 4, i, block)                               
                       
                        end

                        reader:s3d_Encode(entry,s3d)
                end
        end
 
        io.write("\nFinished.")
        reader:refresh()
end

-Billy