Hi, thanks for the code, it works great.
My problem is that my knowledge is small. I studied something, reworked the whole code structure so that the “fn” were together and then just called them.
I don’t know where to place it (fn f1 = format “1 / n” etc …) but it works without it.
If I ever ask myself as a primitive, sorry.
But when I reworked everything, I rewrote the new code with the old code and lost part, and I don’t know what was already there. Any idea?
This is the line $ .modifiers [#VRayDisplacementMod] .texmap = ???
I need them to add early maps from the listbox.
on lml2 pressed do
(
----- loading from matlibrary --------
prevmlfn = getMatLibFileName()
mlfn = getMatLibFileName()
ff = true
if chk1d.state == false then
(
fileOpenMatLib()
mlfn = getMatLibFileName()
if prevmlfn == mlfn and matarrayd.count != 0 then ff = false
)
if ff == true then
(
try
(
matarrayd = #()
loadMaterialLibrary mlfn
for m in currentMaterialLibrary do
(
--if superclassof m == material then
if superclassof m == textureMap then
(
arrentity = #(m,100)
append matarrayd arrentity
refreshlistd()
)
)
--loadMaterialLibrary prevmlfn
if lbx1d.items.count != 0 then
(
lbx1d.selection = 1
lbselectedd 1
)
else (lbselectedd 0)
)
catch
(
)
)
)
on rnd pressed do
(
macros.run "Modifier Stack" "Convert_to_Poly"
modPanel.addModToSelection (VRayDisplacementMod ()) ui:on
$.modifiers[#VRayDisplacementMod].keepContinuity = on
$.modifiers[#VRayDisplacementMod].texmap = ------------------------------------???????
$.modifiers[#VRayDisplacementMod].amount = spn_1a.value
$.modifiers[#VRayDisplacementMod].shift = spn_2a.value
--- defining range
sc = 0
for m in matarrayd do sc = sc + m[2]
--- random function in range
--- defining the hit in range
for o in selection do
(
r = random 0.0 sc
trg = true
tmpm = undefined
s = 0
for m in matarrayd do
(
s = s + m[2] -- greater limit
if r <= s then
(
if trg then
(
--print m[1].name
tmpm = m[1]
)
trg = false
)
) -- end for matarray
try
(
o.material = tmpm
o.material.showInViewport = true
)
catch()
) -- end for selection
)