本文整理汇总了C++中UT_Interrupt类 的典型用法代码示例。如果您正苦于以下问题:C++ UT_Interrupt类的具体用法?C++ UT_Interrupt怎么用?C++ UT_Interrupt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UT_Interrupt类 的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: duplicateSource
OP_ERROR
SOP_Cleave::cookMySop(OP_Context &context)
{
const GA_PrimitiveGroup *polyGroup;
GEO_Primitive *prim;
GQ_Detail *gqd;
int i,j,k;
UT_Vector4 np,p;
// Before we do anything, we must lock our inputs. Before returning,
// we have to make sure that the inputs get unlocked.
if (lockInputs(context) >= UT_ERROR_ABORT) return error();
float now = context.getTime();
duplicateSource(0, context, 0, 1);
// Here we determine which groups we have to work on. We only
// handle poly groups.
UT_String groups;
getGroups(groups);
if (groups.isstring()) polyGroup = parsePrimitiveGroups(groups);
else polyGroup = 0;
if (error() >= UT_ERROR_ABORT) {
unlockInputs();
return error();
}
UT_Interrupt* boss = UTgetInterrupt();
// Start the interrupt server
boss->opStart("Cleaving Polys");
// separate out all polys to be cleaved
GA_PrimitiveGroup* cleave_group = gdp->newPrimitiveGroup("cleave",1);
GA_PrimitiveGroup* not_cleave_group = gdp->newPrimitiveGroup("not_cleave",1);
if (polyGroup) {
GA_FOR_ALL_PRIMITIVES(gdp,prim)
{
if ( (prim->getTypeId()==GEO_PRIMPOLY) && (polyGroup->contains(prim)!=0))
cleave_group->add(prim);
else
not_cleave_group->add(prim);
}
} else {
开发者ID:NextGenIntelligence, 项目名称:hot, 代码行数:54, 代码来源:SOP_Cleave.C
示例2: main
int main(int argc, char* argv[])
{
static UT_Interrupt boss("testGusdError");
boss.setEnabled(1,1);
UTsetInterrupt(&boss);
_TestGusdBasicErrors();
_TestGusdErrorTransport();
_TestGusdTfErrorScope();
return 0;
}
开发者ID:PixarAnimationStudios, 项目名称:USD, 代码行数:12, 代码来源:testGusdErrors.cpp
示例3: error
OP_ERROR SOP_CortexConverter::cookMySop( OP_Context &context )
{
if( lockInputs( context ) >= UT_ERROR_ABORT )
{
return error();
}
UT_Interrupt *boss = UTgetInterrupt();
boss->opStart("Building CortexConverter Geometry...");
gdp->clearAndDestroy();
UT_String nameFilterStr;
evalString( nameFilterStr, pNameFilter.getToken(), 0, 0 );
UT_StringMMPattern nameFilter;
nameFilter.compile( nameFilterStr );
UT_String p( "P" );
UT_String attributeFilter;
evalString( attributeFilter, pAttributeFilter.getToken(), 0, 0 );
if ( !p.match( attributeFilter ) )
{
attributeFilter += " P";
}
const std::string attributeFilterStr = attributeFilter.toStdString();
ResultType type = (ResultType)this->evalInt( pResultType.getToken(), 0, 0 );
bool convertStandardAttributes = evalInt( pConvertStandardAttributes.getToken(), 0, 0 );
DetailSplitterPtr splitter = new DetailSplitter( inputGeoHandle( 0 ) );
std::vector<std::string> names;
splitter->values( names );
for ( std::vector<std::string>::const_iterator it = names.begin(); it != names.end(); ++it )
{
const std::string &name = *it;
// we want match all to also match no-name
if ( UT_String( name ).multiMatch( nameFilter ) || ( name == "" && UT_String( "*" ).multiMatch( nameFilter ) ) )
{
doConvert( splitter->split( name ), name, type, attributeFilterStr, convertStandardAttributes );
}
else
{
doPassThrough( splitter->split( name ), name );
}
}
boss->opEnd();
unlockInputs();
return error();
}
开发者ID:AtomicFiction, 项目名称:cortex, 代码行数:50, 代码来源:SOP_CortexConverter.cpp
示例4: handlerScope
/// Cook the SOP! This method does all the work
OP_ERROR SOP_ProceduralHolder::cookMySop( OP_Context &context )
{
IECore::MessageHandler::Scope handlerScope( getMessageHandler() );
// some defaults and useful variables
float now = context.getTime();
// force eval of our nodes parameters with our hidden parameter expression
evalInt( "__evaluateParameters", 0, now );
// update parameters on procedural from our Houdini parameters
IECore::ParameterisedProceduralPtr procedural = IECore::runTimeCast<IECore::ParameterisedProcedural>( getParameterised() );
// check for a valid parameterised on this SOP
if ( !procedural )
{
UT_String msg( "Procedural Holder has no parameterised class to operate on!" );
addError( SOP_MESSAGE, msg );
return error();
}
if( lockInputs(context) >= UT_ERROR_ABORT )
{
return error();
}
// start our work
UT_Interrupt *boss = UTgetInterrupt();
boss->opStart("Building ProceduralHolder Geometry...");
gdp->clearAndDestroy();
setParameterisedValues( now );
ToHoudiniCortexObjectConverterPtr converter = new ToHoudiniCortexObjectConverter( procedural );
if ( !converter->convert( myGdpHandle ) )
{
addError( SOP_MESSAGE, "Unable to store procedural on gdp" );
}
// tidy up & go home!
boss->opEnd();
unlockInputs();
return error();
}
开发者ID:Shockspot, 项目名称:cortex, 代码行数:45, 代码来源:SOP_ProceduralHolder.cpp
示例5: cookMySop
// the bit that does all the work
OP_ERROR SOP_rmanPtc::cookMySop(OP_Context &context)
{
// get some useful bits & bobs
UT_Interrupt *boss;
float now = context.myTime;
UT_String ptcFile = getPtcFile(now);
int loadPercentage = getLoadPercentage(now);
int displayPercentage = getDisplayPercentage(now);
float pointSize = getPointSize(now);
int useDisk = getUseDisk(now);
int boundOnLoad = getBoundOnLoad(now);
int displayChannel = getDisplayChannel(now);
int onlyOutputDisplayChannel = getOnlyOutputDisplayChannel(now);
/*
float nearDensity = getNearDensity(now);
float farDensity = getFarDensity(now);
UT_String cullCamera = getCullCamera(now);
*/
// lock out inputs
if ( lockInputs(context) >= UT_ERROR_ABORT)
error();
// Check to see that there hasn't been a critical error in cooking the SOP.
if (error() < UT_ERROR_ABORT)
{
boss = UTgetInterrupt();
// here we make sure our detail is an instance of rmanPtcDetail
rmanPtcDetail *ptc_gdp = dynamic_cast<rmanPtcSop::rmanPtcDetail *>(gdp);
if ( !ptc_gdp )
ptc_gdp = allocateNewDetail();
// clear our gdp
ptc_gdp->clearAndDestroy();
// start our work
boss->opStart("Loading point cloud");
// get our bbox
bool has_bbox = false;
const GU_Detail *input_geo = inputGeo( 0, context );
updateBBox( input_geo );
// pass information to our detail
ptc_gdp->point_size = pointSize;
ptc_gdp->use_disk = useDisk;
ptc_gdp->cull_bbox = mBBox;
ptc_gdp->use_cull_bbox = (mHasBBox&&(!mBoundOnLoad))?true:false;
ptc_gdp->display_probability = displayPercentage/100.f;
ptc_gdp->display_channel = displayChannel;
if ( onlyOutputDisplayChannel )
ptc_gdp->display_channel = 0;
// here we load our ptc
if ( mReload )
{
// clear everything
mChannelNames.clear();
cachePoints.clear();
cacheNormals.clear();
cacheRadius.clear();
cacheData.clear();
mRedraw = true;
// open the point cloud
PtcPointCloud ptc = PtcSafeOpenPointCloudFile(
const_cast<char*>(ptcFile.buffer()) );
if ( !ptc )
{
UT_String msg( "Unable to open input file: " );
msg += ptcFile;
addError( SOP_MESSAGE, msg);
boss->opEnd();
return error();
}
// get some information from the ptc
ptc_gdp->path = std::string(ptcFile.fileName());
char **vartypes, **varnames;
PtcGetPointCloudInfo( ptc, const_cast<char*>("npoints"),
&ptc_gdp->nPoints );
PtcGetPointCloudInfo( ptc, const_cast<char*>("npointvars"),
&ptc_gdp->nChannels );
PtcGetPointCloudInfo( ptc, const_cast<char*>("pointvartypes"),
&vartypes );
PtcGetPointCloudInfo( ptc, const_cast<char*>("pointvarnames"),
&varnames );
PtcGetPointCloudInfo( ptc, const_cast<char*>("datasize"),
&ptc_gdp->datasize );
PtcGetPointCloudInfo( ptc, const_cast<char*>("bbox"),
ptc_gdp->bbox );
// process our channel names
ptc_gdp->types.clear();
ptc_gdp->names.clear();
for ( unsigned int i=0; i<ptc_gdp->nChannels; ++i )
{
ptc_gdp->types.push_back( std::string(vartypes[i]) );
//.........这里部分代码省略.........
开发者ID:danbethell, 项目名称:rmanptcsop, 代码行数:101, 代码来源:SOP_rmanPtc.cpp
示例6: error
OP_ERROR
SOP_Ocean::cookMySop(OP_Context &context)
{
float now = context.getTime();
//std::cout << "cook ocean, t = " << now << std::endl;
// lock inputs
if (lockInputs(context) >= UT_ERROR_ABORT )
{
return error();
}
GEO_Point *ppt;
UT_Interrupt *boss;
// Check to see that there hasn't been a critical error in cooking the SOP.
if (error() < UT_ERROR_ABORT)
{
boss = UTgetInterrupt();
// Start the interrupt server
boss->opStart("Updating Ocean");
duplicatePointSource(0,context);
int gridres = 1 << int(GRID_RES(now));
float stepsize = GRID_SIZE(now) / (float)gridres;
bool do_chop = CHOP(now);
bool do_jacobian = JACOBIAN(now);
bool do_normals = NORMALS(now) && !do_chop;
if (!_ocean || _ocean_needs_rebuild)
{
if (_ocean)
{
delete _ocean;
}
if (_ocean_context)
{
delete _ocean_context;
}
_ocean = new drw::Ocean(gridres,gridres,stepsize,stepsize,
V(0),L(0),1.0,W(0),1-DAMP(0),ALIGN(0),
DEPTH(0),SEED(0));
_ocean_scale = _ocean->get_height_normalize_factor();
_ocean_context = _ocean->new_context(true,do_chop,do_normals,do_jacobian);
_ocean_needs_rebuild = false;
// std::cout << "######### SOP, rebuilt ocean, norm_factor = " << _ocean_scale
// << " chop = " << do_chop
// << " norm = " << do_normals
// << " jacobian = " << do_jacobian
// << std::endl;
}
float chop_amount = CHOPAMOUNT(now);
// sum up the waves at this timestep
_ocean->update(TIME(now),*_ocean_context,true,do_chop,do_normals,do_jacobian,
_ocean_scale * SCALE(now),chop_amount);
bool linterp = ! INTERP(now);
// get our attribute indices
GA_RWAttributeRef normal_index;
GA_RWAttributeRef jminus_index;
GA_RWAttributeRef eminus_index;
if (do_normals)
{
normal_index = gdp->addNormalAttribute(GEO_POINT_DICT);
}
if (do_jacobian)
{
// jminus_index = gdp->addPointAttrib("mineigval",sizeof(float),GB_ATTRIB_FLOAT,0);
// eminus_index = gdp->addPointAttrib("mineigvec",sizeof(UT_Vector3),GB_ATTRIB_VECTOR,0);
jminus_index = gdp->addTuple(GA_STORE_REAL32,GA_ATTRIB_POINT,"mineigval",1,GA_Defaults(0));
eminus_index = gdp->addFloatTuple(GA_ATTRIB_POINT,"mineigvec",1,GA_Defaults(0));
}
// this is not that fast, can it be done quicker ???
GA_FOR_ALL_GPOINTS(gdp, ppt)
{
UT_Vector4 p = ppt->getPos();
if (linterp)
{
_ocean_context->eval_xz(p(0),p(2));
}
else
{
_ocean_context->eval2_xz(p(0),p(2));
//.........这里部分代码省略.........
开发者ID:nyue, 项目名称:Houdini-Ocean-Toolkit, 代码行数:101, 代码来源:SOP_Ocean.C
示例7: getGeometryType
void OBJ_SceneCacheTransform::expandHierarchy( const SceneInterface *scene )
{
if ( !scene )
{
return;
}
Parameters params;
params.geometryType = getGeometryType();
params.depth = (Depth)evalInt( pDepth.getToken(), 0, 0 );
params.hierarchy = (Hierarchy)evalInt( pHierarchy.getToken(), 0, 0 );
params.tagGroups = getTagGroups();
getAttributeFilter( params.attributeFilter );
getAttributeCopy( params.attributeCopy );
getShapeFilter( params.shapeFilter );
getTagFilter( params.tagFilterStr );
getTagFilter( params.tagFilter );
getFullPathName( params.fullPathName );
if ( params.hierarchy == FlatGeometry )
{
// Collapse first, in case the immediate object was already created on during parent expansion
collapseHierarchy();
doExpandObject( scene, this, params );
setInt( pExpanded.getToken(), 0, 0, 1 );
return;
}
OBJ_Node *rootNode = this;
if ( scene->hasObject() )
{
Parameters rootParams( params );
rootParams.hierarchy = SubNetworks;
rootParams.depth = Children;
OBJ_Node *objNode = doExpandObject( scene, this, rootParams );
if ( params.hierarchy == Parenting )
{
rootNode = objNode;
}
}
else if ( params.hierarchy == Parenting )
{
/// \todo: this is terrible. can we use the subnet input instead?
rootNode = reinterpret_cast<OBJ_Node*>( createNode( "geo", "TMP" ) );
}
if ( params.hierarchy == Parenting )
{
rootNode->setIndirectInput( 0, this->getParentInput( 0 ) );
}
UT_Interrupt *progress = UTgetInterrupt();
if ( !progress->opStart( ( "Expand Hierarchy for " + getPath() ).c_str() ) )
{
return;
}
doExpandChildren( scene, rootNode, params );
setInt( pExpanded.getToken(), 0, 0, 1 );
if ( params.hierarchy == Parenting && !scene->hasObject() )
{
destroyNode( rootNode );
}
progress->opEnd();
}
开发者ID:ivanimanishi, 项目名称:cortex, 代码行数:67, 代码来源:OBJ_SceneCacheTransform.cpp
示例8: SUBSTEPS
OP_ERROR SOP_CudaParticles::cookMySop(OP_Context &context) {
oldf = f;
f = context.getFrame();
GEO_ParticleVertex* pvtx;
double t = context.getTime();
particlesSystem->dt = 1/(OPgetDirector()->getChannelManager()->getSamplesPerSec() * SUBSTEPS(t));
particlesSystem->preview = PREVIEW(t);
particlesSystem->partsLife = LIFE(t);
particlesSystem->partsLifeVar = LIFEVAR(t);
particlesSystem->velDamp = VELDAMP(t);
particlesSystem->gravityStrength = GRAVITYSTR(t);
particlesSystem->gravityDir = cu::make_float3(GRAVITYX(t),GRAVITYY(t),GRAVITYZ(t));
particlesSystem->fluidStrength = FLUIDSTR(t);
particlesSystem->noiseAmp = cu::make_float3(NOISEAMP(t),NOISEAMP(t),NOISEAMP(t));
particlesSystem->noiseOct = NOISEOCT(t);
particlesSystem->noiseFreq = NOISEFREQ(t);
particlesSystem->noiseLac = NOISELACUN(t);
particlesSystem->noiseOffset = cu::make_float3(NOISEOFFSETX(t),NOISEOFFSETY(t),NOISEOFFSETZ(t));
particlesSystem->pointSize = POINTSIZE(t);
particlesSystem->opacity = OPACITY(t);
particlesSystem->startColor = cu::make_float3(STARTCOLORX(t),STARTCOLORY(t),STARTCOLORZ(t));
particlesSystem->endColor = cu::make_float3(ENDCOLORX(t),ENDCOLORY(t),ENDCOLORZ(t));
UT_Interrupt *boss;
OP_Node::flags().timeDep = 1;
if (error() < UT_ERROR_ABORT) {
boss = UTgetInterrupt();
// Start the interrupt server
if (boss->opStart("Building Particles")){
//gdp->clearAndDestroy();
static float zero = 0.0;
GB_AttributeRef partsAtt = gdp->addAttrib("cudaParticlesPreview", sizeof(int), GB_ATTRIB_INT, &zero);
gdp->attribs().getElement().setValue<int>(partsAtt, particlesSystem->preview);
GB_AttributeRef systemIdAtt = gdp->addAttrib("systemId", sizeof(int), GB_ATTRIB_INT, &zero);
gdp->attribs().getElement().setValue<int>(systemIdAtt, particlesSystem->id);
if (f < STARTFRAME(t)) {
gdp->clearAndDestroy();
particlesSystem->resetParticles();
} else if (f == STARTFRAME(t)) {
gdp->clearAndDestroy();
particlesSystem->resetParticles();
int maxParts = MAXPARTS(t);
if (particlesSystem->nParts!=maxParts)
particlesSystem->changeMaxParts(maxParts);
//hSystem = (GEO_PrimParticle *)gdp->appendPrimitive(GEOPRIMPART);
//hSystem->clearAndDestroy();
GB_AttributeRef hVelocity = gdp->addPointAttrib("v", sizeof(UT_Vector3),GB_ATTRIB_VECTOR, 0);
GB_AttributeRef hLife = gdp->addPointAttrib("life", sizeof(float)*2,GB_ATTRIB_FLOAT, 0);
if(particlesSystem->preview!=1) {
UT_Vector4 orig = UT_Vector4(0,0,0,1);
for (int i = 0; i<particlesSystem->nParts; i++) {
GEO_Point* newPoint = gdp->appendPoint();
newPoint->setPos(orig);
/*pvtx = hSystem->giveBirth();
GEO_Point* ppt = pvtx->getPt();
//ppt->getPos().assign(0,0,0,1);*/
hSystemInit = 1;
}
}
} else {
if(particlesSystem->nParts != -1) {
if(lockInputs(context) >= UT_ERROR_ABORT)
return error();
if(getInput(0)){
GU_Detail* emittersInput = (GU_Detail*)inputGeo(0, context);
//.........这里部分代码省略.........
开发者ID:UIKit0, 项目名称:cudaFluid, 代码行数:101, 代码来源:SOP_CudaParticles.C
示例9: handlerScope
/// Cook the SOP! This method does all the work
OP_ERROR SOP_OpHolder::cookMySop( OP_Context &context )
{
IECore::MessageHandler::Scope handlerScope( getMessageHandler() );
// some defaults and useful variables
Imath::Box3f bbox( Imath::V3f(-1,-1,-1), Imath::V3f(1,1,1) );
float now = context.getTime();
// force eval of our nodes parameters with our hidden parameter expression
evalInt( "__evaluateParameters", 0, now );
// get our op
IECore::OpPtr op = IECore::runTimeCast<IECore::Op>( getParameterised() );
// check for a valid parameterised on this SOP
if ( !op )
{
UT_String msg( "Op Holder has no parameterised class to operate on!" );
addError( SOP_MESSAGE, msg );
return error();
}
if( lockInputs(context)>=UT_ERROR_ABORT )
{
return error();
}
// start our work
UT_Interrupt *boss = UTgetInterrupt();
boss->opStart("Building OpHolder Geometry...");
gdp->clearAndDestroy();
setParameterisedValues( now );
try
{
// make our Cortex op do it's thing...
op->operate();
// pass ourselves onto the GR_Cortex render hook
IECoreHoudini::NodePassData data( this, IECoreHoudini::NodePassData::CORTEX_OPHOLDER );
GA_RWAttributeRef attrRef = gdp->createAttribute( GA_ATTRIB_DETAIL, GA_SCOPE_PRIVATE, "IECoreHoudiniNodePassData", NULL, NULL, "blinddata" );
GA_Attribute *attr = attrRef.getAttribute();
const GA_AIFBlindData *blindData = attr->getAIFBlindData();
blindData->setDataSize( attr, sizeof(IECoreHoudini::NodePassData), &data );
// if our result is a visible renderable then set our bounds on our output gdp
const IECore::Object *result = op->resultParameter()->getValue();
IECore::ConstVisibleRenderablePtr renderable = IECore::runTimeCast<const IECore::VisibleRenderable>( result );
if ( renderable )
{
Imath::Box3f bbox = renderable->bound();
gdp->cube( bbox.min.x, bbox.max.x, bbox.min.y, bbox.max.y, bbox.min.z, bbox.max.z, 0, 0, 0, 1, 1 );
}
}
catch( boost::python::error_already_set )
{
addError( SOP_MESSAGE, "Error raised during Python evaluation!" );
IECorePython::ScopedGILLock lock;
PyErr_Print();
}
catch( const IECore::Exception &e )
{
addError( SOP_MESSAGE, e.what() );
}
catch( const std::exception &e )
{
addError( SOP_MESSAGE, e.what() );
}
catch( ... )
{
addError( SOP_MESSAGE, "Caught unknown exception!" );
}
// tidy up & go home!
boss->opEnd();
unlockInputs();
return error();
}
开发者ID:Alwnikrotikz, 项目名称:cortex-vfx, 代码行数:80, 代码来源:SOP_OpHolder.cpp
示例10: inputGeo
//.........这里部分代码省略.........
}
float base = 0.0;
for(int i=0;i<totd;i++)
{
Daemon& d = daemons[i];
d.range[0]=base;
d.range[1] = base+d.weight/weights;
base=d.range[1];
};
int total = evalInt("count",0,now);
int degr = evalInt("degr",0,now);
total >>= degr;
GA_RWHandleI cntt(gdp->addIntTuple(GA_ATTRIB_POINT, "count", 4, GA_Defaults(1.0)));
GB_AttributeRef dt(gdp->addDiffuseAttribute(GEO_POINT_DICT));
gdp->addVariableName("Cd","Cd");
UT_Vector3 current(0,0,0);
float C[3] = { 0,0,0 };
float R=1.0f;
bool trackRadii = (evalInt("trackradii",0,now)!=0);
float rScale = evalFloat("radiiscale",0,now);
GB_AttributeRef rt;
if(trackRadii)
{
float one=1.0f;
rt = gdp->addPointAttrib("width",4,GB_ATTRIB_FLOAT,&one);
if(!GBisAttributeRefValid(rt)) trackRadii=false;
else gdp->addVariableName("width","WIDTH");
};
float zero=0.0f;
GB_AttributeRef pt = gdp->addPointAttrib("parameter",4,GB_ATTRIB_FLOAT,&zero);
if(GBisAttributeRefValid(pt)) gdp->addVariableName("parameter","PARAMETER");
float param=0.0f;
srand(0);
UT_Interrupt* boss = UTgetInterrupt();
boss->opStart("Computing...");
for(int i=-50;i<total;i++)
{
bool ok = false;
if (boss->opInterrupt()) break;
float w = double(rand())/double(RAND_MAX);
for(int j=0;j<totd;j++)
{
ok = daemons[j].Transform(w,current,C,R,param);
if(ok) break;
};
if(i<0) continue;
if(clip)
{
if(!bbox.isInside(current)) continue;
};
if(ok)
{
GEO_Point* p = gdp->appendPoint();
p->setPos(current);
float* Cd=p->castAttribData<float>(dt);
if(useRamp)
{
ramp.rampLookup(param,C);
}
memcpy(Cd,C,12);
if(trackRadii)
{
float* _R = p->castAttribData<float>(rt);
*_R=rScale*R;
};
if(GBisAttributeRefValid(pt))
{
float* _p = p->castAttribData<float>(pt);
*_p=param;
}
};
};
boss->opEnd();
delete [] daemons;
return error();
};
开发者ID:redpawfx, 项目名称:hscallop, 代码行数:101, 代码来源:sop_scallop.cpp
示例11: UTgetInterrupt
void OBJ_SceneCacheTransform::doExpandChildren( const SceneInterface *scene, OP_Network *parent, const Parameters ¶ms )
{
UT_Interrupt *progress = UTgetInterrupt();
progress->setLongOpText( ( "Expanding " + scene->name().string() ).c_str() );
if ( progress->opInterrupt() )
{
return;
}
OP_Network *inputNode = parent;
if ( params.hierarchy == Parenting )
{
parent = parent->getParent();
}
SceneInterface::NameList children;
scene->childNames( children );
for ( SceneInterface::NameList::const_iterator it=children.begin(); it != children.end(); ++it )
{
ConstSceneInterfacePtr child = scene->child( *it );
OBJ_Node *childNode = 0;
if ( params.hierarchy == SubNetworks )
{
childNode = doExpandChild( child.get(), parent, params );
if ( params.depth == AllDescendants && child->hasObject() && tagged( child.get(), params.tagFilter ) )
{
Parameters childParams( params );
childParams.depth = Children;
doExpandObject( child.get(), childNode, childParams );
}
}
else if ( params.hierarchy == Parenting )
{
if ( child->hasObject() )
{
Parameters childParams( params );
childParams.depth = Children;
childNode = doExpandObject( child.get(), parent, childParams );
}
else
{
childNode = doExpandChild( child.get(), parent, params );
}
childNode->setInput( 0, inputNode );
}
if ( params.depth == AllDescendants )
{
if ( params.hierarchy == SubNetworks && !tagged( child.get(), params.tagFilter ) )
{
// we don't expand non-tagged children for SubNetwork mode, but we
// do for Parenting mode, because otherwise the hierarchy would be
// stuck in an un-expandable state.
continue;
}
doExpandChildren( child.get(), childNode, params );
childNode->setInt( pExpanded.getToken(), 0, 0, 1 );
}
}
OP_Layout layout( parent );
#if UT_MAJOR_VERSION_INT >= 16
OP_SubnetIndirectInput *parentInput = parent->getParentInput( 0 );
layout.addLayoutItem( parentInput->getInputItem() );
for ( int i=0; i < parent->getNchildren(); ++i )
{
layout.addLayoutItem( parent->getChild( i ) );
}
#else
layout.addLayoutOp( parent->getParentInput( 0 ) );
for ( int i=0; i < parent->getNchildren(); ++i )
{
layout.addLayoutOp( parent->getChild( i ) );
}
#endif
layout.layoutOps( OP_LAYOUT_TOP_TO_BOT, parent, parent->getParentInput( 0 ) );
}
开发者ID:ivanimanishi, 项目名称:cortex, 代码行数:86, 代码来源:OBJ_SceneCacheTransform.cpp
示例12: fluidPos
OP_ERROR SOP_FluidSolver2D::cookMySop(OP_Context &context) {
oldf = f;
double t = context.getTime();
int f = context.getFrame();
UT_Interrupt *boss;
GU_PrimVolume *volume;
OP_Node::flags().timeDep = 1;
fluidSolver->fps = OPgetDirector()->getChannelManager()->getSamplesPerSec();
int newResX = RESX(t);
int newResY = RESY(t);
if ( newResX != fluidSolver->res.x || newResY != fluidSolver->res.y) {
fluidSolver->changeFluidRes(newResX,newResY);
}
UT_Vector3 fluidPos(POSX(t), POSY(t), POSZ(t));
UT_Vector3 fluidRot(ROTX(t), ROTY(t), ROTZ(t));
fluidRot.degToRad();
fluidSolver->fluidSize.x = FLUIDSIZEX(t);
fluidSolver->fluidSize.y = FLUIDSIZEY(t);
fluidSolver->borderNegX = BORDERNEGX(t);
fluidSolver->borderPosX = BORDERPOSX(t);
fluidSolver->borderNegY = BORDERNEGY(t);
fluidSolver->borderPosY = BORDERPOSY(t);
fluidSolver->preview = PREVIEW(t);
fluidSolver->previewType = PREVIEWTYPE(t);
fluidSolver->bounds = BOUNDS(t);
fluidSolver->substeps = SUBSTEPS(t);
fluidSolver->jacIter = JACITER(t);
fluidSolver->densDis = DENSDIS(t);
fluidSolver->densBuoyStrength = DENSBUOYSTRENGTH(t);
float ddirX = DENSBUOYDIRX(t);
float ddirY = DENSBUOYDIRY(t);
fluidSolver->densBuoyDir = cu::make_float2(ddirX,ddirY);
fluidSolver->velDamp = VELDAMP(t);
fluidSolver->vortConf = VORTCONF(t);
fluidSolver->noiseStr = NOISESTR(t);
fluidSolver->noiseFreq = NOISEFREQ(t);
fluidSolver->noiseOct = NOISEOCT(t);
fluidSolver->noiseLacun = NOISELACUN(t);
fluidSolver->noiseSpeed = NOISESPEED(t);
fluidSolver->noiseAmp = NOISEAMP(t);
if (error() < UT_ERROR_ABORT) {
boss = UTgetInterrupt();
gdp->clearAndDestroy();
// Start the interrupt server
if (boss->opStart("Building Volume")){
static float zero = 0.0;
#ifdef HOUDINI_11
GB_AttributeRef fluidAtt = gdp->addAttrib("cudaFluidPreview", sizeof(int), GB_ATTRIB_INT, &zero);
gdp->attribs().getElement().setValue<int>(fluidAtt, fluidSolver->preview);
GB_AttributeRef solverIdAtt = gdp->addAttrib("solverId", sizeof(int), GB_ATTRIB_INT, &zero);
gdp->attribs().getElement().setValue<int>(solverIdAtt, fluidSolver->id);
#else
GA_WOAttributeRef fluidAtt = gdp->addIntTuple(GA_ATTRIB_DETAIL, "cudaFluidPreview", 1);
gdp->element().setValue<int>(fluidAtt, fluidSolver->preview);
GA_WOAttributeRef solverIdAtt = gdp->addIntTuple(GA_ATTRIB_DETAIL, "solverId", 1);
gdp->element().setValue<int>(solverIdAtt, fluidSolver->id);
#endif
UT_Matrix3 xform;
const UT_XformOrder volXFormOrder;
volume = (GU_PrimVolume *)GU_PrimVolume::build(gdp);
#ifdef HOUDINI_11
volume->getVertex().getPt()->getPos() = fluidPos;
#else
volume->getVertexElement(0).getPt()->setPos(fluidPos);
#endif
xform.identity();
xform.scale(fluidSolver->fluidSize.x*0.5, fluidSolver->fluidSize.y*0.5, 0.25);
xform.rotate(fluidRot.x(), fluidRot.y(), fluidRot.z(), volXFormOrder);
volume->setTransform(xform);
xform.identity();
//.........这里部分代码省略.........
开发者ID:derkreature, 项目名称:cudasims, 代码行数:101, 代码来源:SOP_FluidSolver2D.cpp
示例13: UTgetInterrupt
void SOP_SceneCacheSource::loadObjects( const IECore::SceneInterface *scene, Imath::M44d transform, double time, Space space, const UT_StringMMPattern &shapeFilter, const std::string &attributeFilter, GeometryType geometryType, size_t rootSize )
{
UT_Interrupt *progress = UTgetInterrupt();
progress->setLongOpText( ( "Loading " + scene->name().string() ).c_str() );
if ( progress->opInterrupt() )
{
return;
}
if ( scene->hasObject() && UT_String( scene->name() ).multiMatch( shapeFilter ) )
{
// \todo See if there are ways to avoid the Object copy below.
ObjectPtr object = scene->readObject( time )->copy();
std::string name = relativePath( scene, rootSize );
bool hasAnimatedTopology = scene->hasAttribute( SceneCache::animatedObjectTopologyAttribute );
bool hasAnimatedPrimVars = scene->hasAttribute( SceneCache::animatedObjectPrimVarsAttribute );
std::vector<InternedString> animatedPrimVars;
if ( hasAnimatedPrimVars )
{
const ConstObjectPtr animatedPrimVarObj = scene->readAttribute( SceneCache::animatedObjectPrimVarsAttribute, 0 );
const InternedStringVectorData *animatedPrimVarData = IECore::runTimeCast<const InternedStringVectorData>( animatedPrimVarObj );
if ( animatedPrimVarData )
{
const std::vector<InternedString> &values = animatedPrimVarData->readable();
animatedPrimVars.resize( values.size() );
std::copy( values.begin(), values.end(), animatedPrimVars.begin() );
}
}
modifyObject( object, name, attributeFilter, hasAnimatedTopology, hasAnimatedPrimVars, animatedPrimVars );
Imath::M44d currentTransform;
if ( space == Local )
{
currentTransform = scene->readTransformAsMatrix( time );
}
else if ( space != Object )
{
currentTransform = transform;
}
// transform the object unless its an identity
if ( currentTransform != Imath::M44d() )
{
transformObject( object, currentTransform, hasAnimatedTopology, hasAnimatedPrimVars, animatedPrimVars );
}
// load the Cortex object directly
if ( geometryType == Cortex )
{
holdObject( object, name, hasAnimatedTopology, hasAnimatedPrimVars, animatedPrimVars );
}
else
{
// convert the object to Houdini
if ( !convertObject( object, name, attributeFilter, geometryType, hasAnimatedTopology, hasAnimatedPrimVars, animatedPrimVars ) )
{
std::string fullName;
SceneInterface::Path path;
scene->path( path );
SceneInterface::pathToString( path, fullName );
addWarning( SOP_MESSAGE, ( "Could not convert " + fullName + " to houdini" ).c_str() );
}
}
}
if ( evalInt( pObjectOnly.getToken(), 0, 0 ) )
{
return;
}
SceneInterface::NameList children;
scene->childNames( children );
for ( SceneInterface::NameList::const_iterator it=children.begin(); it != children.end(); ++it )
{
ConstSceneInterfacePtr child = scene->child( *it );
loadObjects( child, child->readTransformAsMatrix( time ) * transform, time, space, shapeFilter, attributeFilter, geometryType, rootSize );
}
}
开发者ID:richardmonette, 项目名称:cortex, 代码行数:80, 代码来源:SOP_SceneCacheSource.cpp
示例14: sceneChanged
OP_ERROR SOP_SceneCacheSource::cookMySop( OP_Context &context )
{
// make sure the state is valid
if ( boost::indeterminate( m_static ) )
{
sceneChanged();
}
flags().setTimeDep( bool( !m_static ) );
std::string file;
if ( !ensureFile( file ) )
{
addError( SOP_ATTRIBUTE_INVALID, ( file + " is not a valid .scc" ).c_str() );
gdp->clearAndDestroy();
return error();
}
std::string path = getPath();
Space space = getSpace();
GeometryType geometryType = (GeometryType)this->evalInt( pGeometryType.getToken(), 0, 0 );
UT_String shapeFilterStr;
evalString( shapeFilterStr, pShapeFilter.getToken(), 0, 0 );
UT_StringMMPattern shapeFilter;
shapeFilter.compile( shapeFilterStr );
UT_String p( "P" );
UT_String attributeFilter;
evalString( attributeFilter, pAttributeFilter.getToken(), 0, 0 );
if ( !p.match( attributeFilter ) )
{
attributeFilter += " P";
}
ConstSceneInterfacePtr scene = this->scene( file, path );
if ( !scene )
{
addError( SOP_ATTRIBUTE_INVALID, ( path + " is not a valid location in " + file ).c_str() );
gdp->clearAndDestroy();
return error();
}
MurmurHash hash;
hash.append( file );
hash.append( path );
hash.append( space );
hash.append( shapeFilterStr );
hash.append( attributeFilter );
hash.append( geometryType );
hash.append( getObjectOnly() );
if ( !m_loaded || m_hash != hash )
{
gdp->clearAndDestroy();
}
Imath::M44d transform = ( space == World ) ? worldTransform( file, path, context.getTime() ) : Imath::M44d();
SceneInterface::Path rootPath;
scene->path( rootPath );
UT_Interrupt *progress = UTgetInterrupt();
if ( !progress->opStart( ( "Cooking objects for " + getPath() ).c_str() ) )
{
addError( SOP_ATTRIBUTE_INVALID, "Cooking interrupted before it started" );
gdp->clearAndDestroy();
return error();
}
loadObjects( scene, transform, context.getTime(), space, shapeFilter, attributeFilter.toStdString(), geometryType, rootPath.size() );
if ( progress->opInterrupt( 100 ) )
{
addError( SOP_ATTRIBUTE_INVALID, "Cooking interrupted" );
gdp->clearAndDestroy();
m_loaded = false;
m_hash = MurmurHash();
}
else
{
m_loaded = true;
m_hash = hash;
}
progress->opEnd();
return error();
}
开发者ID:richardmonette, 项目名称:cortex, 代码行数:89, 代码来源:SOP_SceneCacheSource.cpp
示例15: UTgetInterrupt
void SOP_SceneCacheSource::loadObjects( const IECore::SceneInterface *scene, Imath::M44d transform, double time, Space space, Parameters ¶ms, size_t rootSize )
{
UT_Interrupt *progress = UTgetInterrupt();
progress->setLongOpText( ( "Loading " + scene->name().string() ).c_str() );
if ( progress->opInterrupt() )
{
return;
}
if ( scene->hasObject() && UT_String( scene->name() ).multiMatch( params.shapeFilter ) && tagged( scene, params.tagFilter ) )
{
std::string name = relativePath( scene, rootSize );
Imath::M44d currentTransform;
if ( space == Local )
{
currentTransform = scene->readTransformAsMatrix( time );
}
else if ( space != Object )
{
currentTransform = transform;
}
ConstObjectPtr object = 0;
if ( params.geometryType == BoundingBox )
{
Imath::Box3d bound = scene->readBound( time );
object = MeshPrimitive::createBox( Imath::Box3f( bound.min, bound.max ) );
params.hasAnimatedTopology = false;
params.hasAnimatedPrimVars = true;
params.animatedPrimVars.clear();
params.animatedPrimVars.push_back( "P" );
}
else if ( params.geometryType == PointCloud )
{
std::vector<Imath::V3f> point( 1, scene->readBound( time ).center() );
PointsPrimitivePtr points = new PointsPrimitive( new V3fVectorData( point ) );
std::vector<Imath::V3f> basis1( 1, Imath::V3f( currentTransform[0][0], currentTransform[0][1], currentTransform[0][2] ) );
std::vector<Imath::V3f> basis2( 1, Imath::V3f( currentTransform[1][0], currentTransform[1][1], currentTransform[1][2] ) );
std::vector<Imath::V3f> basis3( 1, Imath::V3f( currentTransform[2][0], currentTransform[2][1], currentTransform[2][2] ) );
points->variables["basis1"] = PrimitiveVariable( PrimitiveVariable::Vertex, new V3fVectorData( basis1 ) );
points->variables["basis2"] = PrimitiveVariable( PrimitiveVariable::Vertex, new V3fVectorData( basis2 ) );
points->variables["basis3"] = PrimitiveVariable( PrimitiveVariable::Vertex, new V3fVectorData( basis3 ) );
params.hasAnimatedTopology = false;
params.hasAnimatedPrimVars = true;
params.animatedPrimVars.clear();
params.animatedPrimVars.push_back( "P" );
params.animatedPrimVars.push_back( "basis1" );
params.animatedPrimVars.push_back( "basis2" );
params.animatedPrimVars.push_back( "basis3" );
object = points;
}
else
{
object = scene->readObject( time );
params.hasAnimatedTopology = scene->hasAttribute( SceneCache::animatedObjectTopologyAttribute );
params.hasAnimatedPrimVars = scene->hasAttribute( SceneCache::animatedObjectPrimVarsAttribute );
if ( params.hasAnimatedPrimVars )
{
const ConstObjectPtr animatedPrimVarObj = scene->readAttribute( SceneCache::animatedObjectPrimVarsAttribute, 0 );
const InternedStringVectorData *animatedPrimVarData = IECore::runTimeCast<const InternedStringVectorData>( animatedPrimVarObj.get() );
if ( animatedPrimVarData )
{
const std::vector<InternedString> &values = animatedPrimVarData->readable();
params.animatedPrimVars.clear();
params.animatedPrimVars.resize( values.size() );
std::copy( values.begin(), values.end(), params.animatedPrimVars.begin() );
}
}
}
// modify the object if necessary
object = modifyObject( object.get(), params );
// transform the object unless its an identity
if ( currentTransform != Imath::M44d() )
{
object = transformObject( object.get(), currentTransform, params );
}
// convert the object to Houdini
if ( !convertObject( object.get(), name, scene, params ) )
{
std::string fullName;
SceneInterface::Path path;
scene->path( path );
SceneInterface::pathToString( path, fullName );
addWarning( SOP_MESSAGE, ( "Could not convert " + fullName + " to Houdini" ).c_str() );
}
}
if ( evalInt( pObjectOnly.getToken(), 0, 0 ) )
{
return;
}
//.........这里部分代码省略.........
开发者ID:mattigruener, 项目名称:cortex, 代码行数:101, 代码来源:SOP_SceneCacheSource.cpp
示例16: sceneChanged
OP_ERROR SOP_SceneCacheSource::cookMySop( OP_Context &context )
{
// make sure the state is valid
if ( boost::indeterminate( m_static ) )
{
sceneChanged();
}
flags().setTimeDep( bool( !m_static ) );
std::string file;
if ( !ensureFile( file ) )
{
addError( SOP_ATTRIBUTE_INVALID, ( file + " is not a valid .scc" ).c_str() );
gdp->clearAndDestroy();
return error();
}
std::string path = getPath();
Space space = getSpace();
GeometryType geometryType = (GeometryType)this->evalInt( pGeometryType.getToken(), 0, 0 );
UT_String tagFilterStr;
getTagFilter( tagFilterStr );
UT_StringMMPattern tagFilter;
tagFilter.compile( tagFilterStr );
UT_String shapeFilterStr;
getShapeFilter( shapeFilterStr );
UT_StringMMPattern shapeFilter;
shapeFilter.compile( shapeFilterStr );
UT_String p( "P" );
UT_String attributeFilter;
getAttributeFilter( attributeFilter );
if ( !p.match( attributeFilter ) )
{
attributeFilter += " P";
}
UT_String attributeCopy;
getAttributeCopy( attributeCopy );
UT_String fullPathName;
getFullPathName( fullPathName );
ConstSceneInterfacePtr scene = this->scene( file, path );
if ( !scene )
{
addError( SOP_ATTRIBUTE_INVALID, ( path + " is not a valid location in " + file ).c_str() );
gdp->clearAndDestroy();
return error();
}
MurmurHash hash;
hash.append( file );
hash.append( path );
hash.append( space );
hash.append( tagFilterStr );
hash.append( shapeFilterStr );
hash.append( attributeFilter );
hash.append( attributeCopy );
hash.append( fullPathName );
hash.append( geometryType );
hash.append( getObjectOnly() );
if ( !m_loaded || m_hash != hash )
{
gdp->clearAndDestroy();
}
double readTime = time( context );
Imath::M44d transform = ( space == World ) ? worldTransform( file, path, readTime ) : Imath::M44d();
SceneInterface::Path rootPath;
scene->path( rootPath );
UT_Interrupt *progress = UTgetInterrupt();
if ( !progress->opStart( ( "Cooking objects for " + getPath() ).c_str() ) )
{
addError( SOP_ATTRIBUTE_INVALID, "Cooking interrupted before it started" );
gdp->clearAndDestroy();
return error();
}
Parameters params;
UT_String attribFilter;
getAttributeFilter( attribFilter );
params.attributeFilter = attribFilter.toStdString();
params.attributeCopy = attributeCopy.toStdString();
params.fullPathName = fullPathName.toStdString();
params.geometryType = getGeometryType();
getShapeFilter( params.shapeFilter );
getTagFilter( params.tagFilter );
// Building a map from shape name to primitive range, which will be used during
// convertObject() to do a lazy update of animated primvars where possible, and
// to destroy changing topology shapes when necessary.
GA_ROAttributeRef nameAttrRef = gdp->findStringTuple( GA_ATTRIB_PRIMITIVE, "name" );
if ( nameAttrRef.isValid() )
//.........这里部分代码省略.........
开发者ID:mattigruener, 项目名称:cortex, 代码行数:101, 代码来源:SOP_SceneCacheSource.cpp
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:18231| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9664| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8174| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8546| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8452| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9381| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8423| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7856| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8408| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7393| 2022-11-06
请发表评论