Hi guys,
Now is time to optimize some operations for inner edges deformations.
My plan is as follows:
By selecting several inner edges i need to create 4 type of deformations:
1. Wrinkles… 2. Scars… 3. [color=RoyalBlue]Cracks[/color]… 4. Scratches
Sample scene: inner_edges_example.rar
This deformations requires function for extruding edges.
Since there is no function such as polyOp.extrudeEdges() i wrote this:
-- Select couple edges (in line) and run code
fn extrudeEdges obj extrudeWidth:1 extrudeHeight:-3 =
(
if isValidNode obj and classof obj == Editable_Poly do
(
currNumFaces = polyOp.getnumfaces obj
currSelEdges = obj.selectededges as bitarray
if currSelEdges.numberset != 0 do
(
if getCommandPanelTaskMode() != #create do setCommandPanelTaskMode mode:#create
obj.edgeChamferSegments = 2
polyop.chamferEdges obj currSelEdges extrudeWidth
newNumFaces = polyOp.getnumfaces obj
newFaces = (obj.selectedfaces = #{(currNumFaces+1)..newNumFaces})
innerVerts = polyOp.getVertsUsedOnlyByFaces obj newFaces
obj.selectedverts = innerVerts
obj.constrainType = 3
polyop.moveVert obj innerVerts [0,0,extrudeHeight]
obj.constrainType = 0
)
)
)
There may be a better solution to this?
your function is not correct. it might work only on plane. i give you some hints:
#0: using edge chamfer is the right direction
#2: use vdata to mark vertices
#1: use face extrude
#3: weld groups of split vertices
try to play your function for geo sphere for example… you will see what i mean.
You're absolutely right.
Geosphere are problematic one, ie triangular polygons.
This function follow [b]#0[/b] and [color=YellowGreen][b]#1[/b] [b]hints[/b][/color] that you suggested me, but [b]#2[/b] and [b]#3 hints
[/b]i don't know how to use[b].
[/b]
fn extrudeEdges obj extrudeWidth:1 extrudeHeight:2 =
(
if isValidNode obj and classof obj == Editable_Poly do
(
currNumFaces = polyOp.getnumfaces obj
currSelEdges = obj.selectededges as bitarray
if currSelEdges.numberset != 0 do
(
if getCommandPanelTaskMode() != #create do setCommandPanelTaskMode mode:#create
obj.edgeChamferSegments = 1
obj.extrusionType = 1
polyop.chamferEdges obj currSelEdges extrudeWidth
newNumFaces = polyOp.getnumfaces obj
newFaces = #{(currNumFaces+1)..newNumFaces}
polyop.extrudeFaces newFaces extrudeHeight
-- what's next?
)
)
)
you are a half way from the solution now.
try to get how the vdata works. the feature is when any vertex with some vdata splits, all split vertices inherit its original vdata. you can find them and… weld by threshold.
no… the problem is that you have to move the verts along their average (render) normals.
Thanks Denis,
i will try to find workaround.
Weld operation is not a problem.
But I do not know how the “WELD” will help in this situation (image below)
Now i’m totally confused!
Why only meshOp.extrudeEdges() exist? Why?
Now I am stuck in the labyrinth:banghead:
try to catch my point… i can show the solution, but how will it help you to grow? if you want i will post the function… but trust me, when you find a solution yourself you will be much better than … you now what i mean.
ask me questions. i will answer… if i can.
Problem solved. This is the final result.
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
getVertsUsingFace = polyop.getVertsUsingFace
-- 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
cnt = 1
while cnt < cntArr.count+1 do
(
vertslist = getVertsUsingFace obj (obj.selectedfaces as bitarray)
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 $
I’m happy now, as you said Denis