PDA

View Full Version : Help modifying a script to a plugin or CA


lucpet
04-05-2012, 05:42 AM
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://i1111.photobucket.com/albums/h465/lucpet1/TT.jpg

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

Any advice, help and mentorship appreciated

denisT
04-05-2012, 03:17 PM
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.

lucpet
04-06-2012, 01:37 AM
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.

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)

denisT
04-06-2012, 02:01 AM
i will try find a time to make a snippet to show what i mean.

lucpet
04-06-2012, 06:23 AM
i will try find a time to make a snippet to show what i mean.
Thanks, that would be great

denisT
04-06-2012, 04:26 PM
i will try find a time to make a snippet to show what i mean.

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\n"
ss += "pretranslate TM [0,height,radius]\n"
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 % %\n" node target
)
)
/* the Sample
with redraw off
(
delete objects
cam = TargetCamera name:"XTargetCamera" target:(Targetobject name:"XTargetCamera.Target") isselected:on
addmodifier cam (XTarget())
)
*/

lucpet
04-08-2012, 03:51 AM
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)

denisT
04-08-2012, 04:39 AM
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!

CGTalk Moderation
04-08-2012, 04:39 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.