ZBrushCentral

IModGet Reference ?

Hey guys !

is there somewhere a table in which all numbers that could be returned by imodget for the subtools are displayed ?

It would avoid to play or guess to find the values we need :slight_smile:

thx guys !

No, I’m afraid you will have to work them out. (I’ve never worked them all out myself. :slight_smile: ) The simplest way is to use a Note to display the value.

I guess if I am courageous on day I’ll do it :slight_smile:

As part of my 2009 New Year’s Resolution I promised myself to properly document my zscripting discoveries. I have been quite good at respecting that particular point.

The other 28 points of my resolution? Well, let me just say: Here is to 2011 ! Hurray !


Subtool Modifiers:

ZBrush 3.5R3 has 5 modifiers for each subtool that determine a subtool’s state on the canvas, it’s influence on ReMesh operations and whether or not it is paintable/showing polypaint (in 3.5R3 just polypaint on one subtool at a time, sure to be multiple subtools and possibly texture based with ZBrush 4).

From left to right the Modifiers are: Add, Subtract, Intersection, Polypaint and Visibility.

Subtool Modifiers : ZScripting:

These modifiers are queried with IModGet. The selection state (is the Subtool currently selected) is queried with IGetFlags.

ZScripting: IModget with Subtools:

Subtools have 5 modifiers. Each has a specific bit value. The returned IModGet value can be AND compared to the following list in order to determine if a modifier is on or off.

From left to right on a subtools modifiers (ZBrush 3.5R3).

bit 1: Add - 1
bit 2: Subtract - 2
bit 3: Intersection - 4
bit 4: Polypaint - 8
bit 5: Visibility - 16

Hope that makes sense.

Thanks Mark :slight_smile:

One small thing to add (though this will be obvious to seasoned scripters!): values are added together when there are several modifiers in use. So, for example, if the subtool has Add selected, Polypaint on and Visibility on the Mod value will be 25. This needs to be taken into account when testing.

Thx a lot !

It’s gonna save some time for my next Zplugs.

I’m being an idiot. As Mark says, the modifiers can be Bitwise tested. See code below:


[VarDef,subToolPath,""]
[VarDef, message,""]

[IButton,"Test Mods","Test SubTool Modifiers",
	[VarSet,subToolPath,[IGetTitle,Tool:ItemInfo]]
	[VarSet,subToolPath,[StrMerge,"Tool:Sub Tool:",[StrExtract,subToolPath,0,[StrLength,subToolPath]-2]]]	
	[VarSet,mod,[IModGet,[Var,subToolPath]]]
	[If,((mod&1) == 1),[VarSet,message,"Add is on"]]
	[If,((mod&2) == 2),[VarSet,message,"Subtract is on"]]
	[If,((mod&4) == 4),[VarSet,message,"Intersection is on"]]
	[If,((mod&8) == 8),[VarSet,message,[StrMerge,message," and Polypaint is on"]]]
	[If,((mod&16) == 16),[VarSet,message,[StrMerge,message," and the SubTool is Visible"]]]
	[Note, message]
]

Note: [IModGet will only work if the selected subtool is visible in the list. In other words, if you select a subtool then scroll so that it disappears from view before testing the mods you will get a ‘does not have special modifiers’ error message.

Note: [IModGet will only work if the selected subtool is visible in the list. In other words, if you select a subtool then scroll so that it disappears from view before testing the mods you will get a ‘does not have special modifiers’ error message.
Thanks Marcus. Good to know. Could otherwise be a nasty bug to excavate through testing.

It’d be nice if we got a supported language in Zbrush instead of the homegrown one.

I hear Lua is nice, and easy to embed… :smiley: