Hi,
I did a bit of poking around and found where the relationship_lines property is added to the N panel. I altered it slightly so relationship_lines is always set to on (True).
So the properties looks to be at context.space_data.relationship_lines
You can assign directly to this ie:
context.space_data.relationship_lines = True
context.space_data.relationship_lines = False
And it looks as if you can test its state with if context.space_data.relationship_lines == True etc etc.
This will only work while you’re in the right context im guessing so, probably only works while drawing a menu which sets context to point to the right place.
I am really flaky when it comes to Blender Python so don’t take anything I say as being right
Example code follows yanked from code the ships with blender and 1 line altered :
def draw(self, context):
layout = self.layout
view = context.space_data
gs = context.scene.game_data
ob = context.object
col = layout.column()
col.prop(view, "display_render_override")
col = layout.column()
display_all = not view.display_render_override
col.active = display_all
col.prop(view, "outline_selected")
col.prop(view, "all_object_origins")
col.prop(view, "relationship_lines")
view.relationship_lines = True # MY ALTERATION HERE!!!!!!!
if ob and ob.type == 'MESH':
mesh = ob.data
col.prop(mesh, "all_edges")
col = layout.column()
col.active = display_all
split = col.split(percentage=0.55)
split.prop(view, "display_floor", text="Grid Floor")
row = split.row(align=True)
row.prop(view, "display_x_axis", text="X", toggle=True)
row.prop(view, "display_y_axis", text="Y", toggle=True)
row.prop(view, "display_z_axis", text="Z", toggle=True)
sub = col.column(align=True)
sub.active = (display_all and view.display_floor)
sub.prop(view, "grid_lines", text="Lines")
sub.prop(view, "grid_spacing", text="Spacing")
sub.prop(view, "grid_subdivisions", text="Subdivisions")
col = layout.column()
col.label(text="Shading:")
col.prop(gs, "material_mode", text="")
col.prop(view, "textured_solid")
layout.separator()
region = view.region_quadview
layout.operator("screen.region_quadview", text="Toggle Quad View")
if region:
col = layout.column()
col.prop(region, "lock_rotation")
row = col.row()
row.enabled = region.lock_rotation
row.prop(region, "box_preview")
row = col.row()
row.enabled = region.lock_rotation and region.box_preview
row.prop(region, "box_clip")