BitArrays

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  11 November 2013
BitArrays

Hello,

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 :/

Thanks
 
  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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 03:50 AM.


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