v1.0
edit
オブジェクトを名前(SIObject.Name)で指定して削除します。 親ノードやモデルなど、階層のオブジェクトを削除する場合は特別なルールに従う必要があります。 階層全体を削除するには、ブランチ削除を行う必要があります。InputObj 引数で「B:」プリフィックスを使用するか、まずターゲットをブランチ選択してから、InputObj 引数を空のままにします。 これらの方法の詳しい説明については、Python の例を参照してください。
DeleteObj( [InputObj] ); |
' ' Simple example of how to delete a scene object. ' GetPrim "Null" DeleteObj "Null" |
/* This example demonstrates how to delete a custom property from the scene. */ // Quick setup: custom property set on a torus NewScene( null, false ); CreatePrim( "Torus", "MeshSurface", "InnerTube" ); AddProp( "Custom_parameter_list", "", "", "Buoyancy" ); SIAddCustomParameter( "InnerTube.Buoyancy", "Sideways", siDouble, 0, 0, 1, null, 5, 0, 1 ); SIAddCustomParameter( "InnerTube.Buoyancy", "Active", siBool, 0, 0, 1, null, 5, 0, 1 ); // Inspect the property set modally, then delete it if the user presses Cancel var canceled = false; while ( !canceled ) { canceled = InspectObj( "InnerTube.Buoyancy", "", "Buoyancy Settings", siModal, false ); } // Deleting the property set completely removes it from the scene DeleteObj( "InnerTube.Buoyancy" ); |
# # This example shows how to delete a model. # app = Application from win32com.client import constants as cns app.NewScene("", 0); # First create 2 simple models containing a sphere and a disc (respectively) sph = app.CreatePrim("Sphere", "MeshSurface") mdl1 = app.CreateModel(sph, "MySphModel")(0) sph = app.CreatePrim("Disc", "MeshSurface") mdl2 = app.CreateModel(sph, "MyDscModel")(0) app.LogMessage(app.ActiveSceneRoot.Models.GetAsText()) # INFO : MySphModel,MyDscModel # Try deleting it without any special selection mode app.SelectObj(mdl1.Name) app.DeleteObj() app.LogMessage(app.ActiveSceneRoot.Models.GetAsText()) # INFO : MySphModel,MyDscModel # The command failed because it wasn't selected in branch # Now delete it in branch. Models must be branch-selected when deleting app.SelectObj(mdl1.Name, "BRANCH") app.DeleteObj() app.LogMessage(app.ActiveSceneRoot.Models.GetAsText()) # INFO : MyDscModel # Try the "B:" prefix without any selection mode for the second model app.DeselectAll() app.DeleteObj("B:"+mdl2.Name) app.LogMessage(app.ActiveSceneRoot.Models.GetAsText()) # INFO : |