スクリプトで板ポリを作る機会がありましたので、その副産物としてトレイルを作ってみました。
あまり高機能ではありませんが、とりあえずっという時や、レンダーファームのインストールが面倒な時など、お使いください。
CreateTrail.ms
fn createTrail obj widthsize segmentcount axis startframe endframe =(
--createTrailObject
trailobj = editable_mesh name:(uniqueName "trailObject")
convertToPoly trailobj
pos = obj.position + obj.transform[axis] * widthSize
polyop.createVert trailobj pos
pos =obj.position
polyop.createVert trailobj pos
pos =obj.position + obj.transform[axis] * -widthSize
polyop.createVert trailobj pos
for i = 2 to segmentCount do (
pos = obj.position + obj.transform[axis] * widthSize
polyop.createVert trailobj pos
pos =obj.position
polyop.createVert trailobj pos
pos =obj.position + obj.transform[axis] * -widthSize
polyvertcount = polyop.createVert trailobj pos
polynum = polyvertcount - 6
polyop.createPolygon trailobj #(polynum + 1,polynum+ 4, polynum + 5,polynum + 2)
polyop.createPolygon trailobj #(polynum + 2,polynum + 5,polynum + 6,polynum + 3)
)
--animated trail
positionBuffer = #()
for currentFrame = startframe to endframe do (
animate on (
at time currentFrame (
posA = obj.position + obj.transform[axis] * widthSize
posB =obj.position
posC =obj.position + obj.transform[axis] * -widthSize
append positionBuffer #(posA,posB,posC)
for i =1 to segmentcount do (
vertnum = (i - 1 ) * 3
bufferID = positionBuffer.count - i + 1
if bufferID > 0 then (
polyop.setvert trailobj (vertnum + 1 ) positionBuffer[bufferID][1]
polyop.setvert trailobj (vertnum + 2 ) positionBuffer[bufferID][2]
polyop.setvert trailobj (vertnum + 3 ) positionBuffer[bufferID][3]
)
)
)
)
)
)
rollout createTrailSetRO "Settings"
(
spinner widthsp "Width" value:2.5
spinner segsp "Segment" type:#integer value:10
spinner startFsp "StartFrame" type:#integer value:1
spinner endFsp "EndFrame" type:#integer value:100
radiobuttons axisRadioBtn "Axis" labels:#("X","Y","Z") default:1
multiListBox mlb "MultiListBox"
button nodeAddBtn "ADD" across:2
button nodeRemovebtn "Remove"
button RuningBtn "Runinng"
label laba "Create Trail v1.00 2023.0425 Fudie"
on pickbtn picked obj do (
pickbtn.text = obj.name
)
on nodeAddBtn pressed do (
items = mlb.items as array
print mlb.items
for obj in selection do (
appendIfUnique items obj.name
)
mlb.items = items
)
on nodeRemovebtn pressed do (
sellist = mlb.selection as array
items = mlb.items
for i = 1 to sellist.count do (
deleteItem items sellist[ sellist.count + 1 - i ]
)
mlb.items = items
mlb.selection = #{}
)
on RuningBtn pressed do (
for objname = mlb.items do (
slidertime = startFsp.value
obj = getnodebyname objname
createTrail obj widthsp.value segsp.value axisRadioBtn.state startFsp.value endFsp.value
)
)
)
rof=newrolloutfloater "CreateTrail" 300 380
addrollout createTrailSetRO rof