コード例 #1
0
ファイル: manipOverride.cpp プロジェクト: BigRoy/Maya-devkit
void customAttrCtx::toolOnSetup(MEvent &)
{
    MString str(MOVEHELPSTR);
    setHelpString(str);

	updateManipulators(this);
	MStatus status;
	id1 = MModelMessage::addCallback(MModelMessage::kActiveListModified,
									 updateManipulators, 
									 this, &status);
	if (!status) {
		cerr << "Model addCallback failed\n";
	}
}
コード例 #2
0
void ComponentScaleContext::toolOnSetup(MEvent &)
{
	MString str("Scale the selected components");
	setHelpString(str);

	updateManipulators(this);
	MStatus status;
	id1 = MModelMessage::addCallback(MModelMessage::kActiveListModified,
									 updateManipulators, 
									 this, &status);
	if (!status) {
		MGlobal::displayError("Model addCallback failed");
	}
}
コード例 #3
0
ファイル: rotateManip.cpp プロジェクト: BigRoy/Maya-devkit
void RotateManipContext::toolOnSetup(MEvent &)
{
	MString str("Rotate the object using the rotation handles");
	setHelpString(str);

	updateManipulators(this);
	MStatus status;
	id1 = MModelMessage::addCallback(MModelMessage::kActiveListModified,
									 updateManipulators, 
									 this, &status);
	if (!status) {
		MGlobal::displayError("Model addCallback failed");
	}
}
    Geometry1DTransferFunctionEditor::Geometry1DTransferFunctionEditor(TransferFunctionProperty* prop, Geometry1DTransferFunction* tf, QWidget* parent /*= 0*/)
        : AbstractTransferFunctionEditor(prop, tf, parent)
        , _logScale(true)
        , _layout(0)
        , _canvas(0)
        , _lblIntensityLeft(0)
        , _lblIntensityRight(0)
        , _btnAddGeometry(0)
        , _btnRemoveGeometry(0)
        , _cbLogScale(0)
    {
        _selectedGeometry = 0;
        setupGUI();

        tf->s_geometryCollectionChanged.connect(this, &Geometry1DTransferFunctionEditor::onGeometryCollectionChanged);
        tf->s_aboutToBeDeleted.connect(this, &Geometry1DTransferFunctionEditor::onTfAboutToBeDeleted);

        updateManipulators();
        setEventTypes(cgt::Event::MOUSEPRESSEVENT);
    }
    void Geometry1DTransferFunctionEditor::mousePressEvent(cgt::MouseEvent* e) {
        if (_selectedGeometry != 0 && e->modifiers() & cgt::Event::CTRL) {
            TFGeometry1D* g = _selectedGeometry->getGeometry();
            {
                tbb::mutex::scoped_lock lock(_localMutex);

                float pos = static_cast<float>(e->x()) / static_cast<float>(_canvas->width());
                float alpha = cgt::clamp(static_cast<float>(_canvas->height() - e->y()) / static_cast<float>(_canvas->height()), 0.f, 1.f);
                
                g->addKeyPoint(pos, alpha);
            }

            updateManipulators();
            g->s_changed.emitSignal();
        }
        else {
            _selectedGeometry = 0;
            invalidate();
            e->ignore();
        }
    }
 void Geometry1DTransferFunctionEditor::onGeometryCollectionChanged() {
     updateManipulators();
 }