• Welcome to SC4 Devotion Forum Archives.

Script in Reader

Started by ilive, March 28, 2010, 01:41:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nique

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

Durfsurn

#21
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 :)


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