ScriptSpot

Forum topic · General Scripting

is it possible to unhide selected polys ?

By titane357 · 2013-03-06

Description

is it ?
something like "$.unHide #Face" ?
I don't want to do UnHideAll...
thanks

Comments (9)

titane357 · 2013-03-07

I find a solution for my tool...
easy for 2 materials id, but I don't know how to optimize for 20...

modPanel.setCurrentObject $.baseObject

fn Fmask AAA =
(
OBJ.selectByMaterial AAA
polyList = polyop.getFaceSelection OBJ
OBJ.Hide #Face
)

OBJ = $
OBJ.unHideAll #Face
rollout ROLL "MAT iD"
(
checkbutton b01 "01" pos:[1,11] width:40 height:20 unchecked:true
checkbutton b02 "02" pos:[41,11] width:40 height:20 unchecked:true

on b01 changed state do
if state == on then Fmask 1
else (
OBJ.unHideALL #Face

if ROLL.b02.state == on then
(
OBJ.selectByMaterial 2
polyList = polyop.getFaceSelection OBJ
OBJ.Hide #Face
)
)

on b02 changed state do
if state == on then Fmask 2
else (
OBJ.unHideALL #Face

if ROLL.b01.state == on then
(
OBJ.selectByMaterial 1
polyList = polyop.getFaceSelection OBJ
OBJ.Hide #Face
)
)
)
createdialog ROLL

barigazy · 2013-03-06

Hi Kostadin,
You always have the Joker in a sleeve :)
Cheers!

titane357 · 2013-03-07

thanks, I already have it but I want to make something different.
I have used Lightwave for a long time and I want to have something like its layer management (like smoothing groups panel in max)
here is an example with 5 matid, I want to make rows of 10 ids...

Attachments

solution

barigazy · 2013-03-06

This is a simple trick how to do it.


fn unhideFaces obj facesBitarray: = if isKindOf obj Editable_Poly do
(
	local hiddenFaces = polyop.getHiddenFaces obj
	if not hiddenFaces.isEmpty do
	(
		facesToHide = hiddenFaces-facesBitarray
		with redraw off 
		(
			polyop.unHideAllFaces obj
			polyop.setHiddenFaces obj facesToHide
		)
	)
)

Now how to use it
E X A M P L E:


delete objects 
theSphere = converttopoly (sphere segs:16)
polyop.setHiddenFaces theSphere #{49..64}
update theSphere

Then run this line

unhideFaces theSphere facesBitarray:#{53,54}--last argument must be bitarray face list

titane357 · 2013-03-07

Thanks barigazy,
but arrays are nightmare for me, so bitarrays....
can you explain what I'm doing wrong : I want to show material ID 10
--------------------------
obj = $
$.selectByMaterial 10
Faces2show = #{}
Faces2show = polyop.getFaceSelection $ as array <--- there is a problem here
(
local hiddenFaces = polyop.getHiddenFaces obj
if not hiddenFaces.isEmpty do
(
facesToHide = hiddenFaces-Faces2show
with redraw off
(
polyop.unHideAllFaces obj
polyop.setHiddenFaces obj facesToHide
)
)
)

barigazy · 2013-03-07

Are you try Kostadin script that suggested earlier

titane357 · 2013-03-07

yes, but as I said to him I wanted to do something different. :-)