blender-xatlas icon indicating copy to clipboard operation
blender-xatlas copied to clipboard

Escape Object names properly

Open mattedicksoncom opened this issue 5 years ago • 1 comments
trafficstars

Object names aren't being escaped properly. Work on a robust solution that takes any name thrown at it. Currently name_compat in ./export_obj_simple.py simply replaces spaces with under scores.

  • Cannot accept raw spaces
  • Fails on names like Test-Test 10x20x30mm [1234]

Quick dirty hack that works:

  • Replace line 38 return name.replace(' ', '_') in ./export_obj_simple.py
  • Replace with replaceName = name.replace(' ', '_s__') replaceName = replaceName.replace('.', '_d__') replaceName = replaceName.replace('[', '_b__') replaceName = replaceName.replace(']', '_c__') return replaceName
  • Then in ./__init__.py after obTest = importObject at line 88
  • place obTest.obName = obTest.obName.replace( '_s__', ' ') obTest.obName = obTest.obName.replace( '_d__', '.') obTest.obName = obTest.obName.replace( '_b__', '[') obTest.obName = obTest.obName.replace( '_c__', ']')
  • Refresh Scripts

mattedicksoncom avatar Oct 20 '20 11:10 mattedicksoncom

Had an epiphany, I don't know why I used UUID's for this. Some form of counter should work just as well, if not better. eg. xat_0, xat_1, xat_2

I need to investigate if there was a good reason I used them and write it down though.

mattedicksoncom avatar Jan 24 '21 12:01 mattedicksoncom