Beispiel #1
0
def send_frame_changed(scene):
    logger.debug("send_frame_changed")

    if not share_data.client:
        logger.debug("send_frame_changed cancelled (no client instance)")
        return

    # We can arrive here because of scene deletion (bpy.ops.scene.delete({'scene': to_remove}) that happens during build_scene)
    # so we need to prevent processing self events
    if share_data.client.skip_next_depsgraph_update:
        share_data.client.skip_next_depsgraph_update = False
        logger.debug(
            "send_frame_changed canceled (skip_next_depsgraph_update = True)")
        return

    if not is_in_object_mode():
        logger.debug("send_frame_changed canceled (not is_in_object_mode)")
        return

    with StatsTimer(share_data, "send_frame_changed") as timer:
        with timer.child("setFrame"):
            if not share_data.client.block_signals:
                share_data.client.send_frame(scene.frame_current)

        with timer.child("clear_lists"):
            share_data.clear_changed_frame_related_lists()

        with timer.child("update_frame_changed_related_objects_state"):
            update_frame_changed_related_objects_state(
                share_data.old_objects, share_data.blender_objects)

        with timer.child("checkForChangeAndSendUpdates"):
            update_objects_transforms()

        # update for next change
        with timer.child("update_objects_info"):
            share_data.update_objects_info()

        # temporary code :
        # animated parameters are not sent, we need camera & light animated parameters for VRtist
        # (focal lens etc.)
        # please remove this when animation is managed
        with timer.child("send_animated_data"):
            send_animated_data()

        with timer.child("send_current_camera"):
            scene_camera_name = ""
            if bpy.context.scene.camera is not None:
                scene_camera_name = bpy.context.scene.camera.name_full

            if share_data.current_camera != scene_camera_name:
                share_data.current_camera = scene_camera_name
                share_data.client.send_current_camera(
                    share_data.current_camera)

        with timer.child("send_shot_manager_current_shot"):
            shot_manager.send_frame()
Beispiel #2
0
def send_frame_changed(scene):
    logger.debug("send_frame_changed")

    if not share_data.client:
        logger.debug("send_frame_changed cancelled (no client instance)")
        return

    # We can arrive here because of scene deletion (bpy.ops.scene.delete({'scene': to_remove}) that happens during build_scene)
    # so we need to prevent processing self events
    if share_data.client.skip_next_depsgraph_update:
        share_data.client.skip_next_depsgraph_update = False
        logger.debug(
            "send_frame_changed canceled (skip_next_depsgraph_update = True)")
        return

    if not is_in_object_mode():
        logger.debug("send_frame_changed canceled (not is_in_object_mode)")
        return

    if not share_data.client.block_signals:
        share_data.client.send_frame(scene.frame_current)

    share_data.clear_changed_frame_related_lists()

    update_frame_changed_related_objects_state(share_data.old_objects,
                                               share_data.blender_objects)

    update_objects_transforms()

    # update for next change
    share_data.update_objects_info()

    scene_camera_name = ""
    if bpy.context.scene.camera is not None:
        scene_camera_name = bpy.context.scene.camera.name_full

    if share_data.current_camera != scene_camera_name:
        share_data.current_camera = scene_camera_name
        share_data.client.send_current_camera(share_data.current_camera)

        shot_manager.send_frame()