2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2012-12-18 18:02:20 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup pythonintern
|
2012-12-18 18:02:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <Python.h>
|
|
|
|
|
|
2014-06-17 02:47:57 +10:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
|
2024-09-24 12:05:13 +02:00
|
|
|
#include "bpy_app_build_options.hh"
|
2012-12-18 18:02:20 +00:00
|
|
|
|
2013-01-04 04:43:49 +00:00
|
|
|
static PyTypeObject BlenderAppBuildOptionsType;
|
|
|
|
|
|
|
|
|
|
static PyStructSequence_Field app_builtopts_info_fields[] = {
|
2021-03-22 14:22:37 +11:00
|
|
|
/* names mostly follow CMake options, lowercase, after `WITH_` */
|
2023-07-21 02:18:59 +02:00
|
|
|
{"bullet", nullptr},
|
|
|
|
|
{"codec_avi", nullptr},
|
|
|
|
|
{"codec_ffmpeg", nullptr},
|
|
|
|
|
{"codec_sndfile", nullptr},
|
|
|
|
|
{"compositor_cpu", nullptr},
|
|
|
|
|
{"cycles", nullptr},
|
|
|
|
|
{"cycles_osl", nullptr},
|
|
|
|
|
{"freestyle", nullptr},
|
|
|
|
|
{"image_cineon", nullptr},
|
|
|
|
|
{"image_dds", nullptr},
|
|
|
|
|
{"image_hdr", nullptr},
|
|
|
|
|
{"image_openexr", nullptr},
|
|
|
|
|
{"image_openjpeg", nullptr},
|
|
|
|
|
{"image_tiff", nullptr},
|
2025-04-09 10:26:55 +10:00
|
|
|
{"image_webp", nullptr},
|
2023-07-21 02:18:59 +02:00
|
|
|
{"input_ndof", nullptr},
|
|
|
|
|
{"audaspace", nullptr},
|
|
|
|
|
{"international", nullptr},
|
|
|
|
|
{"openal", nullptr},
|
|
|
|
|
{"opensubdiv", nullptr},
|
|
|
|
|
{"sdl", nullptr},
|
|
|
|
|
{"coreaudio", nullptr},
|
|
|
|
|
{"jack", nullptr},
|
|
|
|
|
{"pulseaudio", nullptr},
|
|
|
|
|
{"wasapi", nullptr},
|
|
|
|
|
{"libmv", nullptr},
|
|
|
|
|
{"mod_oceansim", nullptr},
|
|
|
|
|
{"mod_remesh", nullptr},
|
|
|
|
|
{"collada", nullptr},
|
|
|
|
|
{"io_wavefront_obj", nullptr},
|
|
|
|
|
{"io_ply", nullptr},
|
|
|
|
|
{"io_stl", nullptr},
|
IO: New FBX importer (C++, via ufbx)
Adds a C++ based FBX importer, using 3rd party ufbx library (design task:
#131304). The old Python based importer is still there; the new one is marked
as "(experimental)" in the menu item. Drag-and-drop uses the old Python
importer; the new one is only in the menu item.
The new importer is generally 2x-5x faster than the old one, and often uses
less memory too. There's potential to make it several times faster still.
- ASCII FBX files are supported now
- Binary FBX files older than 7.1 (SDK 2012) version are supported now
- Better handling of "geometric transform" (common in 3dsmax), manifesting
as wrong rotation for some objects when in a hierarchy (e.g. #131172)
- Some FBX files that the old importer was failing to read are supported now
(e.g. cases 47344, 134983)
- Materials import more shader parameters (IOR, diffuse roughness,
anisotropy, subsurface, transmission, coat, sheen, thin film) and shader
models (e.g. OpenPBR or glTF2 materials from 3dsmax imports much better)
- Importer now creates layered/slotted animation actions. Each "take" inside
FBX file creates one action, and animated object within it gets a slot.
- Materials that use the same texture several times no longer create
duplicate images; the same image is used
- Material diffuse color animations were imported, but they only animated
the viewport color. Now they also animate the nodetree base color too.
- "Ignore Leaf Bones" option no longer ignores leaf bones that are actually
skinned to some parts of the mesh.
- Previous importer was creating orphan invisible Camera data objects for
some files (mostly from MotionBuilder?), new one properly creates these
cameras.
Import settings that existed in Python importer, but are NOT DONE in the new
one (mostly because not sure if they are useful, and no one asked for them
from feedback yet):
- Manual Orientation & Forward/Up Axis: not sure if actually useful. FBX
file itself specifies the axes fairly clearly. USD/glTF/Alembic also do
not have settings to override them.
- Use Pre/Post Rotation (defaults on): feels like it should just always be
on. ufbx handles that internally.
- Apply Transform (defaults off, warning icon): not sure if needed at all.
- Decal Offset: Cycles specific. None of other importers have it.
- Automatic Bone Orientation (defaults off): feels like current behavior
(either on or off) often produces "nonsensical bones" where bone direction
does not go towards the children with either setting. There are discussions
within I/O and Animation modules about different ways of bone
visualizations and/or different bone length axes, that would solve this
in general.
- Force Connect Children (defaults off): not sure when that would be useful.
On several animated armatures I tried, it turns armature animation
into garbage.
- Primary/Secondary Bone Axis: again not sure when would be useful.
Importer UI screenshots, performance benchmark details and TODOs for later
work are in the PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/132406
2025-04-16 09:55:00 +02:00
|
|
|
{"io_fbx", nullptr},
|
2023-07-21 02:18:59 +02:00
|
|
|
{"io_gpencil", nullptr},
|
|
|
|
|
{"opencolorio", nullptr},
|
|
|
|
|
{"openmp", nullptr},
|
|
|
|
|
{"openvdb", nullptr},
|
|
|
|
|
{"alembic", nullptr},
|
|
|
|
|
{"usd", nullptr},
|
|
|
|
|
{"fluid", nullptr},
|
|
|
|
|
{"xr_openxr", nullptr},
|
|
|
|
|
{"potrace", nullptr},
|
|
|
|
|
{"pugixml", nullptr},
|
|
|
|
|
{"haru", nullptr},
|
2021-03-22 14:22:37 +11:00
|
|
|
/* Sentinel (this line prevents `clang-format` wrapping into columns). */
|
2023-07-21 02:18:59 +02:00
|
|
|
{nullptr},
|
2013-01-04 04:43:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static PyStructSequence_Desc app_builtopts_info_desc = {
|
2024-08-19 11:37:20 +10:00
|
|
|
/*name*/ "bpy.app.build_options",
|
|
|
|
|
/*doc*/ "This module contains information about options blender is built with",
|
|
|
|
|
/*fields*/ app_builtopts_info_fields,
|
|
|
|
|
/*n_in_sequence*/ ARRAY_SIZE(app_builtopts_info_fields) - 1,
|
2013-01-04 04:43:49 +00:00
|
|
|
};
|
|
|
|
|
|
2023-07-21 10:59:54 +10:00
|
|
|
static PyObject *make_builtopts_info()
|
2012-12-18 18:02:20 +00:00
|
|
|
{
|
2013-01-04 04:43:49 +00:00
|
|
|
PyObject *builtopts_info;
|
|
|
|
|
int pos = 0;
|
2012-12-18 18:02:20 +00:00
|
|
|
|
2013-01-04 04:43:49 +00:00
|
|
|
builtopts_info = PyStructSequence_New(&BlenderAppBuildOptionsType);
|
2023-07-21 02:18:59 +02:00
|
|
|
if (builtopts_info == nullptr) {
|
|
|
|
|
return nullptr;
|
2013-01-04 04:43:49 +00:00
|
|
|
}
|
2012-12-18 18:02:20 +00:00
|
|
|
|
2013-01-04 04:43:49 +00:00
|
|
|
#define SetObjIncref(item) \
|
|
|
|
|
PyStructSequence_SET_ITEM(builtopts_info, pos++, (Py_IncRef(item), item))
|
2012-12-18 18:02:20 +00:00
|
|
|
|
|
|
|
|
#ifdef WITH_BULLET
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2024-02-20 13:15:50 +01:00
|
|
|
/* AVI */
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
|
|
|
|
|
#ifdef WITH_FFMPEG
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_SNDFILE
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2024-12-13 14:54:19 +01:00
|
|
|
/* Compositor. */
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
2012-12-18 18:02:20 +00:00
|
|
|
|
|
|
|
|
#ifdef WITH_CYCLES
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_CYCLES_OSL
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2012-12-20 07:57:26 +00:00
|
|
|
#ifdef WITH_FREESTYLE
|
2013-01-05 22:24:05 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-20 07:57:26 +00:00
|
|
|
#endif
|
|
|
|
|
|
2025-04-09 08:44:36 +00:00
|
|
|
#ifdef WITH_IMAGE_CINEON
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2023-04-12 05:22:26 +02:00
|
|
|
/* DDS */
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
2012-12-18 18:02:20 +00:00
|
|
|
|
2023-04-12 05:22:26 +02:00
|
|
|
/* HDR */
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
2012-12-18 18:02:20 +00:00
|
|
|
|
2025-04-09 08:44:36 +00:00
|
|
|
#ifdef WITH_IMAGE_OPENEXR
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2025-04-09 08:44:36 +00:00
|
|
|
#ifdef WITH_IMAGE_OPENJPEG
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2023-04-12 05:22:26 +02:00
|
|
|
/* TIFF */
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
2012-12-18 18:02:20 +00:00
|
|
|
|
2025-04-09 08:44:36 +00:00
|
|
|
#ifdef WITH_IMAGE_WEBP
|
2025-04-09 10:26:55 +10:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-12-18 18:02:20 +00:00
|
|
|
#ifdef WITH_INPUT_NDOF
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_AUDASPACE
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_INTERNATIONAL
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_OPENAL
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-09-03 11:21:51 +02:00
|
|
|
#ifdef WITH_OPENSUBDIV
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-01-04 04:43:49 +00:00
|
|
|
#ifdef WITH_SDL
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2021-03-14 12:46:47 +01:00
|
|
|
#ifdef WITH_COREAUDIO
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-12-18 18:02:20 +00:00
|
|
|
#ifdef WITH_JACK
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2021-03-02 17:29:18 +01:00
|
|
|
#ifdef WITH_PULSEAUDIO
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-03-11 19:22:56 +01:00
|
|
|
#ifdef WITH_WASAPI
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-12-18 18:02:20 +00:00
|
|
|
#ifdef WITH_LIBMV
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_OCEANSIM
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_MOD_REMESH
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2013-01-04 04:43:49 +00:00
|
|
|
#ifdef WITH_COLLADA
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2022-06-07 14:21:19 +10:00
|
|
|
#ifdef WITH_IO_WAVEFRONT_OBJ
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-03-05 19:02:36 +02:00
|
|
|
#ifdef WITH_IO_PLY
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-06-07 14:21:19 +10:00
|
|
|
#ifdef WITH_IO_STL
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
IO: New FBX importer (C++, via ufbx)
Adds a C++ based FBX importer, using 3rd party ufbx library (design task:
#131304). The old Python based importer is still there; the new one is marked
as "(experimental)" in the menu item. Drag-and-drop uses the old Python
importer; the new one is only in the menu item.
The new importer is generally 2x-5x faster than the old one, and often uses
less memory too. There's potential to make it several times faster still.
- ASCII FBX files are supported now
- Binary FBX files older than 7.1 (SDK 2012) version are supported now
- Better handling of "geometric transform" (common in 3dsmax), manifesting
as wrong rotation for some objects when in a hierarchy (e.g. #131172)
- Some FBX files that the old importer was failing to read are supported now
(e.g. cases 47344, 134983)
- Materials import more shader parameters (IOR, diffuse roughness,
anisotropy, subsurface, transmission, coat, sheen, thin film) and shader
models (e.g. OpenPBR or glTF2 materials from 3dsmax imports much better)
- Importer now creates layered/slotted animation actions. Each "take" inside
FBX file creates one action, and animated object within it gets a slot.
- Materials that use the same texture several times no longer create
duplicate images; the same image is used
- Material diffuse color animations were imported, but they only animated
the viewport color. Now they also animate the nodetree base color too.
- "Ignore Leaf Bones" option no longer ignores leaf bones that are actually
skinned to some parts of the mesh.
- Previous importer was creating orphan invisible Camera data objects for
some files (mostly from MotionBuilder?), new one properly creates these
cameras.
Import settings that existed in Python importer, but are NOT DONE in the new
one (mostly because not sure if they are useful, and no one asked for them
from feedback yet):
- Manual Orientation & Forward/Up Axis: not sure if actually useful. FBX
file itself specifies the axes fairly clearly. USD/glTF/Alembic also do
not have settings to override them.
- Use Pre/Post Rotation (defaults on): feels like it should just always be
on. ufbx handles that internally.
- Apply Transform (defaults off, warning icon): not sure if needed at all.
- Decal Offset: Cycles specific. None of other importers have it.
- Automatic Bone Orientation (defaults off): feels like current behavior
(either on or off) often produces "nonsensical bones" where bone direction
does not go towards the children with either setting. There are discussions
within I/O and Animation modules about different ways of bone
visualizations and/or different bone length axes, that would solve this
in general.
- Force Connect Children (defaults off): not sure when that would be useful.
On several animated armatures I tried, it turns armature animation
into garbage.
- Primary/Secondary Bone Axis: again not sure when would be useful.
Importer UI screenshots, performance benchmark details and TODOs for later
work are in the PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/132406
2025-04-16 09:55:00 +02:00
|
|
|
#ifdef WITH_IO_FBX
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-08-20 11:41:37 +02:00
|
|
|
#ifdef WITH_IO_GREASE_PENCIL
|
2022-06-07 14:21:19 +10:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
Refactor: OpenColorIO integration
Briefly about this change:
- OpenColorIO C-API is removed.
- The information about color spaces in ImBuf module is removed.
It was stored in global ListBase in colormanagement.cc.
- Both OpenColorIO and fallback implementation supports GPU drawing.
- Fallback implementation supports white point, RGB curves, etc.
- Removed check for support of GPU drawing in IMB.
Historically it was implemented in a separate library with C-API, this
is because way back C++ code needed to stay in intern. This causes all
sort of overheads, and even calls that are strictly considered bad
level.
This change moves OpenColorIO integration into a module within imbuf,
next to movie, and next to IMB_colormanagement which is the main user
of it. This allows to avoid copy of color spaces, displays, views etc
in the ImBuf: they were used to help quickly querying information to
be shown on the interface. With this change it can be stored in the
same data structures as what is used by the OpenColorIO integration.
While it might not be fully avoiding duplication it is now less, and
there is no need in the user code to maintain the copies.
In a lot of cases this change also avoids allocations done per access
to the OpenColorIO. For example, it is not needed anymore to allocate
image descriptor in a heap.
The bigger user-visible change is that the fallback implementation now
supports GLSL drawing, with the whole list of supported features, such
as curve mapping and white point. This should help simplifying code
which relies on color space conversion on GPU: there is no need to
figure out fallback solution in such cases. The only case when drawing
will not work is when there is some actual bug, or driver issue, and
shader has failed to compile.
The change avoids having an opaque type for color space, and instead
uses forward declaration. It is a bit verbose on declaration, but helps
avoiding unsafe type-casts. There are ways to solve this in the future,
like having a header for forward declaration, or to flatten the name
space a bit.
There should be no user-level changes under normal operation.
When building without OpenColorIO or the configuration has a typo or
is missing a fuller set of color management tools is applies (such as the
white point correction).
Pull Request: https://projects.blender.org/blender/blender/pulls/138433
2025-05-09 14:01:43 +02:00
|
|
|
#ifdef WITH_OPENCOLORIO
|
2013-01-04 04:43:49 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
2012-12-18 18:02:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
2013-05-20 14:38:43 +00:00
|
|
|
#ifdef _OPENMP
|
2013-04-28 16:52:51 +00:00
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
Implementation of OpenVDB as a possible cache format for smoke
simulations.
This commits implements OpenVDB as an extra cache format in the Point
Cache system for smoke simulations. Compilation with the library is
turned off by default for now, and shall be enabled when the library is
present.
A documentation of its doings is available here: http://
wiki.blender.org/index.php/User:Kevindietrich/OpenVDBSmokeExport.
A guide to compile OpenVDB can be found here (Linux): http://
wiki.blender.org/index.php?title=Dev:Doc/Building_Blender/Linux/
Dependencies_From_Source#OpenVDB
Reviewers: sergey, lukastoenne, brecht, campbellbarton
Reviewed By: brecht, campbellbarton
Subscribers: galenb, Blendify, robocyte, Lapineige, bliblubli,
jtheninja, lukasstockner97, dingto, brecht
Differential Revision: https://developer.blender.org/D1721
2016-01-23 08:39:29 +01:00
|
|
|
#ifdef WITH_OPENVDB
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
#ifdef WITH_ALEMBIC
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
USD: Introducing a simple USD Exporter
This commit introduces the first version of an exporter to Pixar's
Universal Scene Description (USD) format.
Reviewed By: sergey, LazyDodo
Differential Revision: https://developer.blender.org/D6287
- The USD libraries are built by `make deps`, but not yet built by
install_deps.sh.
- Only experimental support for instancing; by default all duplicated
objects are made real in the USD file. This is fine for exporting a
linked-in posed character, not so much for thousands of pebbles etc.
- The way materials and UV coordinates and Normals are exported is going
to change soon.
- This patch contains LazyDodo's fixes for building on Windows in D5359.
== Meshes ==
USD seems to support neither per-material nor per-face-group
double-sidedness, so we just use the flag from the first non-empty
material slot. If there is no material we default to double-sidedness.
Each UV map is stored on the mesh in a separate primvar. Materials can
refer to these UV maps, but this is not yet exported by Blender. The
primvar name is the same as the UV Map name. This is to allow the
standard name "st" for texture coordinates by naming the UV Map as such,
without having to guess which UV Map is the "standard" one.
Face-varying mesh normals are written to USD. When the mesh has custom
loop normals those are written. Otherwise the poly flag `ME_SMOOTH` is
inspected to determine the normals.
The UV maps and mesh normals take up a significant amount of space, so
exporting them is optional. They're still enabled by default, though.
For comparison: a shot of Spring (03_035_A) is 1.2 GiB when exported
with UVs and normals, and 262 MiB without. We probably have room for
optimisation of written UVs and normals.
The mesh subdivision scheme isn't using the default value 'Catmull
Clark', but uses 'None', indicating we're exporting a polygonal mesh.
This is necessary for USD to understand our normals; otherwise the mesh
is always rendered smooth. In the future we may want to expose this
choice of subdivision scheme to the user, or auto-detect it when we
actually support exporting pre-subdivision meshes.
A possible optimisation could be to inspect whether all polygons are
smooth or flat, and mark the USD mesh as such. This can be added when
needed.
== Animation ==
Mesh and transform animation are now written when passing
`animation=True` to the export operator. There is no inspection of
whether an object is actually animated or not; USD can handle
deduplication of static values for us.
The administration of which timecode to use for the export is left to
the file-format-specific concrete subclasses of
`AbstractHierarchyIterator`; the abstract iterator itself doesn't know
anything about the passage of time. This will allow subclasses for the
frame-based USD format and time-based Alembic format.
== Support for simple preview materials ==
Very simple versions of the materials are now exported, using only the
viewport diffuse RGB, metallic, and roughness.
When there are multiple materials, the mesh faces are stored as geometry
subset and each material is assigned to the appropriate subset. If there
is only one material this is skipped.
The first material if any) is always applied to the mesh itself
(regardless of the existence of geometry subsets), because the Hydra
viewport doesn't support materials on subsets. See
https://github.com/PixarAnimationStudios/USD/issues/542 for more info.
Note that the geometry subsets are not yet time-sampled, so it may break
when an animated mesh changes topology.
Materials are exported as a flat list under a top-level '/_materials'
namespace. This inhibits instancing of the objects using those
materials, so this is subject to change.
== Hair ==
Only the parent strands are exported, and only with a constant colour.
No UV coordinates, no information about the normals.
== Camera ==
Only perspective cameras are supported for now.
== Particles ==
Particles are only written when they are alive, which means that they
are always visible (there is currently no code that deals with marking
them as invisible outside their lifespan).
Particle-system-instanced objects are exported by suffixing the object
name with the particle's persistent ID, giving each particle XForm a
unique name.
== Instancing/referencing ==
This exporter has experimental support for instancing/referencing.
Dupli-object meshes are now written to USD as references to the original
mesh. This is still very limited in correctness, as there are issues
referencing to materials from a referenced mesh.
I am still committing this, as it gives us a place to start when
continuing the quest for proper instancing in USD.
== Lights ==
USD does not directly support spot lights, so those aren't exported yet.
It's possible to add this in the future via the UsdLuxShapingAPI. The
units used for the light intensity are also still a bit of a mystery.
== Fluid vertex velocities ==
Currently only fluid simulations (not meshes in general) have explicit
vertex velocities. This is the most important case for exporting
velocities, though, as the baked mesh changes topology all the time, and
thus computing the velocities at import time in a post-processing step
is hard.
== The Building Process ==
- USD is built as monolithic library, instead of 25 smaller libraries.
We were linking all of them as 'whole archive' anyway, so this doesn't
affect the final file size. It does, however, make life easier with
respect to linking order, and handling upstream changes.
- The JSON files required by USD are installed into datafiles/usd; they
are required on every platform. Set the `PXR_PATH_DEBUG` to any value
to have the USD library print the paths it uses to find those files.
- USD is patched so that it finds the aforementioned JSON files in a path
that we pass to it from Blender.
- USD is patched to have a `PXR_BUILD_USD_TOOLS` CMake option to disable
building the tools in its `bin` directory. This is sent as a pull
request at https://github.com/PixarAnimationStudios/USD/pull/1048
2019-12-13 10:27:40 +01:00
|
|
|
#ifdef WITH_USD
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-12-16 15:50:14 +01:00
|
|
|
#ifdef WITH_FLUID
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-03-04 16:39:00 +01:00
|
|
|
#ifdef WITH_XR_OPENXR
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-09-21 19:53:36 +02:00
|
|
|
#ifdef WITH_POTRACE
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-03-24 15:14:43 +01:00
|
|
|
#ifdef WITH_PUGIXML
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_HARU
|
|
|
|
|
SetObjIncref(Py_True);
|
|
|
|
|
#else
|
|
|
|
|
SetObjIncref(Py_False);
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-01-04 04:43:49 +00:00
|
|
|
#undef SetObjIncref
|
2012-12-18 18:02:20 +00:00
|
|
|
|
2013-01-04 04:43:49 +00:00
|
|
|
return builtopts_info;
|
2012-12-18 18:02:20 +00:00
|
|
|
}
|
|
|
|
|
|
2023-07-21 10:59:54 +10:00
|
|
|
PyObject *BPY_app_build_options_struct()
|
2012-12-18 18:02:20 +00:00
|
|
|
{
|
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
2013-01-04 04:43:49 +00:00
|
|
|
PyStructSequence_InitType(&BlenderAppBuildOptionsType, &app_builtopts_info_desc);
|
|
|
|
|
|
|
|
|
|
ret = make_builtopts_info();
|
|
|
|
|
|
|
|
|
|
/* prevent user from creating new instances */
|
2023-07-21 02:18:59 +02:00
|
|
|
BlenderAppBuildOptionsType.tp_init = nullptr;
|
|
|
|
|
BlenderAppBuildOptionsType.tp_new = nullptr;
|
2023-05-24 11:21:18 +10:00
|
|
|
/* Without this we can't do `set(sys.modules)` #29635. */
|
|
|
|
|
BlenderAppBuildOptionsType.tp_hash = (hashfunc)_Py_HashPointer;
|
2012-12-18 18:02:20 +00:00
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|