Changeset View
Changeset View
Standalone View
Standalone View
space_view3d_math_vis/draw.py
| Context not available. | |||||
| callback_handle = [] | callback_handle = [] | ||||
| def tag_redraw_all_view3d(): | def tag_redraw_all_view3d_areas(): | ||||
| context = bpy.context | context = bpy.context | ||||
| # Py cant access notifers | # Py cant access notifers | ||||
| for window in context.window_manager.windows: | for window in context.window_manager.windows: | ||||
| for area in window.screen.areas: | for area in window.screen.areas: | ||||
| if area.type == 'VIEW_3D': | if area.type == 'VIEW_3D': | ||||
| for region in area.regions: | area.tag_redraw() | ||||
| if region.type == 'WINDOW': | |||||
| region.tag_redraw() | |||||
| def callback_enable(): | def callback_enable(): | ||||
| if callback_handle: | if callback_handle: | ||||
| Context not available. | |||||
| handle_view = SpaceView3D.draw_handler_add(draw_callback_view, (), 'WINDOW', 'POST_VIEW') | handle_view = SpaceView3D.draw_handler_add(draw_callback_view, (), 'WINDOW', 'POST_VIEW') | ||||
| callback_handle[:] = handle_pixel, handle_view | callback_handle[:] = handle_pixel, handle_view | ||||
| tag_redraw_all_view3d() | tag_redraw_all_view3d_areas() | ||||
| def callback_disable(): | def callback_disable(): | ||||
| Context not available. | |||||
| SpaceView3D.draw_handler_remove(handle_view, 'WINDOW') | SpaceView3D.draw_handler_remove(handle_view, 'WINDOW') | ||||
| callback_handle[:] = [] | callback_handle[:] = [] | ||||
| tag_redraw_all_view3d() | tag_redraw_all_view3d_areas() | ||||
| def draw_callback_px(): | def draw_callback_px(): | ||||
| Context not available. | |||||
| glEnd() | glEnd() | ||||
| # z | # z | ||||
| glColor3f(0.2, 0.2, 1.0) | glColor3f(0.4, 0.4, 1.0) | ||||
| glBegin(GL_LINES) | glBegin(GL_LINES) | ||||
| glVertex3f(*(zero_tx)) | glVertex3f(*(zero_tx)) | ||||
| glVertex3f(*(mat * z_p)) | glVertex3f(*(mat * z_p)) | ||||
| Context not available. | |||||