本文整理汇总了C++中KnobGuiPtr类的典型用法代码示例。如果您正苦于以下问题:C++ KnobGuiPtr类的具体用法?C++ KnobGuiPtr怎么用?C++ KnobGuiPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KnobGuiPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: values
void
KnobGuiColor::onDialogCurrentColorChanged(const QColor & color)
{
KnobColorPtr knob = _knob.lock();
if (!knob) {
return;
}
int nDims = knob->getNDimensions();
std::vector<double> values(nDims);
values[0] = color.redF();
convertFromUIToInternalColorspace(&values[0]);
if (nDims > 1) {
values[1] = color.greenF();
convertFromUIToInternalColorspace(&values[1]);
}
if (nDims > 2) {
values[2] = color.blueF();
convertFromUIToInternalColorspace(&values[2]);
}
if (nDims > 3) {
values[3] = color.alphaF();
}
KnobGuiPtr knobUI = getKnobGui();
knob->setValueAcrossDimensions(values, DimIdx(0), getView(), eValueChangedReasonUserEdited);
if ( knobUI->getGui() ) {
knobUI->getGui()->setDraftRenderEnabled(true);
}
}
示例2:
void
KnobGuiGroup::setEnabled(const std::vector<bool>& perDimEnabled)
{
KnobGroupPtr knob = _knob.lock();
if (_button) {
_button->setEnabled(perDimEnabled[0]);
}
if (perDimEnabled[0]) {
for (std::list<KnobGuiWPtr>::iterator it = _children.begin(); it != _children.end(); ++it) {
KnobGuiPtr k = it->lock();
if (!k) {
continue;
}
k->setEnabledSlot();
}
} else {
for (std::list<KnobGuiWPtr>::iterator it = _children.begin(); it != _children.end(); ++it) {
KnobGuiPtr k = it->lock();
if (!k) {
continue;
}
k->onFrozenChanged(true);
}
}
}
示例3: if
void
KnobGuiGroup::setCheckedInternal(bool checked,
bool userRequested)
{
if (checked == _checked) {
return;
}
_checked = checked;
if (userRequested) {
KnobGroupPtr knob = _knob.lock();
if (knob) {
knob->setValue(checked);
}
}
//getGui()->getPropertiesBin()->setUpdatesEnabled(false);
for (std::list<KnobGuiWPtr>::iterator it = _children.begin(); it != _children.end(); ++it) {
KnobGuiPtr knob = it->lock();
if (!knob) {
continue;
}
if (!checked) {
knob->hide();
} else if ( !knob->getKnob()->getIsSecret() ) {
knob->show();
}
}
//getGui()->getPropertiesBin()->setUpdatesEnabled(true);
}
示例4: getKnobGui
void
KnobGuiFile::createWidget(QHBoxLayout* layout)
{
KnobGuiPtr knobUI = getKnobGui();
if (!knobUI) {
return;
}
Gui* gui = knobUI->getGui();
if (!gui) {
return;
}
GuiAppInstancePtr app = gui->getApp();
if (!app) {
return;
}
KnobFilePtr knob = _knob.lock();
if (!knob) {
return;
}
EffectInstancePtr holderIsEffect = toEffectInstance( knob->getHolder() );
if ( holderIsEffect && holderIsEffect->isReader() && (knob->getName() == kOfxImageEffectFileParamName) ) {
TimeLinePtr timeline = app->getTimeLine();
QObject::connect( timeline.get(), SIGNAL(frameChanged(SequenceTime,int)), this, SLOT(onTimelineFrameChanged(SequenceTime,int)) );
}
示例5: KnobGuiValue
KnobGuiColor::KnobGuiColor(const KnobGuiPtr& knobUI, ViewIdx view)
: KnobGuiValue(knobUI, view)
, _knob( toKnobColor(knobUI->getKnob()) )
, _colorLabel(0)
, _colorDialogButton(0)
, _useSimplifiedUI(false)
, _uiColorspaceLut(0)
, _internalColorspaceLut(0)
{
KnobColorPtr knob = _knob.lock();
if (!knob) {
return;
}
_useSimplifiedUI = knob && knob->isSimplified();
if (!_useSimplifiedUI) {
DimIdx singleDim;
bool singleDimEnabled = knobUI->isSingleDimensionalEnabled(&singleDim);
if (knobUI->getLayoutType() == KnobGui::eKnobLayoutTypeViewerUI && !singleDimEnabled) {
_useSimplifiedUI = true;
}
}
const std::string& uiName = knob->getUIColorspaceName();
const std::string& internalName = knob->getInternalColorspaceName();
_uiColorspaceLut = Color::LutManager::findLut(uiName);
_internalColorspaceLut = Color::LutManager::findLut(internalName);
}
示例6: values
void
KnobGuiColor::onDialogCurrentColorChanged(const QColor & color)
{
KnobColorPtr knob = _knob.lock();
bool isSimple = _useSimplifiedUI;
int nDims = knob->getNDimensions();
std::vector<double> values(nDims);
values[0] = isSimple ? color.redF() : Color::from_func_srgb( color.redF() );
if (nDims >= 3) {
values[1] = isSimple ? color.greenF() : Color::from_func_srgb( color.greenF() );
values[2] = isSimple ? color.blueF() : Color::from_func_srgb( color.blueF() );
if (nDims == 4) {
values[3] = color.alphaF();
}
}
KnobGuiPtr knobUI = getKnobGui();
knob->setValueAcrossDimensions(values, DimIdx(0), getView(), eValueChangedReasonUserEdited);
if ( knobUI->getGui() ) {
knobUI->getGui()->setDraftRenderEnabled(true);
}
}
示例7: assert
void
DSRemoveKeysCommand::addOrRemoveKeyframe(bool add)
{
std::set<KnobGuiPtr> knobsSet;
for (std::vector<DopeSheetKey>::iterator it = _keys.begin(); it != _keys.end(); ++it) {
DopeSheetKey selected = (*it);
DSKnobPtr knobContext = selected.context.lock();
if (!knobContext) {
continue;
}
KnobGuiPtr knobGui = knobContext->getKnobGui();
assert(knobGui);
std::pair<std::set<KnobGuiPtr>::iterator,bool> ok = knobsSet.insert(knobGui);
if (ok.second) {
knobGui->getKnob()->beginChanges();
}
if (add) {
knobGui->setKeyframe( selected.key.getTime(), selected.key, knobContext->getDimension(), ViewIdx(0) );
} else {
knobGui->removeKeyFrame( selected.key.getTime(), knobContext->getDimension(), ViewIdx(0) );
knobContext->getTreeItem()->setSelected(false);
}
}
for (std::set<KnobGuiPtr>::iterator it = knobsSet.begin(); it != knobsSet.end(); ++it) {
(*it)->getKnob()->endChanges();
}
_model->refreshSelectionBboxAndRedrawView();
}
示例8: getKnobGui
void
KnobGuiButton::createWidget(QHBoxLayout* layout)
{
KnobGuiPtr knobUI = getKnobGui();
KnobButtonPtr knob = _knob.lock();
_button = new Button( layout->parentWidget() );
if (knobUI->getLayoutType() == KnobGui::eKnobLayoutTypeTableItemWidget) {
_button->setIconSize( QSize(TO_DPIX(NATRON_SMALL_BUTTON_ICON_SIZE), TO_DPIY(NATRON_SMALL_BUTTON_ICON_SIZE)) );
} else {
_button->setIconSize( QSize(TO_DPIX(NATRON_MEDIUM_BUTTON_ICON_SIZE), TO_DPIY(NATRON_MEDIUM_BUTTON_ICON_SIZE)) );
}
loadPixmaps(false, QColor());
if (!_button->icon().isNull()) {
_button->setFixedSize(TO_DPIX(NATRON_MEDIUM_BUTTON_SIZE), TO_DPIY(NATRON_MEDIUM_BUTTON_SIZE));
}
bool checkable = knob->getIsCheckable();
if (checkable) {
_button->setCheckable(true);
bool checked = knob->getValue();
_button->setChecked(checked);
_button->setDown(checked);
}
QObject::connect( _button, SIGNAL(clicked(bool)), this, SLOT(emitValueChanged(bool)) );
if ( knobUI->hasToolTip() ) {
knobUI->toolTip(_button, getView());
}
layout->addWidget(_button);
} // KnobGuiButton::createWidget
示例9: ss
PasteUndoCommand::PasteUndoCommand(const KnobGuiPtr& knob,
KnobClipBoardType type,
int fromDimension,
int targetDimension,
const KnobPtr& fromKnob)
: QUndoCommand(0)
, _imp( new PasteUndoCommandPrivate() )
{
_imp->knob = knob;
_imp->type = type;
_imp->fromDimension = fromDimension;
_imp->targetDimension = targetDimension;
_imp->fromKnob = fromKnob;
{
std::ostringstream ss;
{
try {
boost::archive::xml_oarchive oArchive(ss);
_imp->originalSerialization->initialize( knob->getKnob() );
oArchive << boost::serialization::make_nvp("KnobClipboard", *_imp->originalSerialization);
} catch (...) {
assert(false);
}
}
_imp->originalSerialization.reset(new KnobSerialization);
std::string str = ss.str();
{
try {
std::stringstream ss(str);
boost::archive::xml_iarchive iArchive(ss);
iArchive >> boost::serialization::make_nvp("KnobClipboard", *_imp->originalSerialization);
} catch (...) {
assert(false);
}
}
}
assert( _imp->originalSerialization->getKnob() );
assert(knob);
assert( _imp->targetDimension >= -1 && _imp->targetDimension < _imp->knob.lock()->getKnob()->getDimension() );
assert( _imp->fromDimension >= -1 && _imp->fromDimension < _imp->fromKnob->getDimension() );
QString text;
switch (type) {
case eKnobClipBoardTypeCopyAnim:
text = tr("Paste Animation to %1");
break;
case eKnobClipBoardTypeCopyValue:
text = tr("Paste Value to %1");
break;
case eKnobClipBoardTypeCopyLink:
text = tr("Paste Link to %1");
break;
}
setText( text.arg( QString::fromUtf8( knob->getKnob()->getLabel().c_str() ) ) );
}
示例10: getKnobGui
void
KnobGuiBool::updateToolTip()
{
KnobGuiPtr knob = getKnobGui();
if ( knob->hasToolTip() ) {
for (int i = 0; i < _knob.lock()->getNDimensions(); ++i) {
knob->toolTip(_checkBox, getView());
}
}
}
示例11: getKnobGui
void
KnobGuiChoice::onCurrentIndexChanged(int i)
{
KnobGuiPtr knobUI = getKnobGui();
knobUI->setWarningValue( KnobGui::eKnobWarningChoiceMenuOutOfDate, QString() );
KnobChoicePtr knob = _knob.lock();
if (!knob) {
return;
}
knobUI->pushUndoCommand( new KnobUndoCommand<int>(knob, knob->getValue(DimIdx(0), getView()), i, DimIdx(0), getView()));
}
示例12: _hide
void
KnobGui::hide()
{
if (!_imp->customInteract) {
_hide();
} else {
_imp->customInteract->hide();
}
//also hide the curve from the curve editor if there's any and the knob is not inside a group
KnobPtr knob = getKnob();
if ( knob && knob->getHolder() && knob->getHolder()->getApp() ) {
KnobPtr parent = getKnob()->getParentKnob();
bool isSecret = true;
while (parent) {
if ( !parent->getIsSecret() ) {
isSecret = false;
break;
}
parent = parent->getParentKnob();
}
if (isSecret) {
getGui()->getCurveEditor()->hideCurves( shared_from_this() );
}
}
////In order to remove the row of the layout we have to make sure ALL the knobs on the row
////are hidden.
bool shouldRemoveWidget = true;
for (U32 i = 0; i < _imp->knobsOnSameLine.size(); ++i) {
KnobGuiPtr sibling = _imp->container->getKnobGui( _imp->knobsOnSameLine[i].lock() );
if ( sibling && !sibling->isSecretRecursive() ) {
shouldRemoveWidget = false;
}
}
if (shouldRemoveWidget) {
if (_imp->field) {
_imp->field->hide();
}
if (_imp->container) {
_imp->container->refreshTabWidgetMaxHeight();
}
} else {
if ( _imp->field && !_imp->field->isVisible() ) {
_imp->field->show();
}
}
if (_imp->labelContainer) {
_imp->labelContainer->hide();
} else if (_imp->descriptionLabel) {
_imp->descriptionLabel->hide();
}
} // KnobGui::hide
示例13: getKnobGui
void
KnobGuiBool::updateToolTip()
{
KnobGuiPtr knobgui = getKnobGui();
if ( knobgui->hasToolTip() ) {
KnobBoolPtr knob = _knob.lock();
if (!knob) {
return;
}
knobgui->toolTip(_checkBox, getView());
}
}
示例14: getKnobGui
void
KnobGuiColor::onColorLabelPickingEnabled(bool enabled)
{
KnobColorPtr knob = _knob.lock();
KnobGuiPtr knobUI = getKnobGui();
if ( knob->getHolder()->getApp() ) {
if (enabled) {
knobUI->getGui()->registerNewColorPicker( _knob.lock(), getView() );
} else {
knobUI->getGui()->removeColorPicker( _knob.lock(), getView());
}
}
}
示例15:
void
KnobGuiGroup::_hide()
{
if (_button) {
_button->hide();
}
for (std::list<KnobGuiWPtr>::iterator it = _children.begin(); it != _children.end(); ++it) {
KnobGuiPtr k = it->lock();
if (!k) {
continue;
}
k->hide();
}
}