From 3e9d54d5d6f5c7530862b32491f4723b34657537 Mon Sep 17 00:00:00 2001 From: Tamas Nepusz Date: Fri, 31 May 2024 15:39:52 +0200 Subject: [PATCH] fix: fixed "inside the mesh" containment test --- src/modules/sbstudio/plugin/model/light_effects.py | 4 ++-- typings/mathutils/bvhtree.pyi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/sbstudio/plugin/model/light_effects.py b/src/modules/sbstudio/plugin/model/light_effects.py index 7200158..7402dab 100644 --- a/src/modules/sbstudio/plugin/model/light_effects.py +++ b/src/modules/sbstudio/plugin/model/light_effects.py @@ -782,7 +782,7 @@ def _get_bvh_tree_from_mesh(self) -> Optional[BVHTree]: # from there ev_mesh = cast(Mesh, obj.data) ev_mesh.transform(mesh.matrix_world) - tree = BVHTree.FromObject(ev_mesh, depsgraph, deform=True) + tree = BVHTree.FromObject(obj, depsgraph, deform=True) ev_mesh.transform(mesh.matrix_world.inverted()) else: # Object is not in the evaluated depsgraph -- maybe it is @@ -791,7 +791,7 @@ def _get_bvh_tree_from_mesh(self) -> Optional[BVHTree]: b_mesh.from_mesh(mesh.data) b_mesh.transform(mesh.matrix_world) tree = BVHTree.FromBMesh(b_mesh) - return tree + return tree def _get_plane_from_mesh(self) -> Optional[Plane]: """Returns a plane that is an infinite expansion of the first face of the diff --git a/typings/mathutils/bvhtree.pyi b/typings/mathutils/bvhtree.pyi index 7fe73ba..5111b39 100644 --- a/typings/mathutils/bvhtree.pyi +++ b/typings/mathutils/bvhtree.pyi @@ -3,7 +3,7 @@ import sys from typing import Union from bmesh.types import BMesh -from bpy.types import Depsgraph, Mesh +from bpy.types import Depsgraph, Object from mathutils import Vector class BVHTree: @@ -12,7 +12,7 @@ class BVHTree: @classmethod def FromObject( cls, - object: Mesh, + object: Object, depsgraph: Depsgraph, deform: bool = True, render: bool = False,