Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jeanloul/AMECO-2769-release-strategy #1

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/python-sdk-samples.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
TBD IF THIS FILE IS NEEDED AT ROOT

Unity Cloud Python SDK copyright © 2023 Unity Technologies SF

Licensed under the Unity Terms of Service ( see https://unity.com/legal/terms-of-service.).

Unless expressly provided otherwise, the Software under this license is made available strictly on an "AS IS" BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# unity-cloud-python-sdk-samples
Public slack channel: [#uc-cs-am-python-sdk](https://unity.slack.com/messages/C04R01SGG68/) <br/>
[View this project in Backstage](https://backstage.corp.unity3d.com/catalog/default/component/unity-cloud-python-sdk-samples) <br/>
# Converting to public repository
Any and all Unity software of any description (including components) (1) whose source is to be made available other than under a Unity source code license or (2) in respect of which a public announcement is to be made concerning its inner workings, may be licensed and released only upon the prior approval of Legal.
The process for that is to access, complete, and submit this [FORM](https://airtable.com/appj757BYrNIMuTBI/shriEdWiQuxWmJOku).
# Python SDK samples

This repository exposes a few samples that demonstrate the use of Python SDK in real life use-cases:

- [Asset Manager for Blender](./assets_manager_for_blender_addon/README.md)
- [Bulk Upload CLI](./bulk_upload_cli/README.md)
- [Bulk Download script](./bulk_download_script/README.md)

> **Note**: This repository does not accept pull requests, review requests, or any other GitHub-hosted issue management requests.

## Tell us what you think!

Thank you for taking a look at the project! To help us improve and provide greater value, please consider providing feedback in our [Help & Support page](https://cloud.unity.com/home/dashboard-support). Thank you!
76 changes: 76 additions & 0 deletions assets_manager_for_blender_addon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Changelog
All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.6.0] - 2024-07-18

### Added
- Ability to select a collection at publish time, to automatically link the asset to.

### Changed
- When selecting an organization, the first project in it is no longer selected by default. Thus preventing loading a project' assets when selecting an organization.
- Refactored the content of the Source folder to improve readability and clarity
- At publish time, asset is now automatically frozen.
- Thumbnail is published locally temporarily (as we disabled the transformation)

## [0.5.0] - 2024-05-23

### Added
- Add version selection whenever an asset is being updated.

### Changed
- Upgraded Python SDK dependency to 0.8.2.

## [0.4.0] - 2024-04-19

### Fixed
- Fix new assets creation failing due to the new assets versioning.

## [0.3.0] - 2024-03-14

### Added
- Added `embed textures` checkbox to `Unity Cloud` menu
- Added a preview re-generation when an asset is updated.

### Changed
- AM4B is now using Unity Cloud Python SDK 0.6.0

## [0.2.0] - 2024-02-22

### Added
- Added `Login` and `Logout` buttons to `Unity Cloud` menu.
- Added functionality to select and update an asset in current project.
- Leading and trailing spaces in asset name input string are now removed to comply with validation rules.

### Fixed
- Plugin now recalls previously selected organization and project ids.
- Plugin recalls previously selected organization, project and asset ids only if they are available.
- Removed reference to `InteropException`.

### Changed
- Updated a few URLs in the documentation.
- `unity-cloud` is initialized/uninitialized on add-on registration/unregistration.
- Previously selected organization, project and asset ids are reset after logging out.
- AM4B is now using Unity Cloud Python SDK 0.5.0

### Removed
- Removed the `generate preview` checkbox since previews are now automatically generated for an asset created with a single `.fbx` file.

## [0.1.1] - 2023-11-30

### Changed
- AM4B is now using Unity Cloud Python SDK 0.2.2

## [0.1.0] - 2023-11-15

Initial release

Features:
- Source code of "Asset Manager for Blender" add-on that demonstrates how to:
- install Unity Cloud Python SDK in integration environment;
- initialize and uninitialize unity-cloud package;
- login to Asset Manager using Unity Cloud Python SDK;
- create new asset and upload data to it.
- Python script to create a ready-to-install Blender add-on.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Technical overview

This document will describe the structure of the "Asset Manager for Blender", explain functionality of the main modules and functions used in this repository.

## Table of contents

- [Technical overview](#technical-overview)
- [Table of contents](#table-of-contents)
- [Add-on structure](#add-on-structure)
- [Add-on registration](#add-on-registration)
- [Installing Unity Cloud Python SDK in Blender's python runtime](#installing-unity-cloud-python-sdk-in-blenders-python-runtime)
- [Initialization of Unity Cloud Python SDK](#initialization-of-unity-cloud-python-sdk)
- [Interface](#interface)
- [Add-on menu](#add-on-menu)
- [Login](#login)
- [Logout](#logout)
- [Add-on dialog](#add-on-dialog)
- [Listing organizations, projects and assets](#listing-organizations-projects-and-assets)
- [Uploading data to Asset Manager](#uploading-data-to-asset-manager)
- [Asset data generation](#asset-data-generation)
- [See also](#see-also)

## Add-on structure

The AM4B is essentially a set of Python wheel files, that can be installed into Blender as an add-on.
AM4B contains 3 files:
- `__init__.py` contains data that is required by Blender in order to properly register and display the add-on.
- `uc_wheel_installation.py` module installs Unity Cloud Python SDK it in Blender environment.
- `uc_asset_manager.py` module provides access to Asset Manager through Unity Cloud Python SDK.

## Add-on registration

`__init__.py` provides information that is required by Blender in order to display the add-on (see [Add-on Tutorial](https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html#what-is-an-add-on) and [Requirements for contributed Scripts](https://wiki.blender.org/wiki/Process/Addons/Guidelines) for details):
- `bl_info`: provides add-on name, description, category, minimum Blender version that the add-on is compatible with.
- `register()` function: initiates installation of Unity Cloud Python SDK in Blender environment, registers Blender operators and displays add-on as Blender scene menu item.
- `unregister()` function: unregisters operators and hides add-on menu item.

## Installing Unity Cloud Python SDK in Blender's python runtime

To install Unity Cloud Python SDK, `__init.py__.register()` executes `install_unity_cloud()` function of `uc_wheel_installation` module. The function identifies the current operating system, checks if it is supported by Unity Cloud Python SDK, selects an according Python wheel file in the add-on zip, and installs it using `pip` command.

## Initialization of Unity Cloud Python SDK

To initialize Unity Cloud Python SDK, `__init.py__.register()` executes `initialize()` function of `uc_asset_manager` module. The function initializes Unity Cloud Python SDK and configures it to use user login. This operation is performed when add-on was enabled, or when Blender starts.
To uninitialize, `__init.py__.unregister()` executes `uninitialize()` function of `uc_asset_manager` module. This operation is performed when add-on was disabled, or when Blender is closing.

## Interface

To define interface of AM4B `__init__.py` implements `UC_Category` and `UploadToCloudOperator` classes, and `draw_func()` function:
- `draw_func()` function displays add-on menu;
- `UC_Category` class describes add-on menu structure and defines menu items functionality;
- `LoginToCloudOperator` class describes functionality of "Login" menu item;
- `LogoutFromCloudOperator` class describes functionality of "Logout" menu item;
- `UploadToCloudOperator` class describes functionality of "Upload FBX to Asset Manager" menu item.

These classes and function must be registered in Blender to display add-on when it is enabled, and unregistered to hide - when disabled.

### Add-on menu

Add-on menu items are defined with `DispatcherMenu` class and `draw_func` function. See [Blender documentation. Menus](https://docs.blender.org/api/current/bpy.types.Menu.html#menu-bpy-struct) for more information about custom menus in Blender.
`draw_func` function is registered in Blender UI system to display menu structure, described in `DispatcherMenu`, when add-on is enabled.

`DispatcherMenu` class describes the add-on menu and sub-menu items. It provides labels for menu items and define what happens when clicked.

### Login

When `Unity Cloud`->`Login` menu is clicked, the add-on will try to perform login to Unity Asset Manager using Unity Cloud Python SDK `identity` module. This functionality is defined in `LoginOperator` class. See [Blender Documentation. Operators](https://docs.blender.org/api/current/bpy.ops.html) for more information about custom operators in Blender.

### Logout

When `Unity Cloud`->`Logout` menu is clicked, the add-on will try to perform logout from Unity Asset Manager using Unity Cloud Python SDK `identity` module. This functionality is defined in `LogoutOperator` class. See [Blender Documentation. Operators](https://docs.blender.org/api/current/bpy.ops.html) for more information about custom operators in Blender.

### Add-on dialog

When `Unity Cloud`->`Upload FBX to Asset Manager` menu is clicked, the `Upload FBX to Asset Manager` dialog opens. The UI and functionality of the dialog is defined by `UploadOperator` class. See [Blender Documentation. Operators](https://docs.blender.org/api/current/bpy.ops.html) for more information about custom operators in Blender.

See [Blender Documentation. Property definitions](https://docs.blender.org/api/current/bpy.props.html) and [Window Manager](https://docs.blender.org/api/current/bpy.types.WindowManager.html) for more details about custom dialogs in Blender.

## Listing organizations, projects and assets

As mentioned above, access to Asset Manager is provided by `uc_asset_manager` module which uses Unity Cloud Python SDK. The module should be initialized before usage, and uninitialized when it's not in use (See [Initialization of Unity Cloud Python SDK](#initialization-of-unity-cloud-python-sdk) for more information about initialization).
`UploadOperator` prepares the list of the available organizations, projects and assets.

## Uploading data to Asset Manager

When user clicks "OK", `UploadOperator.execute()` function is called. It gathers information from user input, and calls `uc_asset_manager` to create asset or a new version, then update it, and finally the payload.

### Asset data generation

The first step of uploading to AM4B is FBX file. `_publish_fbx_to_asset` module creates a temporary folder on disk, saves the current scene as fbx in this folder using Python and Blender API. Then the data is sent to `uc_asset_manager` to be uploaded. The temp directory and files will be deleted after the upload:

See [Blender Documentation. Export scene operators](https://docs.blender.org/api/current/bpy.ops.export_scene.html#module-bpy.ops.export_scene) and [Render Operators](https://docs.blender.org/api/current/bpy.ops.render.html#module-bpy.ops.render) for information about exporting scene and creating images in Blender.

## See also

- [Asset Manager for Blender](../README.md)
- [Unity Cloud Python SDK documentation](https://docs.unity.com/cloud/en-us/asset-manager/python-sdk)
- [How to create your custom integration](https://docs.unity.com/cloud/en-us/asset-manager/create-own-integration)
Loading
Loading