[Closed] Changing values in modifyer maps?
Hi guys!
Working on a script to generate rocks:)
Having issues changing the color values on the map on a diplace modifier.
any Ideas?
heres what I got so far
fn addDisplace obj =
(
local iTex = cellularTex size:6 spread:1.5
local iMod = Displace strength:10 map:iTex
addModifier obj iMod
$.modifiers[#Displace].strength = 10
$.modifiers[#Displace].maptype = 2
$.modifiers[#Displace].length = 50
$.modifiers[#Displace].width = 50
$.modifiers[#Displace].height = 50
(this is what I.m trying to change)
meditMaterials[8].cellColor = color 0 0 0
meditMaterials[8].divColor1 = color 159 159 159
meditMaterials[8].divColor2 = color 112 112 112
)
I’m a complete noob in scripting and just started learning it. Thought this would be a good challenge:)
For some reason it stopped working completly and now I can’t figure it out.
Heres the entire script! any pro’s that can help me?
try (closerolloutfloater MainFloater) catch()
Rollout Menu01 “Stone Creator”
(
button createstone “Create Stone” pos:[2,6] width:80 height:20
button editstone “Edit Stone” pos:[82,6] width:80 height:20
–script start
on createstone pressed do
(
Box lengthsegs:5 widthsegs:5 heightsegs:5 length:10 width:10 height:10 mapcoords:on pos:[0,0,0] isSelected:on
modPanel.addModToSelection (Spherify ()) ui:on
modPanel.addModToSelection (TurboSmooth ()) ui:on
$.modifiers[#TurboSmooth].iterations = 4
fn addDisplace obj =
(
local iTex = cellularTex size:6 spread:1.5
local iMod = Displace strength:10 map:iTex
addModifier obj iMod
$.modifiers[#Displace].maptype = 2
$.modifiers[#Displace].length = 50
$.modifiers[#Displace].width = 50
$.modifiers[#Displace].height = 50
--trying to change the colors on these in the celluar map
--cellColor = color 0 0 0
--divColor1 = color 159 159 159
--divColor2 = color 112 112 112
)
addDisplace selection[1]
–script end
)
Rollout Menu02 “empty”
(
)
Rollout Menu03 “empty”
(
)
MainFloater = newrolloutfloater “Stone Creator” 178 200
addrollout Menu01 MainFloater
addrollout Menu02 MainFloater
addrollout Menu03 MainFloater
Your script is just a little unorganized. Try using indents to help see when you are missing a bracket (which was the problem.)
To change the cellular properties just change them directly from iTex, no need to fish though Object > modifier > cellularTex.
Finally use the “code” ubb when posting script:
Rollout Menu01 "Stone Creator"
(
button createstone "Create Stone" pos:[2,6] width:80 height:20
button editstone "Edit Stone" pos:[82,6] width:80 height:20
fn addDisplace obj =
(
local iTex = cellularTex size:6 spread:1.5
local iMod = Displace strength:10 map:iTex
addModifier obj iMod
iMod.maptype = 2
iMod.length = 50
iMod.width = 50
iMod.height = 50
--trying to change the colors on these in the celluar map
iTex.cellColor = color 0 0 0
iTex.divColor1 = color 159 159 159
iTex.divColor2 = color 112 112 112
)
on createstone pressed do
(
Box lengthsegs:5 widthsegs:5 heightsegs:5 length:10 width:10 height:10 mapcoords:on pos:[0,0,0] isSelected:on
modPanel.addModToSelection (Spherify ()) ui:on
modPanel.addModToSelection (TurboSmooth ()) ui:on
$.modifiers[#TurboSmooth].iterations = 4
addDisplace selection[1]
)
)
Rollout Menu02 "empty"
(
)
Rollout Menu03 "empty"
(
)
try (closerolloutfloater MainFloater) catch()
MainFloater = newrolloutfloater "Stone Creator" 178 200
addrollout Menu01 MainFloater
addrollout Menu02 MainFloater
addrollout Menu03 MainFloater
Thought I’d share my script as it is so far:)
I want the sliders to only work in the rollouts they are in. And also make the sliders not work unless and object is selected. Anyone know how to do this?
And uuuuhm:P I kinda ripped of this guys rock design:P
http://www.scriptspot.com/3ds-max/scripts/rock-generator
try (closerolloutfloater MainFloater) catch()
----------CalledMenus(s)
----------CalledMenus(s)
Rollout Menu01 "Stones"
(
button makechipped "Chipped Stone" pos:[2,6] width:80 height:20
button makesmooth "Smooth Stone" pos:[82,6] width:80 height:20
slider detaillevels "Iterations" range:[0,5,4] pos:[2,30] width:170 height:10
--script
on detaillevels changed value do
(
$.modifiers[#TurboSmooth].iterations = value
)
on makechipped pressed do
(
Box lengthsegs:5 widthsegs:5 heightsegs:5 length:(random 8 12) width:(random 8 12) height:(random 8 12) isSelected:on
$.name = "Chipped Stone"
modPanel.addModToSelection (Spherify ()) ui:on
modPanel.addModToSelection (TurboSmooth ()) ui:on
$.modifiers[#TurboSmooth].iterations = 4
fn addDisplace obj =
(
local iTex = cellularTex size:6 spread:1.5
local iMod = Displace strength:10 map:iTex
addModifier obj iMod
iMod.maptype = 2
iMod.length = 50
iMod.width = 50
iMod.height = 50
--trying to change the colors on these in the celluar map
iTex.cellColor = color 0 0 0
iTex.divColor1 = color 159 159 159
iTex.divColor2 = color 112 112 112
iTex.coords.offset.x = (random 0 300)
)
addDisplace selection[1]
fn addDisplace obj =
(
local iTex = PerlinMarble size:5 levels:10
local iMod = Displace strength:-0.3 map:iTex
addModifier obj iMod
$.modifiers[#Displace].maptype = 2
$.modifiers[#Displace].length = 50
$.modifiers[#Displace].width = 50
$.modifiers[#Displace].height = 50
)
addDisplace selection[1]
modPanel.addModToSelection (Noisemodifier ()) ui:on
$.modifiers[#noise].seed = 0
$.modifiers[#noise].scale = 12
$.modifiers[#noise].fractal = on
$.modifiers[#noise].roughness = 0.1
$.modifiers[#noise].iterations = 10
$.modifiers[#noise].strength = [0.5,0.5,0.5]
modPanel.addModToSelection (Noisemodifier ()) ui:on
$.modifiers[#noise].seed = 0
$.modifiers[#noise].scale = 0.5
$.modifiers[#noise].fractal = on
$.modifiers[#noise].roughness = 0.1
$.modifiers[#noise].iterations = 10
$.modifiers[#noise].strength = [0.05,0.05,0.05]
)
on makesmooth pressed do
(
Box lengthsegs:5 widthsegs:5 heightsegs:5 length:(random 8 12) width:(random 8 12) height:(random 8 12) isSelected:on
$.name = "Smooth Stone"
modPanel.addModToSelection (Spherify ()) ui:on
modPanel.addModToSelection (TurboSmooth ()) ui:on
$.modifiers[#TurboSmooth].iterations = 4
fn addDisplace obj =
(
local iTex = cellularTex size:22 spread:1.8
local iMod = Displace strength:28 map:iTex
addModifier obj iMod
iMod.maptype = 2
iMod.length = 50
iMod.width = 50
iMod.height = 50
--trying to change the colors on these in the celluar map
iTex.cellColor = color 0 0 0
iTex.divColor1 = color 159 159 159
iTex.divColor2 = color 112 112 112
iTex.fractal = on
iTex.iterations = 2
iTex.coords.offset.x = (random 0 300)
)
addDisplace selection[1]
fn addDisplace obj =
(
local iTex = PerlinMarble size:5 levels:10
local iMod = Displace strength:-0.2 map:iTex
addModifier obj iMod
$.modifiers[#Displace].maptype = 2
$.modifiers[#Displace].length = 50
$.modifiers[#Displace].width = 50
$.modifiers[#Displace].height = 50
)
addDisplace selection[1]
modPanel.addModToSelection (Noisemodifier ()) ui:on
$.modifiers[#noise].seed = 0
$.modifiers[#noise].scale = 4
$.modifiers[#noise].fractal = on
$.modifiers[#noise].roughness = 0.1
$.modifiers[#noise].iterations = 10
$.modifiers[#noise].strength = [0.5,0.5,0.5]
modPanel.addModToSelection (Noisemodifier ()) ui:on
$.modifiers[#noise].seed = 0
$.modifiers[#noise].scale = 0.1
$.modifiers[#noise].fractal = on
$.modifiers[#noise].roughness = 0.1
$.modifiers[#noise].iterations = 10
$.modifiers[#noise].strength = [0.05,0.05,0.05]
)
)
Rollout Menu02 "bricks"
(
button makecoarse "Coarse Brick" pos:[2,6] width:80 height:20
button makefine "Fine Brick" pos:[82,6] width:80 height:20
slider detaillevels "Iterations" range:[0,2,2] pos:[2,30] width:170 height:10
--script
on detaillevels changed value do
(
$.modifiers[#TurboSmooth].iterations = value
)
on makecoarse pressed do
(
Box lengthsegs:10 widthsegs:10 heightsegs:10 length:30 width:60 height:30 isSelected:on
$.name = "Coarse Brick"
modPanel.addModToSelection (TurboSmooth ()) ui:on
$.modifiers[#TurboSmooth].iterations = 2
fn addDisplace obj =
(
local iTex = cellularTex size:82 spread:0.5
local iMod = Displace strength:3 map:iTex
addModifier obj iMod
iMod.maptype = 3
iMod.length = 50
iMod.width = 50
iMod.height = 50
iTex.fractal = on
iTex.iterations = 3
iTex.type = 1
iTex.coords.offset.x = (random 0 300)
)
addDisplace selection[1]
fn addDisplace obj =
(
local iTex = PerlinMarble size:81 levels:8
local iMod = Displace strength:-1.39 map:iTex
addModifier obj iMod
$.modifiers[#Displace].maptype = 3
$.modifiers[#Displace].length = 50
$.modifiers[#Displace].width = 50
$.modifiers[#Displace].height = 50
)
addDisplace selection[1]
modPanel.addModToSelection (Noisemodifier ()) ui:on
$.modifiers[#noise].seed = 0
$.modifiers[#noise].scale = 0.6
$.modifiers[#noise].fractal = on
$.modifiers[#noise].roughness = 0.4
$.modifiers[#noise].iterations = 10
$.modifiers[#noise].strength = [0.3,0.3,0.3]
)
on makefine pressed do
(
Box lengthsegs:10 widthsegs:10 heightsegs:10 length:30 width:60 height:30 isSelected:on
$.name = "Coarse Brick"
modPanel.addModToSelection (TurboSmooth ()) ui:on
$.modifiers[#TurboSmooth].iterations = 2
fn addDisplace obj =
(
local iTex = PerlinMarble size:81 levels:8
local iMod = Displace strength:-1.39 map:iTex
addModifier obj iMod
$.modifiers[#Displace].maptype = 3
$.modifiers[#Displace].length = 50
$.modifiers[#Displace].width = 50
$.modifiers[#Displace].height = 50
iTex.coords.offset.x = (random 0 300)
iTex.coords.offset.y = (random 0 300)
modPanel.addModToSelection (Noisemodifier ()) ui:on
$.modifiers[#noise].seed = 0
$.modifiers[#noise].scale = 5
$.modifiers[#noise].fractal = on
$.modifiers[#noise].roughness = 0.4
$.modifiers[#noise].iterations = 10
$.modifiers[#noise].strength = [0.2,0.2,0.2]
)
addDisplace selection[1]
)
)
Rollout Menu03 "Water Stones"
(
button makeround "Round Stone" pos:[2,6] width:80 height:20
button makeflat "Flat Stone" pos:[82,6] width:80 height:20
slider detaillevels "Iterations" range:[0,3,3] pos:[2,30] width:170 height:10
--script
on detaillevels changed value do
(
$.modifiers[#TurboSmooth].iterations = value
)
on makeround pressed do
(
Box lengthsegs:5 widthsegs:5 heightsegs:5 length:15 width:15 height:15 isSelected:on
$.name = "Round Stone"
modPanel.addModToSelection (Spherify ()) ui:on
modPanel.addModToSelection (TurboSmooth ()) ui:on
$.modifiers[#TurboSmooth].iterations = 2
modPanel.addModToSelection (Noisemodifier ()) ui:on
$.modifiers[#noise].seed = 0
$.modifiers[#noise].scale = 0.3
$.modifiers[#noise].fractal = on
$.modifiers[#noise].roughness = 0.3
$.modifiers[#noise].iterations = 10
$.modifiers[#noise].strength = [0.03,0.03,0.03]
modPanel.addModToSelection (Noisemodifier ()) ui:on
$.modifiers[#noise].seed = (random 0 300)
$.modifiers[#noise].scale = 10
$.modifiers[#noise].strength = [5,5,5]
)
on makeflat pressed do
(
Box lengthsegs:5 widthsegs:5 heightsegs:1 length:15 width:15 height:1 isSelected:on
$.name = "Flat Stone"
modPanel.addModToSelection (Spherify ()) ui:on
modPanel.addModToSelection (TurboSmooth ()) ui:on
$.modifiers[#TurboSmooth].iterations = 2
modPanel.addModToSelection (Noisemodifier ()) ui:on
$.modifiers[#noise].seed = 0
$.modifiers[#noise].scale = 0.3
$.modifiers[#noise].fractal = on
$.modifiers[#noise].roughness = 0.3
$.modifiers[#noise].iterations = 10
$.modifiers[#noise].strength = [0.03,0.03,0.03]
modPanel.addModToSelection (Noisemodifier ()) ui:on
$.modifiers[#noise].seed = (random 0 300)
$.modifiers[#noise].scale = 10
$.modifiers[#noise].strength = [5,5,2]
)
Rollout Menu04 "info"
(
label type01 "Master Stone Creator"
label type02 "Made by Steffen Morris"
label type03 "BIATCH!"
)
)
MainFloater = NewRolloutFloater "" 178 425
addRollout Menu01 MainFloater
addRollout Menu02 MainFloater
addRollout Menu03 MainFloater
addRollout Menu04 MainFloater