Notifications
Clear all

[Closed] Why ArrowHelper extending Helper and not mesh?

I came acros this old thread and was wondering which advantage it has, that ArrowHelper extends dummy and not mesh. Could anybody explain it to me?

22 Replies

probably keeps it “classified” as a helper to the rest of max

So this is the only reason? No other advantages?

some advantages are ‘not convertable’, ‘not deformable’, ‘not renderable’
also helpers and meshes go in different selection and visibility categories

which fits better to such things as helpers-locators-bones-joints of a custom rig for example

By ‘not convertable’ you mean it can´t be coverted to mesh or poly? If yes, this the advantage I was looking for.
Could you please also explained what exactly you meaning by ‘not deformable’ and ‘not renderable’?

to max it’s a helper, so doesn’t appear in any renders and if it has a deforming modifier applied it remains unchanged.

But the mesh is still displaied and a material can be set for it, right?

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

You can try it yourself to make sure

… and ideally publish your code

Would like to try it, but still not completly understanding it. found an other similar example here, but why that local variables used?

so it doesn’t have to rebuild the mesh unless the size changes.

this how i do it fif i’m prototyping for the sdk…

plugin Helper arrow_helper
	name:"arrow_helper"
	classID:#(0x45c33d08, 0x16e70cb1)
	category:"Standard"
	extends:dummy
	replaceUI:true;
(
	local lastSize, msh = trimesh();
	
	parameters main rollout:params
	(
		size type:#float ui:ui_size default:10.0;
	)
	
	rollout params "Params"
	(
		spinner ui_size "Icon Size:" range:[0, 100000000.0, size] fieldwidth:64 type:#float align:#center;
	)

	tool create
	(
 		on mousePoint click do case click of
 		(
 			1: 
 			(
 				nodeTM.translation = gridPoint;
 				size = 0.01;
 			)
 			2: #stop
 		)
 		on mouseMove click do case click of
 		(
 			2:  size = amax (abs gridDist.x) (abs gridDist.y);
 		)
	)
		
	fn mxssetedgevisflags m face flags =
	(	
		setEdgeVis m face 1 flags[1];
		setEdgeVis m face 2 flags[2];
		setEdgeVis m face 3 flags[3];
	)

	fn BuildMesh =
	(
		setNumVerts msh 13
		setNumFaces msh 22
		setvert msh 1 ([0.5,0,0] * size)
		setvert msh 2 ([0,0.5,0] * size)
		setvert msh 3 ([-0.5,0,0] * size)
		setvert msh 4 ([0,-0.5,0] * size)
		setvert msh 5 ([0.5,0,6.99999] * size)
		setvert msh 6 ([0,0.5,6.99999] * size)
		setvert msh 7 ([-0.5,0,6.99999] * size)
		setvert msh 8 ([0,-0.5,6.99999] * size)
		setvert msh 9 ([1.5,0,7.00001] * size)
		setvert msh 10 ([0,1.5,7.00001] * size)
		setvert msh 11 ([-1.5,0,7.00001] * size)
		setvert msh 12 ([0,-1.5,7.00001] * size)
		setvert msh 13 ([0,0,10] * size)
		setface msh 1 [1,2,6]
		setface msh 2 [6,5,1]
		setface msh 3 [2,3,7]
		setface msh 4 [7,6,2]
		setface msh 5 [3,4,8]
		setface msh 6 [8,7,3]
		setface msh 7 [4,1,5]
		setface msh 8 [5,8,4]
		setface msh 9 [3,2,1]
		setface msh 10 [1,4,3]
		setface msh 11 [7,8,12]
		setface msh 12 [7,12,11]
		setface msh 13 [6,7,11]
		setface msh 14 [6,11,10]
		setface msh 15 [5,6,10]
		setface msh 16 [5,10,9]
		setface msh 17 [8,5,9]
		setface msh 18 [8,9,12]
		setface msh 19 [9,10,13]
		setface msh 20 [10,11,13]
		setface msh 21 [11,12,13]
		setface msh 22 [12,9,13]
		mxssetedgevisflags msh  1 #{1..2}
		mxssetedgevisflags msh  2 #{1..2}
		mxssetedgevisflags msh  3 #{1..2}
		mxssetedgevisflags msh  4 #{1..2}
		mxssetedgevisflags msh  5 #{1..2}
		mxssetedgevisflags msh  6 #{1..2}
		mxssetedgevisflags msh  7 #{1..2}
		mxssetedgevisflags msh  8 #{1..2}
		mxssetedgevisflags msh  9 #{1..2}
		mxssetedgevisflags msh  10 #{1..2}
		mxssetedgevisflags msh  11 #{1}
		mxssetedgevisflags msh  12 #{2}
		mxssetedgevisflags msh  13 #{1}
		mxssetedgevisflags msh  14 #{2}
		mxssetedgevisflags msh  15 #{1}
		mxssetedgevisflags msh  16 #{2}
		mxssetedgevisflags msh  17 #{1}
		mxssetedgevisflags msh  18 #{2}
		mxssetedgevisflags msh  19 #{1..3}
		mxssetedgevisflags msh  20 #{1..3}
		mxssetedgevisflags msh  21 #{1..3}
		mxssetedgevisflags msh  22 #{1..3}
		update msh
	)
	
	on getDisplayMesh do 
	(
		if size != lastSize  do 
		(
			buildmesh();
			lastSize = size;
		)
		msh;
	)
)

and I use this snippet to convert a mesh to mxs

fn mxsgetedgevisflags obj f = 
(
	flags = #{}
	for i = 1 to 3 do flags[i] = getEdgeVis obj f i; 	
	flags;
)	

fn MeshtoMXS obj = if classof obj == editable_mesh do
(	
	itm = inverse obj.transform;
	numverts = getNumVerts obj;
	numfaces = getNumFaces obj;
	
	format "setNumVerts msh %\n" numverts;
	format "setNumFaces msh %\n" numfaces;
	
	for v = 1 to numverts do format "setvert msh % (% * size)\n" v (getVert obj v * itm);
	for f = 1 to numfaces do format "setface msh % %\n" f (getFace obj f);
	for f = 1 to numfaces where not (ev = mxsgetedgevisflags obj f).isEmpty do format "mxssetedgevisflags msh  % %\n" f ev;
)

yep… and what is more important we have to use a local instance of the mesh to not create a new one if it’s not necessary, because it takes time and eats memory

Page 1 / 3