The official Blender project repository.
Go to file
Charles Flèche 0df5d8220b
All checks were successful
buildbot/vdev-code-daily-lint Build done.
buildbot/vdev-code-daily-darwin-x86_64 Build done.
buildbot/vdev-code-daily-linux-x86_64 Build done.
buildbot/vdev-code-daily-windows-amd64 Build done.
buildbot/vdev-code-daily-darwin-arm64 Build done.
buildbot/vdev-code-daily-coordinator Build done.
USD: Add new get_prim_map API callable from python on_import hooks
When importing an USD, the Blender object names do not necessarily match
Prim names:

```
#usda 1.0
def Xform "xform1"
{
  def Mesh "MyObject"  # Will be imported as "MyObject"
}
def Xform "xform2"
{
  def Mesh "MyObject"  # Will be imported as "MyObject.001"
}
def Xform "xform2"
{
  def Mesh "MyObject"  # Will be imported as "MyObject.002"
}
```

This makes it difficult in the [USD Import Hooks]
(https://docs.blender.org/api/current/bpy.types.USDHook.html) to link a
Blender object back to its source Prim for additional processing. A
typical use cases for games is to generate UVs, create and apply a
material on the fly when importing a collision shape that does not have
a visual representation (hence no materials) based on some Prim
attributes, but that the artist needs to differenciate in Blender's
viewport.

The Import context exposes a new method `get_prim_map()` that returns a
`dict` of `prim path` / `list of Blender ID`.

For example, given the following USD scene,
```
/
 |--XformThenCube [def Xform]
 |   `--Cube [def Cube]
 |--XformThenXformCube [def Xform]
 |   `--XformIntermediate [def Xform]
 |       `--Cube [def Mesh]
 |--Cube [def Cube]
 `--Material [def Material]
     `--Principled_BSDF [def Shader]
```

the `get_prim_map()` method will return a map as:

```python
@static_method
def on_import(import_context):
  pprint(import_context.get_prim_map())
```

```json
{
  "/Cube": [bpy.data.objects["Cube.002"], bpy.data.meshes["Cube.002"]],
  "/XformThenCube": [bpy.data.objects["XformThenCube"]],
  "/XformThenCube/Cube": [bpy.data.objects["Cube"], bpy.data.meshes["Cube"]],
  "/XformThenXformCube": [bpy.data.objects["XformThenXformCube"]],
  "/XformThenXformCube/XformIntermediate": [bpy.data.objects["XformIntermediate"]],
  "/XformThenXformCube/XformIntermediate/Cube": [bpy.data.objects["Cube.001"], bpy.data.meshes["Cube.001"]],
  "/Material": [bpy.data.materials["Material"]],
}
```

Co-authored-by: Odréanne Breton <odreanne.breton@ubisoft.com>
Co-authored-by: Sttevan Carnali Joga <sttevan.carnali-joga@ubisoft.com>
Co-authored-by: Charles Flèche <charles.fleche@ubisoft.com>
2024-12-11 21:36:09 +01:00
.gitea Report template: Add link to manual system information collection page 2024-11-19 01:05:52 +01:00
.github Funding: Add FUNDING.yml to link to fund.blender.org on GitHub mirror 2024-07-31 10:03:57 +02:00
build_files Fix: Ninja build command on Windows 2024-12-10 01:10:35 +01:00
doc USD: Add new get_prim_map API callable from python on_import hooks 2024-12-11 21:36:09 +01:00
extern Cmake: Add Pipewire support 2024-12-03 16:26:01 +01:00
intern Fix #131240: Cycles: Negative integration range in Huang Hair 2024-12-10 21:56:04 +01:00
lib Libs: Update Windows ARM64 Vulkan + shaderc 2024-12-10 11:16:12 +01:00
locale I18N: Updated UI translation from git/weblate repository (9809f2b9f468b03). 2024-12-09 11:09:44 +01:00
release Installer: Windows: Various tweaks and updates to the installer 2024-12-10 08:41:04 +01:00
scripts Fix #100324: Curves sculpt slide brush always resets with pressure 2024-12-11 16:43:15 +01:00
source USD: Add new get_prim_map API callable from python on_import hooks 2024-12-11 21:36:09 +01:00
tests USD: Add new get_prim_map API callable from python on_import hooks 2024-12-11 21:36:09 +01:00
tools Cleanup: quiet Python linter warnings 2024-12-11 11:26:24 +11:00
.clang-format ClangFormat: Remove unused sculpt macro exceptions 2024-11-12 00:44:24 +01:00
.clang-tidy Cleanup: match declaration names, avoid shadowing & clear trailing space 2024-10-03 12:12:08 +10:00
.editorconfig editorconfig: add HTML entry 2023-12-08 13:28:13 +11:00
.git-blame-ignore-revs Cleanup: add commit to .git-blame-ignore-revs 2023-05-03 20:31:11 +10:00
.gitignore Deps: support vs2022 x64, git ignores 2024-12-09 17:23:17 +01:00
.gitmodules Revert "Release cycle: Blender 4.3 Beta" 2024-10-02 12:35:26 +02:00
AUTHORS AUTHORS: add 1 new author (via override) 2024-10-29 14:43:10 +11:00
CMakeLists.txt Fix: CMake: Disable jemalloc/valgrind when ASAN options are enabled. 2024-12-09 16:41:05 +01:00
COPYING == docs == 2010-10-13 14:44:22 +00:00
GNUmakefile make license: command to update the license file 2024-10-18 17:09:43 +02:00
make.bat make license: command to update the license file 2024-10-18 17:09:43 +02:00
pyproject.toml pyproject.toml: correct autopep8 configuration for 2.3.1 2024-10-16 20:55:03 +11:00
README.md Docs: Replace most wiki links with links to new developer docs 2024-01-18 16:49:38 +01:00

Blender

Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.

Blender screenshot

Project Pages

Development

License

Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different, but compatible license.

See blender.org/about/license for details.