Exemple #1
0
    def make(cls, datablock: T.ID) -> DatablockProxy:
        proxy: DatablockProxy
        if datablock.library:
            from mixer.blender_data.library_proxies import DatablockLinkProxy

            proxy = DatablockLinkProxy()

        elif isinstance(datablock, T.Library):
            from mixer.blender_data.library_proxies import LibraryProxy

            proxy = LibraryProxy()
        elif isinstance(datablock, T.Object):
            from mixer.blender_data.object_proxy import ObjectProxy

            proxy = ObjectProxy()
        elif isinstance(datablock, T.Mesh):
            from mixer.blender_data.mesh_proxy import MeshProxy

            proxy = MeshProxy()

        elif isinstance(datablock, T.Key):
            from mixer.blender_data.shape_key_proxy import ShapeKeyProxy

            proxy = ShapeKeyProxy()
        else:
            proxy = DatablockProxy()

        type_name = sub_id_type(type(datablock)).bl_rna.identifier
        proxy._bpy_data_collection = rna_identifier_to_collection_name[
            type_name]
        proxy._datablock_uuid = datablock.mixer_uuid
        return proxy
Exemple #2
0
    def make(cls, attr_property):

        if isinstance(attr_property, T.Mesh):
            from mixer.blender_data.mesh_proxy import MeshProxy

            return MeshProxy()
        return DatablockProxy()
Exemple #3
0
def update_requires_clear_geometry(incoming_update: MeshProxy,
                                   existing_proxy: MeshProxy) -> bool:
    geometry_updates = _mesh_geometry_properties & set(
        incoming_update._data.keys())
    for k in geometry_updates:
        existing_length = existing_proxy._data[k].length
        incoming_soa = incoming_update.data(k)
        if incoming_soa:
            incoming_length = incoming_soa.length
            if existing_length != incoming_length:
                logger.debug("apply: length mismatch %s.%s ", existing_proxy,
                             k)
                return True
    return False
Exemple #4
0
def proxy_requires_clear_geometry(incoming_proxy: MeshProxy,
                                  mesh: T.Mesh) -> bool:
    for k in _mesh_geometry_properties:
        soa = getattr(mesh, k)
        existing_length = len(soa)
        incoming_soa = incoming_proxy.data(k)
        if incoming_soa:
            incoming_length = incoming_soa.length
            if existing_length != incoming_length:
                logger.debug(
                    "need_clear_geometry: %s.%s (current/incoming) (%s/%s)",
                    mesh,
                    k,
                    existing_length,
                    incoming_length,
                )
                return True
    return False