yes… i’ve checked that and tried to use… no luck.
so you are right with your guess. the edge extrude has to be own coded. i don’t see any alternative.
I know what you mean.
I really appreciate your methodology, but I’m tired now.
Ok i need to try harder. And i will.
some people ask this forum – how to do …?
well. show your ideas. show how you are trying to get it.
believe me… it’s much easier for me to post a code than explain how the code works. and it’s much better for an answerer to get the answer himself than simply copy it and paste.
I’m currently try to understand how vdata works, but the mxs help is little explained.
I try this
--channel 4: Cornering values for subdivision use
polyop.setVDataChannelSupport $ 4 true
polyop.getNumVDataChannels $
--4
polyop.getVDataValue $ 4 21 --vertindex 21
--0,0
After that i extrude vert 21 and run last line of code
Result is the same (0.0)
I was definitely off the track? I don’t get it, again
well, well, well… you are on the right track.
#1. pick your vdata channel. any… an average max scripter doesn’t know about this feature. so you can capture any.
#2. set unique vdata (the source vertex index for example) for being split vertices
#3. chamfer, extrude, do whatever you want you want… any vertex split from the source will get the source’s dvata. THAT’S REALLY COOL!
#4. now you can find any group of split vertices by their vdata. and weld them!
Your first suggestion is different then last one.
For me this is hardest part i ever try to solve.Really.
Yes this is cool.
If i understand correctly then i need to do this:
fn extrudeEdges obj extrudeWidth:1 extrudeHeight:2 =
(
if isValidNode obj and classof obj == Editable_Poly do
(
currNumFaces = polyOp.getNumFaces obj
currNumVerts = polyOp.getNumVerts obj
currSelEdges = obj.selectededges as bitarray
if currSelEdges.numberset != 0 do
(
if getCommandPanelTaskMode() != #create do setCommandPanelTaskMode mode:#create
vertslist = polyop.getVertsUsingEdge obj currSelEdges
getVDataChnl = polyop.getNumVDataChannels
getVDataVal = polyop.getVDataValue
setVDataVal = polyop.setVDataValue
-- weldVerts = polyop.weldVertsByThreshold
collapseVerts = polyop.collapseVerts
setVDataVal obj 4 #{1..(currNumVerts)} 0.0
cnt = 1.0 ; cntArr = #()
for vert in vertslist do
(
setVDataVal obj 4 #{vert} cnt
append cntArr cnt ; cnt +=1
)
format "cntArr=%
" cntArr
obj.edgeChamferSegments = 1
--obj.weldThreshold = 1e3
obj.extrusionType = 1
polyop.chamferEdges obj currSelEdges extrudeWidth
newNumFaces = polyOp.getnumfaces obj
newFaces = (obj.selectedfaces = #{(currNumFaces+1)..newNumFaces})
polyop.extrudeFaces obj newFaces extrudeHeight
vertslist = polyop.getVertsUsingFace obj (obj.selectedfaces as bitarray)
-- this part below throw "Runtime error"
cnt = 1
while cnt < cntArr.count+1 do
(
local vertsGroup = #{}
for vert in vertslist where getVDataChnl obj == 4 and getVDataVal obj 4 vert == cntArr[cnt] do append vertsGroup vert
collapseVerts obj vertsGroup
cnt += 1
)
)
)
)
extrudeEdges $
Now i need to do:
– select all top collapsed verts
– get edges using this verts, and shrink selection one time
– “setRingShift” and connect edges
i don’t see your function working right. but the idea is right. so i can show my version:
fn extrudeEdges obj edges: edgeExtrudeWidth: edgeExtrudeHeight: =
(
if edges == unsupplied do edges = obj.selectededges as bitarray
if not edges.isempty do
(
SPLIT_CH = 67
data = #(obj.edgeChamferSegments, obj.extrusionType, obj.weldThreshold)
obj.edgeChamferSegments = 1
obj.extrusionType = 1
obj.weldThreshold = edgeExtrudeWidth*4
polyop.setVDataChannelSupport obj SPLIT_CH on
obj.selectedverts = verts = polyop.getvertsusingedge obj edges
for v in verts do polyop.setVDataValue obj SPLIT_CH v v
faces = obj.faces as bitarray
polyop.chamferedges obj edges edgeExtrudeWidth
vlist = obj.verts as bitarray
polyop.extrudeFaces obj (obj.faces as bitarray - faces) edgeExtrudeHeight
for v in verts do
(
vv = #{}
for k in (obj.verts as bitarray - vlist) where (polyop.getVDataValue obj SPLIT_CH k) == v do append vv k
polyop.weldvertsbythreshold obj vv
)
obj.edgeChamferSegments = data[1]
obj.extrusionType = data[2]
obj.weldThreshold = data[3]
polyop.freeVData obj SPLIT_CH
obj.selectedverts as bitarray
)
)
i didn’t care about any optimization. and there is probably noting to optimize, because there are no heavy loops there.
Yep, is super advanced solution.
I look at your code and i have some questions:
- 67 is the some random number for VDataChannel?
2.Why is the “Weld” operation better to use then “Collapse”? - And how to select now top edge.Two bottom-side are already selected 🙁
“setRingShift” now is not solution. Hmmm?
#1 it’s random. but you can check what channel is not taken
#2 because weld makes one vert where collapse keeps all. so can easily do random move, tessellate or relax after that.
And third? I need to connect theses edges and then select all verts and do some random
movement.
Ok.
Thanks Denis.
Now I have enough material to create four (previously explained) deformation types.
Until then, if you guys have an idea or suggestion for this script,
please let me know.
Cheers!