Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  11 November 2013


Could someone explain me how works bitarrays ? I have a bitarray, and I need to turn off some of its item so I use only the "on" without changing their index.
I have heard I can perfectly do that with a bitarray but find no infos in the help or google :/

  11 November 2013
bit arrays as it says in the maxscript help is simply an array that contains values that are either true or false i.e. bits.

A good way to look at how they work is to make an object and set some of the transform lock flags on and off.

If you then run this:

tlf = gettransformlockflags $ --this returns a bit array
for i = 1 to tlf.count do
format ((i as string)+": "+(tlf[i] as string)+"\n")

It will show you that some of them are set to true (matching the ticks you set) or false (the ones without the tick).

So say you have a bit array of 20 items and you want the fifth and tenth to be 'off' you ensure index 5 and index 10 are set to false (as far as I'm aware anyway!)
Matt Rennie
Sr. Character Rigger
Rockstar North
  11 November 2013
fairly simple stuff the way max displays it makes it a touch confusing
for example

	ba = #{};	-- create empty bit array
	print ba;
	ba.count = 100 -- create storage for 100 bits
	print ba;
	ba[100] = true -- set 100th to true
	print ba
	ba = #{1..100}; -- create 100 bit array all set
	print ba
	ba[50] = false -- set 50th to false
	print ba
  11 November 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 11:56 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.