so lets say i have a script called Make_A_Pointless_Cube.py
and that script contains the code
import sys
import omni.usd
import omni.kit.commands
from pxr import Usd, UsdGeom, Sdf,UsdShade
#----------------------------------------------------------------------
def Make_Pointless_Cube(fp) -> None:
""" """
stage = omni.usd.get_context().open_stage(fp)
df_prim:Usd.Prim = stage.GetDefaultPrim()
omni.kit.commands.execute('CreateMeshPrimWithDefaultXform',
prim_type='Cube',
prim_path=df_prim.GetPath().AppendChild("Pointless_Cube").pathString)
omni.usd.get_context().save_stage()
if __name__ == "__main__":
fp = sys.argv[1]
Make_Pointless_Cube(fp)
and every time i finish a project for a client i deliver 20 to 30 usd files.
but the client has requested that they would like a pointless cube in all the finale deliveries.
but not in the working files.
now i have a script that scans a directory finds all the usd files and runs the
Make_A_Pointless_Cube.py file on them.
i have tried
kit.exe --exec "C:\code_stuff\scripts\do_pointless_stuff.py"
kit.exe --exec "C:\code_stuff\scripts\Make_A_Pointless_Cube.py" A_Usd_file.usd
but when ever i run it one of 3 things happens
[Error] [omni.kit.app.plugin] [py stderr]: ImportError: DLL load failed: The specified module could not be found.
[Error] [omni.kit.app.plugin] [py stderr]: ModuleNotFoundError: No module named ‘omni.usd’
or it just crashes.
the code is much more complex than that but i wanted to keep the concept simple
im also looking to see if this could be executed from within Maya after a usd export