Notifications
Clear all

[Closed] How can i do this ? and this ?

i could just add a remove script or button, and i think i will :)… but still, the quad problem remains

fixed the quad problem… but i got a question…

what’s the difference between a mapped function and a normal one ? i looked in the help menu but i don’t get it

[left]From MXS Help… Creating Functions[/left]

[left]Using the mapped prefix on a function definition marks this function to be automatically mapped over collections. This means the function will be automatically called repeatedly on the elements of a collection if the collection is given as the first argument to the function. This allows you to define scripted functions that behave in a similar manner to the mapped built-in functions, such as copy, delete, move, and so on, which can be applied to an object set, path name pattern, or array. See Collections for more information.[/left]

[left]

[/left]
[left](
 mapped fn collectPosition obj &positions = append positions #(obj.name, obj.pos) 
 infos = #()
 nodes = for k=1 to 10 collect (box pos:(random [-10,-10,0] [10,10,0]))
 collectPosition nodes infos
 delete nodes
 format "%
" infos 
)
[/left]

[left]

[/left]

i posted a brief note on my blog about this too –

http://lonerobot.net/?p=179

denisT like i said i looked in help… but i did not get the point of mapped function… i asked for an explanation/example… you just copied the help…

LoneRobot thanks for the link… now i get the mapped thingy…

I gave you a sample.

[QUOTE=RappyBMX]denisT like i said i looked in help… but i did not get the point of mapped function… i asked for an explanation/example… you just copied the help…
QUOTE]

Here is another sample to show difference between mapped and not mapped functions:


mapped fn formatValue1 val = format "%
" val
fn formatValue2 val = format "%
" val

formatValue1 #(1,2,3) 
formatValue2 #(1,2,3) 


The Help does exactly tell what a Mapped Function is:
You can apply Mapped Functions to Object sets (eg ‘move $Box*’ would move every object with the name Box…), whereas standart functions have to be called for every object in a set seperately (eg ‘get TMController $Box*’ would not work. You’d have to say ‘for o in $Box* do getTMController o’).

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

mapped function works not only for nodes collection. it works for any collection (or array) of any type of elements:


mapped fn formatClassof1 val = format "%: %
" val (classof val)
fn formatClassof2 val = format "%: %
" val (classof val)
formatClassof1 #("test",float,3) 
formatClassof2 #("test",float,3)  

denisT that’s what i was looking for an example like that… thanks.
Piflik thanks for the explanation.

got something else… in 3ds max 2010… macroscript stupid error…


macroScript CSlide
category:"RappaTools"
buttonText:"CSlide"
--tooltip:"Connect, Slide. ctrl: Connect, Slide, Push."
(
	on isVisible do	(try( (RappaTools.open)and( RappaTools.theZone.subModeling.btn_connectslidepush.enabled) )Catch() )
	on isEnabled do (try( (RappaTools.open)and( RappaTools.theZone.subModeling.btn_connectslidepush.enabled) )Catch() )

	on execute do
	(
		try
		(
			if ( ( RappaTools.open ) and ( RappaTools.theZone.subModeling.btn_connectslidepush.enabled ) ) then
			(
				RappaTools.theZone.subModeling.btn_connectslidepush.pressed()
			)
		)
		Catch()
	)
)

for example the macroscript above (from rappatools) when i install rappatools the macroscript works… but after i close 3ds max 2010 then open it again the macro script won’t work… if i open the macroscript and evaluate it, the macroscript starts to work… but after i close then open max same thing it won’t work weird… why ? only in max 2010 !

Sound like a variable definition error, you should comment out the TRY CATCH to find exactly where the problem is, my guess is that the variable RappaTools or some of it’s properties are not defined.

Page 5 / 6