Beispiel #1
0
def dist(args):
    pman.get_python_program()

    try:
        import direct.dist.commands #pylint:disable=unused-import,unused-variable
    except ImportError:
        print('Setuptools-based distribution is not supported by this version of Panda3D')
        return

    platforms = args.platforms
    if platforms is not None:
        platforms = list(platforms)
    pman.dist(build_installers=not args.skip_installers, platforms=platforms)
Beispiel #2
0
    def __init__(self):
        filedir = os.path.dirname(
            bpy.data.filepath) if bpy.data.filepath else os.getcwd()
        try:
            config = pman.get_config(filedir)
            user_config = pman.get_user_config(
                config['internal']['projectdir'])
        except pman.NoConfigError:
            config = None
            user_config = None

        self._tmpfnames = set()
        self.update_queue = queue.Queue()

        if user_config is not None and user_config['python']['in_venv']:
            pyprog = 'python'
        else:
            pyprog = pman.get_python_program(config)

        scriptloc = os.path.join(os.path.dirname(__file__), 'processor_app.py')

        with multiprocessing.connection.Listener() as listener:
            args = [
                pyprog,
                scriptloc,
                filedir,
                str(listener.address),
            ]
            self.proc = subprocess.Popen(args)
            if self.proc.poll() is None:
                self.connection = listener.accept()
        self._running = True
        self.timer = threading.Thread(target=self._timer_thread)
        self.timer.start()
Beispiel #3
0
def test(_, config):
    args = [
        pman.get_python_program(config),
        'setup.py',
        'test',
    ]
    sys.exit(subprocess.call(args, cwd=config['internal']['projectdir']))
Beispiel #4
0
def test(_):
    config = pman.get_config()
    args = [
        pman.get_python_program(),
        'setup.py',
        'test',
    ]
    subprocess.call(args, cwd=config['internal']['projectdir'])
Beispiel #5
0
    def __init__(self):
        try:
            config = pman.get_config(os.path.dirname(bpy.data.filepath) if bpy.data.filepath else None)
        except pman.NoConfigError as e:
            config = None
        pycmd = pman.get_python_program(config)
        path = os.path.join(os.path.dirname(__file__), 'processor_app.py')
        args = [pycmd, path, os.path.dirname(bpy.data.filepath)]

        super().__init__(
            processor=ExternalProcessor(args),
            use_bgr_texture=True
        )
Beispiel #6
0
    def __init__(self):
        if USE_EXTERNAL:
            try:
                config = pman.get_config(os.path.dirname(bpy.data.filepath) if bpy.data.filepath else None)
            except pman.NoConfigError as e:
                config = None
            pycmd = pman.get_python_program(config)
            path = os.path.join(os.path.dirname(__file__), 'processor_app.py')
            args = [pycmd, path, os.path.dirname(bpy.data.filepath)]

            super().__init__(processor=ExternalProcessor(args), use_bgr_texture=True)
        else:
            if PandaEngine._processor is None:
                PandaEngine._processor = processor.PandaProcessor()
            PandaEngine._processor.reset(os.path.dirname(bpy.data.filepath))

            self.processor = PandaEngine._processor
            super().__init__(processor=PandaEngine._processor)
Beispiel #7
0
    def __init__(self):
        if USE_EXTERNAL:
            try:
                config = pman.get_config(
                    os.path.dirname(bpy.data.filepath) if bpy.data.
                    filepath else None)
            except pman.NoConfigError as e:
                config = None
            pycmd = pman.get_python_program(config)
            path = os.path.join(os.path.dirname(__file__), 'processor_app.py')
            args = [pycmd, path, os.path.dirname(bpy.data.filepath)]

            super().__init__(processor=ExternalProcessor(args),
                             use_bgr_texture=True)
        else:
            if PandaEngine._processor is None:
                PandaEngine._processor = processor.PandaProcessor()
            PandaEngine._processor.reset(os.path.dirname(bpy.data.filepath))

            self.processor = PandaEngine._processor
            super().__init__(processor=PandaEngine._processor)
Beispiel #8
0
    def __init__(self):
        filedir = os.path.dirname(bpy.data.filepath) if bpy.data.filepath else os.getcwd()
        try:
            config = pman.get_config(filedir)
            user_config = pman.get_user_config(config['internal']['projectdir'])
        except pman.NoConfigError:
            config = None
            user_config = None


        self._tmpfnames = set()
        self.update_queue = queue.Queue()

        if user_config is not None and user_config['python']['in_venv']:
            pyprog = 'python'
        else:
            pyprog = pman.get_python_program(config)

        scriptloc = os.path.join(
            os.path.dirname(__file__),
            'processor_app.py'
        )

        with multiprocessing.connection.Listener() as listener:
            args = [
                pyprog,
                scriptloc,
                filedir,
                str(listener.address),
            ]
            self.proc = subprocess.Popen(args)
            if self.proc.poll() is None:
                self.connection = listener.accept()
        self._running = True
        self.timer = threading.Thread(target=self._timer_thread)
        self.timer.start()
Beispiel #9
0
    def execute(self, _context):
        filedir = os.path.dirname(
            bpy.data.filepath) if bpy.data.filepath else os.path.dirname(
                self.filepath)
        try:
            config = pman.get_config(filedir)
        except pman.NoConfigError as err:
            config = None
        if config:
            user_config = pman.get_user_config(
                config['internal']['projectdir'])
        else:
            user_config = None

        try:
            pycmd = pman.get_python_program(config)
        except pman.CouldNotFindPythonError as err:
            self.report({'ERROR'}, str(err))
            return {'CANCELLED'}

        use_legacy_mats = (config is None
                           or config['general']['material_mode'] == 'legacy')
        material_mode = 'legacy' if use_legacy_mats else 'pbr'

        # Check if we need to convert the file
        try:
            if self.skip_up_to_date and os.stat(
                    bpy.data.filepath).st_mtime <= os.stat(
                        self.filepath).st_mtime:
                print('"{}" is already up-to-date, skipping'.format(
                    self.filepath))
                return {'FINISHED'}
        except FileNotFoundError:
            # The file doesn't exist, so we cannot skip conversion
            pass

        # Create a temporary blend file to convert
        tmpfname = os.path.join(filedir, '__bp_temp__.blend')
        bpy.ops.wm.save_as_mainfile(filepath=tmpfname, copy=True)

        # Now convert the data to bam
        blend2bam_args = [
            '--blender-dir',
            os.path.dirname(bpy.app.binary_path),
            '--material-mode',
            material_mode,
        ]
        blend2bam_args += [tmpfname, self.filepath]

        retval = {'FINISHED'}
        try:
            if user_config is not None and user_config['python']['in_venv']:
                # Use blend2bam from venv
                pman.run_program(config, ['blend2bam'] + blend2bam_args)
            else:
                # Use bundled blend2bam
                scriptloc = os.path.join(os.path.dirname(__file__),
                                         'blend2bam_wrapper.py')
                args = [pycmd, scriptloc] + blend2bam_args
                if subprocess.call(args) != 0:
                    retval = {'CANCELLED'}
        finally:
            # Remove the temporary blend file
            os.remove(tmpfname)

        return retval
Beispiel #10
0
    def execute(self, _context):
        filedir = os.path.dirname(bpy.data.filepath) if bpy.data.filepath else os.path.dirname(self.filepath)
        try:
            config = pman.get_config(filedir)
        except pman.NoConfigError as err:
            config = None
        if config:
            user_config = pman.get_user_config(config['internal']['projectdir'])
        else:
            user_config = None

        try:
            pycmd = pman.get_python_program(config)
        except pman.CouldNotFindPythonError as err:
            self.report({'ERROR'}, str(err))
            return {'CANCELLED'}

        use_legacy_mats = (
            config is None or
            config['general']['material_mode'] == 'legacy'
        )
        material_mode = 'legacy' if use_legacy_mats else 'pbr'

        # Check if we need to convert the file
        try:
            if self.skip_up_to_date and os.stat(bpy.data.filepath).st_mtime <= os.stat(self.filepath).st_mtime:
                print('"{}" is already up-to-date, skipping'.format(self.filepath))
                return {'FINISHED'}
        except FileNotFoundError:
            # The file doesn't exist, so we cannot skip conversion
            pass

        # Create a temporary blend file to convert
        tmpfname = os.path.join(filedir, '__bp_temp__.blend')
        bpy.ops.wm.save_as_mainfile(filepath=tmpfname, copy=True)

        # Now convert the data to bam
        blend2bam_args = [
            '--blender-dir', os.path.dirname(bpy.app.binary_path),
            '--material-mode', material_mode,
        ]
        blend2bam_args += [
            tmpfname,
            self.filepath
        ]

        retval = {'FINISHED'}
        try:
            if user_config is not None and user_config['python']['in_venv']:
                # Use blend2bam from venv
                pman.run_program(config, ['blend2bam'] + blend2bam_args)
            else:
                # Use bundled blend2bam
                scriptloc = os.path.join(
                    os.path.dirname(__file__),
                    'blend2bam_wrapper.py'
                )
                args = [
                    pycmd,
                    scriptloc
                ] + blend2bam_args
                if subprocess.call(args) != 0:
                    retval = {'CANCELLED'}
        finally:
            # Remove the temporary blend file
            os.remove(tmpfname)

        return retval