PDA

View Full Version : Fast vertexs selection


DDS
01-05-2005, 11:24 AM
Hi!!

I don't know if I'm the only one who's also in my situation. Let's see, I have a dual screen, and I usually work in the left monitor, and the right monitor is used for windows (mat. editor, graph editor, etc.), the extended command panel, and this stuff.

When selecting vertexs with complex poly meshes, usually there are some vertexs that aren't welded, or vertexs that are backfacing and sometimes I don't want to select them, and I'm always looking at the command panel (at the second screen) to see how many vertexs are selected, and it's quite annoying because it slows down my workflow in my opinion.

Ok, now my request: I have no much idea of maxscript, so I don't know how to do it. But, could somebody tell me how to make an script so when I have a number "n" of vertexs selected, it makes "n" computer beeps (5 max), or reproduces a premade wav file or something?

Any other ideas?

Thanks a lot! :D

ofer_z
01-05-2005, 12:33 PM
you can use this version of polygonCounter, just make sure to back up the original first... :)

-- MacroScript File

-- Created: Sept 21 1999
-- Modified: Dec 7 2000
-- Modified: Apr 25 2001 LAM
-- Author: Fred Ruff
-- Modified Larry Minton, June 02, 2002
-- clean up screen drit, changed "triangles" to "faces"
-- MacroScript for Turning On a Polygon counter in the viewpot on an object.

-- Modified Ofer Zelichover, Jan. 05 2005 - added selected elements.
--***********************************************************************************************
-- MODIFY THIS AT YOUR OWN RISK

macroScript Poly_Counter
category:"MAX Script Tools"
internalcategory:"MAX Script Tools"
buttontext:"Polygon Counter"
toolTip:"Polygon Counter"
(
local PolyCounterOn = false
local viewText, lastText
local viewText2 , lastText2
local lastViewport
local textPos
local updateRect
fn polytext =
(
try
(
viewText = ""
viewText2 = ""
if selection.count == 1 do
( if getCommandPanelTaskMode() == #modify and subobjectlevel == 1 then
viewText = "Vertices: " + (getPolygoncount $)[2] as string
else
viewText = "Faces: " + (getPolygoncount $)[1] as string

case getSelectionLevel $ of (
#vertex: viewText2 = "Sel. Vert.: " + ((getVertSelection $) as array).count as string
#edge: viewText2 = "Sel. Edges: " + ((getEdgeSelection $) as array).count as string
#face: viewText2 = "Sel. Faces: " + ((getFaceSelection $) as array).count as string
)
)
local needUpdate = viewText != lastText or viewText2 != lastText2

if viewport.activeViewport != lastViewport then
( completeredraw()
lastViewport = viewport.activeViewport
)
else if needUpdate do
( local rect = gw.getTextExtent lastText
if textView2 != "" then (
local r = gw.getTextExtent lastText2 + [0,5]
rect = [amax rect[1] r[1], rect[2] + r[2]]
)
updateRect.w = rect.x+1
updateRect.h = rect.y+1
gw.clearscreen updateRect useBkg:true
gw.enlargeUpdateRect updateRect
gw.updateScreen()
gw.resetUpdateRect()
)

if (viewText != "") do
(
gw.wtext textPos viewText color:(color 255 234 0)
rect = gw.getTextExtent viewText


if textView2 != "" then (
gw.wtext (textPos+[0,15,0]) viewText2 color:(color 255 234 0)
local r = gw.getTextExtent viewText2 + [0,5]
rect = [amax rect[1] r[1], rect[2] + r[2]]
)
updateRect.w = rect.x+1
updateRect.h = rect.y+1
gw.enlargeUpdateRect updateRect
gw.updateScreen()
)
lastText = viewText
lastText2 = viewText2
)
catch ()
)

on ischecked return PolyCounterOn

On execute do
( if PolyCounterOn then
unregisterRedrawViewsCallback polytext
else
( registerRedrawViewsCallback polytext
textPos = [5,40,0]
updateRect = box2 (textPos.x) (textPos.y-(gw.getTextExtent "X").y) 0 0
lastText = ""
lastText2 = ""
)
PolyCounterOn = not PolyCounterOn
completeredraw()
updateToolbarButtons()
)
)





hOpe this helps,
o

DDS
01-05-2005, 11:21 PM
oh, thanks for the great interest. But, how can I make this script to work? because when I replace the original with it, it doesn't change at all. Anyways, what does it make exactly?

Cheers,

DDS.

ofer_z
01-06-2005, 01:43 AM
you need to copy the code to a maxscript editor window and execute it, or save it to a file and run it. this will replace the original polygoncounter macroscript.
the original script shows in the viewport the amount of vertices/faces in an object. the modified version also shows the amount of selected sub objects.
the default keyborad shortcut for it is "7" but since is's a macroscript you can bind it to any keyboard shortcut/menu item/toolbar button using customize.

hOpe this helps,
o

DDS
01-14-2005, 10:24 AM
oh, I thought it was the polygon counter that is at the utility panel. Now I've pressed the 7 of the other one, and what do I find! It tells me how many vertexs I have selected. Man, u really helped me. Lots of thanks! sorry for not answering before.

:applause:

CGTalk Moderation
01-20-2006, 03:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.