PDA

View Full Version : customize buttons and maxscript.


Halford
05-26-2006, 02:41 PM
Hi everyone,

sorry for this basic question, but I'm trying to create few buttons in max as I have to do many extrude of 0,03cm and rotate them of 5° or -5°... by hand it's starting to be boring...and I know I can set buttons in a customized bar to do that..

Could someone point me to the right direction?

Thanks,

Hal.

j-man
05-26-2006, 05:37 PM
Hi,

making customise buttons is pretty straight forward!

read in the manuel under: "creating icon bitmap files"

This is a quick, comprehensive read. Also, look under you UI/icons directory to see existing examples.

Here is a sample of what you macroscript definition would look like with an ico:


macroScript maxwellunits category:"Maxwell" tooltip:"Convert system units to Maxwell units." icon:#("Helpers",3)


I hope that helps!

J.

Halford
05-27-2006, 08:05 AM
Thanks for the reply.



To do the button there is no problem, it's just that it doesn't do what I ask.

I open the listener and then extrude a face of poly (it does not appear in the listener) and the turn it 5 on Z. that appears. I take the line and drag it to the new bar. It makes the button.



but when I click it it does nothing.I would like to make it turn the selected face of 5.



here is the line I have in the listener:



rotate $.selectedFaces (quat 0 0 0.0436194 0.999048)



thaks for the help.



Hal.

fabman
05-28-2006, 03:24 AM
This has been asked already, you got a good thread in here (http://forums.cgsociety.org/showthread.php?t=187686&highlight=rotate+face), at the bottom of that thread you got a pretty neat function for doing what you want. Psan (http://forums.cgsociety.org/member.php?u=49462) wrote this nice function.


fn rotateface rx ry rz selected_faces =
(
for f=1 to selected_faces.count do --for every face
(
center_face = polyOp.getFaceCenter $ selected_faces[f] --the center of the first polygon
transform_mat = matrixFromNormal (polyOp.getFaceNormal $ selected_faces[f]) --create a matrix using the normal
transform_mat.row4 = center_face --move matrix to center of polygon
face_vertices = (polyOp.getVertsUsingFace $ selected_faces[f]) as array --get the verts of polygon 1
for v in face_vertices do --for every vertex in the first polygon,
(
in coordsys transform_mat vertex_position = (polyOp.getVert $ v) --get vertex in the matix coordinates
RotateXYZ = (rotateYPRMatrix rx ry rz) * transform_mat -- create a Rotation matrix, transform in the space of the Normal's matrix
polyOp.setVert $ v (vertex_position * RotateXYZ) --transform the vertex using the new matrix
)--for v
)--for f
)--fn rotateface



--main body
(
selfaces = (polyOp.getFaceSelection $) as array --the selected polygons
rotateface 0 0 30 selfaces
)

CGTalk Moderation
05-28-2006, 03:24 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.