本文整理汇总了C++中depFn函数的典型用法代码示例。如果您正苦于以下问题:C++ depFn函数的具体用法?C++ depFn怎么用?C++ depFn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了depFn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: depFn
// to check if an object is animated, we need to check e.g. its transform inputs
// if the object is from an instancer node, always return true
bool MayaObject::isObjAnimated()
{
MStatus stat;
bool returnValue = false;
if( this->instancerParticleId > -1)
return true;
if( this->mobject.hasFn(MFn::kTransform))
{
MFnDependencyNode depFn(this->mobject, &stat);
if(stat)
{
MPlugArray connections;
depFn.getConnections(connections);
if( connections.length() == 0)
returnValue = false;
else{
for( uint cId = 0; cId < connections.length(); cId++)
{
if( connections[cId].isDestination())
{
returnValue = true;
}
}
}
}
}
return returnValue;
}
开发者ID:haggi,项目名称:OpenMaya,代码行数:33,代码来源:mayaObject.cpp
示例2: getConnectedInNode
MObject getConnectedInNode(const MObject& thisObject, const char *attrName)
{
MObject result = MObject::kNullObj;
MString indexStr, base;
int index = -1;
if (getArrayIndex(attrName, indexStr, base))
{
index = indexStr.asInt();
attrName = base.asChar();
}
MFnDependencyNode depFn(thisObject);
MPlug inPlug = depFn.findPlug(attrName);
if (index > -1)
inPlug = inPlug[index];
MString plugname = inPlug.name();
if (!inPlug.isConnected())
return result;
MPlugArray connectedPlugs;
inPlug.connectedTo(connectedPlugs, true, false);
if (connectedPlugs.length() == 0)
return result;
return connectedPlugs[0].node();
}
开发者ID:dictoon,项目名称:appleseed-maya,代码行数:26,代码来源:tools.cpp
示例3: depFn
TheaSDK::Normal3D TheaRenderer::getSunDirection()
{
MFnDependencyNode depFn(getRenderGlobalsNode());
std::shared_ptr<RenderGlobals> renderGlobals = MayaTo::getWorldPtr()->worldRenderGlobalsPtr;
std::shared_ptr<TheaRenderer> renderer = std::static_pointer_cast<TheaRenderer>(MayaTo::getWorldPtr()->worldRendererPtr);
TheaSDK::Normal3D sunDir;
MObjectArray nodeList;
getConnectedInNodes(MString("sunLightConnection"), getRenderGlobalsNode(), nodeList);
if( nodeList.length() > 0)
{
MVector lightDir(0,0,1);
MFnDagNode sunDagNode(nodeList[0]);
//lightDir *= this->mtth_renderGlobals->globalConversionMatrix.inverse();
lightDir *= sunDagNode.transformationMatrix();
lightDir *= renderGlobals->globalConversionMatrix;
lightDir.normalize();
return TheaSDK::Normal3D(lightDir.x,lightDir.y,lightDir.z);
}
float sunDirX = 0.0f, sunDirY = 0.0f, sunDirZ = 1.0f;
MPlug sunDirPlug = depFn.findPlug("sunDirection");
if (!sunDirPlug.isNull())
{
sunDirX = sunDirPlug.child(0).asFloat();
sunDirY = sunDirPlug.child(1).asFloat();
sunDirZ = sunDirPlug.child(2).asFloat();
}
return TheaSDK::Normal3D(sunDirX, sunDirY, sunDirZ);
}
开发者ID:haggi,项目名称:OpenMaya,代码行数:30,代码来源:TheaEnvironment.cpp
示例4: depFn
SkyMap::SkyMap(MObject sObject)
{
MFnDependencyNode depFn(sObject);
this->params = new Corona::SkyParams;
params->multiplier = getFloatAttr("pSkyMultiplier", depFn, 1.0);
int skyModel = getEnumInt("pSkyModel", depFn);
if (skyModel == 0)
params->mode = Corona::SkyModelType::MODEL_PREETHAM;
if (skyModel == 1)
params->mode = Corona::SkyModelType::MODEL_RAWAFAKE;
if (skyModel == 2)
params->mode = Corona::SkyModelType::MODEL_HOSEK;
params->groundColor = toCorona(getColorAttr("pSkyGroundColor", depFn));
params->horizonBlur = getFloatAttr("pSkyHorizBlur", depFn, .1f);
params->skyAffectGround = getBoolAttr("pSkyAffectGround", depFn, true);
params->preetham.turbidity = getFloatAttr("pSkyPreethamTurb", depFn, 2.5f);
params->rawafake.horizon = toCorona(getColorAttr("pSkyHorizon", depFn));
params->rawafake.horizon = toCorona(getColorAttr("pSkyZenith", depFn));
params->rawafake.sunBleed = getFloatAttr("pSkySunBleed", depFn, 1.0f);
params->rawafake.sunFalloff = getFloatAttr("pSkySunFalloff", depFn, 3.0f);
params->rawafake.sunGlow = getFloatAttr("pSkySunGlow", depFn, 1.0f);
params->rawafake.sunSideGlow = getFloatAttr("pSkySunSideGlow", depFn, .2f);
this->initSky();
};
开发者ID:haggi,项目名称:OpenMaya,代码行数:27,代码来源:CoronaSky.cpp
示例5: addVisibilityFlags
void addVisibilityFlags(boost::shared_ptr<MayaObject> obj, renderer::ParamArray& paramArray)
{
MFnDependencyNode depFn(obj->mobject);
if (obj->mobject.hasFn(MFn::kMesh) || obj->mobject.hasFn(MFn::kAreaLight))
{
if (!getBoolAttr("primaryVisibility", depFn, true))
paramArray.insert_path("visibility.camera", false);
if (!getBoolAttr("castsShadows", depFn, true))
paramArray.insert_path("visibility.shadow", false);
if (!getBoolAttr("visibleInRefractions", depFn, true))
paramArray.insert_path("visibility.transparency", false);
if (!getBoolAttr("mtap_visibleLights", depFn, true))
paramArray.insert_path("visibility.light", false);
if (!getBoolAttr("mtap_visibleProbe", depFn, true))
paramArray.insert_path("visibility.probe", false);
if (!getBoolAttr("mtap_visibleGlossy", depFn, true))
paramArray.insert_path("visibility.glossy", false);
if (!getBoolAttr("mtap_visibleSpecular", depFn, true))
paramArray.insert_path("visibility.specular", false);
if (!getBoolAttr("mtap_visibleDiffuse", depFn, true))
paramArray.insert_path("visibility.diffuse", false);
}
}
开发者ID:dictoon,项目名称:appleseed-maya,代码行数:31,代码来源:appleseedutils.cpp
示例6: depFn
void CoronaRenderer::defineColorMapping()
{
float gamma = 2.2f;
#if MAYA_API_VERSION > 2015
if (MColorManagementUtilities::isColorManagementEnabled())
gamma = 1.0f;
#endif
MFnDependencyNode depFn(getRenderGlobalsNode());
context.colorMappingData->colorTemperature = getFloatAttr("colorMapping_colorTemperature", depFn, 6500.0f);
context.colorMappingData->contrast = getFloatAttr("colorMapping_contrast", depFn, 1.0f);
context.colorMappingData->gamma = gamma;
context.colorMappingData->tint = toCorona(getColorAttr("colorMapping_tint", depFn));
context.colorMappingData->exposure.simple.exponent = getFloatAttr("colorMapping_simpleExposure", depFn, 0.0f);
context.colorMappingData->highlightCompression = getFloatAttr("colorMapping_highlightCompression", depFn, 1.0f);
context.colorMappingData->photographicExposure = getEnumInt("exposure_type", depFn) == 1;
// release 0.39 override camera settings
if (context.colorMappingData->photographicExposure)
{
context.colorMappingData->exposure.photographic.fStop = getFloatAttr("colorMapping_fStop", depFn, 5.6);
context.colorMappingData->exposure.photographic.iso = getFloatAttr("colorMapping_iso", depFn, 100.0);
context.colorMappingData->exposure.photographic.shutterSpeed = 1.0f / getFloatAttr("colorMapping_shutterSpeed", depFn, 250.0f);
if ( this->renderCam != MObject::kNullObj)
{
MFnDependencyNode camFn(renderCam);
if (getBoolAttr("mtco_overrideRenderSettings", camFn, false))
{
context.settings->set(Corona::PARAM_COLORMAP_ISO, getFloatAttr("mtco_iso", camFn, 1.0));
context.settings->set(Corona::PARAM_COLORMAP_F_STOP, getFloatAttr("fStop", camFn, 5.6));
context.settings->set(Corona::PARAM_COLORMAP_SHUTTER_SPEED, 1.0f / getFloatAttr("mtco_shutterSpeed", camFn, 250.0f));
}
}
}
}
开发者ID:haggi,项目名称:OpenMaya,代码行数:35,代码来源:CoronaSettings.cpp
示例7: depFn
void ShadingNode::getConnectedInputObjects(MObjectArray& objectArray)
{
MStatus stat;
MFnDependencyNode depFn(this->mobject);
MStringArray aliasArray;
depFn.getAliasList(aliasArray);
MObjectArray objectList;
MPlugArray connections;
depFn.getConnections(connections);
for (uint connId = 0; connId < connections.length(); connId++)
{
MPlug p = connections[connId];
if (!p.isDestination())
continue;
// a connection can be a direct connection or a child connection e.g. colorR, colorG...
// but in a shader description file only the main attribute is listed so we go up until we have the main plug
MPlug mainPlug = p;
while (mainPlug.isChild())
mainPlug = mainPlug.parent();
if (mainPlug.isElement())
mainPlug = mainPlug.array();
MStringArray stringArray;
// name contains node.attributeName, so we have to get rid of the nodeName
mainPlug.name().split('.', stringArray);
MString plugName = stringArray[stringArray.length() - 1];
if (!this->isAttributeValid(plugName))
continue;
getConnectedInNodes(p, objectList);
makeUniqueArray(objectList);
}
objectArray = objectList;
}
开发者ID:haggi,项目名称:OpenMaya,代码行数:34,代码来源:shadingNode.cpp
示例8: getOtherSideSourceNode
MObject getOtherSideSourceNode(MString& plugName, MObject& thisObject, bool checkChildren, MString& outPlugName)
{
MStatus stat;
MObject result = MObject::kNullObj;
MFnDependencyNode depFn(thisObject, &stat); if (stat != MStatus::kSuccess) return result;
MPlugArray pa;
depFn.getConnections(pa);
MPlug connectedPlug;
for (uint pId = 0; pId < pa.length(); pId++)
{
MPlug plug = pa[pId];
if (!plug.isDestination())
continue;
while (plug.isChild())
{
plug = plug.parent();
}
if (getAttributeNameFromPlug(plug) == plugName)
{
connectedPlug = pa[pId];
}
}
if (connectedPlug.isNull())
return result;
connectedPlug.connectedTo(pa, true, false, &stat); if (stat != MStatus::kSuccess) return result;
if (pa.length() == 0)
return result;
MPlug otherSidePlug = pa[0];
result = otherSidePlug.node();
outPlugName = getAttributeNameFromPlug(otherSidePlug);
if (otherSidePlug.isChild())
outPlugName = getAttributeNameFromPlug(otherSidePlug.parent());
return result;
}
开发者ID:MassW,项目名称:OpenMaya,代码行数:34,代码来源:tools.cpp
示例9: meshName
void LuxRenderer::createAreaLightMesh(mtlu_MayaObject *obj)
{
MString meshName("");
MFnDependencyNode depFn(obj->mobject);
MObject otherSideObj = getOtherSideNode(MString("mtlu_areaLight_geo"), obj->mobject);
if( otherSideObj != MObject::kNullObj)
{
}else{
int indices[6] = {0,1,2,2,3,0};
float floatPointArray[12] = {-1, -1, 0,
-1, 1, 0,
1, 1, 0,
1, -1, 0};
float floatNormalArray[12] = {0,0,-1,
0,0,-1,
0,0,-1,
0,0,-1};
ParamSet triParams = CreateParamSet();
triParams->AddInt("indices", indices, 6);
triParams->AddPoint("P", floatPointArray, 4);
triParams->AddNormal("N", floatNormalArray, 4);
lux->transformBegin();
float fm[16];
MMatrix tm = obj->transformMatrices[0];
setZUp(tm, fm);
this->lux->transform(fm);
this->lux->shape("trianglemesh", boost::get_pointer(triParams));
lux->transformEnd();
}
}
开发者ID:MassW,项目名称:OpenMaya,代码行数:35,代码来源:LuxGeometry.cpp
示例10: getConnectedShadingEngine
MObject getConnectedShadingEngine(MObject node)
{
MObject se = MObject::kNullObj;
MFnDependencyNode depFn(node);
MPlugArray plugArray;
depFn.getConnections(plugArray);
for( uint i = 0; i < plugArray.length(); i++)
{
if( plugArray[i].isSource() )
{
MPlugArray desArray;
plugArray[i].connectedTo(desArray, false, true);
for(uint k = 0; k < desArray.length(); k++)
{
if( desArray[k].node().hasFn(MFn::kShadingEngine))
{
se = desArray[k].node();
}
}
}
}
return se;
}
开发者ID:MassW,项目名称:OpenMaya,代码行数:25,代码来源:tools.cpp
示例11: depFn
bool
MayaPrimWriter::writePrimAttrs(const MDagPath &dagT, const UsdTimeCode &usdTime, UsdGeomImageable &primSchema)
{
MStatus status;
MFnDependencyNode depFn(getDagPath().node());
MFnDependencyNode depFn2(dagT.node()); // optionally also scan a shape's transform if merging transforms
if (getArgs().exportVisibility) {
bool isVisible = true; // if BOTH shape or xform is animated, then visible
bool isAnimated = false; // if either shape or xform is animated, then animated
PxrUsdMayaUtil::getPlugValue(depFn, "visibility", &isVisible, &isAnimated);
if ( dagT.isValid() ) {
bool isVis, isAnim;
if (PxrUsdMayaUtil::getPlugValue(depFn2, "visibility", &isVis, &isAnim)){
isVisible = isVisible and isVis;
isAnimated = isAnimated or isAnim;
}
}
TfToken const &visibilityTok = (isVisible ? UsdGeomTokens->inherited :
UsdGeomTokens->invisible);
if (usdTime.IsDefault() != isAnimated ) {
if (usdTime.IsDefault())
primSchema.CreateVisibilityAttr(VtValue(visibilityTok), true);
else
primSchema.CreateVisibilityAttr().Set(visibilityTok, usdTime);
}
}
UsdPrim usdPrim = primSchema.GetPrim();
// There is no Gprim abstraction in this module, so process the few
// gprim attrs here.
UsdGeomGprim gprim = UsdGeomGprim(usdPrim);
if (gprim and usdTime.IsDefault()){
PxrUsdMayaPrimWriterContext* unused = NULL;
PxrUsdMayaTranslatorGprim::Write(
getDagPath().node(),
gprim,
unused);
}
_writeUsdInfo(dagT, usdTime, usdPrim);
// Write user-tagged export attributes. Write attributes on the transform
// first, and then attributes on the shape node. This means that attribute
// name collisions will always be handled by taking the shape node's value
// if we're merging transforms and shapes.
if (dagT.isValid() and !(dagT == getDagPath())) {
PxrUsdMayaWriteUtil::WriteUserExportedAttributes(dagT, usdPrim, usdTime);
}
PxrUsdMayaWriteUtil::WriteUserExportedAttributes(getDagPath(), usdPrim, usdTime);
return true;
}
开发者ID:400dama,项目名称:USD,代码行数:59,代码来源:MayaPrimWriter.cpp
示例12: getObjectName
MString getObjectName(const MObject& mobject)
{
if (mobject == MObject::kNullObj)
return "";
MFnDependencyNode depFn(mobject);
return depFn.name();
}
开发者ID:dictoon,项目名称:appleseed-maya,代码行数:8,代码来源:tools.cpp
示例13: hasPlug
bool hasPlug(MObject& thisObject, MString& plugName)
{
MStatus stat;
MFnDependencyNode depFn(thisObject, &stat); if( stat != MStatus::kSuccess) return false;
MPlug plug = depFn.findPlug(plugName, &stat);
if( stat != MStatus::kSuccess)
return false;
else
return true;
return false;
}
开发者ID:MassW,项目名称:OpenMaya,代码行数:11,代码来源:tools.cpp
示例14: _WritePrefixedAttrs
void
_WritePrefixedAttrs(
const UsdTimeCode &usdTime,
const _PrimEntry& entry)
{
MStatus status;
MFnDependencyNode depFn(entry.mayaDagPath.node());
for (const auto& attrEntry : entry.attrs) {
MPlug plg = depFn.findPlug(attrEntry.mayaAttributeName.c_str(), true);
UsdAttribute usdAttr;
if (attrEntry.isPrimvar) {
// Treat as custom primvar.
TfToken interpolation = _GetPrimvarInterpolation(
depFn, attrEntry.mayaAttributeName);
UsdGeomImageable imageable(entry.usdPrim);
if (!imageable) {
TF_RUNTIME_ERROR(
"Cannot create primvar for non-UsdGeomImageable "
"USD prim <%s>",
entry.usdPrim.GetPath().GetText());
continue;
}
UsdGeomPrimvar primvar = UsdMayaWriteUtil::GetOrCreatePrimvar(
plg,
imageable,
attrEntry.usdAttributeName,
interpolation,
-1,
false);
if (primvar) {
usdAttr = primvar.GetAttr();
}
}
else {
// Treat as custom attribute.
usdAttr = UsdMayaWriteUtil::GetOrCreateUsdAttr(
plg, entry.usdPrim, attrEntry.usdAttributeName, true);
}
if (usdAttr) {
UsdMayaWriteUtil::SetUsdAttr(plg, usdAttr, usdTime);
}
else {
TF_RUNTIME_ERROR(
"Could not create attribute '%s' for "
"USD prim <%s>",
attrEntry.usdAttributeName.c_str(),
entry.usdPrim.GetPath().GetText());
continue;
}
}
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:53,代码来源:alembicChaser.cpp
示例15: depFn
RoundCorners::RoundCorners(MObject shaderObject)
{
MFnDependencyNode depFn(shaderObject);
radius = getFloatAttr("radius", depFn, 0.0f);
samplesCount = getIntAttr("samples", depFn, 10);
float globalScaleFactor = 1.0f;
if (MayaTo::getWorldPtr()->worldRenderGlobalsPtr != nullptr)
globalScaleFactor = MayaTo::getWorldPtr()->worldRenderGlobalsPtr->scaleFactor;
else
globalScaleFactor = MayaTo::getWorldPtr()->scaleFactor;
radius *= globalScaleFactor;
};
开发者ID:haggi,项目名称:OpenMaya,代码行数:12,代码来源:CoronaRoundCorners.cpp
示例16: getConnectedOutPlugs
bool getConnectedOutPlugs(MObject& thisObject, MPlugArray& outPlugs)
{
MStatus stat;
bool result = false;
MFnDependencyNode depFn(thisObject, &stat); if( stat != MStatus::kSuccess) return result;
MPlugArray pa;
depFn.getConnections(pa);
for( uint i = 0; i < pa.length(); i++)
if( pa[i].isSource() )
outPlugs.append(pa[i]);
return true;
}
开发者ID:MassW,项目名称:OpenMaya,代码行数:13,代码来源:tools.cpp
示例17: getOtherSidePlugName
bool getOtherSidePlugName(MString& plugName, MObject& thisObject, MString& otherSidePlugName)
{
MStatus stat;
MFnDependencyNode depFn(thisObject, &stat); if( stat != MStatus::kSuccess) return false;
MPlug plug = depFn.findPlug(plugName, &stat); if( stat != MStatus::kSuccess) return false;
MPlugArray plugArray;
plug.connectedTo(plugArray, 1, 0, &stat);if( stat != MStatus::kSuccess) return false;
if( plugArray.length() == 0)
return false;
MPlug otherSidePlug = plugArray[0];
otherSidePlugName = otherSidePlug.name();
return true;
}
开发者ID:MassW,项目名称:OpenMaya,代码行数:13,代码来源:tools.cpp
示例18: getConnectedFileTexturePath
bool getConnectedFileTexturePath(MString& plugName, MString& nodeName, MString& value, MObject& outFileNode)
{
MStatus stat;
MObject obj = objectFromName(nodeName);
if( obj == MObject::kNullObj)
return false;
MFnDependencyNode depFn(obj);
MPlug plug = depFn.findPlug(plugName, &stat);
if( !stat )
return false;
//MGlobal::displayInfo(MString("is plug connected: ") + plug.name());
if( !plug.isConnected())
{
//MGlobal::displayInfo(MString("plug is NOT connected: ") + plug.name());
return false;
}
MPlugArray parray;
plug.connectedTo(parray, true, false, &stat);
if( !stat )
return false;
if( parray.length() == 0 )
return false;
MPlug destPlug = parray[0];
MObject fileNode = destPlug.node();
std::cout << "filenode: " << getObjectName(fileNode).asChar() << " plug name " << destPlug.name() << "\n";
if( !fileNode.hasFn(MFn::kFileTexture) )
{
std::cout << "node is not from type fileTexture.\n";
return false;
}
MFnDependencyNode fileDepFn(fileNode);
MPlug ftn = fileDepFn.findPlug("fileTextureName", &stat);
if(!stat)
{
std::cout << "fileTextureName not found at fileTexNode.\n";
return false;
}
MString fileTextureName = ftn.asString();
std::cout << "fileTextureName value: " << fileTextureName.asChar() <<"\n";
value = fileTextureName;
outFileNode = fileNode;
return true;
}
开发者ID:MassW,项目名称:OpenMaya,代码行数:51,代码来源:tools.cpp
示例19: getOtherSideNode
//
// simply get the node wich is connected to the named plug.
// If we have no connection, a kNullObject is returned.
//
MObject getOtherSideNode(MString& plugName, MObject& thisObject)
{
MStatus stat;
MObject result = MObject::kNullObj;
MFnDependencyNode depFn(thisObject, &stat); if( stat != MStatus::kSuccess) return result;
MPlug plug = depFn.findPlug(plugName, &stat); if( stat != MStatus::kSuccess) return result;
MPlugArray plugArray;
plug.connectedTo(plugArray, 1, 0, &stat);if( stat != MStatus::kSuccess) return result;
if( plugArray.length() == 0)
return result;
MPlug otherSidePlug = plugArray[0];
result = otherSidePlug.node();
return result;
}
开发者ID:MassW,项目名称:OpenMaya,代码行数:18,代码来源:tools.cpp
示例20: getConnectedInNode
MObject getConnectedInNode(MObject& thisObject, const char *attrName)
{
MObject result = MObject::kNullObj;
MFnDependencyNode depFn(thisObject);
MPlug inPlug = depFn.findPlug(attrName);
if( !inPlug.isConnected())
return result;
MPlugArray connectedPlugs;
inPlug.connectedTo(connectedPlugs, true, false);
if( connectedPlugs.length() == 0)
return result;
return connectedPlugs[0].node();
}
开发者ID:MassW,项目名称:OpenMaya,代码行数:15,代码来源:tools.cpp
注:本文中的depFn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论