def test_exact_class(self): filter_stack = FilterStack() filter_set = {T.Scene: [TypeFilterOut(T.SceneEEVEE)]} filter_stack.append(filter_set) synchronized_properties = SynchronizedProperties(filter_stack, property_order) props = synchronized_properties.properties(T.Mesh) self.assertFalse(any([matches_type(p, T.SceneEEVEE) for _, p in props]))
def test_exact_class(self): filter_stack = FilterStack() filter_set = {T.BlendData: [TypeFilterIn(T.CollectionProperty)]} filter_stack.append(filter_set) synchronized_properties = SynchronizedProperties(filter_stack, property_order) props = list(synchronized_properties.properties(T.BlendData)) self.assertTrue(any([matches_type(p, T.BlendDataCameras) for _, p in props])) self.assertFalse(any([matches_type(p, T.StringProperty) for _, p in props]))
def test_exact_class(self): filter_stack = FilterStack() filter_set = {T.Mesh: CollectionFilterOut(T.MeshVertices)} filter_stack.append(filter_set) synchronized_properties = SynchronizedProperties(filter_stack) props = synchronized_properties.properties(T.Mesh) self.assertFalse( any([matches_type(p, T.MeshVertices) for _, p in props])) self.assertTrue(any([matches_type(p, T.MeshLoops) for _, p in props]))
def test_unrelated_class(self): filter_stack = FilterStack() # Exclude on unrelated class : does nothing filter_set = {T.Collection: CollectionFilterOut(T.MeshVertices)} filter_stack.append(filter_set) synchronized_properties = SynchronizedProperties(filter_stack) props = synchronized_properties.properties(T.Mesh) self.assertTrue( any([matches_type(p, T.MeshVertices) for _, p in props])) self.assertTrue(any([matches_type(p, T.MeshLoops) for _, p in props]))
def test_base_class(self): filter_stack = FilterStack() # Exclude on ID, applies to derived classes filter_set = {T.ID: CollectionFilterOut(T.MeshVertices)} filter_stack.append(filter_set) synchronized_properties = SynchronizedProperties(filter_stack) props = synchronized_properties.properties(T.Mesh) self.assertFalse( any([matches_type(p, T.MeshVertices) for _, p in props])) self.assertTrue(any([matches_type(p, T.MeshLoops) for _, p in props]))
def test_root_class(self): filter_stack = FilterStack() # Exclude on all classes filter_set = {None: [CollectionFilterOut(T.MeshVertices)]} filter_stack.append(filter_set) synchronized_properties = SynchronizedProperties( filter_stack, property_order) props = synchronized_properties.properties(T.Mesh) self.assertFalse( any([matches_type(p, T.MeshVertices) for _, p in props])) self.assertTrue(any([matches_type(p, T.MeshLoops) for _, p in props]))
def test_blenddata_filtered(self): blend_data = self.proxy._data scene = blend_data["scenes"].search_one("Scene_0")._data self.assertTrue("eevee" in scene) filter_stack = copy.copy(test_filter) filter_stack.append({T.Scene: [TypeFilterOut(T.SceneEEVEE)]}) proxy = BpyDataProxy() proxy.load(SynchronizedProperties(filter_stack, property_order)) blend_data_ = proxy._data scene_ = blend_data_["scenes"].search_one("Scene_0")._data self.assertFalse("eevee" in scene_)