ScriptSpot

Forum topic · General Scripting

VrayHDRI reader material editor

By johncrawshaw · 2013-06-09

Description

Hi All,

I'm writing a HDRI viewer. Part of what I want to do is be able to read current HDRI's settings in the scene, specifically material editor slot 24. Here is the code I have so far on load:

if meditMaterials[24] != VRayHDRI() then
(
print "HDRI"
Hozmulti.value = meditMaterials[24].horizontalRotation
) else print "not"-- Hozmulti.value = 0

It only has to work from slot 24 and for the current HDRI if it exsits.

Thanks

Comments (1)

alexcfarrell · 2013-06-20

Think I've found a way around this using getMeditMaterial...

Whatever you call your VRayHDRI it will always have ":VRayHDRI" appended to it when you use getMeditMaterial. Therefore you can use the trimleft function to remove all characters that would appear before the ":". This way you can ascertain what's a VRayHDRI, and what isn't.

Appears a little fiddly but it's only two lines of code.

Cheers,
Alex