# menuInfo fundza,Crackle#0 float Crackle /Float
  
slim 1 extensions cutter {
extensions fundza cutr {
    template multiple Crackle {
        description {
            Description of the node goes here.
            }
        previewinfo {
            shadingrate 1
            objectsize 1
            objectshape Sphere
            frame 1
            }
        #__custom parameters Begin____________
  
        parameter color col_var1 {
            label "Color 1"
            description "No description."
            default {0.486 0.671 0.446}
            detail varying
            }
  
        parameter color col_var2 {
            label "Color 2"
            description "No description."
            default {0.029 0.040 0.033}
            detail varying
            }
        
        # connect a node inside
        # pararmeter -> float -> inline
        parameter float worl_input {
            label "Worley"
            description "No description."
            detail mustvary "pixar,Worley" inline
            # define parameters when interface is created
            msghandler {
               CreateConnection {
                   set thisParam %obj
                   set thisNode [$thisParam GetAppearance]
                   set connectedNode [$thisParam GetConnectedFunction]
                    # set parameters here
                    # look for actual parameter names in 
                    # lib/slim/floats.slim
                   set freqParam [$connectedNode GetProperties -name frequency]
                   $freqParam SetValue 8
                   set jitterParam [$connectedNode GetProperties -name jitter]
                   $jitterParam SetValue 2            
                   set c1Param [$connectedNode GetProperties -name c1]
                   $c1Param SetValue 1.15        
                   set c2Param [$connectedNode GetProperties -name c2]
                   $c2Param SetValue -1.06                
                   $thisNode UpdateEditor
                  }
              }
            }
    
        parameter float mult {
            label "Worly Multiplier"
            description "No description."
            subtype slider
            range {0 1}
            detail varying
            default 0.35
            }
        parameter float contrast {
            label "Worley Contrast"
            description "No description."
            subtype slider
            range {0 5}
            detail varying
            default 2.11
            }
  
        # turbulance as bump
        parameter float turb_input {
            label "Bump"
            description "No description."
            detail mustvary "pixar,Turbulence" inline
            # define default size
            msghandler {
                CreateConnection {
                    set thisParam %obj
                    set thisNode [$thisParam GetAppearance]
                    set connectedNode [$thisParam GetConnectedFunction]
                    set baseFrequencyParam [$connectedNode GetProperties -name baseFrequency]
                    $baseFrequencyParam SetValue 75
                    $thisNode UpdateEditor
                    }
                }
            }
  
        #__custom parameters End______________
  
        parameter color result {
            label "Color Pattern Output"
            access output
            display hidden
            }
        parameter color result_base_color {
            label "Base Color"
            access output
            display hidden
        }
        parameter float result_pattern {
            label "Pattern"
            access output
            display hidden
        }
        parameter float result_noise {
            label "Bump Output"
            access output
            display hidden
        }
            
        RSLFunction {
        void cutrCrackle (
            //parameter vars goes here...
            //
            color col_var1;
            color col_var2;
            float worl_input;
            float mult;
            float contrast;
            float turb_input;
            output color result;
            output color result_base_color;
            output float result_pattern;
            output float result_noise;
            )
        {
        
        // from SLBox node:
        float mask = pow(worl_input, mult);
        mask *= contrast; 
        // a = a * b
        // a *= b
        // the same but shorter
        
        // mix returns a color value
        // mix(input1, input2, mask)
        result = mix(col_var1, col_var2, mask);
        result_base_color = col_var1;
        result_pattern = worl_input;
        result_noise = turb_input;
        }
    }
}
}}