Notifications
Clear all

[Closed] scriptmodifier vertconstaint

Hi all,

i’m trying to make a scripted modifier and basically trying to get the modifier that constains each vert to anther meshes verts. i want to know how you call the object with the modifier on it i thout it was “map” but i think thats wrong or it just doesent work. also would this script calulate per frame or just constantly update in a endless cycle when do modifiers calculate?. i have afew layout problems still so the script dosent work yet. here is what i have so far.

any info would be great if there are eny example outside of the help please let me know. i’ll update if i find out by reading more.

cheers

john


 plugin modifier glueMesh
 
 name:"glueMesh"
 
 classID:#(0xaf43ce, 0x326f0537)
 
 replaceUI:true version:1
 
 ( 
 
 	parameters main rollout:params
 	
 	(
 	
 		pickMesh type:#node animatable:false ui:pickMesh
 	
 		--on bendamt set val do delegate.angle = val
 	
 	)
 	
 	fn mesh_filter obj = superclassof obj == GeometryClass and classof obj != TargetObject
 	
 	rollout params "glueMesh Parameters"
 	(
 	
 		pickbutton pickMesh "Pick Mesh" pos:[28,20] width:100 height:30 filter:mesh_filter autodisplay:true
 		
 		on pickMesh picked obj do 
 		(
 			if obj != undefined do 
 			(
 				objectModifiersOn = map
 				theMesh = Obj
 				for v = 1 to theMesh.numverts by 1 do
 				(
 						thevert = polyop.getvert theMesh v
 						polyop.setvert objectModifiersOn theMesh v 
 				)
 			)
 		)
 	)
 
 )--endscript
3 Replies
1 Reply
(@martinb)
Joined: 11 months ago

Posts: 0

Have you considered just using the SkinWrap modifier?

the on map event is called whenever 3ds Max needs to know what you modifier wants to to with the underlying geometry. In your case, you would put the vertex move code in there.


on map myIndex myCoord do (
   -- do something with myCoord or use the sub-object with index myIndex
)

Also check out the MAXScript online help page titled ‘Scripted SimpleMod Plug-ins’

Hope this helps
– MartinB

Hi martin,

I am not really using it on a mesh but a Cgmuscle Object but i wanted to get it to work on a poly mesh first. the main reason for doing this is if i use skinwarp on a cgmuscle it evaluates it as a mesh. which causes problems in ACT cgmuscle Plugin later on.

so your suggesting that i only have one “On Map” statement.

here is what i have but it keeps asking for a While statment. i really cant get my head around this at this stage it seems simple but my syntax must be all up in the air.

--john Van Der Zalm 2007
--email: john@kaffeineproductions.com
--version 0.5
--last updated 13 sep 2007

--notes

--ChangeLog

plugin modifier glueCgmuscle

name:"glueCgmuscle"

classID:#(0xaf43ce, 0x326f0537)

replaceUI:true version:1

( 

	parameters main rollout:params
	
	(
	
		pickMesh type:#node animatable:false ui:pickMesh
	
		--on bendamt set val do delegate.angle = val
	
	)
	
	fn mesh_filter obj = superclassof obj == GeometryClass and classof obj != TargetObject
	
	rollout params "glueMuscle Parameters"
	(
	
		pickbutton pickMesh "Pick Mesh" pos:[28,20] width:100 height:30 filter:mesh_filter autodisplay:true
		
		on pickMesh picked obj do 
		(
			if obj != undefined do 
			(
				
				theMesh = Obj
				
				on map i p do
				(
					thevert = polyop.getvert theMesh i
					polyop.setvert map theMesh i 
					--actSetMusclePoint map 1 p(thevert)
				)
			)
		)
		
	)
)

cheers

john

I haven’t read your entire post, but you need to put the on map event into the plugin itself, not into the rollout.

Here’s some code from the MXS online help:


plugin simpleMod saddle
name:"SaddleDeform"
classID:#(685325,452281)
version:1
( 
  parameters main rollout:params
  (
    amount type:#integer ui:amtSpin default:20
  )
  rollout params "Saddle Parameters"
  (
    spinner amtSpin "Amount: " type:#integer range:[0,1000,20]
  )
  on map i p do
  (
    p.z += amount * sin((p.x * 22.5/extent.x) * (p.y * 22.5/extent.y))
    p
  )
)

As you see, the on map event is outside of the rollout. It is a special event for SimpleMod plugins.

– MartinB