Пример #1
0
    def execute(self, context):
        bpy.data.window_managers["WinMan"].mixer.send_base_meshes = False
        mixer_prefs = get_mixer_prefs()
        if not share_data.client.current_room:
            try:
                connect()
            except Exception as e:
                self.report({"ERROR"}, f"vrtist.launch connect error : {e}")
                return {"CANCELLED"}

            join_room(mixer_prefs.room, mixer_prefs.experimental)

        args = [
            mixer_prefs.VRtist,
            "--room",
            share_data.client.current_room,
            "--hostname",
            mixer_prefs.host,
            "--port",
            str(mixer_prefs.port),
            "--master",
            str(share_data.client.client_id),
        ]
        subprocess.Popen(args,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.STDOUT,
                         shell=False)
        return {"FINISHED"}
Пример #2
0
    def execute(self, context):
        prefs = get_mixer_prefs()
        try:
            self.report({"INFO"},
                        f'Connecting to "{prefs.host}:{prefs.port}" ...')
            try:
                connect()
            except Exception as e:
                self.report({"ERROR"}, f"mixer.connect error : {e}")
                return {"CANCELLED"}

            self.report({"INFO"},
                        f'Connected to "{prefs.host}:{prefs.port}" ...')
        except socket.gaierror as e:
            msg = f'Cannot connect to "{prefs.host}": invalid host name or address'
            self.report({"ERROR"}, msg)
            if prefs.env != "production":
                raise e
        except Exception as e:
            self.report({"ERROR"}, repr(e))
            if prefs.env != "production":
                raise e
            return {"CANCELLED"}

        return {"FINISHED"}
Пример #3
0
    def execute(self, context):
        bpy.data.window_managers["WinMan"].mixer.send_base_meshes = False
        mixer_prefs = get_mixer_prefs()
        if not share_data.client or not share_data.client.current_room:
            try:
                connect()
            except Exception as e:
                self.report({"ERROR"}, f"vrtist.launch connect error : {e!r}")
                return {"CANCELLED"}

            logger.warning("LaunchVRtistOperator.execute({mixer_prefs.room})")
            join_room(mixer_prefs.room, mixer_prefs.experimental)

        color = share_data.client.clients_attributes[
            share_data.client.client_id].get(ClientAttributes.USERCOLOR,
                                             (0.0, 0.0, 0.0))
        color = (int(c * 255) for c in color)
        color = "#" + "".join(f"{c:02x}" for c in color)
        name = "VR " + share_data.client.clients_attributes[
            share_data.client.client_id].get(ClientAttributes.USERNAME,
                                             "client")

        args = [
            mixer_prefs.VRtist,
            "--room",
            share_data.client.current_room,
            "--hostname",
            mixer_prefs.host,
            "--port",
            str(mixer_prefs.port),
            "--master",
            str(share_data.client.client_id),
            "--usercolor",
            color,
            "--username",
            name,
        ]
        subprocess.Popen(args,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.STDOUT,
                         shell=False)
        return {"FINISHED"}
Пример #4
0
    def execute(self, context):
        bpy.data.window_managers["WinMan"].mixer.send_base_meshes = False
        mixer_prefs = get_mixer_prefs()
        if not share_data.client.current_room:
            if not connect():
                return {"CANCELLED"}
            join_room(mixer_prefs.room)

        args = [
            mixer_prefs.VRtist,
            "--room",
            share_data.client.current_room,
            "--hostname",
            mixer_prefs.host,
            "--port",
            str(mixer_prefs.port),
        ]
        subprocess.Popen(args,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.STDOUT,
                         shell=False)
        return {"FINISHED"}
Пример #5
0
    def execute(self, context):
        bpy.data.window_managers["WinMan"].mixer.send_bake_meshes = True

        mixer_prefs = get_mixer_prefs()
        if not share_data.client or not share_data.client.current_room:
            timeout = 10
            try:
                connect()
            except Exception as e:
                self.report({"ERROR"}, f"vrtist.launch connect error : {e!r}")
                return {"CANCELLED"}

            # Wait for local server creation
            while timeout > 0 and not is_client_connected():
                time.sleep(0.5)
                timeout -= 0.5
            if timeout <= 0:
                self.report({"ERROR"},
                            "vrtist.launch connect error : unable to connect")
                return {"CANCELLED"}

            logger.warning("LaunchVRtistOperator.execute({mixer_prefs.room})")
            shared_folders = []
            for item in mixer_prefs.shared_folders:
                shared_folders.append(item.shared_folder)
            mixer_prefs.ignore_version_check = True
            join_room(mixer_prefs.room, True, shared_folders,
                      mixer_prefs.ignore_version_check)

            # Wait for room creation/join
            timeout = 10
            while timeout > 0 and share_data.client.current_room is None:
                time.sleep(0.5)
                timeout -= 0.5
            if timeout <= 0:
                self.report(
                    {"ERROR"},
                    "vrtist.launch connect error : unable to join room")
                return {"CANCELLED"}

            # Wait for client id
            timeout = 10
            while timeout > 0 and share_data.client.client_id is None:
                network_consumer_timer()
                time.sleep(0.1)
                timeout -= 0.1
            if timeout <= 0:
                self.report({
                    "ERROR"
                }, "vrtist.launch connect error : unable to retrieve client id"
                            )
                return {"CANCELLED"}

        color = share_data.client.clients_attributes[
            share_data.client.client_id].get(ClientAttributes.USERCOLOR,
                                             (0.0, 0.0, 0.0))
        color = (int(c * 255) for c in color)
        color = "#" + "".join(f"{c:02x}" for c in color)
        name = "VR " + share_data.client.clients_attributes[
            share_data.client.client_id].get(ClientAttributes.USERNAME,
                                             "client")

        args = [
            mixer_prefs.VRtist,
            "--room",
            share_data.client.current_room,
            "--hostname",
            mixer_prefs.host,
            "--port",
            str(mixer_prefs.port),
            "--master",
            str(share_data.client.client_id),
            "--usercolor",
            color,
            "--username",
            name,
            "--startScene",
            os.path.split(bpy.data.filepath)[1],
        ]
        LaunchVRtistOperator.vrtist_process = subprocess.Popen(
            args,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT,
            shell=False)
        return {"FINISHED"}