Jump to content
Sign in to follow this  
pelos

vex function to read all the attributes of a point?

Recommended Posts

i am creating a point in between 2 points and i want to transfer all the attributes to this new point, 

is there a way to find all the attributes that are in a point?  like a list/array ["Cd", "P", "N"...]

 

thanks =)

Share this post


Link to post
Share on other sites
string pointattribs[] = detailintrinsic(0,"pointattributes");

this gives you a list of pointattribs that allready exist, the problem is to create the attributes on your new point. The problem is that you dont know the attribtype (float,string,vector). You can somehow use attribsize combined with pointattribtype to check what it is. It becomes alot of if statements if you want it to be rock solid. Personaly i have ignored some types to make it simpler.

void transferPoint(int input;int fromPoint ;int toPoint){ 
    string pointattribs[] = detailintrinsic(input,"pointattributes");
    foreach(string name;pointattribs){    
        int found = 0;
        int size = attribsize(input,"point",name);
        int type = pointattribtype(input,name);
        
        if(type == 0){
            int attrib = pointattrib(input,name,fromPoint,found);
            setpointattrib(0,name,toPoint,attrib,"set");
            }  
            
        if(type == 1 && size == 1){
            float attrib = pointattrib(input,name,fromPoint,found);
            setpointattrib(0,name,toPoint,attrib,"set");
            }    
        
        if(type == 2){
            string attrib = pointattrib(input,name,fromPoint,found);
            setpointattrib(0,name,toPoint,attrib,"set");
            }       
                
        if(type == 1 && size >= 2){
            if(size == 4){
                vector4 attrib = pointattrib(input,name,fromPoint,found);
                setpointattrib(0,name,toPoint,attrib,"set");
                }
            else{
                vector attrib = pointattrib(input,name,fromPoint,found);
                setpointattrib(0,name,toPoint,attrib,"set");
                }
            }            
        }
}

 

  • Thanks 1

Share this post


Link to post
Share on other sites

mmm  sometimes i think the vex datatypes are very limited, i was expecting to get a list of classes such

[

pointclass1,

pointclass2,

]

that later on with .notation i could get properties like the size, type, name etc..


(something i like a to work with python more than vex)

thanks for sharing the snippet, i appreciate it =)

Share this post


Link to post
Share on other sites
Posted (edited)

If you want to transfer just from 1 point you can provide that point as a reference for addpoint() function

To get interpolated attributes between 2 or more points you can also just use Attribute Interpolate SOP after your wrangle to do the job based on arrays of point numbers and weights that you provide

Edited by anim

Share this post


Link to post
Share on other sites
Posted (edited)

interesting how the groups as are also consider an attribute,    was expecting an especial function for getting all the groups that a points is in.

Edited by pelos

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×