本文整理汇总了C++中NodePtr::getApp方法的典型用法代码示例。如果您正苦于以下问题:C++ NodePtr::getApp方法的具体用法?C++ NodePtr::getApp怎么用?C++ NodePtr::getApp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodePtr
的用法示例。
在下文中一共展示了NodePtr::getApp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getOutputNode
void
ViewerDisplayScheduler::onRenderStopped(bool /*/aborted*/)
{
// Refresh all previews in the tree
NodePtr effect = getOutputNode();
effect->getApp()->refreshAllPreviews();
if ( effect->getApp()->isGuiFrozen() ) {
getEngine()->s_refreshAllKnobs();
}
}
示例2:
void
TrackerHelper::onSchedulerTrackingProgress(double progress)
{
TrackerParamsProviderPtr provider = _imp->provider.lock();
if (!provider) {
return;
}
NodePtr node = provider->getTrackerNode();
if (!node) {
return;
}
if ( node->getApp() && !node->getApp()->progressUpdate(node, progress) ) {
_imp->scheduler->abortThreadedTask();
}
}
示例3: getContext
void
TrackMarker::resetCenter()
{
TrackerContextPtr context = getContext();
assert(context);
NodePtr input = context->getNode()->getInput(0);
if (input) {
SequenceTime time = input->getApp()->getTimeLine()->currentFrame();
RenderScale scale;
scale.x = scale.y = 1;
RectD rod;
bool isProjectFormat;
StatusEnum stat = input->getEffectInstance()->getRegionOfDefinition_public(input->getHashValue(), time, scale, ViewIdx(0), &rod, &isProjectFormat);
Point center;
center.x = 0;
center.y = 0;
if (stat == eStatusOK) {
center.x = (rod.x1 + rod.x2) / 2.;
center.y = (rod.y1 + rod.y2) / 2.;
}
KnobDoublePtr centerKnob = getCenterKnob();
centerKnob->setValue(center.x, ViewSpec::current(), 0);
centerKnob->setValue(center.y, ViewSpec::current(), 1);
}
}
示例4: EffectInstance
OneViewNode::OneViewNode(const NodePtr& n)
: EffectInstance(n)
, _imp( new OneViewNodePrivate() )
{
setSupportsRenderScaleMaybe(eSupportsYes);
if (n) {
ProjectPtr project = n->getApp()->getProject();
QObject::connect( project.get(), SIGNAL(projectViewsChanged()), this, SLOT(onProjectViewsChanged()) );
}
}
示例5: assert
void
TrackerNode::onTransformSolverWatcherProgress(int progress)
{
assert(_imp->lastSolveRequest.tWatcher);
NodePtr thisNode = getNode();
double min = _imp->lastSolveRequest.tWatcher->progressMinimum();
double max = _imp->lastSolveRequest.tWatcher->progressMaximum();
double p = (progress - min) / (max - min);
thisNode->getApp()->progressUpdate(thisNode, p);
}
示例6: f
///High level test: render 1 frame of dot generator
TEST_F(BaseTest, GenerateDot)
{
///create the generator
NodePtr generator = createNode(_generatorPluginID);
///create the writer and set its output filename
NodePtr writer = createNode(_writeOIIOPluginID);
ASSERT_TRUE(generator && writer);
KnobIPtr frameRange = generator->getApp()->getProject()->getKnobByName("frameRange");
ASSERT_TRUE(frameRange);
KnobIntPtr knob = toKnobInt(frameRange);
ASSERT_TRUE(knob);
knob->setValue(1, ViewSpec::all(), 0);
knob->setValue(1, ViewSpec::all(), 1);
Format f(0, 0, 200, 200, "toto", 1.);
generator->getApp()->getProject()->setOrAddProjectFormat(f);
const QString& binPath = appPTR->getApplicationBinaryPath();
QString filePath = binPath + QString::fromUtf8("/test_dot_generator.jpg");
writer->setOutputFilesForWriter( filePath.toStdString() );
///attempt to connect the 2 nodes together
connectNodes(generator, writer, 0, true);
///and start rendering. This call is blocking.
std::list<AppInstance::RenderWork> works;
AppInstance::RenderWork w;
w.writer = toOutputEffectInstance( writer->getEffectInstance() );
assert(w.writer);
w.firstFrame = INT_MIN;
w.lastFrame = INT_MAX;
w.frameStep = INT_MIN;
w.useRenderStats = false;
works.push_back(w);
getApp()->startWritersRendering(false, works);
EXPECT_TRUE( QFile::exists(filePath) );
QFile::remove(filePath);
}
示例7: setSolverParamsEnabled
void
TrackerNodePrivate::endSolve()
{
lastSolveRequest.cpWatcher.reset();
lastSolveRequest.tWatcher.reset();
lastSolveRequest.keyframes.clear();
lastSolveRequest.allMarkers.clear();
setSolverParamsEnabled(true);
NodePtr n = publicInterface->getNode();
n->getApp()->progressEnd(n);
n->getEffectInstance()->endChanges();
}
示例8: trackingStarted
void
TrackerHelper::onSchedulerTrackingStarted(int frameStep)
{
TrackerParamsProviderPtr provider = _imp->provider.lock();
if (!provider) {
return;
}
NodePtr node = provider->getTrackerNode();
if (!node) {
return;
}
node->getApp()->progressStart(node, tr("Tracking...").toStdString(), "");
Q_EMIT trackingStarted(frameStep);
}
示例9: trackingFinished
void
TrackerHelper::onSchedulerTrackingFinished()
{
TrackerParamsProviderPtr provider = _imp->provider.lock();
if (!provider) {
return;
}
NodePtr node = provider->getTrackerNode();
if (!node) {
return;
}
node->getApp()->progressEnd( node );
Q_EMIT trackingFinished();
}
示例10: SIGNAL
void
TrackerNodePrivate::computeTransformParamsFromTracks()
{
boost::shared_ptr<TrackerParamsProvider> thisShared = shared_from_this();
#ifndef TRACKER_GENERATE_DATA_SEQUENTIALLY
lastSolveRequest.cpWatcher.reset();
lastSolveRequest.tWatcher.reset( new QFutureWatcher<TransformData>() );
QObject::connect( lastSolveRequest.tWatcher.get(), SIGNAL(finished()), publicInterface, SLOT(onTransformSolverWatcherFinished()) );
QObject::connect( lastSolveRequest.tWatcher.get(), SIGNAL(progressValueChanged(int)), publicInterface, SLOT(onTransformSolverWatcherProgress(int)) );
lastSolveRequest.tWatcher->setFuture( QtConcurrent::mapped( lastSolveRequest.keyframes, boost::bind(&TrackerHelper::computeTransformParamsFromTracksAtTime,
lastSolveRequest.refTime,
_1,
lastSolveRequest.jitterPeriod,
lastSolveRequest.jitterAdd,
lastSolveRequest.robustModel,
thisShared,
center.lock(),
lastSolveRequest.allMarkers)) );
#else
NodePtr thisNode = publicInterface->getNode();
QList<TransformData> validResults;
{
int nKeys = lastSolveRequest.keyframes.size();
int keyIndex = 0;
for (std::set<double>::const_iterator it = lastSolveRequest.keyframes.begin(); it != lastSolveRequest.keyframes.end(); ++it, ++keyIndex) {
TransformData data = tracker->computeTransformParamsFromTracksAtTime(lastSolveRequest.refTime, *it, lastSolveRequest.jitterPeriod, lastSolveRequest.jitterAdd, lastSolveRequest.robustModel, thisShared, center.lock(), lastSolveRequest.allMarkers);
if (data.valid) {
validResults.push_back(data);
}
double progress = (keyIndex + 1) / (double)nKeys;
thisNode->getApp()->progressUpdate(thisNode, progress);
}
}
computeTransformParamsFromTracksEnd(lastSolveRequest.refTime, lastSolveRequest.maxFittingError, validResults);
#endif
} // TrackerContextPrivate::computeTransformParamsFromTracks
示例11: time
void
TrackMarker::resetCenter()
{
KnobItemsTablePtr model = getModel();
if (!model) {
return;
}
RectD rod;
NodePtr input = model->getNode()->getInput(0);
if (!input) {
Format f;
getApp()->getProject()->getProjectDefaultFormat(&f);
rod = f.toCanonicalFormat();
} else {
TimeValue time(input->getApp()->getTimeLine()->currentFrame());
RenderScale scale(1.);
RectD rod;
{
GetRegionOfDefinitionResultsPtr results;
ActionRetCodeEnum stat = input->getEffectInstance()->getRegionOfDefinition_public(time, scale, ViewIdx(0), &results);
if (!isFailureRetCode(stat)) {
rod = results->getRoD();
}
}
Point center;
center.x = 0;
center.y = 0;
center.x = (rod.x1 + rod.x2) / 2.;
center.y = (rod.y1 + rod.y2) / 2.;
KnobDoublePtr centerKnob = getCenterKnob();
centerKnob->setValue(center.x, ViewSetSpec::all(), DimIdx(0));
centerKnob->setValue(center.y, ViewSetSpec::all(), DimIdx(1));
}
}
示例12: make_pair
std::pair<ImagePtr, RectI>
TrackMarker::getMarkerImage(int time,
const RectI& roi) const
{
std::list<ImageComponents> components;
components.push_back( ImageComponents::getRGBComponents() );
const unsigned int mipmapLevel = 0;
assert( !roi.isNull() );
NodePtr node = getContext()->getNode();
NodePtr input = node->getInput(0);
if (!input) {
return std::make_pair(ImagePtr(), roi);
}
AbortableRenderInfoPtr abortInfo = AbortableRenderInfo::create(false, 0);
const bool isRenderUserInteraction = true;
const bool isSequentialRender = false;
AbortableThread* isAbortable = dynamic_cast<AbortableThread*>( QThread::currentThread() );
if (isAbortable) {
isAbortable->setAbortInfo( isRenderUserInteraction, abortInfo, node->getEffectInstance() );
}
ParallelRenderArgsSetter::CtorArgsPtr tlsArgs(new ParallelRenderArgsSetter::CtorArgs);
tlsArgs->time = time;
tlsArgs->view = ViewIdx(0);
tlsArgs->isRenderUserInteraction = isRenderUserInteraction;
tlsArgs->isSequential = isSequentialRender;
tlsArgs->abortInfo = abortInfo;
tlsArgs->treeRoot = getContext()->getNode();
tlsArgs->textureIndex = 0;
tlsArgs->timeline = node->getApp()->getTimeLine();
tlsArgs->activeRotoPaintNode = NodePtr();
tlsArgs->activeRotoDrawableItem = RotoDrawableItemPtr();
tlsArgs->isDoingRotoNeatRender = false;
tlsArgs->isAnalysis = true;
tlsArgs->draftMode = true;
tlsArgs->stats = RenderStatsPtr();
ParallelRenderArgsSetter frameRenderArgs(tlsArgs);
RenderScale scale;
scale.x = scale.y = 1.;
EffectInstance::RenderRoIArgs args( time,
scale,
mipmapLevel, //mipmaplevel
ViewIdx(0),
false,
roi,
RectD(),
components,
eImageBitDepthFloat,
false,
node->getEffectInstance(),
eStorageModeRAM /*returnOpenGlTex*/,
time);
std::map<ImageComponents, ImagePtr> planes;
EffectInstance::RenderRoIRetCode stat = input->getEffectInstance()->renderRoI(args, &planes);
appPTR->getAppTLS()->cleanupTLSForThread();
if ( (stat != EffectInstance::eRenderRoIRetCodeOk) || planes.empty() ) {
return std::make_pair(ImagePtr(), roi);
}
return std::make_pair(planes.begin()->second, roi);
} // TrackMarker::getMarkerImage
示例13: k
/*
* @brief This is called by LibMV to retrieve an image either for reference or as search frame.
*/
mv::FrameAccessor::Key
TrackerFrameAccessor::GetImage(int /*clip*/,
int frame,
mv::FrameAccessor::InputMode input_mode,
int downscale, // Downscale by 2^downscale.
const mv::Region* region, // Get full image if NULL.
const mv::FrameAccessor::Transform* /*transform*/, // May be NULL.
mv::FloatImage** destination)
{
// Since libmv only uses MONO images for now we have only optimized for this case, remove and handle properly
// other case(s) when they get integrated into libmv.
assert(input_mode == mv::FrameAccessor::MONO);
FrameAccessorCacheKey key;
key.frame = frame;
key.mipMapLevel = downscale;
key.mode = input_mode;
/*
Check if a frame exists in the cache with matching key and bounds enclosing the given region
*/
RectI roi;
if (region) {
convertLibMVRegionToRectI(*region, _imp->formatHeight, &roi);
QMutexLocker k(&_imp->cacheMutex);
std::pair<FrameAccessorCache::iterator, FrameAccessorCache::iterator> range = _imp->cache.equal_range(key);
for (FrameAccessorCache::iterator it = range.first; it != range.second; ++it) {
if ( (roi.x1 >= it->second.bounds.x1) && (roi.x2 <= it->second.bounds.x2) &&
( roi.y1 >= it->second.bounds.y1) && ( roi.y2 <= it->second.bounds.y2) ) {
#ifdef TRACE_LIB_MV
qDebug() << QThread::currentThread() << "FrameAccessor::GetImage():" << "Found cached image at frame" << frame << "with RoI x1="
<< region->min(0) << "y1=" << region->max(1) << "x2=" << region->max(0) << "y2=" << region->min(1);
#endif
// LibMV is kinda dumb on this we must necessarily copy the data either via CopyFrom or the
// assignment constructor:
// EDIT: fixed libmv
*destination = it->second.image.get();
//destination->CopyFrom<float>(*it->second.image);
++it->second.referenceCount;
return (mv::FrameAccessor::Key)it->second.image.get();
}
}
}
EffectInstancePtr effect;
if (_imp->trackerInput) {
effect = _imp->trackerInput->getEffectInstance();
}
if (!effect) {
return (mv::FrameAccessor::Key)0;
}
// Not in accessor cache, call renderRoI
RenderScale scale;
scale.y = scale.x = Image::getScaleFromMipMapLevel( (unsigned int)downscale );
RectD precomputedRoD;
if (!region) {
bool isProjectFormat;
StatusEnum stat = effect->getRegionOfDefinition_public(_imp->trackerInput->getHashValue(), frame, scale, ViewIdx(0), &precomputedRoD, &isProjectFormat);
if (stat == eStatusFailed) {
return (mv::FrameAccessor::Key)0;
}
double par = effect->getAspectRatio(-1);
precomputedRoD.toPixelEnclosing( (unsigned int)downscale, par, &roi );
}
std::list<ImageComponents> components;
components.push_back( ImageComponents::getRGBComponents() );
NodePtr node = _imp->context->getNode();
const bool isRenderUserInteraction = true;
const bool isSequentialRender = false;
AbortableRenderInfoPtr abortInfo = AbortableRenderInfo::create(false, 0);
AbortableThread* isAbortable = dynamic_cast<AbortableThread*>( QThread::currentThread() );
if (isAbortable) {
isAbortable->setAbortInfo( isRenderUserInteraction, abortInfo, node->getEffectInstance() );
}
ParallelRenderArgsSetter::CtorArgsPtr tlsArgs(new ParallelRenderArgsSetter::CtorArgs);
tlsArgs->time = frame;
tlsArgs->view = ViewIdx(0);
tlsArgs->isRenderUserInteraction = isRenderUserInteraction;
tlsArgs->isSequential = isSequentialRender;
tlsArgs->abortInfo = abortInfo;
tlsArgs->treeRoot = node;
tlsArgs->textureIndex = 0;
tlsArgs->timeline = node->getApp()->getTimeLine();
tlsArgs->activeRotoPaintNode = NodePtr();
tlsArgs->activeRotoDrawableItem = RotoDrawableItemPtr();
tlsArgs->isDoingRotoNeatRender = false;
tlsArgs->isAnalysis = true;
//.........这里部分代码省略.........
示例14: args
void
TrackerNodePrivate::exportTrackDataFromExportOptions()
{
//bool transformLink = _imp->exportLink.lock()->getValue();
KnobChoicePtr transformTypeKnob = transformType.lock();
assert(transformTypeKnob);
int transformType_i = transformTypeKnob->getValue();
TrackerTransformNodeEnum transformType = (TrackerTransformNodeEnum)transformType_i;
KnobChoicePtr motionTypeKnob = motionType.lock();
if (!motionTypeKnob) {
return;
}
int motionType_i = motionTypeKnob->getValue();
TrackerMotionTypeEnum mt = (TrackerMotionTypeEnum)motionType_i;
if (mt == eTrackerMotionTypeNone) {
Dialogs::errorDialog( tr("Tracker Export").toStdString(), tr("Please select the export mode with the Motion Type parameter").toStdString() );
return;
}
bool linked = exportLink.lock()->getValue();
QString pluginID;
switch (transformType) {
case eTrackerTransformNodeCornerPin:
pluginID = QString::fromUtf8(PLUGINID_OFX_CORNERPIN);
break;
case eTrackerTransformNodeTransform:
pluginID = QString::fromUtf8(PLUGINID_OFX_TRANSFORM);
break;
}
NodePtr thisNode = publicInterface->getNode();
AppInstancePtr app = thisNode->getApp();
CreateNodeArgsPtr args(CreateNodeArgs::create( pluginID.toStdString(), thisNode->getGroup() ));
args->setProperty<bool>(kCreateNodeArgsPropAutoConnect, false);
args->setProperty<bool>(kCreateNodeArgsPropSettingsOpened, false);
NodePtr createdNode = app->createNode(args);
if (!createdNode) {
return;
}
// Move the new node
double thisNodePos[2];
double thisNodeSize[2];
thisNode->getPosition(&thisNodePos[0], &thisNodePos[1]);
thisNode->getSize(&thisNodeSize[0], &thisNodeSize[1]);
createdNode->setPosition(thisNodePos[0] + thisNodeSize[0] * 2., thisNodePos[1]);
TimeValue timeForFromPoints(referenceFrame.lock()->getValue());
switch (transformType) {
case eTrackerTransformNodeCornerPin: {
KnobDoublePtr cornerPinToPoints[4];
KnobDoublePtr cornerPinFromPoints[4];
for (unsigned int i = 0; i < 4; ++i) {
cornerPinFromPoints[i] = getCornerPinPoint(createdNode, true, i);
assert(cornerPinFromPoints[i]);
for (int j = 0; j < cornerPinFromPoints[i]->getNDimensions(); ++j) {
cornerPinFromPoints[i]->setValue(fromPoints[i].lock()->getValueAtTime(timeForFromPoints, DimIdx(j)), ViewSetSpec::all(), DimIdx(j));
}
cornerPinToPoints[i] = getCornerPinPoint(createdNode, false, i);
assert(cornerPinToPoints[i]);
if (!linked) {
cornerPinToPoints[i]->copyKnob( toPoints[i].lock() );
} else {
bool ok = cornerPinToPoints[i]->linkTo(toPoints[i].lock());
(void)ok;
assert(ok);
}
}
{
KnobIPtr knob = createdNode->getKnobByName(kCornerPinParamMatrix);
if (knob) {
KnobDoublePtr isType = toKnobDouble(knob);
if (isType) {
isType->copyKnob(cornerPinMatrix.lock() );
}
}
}
break;
}
case eTrackerTransformNodeTransform: {
KnobIPtr translateKnob = createdNode->getKnobByName(kTransformParamTranslate);
if (translateKnob) {
KnobDoublePtr isDbl = toKnobDouble(translateKnob);
if (isDbl) {
if (!linked) {
isDbl->copyKnob(translate.lock() );
} else {
ignore_result(isDbl->linkTo(translate.lock()));
}
}
}
//.........这里部分代码省略.........
示例15: refTime
void
TrackerNodePrivate::solveTransformParams()
{
setTransformOutOfDate(false);
std::vector<TrackMarkerPtr> markers;
knobsTable->getAllMarkers(&markers);
if ( markers.empty() ) {
return;
}
resetTransformParamsAnimation();
KnobChoicePtr motionTypeKnob = motionType.lock();
int motionType_i = motionTypeKnob->getValue();
TrackerMotionTypeEnum type = (TrackerMotionTypeEnum)motionType_i;
TimeValue refTime(referenceFrame.lock()->getValue());
int jitterPer = 0;
bool jitterAdd = false;
switch (type) {
case eTrackerMotionTypeNone:
return;
case eTrackerMotionTypeMatchMove:
case eTrackerMotionTypeStabilize:
break;
case eTrackerMotionTypeAddJitter:
case eTrackerMotionTypeRemoveJitter: {
jitterPer = jitterPeriod.lock()->getValue();
jitterAdd = type == eTrackerMotionTypeAddJitter;
break;
}
}
setSolverParamsEnabled(false);
std::set<TimeValue> keyframes;
{
for (std::size_t i = 0; i < markers.size(); ++i) {
std::set<double> keys;
markers[i]->getCenterKeyframes(&keys);
for (std::set<double>::iterator it = keys.begin(); it != keys.end(); ++it) {
keyframes.insert(TimeValue(*it));
}
}
}
KnobChoicePtr transformTypeKnob = transformType.lock();
assert(transformTypeKnob);
int transformType_i = transformTypeKnob->getValue();
TrackerTransformNodeEnum transformType = (TrackerTransformNodeEnum)transformType_i;
NodePtr node = publicInterface->getNode();
invertTransform.lock()->setValue(type == eTrackerMotionTypeStabilize);
KnobDoublePtr centerKnob = center.lock();
// Set the center at the reference frame
Point centerValue = {0, 0};
int nSamplesAtRefTime = 0;
for (std::size_t i = 0; i < markers.size(); ++i) {
if ( !markers[i]->isEnabled(refTime) ) {
continue;
}
KnobDoublePtr markerCenterKnob = markers[i]->getCenterKnob();
centerValue.x += markerCenterKnob->getValueAtTime(refTime);
centerValue.y += markerCenterKnob->getValueAtTime(refTime, DimIdx(1));
++nSamplesAtRefTime;
}
if (nSamplesAtRefTime) {
centerValue.x /= nSamplesAtRefTime;
centerValue.y /= nSamplesAtRefTime;
{
std::vector<double> values(2);
values[0] = centerValue.x;
values[1] = centerValue.y;
centerKnob->setValueAcrossDimensions(values);
}
}
bool robust;
robust = robustModel.lock()->getValue();
KnobDoublePtr maxFittingErrorKnob = fittingErrorWarnIfAbove.lock();
const double maxFittingError = maxFittingErrorKnob->getValue();
node->getApp()->progressStart( node, tr("Solving for transform parameters...").toStdString(), std::string() );
lastSolveRequest.refTime = refTime;
lastSolveRequest.jitterPeriod = jitterPer;
lastSolveRequest.jitterAdd = jitterAdd;
lastSolveRequest.allMarkers = markers;
lastSolveRequest.keyframes = keyframes;
lastSolveRequest.robustModel = robust;
lastSolveRequest.maxFittingError = maxFittingError;
switch (transformType) {
case eTrackerTransformNodeTransform:
//.........这里部分代码省略.........