Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Maxunderground news unavailable

basic maxscript questions
show user profile  digs
please excuse these very simple questions to start, I promise to make them more complicated asap : )

I search for "Omni Light" in f1 because I want to create an omni light.
f1 gives me miAreaLightomni - superclass: light; super-superclass:node - 8:1 - classID: #(112233, 554433)

so I create the omni light with miAreaLightomni() because I know I can create a box with box()

it works, but now I want to turn the light off. f1 says a property of miAreaLightomni is
.Area_Enable BooleanClass default: true -- animatable; Boolean

so I try to turn the light off
omni = miAreaLightOmni()
omni.Area_Enable = false // or off

but nothing happens, other than the listener window outputting "false"

I enable the macro recorder, turn the light on/off, and I see
$.enabled = on/off as i toggle the checkbox for the light

but even if I select the light and enter $.enabled = off or $.enabled = on in the listener, the only thing that happens is a "false" or "true" output, nothing happens to the light in the scene

what's happening here?

read 752 times
9/14/2015 7:16:58 AM (last edit: 9/14/2015 7:29:35 AM)
show user profile  3joez
Help reports obscure messages about miAreaOmnilight.
I can't find what mi stands for. And more, after the class definition, it says: unsupported feature.
Not very clear.
It would be easier with a standard omni light.

myLight = Omnilight()
myLight.enabled = false

read 733 times
9/14/2015 9:18:45 AM (last edit: 9/14/2015 9:18:45 AM)
show user profile  Nik Clark
omni = miAreaLightOmni()
omni.Area_Enable = off
omni.Area_Enable = on

Works for me.

mi stands for Mental Images, who make mental Ray.

Click here to send me an emailClick here to visit my websiteClick here to visit my photo gallery on Flickr

read 728 times
9/14/2015 10:00:07 AM (last edit: 9/14/2015 10:16:01 AM)
show user profile  digs

omni = miAreaLightOmni() creates a light for me just fine

but omni.Area_Enable = off still doesn't turn of that light : /

It does work with just a regular omni light as 3joez suggested trying, and I remember seeing something about extending Mental Ray in the help files, so I'll have a look there next! Thanks
read 716 times
9/14/2015 12:29:33 PM (last edit: 9/14/2015 12:31:39 PM)
show user profile  Nik Clark
That is odd because I tested that it's actually affecting the light, and it certainly is for me.

Click here to send me an emailClick here to visit my websiteClick here to visit my photo gallery on Flickr

read 712 times
9/14/2015 12:45:12 PM (last edit: 9/14/2015 12:45:12 PM)
show user profile  digs

*edit* double facepalm - omni.Area_Enable works. It just doesn't turn the light off, its working in the Area Light Parameters

i tested with

omni.on = false

and it turned the light off. also

omni.multiplier = 20

changes the multiplier to 20, as would be expected.
But where is this information located in the help? I thought I was on the right track looking at the "Properties" of miAreaLightomni, but apparently that's not all the information about the light


in the macro recorder, when I adjust the multiplier for the omni light (i'm only using an omni light because I though to myself 'hey, create an omni light') - the recorder says the command to adjust the light is

$[#Omni_Light].multiplier = 1.1

but if I type this in, again, it doesn't work. I had to use omni.multiplier, which again, I found by guessing. I would prefer to actually know where this info is located!!
read 696 times
9/14/2015 3:35:30 PM (last edit: 9/14/2015 3:44:08 PM)
show user profile  Nik Clark
But where is this information located in the help?

This has always been a problem with Maxscript help files. Some of it is really well documented, some less so. As you have discovered, the listener output isn't always what you need to input. It can take quite a bit of work sometimes.

Click here to send me an emailClick here to visit my websiteClick here to visit my photo gallery on Flickr

read 693 times
9/14/2015 3:41:52 PM (last edit: 9/14/2015 3:41:52 PM)
show user profile  digs
welllll, balls.

thanks! :P
read 687 times
9/14/2015 3:49:16 PM (last edit: 9/14/2015 3:49:16 PM)
show user profile  digs
I'm trying to make a toggle-able macro that locks the transforms of a selected object if those transforms are unlocked, and unlock them if they r locked

so, setting the locks is simple

setTransformLockFlags selection #all -- works fine

but im trying to check if a value is true first, which is where i am having trouble. I can't figure out how to read if a bit is true or false

f1 has: getTransformLockFlags -- mapped

and the bits are from #{1-9}, so i can do something like

setTransformLockFlag selection #{4} to lock ROT-X for whatever i have selected, but I don't know how I can read from that bit

I want to do something like

if getTransformLockFlags selection #{4} == 1 then
setTransformLockFlags selection #none
setTransformLockFlags selection #all

but that throws me an error:
-- Argument count error: getTransformLockFlags wanted 1, got 2


i found getTransformLockFlags $ needs to be assigned to a variable - is this the only way to see the output?

i got the code working with

x = 0
for obj in selection do
x = 0
lockCheck = getTransformLockFlags obj
for int in 1 to 9 do
if lockCheck[int] == true then
x += 1
if x > 0 then
setTransformLockFlags $ #none
setTransformLockFlags $ #all

any optimization advice?
read 618 times
9/21/2015 4:17:20 PM (last edit: 9/21/2015 4:49:23 PM)
show user profile  Garp
setTransformLockFlags $ -(getTransformLockFlags $)

Drag that to a toolbar. Toggles all the transform locks in the selection.

read 604 times
9/21/2015 5:23:14 PM (last edit: 9/21/2015 5:35:07 PM)
show user profile  digs
haha, yes, much optimization!

messing around a bit -

print (getTransformLockFlags $) -- will output
#{1...9} -- if all fields are true

so I tried

if (getTransformLockFlags $) == #{1...9} then
print "all"

but all that outputs is "undefined"

shouldn't that logically output "all"?

*edit* I was also wondering what "mapped" means, ie
setTransformLockFlags (#all|#none| ) -- mapped ((in the f1))
read 588 times
9/21/2015 7:42:38 PM (last edit: 9/21/2015 7:44:03 PM)
show user profile  Garp
To test for equality, you would rather test that the difference is empty:
(ba1 - ba2).isEmpty
If you know in advanced the total number of bits, as is the case here, you can also use numberSet:
if (getTransformLockFlags obj).numberSet == 9 do print "all"

Given a collection instead of an object or value, a mapped function applies itself to each element in turn, saving you the bother of writing a loop.

read 583 times
9/21/2015 8:04:40 PM (last edit: 9/21/2015 8:09:32 PM)
#Maxforums IRC
Open chat window