Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Christian López Barrón <chris.gfz@gmail.com>
  • Loading branch information
chrizzFTD committed Jan 2, 2025
1 parent b85200a commit 9bba026
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
12 changes: 4 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def _get_usd_ref_tooltip(app):


@functools.cache
def _get_url_for_target(app, target):
def _get_url_for_usd_target(app, target):
pxr_obj_namespace = target.removeprefix('pxr.').replace(".", "")
pxr_obj_namespace = {
"UsdInitialLoadSet": "UsdStage::InitialLoadSet", # there's indirection in the python bindings
Expand All @@ -281,13 +281,9 @@ def _get_url_for_target(app, target):
def _handle_missing_usd_reference(app, env, node, contnode):
from docutils import nodes

target = node['reftarget']
if not target.startswith('pxr.'):
return None

reftitle, refuri = _get_url_for_target(app, target)
node = nodes.reference('', contnode.astext(), internal=False, refuri=refuri, reftitle=reftitle)
return node
if (target := node['reftarget']).startswith('pxr.'):
reftitle, refuri = _get_url_for_usd_target(app, target)
return nodes.reference('', contnode.astext(), internal=False, refuri=refuri, reftitle=reftitle)


def _grill_process_signature(app, what, name, obj, options, signature, return_annotation):
Expand Down
7 changes: 3 additions & 4 deletions grill/usd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""Helpers for USD workflows which do not know anything about the pipeline."""
from __future__ import annotations

import enum
# https://docs.python.org/3/whatsnew/3.10.html#pep-604-new-type-union-operator
# TODO: Remove when py-3.10+ is supported (for union types)
import typing
import inspect
import logging
import functools
Expand Down Expand Up @@ -58,7 +57,7 @@ def common_paths(paths: abc.Iterable[Sdf.Path]) -> list[Sdf.Path]:
return unique


def iprims(stage: Usd.Stage, root_paths: abc.Iterable[Sdf.Path] = tuple(), prune_predicate: abc.Callable[[Usd.Prim], bool] = None, traverse_predicate: typing.Union[Usd._Term, Usd._PrimFlagsConjunction] = Usd.PrimDefaultPredicate) -> abc.Iterator[Usd.Prim]:
def iprims(stage: Usd.Stage, root_paths: abc.Iterable[Sdf.Path] = tuple(), prune_predicate: abc.Callable[[Usd.Prim], bool] = None, traverse_predicate: Usd._Term | Usd._PrimFlagsConjunction = Usd.PrimDefaultPredicate) -> abc.Iterator[Usd.Prim]:
"""Convenience function that creates an iterator useful for common :ref:`glossary:stage traversal`.
Without keyword arguments, this is the same as calling :usdcpp:`UsdStage::Traverse`, so
Expand Down

0 comments on commit 9bba026

Please sign in to comment.