Announcement

Collapse
No announcement yet.

random uvxform offset for multiple objects

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • random uvxform offset for multiple objects

    Hi there,

    Im a big maxscript novice and so im having a few problems with getting a simple "randomize UVWXform" script to work.

    It seems to work. I have to make the uvwXform mods unique before pressing button 2, and the offsets all seem to randomize when looking at the mod, but visually it doesnt update. Not sure what is going on to be honest.

    You have to select your objects first and then button 1 applies a uvw_xform mod to each.

    Any ideas ?

    Here is the code so far(taken from another code but altered for uvwXform):

    Code:
    rollout t "Test"
    (
    	local mymod = (uvw_Xform())
     
    	button b "Create UVWMap"
    	button b2 "Random Offset"
     
    	on b pressed do
    	(
    	modPanel.addModToSelection (UVW_Xform ()) ui:on
    	)
     
    	on b2 pressed do 
    	(
    		for i = 1 to selection.count do
    				
    		
    		(
    			obj = selection[i].modifiers[#UVW_Xform]
    			obj.U_Offset = random 1 500
    			obj.V_Offset = random 1 500
    			
    		)
    	)
     
    )
    createdialog t
    Regards

    Steve

    My Portfolio

  • #2
    Dont worry. I worked it out. I need to add the decimal points to the random numbers otherwise they remained integer.

    Here is the code if anyone is interested.

    Code:
    rollout t "Test"
    (
    	local mymod = (UVWMap())
     
    	button b "Create UVWMap"
    	button b2 "Random Offset"
     
    	on b pressed do
    	(
    		modPanel.addModToSelection (UVW_Xform ()) ui:on
    	)
     
    	on b2 pressed do 
    	(
    		for i = 1 to selection.count do
    		(
    			selection[i].modifiers[#UVW_Xform].U_Offset = random 1.0 2.0
    			selection[i].modifiers[#UVW_Xform].V_Offset = random 1.0 2.0
    			selection[i].modifiers[#UVW_Xform].W_Offset = random 1.0 2.0
    
    		)
    	)
     
    )
    createdialog t
    Regards

    Steve

    My Portfolio

    Comment

    Working...
    X