Advertisement
vizrtexample

NoggiParameterReplicator

Jun 29th, 2025 (edited)
464
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim containers as Array[container]
  2. Dim filters As Array[String]
  3. filters.Push("All")
  4. filters.Push("by Name")
  5.  
  6. Sub OnInitParameters()
  7.     RegisterParameterBool("edit", "Edit Parameters", False)
  8.     RegisterParameterContainer("Container", "Root Container")
  9.     RegisterRadioButton("filter", "Find Noggi", 0, filters)
  10.     RegisterParameterString("cName", "Name", "", 32, 100, "")
  11.     RegisterParameterDouble("width", "Width", 100, 0, 10000)
  12.     RegisterParameterDouble("height", "Height", 100, 0, 10000)
  13.     RegisterParameterBool("doCrop", "Crop", False)
  14.     RegisterParameterDouble("crop_left", "Left Crop Face", -50, -10000, 10000)
  15.     RegisterParameterDouble("crop_right", "Right Crop Face", 50, -10000, 10000)
  16.     RegisterParameterDouble("crop_bottom", "Bottom Crop Face", -50, -10000, 10000)
  17.     RegisterParameterDouble("crop_top", "Top Crop Face", 50, -10000, 10000)
  18. End Sub
  19.  
  20. Sub OnParameterChanged(parameterName As String)
  21.     Dim c = GetParameterContainer("Container")
  22.     If Not c.Valid Then
  23.         c = this
  24.     End If
  25.     c.GetContainerAndSubContainers(containers, False)
  26.  
  27.     If GetParameterBool("edit") Then
  28.         Dim filterType = GetParameterInt("filter")
  29.         For i = 0 To containers.UBound
  30.             Dim plugin As PluginInstance = containers[i].Geometry.PluginInstance
  31.             If plugin.Valid Then
  32.                 Select Case filterType
  33.                     Case 0 ' All
  34.                        If plugin.PluginName = "Noggi" Then
  35.                             ApplyPluginChanges(plugin, parameterName)
  36.                         End If
  37.                     Case 1 ' by Name
  38.                        If plugin.PluginName = "Noggi" And containers[i].name = GetParameterString("cName") Then
  39.                             ApplyPluginChanges(plugin, parameterName)
  40.                         End If
  41.                 End Select
  42.             End If
  43.         Next
  44.     End If
  45. End Sub
  46.  
  47. Sub ApplyPluginChanges(plugin As PluginInstance, parameterName As String)
  48.     Select Case parameterName
  49.         Case "width"
  50.             plugin.SetParameterDouble("width", GetParameterDouble("width"))
  51.         Case "height"
  52.             plugin.SetParameterDouble("height", GetParameterDouble("height"))
  53.         Case "doCrop"
  54.             plugin.SetParameterBool("doCrop", GetParameterBool("doCrop"))
  55.         Case "crop_left"
  56.             plugin.SetParameterDouble("crop_left", GetParameterDouble("crop_left"))
  57.         Case "crop_right"
  58.             plugin.SetParameterDouble("crop_right", GetParameterDouble("crop_right"))
  59.         Case "crop_bottom"
  60.             plugin.SetParameterDouble("crop_bottom", GetParameterDouble("crop_bottom"))
  61.         Case "crop_top"
  62.             plugin.SetParameterDouble("crop_top", GetParameterDouble("crop_top"))
  63.     End Select
  64. End Sub
  65.  
  66. Sub OnGuiStatus()
  67.     Select Case GetParameterBool("edit")
  68.         Case True
  69.             If GetParameterInt("filter") = 1 Then
  70.                 SendGuiParameterShow("cName", SHOW)
  71.             Else
  72.                 SendGuiParameterShow("cName", HIDE)
  73.             End If
  74.             SendGuiParameterShow("Container", SHOW)
  75.             SendGuiParameterShow("filter", SHOW)
  76.             SendGuiParameterShow("height", SHOW)
  77.             SendGuiParameterShow("width", SHOW)
  78.             SendGuiParameterShow("doCrop", SHOW)
  79.             SendGuiParameterShow("crop_left", SHOW)
  80.             SendGuiParameterShow("crop_right", SHOW)
  81.             SendGuiParameterShow("crop_bottom", SHOW)
  82.             SendGuiParameterShow("crop_top", SHOW)
  83.         Case False
  84.             SendGuiParameterShow("Container", HIDE)
  85.             SendGuiParameterShow("filter", HIDE)
  86.             SendGuiParameterShow("width", HIDE)
  87.             SendGuiParameterShow("height", HIDE)
  88.             SendGuiParameterShow("cName", HIDE)
  89.             SendGuiParameterShow("doCrop", HIDE)
  90.             SendGuiParameterShow("crop_left", HIDE)
  91.             SendGuiParameterShow("crop_right", HIDE)
  92.             SendGuiParameterShow("crop_bottom", HIDE)
  93.             SendGuiParameterShow("crop_top", HIDE)
  94.     End Select
  95. End Sub
  96.  
Advertisement
Comments
  • vizrtexample
    5 hours
    # text 0.15 KB | 0 0
    1. Sample scene with alternative methods using the "Datapool" plugin or scripting
    2. https://mega.nz/file/BrJiHRiZ#3rU24HzIbGE3C5AFeo-j3Z2EAoHiPYLyyPTqXIY9cjQ
Add Comment
Please, Sign In to add comment
Advertisement