get_stage_next_free_path

omni.usd.get_stage_next_free_path(stage: Stage, path: Union[str, Path], prepend_default_prim: bool)

Gets a new prim path that doesn’t exist in the stage given a base path. If the given path doesn’t exist in the stage already, it returns the given path directly. Otherwise, it appends a suffix with number index to the given path until it finds a path that’s not taken.

Parameters
  • stage (Usd.Stage) – The stage handle.

  • path (Union[str, Sdf.Path]) – Base prim path.

  • prepend_default_prim (bool) – Whether it should prepend default prim name to the path or not.

Raises

ValueError – Path is not a valid prim path.

Returns

prim path that doesn’t exist in the stage.

Return type

str