Exemple #1
0
 def test_exact_class(self):
     filter_stack = FilterStack()
     filter_set = {T.Scene: TypeFilterOut(T.SceneEEVEE)}
     filter_stack.append(filter_set)
     context = Context(filter_stack)
     props = context.properties(T.Mesh)
     self.assertFalse(any([matches_type(p, T.SceneEEVEE)
                           for _, p in props]))
Exemple #2
0
 def test_exact_class(self):
     filter_stack = FilterStack()
     filter_set = {T.Mesh: CollectionFilterOut(T.MeshVertices)}
     filter_stack.append(filter_set)
     context = Context(filter_stack)
     props = context.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]))
Exemple #3
0
 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)
     context = Context(filter_stack)
     props = context.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]))
Exemple #4
0
 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)
     context = Context(filter_stack)
     props = context.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]))
Exemple #5
0
 def test_exact_class(self):
     filter_stack = FilterStack()
     filter_set = {T.BlendData: TypeFilterIn(T.CollectionProperty)}
     filter_stack.append(filter_set)
     context = Context(filter_stack)
     props = list(context.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]))
Exemple #6
0
    def diff(self, blend_proxy: BpyBlendProxy, context: Context):
        self.collection_deltas.clear()
        self.id_deltas.clear()

        for collection_name, _ in context.properties(bpy_type=T.BlendData):
            delta = BpyPropCollectionDiff()
            delta.diff(blend_proxy._data[collection_name], collection_name,
                       context)
            if not delta.empty():
                self.collection_deltas.append((collection_name, delta))
Exemple #7
0
    def test_blenddata_filtered(self):
        blend_data = self.proxy._data
        scene = blend_data["scenes"]._data["Scene_0"]._data
        self.assertTrue("eevee" in scene)

        filter_stack = copy.copy(test_filter)
        filter_stack.append({T.Scene: TypeFilterOut(T.SceneEEVEE)})
        proxy = BpyBlendProxy()
        proxy.load(Context(filter_stack))
        blend_data_ = proxy._data
        scene_ = blend_data_["scenes"]._data["Scene_0"]._data
        self.assertFalse("eevee" in scene_)
Exemple #8
0
    def diff(self, blend_proxy: BpyBlendProxy, context: Context):
        self.collection_deltas.clear()
        self.id_deltas.clear()

        for collection_name, _ in context.properties(bpy_type=T.BlendData):
            delta = BpyPropCollectionDiff()
            delta.diff(blend_proxy._data[collection_name], collection_name, context)
            if not delta.empty():
                self.collection_deltas.append((collection_name, delta))

        # Before this change:
        # Only datablocks handled by the generic synchronization system get a uuid, either from
        # BpyBlendProxy.initialize_ref_targets() during room creation, or later during diff processing.
        # Datablocks of unhandled types get no uuid and BpyIDRefProxy references to them are incorrect.
        # What is more, this means trouble for tests since datablocks of unhandled types are assigned
        # a uuid during the message grabbing, which means that they get different uuids on both ends.
        for collection_name in context.unhandled_bpy_data_collection_names:
            collection = getattr(bpy.data, collection_name)
            for datablock in collection.values():
                ensure_uuid(datablock)