Notifications
Clear all

[Closed] Scripted object plugin

Hi all,

I’m trying to make a new scripted plugin to allow me to make a new type of node i can use as a bone. Currently I make these objects in max as a simple modified sphere with a few custom attributes via a attribute hodler.

however I want to turn this into a proper object which will also return a specific class it will return via classof.

I’ve looked at a few ways of doing this so far. The best appears to be starting like this:

plugin Geometry newBoneType
name:“newBoneType”
classID:#(0x50bb0ce0, 0x22d1c88f)
extends:boneGeometry –version:1
category:“myRigging”
autoPromoteDelegateProps:true
replaceUI:true
(
–blah blah
)

Now the issue I’m having, is i have my bits that get called when the user clicks which is fine. I essentially want to now replace the .mesh on my created bone with a new mesh which i can get from modifying a sphere.

Unfortunately setMesh doesnt seem to work.

I’ve tried setMesh myEditpolySphere myBoneGeo

but nothing happens.

Does anyone know how to replace the mesh on a bone object without converting to epoly and deleting old faces then attaching a new object (I dont want to do this as i then lose a load of my original attributes)?

4 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0
replaceinstances bone.mesh (createinstance box)
replaceinstances bone.mesh anygeometryobject.mesh

if you want it as a mesh object you have to use simpleObject plugin class
if you want to have it kinda a helper it’s better to use scripted manipulator

but you have to understand that it will make the bone not a “bone object” anymore.
you will lose stretching for example.

delete objects
(
	b0 = boneSys.createBone [0,0,0] [10,0,0] z_axis
	b1 = boneSys.createBone [10,0,0] [20,0,0] z_axis
	b1.parent = b0
	b2 = boneSys.createBone [20,0,0] [24,0,0] z_axis
	b2.parent = b1
		
	replaceinstances b0.mesh (createinstance ChamferCyl radius:2 height:10 fillet:5 fillet_segments:3) 
	b0.objectoffsetrot = eulerangles 0 90 0
	paramWire.connect b1.pos.controller[#X_Position] b0.baseObject[#Height] "X_Position" 
)