Exocortex / ExocortexCrate

http://exocortex.com/products/crate
BSD 3-Clause "New" or "Revised" License
134 stars 68 forks source link

Maya: Incorrect string parsing on nodes containing "xfo" #70

Open ndegruyter opened 6 years ago

ndegruyter commented 6 years ago

I'm encountering an issue with the removeXfoSuffix function within CommonImport. When processing nodes containing the string "xfo", it will strip the first occurrence of the string, as opposed to the suffix occurrence.

expected behaviour: example_asset:lt_xformfrozen_node1xfo > example_asset:lt_xformfrozen_node1 example_asset:lt_xformfrozen_node2xfo > example_asset:lt_xformfrozen_node2 example_asset:lt_xformfrozen_node3xfo > example_asset:lt_xformfrozen_node3

What I'm getting: example_asset:lt_xformfrozen_node1xfo > exampleasset:lt example_asset:lt_xformfrozen_node2xfo > exampleasset:lt example_asset:lt_xformfrozen_node3xfo > exampleasset:lt

which is resulting in the following error on import (as well as a full halt of the import operation): # Warning: Alembic: Warning: duplicate node name. Cannot add "standardbiped1:lt_" to map. #

My c++ is fairly rusty, but can anyone suggest a fix for this method so it replaces the final occurrence of "xfo" in a node name, as opposed to the first occurrence it encounters? It's fairly easy to move forward simply avoiding node names that contain the string "xfo", but it would be great to avoid placing gotcha usage restrictions on users like this.

ndegruyter commented 6 years ago

Looks like that function's just using a find call to find occurrences of "xfo" in a given string. Going to swap it out for rfind and see if that breaks anything.