change edges color through code (in an addon)

Hi,

I am writing an addon and I would like to change the bpy.types.ThemeView3D.object_grouped and bpy.types.ThemeView3D.object_grouped_active colors. So that in the attached :eyebrowlift:image I would like to change the color of the edges when the object is selected/not selected.

I know the way to change this through the User Preferences, but I want to do it in the addon (code) itself. Does anyone have any idea?

I tried stuff like this
bpy.types.ThemeView3D.object_grouped_active = (0.3, 1, 0.9)

but this doesn’t work

Thanks!

Anyone? :smiley:

the data path is

bpy.context.user_preferences.themes[0].view_3d.object_grouped_active

Note that many context members are not writable at registration time, and changing properties with an addon automatically might not work in general (it does however if run by the user in the console / text editor)

Thank you so much! It works when I call it from the console, but it doesn’t work when I call it from the addon itself. Do you know any tricky way (know-how?) how to make it working from the code?

Thanks

I got it working!!! You just need to put it in the execute function!!! And now it works from the code.

Do you know how to change edge color of different groups?

So object_grouped changes colors of all the objects being in some group. I want the objects from a group “a” have red edges and objects from a group “b” to have purple edges. Is that possible?

It looks to me that you are temporarily changing the theme so it would relate to the things you can normally do with a theme.
ie: change the active object colour etc.
I am pretty sure that themes aren’t that finely defined.
You could dump the bpy.context.user_preferences.themes[0].view_3d collection to see what else is there tho.

bone groups can have different colors, but groups not afaik. There’s a discussion somewhere on http://developer.blender.org/ about multi colured groups