Notifications
Clear all

[Closed] Show edges command?

the listener won’t echo this command (when u hit F4). I want to make a simple script that will basically say:

if (
showEdges == on
then do this
else do this
)

anyone know the command im lookin for?

thanks

4 Replies

Originally posted by drunkirishmic
[B]the listener won’t echo this command (when u hit F4). I want to make a simple script that will basically say:

if (
showEdges == on
then do this
else do this
)

anyone know the command im lookin for?

thanks [/B]

I don’t think this is possible.
You can set the mode, but you cannot query its state.

If you absolutely need a hack, here is one, but it is slow, bad, ugly… I wouldn’t use it even if my life would depend on it!
(But it was sort of fun writing)

fn CheckEdgedFacesMode =
(
currentSel = selection as array
max select all
currentVisible = selection as array
hide selection
oldTM = viewport.getTM()
b = box wirecolor:(color 255 0 0)
b.material = standardmaterial useSelfillumColor:true
b.material.diffusecolor = b.material.selfillumcolor = (color 0 255 0)
select b
max tool zoomextents
max select none
redrawViews()
theBmp = gw.getViewportDIB()
thePixels = getPixels theBmp [0,theBmp.height/2] theBmp.width
EdgedFacesOn = false
ShadedOn = false
for p in thePixels do
(
if p == (color 255 0 0) do EdgedFacesOn = true
if p == (color 0 255 0) do ShadedOn = true
)
delete b
theBmp = undefined
gc light:true
unhide currentVisible
select currentSel
viewport.setTM oldTM
(EdgedFacesOn and ShadedOn)
)

Basically it hides everything in the scene, creates a green box with red wireframe, zooms at the box, snapshots the viewport bitmap and checks for red and green pixels in the central pixel line. If it finds a red pixel, ShadedFaces are on. If it finds a green pixel, shaded mode is on. Then it restores the original scene and viewport and returns the logical AND of the two findings.

True means Shaded Mode with Edged Faces is on, false means that either Wireframe mode or Shaded mode without Edges is on.

Of course, you could return an array of booleans to know what mode exactly you are, or a name value like:


viewport.setTM oldTM
if EdgedFacesOn and ShadedOn do return #edgedFaces
if EdgedFacesOn and not ShadedOn do return #wireFrame
if not EdgedFacesOn and ShadedOn do return #shadedMode
)

There might be an easier way somewhere, I just don’t know of one.

Cheers,

Bobo

damn, i thought you could just query the state. oh well. thanks for givin me that script, ur right it would be slow, probably kill my workflow.

thanks again bobo, always happy to get a response from the man.

bobo that is just ridiculous… i think you are running out of problems to solve! hehe, nice hack, really!

ben

Originally posted by suck
[B]bobo that is just ridiculous… i think you are running out of problems to solve! hehe, nice hack, really!

ben [/B]

I hope I am not!
My current job is about solving problems in a production environment (or as the president of the company put it once nicely, about “Fighting Evil”). The day I run out of problems to solve I will be without a job and money!
I hope this day is far away…

Cheers,

Bobo
Technical Director, Frantic Films