// ------------------------------------------------------------
    void EffectTextureExporter::add2DPlacement ( COLLADASW::Texture* colladaTexture, MObject texture )
    {
        // Is there a texture placement applied to this texture?
        MObject placementNode = DagHelper::getSourceNodeConnectedTo ( texture, ATTR_UV_COORD );
        if ( placementNode.hasFn ( MFn::kPlace2dTexture ) )
        {
            MFnDependencyNode placement2d ( placementNode );

            addBoolParameter ( colladaTexture, MAYA_TEXTURE_WRAPU_PARAMETER, placement2d );
            addBoolParameter ( colladaTexture, MAYA_TEXTURE_WRAPV_PARAMETER, placement2d );
            addBoolParameter ( colladaTexture, MAYA_TEXTURE_MIRRORU_PARAMETER, placement2d );
            addBoolParameter ( colladaTexture, MAYA_TEXTURE_MIRRORV_PARAMETER, placement2d );

            addFloatParameter ( colladaTexture, MAYA_TEXTURE_COVERAGEU_PARAMETER, placement2d );
            addFloatParameter ( colladaTexture, MAYA_TEXTURE_COVERAGEV_PARAMETER, placement2d );
            addFloatParameter ( colladaTexture, MAYA_TEXTURE_TRANSFRAMEU_PARAMETER, placement2d );
            addFloatParameter ( colladaTexture, MAYA_TEXTURE_TRANSFRAMEV_PARAMETER, placement2d );
            addAngleParameter ( colladaTexture, MAYA_TEXTURE_ROTFRAME_PARAMETER, placement2d );

            addBoolParameter ( colladaTexture, MAYA_TEXTURE_STAGGER_PARAMETER, placement2d );
            addBoolParameter ( colladaTexture, MAYA_TEXTURE_FAST_PARAMETER, placement2d );
            addFloatParameter ( colladaTexture, MAYA_TEXTURE_REPEATU_PARAMETER, placement2d );
            addFloatParameter ( colladaTexture, MAYA_TEXTURE_REPEATV_PARAMETER, placement2d );
            addFloatParameter ( colladaTexture, MAYA_TEXTURE_OFFSETU_PARAMETER, placement2d );
            addFloatParameter ( colladaTexture, MAYA_TEXTURE_OFFSETV_PARAMETER, placement2d );
            addAngleParameter ( colladaTexture, MAYA_TEXTURE_ROTATEUV_PARAMETER, placement2d );
            addFloatParameter ( colladaTexture, MAYA_TEXTURE_NOISEU_PARAMETER, placement2d );
            addFloatParameter ( colladaTexture, MAYA_TEXTURE_NOISEV_PARAMETER, placement2d );
        }
    }
Example #2
0
AudioModule::AudioModule(const String & name) :
	Module(name),
	uidIncrement(100),
	numActiveMonitorOutputs(0),
	pitchDetector(nullptr)
{
	inputGain = addFloatParameter("Input Gain", "Gain for the input volume", 1, 0, 10);
	activityThreshold = addFloatParameter("Activity Threshold", "Threshold to consider activity from the source.\nAnalysis will compute only if volume is greater than this parameter", .1f, 0, 1);
	keepLastDetectedValues = addBoolParameter("Keep Values", "Keep last detected values when no activity detected.", false);

	monitorVolume = addFloatParameter("Monitor Volume", "Volume multiplier for the monitor output. This will affect all the input channels and all the selected output channels", 1, 0, 10);

	//Values
	volume = valuesCC.addFloatParameter("Volume", "Volume of the audio input", 0, 0, 1);
	volume->isControllableFeedbackOnly = true;

	frequency = valuesCC.addFloatParameter("Freq", "Freq", 0, 0, 2000);
	frequency->isControllableFeedbackOnly = true;

	pitch = valuesCC.addIntParameter("Pitch", "Pitch", 0, 0, 300);
	pitch->isControllableFeedbackOnly = true;

	note = valuesCC.addEnumParameter("Note", "Detected note");
	note->addOption("-", -1);
	for (int i = 0; i < 12; i++) note->addOption(MIDIManager::getNoteName(i, false), i);
	octave = valuesCC.addIntParameter("Octave", "Detected octave", 0, 0, 10);

	am.addAudioCallback(this);
	am.addChangeListener(this);
	am.initialiseWithDefaultDevices(2, 2);

	am.addAudioCallback(&player);

	graph.reset();

	AudioDeviceManager::AudioDeviceSetup setup;
	am.getAudioDeviceSetup(setup);
	currentSampleRate = setup.sampleRate;
	currentBufferSize = setup.bufferSize;


	graph.setPlayConfigDetails(0, 2, currentSampleRate, currentBufferSize);
	graph.prepareToPlay(currentSampleRate, currentBufferSize);

	graph.addNode(new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioInputNode), 1);
	graph.addNode(new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode), 2);
	player.setProcessor(&graph);

}
void ConditionManager::onContainerParameterChanged(Parameter * p)
{
	if (p == validationTime)
	{
		if (validationTime->floatValue() > 0)
		{
			if (validationProgress == nullptr)
			{
				validationProgress = addFloatParameter("Progress", "Validation time progress", 0, 0, validationTime->floatValue());
				validationProgress->isControllableFeedbackOnly = true;
				validationProgress->isEditable = false;

			}
			else validationProgress->setRange(0, validationTime->floatValue());
		} else
		{
			if (validationProgress != nullptr)
			{
				removeControllable(validationProgress);
				validationProgress = nullptr;
			}
		}
	} else if (p == conditionOperator)
	{
		checkAllConditions();
	}
}
//--------------------------------------------------------------
ofApp::ofApp(int minInputs, int maxInputs )
{
    maxR = 50;
    addFloatParameter("Radius",&maxR,1,100);
    numStep = 10;
    addFloatParameter("Step",&numStep,1,360);
    n = 100;
    addFloatParameter("NumberOfCircle",&n,1,360);
    theInitSzie = 50;
    addFloatParameter("theInitSzie",&theInitSzie,1,100);
    increasement = 0.25;
    addFloatParameter("Increasment",&increasement,0,0.5);
    
//    addFloatParameter("Repetitions",	// name of parameter ( as it will appear in host )
//                      &numRepeats,      // address of the float this parameter will point to
//                      1,				// minimum value
//                      20				// maximum value
//                      );
    initParameters();
}
Example #5
0
testApp::testApp()
{
	// add parameters
	
	numRepeats = 1;
	
	addFloatParameter(	"num repeats",	// name of parameter ( as it will appear in host )
						&numRepeats,	// address of the float this parameter will point to
						1,				// minimum value
						20				// maximum value
					  );
}
ConditionManager::ConditionManager(bool _operatorOnSide) :
	BaseManager<Condition>("Conditions"),
	operatorOnSide(_operatorOnSide),
	validationProgress(nullptr)
{
	selectItemWhenCreated = false;

	isValid = addBoolParameter("Is Valid","Indicates if all the conditions are valid. If so, the consequences are triggered one time, at the moment the action becomes valid.",false);
	isValid->isControllableFeedbackOnly = true;
	isValid->hideInEditor = true;

	conditionOperator = addEnumParameter("Operator", "Operator for this manager, will decides how the conditions are validated");
	conditionOperator->addOption("AND", ConditionOperator::AND);
	conditionOperator->addOption("OR", ConditionOperator::OR);

	validationTime = addFloatParameter("Validation Time", "If greater than 0, the conditions will be validated only if they remain valid for this amount of time", 0, 0, 10);
	
	//conditionOperator->hideInEditor = items.size() <= 1;
}
Example #7
0
// TODO: make evalAttr finds more robust
MStatus PRTAttrs::createAttributes(MFnDependencyNode & node, const std::wstring & ruleFile, const std::wstring & startRule, prt::AttributeMapBuilder* aBuilder, const prt::RuleFileInfo* info) {
	MStatus           stat;
	MStatus           stat2;
	MFnNumericData    numericData;
	MFnTypedAttribute tAttr;
	MFnStringData     attrDefaultStr;
	PRTNode*          prtNode = (PRTNode*)node.userNode();
	MString           dummy;

	MayaCallbacks* outputHandler = prtNode->createOutputHandler(0, 0);
	const prt::AttributeMap* attrs   = aBuilder->createAttributeMap();

	prt::InitialShapeBuilder* isb = prt::InitialShapeBuilder::create();
	isb->setGeometry(
			UnitQuad::vertices,
			UnitQuad::vertexCount,
			UnitQuad::indices,
			UnitQuad::indexCount,
			UnitQuad::faceCounts,
			UnitQuad::faceCountsCount
	);
	isb->setAttributes(
			ruleFile.c_str(),
			startRule.c_str(),
			UnitQuad::seed,
			L"",
			attrs,
			prtNode->mResolveMap
	);
	const prt::InitialShape* shape = isb->createInitialShapeAndReset();

	prt::generate(&shape, 1, 0, &ENC_ATTR, 1, &prtNode->mAttrEncOpts, outputHandler, PRTNode::theCache, 0);

	const std::map<std::wstring, MayaCallbacks::AttributeHolder>& evalAttrs = outputHandler->getAttrs();

	prtNode->mBriefName2prtAttr[NAME_GENERATE.asWChar()] = NAME_GENERATE.asWChar();

	for(size_t i = 0; i < info->getNumAttributes(); i++) {
		PRTEnum* e = nullptr;

		const MString name = MString(info->getAttribute(i)->getName());
		MObject attr;

		if(info->getAttribute(i)->getNumParameters() != 0) continue;

		prtNode->mBriefName2prtAttr[prtu::toCleanId(name).asWChar()] = name.asWChar();

		switch(info->getAttribute(i)->getReturnType()) {
		case prt::AAT_BOOL: {
				for(size_t a = 0; a < info->getAttribute(i)->getNumAnnotations(); a++) {
					const prt::Annotation* an = info->getAttribute(i)->getAnnotation(a);
					if(!(wcscmp(an->getName(), ANNOT_RANGE)))
						e = new PRTEnum(prtNode, an);
				}
				bool value = evalAttrs.find(name.asWChar())->second.mBool;
				if(e) {
					MCHECK(addEnumParameter(node, attr, name, value, e));
				} else {
					MCHECK(addBoolParameter(node, attr, name, value));
				}
			break;
			}
		case prt::AAT_FLOAT: {
				double min = std::numeric_limits<double>::quiet_NaN();
				double max = std::numeric_limits<double>::quiet_NaN();
				for(size_t a = 0; a < info->getAttribute(i)->getNumAnnotations(); a++) {
					const prt::Annotation* an = info->getAttribute(i)->getAnnotation(a);
					if(!(wcscmp(an->getName(), ANNOT_RANGE))) {
						if(an->getNumArguments() == 2 && an->getArgument(0)->getType() == prt::AAT_FLOAT && an->getArgument(1)->getType() == prt::AAT_FLOAT) {
							min = an->getArgument(0)->getFloat();
							max = an->getArgument(1)->getFloat();
						} else
							e = new PRTEnum(prtNode, an);
					}
				}

				double value = evalAttrs.find(name.asWChar())->second.mFloat;

				if(e) {
					MCHECK(addEnumParameter(node, attr, name, value, e));
				} else {
					MCHECK(addFloatParameter(node, attr, name, value, min, max));
				}
				break;
			}
		case prt::AAT_STR: {
				MString exts;
				bool    asFile  = false;
				bool    asColor = false;
				for(size_t a = 0; a < info->getAttribute(i)->getNumAnnotations(); a++) {
					const prt::Annotation* an = info->getAttribute(i)->getAnnotation(a);
					if(!(wcscmp(an->getName(), ANNOT_RANGE)))
						e = new PRTEnum(prtNode, an);
					else if(!(wcscmp(an->getName(), ANNOT_COLOR)))
						asColor = true;
					else if(!(wcscmp(an->getName(), ANNOT_DIR))) {
						exts = MString(an->getName());
						asFile = true;
					} else if(!(wcscmp(an->getName(), ANNOT_FILE))) {
						asFile = true;
						for(size_t arg = 0; arg < an->getNumArguments(); arg++) {
							if(an->getArgument(arg)->getType() == prt::AAT_STR) {
								exts += MString(an->getArgument(arg)->getStr());
								exts += " (*.";
								exts += MString(an->getArgument(arg)->getStr());
								exts += ");;";
							}
						}
						exts += "All Files (*.*)";
					}
				}

				std::wstring value = evalAttrs.find(name.asWChar())->second.mString;
				MString mvalue(value.c_str());
				if(!(asColor) && mvalue.length() == 7 && value[0] == L'#')
					asColor = true;

				if(e) {
					MCHECK(addEnumParameter(node, attr, name, mvalue, e));
				} else if(asFile) {
					MCHECK(addFileParameter(node, attr, name, mvalue, exts));
				} else if(asColor) {
					MCHECK(addColorParameter(node, attr, name, mvalue));
				} else {
					MCHECK(addStrParameter(node, attr, name, mvalue));
				}

				break;
			}
		default:
			break;
		}
	}

	shape->destroy();
	attrs->destroy();
	delete outputHandler;

	return MS::kSuccess;
}