0
votes

I've been struggling with an issue for a couple of days now. I need a custom spline shape for a rig I'm doing, for a catarpillar track around 4 separately moving wheels (Wall-E)

I want the spline to be a quadrilateral, with the 4 seperate corners filleted by a certain amount (radius based on the wheels radius).

My issue is, that I can't seem to create a custom SplineShape (like I can with mesh geometry).

I'm stuck here:

plugin shape FilletQuad
name: "FilletQuad"
classID:#(0x32cdee2b, 0x56acdf01)
extends:SplineShape version:1
category:"Splines"
(   

parameters main rollout:ro_filletQuad
(
    x1 type:#float animatable:true default:-30 ui:sp_x1
    y1 type:#float animatable:true default:20 ui:sp_y1
    r1 type:#float animatable:true default:10 ui:sp_r1
)

rollout ro_filletQuad "Hardware Shaders"
(
    label lbl_point1 "Point 1:"
    spinner sp_x1 "x:"
    spinner sp_y1 "y:"
    spinner sp_r1 "radius:"
)

fn createShape =
(
    print "code for shape creation goes here.."
)

tool create
(
    local startPoint
    on mousePoint click do
        case click of
        (
            1: startPoint = nodeTM.translation = gridPoint
            2: (
                createShape()
                #stop
            )
        )
    on mouseMove click do
    (
        case click of
        (
            2: (
                print "Dragging - N/A for this primitive"
            )
        )
    )
)
)

I need a way to reference the base object and build the spline, and rebuild it when ever a parameter changes.

In geometry I use the "on buildMesh" event and then I build on the "mesh" variable. But I cannot seem to locate equal properties of shapes.

Any help??

2

2 Answers

1
votes

I believe that because you're extending an existing plugin (SplineShape), you need to access your plugin's ancestor with the keyword delegate and modify any of the inherited parameters.

If you look at the scripted Shape Plug-ins example, and read the documentation, it's pretty clear that when you extend plugins, you're essentially using this as a base and adding functionality at creation.

The only plugin that seems to allow the user define geometry creation from scratch is the simpleobject plugin.

Plugin creation through maxscript is relatively limited. You can possibly cheat by creating a mesh that remains consistent with the viewport view size (a bit like the point settings) to represent a spline.

Hope this helps.

1
votes

Provided that you are using max 2016 SP2 or higher, you can use simpleSpline. This scripted custom primitive class was added with MCG in mind and so no maxscript methods to manipulate the shape are exposed. Of course, you can always use the .NET methods instead. Look at Arrow, Pulley Belt or Guilloche scripted shapes to see the setup.