Skip to content

Initialize Mitsuba Python variant in SceneManager for custom plugin registration - #26

Open
WeiPhil wants to merge 1 commit into
google:mainfrom
WeiPhil:python_variant_registration
Open

Initialize Mitsuba Python variant in SceneManager for custom plugin registration#26
WeiPhil wants to merge 1 commit into
google:mainfrom
WeiPhil:python_variant_registration

Conversation

@WeiPhil

@WeiPhil WeiPhil commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

This allows python-based plugins to automatically get registered in the render delegate (e.g. volprim_rf_basic) that would otherwise never get registered from the C++ side of things.

@dvicini dvicini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good. It would just be good to clarify the error message

if (!TfPyInvoke("mitsuba", "set_variant", variant)) {
TF_WARN(
"Failed to set Mitsuba Python variant '%s'; Python-defined plugins "
"(e.g. volprim_rf_basic) will be unavailable.",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be unavailable or might be unavailable if there is a variant mismatch?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be unavailable. I think there are only two scenarios in which case this fails. Mitsuba was built without python support or a wrong PYTHONPATH was set or mitsuba doesn't have that variant which can only happen if we load a different mitsuba build that the one we ship with hdmitsuba, e.g the pip version which I think we do warn isn't supported. In case we just switch variant this work seemlessly. Maybe we can rephrase as
"Could not import mitsuba in Python or set variant X — check PYTHONPATH points at the same Mitsuba build hdmitsuba was compiled against."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay makes sense. Yes let's just add a sentence that this means the Mitsuba Python module was not found.

Also, should this code initially import mitsuba? I think right now this may not work if mitsuba was previously not imported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants