ColorCorrection and bezier float Controllers


#1

Hello,

I’m writing a simple script that is adding a colorcorrection nodes before nodes in diffuse slot for all materials of objects selected. I am trying to connect these colorcorrection nodes with bezier_float controllers. I managed to create the cc nodes correctly and create the bezier_float nodes, but I’m unable to connect them to the cc nodes.

Here is the code I have so far:

mats_col = #()

for o in selection where o.material != undefined do
join mats_col (getClassInstances VRayMtl target:o.material)

makeUniqueArray mats_col

av = sme.ActiveView
SelView = sme.GetView sme.ActiveView

HueCtrl = bezier_float()
HueCtrlNode = SelView.CreateNode HueCtrl [10,10]
HueCtrlNode.name = “HueShiftCTRL”

SatCtrl = bezier_float()
SatCtrlNode = SelView.CreateNode SatCtrl [10,10]
SatCtrlNode.name = “SaturationCTRL”

GainCtrl = bezier_float()
GainCtrlNode = SelView.CreateNode GainCtrl [10,10]
GainCtrlNode.name = “GainCTRL”

GammaCtrl = bezier_float()
GammaCtrlNode = SelView.CreateNode GammaCtrl [10,10]
GammaCtrlNode.name = “GammaCTRL”

for mymat in mats_col do
(
if mymat.texmap_diffuse != undefined then
(
mymap = mymat.texmap_diffuse
ccnode = ColorCorrection()
ccnode.Map = mymap
ccnode.lightnessMode = 1
mymat.texmap_diffuse = ccnode
)
else print “nothing in diffuse slot”
)

I tried to add rootScene[#SME][av][ccnode].SMENodeAttr.reference.hueShift = ?? but didn't work

#2

use setPropertyController


#3

Thanks so much!

I made it work… buuut it’s not really connecting the cc nodes with the controller nodes I create. It seems to make new controller nodes.

This is what it looks like now:

mats_col = #()

for o in selection where o.material != undefined do
join mats_col (getClassInstances VRayMtl target:o.material)

makeUniqueArray mats_col

av = sme.ActiveView
SelView = sme.GetView sme.ActiveView

HueCtrlD = bezier_float()
HueCtrlDNode = SelView.CreateNode HueCtrl [10,10]
HueCtrlDNode.name = “HueShiftCTRL”

SatCtrlD = bezier_float()
SatCtrlDNode = SelView.CreateNode SatCtrl [10,10]
SatCtrlDNode.name = “SaturationCTRL”

GainCtrlD = bezier_float()
GainCtrlDNode = SelView.CreateNode GainCtrl [10,10]
GainCtrlDNode.name = “GainCTRL”

GammaCtrlD = bezier_float()
GammaCtrlDNode = SelView.CreateNode GammaCtrl [10,10]
GammaCtrlDNode.name = “GammaCTRL”

for mymat in mats_col do
(
if mymat.texmap_diffuse != undefined then
(
mymap = mymat.texmap_diffuse
ccnode = ColorCorrection()
ccnode.Map = mymap
ccnode.lightnessMode = 1
ccnode.hueShift.controller = HueCtrlD
ccnode.saturation.controller = SatCtrlD
ccnode.gainRGB.controller = GainCtrlD
ccnode.gammaRGB.controller = GammaCtrlD
mymat.texmap_diffuse = ccnode
)
else print “nothing in diffuse slot”
)

Works, but the controller named controller nodes are not being used.