Skip to content

Instantly share code, notes, and snippets.

@andybak
Created July 16, 2021 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andybak/75d667d57672bebeec871c6adb853983 to your computer and use it in GitHub Desktop.
Save andybak/75d667d57672bebeec871c6adb853983 to your computer and use it in GitHub Desktop.
public void TestImport(string filename, Vector3 position, Quaternion rotation)
{
path = Path.Combine(App.MediaLibraryPath(), "Models", path);
var model = new Model(Model.Location.File(path));
model.LoadModel();
var tr = new TrTransform();
tr.translation = position;
tr.rotation = rotation;
CreateWidgetCommand createCommand = new CreateWidgetCommand(
WidgetManager.m_Instance.ModelWidgetPrefab, tr);
SketchMemoryScript.m_Instance.PerformAndRecordCommand(createCommand);
ModelWidget modelWidget = createCommand.Widget as ModelWidget;
modelWidget.Model = model;
modelWidget.Show(true);
createCommand.SetWidgetCost(modelWidget.GetTiltMeterCost());
WidgetManager.m_Instance.WidgetsDormant = false;
SketchControlsScript.m_Instance.EatGazeObjectInput();
SelectionManager.m_Instance.RemoveFromSelection(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment