LineMask-plugin as an alternative to Topological Masking?
I really like to use the Transform: Move, Scale, Rotate possibilities of ZB3 in my (re)modeling.
But the kind of meshes I use do not seem to be compatible with the new Topological
Masking that is introduced in ZB3, which makes using the Transform-mode very clumsy to use for me.
So I started thinking about an alternative for the Topological Masking, and I found a very intuitive one: just define the area that is to be masked by drawing one or two closed masklines (Control+ LMB) in the usual way in the Draw-mode:
“Sim Sala Bim!”, they say in my country when the magic trick succeeds!
However, I’m not a ZScripter, but from my general experience as a programmer I could make a pseudo-code
version of the algorithm, that should do this trick.
To understand this algorithm:
I presume that ZB defines the points of the 3d-space in some sort of (x,y,z)manner.
So that every actual point can be a point on the mesh or not:
(mesh(xAct,yAct,zAct)=true or mesh(xAct,yAct,zAct)=false).
Likewise I presume that every actual point can be a masked
meshpoint(xAct,yAct,zAct)
or not mask(xAct,yAct,zAct)=true or mask(xAct,yAct,zAct)=false)
At last I presume that there exists a Button:“LineMask” in the Tool>Masking pallet, which must be pressed before a LMB-click will start the Main Subroutine:
----------------------------------------------------------------------START PSEUDOCODE:
Sub Main
Dim xAct,yAct,zAct
'Comment: This subroutine recurses until all the nabouring meshpoints from
’ the point where LMB was clicked are masked.
’ If before the ButtonEvent:“LineMask” the user has drawn two closed
’ masklines then the masking will only occupy the area within the lines.
’ If before the ButtonEvent:“LineMask” the user has drawn one closed
’ maskline then the masking will only occupy the area on the site of this line
’ where the LMB was clicked.
’ If before the ButtonEvent:“LineMask” the user has drawn no closed
’ maskline then the masking will occupy the whole mesht.
'Comment: The user has defined a mesh-area that he wants to be masked, by 'drawing
’ one or two closed masklines (Control and Draw brushstroke) on the mesh.
’ Then he pushes theButton:“LineMask” and LMB_clicks between in the area
’ that he wants to be masked.
xAct=xLMB
yAct=yLMB
zAct=zLMB
Call SearchUnmasked(xAct,YAct,zAct)
EndSub
Sub SearchUnmasked(xAct,YAct,zAct)
Dim x,y,z
'Comment: Look for the meshstate(true or false)and the maskstate(true or 'false)
'of the nabouring points in the 3d-space;if mesh=true and maske=false then
'make mask for this point true and search it’s nabours.
For x=xAct-1 to xAct+1
For y=yAct-1 to yAct+1
For z=zAct-1 to zAct+1
If mesh(x,y,z)=true and mask(x,y,z)=false Then
mask(x,y,z)=true
Call SearchUnmasked(x,y,z)
EndIf
Next z
Next y
Next x
EndSub
END PSEUDOCODE
Now my question to the scripting-forum:
Would someone be inclined to make a translation of this pseudo-code into ZScript-code, perhaps in the form of a plugin.
I’m absolutely convinced that this algorithm will be not only of great use for me but also for many other ZBrush modelers.