Jump to content
revelationsr

string array compare

Recommended Posts

I am very new to arrays but I am sure this will solve a problem I am having.

I am working on a project doing cloth siming. Animation in Maya and cloth in Houdini. The characters goes back to rigging from time to time due to issues that pop up. When those character return there so no change to the geo. How ever the primitive order will have changed. Meaning if a shirt that is primitive 25 has a setup to sim. When I get a new cache with a updated rig, primitive 25 might be the left shoe. Now changing this is not a problem. But with the more complicated characters we are looking at changing 30+ locations. Some do slip through the cracks causeing problems down the line.

I was thinking of a way to solve this problem. Maybe there is a better way to do this. Please let me know. But I was thinking maybe arrays could help.

The primitives I get from Maya all have thier object name attached to them. In the "path" attribute. I was thinking maybe if I could make a string array with all those names. Then compare that to a string array of the updated rig. I could assign a attribute to the updated rig geo refecting the order that the primitives should apear in. Then using the sort node to re-order the primitives before I seed them into simulation.

I just dont know how to do this. Any help would be awesome.

Share this post


Link to post
Share on other sites

How are you referencing or isolating your primitive number?

If you want to isolate the left shoe using the path, you can use

@path=="leftShoe"

in the group parameter of a blast node.

In an if statement you could do something like this:

if(s@path != "leftShoe"){
      removepoint(0, @ptnum);
}

If you really want to go the string array route maybe the strmatch() function will help?

Share this post


Link to post
Share on other sites

@Sean-R

Thank you for your responce.

The primitive order will come from the first rig. So @primnum. If I create a array string from that then the order in which the primitives apear in the array should mirror how they appear in the scene. I will save 1 frame of that character somewhere so I can refferance back to that. That saved refferance I can compare to the current version of the rig. I should be able to find the differance there. The question is how to create a attribute on the new rig to reflect the order of the original rig. Once I have that I should be able to use a sort node to reorder the new rig to match the old.

Cheers

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

×