WELL DONE !! It works perfect !
One minor bug is that it converts the whole scene instead of the selected object only. But this is easy to work around just loading a single object at a time to convert it.
Also, if you would accept a suggestion, to me the script interface seems over complicated. Just having two buttons “srgb to linear” and “linear to srgb” would do the job.
Anyway, now your script works perfect and it is usable for production !!
The attached image shows the difference between linear and srgb colors. Linear colors are much darker than srgb.
So if you import a srgb model in the scene (blend 2.4x,dae,fbx,obj,3ds etc), Blender reads it as linear and the colors appear much brighter than in the original model.
Now using your script the user can convert between srgb and linear so to fix the Blender behaviour when needed.
To import from srgb format (blend 2.4x,dae,fbx,obj,3ds etc)
- turn off CM by setting display device to none
- import the srgb model
- run the srgb_to_linear script
- turn on CM by setting display device to srgb
To export to srgb format (blend 2.4x,dae,fbx,obj,3ds etc)
- turn off CM
- run the linear_to_srgb script
- export the model
Beware, this applies to Blender 2.5x-2.73 (current version at this time). The Blender team said that they will add CM capabilities to i/o scripts in a future release (see https://developer.blender.org/T43025). So this issue may not apply to future versions of Blender.
Also, some external i/o scripts could already handle the srgb-linear conversion so you have to check out before exporting. Anyway, you have the script if you need it.