(05-13-2017, 04:07 AM)Random Talking Bush Wrote: Ah, thanks for your help! And it just so happens that I was also in the process of cleaning things up with the script, too, so I've added your changes to the newest revision.
Hopefully I didn't accidentally break anything with the revision, but things seemed to work alright for the models I've tried. Either way, be sure to let me know if there's anything else I can improve!
You're welcome.
Not really matter but you forgot the "disableSceneRedraw()" between lines 194/195.
Here's a lil function to limit range, for type byte nor other custom range.
Code:
fn range Lo Hi val=(
val=case of(
(val>Hi):Hi
(val<Lo):Lo
default:val
)
)
to reduce this kind of code:
Code:
--Color Info--
(AttrArr[attr].attName == "_c0"):(
case of (
(AttrArr[attr].vertType == 0x020A):(
var1 = var1 * 2
var2 = var2 * 2
var3 = var3 * 2
var4 = var4 as float / 127
case of (
(var1 < 0):(var1 = 0)
(var1 > 254):(var1 = 255)
)
case of (
(var2 < 0):(var2 = 0)
(var2 > 254):(var2 = 255)
)
case of (
(var3 < 0):(var3 = 0)
(var3 > 254):(var3 = 255)
)
case of (
(var4 < 0):(var4 = 0)
(var4 > 1):(var4 = 1)
)
)
(AttrArr[attr].vertType == 0x080F):(
var1 = var1 * 255
var2 = var2 * 255
var3 = var3 * 255
case of (
(var1 < 0):(var1 = 0)
(var1 > 255):(var1 = 255)
)
case of (
(var2 < 0):(var2 = 0)
(var2 > 255):(var2 = 255)
)
case of (
(var3 < 0):(var3 = 0)
(var3 > 255):(var3 = 255)
)
)
(AttrArr[attr].vertType == 0x0813):(
var1 = var1 * 255
var2 = var2 * 255
var3 = var3 * 255
case of (
(var1 < 0):(var1 = 0)
(var1 > 255):(var1 = 255)
)
case of (
(var2 < 0):(var2 = 0)
(var2 > 255):(var2 = 255)
)
case of (
(var3 < 0):(var3 = 0)
(var3 > 255):(var3 = 255)
)
)
)
append Color_Array[var1,var2,var3]
-- append Alpha_Array var4
)
to this shorter
Code:
--Color Info--
(AttrArr[attr].attName == "_c0"):(
case of (
(AttrArr[attr].vertType == 0x020A):(
var1 = range 0 254 (var1 * 2)
var2 = range 0 254 (var2 * 2)
var3 = range 0 254 (var3 * 2)
var4 = range 0 1 (var4 as float / 127)
)
(AttrArr[attr].vertType == 0x080F):(
var1 = range 0 255 (var1 * 255)
var2 = range 0 255 (var2 * 255)
var3 = range 0 255 (var3 * 255)
)
(AttrArr[attr].vertType == 0x0813):(
var1 = range 0 255 (var1 * 255)
var2 = range 0 255 (var2 * 255)
var3 = range 0 255 (var3 * 255)
)
)
append Color_Array[var1,var2,var3]
-- append Alpha_Array var4
)