Notifications
Clear all

[Closed] Help modifying a script to a plugin or CA

Hi, I’m looking into makeing my Easy Turntable script either a
scripted plugin or Custom attributes.
That way you should to be able to save it along with the max file
so you can re-open the file and be able to still use the settings.
(and possibly even build another one if needed?)

So I’m here to ask for any advice on which method would be best
to use. I’ve only played with the Scripted CA’s and the scripted plugins
in the help file so far, so I’ve got a learning curve ahead

If it is a plugin I could extend a point helper added to the scene
or use the circle which would be created and used in the setup
where the point helper would be creaed but not nesseraly used.
Does it matter? Is there a reason not to use an already created obj?

http://www.scriptspot.com/3ds-max/scripts/easy-turntable

Any advice, help and mentorship appreciated

7 Replies

I see this tool as modifier for Target Camera. The target is free and used as a point to rotate about. The camera has Scripted Transform Controller generated by the modifier’s settings. Attaching the modifier sets camera’s controller to the script controller; detaching(deleting) the modifier sets controller to PRS.

1 Reply
(@lucpet)
Joined: 11 months ago

Posts: 0

Thanks Denis, the camera target should have been obvious to me I guess but didn’t consider it.
I’ve been away from scripting this for a while due to some health issues and I blame my lack of thinking to medication (had a transplant some years ago and it plays up occasionally)

I’m trying to get my mind around your advice and wondering if you could elaborate on how your method would be implemented (eg dumb it down a bit and spell it out for me)

i will try find a time to make a snippet to show what i mean.

2 Replies
(@lucpet)
Joined: 11 months ago

Posts: 0

Thanks, that would be great

(@denist)
Joined: 11 months ago

Posts: 0

here is how i see it:


/* denisT collection 2012 */

plugin Modifier XTarget
name:"XTarget"
classID:#(0x00001967, 0x04062012)
extends:EmptyModifier
replaceUI:on
silentErrors:on
version:1
( 
	parameters mian rollout:main
	(
		radius type:#float animatable:on default:0 ui:ui_radius
		height type:#float animatable:on default:0 ui:ui_height
		yaw type:#float animatable:on default:0 ui:ui_yaw
		pinch type:#float animatable:on default:0 ui:ui_pinch
		roll type:#float animatable:on default:0 ui:ui_roll
		spin_speed type:#float animatable:on default:0 ui:ui_spin_speed
	)
	rollout main "Parameters"
	(
		group "Camera Translation: " 
		(
			spinner ui_radius "Radius: " type:#float fieldwidth:56 range:[-1e9,1e9,0] align:#right offset:[0,0]
			spinner ui_height "Height: " type:#float fieldwidth:56 range:[-1e9,1e9,0] align:#right offset:[0,-2]
		)
		group "Camera Rotation: "
		(
			spinner ui_yaw "Yaw: " type:#float fieldwidth:56 range:[-1e9,1e9,0] align:#right offset:[0,0]
			spinner ui_pinch "Pinch: " type:#float fieldwidth:56 range:[-1e9,1e9,0] align:#right offset:[0,-2]
			spinner ui_roll "Roll: " type:#float fieldwidth:56 range:[-1e9,1e9,0] align:#right offset:[0,-2]
		)
		group "Target Animation: "
		(
			spinner ui_spin_speed "Spin Speed: " type:#float fieldwidth:56 range:[-1e9,1e9,0] align:#right offset:[0,0] tooltip:"Angular Velocity (deg/sec)"
		)
	)
	on attachedtonode node do if iskindof node TargetCamera do
	(
		target = node.target
		c = node.controller = transform_script()
		c.addtarget "TM" target[#transform]
		c.addtarget "radius" this[#radius]
		c.addtarget "height" this[#height]
		c.addtarget "yaw" this[#yaw]
		c.addtarget "pinch" this[#pinch]
		c.addtarget "roll" this[#roll]

		ss = ""
		ss += "prerotateX TM 90
"
		ss += "pretranslate TM [0,height,radius]
"
		ss += "prerotate TM (rotateYPRMatrix yaw pinch roll).rotation"
		c.setexpression ss

		c = target.rotation.controller[3].controller = float_script()
		c.addtarget "speed" this[#spin_speed]

		ss = "S*(degtorad speed)"
		c.setexpression ss
		
--		format "attached % %
" node target
	)
)
/* the Sample
with redraw off
(
	delete objects 
	cam = TargetCamera name:"XTargetCamera" target:(Targetobject name:"XTargetCamera.Target") isselected:on
	addmodifier cam (XTarget())
)
 */

Wow thanks Denis, maybe you should just develop the Turntable plugin yourself
I’ll be playing with your script for a while seeing if I can add my own ideas (not that I’ve got much)

don’t worry. i have enough plugins to develop you are free to use this snippet as you like. good luck!