How to slide a vertex or edge in houdini?

   4058   6   0
User Avatar
Member
18 posts
Joined: Feb. 2019
Offline
Hello everyone how to slide a vertex or edge in houdini 18.5? i see, i'm modelling a character and i have this doubt. thanks so much for your answer and greetings from Machu Picchu - Peru
User Avatar
Member
4517 posts
Joined: Feb. 2012
Offline
Hi,

I wrote a Python SOP node that does this, back in the day before VEX had half edges:



Just add a string parameter for the Edge Group and a float parameter for the Amount locked to -1 to 1 value range.

node = hou.pwd ( )
geo = node.geometry ( )

def filterEdgeGroup ( edgeGroup ):
    group = []
    names = edgeGroup.split ( ' ' )
    for name in names:
        try:
            edges = geo.globEdges ( name )
        except hou.OperationFailed:
            edges = ( )
        
        for edge in edges:
            p0 = edge.points ( ) [ 0 ]
            p1 = edge.points ( ) [ 1 ]
            
            try:
                isValidEdge = geo.findEdge ( p0, p1 )
            except:
                isValidEdge = False
            
            if not isValidEdge:
                continue
            
            if len ( edge.prims ( ) ):
                group.append ( edge )
    
    return group


def getPolysFromEdges ( edges ):
    polys = []
    for edge in edges:
        polys += edge.prims ( )
    
    return polys


def getPointsFromEdges ( edges ):
    points = set ( )
    for edge in edges:
        points.add ( edge.points ( ) [ 0 ] )
        points.add ( edge.points ( ) [ 1 ] )
    
    return points


def getPointsFromPolys ( polys ):
    points = set ( )
    for poly in polys:
        verts = poly.vertices ( )
        for vert in verts:
            points.add ( vert.point ( ) )
    
    return points


def isValidEdge ( point1, point2 ):
    try:
        group = geo.globEdges ( "p{0}-{1} ".format ( point1, point2 ) )
    except hou.OperationFailed:
        return False
    
    for edge in group:
        p0 = edge.points ( ) [ 0 ]
        p1 = edge.points ( ) [ 1 ]
        
        try:
            return geo.findEdge ( p0, p1 ) != None
        except:
            return False


def getEdgePointsOfPoint ( point ):
    points = hou.hscriptExpression ( "pointneighbours(\"" + node.inputs ( ) [ 0 ].path ( ) + "\", " + str ( point ) + ", 1)" )
    points = points.split ( ' ' )
    points = map ( int, points )
    edgePoints = set ( )
    for pt in points:
        if isValidEdge ( point, pt ):
            edgePoints.add ( geo.iterPoints ( ) [ pt ] )
    
    return edgePoints



group = hou.evalParm ( "group" )
amount = hou.evalParm ( "amount" )
edges = filterEdgeGroup ( group )

if not edges:
    raise hou.NodeWarning ( "No valid edges were found in the group." )

polys = getPolysFromEdges ( edges )
points = getPointsFromEdges ( edges )
outerPoints = getPointsFromPolys ( polys )
outerPoints -= points

if not outerPoints:
    raise hou.NodeWarning ( "No valid edges were found in the group." )

first = outerPoints.pop ( )
source = { first }
innerPoints = { first }

while source:
    edgePoints = getEdgePointsOfPoint ( source.pop ( ).number ( ) )
    shared = edgePoints.intersection ( outerPoints )
    source = source.union ( shared )
    innerPoints = innerPoints.union ( shared )
    outerPoints = outerPoints.difference ( edgePoints )

goals = outerPoints
if ( amount < 0 ):
    goals = innerPoints

for point in points:
    edgePoints = getEdgePointsOfPoint ( point.number ( ) )
    target = edgePoints.intersection ( goals )
    if target:
        p0 = target.pop ( ).position ( )
        p1 = point.position ( )
        point.setPosition ( p1 + ( p0 - p1 ) * abs ( amount ) )
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
238 posts
Joined: March 2013
Offline
You can use the slide mode in H18.5+ and set it to match profile.

Attachments:
Capture.JPG (57.2 KB)

I'm not lying, I'm writing fiction with my mouth.
User Avatar
Member
88 posts
Joined: Feb. 2021
Offline
I can find no such node ?

What is it called ?
User Avatar
Member
340 posts
Joined: June 2017
Offline
When you select points or edges and then click the move tool, it will create an edit node. One of the options on parameters is "slide on surface".
Edited by Island - Dec. 31, 2021 17:41:58

Attachments:
slide.jpg (154.9 KB)

User Avatar
Member
88 posts
Joined: Feb. 2021
Offline
ah yes i looked over the settings in the vieuwport top bar.
User Avatar
Member
18 posts
Joined: Feb. 2019
Offline
Thanks so much all of you guys for your help! finally! works!
Edited by _udo_ - Jan. 16, 2022 11:58:02
  • Quick Links