Kit Compatibility#
omni.physxclashdetectioncore is a Kit-free Python package with the
import paths of Kit’s package of the same name. ovclash is the clash detection library for
USD scenes that runs without Kit.
Where it ships. It ships beside
ovclashandovclash_suite, in the wheel and in the SDK archive’spython/directory.ovclash_suite, the Python package of the Suite API, backs it.What resolves. Every public class, function and class member that Kit defines in a module that both packages provide resolves here, except the gaps under What does not. Code that uses only those names needs no import changes.
What to check. A few parameters and behaviors differ; see Behavioral differences to check.
Use the package only to port existing Kit code. New code imports ovclash_suite directly; see
Choosing an API Layer and Suite Workflows.
Every name the package forwards is the Suite API’s own object, not a wrapper.
omni.physxclashdetectioncore.ClashDetection and ovclash_suite.ClashDetection are one class.
A partially ported module can therefore mix the two spellings without isinstance surprises.
Three functions wrap a Suite function of the same name instead:
clash_detect_export.export_to_json, clash_detect_export.export_to_html and
utils.file_exists.
# Kit code: keeps working, no edit needed.
from omni.physxclashdetectioncore.clash_detect import ClashDetection
from omni.physxclashdetectioncore.clash_detect_settings import SettingId
# The same two objects, spelled the way new code should spell them.
from ovclash_suite import ClashDetection as SuiteClashDetection, SettingId as SuiteSettingId
assert ClashDetection is SuiteClashDetection
assert SettingId is SuiteSettingId
Importing the package imports ovclash_suite, which loads the native library:
The wheel finds the library it bundles.
With the SDK archive, put its
python/directory onPYTHONPATH, and setOVCLASH_LIBorOVCLASH_SUITE_LIBto the absolute path of the native library. See Native library lookup.
This page covers the Python package. Two other pages cover the rest of the Kit surface:
Limitations lists the C entry points kept only for compatibility with Kit’s clash interface.
Legacy Containers covers Kit’s
.clashDetectionresult files.
What resolves#
The package root re-exports these ovclash_suite names. Kit’s package root does not provide
them, so Kit code imports them from the submodules that keep Kit’s import paths, which the
Module | Exports table of this section lists.
Name |
Kind |
|---|---|
|
serializer base class |
|
array container of copied values, convertible to a list, a NumPy array or a Warp array |
|
data-store facade |
|
directory serializer that stores readable JSON files; ovclash only |
|
SQLite serializer for |
|
runtime: stage, settings, scopes, pipeline, reports |
|
per-frame clash record |
|
clash record |
|
query model |
|
enum |
|
enum |
|
point-cloud settings record |
|
settings-key enum |
These submodules keep Kit’s import paths. Each one exposes the Suite API names in its row and lists
exactly those names in __all__. Only the two export functions are wrappers.
Module |
Exports |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clash_data_serializer_directory exports ClashDataSerializerDirectory in the same way. Kit
has no such module.
These modules are implemented in the package rather than forwarded:
config.ExtensionConfigkeeps Kit’s class attributes and defaults:Field
Type
Required
Default or values
Description
debug_logging,debug_logging_detailedboolNo
FalseKit’s logging switches. Nothing here reads them.
extension_pathstrorNoneNo
NoneKit sets it at extension startup; nothing sets it here.
update_clash_states_after_detectionboolNo
TrueWhether fetch-and-save updates the stored clash states. A class-level property that reads and writes
ovclash_suite._runtime.update_clash_states_after_detection, so both spellings share one flag; assignment storesbool(value). Read and set it on the class. Unlike Kit’s attribute, it is not visible on an instance.logger.Loggerhas no Kit counterpart. Itslog_error,log_warnandlog_infoclass methods write to the standard-library logger namedovclash_suite, whichovclash_suitealso uses. Theutilsandusd_utilshelpers log there where Kit’s code callscarb.log_*, the logging functions of Kit’s Carbonite framework.utilsprovides every Kit helper.make_int128andhtml_escapeare the Suite API’s own functions.get_available_system_memory()reads the operating system instead of Kit’somni.gpu_foundation_factoryextension. Like Kit, it returns0when it cannot tell.measure_execution_timereturns the function’s result but prints nothing. Kit prints each call’s duration.
usd_utilskeeps Kit’s four matrix helpers, which need no OpenUSD:matrix_to_list,list_to_matrix,serialize_matrix_to_jsonanddeserialize_matrix_from_json.list_to_matrixanddeserialize_matrix_from_jsonreturn a tuple of four float tuples where Kit returnsGf.Matrix4d, the 4x4 matrix type of OpenUSD in Python. The OpenUSD-dependent helpers are stubs; see What does not.
The forwarded names are the Suite API’s own objects, so the ovclash_suite docstrings document
them. The docstrings of the four modules config, logger, utils and usd_utils, in the
installed omni.physxclashdetectioncore package, are their reference.
References in the package says how to read the
docstrings.
What does not#
The Kit API in the Missing API table of this section does not resolve. Apart from
ExtensionConfig at the package root, each gap is structural. It needs one of these, which this package does not have:
Kit itself;
Python OpenUSD (
pxr) or Warp, which this package does not require;a C ABI entry point that the native layer does not expose.
None of it is a defect to fix in place. Closing a gap means adding that dependency or that entry point.
Missing API |
Why |
|---|---|
Modules |
Absent as whole modules, so importing one raises |
|
Kit’s package |
|
Handles to the USD stage and layer that Kit binds the data to. There is no Python OpenUSD stage object here, so |
|
SQLite maintenance. Kit runs these on a |
|
Kit’s flag that SQLite reported the file as corrupt or as not a database. Kit sets it from the result codes of the |
|
Kit’s constructor argument that selects the Warp device for the frame’s default (empty) arrays. Frame arrays here are |
These names are deliberately absent rather than present-and-raising. Code that feature-detects
with hasattr sees that they are missing and can take its fallback path.
The OpenUSD-dependent helpers in usd_utils are the exception: get_prim_children_paths,
get_list_of_prim_paths, get_prim_matrix, are_points_prim_widths_animated and
get_points_prim_widths_array. They keep Kit’s signatures, log an error and raise
NotImplementedError. A Kit caller therefore gets that error instead of a TypeError.
For a prim transform, call ClashDetection.open_stage() and then
ClashDetection.get_prim_matrix(), which the C ABI backs. Two details differ from Kit’s helper:
It takes a USD time code, where Kit’s helper takes seconds.
It returns a NumPy array, or a tuple of four row tuples when NumPy is not installed. Kit’s helper returns
Gf.Matrix4d.
Behavioral differences to check#
A stage argument names a file. ClashDetection.set_settings() and set_scope() accept a
file path, a pathlib.Path or a stage object.
From a stage object they take the file path of its root layer, and the native layer opens that file. Unsaved edits in a Python
Usd.Stageare therefore not seen.A
stageargument that names the file already open, in any spelling, does not reopen it. Edits saved after the first open are not seen either. To see them, callClashDetection.open_stage()with the file path, then callset_scope()again: a successful open clears the scope.set_settings()reads the timeline (start and end time codes, time codes per second) from the stage object itself. The run’s time range therefore follows unsaved timeline edits.The other methods that take Kit’s
stageargument, such asfetch_and_save_overlaps()andprocess_overlap(), ignore it.
Scopes take literal prim paths.
ClashDetection.set_scope()does not expand a USD collection path to its member prims, as Kit’s does.get_list_of_prims_int_paths()ignores itsadd_prim_children,prim_accept_fnandexclude_invisiblearguments; the native run settings control visibility. It returns the prim paths as strings, not asSdf.Pathobjects.
Some parameters differ. Ported calls to these methods need edits:
ClashData.open()takes the store’s file path, where Kit’s takes a stage id, Kit’s integer handle of an open stage. It has noforce_reload_layerparameter.ClashData.save_as()takes the store’s new path. Kit’ssave_as()takes the stage’s new USD path, saves the store in place and saves the clash layer for that stage path. A portedsave_as("scene.usd")therefore writes an SQLite store namedscene.usd. It raisesRuntimeErrorwhen that file already holds a USD layer.ClashFrameInfo()has nodeviceparameter, so each parameter afterobject_1_matrixsits one position earlier than in Kit. A Kit call that passesdeviceby position stores it inusd_points_0without an error. Pass the arguments afterobject_1_matrixby keyword.Some parameters have new names, which the
Kit nameandName herecolumns of the method table give. A Kit call that passes one by keyword raisesTypeError.
Method |
Kit name |
Name here |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ClashDataSerializerDirectory uses the new point-cloud parameter names too. ClashData and
AbstractClashDataSerializer keep Kit’s names.
A ported detect-and-store flow, with the edits these rules require. It runs on
time_sampled.usda, the sample stage in samples/data/ of the installed ovclash package and of
the SDK archive. Run it from that directory, or pass the stage’s full path:
from contextlib import closing
from omni.physxclashdetectioncore.clash_data import ClashData
from omni.physxclashdetectioncore.clash_detect import ClashDetection
from omni.physxclashdetectioncore.clash_query import ClashQuery
query = ClashQuery(
query_name="Cube vs Plane",
object_a_path="/Root/Xform_Primitives/Cube",
object_b_path="/Root/Xform_Primitives/Plane",
)
data = ClashData() # SQLite serializer by default
data.open("results.ovclashdb") # Kit: data.open(stage_id)
data.insert_query(query)
clash = ClashDetection()
try:
# A `stage` argument names the file the native layer opens.
clash.set_settings(query.clash_detect_settings, "time_sampled.usda")
clash.set_scope("time_sampled.usda", query.object_a_path, query.object_b_path)
clash.run_pipeline()
# The generator reserves the runtime and the store until it is exhausted or closed.
with closing(clash.fetch_and_save_overlaps(None, data, query)) as fetch:
for progress in fetch:
pass
print("stored overlaps:", data.get_overlaps_count_by_query_id(query.identifier))
finally:
clash.destroy()
data.close()
stored overlaps: 1
Export rejects ragged rows and selects cells by column order.
export_to_jsonandexport_to_htmlraiseValueErrorfor a row whose length differs from the column count.In both formats, each column renders the cell that its
orderselects.Kit’s
export_to_jsonwrites each row as given. The cells of a JSON row therefore differ from Kit’s whenever a column’sorderdiffers from its index.
See Export.
Native failures raise. A failed native call normally raises an exception that carries the
native error text. Kit often logs the error and returns False, 0 or None instead; its
SQLite serializer, for example, logs every SQLite error and carries on. The data and serializer
classes keep Kit’s return values in a few cases, such as a store that is not open.
Failures that do not raise lists them.
Unchanged approvals survive re-detection. ExtensionConfig.update_clash_states_after_detection
defaults to True. With it set, Kit sets every re-detected clash to ACTIVE. ovclash keeps a
clash APPROVED when its detected contents are exactly unchanged.
Clash states gives every state rule and what the comparison
covers.
To preserve all stored states, clear the flag before the fetch starts:
from omni.physxclashdetectioncore.config import ExtensionConfig
ExtensionConfig.update_clash_states_after_detection = False
The fetch generator holds its owners. fetch_and_save_overlaps() returns a generator. It
reserves its runtime and store until it is exhausted or closed, even after its final progress
value.
Until then, the runtime and a built-in store reject conflicting calls, such as closing the store.
A custom serializer must guard its own store.
Close a generator that you stop early, for example with
contextlib.closing, as the ported detect-and-store flow in Behavioral differences to check does.
See fetch and cursor lifetime.
Custom serializers need fetch_transaction. A Kit-style serializer that implements only the
CRUD methods cannot receive fetched results: the fetch raises NotImplementedError before it
starts. Override fetch_transaction(). The contract is in
Custom stores.