michael Posted November 8, 2016 Share Posted November 8, 2016 Since I keep forgetting how to do this.... Blend nodes have a weird parameter on them called Mask - it lets you specify what combination of Tx Ty Tz Rx Ry Rz Sx Ry Rz to take from each input. this is called a "Bit Mask" and here is how to figure then out: with a default blend object in your scene (blend1) and something wired into it...anything, a null open a python shell and type: >>> bmask = (then click on the Mask 1 parameter of blend1 and drag it here) you should have this: >>> bmask = hou.parm('/obj/blend1') hit enter now type >>> bmask.eval() hit enter >>> 511 what the hell? here's how to decrypt this number if you turn OFF all the TRS of blend1/Mask1 and type the above again you'l get: >>> 0 turn ON TX >>> 1 turn OFF TX and turn ON TY >>> 2 turn OFF TY and turn ON TZ >>> 4 and so on....each one is double the one before. so how did we get 511? we ADD each one to get a total > 1 (tx) + 2 (ty) + 4 (tz) + 8 (rx) + 16 (ry) + 32 (rz) + 64 (sx) + 128 (sy) + 256 (sz) = 511 so to manipulate this parameter with HOM we can set this parameter to the TOTAL that we want. if we want TX RY and SZ we'd use: ( 1 + 16 + 256 = 273 ) bmask.set(273) Quote Link to comment Share on other sites More sharing options...
f1480187 Posted November 9, 2016 Share Posted November 9, 2016 (edited) If you convert the nine boxes into binary sequence, it will be more intuitive: Binary Decimal Axes SSSRRRTTT zyxzyxzyx 000000000 0 None 000000001 1 Tx 000000010 2 Ty 000000100 4 Tz 000001000 8 Rx 000010000 16 Ry 000100000 32 Rz 001000000 64 Sx 010000000 128 Sy 100000000 256 Sz 111111111 511 All 100010001 273 TxRySz 000010111 23 TxTyTzRy Note the reversed order Houdini uses internally (Sz Sy Sx Rz Ry Rx Tz Ty Tx) for the mask. By using bitwise OR operator, you build up axes you need: # Using decimal numbers. bmask.set(273) bmask.set(1 | 16 | 256) # Using binary numbers. bmask.set(0b100010001) bmask.set(0b000000001 | 0b000010000 | 0b100000000) # Using named constants. TX = 0b000000001 RY = 0b000010000 SZ = 0b100000000 bmask.set(TX | RY | SZ) The last one is how it's usually being used. It's human-readable in code. You may also make use of AND and other bitwise operators: NO_SCALE = 0b000111111 bmask.set(bmask.eval() & NO_SCALE) Edited November 9, 2016 by f1480187 1 Quote Link to comment Share on other sites More sharing options...
michael Posted November 9, 2016 Author Share Posted November 9, 2016 thanks for this addition... but I have to say that binary is not what most people want to see Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.