Notifications
Clear all

[Closed] FumeFX Add Lights

So I’ve just started using Maxscript and my curiosity got the best of me and I just plowed ahead in trying to use in with things I use daily.

One thing that I keep getting stuck on is ui controls. I opened up Fume’s documentation and looked at the Maxscript stuff. I’m trying to make a button that when you click it, adds all of the lights(or named lights – I’m new so any or all is good to learn) to the FumeFX list.

Right now this is my simple script:

rollout chooseFume “Select Fume Container”
(
fn chooseFume = classof obj == FumeFX
pickbutton chooseit “Select Fume Container”
button addFL “Add Lights to FumeFX”

        on chooseit picked obj do
            (
        if obj != undefined do
                (
            chooseit.text = obj.name
                )
            )
        
    on addFL pressed do
        (

            )

)
createDialog chooseFume

You’ll notice that the selection part is pretty much taken straight from the Max Reference. I know I”m missing parts, but only because this is where I’m stuck. Fume’s documentation to add light’s is as listed:

<boolean>AddLight <node>nodeAdds a light

Now what I’m confused on is all of this (I think “Adds a light” is a misstype) is what would the Boolean be? Wouldn’t that be the button press? And the node, would that be the Fume container, or the selected lights?

My thought process is that I need to somehow declare that the pickbutton’d grid is the current Fume container, and then with the function above, specify the lights to go to that container. I’m new, so I’m still hitting road bumps. I appreciate any help on this as I’m super exited to get under the hood of things. The past week has been a mind mess with learning proper scripting methods and definitions.

Thanks!

4 Replies
 <boolean>[b]AddLight[/b] <node>nodeAdds a  light

I’m pretty sure (without testing with fumefx) that its like this:
The bool is what the function returns, true if it adds the light, false if not.


  --Create a new light,assign it to variable
  mylight = Omnilight rgb:(color 255 255 255) shadowColor:(color 0 0 0) multiplier:1 contrast:0 softenDiffuseEdge:0 nearAttenStart:0 nearAttenEnd:40 farAttenStart:80 farAttenEnd:200 decayRadius:40 atmosOpacity:100 atmosColorAmt:100 shadowMultiplier:1 pos:[-0,-0,0] isSelected:off
  AddLight mylight
  --add it to fumefx
  

the ‘mylight’ can be a light from the scene, or a newly created one.

if you want to add the light you picked from your pickbutton then use:

on addFL pressed do
               (
  if (chooseit.object !=undefined) do
  (
 if (AddLight chooseit.object)then
 (
 messagebox "Added light"
 )else
 (
 messagebox "did not add light"
 )
                   )

Thanks for the reply! I tried adding this to the script but I kept getting errors. The pickbutton in my script is to select a FumeFX container not a light.

I’m not even sure if it’s correct to do that, but as I understand it. I’d want to specify which Fume container the lights would be added to.

I even tried swapping out my

fn chooseFume = classof obj == FumeFX

for a light, so that I can only select a light. But that still didn’t work. I may be crazy, or just too new, but it seems like the Fume documentation needs a bit more details.

For the code:

<boolean>AddLight <node>nodeAdds a light

It would be something like the following:

$.AddLight $Omni001

I hope that helps anyone else that comes across this too.

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

I don’t have installed FumeFX but I hope this shuld works fine.
You can select meny lights and press the button

try(destroyDialog ::chooseFume)catch()
 rollout chooseFume "Select Fume Container"
  (
  	local fumeContainer
  	fn chooseFume ffx = isKindOf ffx FumeFX
  	pickbutton chooseit "Select Fume Container" pos:[5,5] width:190 filter:chooseFume
  	button addFL "Add Lights to FumeFX" pos:[5,30] width:190
  
  	on chooseit picked obj do
  	(
  		fumeContainer = obj
  		chooseit.text = if obj == undefined then "Select Fume Container" else obj.name
  	)
  	on addFL pressed do if selection.count != 0 do
  	(
  		if isValidNode fumeContainer do
  		(
  			for lgh in selection where isKindOf lgh light do fumeContainer.AddLight lgh
  		)
  	)
  )
  createDialog chooseFume 200 55 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)