Skip to content

Commit add7131

Browse files
Added comment for traverse_py_cb_ro_impl
1 parent e1fb849 commit add7131

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/python/detail.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,13 @@ struct recursion_guard {
300300
};
301301
} // namespace
302302

303+
/**
304+
* \brief Traverses all variables of a python object.
305+
*
306+
* This function is used to traverse variables of python objects, inheriting
307+
* from trampoline classes. This allows the user to freeze for example custom
308+
* BSDFs, without having to declare its variables.
309+
*/
303310
void traverse_py_cb_ro_impl(nb::handle self, nb::callable c) {
304311
recursion_guard guard;
305312

@@ -340,6 +347,13 @@ void traverse_py_cb_ro_impl(nb::handle self, nb::callable c) {
340347
}
341348
}
342349

350+
/**
351+
* \brief Traverses all variables of a python object.
352+
*
353+
* This function is used to traverse variables of python objects, inheriting
354+
* from trampoline classes. This allows the user to freeze for example custom
355+
* BSDFs, without having to declare its variables.
356+
*/
343357
void traverse_py_cb_rw_impl(nb::handle self, nb::callable c) {
344358
recursion_guard guard;
345359

tests/call_ext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ struct Sampler : dr::TraversableBase {
2020

2121
T next() { return rng.next_float32(); }
2222

23-
DR_TRAVERSE_CB(dr::TraversableBase, rng);
24-
2523
dr::PCG32<dr::uint64_array_t<T>> rng;
24+
25+
DR_TRAVERSE_CB(dr::TraversableBase, rng);
2626
};
2727

2828
template <typename Float> struct Base : drjit::TraversableBase {

0 commit comments

Comments
 (0)