Exemple #1
0
void OutputMap::loadDefaults()
{
    QSettings settings;
    QString plugin;
    QString output;
    QString fb_plugin;
    QString feedback;
    QString key;

    for (quint32 i = 0; i < universes(); i++)
    {
        /* Plugin name */
        key = QString("/outputmap/universe%2/plugin/").arg(i);
        plugin = settings.value(key).toString();

        /* Plugin output */
        key = QString("/outputmap/universe%2/output/").arg(i);
        output = settings.value(key).toString();

        /* Feedback plugin name */
        key = QString("/outputmap/universe%2/feedbackplugin/").arg(i);
        fb_plugin = settings.value(key).toString();

        /* Feedback line */
        key = QString("/outputmap/universe%2/feedback/").arg(i);
        feedback = settings.value(key).toString();

        if (plugin.length() > 0 && output.length() > 0)
        {
            /* Check that the same plugin & output are not mapped
               to more than one universe at a time. */
            quint32 m = mapping(plugin, output.toInt());
            if (m == QLCChannel::invalid() || m == i)
                setPatch(i, plugin, output.toInt());
        }
        if (fb_plugin.length() > 0 && feedback.length() > 0)
        {
            quint32 m = mapping(feedback, fb_plugin.toInt());
            if (m == QLCChannel::invalid() || m == i)
                setPatch(i, fb_plugin, feedback.toInt(), true);
        }
    }
}
Exemple #2
0
LabelWidget::LabelWidget(String const &text, patchid_t *patch)
    : Widget()
    , d(new Impl)
{
    setFont(MENU_FONT1);
    setColor(MENU_COLOR1);
    setFlags(NoFocus); // never focusable.
    setText(text);
    setPatch(patch);
}
// Pre-hide callback
void PatchInspector::_preHide()
{
	TransientWindow::_preHide();

	// Clear the patch, we don't need to observe it while hidden
	setPatch(PatchNodePtr());

	// A hidden PatchInspector doesn't need to listen for events
	GlobalUndoSystem().removeObserver(this);
	GlobalSelectionSystem().removeObserver(this);
}
Exemple #4
0
void InputMap::loadDefaults()
{
	bool feedbackEnabled;
	QString profileName;
	QSettings settings;
	QString plugin;
	QVariant value;
	QString input;
	QString key;

	/* Editor universe */
	key = QString("/inputmap/editoruniverse/");
	value = settings.value(key);
	if (value.isValid() == true)
		setEditorUniverse(value.toInt());

	for (t_input_universe i = 0; i < m_universes; i++)
	{
		/* Plugin name */
		key = QString("/inputmap/universe%2/plugin/").arg(i);
		plugin = settings.value(key).toString();

		/* Plugin input */
		key = QString("/inputmap/universe%2/input/").arg(i);
		input = settings.value(key).toString();

		/* Input profile */
		key = QString("/inputmap/universe%2/profile/").arg(i);
		profileName = settings.value(key).toString();

		/* Feedback enable */
		key = QString("/inputmap/universe%2/feedbackEnabled/").arg(i);
		if (settings.value(key).isValid() == true)
			feedbackEnabled = settings.value(key).toBool();
		else
			feedbackEnabled = true;

		/* Do the mapping */
		if (plugin.length() > 0 && input.length() > 0)
		{
			/* Check that the same plugin & input are not mapped
			   to more than one universe at a time. */
			int m = mapping(plugin, input.toInt());
			if (m == -1 || m == i)
			{
				setPatch(i, plugin, input.toInt(),
					 feedbackEnabled, profileName);
			}
		}
	}
}
Exemple #5
0
void InputMap::loadDefaults()
{
    QString profileName;
    QSettings settings;
    QString plugin;
    QVariant value;
    QString input;
    QString key;

    /* Editor universe */
    key = QString("/inputmap/editoruniverse/");
    value = settings.value(key);
    if (value.isValid() == true)
        setEditorUniverse(value.toInt());

    for (quint32 i = 0; i < m_universes; i++)
    {
        /* Plugin name */
        key = QString("/inputmap/universe%2/plugin/").arg(i);
        plugin = settings.value(key).toString();

        /* Plugin input */
        key = QString("/inputmap/universe%2/input/").arg(i);
        input = settings.value(key).toString();

        /* Input profile */
        key = QString("/inputmap/universe%2/profile/").arg(i);
        profileName = settings.value(key).toString();

        /* Do the mapping */
        if (plugin.length() > 0 && input.length() > 0)
        {
            /* Check that the same plugin & input are not mapped
               to more than one universe at a time. */
            quint32 m = mapping(plugin, input.toInt());
            if (m == InputMap::invalidUniverse() || m == i)
            {
                setPatch(i, plugin, input.toInt(),
                         profileName);
            }
        }
    }
}
Exemple #6
0
void OutputMap::loadDefaults()
{
	QSettings settings;
	QString plugin;
	QString output;
	QString key;

	for (int i = 0; i < KUniverseCount; i++)
	{
		/* Plugin name */
		key = QString("/outputmap/universe%2/plugin/").arg(i);
		plugin = settings.value(key).toString();

		/* Plugin output */
		key = QString("/outputmap/universe%2/output/").arg(i);
		output = settings.value(key).toString();

		if (plugin.length() > 0 && output.length() > 0)
			setPatch(i, plugin, output.toInt());
	}
}
void PatchInspector::rescanSelection()
{
	// Check if there is one distinct patch selected
	bool sensitive = (_selectionInfo.patchCount == 1);

	findNamedObject<wxPanel>(this, "PatchInspectorVertexPanel")->Enable(sensitive);
	findNamedObject<wxPanel>(this, "PatchInspectorCoordPanel")->Enable(sensitive);

	// Tesselation is always sensitive when one or more patches are selected
	findNamedObject<wxPanel>(this, "PatchInspectorTessPanel")->Enable(_selectionInfo.patchCount > 0);

	// Clear the patch reference
	setPatch(PatchNodePtr());

	if (_selectionInfo.patchCount > 0)
	{
		// Get the list of selected patches
		PatchPtrVector list = selection::algorithm::getSelectedPatches();

		Subdivisions tess(UINT_MAX, UINT_MAX);
		bool tessIsFixed = false;

		// Try to find a pair of same tesselation values
		for (PatchPtrVector::const_iterator i = list.begin(); i != list.end(); ++i)
        {
			IPatch& p = (*i)->getPatch();

			if (tess.x() == UINT_MAX)
            {
				// Not initialised yet, take these values for starters
				tessIsFixed = p.subdivionsFixed();
				tess = p.getSubdivisions();
			}
			else
			{
				// We already have a pair of divisions, compare
				Subdivisions otherTess = p.getSubdivisions();

				if (tessIsFixed != p.subdivionsFixed() || otherTess != tess)
				{
					// Our journey ends here, we cannot find a pair of tesselations
					// for all selected patches or the same fixed/variable status
					tessIsFixed = false;
					break;
				}
			}
		}

		_updateActive = true;

		// Load the "fixed tesselation" value
		findNamedObject<wxCheckBox>(this, "PatchInspectorFixedSubdivisions")->SetValue(tessIsFixed);

		wxSpinCtrl* fixedSubdivX = findNamedObject<wxSpinCtrl>(this, "PatchInspectorSubdivisionsX");
		wxSpinCtrl* fixedSubdivY = findNamedObject<wxSpinCtrl>(this, "PatchInspectorSubdivisionsY");

		fixedSubdivX->SetValue(tess[0]);
		fixedSubdivY->SetValue(tess[1]);

		fixedSubdivX->Enable(tessIsFixed);
		fixedSubdivY->Enable(tessIsFixed);

		findNamedObject<wxStaticText>(this, "PatchInspectorSubdivisionsXLabel")->Enable(tessIsFixed);
		findNamedObject<wxStaticText>(this, "PatchInspectorSubdivisionsYLabel")->Enable(tessIsFixed);

		if (_selectionInfo.patchCount == 1)
		{
			setPatch(list[0]);
		}

		_updateActive = false;
	}

	update();
}
Exemple #8
0
	/**
     * Create a Version class object
     *
     * @param name of the project
     */
    ProjectVersion(std::string iProjectName, int iMajor, int iMinor, int iPatch) { 
      setProjectName(iProjectName);
      setMajor(iMajor);
      setMinor(iMinor);
      setPatch(iPatch);
    }
Exemple #9
0
void CPatch::Init(double iz)
{	
	bool flag = false;
	double nx, ny, nz, z0;
	if (iz < 0)
	{
		if (side == A)
		{
			z0 = rng_z0_A.uniform(0.0, _max_disp);
			nx = rng_nx_A.gaussian(1);
			ny = rng_ny_A.gaussian(1);
			nz = rng_nz_A.gaussian(1);
		}
		else
		{
			z0 = rng_z0_B.uniform(0.0, _max_disp);
			nx = rng_nx_B.gaussian(1);
			ny = rng_ny_B.gaussian(1);
			nz = rng_nz_B.gaussian(1);
		}
	}
	else	// Init with know disparity (z0)
	{
		if (side == A)
		{
			z0 = iz;
			nx = rng_nx_A.gaussian(1);
			ny = rng_ny_A.gaussian(1);
			nz = rng_nz_A.gaussian(1);
		}
		else
		{
			z0 = iz;
			nx = rng_nx_B.gaussian(1);
			ny = rng_ny_B.gaussian(1);
			nz = rng_nz_B.gaussian(1);
		}
	}
	

	// Generate unit vector pointing to uniformly distributed direction
	// Method 1
// 	double k1, k2;
// 	cv::RNG rng_k1(cv::getTickCount());
// 	cv::RNG rng_k2(cv::getTickCount());
// 	while (flag)
// 	{
// 		// Marsaglia (1972) Ref:http://mathworld.wolfram.com/SpherePointPicking.html
// 		k1 = rng_k1.uniform(-1.0, 1.0);
// 		k2 = rng_k2.uniform(-1.0, 1.0);
// 		if (k1*k1 + k2*k2 >= 1)
// 			continue;
// 		nx = 2 * k1 * sqrt(1 - k1*k1 - k2*k2);
// 		ny = 2 * k2 * sqrt(1 - k1*k1 - k2*k2);
// 		nz = 1 - 2 * (k1*k1 + k2*k2);
// 		flag = true;
// 	}
	// Method 2

	
	double length = sqrt(nx*nx + ny*ny + nz*nz);
	nx /= length;
	ny /= length;
	nz /= length;

	// Convert normal vector to a, b, c
	setPatch(nx, ny, nz, z0);
}