Hey folks.
Currently working on a project for uni, trying to create a more user friendly fire generator in 3DsMax.
Using Partical systems as the basis of the tool and just simplifying it.
RE 1st:
I'm not exactly sure how to acomplish this without doing some trial and error scripting which I don't have time for right now but I think I can help with you're 2nd question.
RE 2nd:
"max time play" to start the animation playback.
"stopAnimation()" to stop the playback.
You might also want to add an option to your fire generator to create a looping system since particles in max don't actually loop on their own. You do this by creating 4 identical sprayers set to go off at regular intervals and fade out as others are fading in. Here is a thread that talks about it as well as links to another script that automates the process a bit: http://www.polycount.com/forum/showthread.php?p=1197140#post1197140
Cheers guys, still having a little trouble with the callback but everything else is working just fine. Much appreciated.
I'm working on adding a texture to my particle. It's a pre-set that I've made which should be applied by a simple button press.
Error:
-- Error occurred in texture(); filename: F: \MaxScript\; position: 888; line: 32
-- Frame:
-- called in addTexture.pressed(); filename: F: \MaxScript\; position: 2716; line: 63
-- Frame:
>> MAXScript Rollout Handler Exception:
-- Unknown property: "color1" in undefined <<
I also need to find a way of applying textures to the viewport (2 on diagram)
1. You should probably use a more descriptive function name. Generic names like "texture" are easy to type, but when you look at your code some time from now, or share it with others, a more descriptive name will be appriciated. So instead of Texture() we'll use ApplyNoiseTexture().
2. The problem is that you are referencing the Noise map by name, but the name of the map has changed. When you apply a Noise texture through the interface, the name is #Diffuse_Color__Map__1____Noise. However, when you apply it through maxscript the name is #Diffuse_Color__Noise____Noise. Working with names is unreliable. Instead you should store the Noise texture in a variable on creation, then reference the variable's properties.
Great stuff monster, makes perfect sense and thanks for the tip. I still need to comment my script at some point.
Any ideas for showing material in viewport? maybe
Ok, finally got the callback working, so that you can only change the values if its selected, thanks havardsc and cheers mark for the timeline playback.
One final question would be, how to link my two colour pickers to the noise texture.
One way control is pretty easy. (Color Picker controls the Noise Map)
on cp1 changed val do
(
meditMaterials[1].diffuseMap.color1 = val
)
on cp2 changed val do
(
meditMaterials[1].diffuseMap.color2 = val
)
Two way control would be a little trickier since the ColorPicker control doesn't support animation controllers. Basically, you would create hidden spinners, have those modifier the color picker and vice versa. But also assign the controllers of the RGB channels of the Noise map color to the spinners.
For this script to work reset the scene, and apply a noise map to medit[1]'s diffuse channel.
rollout ColorLinkTest "Color Link"
(
colorPicker cp1 "" width:72 height:40
spinner spnR "" range:[0,1,0] visible:false
spinner spnG "" range:[0,1,0] visible:false
spinner spnB "" range:[0,1,0] visible:false
fn updateColor =
(
cp1.color = (color (spnR.value*255.0) (spnG.value*255.0) (spnB.value*255.0))
)
on ColorLinkTest open do
(
AnimController = Point3_XYZ()
meditMaterials[1].diffuseMap.color2.controller = AnimController
spnR.controller = meditMaterials[1].diffuseMap.color2.controller.x.controller
spnG.controller = meditMaterials[1].diffuseMap.color2.controller.y.controller
spnB.controller = meditMaterials[1].diffuseMap.color2.controller.z.controller
updateColor()
)
on cp1 changed val do
(
spnR.value = val.r/255.0
spnG.value = val.g/255.0
spnB.value = val.b/255.0
)
on spnR changed val do
(
updateColor()
)
on spnG changed val do
(
updateColor()
)
on spnB changed val do
(
updateColor()
)
)
createDialog ColorLinkTest
Replies
Here's what I'm stuck with:
1st:
I need it so that my spinners are disabled when the Partical System is not selected in the scene
(
particalSpeed.enabled = false
)
else
(
particalSpeed.enabled = true
)
2nd
I want to add a play timeline button to my rollout. But I cannot find the maxScript of the action.
??
I'm not exactly sure how to acomplish this without doing some trial and error scripting which I don't have time for right now but I think I can help with you're 2nd question.
RE 2nd:
"max time play" to start the animation playback.
"stopAnimation()" to stop the playback.
You might also want to add an option to your fire generator to create a looping system since particles in max don't actually loop on their own. You do this by creating 4 identical sprayers set to go off at regular intervals and fade out as others are fading in. Here is a thread that talks about it as well as links to another script that automates the process a bit:
http://www.polycount.com/forum/showthread.php?p=1197140#post1197140
More details here: http://docs.autodesk.com/3DSMAX/14/ENU/MAXScript%20Help%202012/files/GUID-7C91D285-5683-4606-9F7C-B8D3A7CA508-2062.htm
Instead of max time play you can use playanimation() which gives you some more optional arguments.
I'm working on adding a texture to my particle. It's a pre-set that I've made which should be applied by a simple button press.
Error:
-- Frame:
-- called in addTexture.pressed(); filename: F: \MaxScript\; position: 2716; line: 63
-- Frame:
>> MAXScript Rollout Handler Exception:
-- Unknown property: "color1" in undefined <<
I also need to find a way of applying textures to the viewport (2 on diagram)
2. The problem is that you are referencing the Noise map by name, but the name of the map has changed. When you apply a Noise texture through the interface, the name is #Diffuse_Color__Map__1____Noise. However, when you apply it through maxscript the name is #Diffuse_Color__Noise____Noise. Working with names is unreliable. Instead you should store the Noise texture in a variable on creation, then reference the variable's properties.
Any ideas for showing material in viewport? maybe
One final question would be, how to link my two colour pickers to the noise texture.
Two way control would be a little trickier since the ColorPicker control doesn't support animation controllers. Basically, you would create hidden spinners, have those modifier the color picker and vice versa. But also assign the controllers of the RGB channels of the Noise map color to the spinners.
For this script to work reset the scene, and apply a noise map to medit[1]'s diffuse channel.