Hi,
I can see how to move a position or to change its color but how can I create a new position ?
change position is ok : rootScene[#SME][#View1][#Map__45____Gradient_Texture].SMENodeAttr.reference.Positions[17] = 0.489231
change color is ok : rootScene[#SME][#View1][#Map__45____Gradient_Texture].SMENodeAttr.reference.color[17] = color 137 188 0
Thanks.
maxscript add new Gradient position
Forum rules
Please post only in English in this subforum. For alternate language discussion please go here http://render.otoy.com/forum/viewforum.php?f=18
Please post only in English in this subforum. For alternate language discussion please go here http://render.otoy.com/forum/viewforum.php?f=18
YOKO Studio | win 10 64 | i7 5930K GTX 3090 | 3dsmax 2022.3 |
- neonZorglub
- Posts: 1017
- Joined: Sun Jul 31, 2016 10:08 pm
Hi coilbook,HHbomb wrote:Hi,
I can see how to move a position or to change its color but how can I create a new position ?
change position is ok : rootScene[#SME][#View1][#Map__45____Gradient_Texture].SMENodeAttr.reference.Positions[17] = 0.489231
change color is ok : rootScene[#SME][#View1][#Map__45____Gradient_Texture].SMENodeAttr.reference.color[17] = color 137 188 0
Thanks.
For 'Gradient Texture', there are 3 arrays that store the data (named Positions, Color and TexMap_Tab)
You can manipulate those arrays like any other arrays with maxscript, but when adding or deleting element,
you MUST keep the same size for all of those 3 arrays.
For example, using t as the gradient texture:
t = meditMaterials[1].diffuse_tex
Map #0:Gradient Texture
To add a 'key', you need to add 3 elements (add 1 element for each of those 3 arrays):
append t.Positions 0.67
append t.color (color 57 255 40)
append t.TexMap_Tab undefined
check the size of each array with
t.color.count
t.Positions.count
t.TexMap_Tab.count
Don't change or delete the first 2 elements (1 and 2), that's reserved for the first key (left, position 0.0) and last keys (right, position 1.0)
Note that other octane textures using gradient may have different names, eg gradPositions, gradColors, gradMaps for Apply gradient map (layer of a Composite texture)
(Use showproperties t to check)
Also Toon Ramp and Volume Ramp have only 2 arrays (positions and color)
See also Autodesk documentation on arrays:
https://help.autodesk.com/view/MAXDEV/2 ... 869817282A
Thanks
Thanks ! 
But I'm not coilbook

But I'm not coilbook

YOKO Studio | win 10 64 | i7 5930K GTX 3090 | 3dsmax 2022.3 |