示例#1
0
文件: mesh.py 项目: tscrypter/mixer
def encode_mesh(obj, do_encode_base_mesh, do_encode_baked_mesh):
    binary_buffer = bytes()

    if do_encode_base_mesh:
        logger.info("encode_base_mesh %s", obj.name_full)
        mesh_buffer = encode_base_mesh(obj)
        binary_buffer += common.encode_int(len(mesh_buffer))
        binary_buffer += mesh_buffer
    else:
        binary_buffer += common.encode_int(0)

    if do_encode_baked_mesh:
        logger.info("encode_baked_mesh %s", obj.name_full)
        mesh_buffer = encode_baked_mesh(obj)
        binary_buffer += common.encode_int(len(mesh_buffer))
        binary_buffer += mesh_buffer
    else:
        binary_buffer += common.encode_int(0)

    # Materials
    materials = []
    for material in obj.data.materials:
        materials.append(material.name_full if material is not None else "")
    binary_buffer += common.encode_string_array(materials)

    return binary_buffer
示例#2
0
def send_asset_bank_entries():
    if bpy.context.window_manager.uas_asset_bank is None:
        return

    bpy.ops.uas.asset_bank_refresh()
    assets = bpy.context.window_manager.uas_asset_bank.assets
    names = []
    tags = []
    thumbnails = []

    for asset in assets:
        names.append(asset.nice_name)
        tags.append(asset.tags)
        thumbnails.append(asset.thumbnail_path)

    buffer = (common.encode_int(AssetBankAction.LIST_RESPONSE) +
              common.encode_string_array(names) +
              common.encode_string_array(tags) +
              common.encode_string_array(thumbnails))

    share_data.client.add_command(
        common.Command(common.MessageType.ASSET_BANK, buffer, 0))
示例#3
0
文件: data.py 项目: OpenWRLD/mixer
def send_data_renames(renames: RenameChangeset):
    if not renames:
        return
    if not share_data.use_experimental_sync():
        return

    items = []
    for uuid, old_name, new_name, debug_info in renames:
        logger.info("send_rename: %s (%s) into %s", uuid, debug_info, new_name)
        items.extend([uuid, old_name, new_name])

    buffer = encode_string_array(items)
    command = Command(MessageType.BLENDER_DATA_RENAME, buffer, 0)
    share_data.client.add_command(command)
示例#4
0
 def encode(renames: List[str]) -> bytes:
     return encode_string_array(renames)