factory
get_state_dependency_graph(states=None)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
states
|
None or Iterable
|
If specified, specific state(s) to sort. Otherwise, will generate dependency graph over all states |
None
|
Returns:
| Type | Description |
|---|---|
DiGraph
|
State dependency graph of supported object states |
Source code in OmniGibson/omnigibson/object_states/factory.py
get_states_and_params_for_ability(ability, params)
Enumerate the (state_type, params) pairs an @ability contributes, with the per-(ability, state) param transform (see @transform_ability_params_for_state) applied to each.
Both object hydration (USDObject) and asset model-validation
(get_all_object_category_models_with_abilities) must instantiate an ability's states with the
SAME kwargs, otherwise a model can pass one path and fail the other. They therefore share this
helper so the two never drift apart -- e.g. flammable injects requires_on_fire=True into
HeatSourceOrSink, which flips its meta-link requirement; without the transform, validation
would demand a heatsource meta link that hydration does not.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ability
|
str
|
Ability name |
required |
params
|
dict
|
Raw ability params |
required |
Returns:
| Type | Description |
|---|---|
list of (type, dict
|
(state_type, transformed_params) for each state @ability contributes |
Source code in OmniGibson/omnigibson/object_states/factory.py
get_states_by_dependency_order(states=None)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
states
|
None or Iterable
|
If specified, specific state(s) to sort. Otherwise, will generate dependency graph over all states |
None
|
Returns:
| Type | Description |
|---|---|
list
|
all states in topological order of dependency |
Source code in OmniGibson/omnigibson/object_states/factory.py
transform_ability_params_for_state(ability, state_type, params)
Applies the per-(ability, state) kwarg transform (if any) to @params.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ability
|
str
|
Ability name |
required |
state_type
|
type
|
Object state class being hydrated from @ability's params |
required |
params
|
dict
|
Raw ability params |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Transformed copy of @params |