Fix: Simplify import in VR add-on

In the Viewport VR Preview, an unusual and complicated import
manipulates sys.path to import a class from a file that is already
importable anyway.

There is no documented reason for this, and the common way to subclass an RNA type in python is by using its `bpy.types....` registered class, _not_ by directly subclassing the python type used to declare/register the parent type.

Pull Request: https://projects.blender.org/blender/blender/pulls/147656
This commit is contained in:
Damien Picard
2025-10-13 12:53:17 +02:00
committed by Bastien Montagne
parent 5460601da3
commit 0c22ef5ae7

View File

@@ -18,11 +18,7 @@ from bpy.types import (
Panel,
UIList,
)
# Add space_view3d.py to module search path for VIEW3D_PT_object_type_visibility import.
import os.path
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../startup/bl_ui')))
from space_view3d import VIEW3D_PT_object_type_visibility
from bpy.types import VIEW3D_PT_object_type_visibility
# Session.