Advertisement
vizrtexample

NoggiContainerCropper

Mar 25th, 2025 (edited)
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim containers as Array[container]
  2.  
  3. Sub OnInitParameters()
  4.     RegisterParameterBool("edit", "Edit Parameters", False)
  5.     RegisterParameterContainer("Container", "Root Container")
  6.     RegisterParameterString("cName", "Find Containers by Name", "", 32, 100, "")
  7.     RegisterParameterBool("doCrop", "Crop", False)
  8.     RegisterParameterDouble("crop_left", "Left Crop Face", - 50, - 10000, 10000)
  9.     RegisterParameterDouble("crop_right", "Right Crop Face", 50, - 10000, 10000)
  10.     RegisterParameterDouble("crop_bottom", "Bottom Crop Face", - 50, - 10000, 10000)
  11.     RegisterParameterDouble("crop_top", "Top Crop Face", 50, - 10000, 10000)
  12. End Sub
  13.  
  14. Sub OnParameterChanged(parameterName As String)
  15.    
  16.     Dim c = GetParameterContainer("Container")
  17.     If Not c.Valid Then
  18.         c = this
  19.     End If
  20.     c.GetContainerAndSubContainers(containers, False)
  21.  
  22.     If GetParameterBool("edit") Then
  23.         For i = 0 To containers.UBound
  24.             Dim plugin As PluginInstance = containers[i].Geometry.PluginInstance
  25.             If plugin.PluginName = "Noggi" And containers[i].Name = GetParameterString("cName") Then
  26.                 Select Case parameterName
  27.                     Case "doCrop"
  28.                         plugin.SetParameterBool("doCrop", GetParameterBool("doCrop"))
  29.                     Case "crop_left"
  30.                         plugin.SetParameterDouble("crop_left", GetParameterDouble("crop_left"))
  31.                     Case "crop_right"
  32.                         plugin.SetParameterDouble("crop_right", GetParameterDouble("crop_right"))
  33.                     Case "crop_bottom"
  34.                         plugin.SetParameterDouble("crop_bottom", GetParameterDouble("crop_bottom"))
  35.                     Case "crop_top"
  36.                         plugin.SetParameterDouble("crop_top", GetParameterDouble("crop_top"))
  37.                 End Select
  38.             End If
  39.         Next
  40.     End If
  41. End Sub
  42.  
  43. Sub OnGuiStatus()
  44.     Select Case GetParameterBool("edit")
  45.         Case True
  46.             SendGuiParameterShow("Container", SHOW)
  47.             SendGuiParameterShow("cName", SHOW)
  48.             SendGuiParameterShow("doCrop", SHOW)
  49.             SendGuiParameterShow("crop_left", SHOW)
  50.             SendGuiParameterShow("crop_right", SHOW)
  51.             SendGuiParameterShow("crop_bottom", SHOW)
  52.             SendGuiParameterShow("crop_top", SHOW)
  53.         Case False
  54.             SendGuiParameterShow("Container", HIDE)
  55.             SendGuiParameterShow("cName", HIDE)
  56.             SendGuiParameterShow("doCrop", HIDE)
  57.             SendGuiParameterShow("crop_left", HIDE)
  58.             SendGuiParameterShow("crop_right", HIDE)
  59.             SendGuiParameterShow("crop_bottom", HIDE)
  60.             SendGuiParameterShow("crop_top", HIDE)
  61.     End Select
  62. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement