BandpassMixer::BandpassMixer( char* instance_name, PracSimModel* outer_model, Signal< float >* in_sig_1, Signal< float >* in_sig_2, Signal< float >* out_sig ) :PracSimModel(instance_name, outer_model) { MODEL_NAME(BandpassMixer); //----------------------------------------- // Read model config parms //OPEN_PARM_BLOCK; //-------------------------------------- // Connect input and output signals Out_Sig = out_sig; In_Sig_1 = in_sig_1; In_Sig_2 = in_sig_2; MAKE_OUTPUT( Out_Sig ); MAKE_INPUT( In_Sig_1 ); MAKE_INPUT( In_Sig_2 ); }
MStatus liqCoordSysNode::initialize() { MFnEnumAttribute eAttr; MFnNumericAttribute numAttr; MStatus status; aCoordType = eAttr.create( "type", "t", 0, &status ); eAttr.addField( "Card", 0 ); eAttr.addField( "Sphere", 1 ); eAttr.addField( "Cylinder", 2 ); eAttr.addField( "Cube", 3 ); eAttr.addField( "Deep Card", 4 ); eAttr.addField( "Clipping Plane", 5 ); MAKE_INPUT(eAttr); CHECK_MSTATUS(eAttr.setConnectable(false)); CHECK_MSTATUS( addAttribute( aCoordType ) ); aCoordColor = numAttr.createColor( "coordColor", "cc", &status ); MAKE_INPUT(numAttr); CHECK_MSTATUS( numAttr.setMin( 0.0, 0.0, 0.0 ) ); CHECK_MSTATUS( numAttr.setMax( 1.0, 1.0, 1.0 ) ); CHECK_MSTATUS( numAttr.setDefault( 0.0, 0.0, 0.5) ); CHECK_MSTATUS( addAttribute( aCoordColor ) ); aCoordOpacity = numAttr.create( "coordOpacity", "co", MFnNumericData::kFloat, 0.0, &status ); MAKE_INPUT(numAttr); CHECK_MSTATUS( numAttr.setMin( 0.0 ) ); CHECK_MSTATUS( numAttr.setMax( 1.0 ) ); CHECK_MSTATUS( addAttribute( aCoordOpacity ) ); return MS::kSuccess; }
// // DESCRIPTION: /////////////////////////////////////////////////////// MStatus Gamma::initialize() { MFnNumericAttribute nAttr; // Input attributes aColor = nAttr.createColor( "color", "c" ); MAKE_INPUT(nAttr); aGamma = nAttr.createPoint( "gamma", "g" ); MAKE_INPUT(nAttr); CHECK_MSTATUS ( nAttr.setDefault(1.f, 1.f, 1.f) ); // Output attributes aOutColor= nAttr.createColor( "outColor", "oc" ); MAKE_OUTPUT(nAttr); // Add attributes to the node database. CHECK_MSTATUS ( addAttribute(aColor) ); CHECK_MSTATUS ( addAttribute(aGamma) ); CHECK_MSTATUS ( addAttribute(aOutColor) ); // All input affect the output color CHECK_MSTATUS ( attributeAffects( aColor, aOutColor )); CHECK_MSTATUS ( attributeAffects( aGamma, aOutColor )); return MS::kSuccess; }
// // DESCRIPTION: MStatus OSLNode::initialize() { MFnNumericAttribute nAttr; MFnTypedAttribute tAttr; MFnGenericAttribute gAttr; MFnEnumAttribute eAttr; MFnMessageAttribute mAttr; MStatus status; color = nAttr.createColor("color", "color"); MAKE_INPUT(nAttr); CHECK_MSTATUS(addAttribute( color )); script = tAttr.create("script", "script", MFnNumericData::kString); MAKE_INPUT(tAttr); CHECK_MSTATUS(addAttribute( script )); outColor = nAttr.createColor("outColor", "outColor"); MAKE_OUTPUT(nAttr); CHECK_MSTATUS(addAttribute( outColor )); //---------------------------- automatically created attributes start ------------------------------------ //---------------------------- automatically created attributes end ------------------------------------ attributeAffects(color, outColor); attributeAffects(script, outColor); return MS::kSuccess; }
//==================================================== SignalAnchor::SignalAnchor( char* instance_name, PracSimModel* outer_model, Signal<bit_t>* bit_signal, Signal<byte_t>* byte_signal ) :PracSimModel(instance_name, outer_model) { MODEL_NAME(SignalAnchor); int block_size; double samp_intvl; OPEN_PARM_BLOCK; GET_DOUBLE_PARM( samp_intvl ); GET_INT_PARM( block_size ); Bit_Signal = bit_signal; Byte_Signal = byte_signal; MAKE_INPUT(Bit_Signal); MAKE_INPUT(Byte_Signal); SET_SAMP_INTVL(Bit_Signal, samp_intvl); SET_BLOCK_SIZE(Bit_Signal, block_size); SET_SAMP_INTVL(Byte_Signal, samp_intvl); SET_BLOCK_SIZE(Byte_Signal, block_size); }
// initializes attribute information MStatus myComp::initialize() { MFnNumericAttribute nAttr; // Create input attributes aForegroundColor = nAttr.createColor("foreground", "fg"); MAKE_INPUT(nAttr); aBackgroundColor = nAttr.createColor("background", "bg"); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setDefault(1., 1., 1.)); aBackColor = nAttr.createColor("backColor", "bk"); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setDefault(1., 1., 1.)); aMask = nAttr.create( "mask", "ms", MFnNumericData::kFloat); CHECK_MSTATUS( nAttr.setMin(0.f)); CHECK_MSTATUS( nAttr.setMax(1.f)); MAKE_INPUT(nAttr); // Create output attributes here aOutColor = nAttr.createColor("outColor", "oc"); MAKE_OUTPUT(nAttr); aOutAlpha = nAttr.create( "outAlpha", "oa", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); // Add the attributes here CHECK_MSTATUS( addAttribute(aForegroundColor) ); CHECK_MSTATUS( addAttribute(aBackgroundColor) ); CHECK_MSTATUS( addAttribute(aBackColor) ); CHECK_MSTATUS( addAttribute(aMask) ); CHECK_MSTATUS( addAttribute(aOutColor) ); CHECK_MSTATUS( addAttribute(aOutAlpha) ); // all input affect the output color and alpha CHECK_MSTATUS( attributeAffects(aForegroundColor, aOutColor) ); CHECK_MSTATUS( attributeAffects(aForegroundColor, aOutAlpha) ); CHECK_MSTATUS( attributeAffects(aBackgroundColor, aOutColor) ); CHECK_MSTATUS( attributeAffects(aBackgroundColor, aOutAlpha) ); CHECK_MSTATUS( attributeAffects(aBackColor, aOutColor) ); CHECK_MSTATUS( attributeAffects(aBackColor, aOutAlpha) ); CHECK_MSTATUS( attributeAffects(aMask, aOutColor) ); CHECK_MSTATUS( attributeAffects(aMask, aOutAlpha) ); return MS::kSuccess; }
// // DESCRIPTION: /////////////////////////////////////////////////////// MStatus depthShader::initialize() { MFnNumericAttribute nAttr; // Create input attributes aColorNear = nAttr.createColor("color", "c"); MAKE_INPUT(nAttr); CHECK_MSTATUS(nAttr.setDefault(0., 1., 0.)); // Green aColorFar = nAttr.createColor("colorFar", "cf"); MAKE_INPUT(nAttr); CHECK_MSTATUS(nAttr.setDefault(0., 0., 1.)); // Blue aNear = nAttr.create("near", "n", MFnNumericData::kFloat); MAKE_INPUT(nAttr); CHECK_MSTATUS(nAttr.setMin(0.0f)); CHECK_MSTATUS(nAttr.setSoftMax(1000.0f)); aFar = nAttr.create("far", "f", MFnNumericData::kFloat); MAKE_INPUT(nAttr); CHECK_MSTATUS(nAttr.setMin(0.0f)); CHECK_MSTATUS(nAttr.setSoftMax(1000.0f)); CHECK_MSTATUS(nAttr.setDefault(2.0f)); aPointCamera = nAttr.createPoint("pointCamera", "p"); MAKE_INPUT(nAttr); CHECK_MSTATUS(nAttr.setHidden(true)); // Create output attributes aOutColor = nAttr.createColor("outColor", "oc"); MAKE_OUTPUT(nAttr); CHECK_MSTATUS(addAttribute(aColorNear)); CHECK_MSTATUS(addAttribute(aColorFar)); CHECK_MSTATUS(addAttribute(aNear) ); CHECK_MSTATUS(addAttribute(aFar)); CHECK_MSTATUS(addAttribute(aPointCamera)); CHECK_MSTATUS(addAttribute(aOutColor)); CHECK_MSTATUS(attributeAffects(aColorNear, aOutColor)); CHECK_MSTATUS(attributeAffects(aColorFar, aOutColor)); CHECK_MSTATUS(attributeAffects(aNear, aOutColor)); CHECK_MSTATUS(attributeAffects(aFar, aOutColor)); CHECK_MSTATUS(attributeAffects(aPointCamera, aOutColor)); return MS::kSuccess; }
ComplexVco::ComplexVco( char* instance_name, PracSimModel* outer_model, Signal<float>* in_sig, Signal< complex<float> >* out_sig) :PracSimModel(instance_name, outer_model) { MODEL_NAME(ComplexVco); //---------------------------------------- // Read model config parms OPEN_PARM_BLOCK; GET_DOUBLE_PARM(Freq_Lo_Hz); GET_DOUBLE_PARM(Freq_Hi_Hz); GET_FLOAT_PARM(Lo_Control_Val); GET_FLOAT_PARM(Hi_Control_Val); //------------------------------------- // Connect input and output signals In_Sig = in_sig; Out_Sig = out_sig; MAKE_OUTPUT( Out_Sig ); MAKE_INPUT( In_Sig ); //---------------------------------- // Compute derived parameters Hz_Per_Volt = (Freq_Hi_Hz - Freq_Lo_Hz)/(Hi_Control_Val - Lo_Control_Val); }
Upsampler< T >::Upsampler( char* instance_name, PracSimModel* outer_model, Signal<T>* in_signal, Signal<T>* out_signal ) :PracSimModel(instance_name, outer_model) { MODEL_NAME(Upsampler); ENABLE_MULTIRATE; // ActiveModel = this; //----------------------------------- // Read configuration parameters OPEN_PARM_BLOCK; GET_INT_PARM(Interp_Rate); //----------------------------------- // Signals In_Sig = in_signal; Out_Sig = out_signal; MAKE_OUTPUT( Out_Sig ); MAKE_INPUT( In_Sig ); CHANGE_RATE(In_Sig, Out_Sig, Interp_Rate); };
ContinuousDelayTester< T >::ContinuousDelayTester( char* instance_name, PracSimModel* outer_model, Signal<T>* in_signal, Signal<T>* out_signal, Control<float> *delay_value, Control<bool> *delay_change_enabled ) :PracSimModel(instance_name, outer_model) { MODEL_NAME(ContinuousDelayTester); //----------------------------------- // Signals In_Sig = in_signal; Out_Sig = out_signal; MAKE_OUTPUT( Out_Sig ); MAKE_INPUT( In_Sig ); //-------------------------------- // Controls Delay_Value = delay_value; Delay_Change_Enabled = delay_change_enabled; return; }
RateChanger< T >::RateChanger( char* instance_name, PracSimModel* outer_model, Signal<T>* in_signal, Signal<T>* out_signal ) :PracSimModel(instance_name, outer_model) { MODEL_NAME(RateChanger); ENABLE_MULTIRATE; ENABLE_CONST_INTERVAL; ActiveModel = this; //----------------------------------- // Read configuration parameters OPEN_PARM_BLOCK; GET_INT_PARM(Num_Sidelobes); GET_DOUBLE_PARM(Rate_Change_Factor); //----------------------------------- // Signals In_Sig = in_signal; Out_Sig = out_signal; MAKE_INPUT( In_Sig ); MAKE_OUTPUT( Out_Sig ); // one sample per bit at input CHANGE_RATE( In_Sig, Out_Sig, Rate_Change_Factor ); return; }
AnlgDirectFormFir::AnlgDirectFormFir( char* instance_name, PracSimModel* outer_model, Signal<float>* in_sig, Signal<float>* out_sig ) :PracSimModel(instance_name, outer_model) { In_Sig = in_sig; Out_Sig = out_sig; OPEN_PARM_BLOCK; GET_BOOL_PARM(Bypass_Enabled); GET_INT_PARM( Kind_Of_Filter_Resp ); GET_DOUBLE_PARM( Fixed_Gain ); if(Kind_Of_Filter_Resp == 3) { Coeff_Fname = new char[64]; strcpy(Coeff_Fname, "\0"); GET_STRING_PARM(Coeff_Fname); } MAKE_OUTPUT(Out_Sig); MAKE_INPUT(In_Sig); SAME_RATE(In_Sig, Out_Sig); }
YuleWalkerPsdEstim::YuleWalkerPsdEstim( char* instance_name, PracSimModel* outer_model, Signal<float>* in_sig ) :PracSimModel( instance_name, outer_model ) { MODEL_NAME(YuleWalkerPsdEstim); OPEN_PARM_BLOCK; GET_INT_PARM(Seg_Len); GET_INT_PARM(Ar_Order); GET_INT_PARM(Hold_Off); GET_INT_PARM(Num_Freq_Pts); Psd_File_Name = new char[64]; strcpy(Psd_File_Name, "\0"); GET_STRING_PARM(Psd_File_Name); GET_DOUBLE_PARM(Freq_Norm_Factor); GET_BOOL_PARM(Output_In_Decibels); GET_BOOL_PARM(Plot_Two_Sided); GET_BOOL_PARM(Halt_When_Completed); In_Sig = in_sig; MAKE_INPUT(In_Sig); Time_Seg = new double[Seg_Len]; Sample_Spectrum = new double[Seg_Len]; for(int is=0; is<Seg_Len; is++){ Sample_Spectrum[is] = 0.0; } Processing_Completed = false; }
QpskModulator::QpskModulator( char* instance_name, PracSimModel* outer_model, Signal<float>* i_in_sig, Signal<float>* q_in_sig, Signal< std::complex<float> >* cmpx_out_sig, Signal<float>* mag_out_sig, Signal<float>* phase_out_sig ) :PracSimModel(instance_name, outer_model) { MODEL_NAME(QpskModulator); //---------------------------------------- // Read model config parms OPEN_PARM_BLOCK; GET_DOUBLE_PARM(Phase_Unbal); GET_DOUBLE_PARM(Amp_Unbal); //GET_INT_PARM("block_size\0"); //GET_DOUBLE_PARM("samp_intvl\0"); //------------------------------------- // Connect input and output signals I_In_Sig = i_in_sig; Q_In_Sig = q_in_sig; Cmpx_Out_Sig = cmpx_out_sig; Mag_Out_Sig = mag_out_sig; Phase_Out_Sig = phase_out_sig; MAKE_OUTPUT( Cmpx_Out_Sig ); MAKE_OUTPUT( Mag_Out_Sig ); MAKE_OUTPUT( Phase_Out_Sig ); MAKE_INPUT( I_In_Sig ); MAKE_INPUT( Q_In_Sig ); //----------------------------------------- // Set up derived parms double phase_unbal_rad = PI * Phase_Unbal / 180.0; Real_Unbal = float(cos(phase_unbal_rad) * Amp_Unbal); Imag_Unbal = float(sin(phase_unbal_rad) * Amp_Unbal); }
QpskOptimalBitDemod::QpskOptimalBitDemod( char* instance_name, PracSimModel* outer_model, Signal< std::complex< float > >* in_sig, Signal< std::complex< float > >* carrier_ref_sig, Signal< bit_t >* symb_clock_in, Signal< bit_t >* i_decis_out, Signal< bit_t >* q_decis_out ) :PracSimModel(instance_name, outer_model) { MODEL_NAME(QpskOptimalBitDemod); ENABLE_MULTIRATE; //----------------------------------------- // Read model config parms OPEN_PARM_BLOCK; GET_INT_PARM(Samps_Per_Symb); GET_BOOL_PARM(Constel_Offset_Enabled); //-------------------------------------- // Connect input and output signals I_Decis_Out = i_decis_out; Q_Decis_Out = q_decis_out; Symb_Clock_In = symb_clock_in; Carrier_Ref_Sig = carrier_ref_sig; In_Sig = in_sig; MAKE_OUTPUT( I_Decis_Out ); MAKE_OUTPUT( Q_Decis_Out ); MAKE_INPUT( Symb_Clock_In ); MAKE_INPUT( Carrier_Ref_Sig ); MAKE_INPUT( In_Sig ); double resamp_rate = 1.0/double(Samps_Per_Symb); CHANGE_RATE( In_Sig, I_Decis_Out, resamp_rate ); CHANGE_RATE( In_Sig, Q_Decis_Out, resamp_rate ); CHANGE_RATE( Carrier_Ref_Sig, I_Decis_Out, resamp_rate ); CHANGE_RATE( Carrier_Ref_Sig, Q_Decis_Out, resamp_rate ); CHANGE_RATE( Symb_Clock_In, I_Decis_Out, resamp_rate ); }
// // DESCRIPTION: /////////////////////////////////////////////////////// MStatus MixtureNode::initialize() { MFnNumericAttribute nAttr; // Input attributes aColor1 = nAttr.createColor( "color1", "c1" ); MAKE_INPUT(nAttr); CHECK_MSTATUS ( nAttr.setDefault(0.0f, 1.0f, 0.0f) ); // Green aColor2 = nAttr.createColor( "color2", "c2" ); MAKE_INPUT(nAttr); CHECK_MSTATUS ( nAttr.setDefault(0.0f, 0.0f, 1.0f) ); // Blue aAlphaInput1= nAttr.createColor( "mask1", "m1" ); MAKE_INPUT(nAttr); CHECK_MSTATUS ( nAttr.setDefault(.5f, .5f, .5f) ); aAlphaInput2= nAttr.createColor( "mask2", "m2" ); MAKE_INPUT(nAttr); CHECK_MSTATUS ( nAttr.setDefault(.5f, .5f, .5f) ); // Output attributes aOutColor = nAttr.createColor( "outColor", "oc" ); MAKE_OUTPUT(nAttr); // Add attributes to the node database. CHECK_MSTATUS ( addAttribute(aColor1) ); CHECK_MSTATUS ( addAttribute(aColor2) ); CHECK_MSTATUS ( addAttribute(aAlphaInput1) ); CHECK_MSTATUS ( addAttribute(aAlphaInput2) ); CHECK_MSTATUS ( addAttribute(aOutColor) ); // All input affect the output color CHECK_MSTATUS ( attributeAffects(aColor1, aOutColor) ); CHECK_MSTATUS ( attributeAffects(aColor2, aOutColor) ); CHECK_MSTATUS ( attributeAffects(aAlphaInput1, aOutColor) ); CHECK_MSTATUS ( attributeAffects(aAlphaInput2, aOutColor) ); return MS::kSuccess; }
//==================================================== // Dual integer signals SignalAnchor::SignalAnchor( char* instance_name, PracSimModel* outer_model, Signal<int>* int_signal, Signal<int>* int_signal_2, double samp_intvl, int block_size ) :PracSimModel(instance_name, outer_model) { Int_Signal = int_signal; Int_Signal_2 = int_signal_2; MAKE_INPUT(Int_Signal); MAKE_INPUT(Int_Signal_2); SET_SAMP_INTVL(Int_Signal, samp_intvl); SET_BLOCK_SIZE(Int_Signal, block_size); SET_SAMP_INTVL(Int_Signal_2, samp_intvl); SET_BLOCK_SIZE(Int_Signal_2, block_size); }
//==================================================== // Dual float signal SignalAnchor::SignalAnchor( char* instance_name, PracSimModel* outer_model, Signal<float>* float_signal, Signal<float>* float_signal_2, double samp_intvl, int block_size ) :PracSimModel(instance_name, outer_model) { MODEL_NAME(SignalAnchor); Float_Signal = float_signal; Float_Signal_2 = float_signal_2; MAKE_INPUT(Float_Signal); MAKE_INPUT(Float_Signal_2); SET_SAMP_INTVL(Float_Signal, samp_intvl); SET_BLOCK_SIZE(Float_Signal, block_size); SET_SAMP_INTVL(Float_Signal_2, samp_intvl); SET_BLOCK_SIZE(Float_Signal_2, block_size); }
//==================================================== SignalAnchor::SignalAnchor( char* instance_name, PracSimModel* outer_model, Signal<bit_t>* bit_signal, double samp_intvl, int block_size ) :PracSimModel(instance_name, outer_model) { Bit_Signal = bit_signal; MAKE_INPUT(Bit_Signal); SET_SAMP_INTVL(Bit_Signal, samp_intvl); SET_BLOCK_SIZE(Bit_Signal, block_size); }
MStatus liqRibRequestNode::initialize() { MFnTypedAttribute tAttr; MStatus status; aPreFrame = tAttr.create( MString( "preFrame" ), MString( "preF" ), MFnData::kString, aPreFrame, &status ); MAKE_INPUT(tAttr); aPreWorld = tAttr.create( MString( "preWorld" ), MString( "preW" ), MFnData::kString, aPreWorld, &status ); MAKE_INPUT(tAttr); aPostWorld = tAttr.create( MString( "postWorld" ), MString( "postW" ), MFnData::kString, aPostWorld, &status ); MAKE_INPUT(tAttr); aPreGeom = tAttr.create( MString( "preGeom" ), MString( "preG" ), MFnData::kString, aPreGeom, &status ); MAKE_INPUT(tAttr); CHECK_MSTATUS( addAttribute( aPreFrame ) ); CHECK_MSTATUS( addAttribute( aPreWorld ) ); CHECK_MSTATUS( addAttribute( aPostWorld ) ); CHECK_MSTATUS( addAttribute( aPreGeom ) ); return MS::kSuccess; }
AmplitudeToDbPower::AmplitudeToDbPower( char* instance_name, PracSimModel* outer_model, Signal<float>* in_sig, Signal<float>* out_sig) :PracSimModel(instance_name, outer_model) { In_Sig = in_sig; Out_Sig = out_sig; MAKE_OUTPUT(Out_Sig); MAKE_INPUT(In_Sig); SAME_RATE(In_Sig, Out_Sig); }
SignalAnchor::SignalAnchor( char* instance_name, PracSimModel* outer_model, Signal< std::complex<float> >* complex_signal, double samp_intvl, int block_size ) :PracSimModel(instance_name, outer_model) { MODEL_NAME(SignalAnchor); Complex_Signal = complex_signal; MAKE_INPUT(Complex_Signal); SET_SAMP_INTVL(Complex_Signal, samp_intvl); SET_BLOCK_SIZE(Complex_Signal, block_size); }
MStatus texLayerNode::initialize() { MStatus stat; MFnNumericAttribute numAttr; MFnEnumAttribute enumAttr; layerInput1=numAttr.createColor("LayerInput1","li1"); numAttr.setDefault(1.0,1.0,1.0); MAKE_INPUT(numAttr); layerInput2=numAttr.createColor("LayerInput2","li2"); MAKE_INPUT(numAttr); numAttr.setDefault(1.0,1.0,1.0); layerInput3=numAttr.createColor("LayerInput3","li3"); MAKE_INPUT(numAttr); numAttr.setDefault(1.0,1.0,1.0); layerInput4=numAttr.createColor("LayerInput4","li4"); MAKE_INPUT(numAttr); numAttr.setDefault(1.0,1.0,1.0); MObject u=numAttr.create("uCoord","u",MFnNumericData::kFloat); MObject v=numAttr.create("vCoord","v",MFnNumericData::kFloat); layerUV=numAttr.create("uvCoord","uv",u,v); MAKE_INPUT(numAttr); MObject filterX=numAttr.create("uvFilterSizeX", "fsx", MFnNumericData::kFloat); MObject filterY=numAttr.create( "uvFilterSizeY", "fsy", MFnNumericData::kFloat); layerUVFilterSize=numAttr.create("uvFilterSize", "fs", filterX, filterY); MAKE_INPUT(numAttr); layerOutput=numAttr.createColor("outColor","oc"); MAKE_OUTPUT(numAttr); numAttr.setHidden(true); addAttribute(layerInput1); addAttribute(layerInput2); addAttribute(layerInput3); addAttribute(layerInput4); addAttribute(layerUV); addAttribute(layerUVFilterSize); addAttribute(layerOutput); attributeAffects(layerInput1,layerOutput); attributeAffects(layerInput2,layerOutput); attributeAffects(layerInput3,layerOutput); attributeAffects(layerInput4,layerOutput); attributeAffects(layerUV,layerOutput); attributeAffects(layerUVFilterSize,layerOutput); return stat; }
PolarFreqDomainFilter::PolarFreqDomainFilter( char* instance_name, PracSimModel* outer_model, Signal< std::complex<float> >* in_sig, Signal< std::complex<float> >* out_sig) :PracSimModel(instance_name, outer_model) { MODEL_NAME(PolarFreqDomainFilter); ENABLE_MULTIRATE; In_Sig = in_sig; Out_Sig = out_sig; OPEN_PARM_BLOCK; GET_INT_PARM(Fft_Size); GET_DOUBLE_PARM(Dt_For_Fft); GET_FLOAT_PARM(Overlap_Save_Mem); GET_BOOL_PARM(Bypass_Enabled); Magnitude_Data_Fname = new char[64]; strcpy(Magnitude_Data_Fname, "\0"); GET_STRING_PARM(Magnitude_Data_Fname); GET_DOUBLE_PARM(Mag_Freq_Scaling_Factor); Phase_Data_Fname = new char[64]; strcpy(Phase_Data_Fname, "\0"); GET_STRING_PARM(Phase_Data_Fname); GET_DOUBLE_PARM(Phase_Freq_Scaling_Factor); Num_Saved_Samps = int(Overlap_Save_Mem/Dt_For_Fft + 0.5); Block_Size = Fft_Size - Num_Saved_Samps; MAKE_OUTPUT(Out_Sig); MAKE_INPUT(In_Sig); SET_SAMP_INTVL(In_Sig, Dt_For_Fft); SET_BLOCK_SIZE(In_Sig, Block_Size); SET_SAMP_INTVL(Out_Sig, Dt_For_Fft); SET_BLOCK_SIZE(Out_Sig, Block_Size); //SET_DELAY( In_Sig, Out_Sig, Group_Delay_Offset); }
// // DESCRIPTION: MStatus constant::initialize() { MFnNumericAttribute nAttr; MFnTypedAttribute tAttr; MFnGenericAttribute gAttr; MFnEnumAttribute eAttr; MFnMessageAttribute mAttr; MStatus status; outColor = nAttr.createColor("outColor", "outColor"); MAKE_OUTPUT(nAttr); CHECK_MSTATUS(addAttribute( outColor )); //---------------------------- automatically created attributes start ------------------------------------ color = nAttr.createColor("color", "color"); MAKE_INPUT(nAttr); nAttr.setDefault(1.0,1.0,1.0); CHECK_MSTATUS(addAttribute( color )); luxOutFloat = nAttr.create("luxOutFloat", "luxOutFloat", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); CHECK_MSTATUS(addAttribute( luxOutFloat )); luxOutColor = nAttr.createColor("luxOutColor", "luxOutColor"); MAKE_OUTPUT(nAttr); CHECK_MSTATUS(addAttribute( luxOutColor )); luxOutFresnel = nAttr.create("luxOutFresnel", "luxOutFresnel", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); CHECK_MSTATUS(addAttribute( luxOutFresnel )); CHECK_MSTATUS ( attributeAffects( color, luxOutFloat)); CHECK_MSTATUS ( attributeAffects( color, luxOutColor)); CHECK_MSTATUS ( attributeAffects( color, luxOutFresnel)); CHECK_MSTATUS ( attributeAffects( color, outColor)); //---------------------------- automatically created attributes end ------------------------------------ return MS::kSuccess; }
// // DESCRIPTION: MStatus Gradient::initialize() { MFnNumericAttribute nAttr; MFnTypedAttribute tAttr; MFnGenericAttribute gAttr; MFnEnumAttribute eAttr; MFnMessageAttribute mAttr; MStatus status; outColor = nAttr.createColor("outColor", "outColor"); MAKE_OUTPUT(nAttr); CHECK_MSTATUS(addAttribute( outColor )); //---------------------------- automatically created attributes start ------------------------------------ high = nAttr.createColor("high", "high"); nAttr.setDefault(0,0,0); CHECK_MSTATUS(addAttribute( high )); low = nAttr.createColor("low", "low"); nAttr.setDefault(1,1,1); CHECK_MSTATUS(addAttribute( low )); MObject directionX = nAttr.create("directionX", "directionx", MFnNumericData::kDouble, 0.0); MObject directionY = nAttr.create("directionY", "directiony", MFnNumericData::kDouble, 0.0); MObject directionZ = nAttr.create("directionZ", "directionz", MFnNumericData::kDouble, 0.0); direction = nAttr.create("direction", "direction", directionX, directionY, directionZ); MAKE_INPUT(nAttr); nAttr.setDefault(1,0,0); CHECK_MSTATUS(addAttribute( direction )); //---------------------------- automatically created attributes end ------------------------------------ return MS::kSuccess; }
// // DESCRIPTION: MStatus fresnel::initialize() { MFnNumericAttribute nAttr; MFnTypedAttribute tAttr; MFnGenericAttribute gAttr; MFnEnumAttribute eAttr; MFnMessageAttribute mAttr; MStatus status; outColor = nAttr.createColor("outColor", "outColor"); MAKE_OUTPUT(nAttr); CHECK_MSTATUS(addAttribute( outColor )); //---------------------------- automatically created attributes start ------------------------------------ filename = tAttr.create("filename", "filename", MFnNumericData::kString); CHECK_MSTATUS(addAttribute( filename )); name = eAttr.create("name", "name", 0, &status); status = eAttr.addField( "aluminium", 0 ); status = eAttr.addField( "amorphous carbon", 1 ); status = eAttr.addField( "silver", 2 ); status = eAttr.addField( "gold", 3 ); status = eAttr.addField( "copper", 4 ); MAKE_INPUT(eAttr); CHECK_MSTATUS(addAttribute( name )); luxOutFresnel = nAttr.create("luxOutFresnel", "luxOutFresnel", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); CHECK_MSTATUS(addAttribute( luxOutFresnel )); CHECK_MSTATUS ( attributeAffects( filename, luxOutFresnel)); CHECK_MSTATUS ( attributeAffects( filename, outColor)); //---------------------------- automatically created attributes end ------------------------------------ return MS::kSuccess; }
BartlettPeriodogram<T>:: BartlettPeriodogram( char* instance_name, PracSimModel* outer_model, Signal<T>* in_sig ) :PracSimModel( instance_name, outer_model ) { MODEL_NAME(BartlettPeriodogram); OPEN_PARM_BLOCK; GET_INT_PARM(Seg_Len); GET_INT_PARM(Fft_Len); GET_INT_PARM(Hold_Off); GET_INT_PARM(Num_Segs_To_Avg); Psd_File_Name = new char[64]; strcpy(Psd_File_Name, "\0"); GET_STRING_PARM(Psd_File_Name); GET_DOUBLE_PARM(Freq_Norm_Factor); GET_BOOL_PARM(Output_In_Decibels); GET_BOOL_PARM(Plot_Two_Sided); GET_BOOL_PARM(Halt_When_Completed); In_Sig = in_sig; MAKE_INPUT(In_Sig); Time_Seg = new T[Seg_Len]; Sample_Spectrum = new double[Fft_Len]; Freq_Seg = new std::complex<double>[Fft_Len]; for(int is=0; is<Fft_Len; is++) { Sample_Spectrum[is] = 0.0; } Psd_File = new ofstream(Psd_File_Name, ios::out); Processing_Completed = false; }
// // DESCRIPTION: /////////////////////////////////////////////////////// MStatus Cell3D::initialize() { MFnMatrixAttribute mAttr; MFnNumericAttribute nAttr; // Input attributes aColorGain = nAttr.createColor("colorGain", "cg"); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setDefault(1.0f,1.0f,1.0f) ); aColorOffset = nAttr.createColor("colorOffset", "co"); MAKE_INPUT(nAttr); aPlaceMat = mAttr.create("placementMatrix", "pm", MFnMatrixAttribute::kFloat); MAKE_INPUT(mAttr); // Implicit shading network attributes aPointWorld = nAttr.createPoint("pointWorld", "pw"); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setHidden(true) ); // Create output attributes aOutF0 = nAttr.create( "F0", "f0", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); aOutF1 = nAttr.create( "F1", "f1", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); aOutN0 = nAttr.create( "N0", "n0", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); aOutBorderDist = nAttr.create("borderDistance", "bd", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); aOutColor = nAttr.createColor("outColor", "oc"); MAKE_OUTPUT(nAttr); aOutAlpha = nAttr.create( "outAlpha", "oa", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); // Add attributes to the node database. CHECK_MSTATUS( addAttribute(aColorGain) ); CHECK_MSTATUS( addAttribute(aColorOffset) ); CHECK_MSTATUS( addAttribute(aPointWorld) ); CHECK_MSTATUS( addAttribute(aPlaceMat) ); CHECK_MSTATUS( addAttribute(aOutAlpha) ); CHECK_MSTATUS( addAttribute(aOutColor) ); CHECK_MSTATUS( addAttribute(aOutF0) ); CHECK_MSTATUS( addAttribute(aOutF1) ); CHECK_MSTATUS( addAttribute(aOutN0) ); CHECK_MSTATUS( addAttribute(aOutBorderDist) ); // All input affect the output color and alpha CHECK_MSTATUS( attributeAffects (aColorGain, aOutColor) ); CHECK_MSTATUS( attributeAffects (aColorOffset, aOutColor) ); CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutColor) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutColor) ); CHECK_MSTATUS( attributeAffects (aColorGain, aOutAlpha) ); CHECK_MSTATUS( attributeAffects (aColorOffset, aOutAlpha) ); CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutAlpha) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutAlpha) ); // Geometry attribute affect all other outputs. CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutF0) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutF0) ); CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutF1) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutF1) ); CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutN0) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutN0) ); CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutBorderDist) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutBorderDist) ); return MS::kSuccess; }
MStatus woodTexNode::initialize() { MStatus stat; MFnNumericAttribute numAttr; MFnEnumAttribute enumAttr; woodTurbulence=numAttr.create("Turbulence","tl",MFnNumericData::kFloat,5.0); MAKE_INPUT(numAttr); numAttr.setMin(0.0); numAttr.setMax(200.0); woodSize=numAttr.create("WoodSize","ws",MFnNumericData::kFloat,4.0); MAKE_INPUT(numAttr); numAttr.setMin(0.0); numAttr.setMax(32.0); woodHard=numAttr.create("Hard","hr",MFnNumericData::kBoolean,false); MAKE_INPUT(numAttr); woodType=enumAttr.create("WoodType","wt",0); enumAttr.addField("bands",0); enumAttr.addField("rings",1); MAKE_INPUT(enumAttr); woodShape=enumAttr.create("WoodShape","wosh",0); enumAttr.addField("sin",0); enumAttr.addField("saw",1); enumAttr.addField("tri",2); NoiseType=enumAttr.create("NoiseType","noty",0); enumAttr.addField("newperlin",0); enumAttr.addField("stdperlin",1); enumAttr.addField("voronoi_f1",2); enumAttr.addField("voronoi_f2",3); enumAttr.addField("voronoi_f3",4); enumAttr.addField("voronoi_f4",5); enumAttr.addField("voronoi_f2fl",6); enumAttr.addField("voronoi_crackle",7); enumAttr.addField("cellnoise",8); MAKE_INPUT(enumAttr); mappingMethod=enumAttr.create("MappingMethod","mame",0); enumAttr.addField("uv",0); enumAttr.addField("orco",1); enumAttr.addField("global",2); enumAttr.addField("window",3); MAKE_INPUT(enumAttr); texCo=enumAttr.create("TextureCoordinate","texco",0); enumAttr.addField("plain",0); enumAttr.addField("cube",1); enumAttr.addField("tube",2); enumAttr.addField("sphere",3); MAKE_INPUT(enumAttr); //*******************************layer texture attribute*********************************// layerMix=enumAttr.create("MixMethod","mm1",0); enumAttr.addField("mix",0); enumAttr.addField("add",1); enumAttr.addField("multiply",2); enumAttr.addField("subtract",3); enumAttr.addField("screen",4); enumAttr.addField("divide",5); enumAttr.addField("difference",6); enumAttr.addField("darken",7); enumAttr.addField("lighten",8); MAKE_INPUT(enumAttr); textureColor=numAttr.createColor("TextureColor","teco"); numAttr.setDefault(1.0,0.0,1.0); MAKE_INPUT(numAttr); texColorFact=numAttr.create("TextureColorWeight","tcw",MFnNumericData::kFloat,1.0); numAttr.setMin(0.0); numAttr.setMax(1.0); MAKE_INPUT(numAttr); defVal=numAttr.create("DefValue","dev",MFnNumericData::kFloat,1.0); numAttr.setMin(0.0); numAttr.setMax(1.0); MAKE_INPUT(numAttr); valFact=numAttr.create("ValueWeight","vaw",MFnNumericData::kFloat,1.0); numAttr.setMin(0.0); numAttr.setMax(1.0); MAKE_INPUT(numAttr); doColor=numAttr.create("DoColor","doco",MFnNumericData::kBoolean,true); MAKE_INPUT(numAttr); negative=numAttr.create("Negative","nega",MFnNumericData::kBoolean,false); MAKE_INPUT(numAttr); noRGB=numAttr.create("NoRGB","nr",MFnNumericData::kBoolean,false); MAKE_INPUT(numAttr); stencil=numAttr.create("Stencil","sten",MFnNumericData::kBoolean,false); MAKE_INPUT(numAttr); //*******************************layer texture attribute end*********************************// MObject u=numAttr.create("uCoord","u",MFnNumericData::kFloat); MObject v=numAttr.create("vCoord","v",MFnNumericData::kFloat); UV=numAttr.create("uvCoord","uv",u,v); MAKE_INPUT(numAttr); MObject filterX=numAttr.create("uvFilterSizeX", "fsx", MFnNumericData::kFloat); MObject filterY=numAttr.create( "uvFilterSizeY", "fsy", MFnNumericData::kFloat); UVFilterSize=numAttr.create("uvFilterSize", "fs", filterX, filterY); MAKE_INPUT(numAttr); Output=numAttr.createColor("outColor","oc"); numAttr.setHidden(true); MAKE_OUTPUT(numAttr); addAttribute(woodTurbulence); addAttribute(woodSize); addAttribute(woodHard); addAttribute(woodType); addAttribute(woodShape); addAttribute(NoiseType); addAttribute(mappingMethod); addAttribute(texCo); addAttribute(layerMix); addAttribute(textureColor); addAttribute(texColorFact); addAttribute(defVal); addAttribute(valFact); addAttribute(doColor); addAttribute(negative); addAttribute(noRGB); addAttribute(stencil); addAttribute(UV); addAttribute(UVFilterSize); addAttribute(Output); attributeAffects(woodTurbulence,Output); attributeAffects(woodSize,Output); attributeAffects(woodHard,Output); attributeAffects(woodType,Output); attributeAffects(woodShape,Output); attributeAffects(NoiseType,Output); attributeAffects(mappingMethod,Output); attributeAffects(texCo,Output); attributeAffects(layerMix,Output); attributeAffects(textureColor,Output); attributeAffects(texColorFact,Output); attributeAffects(defVal,Output); attributeAffects(valFact,Output); attributeAffects(doColor,Output); attributeAffects(negative,Output); attributeAffects(noRGB,Output); attributeAffects(stencil,Output); attributeAffects(UV,Output); attributeAffects(UVFilterSize,Output); return stat; }