Esempio n. 1
0
def register():
    from . import custom_props, custom_ui

    bpy.utils.register_class(V3D_OT_export_gltf)
    bpy.utils.register_class(V3D_OT_export_glb)

    custom_props.register()
    custom_ui.register()

    bpy.types.TOPBAR_MT_file_export.append(menuExportGLTF)
    bpy.types.TOPBAR_MT_file_export.append(menuExportGLB)

    if AppManagerConn.isAvailable(getRoot()):
        AppManagerConn.start(getRoot(), 'BLENDER', True)
    else:
        printLog('WARNING', 'Verge3D App Manager is not available!')
def register():

    bpy.types.TOPBAR_MT_help.append(v3d_menu_help)

    bpy.utils.register_class(V3D_PT_RenderSettings)
    bpy.utils.register_class(V3D_PT_RenderLayerSettings)
    bpy.utils.register_class(V3D_PT_WorldSettings)
    bpy.utils.register_class(V3D_PT_ObjectSettings)
    bpy.utils.register_class(V3D_PT_CameraSettings)
    bpy.utils.register_class(V3D_PT_LightSettings)
    bpy.utils.register_class(V3D_PT_MaterialSettings)
    bpy.utils.register_class(V3D_PT_CurveSettings)
    bpy.utils.register_class(V3D_PT_TextureSettings)
    bpy.utils.register_class(V3D_PT_MeshSettings)
    bpy.utils.register_class(V3D_PT_NodeSettings)

    bpy.utils.register_class(V3D_OT_OrbitCameraUpdateView)
    bpy.utils.register_class(V3D_OT_ReexportAll)

    bpy.utils.register_class(COLLECTION_UL_export)

    if AppManagerConn.isAvailable(getRoot()):
        bpy.utils.register_class(V3D_OT_AppManager)
        bpy.utils.register_class(V3D_OT_SneakPeek)
        bpy.types.VIEW3D_HT_header.append(v3d_sneak_peek)
        bpy.types.VIEW3D_HT_header.append(v3d_app_manager)
Esempio n. 3
0
def unregister():

    if AppManagerConn.isAvailable(getRoot()):
        bpy.types.VIEW3D_HT_header.remove(btnAppManager)
        bpy.types.VIEW3D_HT_header.remove(btnSneakPeek)
        bpy.utils.unregister_class(V3D_OT_sneak_peek)
        bpy.utils.unregister_class(V3D_OT_app_manager)

    bpy.utils.unregister_class(V3D_PT_NodeSettings)
    bpy.utils.unregister_class(V3D_PT_TextureSettings)
    bpy.utils.unregister_class(V3D_PT_MaterialSettings)
    bpy.utils.unregister_class(V3D_PT_LightSettings)
    bpy.utils.unregister_class(V3D_PT_CurveSettings)
    bpy.utils.unregister_class(V3D_PT_CameraSettings)
    bpy.utils.unregister_class(V3D_PT_ObjectSettings)
    bpy.utils.unregister_class(V3D_PT_WorldSettings)
    bpy.utils.unregister_class(V3D_PT_RenderLayerSettings)
    bpy.utils.unregister_class(V3D_PT_RenderSettings)
    bpy.utils.unregister_class(V3D_PT_MeshSettings)

    bpy.utils.unregister_class(V3D_OT_reexport_all)
    bpy.utils.unregister_class(V3D_OT_orbit_camera_target_from_cursor)
    bpy.utils.unregister_class(V3D_OT_orbit_camera_update_view)

    bpy.utils.unregister_class(COLLECTION_UL_export)
Esempio n. 4
0
def execBrowser(url):
    # always try to run server before starting browers
    # fixes several issues with closed Blender
    AppManagerConn.start(getRoot(), 'BLENDER', True)

    try:
        webbrowser.open(url)
    except BaseException:
        print("Failed to open URL: " + url)
Esempio n. 5
0
def register():
    from . import custom_props, custom_ui

    bpy.utils.register_class(V3D_OT_ExportGLTF)
    bpy.utils.register_class(V3D_OT_ExportGLB)

    custom_props.register()
    custom_ui.register()

    bpy.types.TOPBAR_MT_file_export.append(menu_func_export_v3d_gltf)
    bpy.types.TOPBAR_MT_file_export.append(menu_func_export_v3d_glb)

    AppManagerConn.start(getRoot(), 'BLENDER', True)
    def execute(self, context):
        prev_dir = join(getRoot(), "player", "preview")

        if os.path.exists(prev_dir):
            shutil.rmtree(prev_dir)
        os.mkdir(prev_dir)

        bpy.ops.v3d.export_gltf(filepath=join(prev_dir, 'sneak_peek.gltf'),
                                export_sneak_peek=True)

        execBrowser(getAppManagerHost() +
                    'player/player.html?load=preview/sneak_peek.gltf')

        return {"FINISHED"}
Esempio n. 7
0
    def execute(self, context):
        apps = join(getRoot(), 'applications')

        for root, dirs, files in os.walk(apps):
            for name in files:
                if fnmatch.fnmatch(name, '*.blend'):
                    blendpath = norm(join(root, name))

                    # use file utility to check .blend version
                    if sys.platform.startswith('linux'):
                        fileinfo = subprocess.check_output(
                            ['file', '--uncompress', blendpath]).decode()
                        ver = re.search('\d\.\d\d', fileinfo).group(0)
                        verMaj, verMin = [int(n) for n in ver.split('.')]

                        # ignore incompatible blender files

                        if verMaj != 2:
                            continue

                        if verMin < 80:
                            continue

                        IGNORE = []

                        ignore = False
                        for pattern in IGNORE:
                            if fnmatch.fnmatch(name, pattern):
                                ignore = True
                        if ignore:
                            continue

                    gltfpath = os.path.splitext(blendpath)[0] + '.gltf'

                    if os.path.exists(gltfpath):
                        self.__class__.exported.append((blendpath, gltfpath))
                        self.__class__.exported.sort()

        self.__class__.reexportNext()

        return {"FINISHED"}
def unregister():

    if AppManagerConn.isAvailable(getRoot()):
        bpy.types.VIEW3D_HT_header.remove(btnAppManager)
        bpy.types.VIEW3D_HT_header.remove(btnSneakPeek)
        bpy.utils.unregister_class(V3D_OT_sneak_peek)
        bpy.utils.unregister_class(V3D_OT_app_manager)

    bpy.utils.unregister_class(V3D_PT_NodeSettings)
    bpy.utils.unregister_class(V3D_PT_TextureSettings)
    bpy.utils.unregister_class(V3D_PT_ClippingPlaneSettings)
    bpy.utils.unregister_class(V3D_PT_MaterialSettings)
    bpy.utils.unregister_class(V3D_PT_LightSettings)
    bpy.utils.unregister_class(V3D_PT_CurveSettings)
    bpy.utils.unregister_class(V3D_PT_CameraSettings)
    bpy.utils.unregister_class(V3D_PT_ObjectSettings)
    bpy.utils.unregister_class(V3D_PT_WorldSettings)
    bpy.utils.unregister_class(V3D_PT_RenderLayerSettings)
    bpy.utils.unregister_class(V3D_PT_RenderSettings)
    bpy.utils.unregister_class(V3D_PT_MeshSettings)
    bpy.utils.unregister_class(V3D_PT_LightProbeSettings)

    bpy.utils.unregister_class(V3D_OT_reexport_all)
    bpy.utils.unregister_class(V3D_OT_orbit_camera_target_from_cursor)
    bpy.utils.unregister_class(V3D_OT_orbit_camera_update_view)

    bpy.utils.unregister_class(COLLECTION_UL_export)

    if pluginUtils.debug:
        bpy.types.TOPBAR_MT_render.remove(menuReexportAll)

    bpy.types.TOPBAR_MT_help.remove(menuUserManual)
    bpy.types.VIEW3D_MT_add.remove(menuVerge3dAdd)

    bpy.utils.unregister_class(V3D_OT_add_clipping_plane)
    bpy.utils.unregister_class(VIEW3D_MT_verge3d_add)