helix
helix copied to clipboard
Fix hasVignetteMaterial always returning true
Call IsError instead of comparing IMaterial with string
@OffLegAz Have you tested this without the Helix content on, including in client materials/ folders .etc?
@OffLegAz Have you tested this without the Helix content on, including in client materials/ folders .etc?
I've tested this while trying to check another material on validity in the same way it's done with vignette. Soon I found that this check always returns true due to IMaterial not being equal to string. Eventually, I discovered IsError function on wiki wich allows to safely check is material valid or not. So this fix should work fine.
@OffLegAz Have you tested this without the Helix content on, including in client materials/ folders .etc?
I've tested this while trying to check another material on validity in the same way it's done with vignette. Soon I found that this check always returns true due to IMaterial not being equal to string. Eventually, I discovered IsError function on wiki wich allows to safely check is material valid or not. So this fix should work fine.
i have rechecked this just to be sure.
-------------- doesnot_exist.png --------------
Material [___error] Material [___error]
true true
false false
-------------- BREAK --------------
-------------- CORRECT MATERIAL --------------
-------------- icon16/user.png --------------
Material [icon16/user] Material [icon16/user]
false false
false false
-------------- BREAK --------------
local testcase_354 = { }
do
testcase_354.test = function()
print( '-------------- INCORRECT MATERIAL --------------' )
print('-------------- doesnot_exist.png --------------')
local materialBad = 'doesnot_exist.png'
local YANKEE = Material( materialBad )
local ZULU = ix.util.GetMaterial( materialBad )
print( YANKEE, ZULU )
print( YANKEE:IsError( ), ZULU:IsError( ) )
print( YANKEE == '___error', ZULU == '___error' )
print( '-------------- BREAK --------------' )
print( '-------------- CORRECT MATERIAL --------------' )
print('-------------- icon16/user.png --------------')
local materialGood = 'icon16/user.png'
local ALPHA = Material( materialGood )
local BRAVO = ix.util.GetMaterial( materialGood )
print( ALPHA, BRAVO )
print( ALPHA:IsError( ), BRAVO:IsError( ) )
print( ALPHA == '___error', BRAVO == '___error' )
print( '-------------- BREAK --------------' )
end
testcase_354.test()
end
@alexgrist no issues found with the reasoning, he is correct in this.
I don't think anything will happen if the vignette isn't drawn when it doesn't exist.