예제 #1
0
파일: data.py 프로젝트: OpenWRLD/mixer
def build_data_rename(buffer):
    if not share_data.use_experimental_sync():
        return

    strings, _ = decode_string_array(buffer, 0)

    # (uuid1, old1, new1, uuid2, old2, new2, ...) to ((uuid1, old1, new1), (uuid2, old2, new2), ...)
    args = [iter(strings)] * 3
    # do not consume the iterator on the log loop !
    items = list(itertools.zip_longest(*args))

    for uuid, old_name, new_name in items:
        logger.info("build_data_rename: %s (%s) into %s", uuid, old_name,
                    new_name)

    rename_changeset = share_data.bpy_data_proxy.rename_datablocks(items)

    # TODO temporary until VRtist protocol uses Blenddata instead of blender_objects & co
    share_data.set_dirty()

    if rename_changeset:
        send_data_renames(rename_changeset)
예제 #2
0
파일: mesh.py 프로젝트: tscrypter/mixer
def decode_mesh(client, obj, data, index):
    assert obj.data

    # Clear materials before building faces because it erase material idx of faces
    obj.data.materials.clear()

    byte_size, index = common.decode_int(data, index)
    if byte_size == 0:
        # No base mesh, lets read the baked mesh
        index = decode_bakes_mesh(obj, data, index)
    else:
        index = decode_base_mesh(client, obj, data, index)
        # Skip the baked mesh (its size is encoded here)
        baked_mesh_byte_size, index = common.decode_int(data, index)
        index += baked_mesh_byte_size

    # Materials
    material_names, index = common.decode_string_array(data, index)
    for material_name in material_names:
        material = material_api.get_or_create_material(
            material_name) if material_name != "" else None
        obj.data.materials.append(material)

    return index
예제 #3
0
파일: messages.py 프로젝트: pypingyi/mixer
 def decode(self, buffer: bytes):
     self.renames, _ = decode_string_array(buffer, 0)