Idea is to do xray for the active object only. But from what I can tell turning real xray on/off is an all or nothing thing. No single object xray for now, correct?
So to detour around that for the moment, I am trying to make some changes to object_select.c
-
When selecting a mesh in object mode, if a checkbox in overlay settings is true, AND if there is an object already selected, change its display type (aka Object.display_type, accessed in Object Properties->Viewport Display->Display As) to SOLID or TEXTURED, so it doesn’t stay in WIRE
-
Change the new object’s viewport display to WIRE
Here’s an example of what I’ve tried for the first half of that, setting current object to SOLID before setting the new object to WIRE, in
‘source-source->blender->editors->object->object_select.c’
void ED_object_base_select(Base *base, eObjectSelect_Mode mode, ViewLayer *view_layer)
{
if (mode == BA_INVERT) {
mode = (base->flag & BASE_SELECTED) != 0 ? BA_DESELECT : BA_SELECT;
}
if (base) {
switch (mode) {
case BA_SELECT:
if ((base->flag & BASE_SELECTABLE) != 0) {
view_layer->basact->object->data.display_type = OB_SOLID;
base->flag |= BASE_SELECTED;
}
break;
Seems pretty straightforward, but I can’t get it working. Whatever I try to tell it, I get something like
error C2039: 'display_type': is not a member of 'Object'
OR
error C2224: left of '.display_type' must have struct/union type
I’ve tried quite a few variations of
view_layer->basact->object->data.display_type = OB_SOLID;
and replaced ‘display_type’ with ‘shading.type’ like you see in ‘view3d_edit.c’
Maybe I got stuff going in the wrong place, as far as getting stuff doing exactly what I want. That’s fine, it’s usually a matter of time before figuring that part out.
The real issue is I have no idea what Members exist, and what they belong to. It’s pretty annoying to be this close to what I need to do, but have no way forward other than blind guessing what magic words I need to type.
https://wiki.blender.org/wiki/Source/Architecture/Context
There is no central place that lists all context members.
Great…
To find out which context members are available,
it is best to look at the relevant callback. I.e. if you're
working in the image window, look at the context callback
function defined in space_image.c.
Far as I can tell, none of the scripts in ‘source->blender->editors->object’ have the ‘default callbacks’ that you can find elsewhere.
In python, it's easy to look at what's in the context at runtime:
print(dir(context))
If I type that into a text and run it inside blender I just get this
File "\Text", line 1, in <module>
NameError: name 'context' is not defined
PLEASE HELP THANK YOU