2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2015 Blender Foundation. All rights reserved. */
|
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
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup pythonintern
|
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
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "BLI_utildefines.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <Python.h>
|
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
|
|
|
|
|
|
|
|
#include "bpy_app_openvdb.h"
|
|
|
|
|
|
2017-08-22 18:02:58 +10:00
|
|
|
#include "../generic/py_capi_utils.h"
|
|
|
|
|
|
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
|
|
|
|
|
# include "openvdb_capi.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static PyTypeObject BlenderAppOVDBType;
|
|
|
|
|
|
|
|
|
|
static PyStructSequence_Field app_openvdb_info_fields[] = {
|
2019-12-20 10:42:57 +11:00
|
|
|
{"supported", "Boolean, True when Blender is built with OpenVDB support"},
|
|
|
|
|
{"version", "The OpenVDB version as a tuple of 3 numbers"},
|
|
|
|
|
{"version_string", "The OpenVDB version formatted as a string"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{NULL},
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static PyStructSequence_Desc app_openvdb_info_desc = {
|
2019-12-20 10:42:57 +11:00
|
|
|
"bpy.app.openvdb", /* name */
|
|
|
|
|
"This module contains information about OpenVDB blender is linked against", /* doc */
|
|
|
|
|
app_openvdb_info_fields, /* fields */
|
2019-02-03 14:01:45 +11:00
|
|
|
ARRAY_SIZE(app_openvdb_info_fields) - 1,
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static PyObject *make_openvdb_info(void)
|
|
|
|
|
{
|
|
|
|
|
PyObject *openvdb_info;
|
|
|
|
|
int pos = 0;
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_OPENVDB
|
|
|
|
|
int curversion;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
openvdb_info = PyStructSequence_New(&BlenderAppOVDBType);
|
|
|
|
|
if (openvdb_info == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef WITH_OPENVDB
|
|
|
|
|
# define SetStrItem(str) PyStructSequence_SET_ITEM(openvdb_info, pos++, PyUnicode_FromString(str))
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define SetObjItem(obj) PyStructSequence_SET_ITEM(openvdb_info, pos++, obj)
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_OPENVDB
|
|
|
|
|
curversion = OpenVDB_getVersionHex();
|
|
|
|
|
SetObjItem(PyBool_FromLong(1));
|
2017-08-22 18:02:58 +10:00
|
|
|
SetObjItem(
|
|
|
|
|
PyC_Tuple_Pack_I32(curversion >> 24, (curversion >> 16) % 256, (curversion >> 8) % 256));
|
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
|
|
|
SetObjItem(PyUnicode_FromFormat(
|
|
|
|
|
"%2d, %2d, %2d", curversion >> 24, (curversion >> 16) % 256, (curversion >> 8) % 256));
|
|
|
|
|
#else
|
|
|
|
|
SetObjItem(PyBool_FromLong(0));
|
2017-08-22 18:02:58 +10:00
|
|
|
SetObjItem(PyC_Tuple_Pack_I32(0, 0, 0));
|
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
|
|
|
SetStrItem("Unknown");
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-03-04 15:46:07 +11:00
|
|
|
if (UNLIKELY(PyErr_Occurred())) {
|
|
|
|
|
Py_DECREF(openvdb_info);
|
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
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef SetStrItem
|
|
|
|
|
#undef SetObjItem
|
|
|
|
|
|
|
|
|
|
return openvdb_info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *BPY_app_openvdb_struct(void)
|
|
|
|
|
{
|
|
|
|
|
PyObject *ret;
|
|
|
|
|
|
|
|
|
|
PyStructSequence_InitType(&BlenderAppOVDBType, &app_openvdb_info_desc);
|
|
|
|
|
|
|
|
|
|
ret = make_openvdb_info();
|
|
|
|
|
|
|
|
|
|
/* prevent user from creating new instances */
|
|
|
|
|
BlenderAppOVDBType.tp_init = NULL;
|
|
|
|
|
BlenderAppOVDBType.tp_new = NULL;
|
|
|
|
|
BlenderAppOVDBType.tp_hash = (hashfunc)
|
2020-09-30 20:09:02 +10:00
|
|
|
_Py_HashPointer; /* without this we can't do set(sys.modules) T29635. */
|
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
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|