当前位置: 首页>>代码示例>>C++>>正文


C++ MFnEnumAttribute::setInternal方法代码示例

本文整理汇总了C++中MFnEnumAttribute::setInternal方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnEnumAttribute::setInternal方法的具体用法?C++ MFnEnumAttribute::setInternal怎么用?C++ MFnEnumAttribute::setInternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MFnEnumAttribute的用法示例。


在下文中一共展示了MFnEnumAttribute::setInternal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addAttribute

MStatus
OpenSubdivShader::initialize()
{
    MStatus stat;
    MFnTypedAttribute typedAttr;
    MFnNumericAttribute numAttr;
    MFnEnumAttribute enumAttr;

    aLevel = numAttr.create("level", "lv", MFnNumericData::kLong, 1);
    numAttr.setInternal(true);
    numAttr.setMin(1);
    numAttr.setSoftMax(5);

    aScheme = enumAttr.create("scheme", "sc");
    enumAttr.addField("Catmull-Clark", kCatmark);
    enumAttr.addField("Loop", kLoop);
    enumAttr.addField("Bilinear", kBilinear);
    enumAttr.setInternal(true);

    aKernel = enumAttr.create("kernel", "kn");
    enumAttr.addField("CPU", OpenSubdiv::OsdKernelDispatcher::kCPU);
    if (OpenSubdiv::OsdKernelDispatcher::HasKernelType(OpenSubdiv::OsdKernelDispatcher::kOPENMP))
        enumAttr.addField("OpenMP", OpenSubdiv::OsdKernelDispatcher::kOPENMP);
    if (OpenSubdiv::OsdKernelDispatcher::HasKernelType(OpenSubdiv::OsdKernelDispatcher::kCL))
        enumAttr.addField("CL", OpenSubdiv::OsdKernelDispatcher::kCL);
    if (OpenSubdiv::OsdKernelDispatcher::HasKernelType(OpenSubdiv::OsdKernelDispatcher::kCUDA))
        enumAttr.addField("CUDA", OpenSubdiv::OsdKernelDispatcher::kCUDA);
    enumAttr.setInternal(true);

    aDiffuse = numAttr.createColor("diffuse", "d");
    numAttr.setDefault(1.0f, 1.0f, 1.0f);
    aSpecular = numAttr.createColor("specular", "s");
    numAttr.setDefault(1.0f, 1.0f, 1.0f);
    aAmbient = numAttr.createColor("ambient", "a");
    numAttr.setDefault(1.0f, 1.0f, 1.0f);
    aShininess = numAttr.create("shininess", "shin", MFnNumericData::kFloat, 16.0f);
    numAttr.setMin(0);
    numAttr.setMax(128.0f);

    aWireframe = numAttr.create("wireframe", "wf", MFnNumericData::kBoolean);

    addAttribute(aLevel);
    addAttribute(aScheme);
    addAttribute(aKernel);
    addAttribute(aDiffuse);
    addAttribute(aSpecular);
    addAttribute(aAmbient);
    addAttribute(aShininess);
    addAttribute(aWireframe);

    return MS::kSuccess;
}
开发者ID:Ernesto01,项目名称:OpenSubdiv,代码行数:52,代码来源:OpenSubdivShaderOverride.cpp

示例2: addAttribute

MStatus
OpenSubdivPtexShader::initialize()
{
    MFnTypedAttribute typedAttr;
    MFnNumericAttribute numAttr;
    MFnEnumAttribute enumAttr;

    // level
    aLevel = numAttr.create("level", "lv", MFnNumericData::kLong, 3);
    numAttr.setInternal(true);
    numAttr.setMin(1);
    numAttr.setSoftMax(5);
    numAttr.setMax(10);

    // tessFactor
    aTessFactor = numAttr.create("tessFactor", "tessf", MFnNumericData::kLong, 2);
    numAttr.setInternal(true);
    numAttr.setMin(1);
    numAttr.setMax(10);

    // scheme
    aScheme = enumAttr.create("scheme", "sc", OsdPtexMeshData::kCatmark);
    enumAttr.addField("Catmull-Clark",  OsdPtexMeshData::kCatmark);
    enumAttr.addField("Loop",           OsdPtexMeshData::kLoop);
    enumAttr.addField("Bilinear",       OsdPtexMeshData::kBilinear);
    enumAttr.setInternal(true);

    // kernel
    aKernel = enumAttr.create("kernel", "kn", OsdPtexMeshData::kCPU);
    enumAttr.addField("CPU",    OsdPtexMeshData::kCPU);
#ifdef OPENSUBDIV_HAS_OPENMP
    enumAttr.addField("OpenMP", OsdPtexMeshData::kOPENMP);
#endif
#ifdef OPENSUBDIV_HAS_OPENCL
    enumAttr.addField("CL",     OsdPtexMeshData::kCL);
#endif
#ifdef OPENSUBDIV_HAS_CUDA
    enumAttr.addField("CUDA",   OsdPtexMeshData::kCUDA);
#endif
    enumAttr.setInternal(true);

    // interpolateBoundary
    aInterpolateBoundary = enumAttr.create("interpolateBoundary", "ib",
                                           OsdPtexMeshData::kInterpolateBoundaryNone);
    enumAttr.addField("None",            OsdPtexMeshData::kInterpolateBoundaryNone);
    enumAttr.addField("Edge Only",       OsdPtexMeshData::kInterpolateBoundaryEdgeOnly);
    enumAttr.addField("Edge and Corner", OsdPtexMeshData::kInterpolateBoundaryEdgeAndCorner);
    enumAttr.addField("Always Sharp",    OsdPtexMeshData::kInterpolateBoundaryAlwaysSharp);
    enumAttr.setInternal(true);

    // adaptive
    aAdaptive = numAttr.create("adaptive", "adp", MFnNumericData::kBoolean, true);
    numAttr.setInternal(true);

    // wireframe
    aWireframe = numAttr.create("wireframe", "wf", MFnNumericData::kBoolean, false);

    // material attributes
    aDiffuse = numAttr.createColor("diffuse",   "d");
    numAttr.setDefault(0.6f, 0.6f, 0.7f);
    aAmbient = numAttr.createColor("ambient",   "a");
    numAttr.setDefault(0.1f, 0.1f, 0.1f);
    aSpecular = numAttr.createColor("specular", "s");
    numAttr.setDefault(0.3f, 0.3f, 0.3f);

    // Ptex Texture Attributes
    //
    // diffuseEnvironmentMapFile;
    aDiffuseEnvironmentMapFile = typedAttr.create("diffuseEnvironmentMap", "difenv", MFnData::kString);
    typedAttr.setInternal(true);
    // don't let maya hold on to string when fileNode is disconnected
    typedAttr.setDisconnectBehavior(MFnAttribute::kReset);

    // specularEnvironmentMapFile;
    aSpecularEnvironmentMapFile = typedAttr.create("specularEnvironmentMap", "specenv", MFnData::kString);
    typedAttr.setInternal(true);
    // don't let maya hold on to string when fileNode is disconnected
    typedAttr.setDisconnectBehavior(MFnAttribute::kReset);

    // colorFile;
    aColorFile = typedAttr.create("colorFile", "cf", MFnData::kString);
    typedAttr.setInternal(true);

    // displacementFile;
    aDisplacementFile = typedAttr.create("displacementFile", "df", MFnData::kString);
    typedAttr.setInternal(true);

    // occlusionFile;
    aOcclusionFile = typedAttr.create("occlusionFile", "of", MFnData::kString);
    typedAttr.setInternal(true);

    // enableDisplacement;
    aEnableDisplacement = numAttr.create("enableDisplacement", "end", MFnNumericData::kBoolean, 1);
    numAttr.setInternal(true);

    // enableColor;
    aEnableColor = numAttr.create("enableColor", "enc", MFnNumericData::kBoolean, 1);
    numAttr.setInternal(true);

    // enableOcclusion;
//.........这里部分代码省略.........
开发者ID:GaryRay,项目名称:OpenSubdiv,代码行数:101,代码来源:OpenSubdivPtexShader.cpp

示例3: addAttribute

MStatus
OpenSubdivShader::initialize() 
{
    MFnTypedAttribute typedAttr;
    MFnNumericAttribute numAttr;
    MFnEnumAttribute enumAttr;

    // Subdivision level
    aLevel = numAttr.create("level", "lv", MFnNumericData::kLong, 3);
    numAttr.setInternal(true);
    numAttr.setMin(1);
    numAttr.setSoftMax(5);
    numAttr.setMax(10);
    addAttribute(aLevel);

    // GPU tesselation factor
    aTessFactor = numAttr.create("tessFactor", "tessf", MFnNumericData::kLong, 2);
    numAttr.setInternal(true);
    numAttr.setMin(1);
    numAttr.setMax(10);
    addAttribute(aTessFactor);

    // Subdivision scheme
    aScheme = enumAttr.create("scheme", "sc", OsdMeshData::kCatmark);
    enumAttr.setInternal(true);
    enumAttr.addField("Catmull-Clark",  OsdMeshData::kCatmark);
    enumAttr.addField("Loop",           OsdMeshData::kLoop);
    enumAttr.addField("Bilinear",       OsdMeshData::kBilinear);
    addAttribute(aScheme);

    // Computation kernel
    aKernel = enumAttr.create("kernel", "kn", OsdMeshData::kCPU);
    enumAttr.setInternal(true);
    enumAttr.addField("CPU",    OsdMeshData::kCPU);
#ifdef OPENSUBDIV_HAS_OPENMP
    enumAttr.addField("OpenMP", OsdMeshData::kOPENMP);
#endif
#ifdef OPENSUBDIV_HAS_OPENCL
    enumAttr.addField("CL",     OsdMeshData::kCL);
#endif
#ifdef OPENSUBDIV_HAS_CUDA
    enumAttr.addField("CUDA",   OsdMeshData::kCUDA);
#endif
    addAttribute(aKernel);

    // Boundary interpolation flag
    aInterpolateBoundary = enumAttr.create("interpolateBoundary", "ib", 
                    OsdMeshData::kInterpolateBoundaryNone);
    enumAttr.addField("None",            OsdMeshData::kInterpolateBoundaryNone);
    enumAttr.addField("Edge Only",       OsdMeshData::kInterpolateBoundaryEdgeOnly);
    enumAttr.addField("Edge and Corner", OsdMeshData::kInterpolateBoundaryEdgeAndCorner);
    enumAttr.addField("Always Sharp",    OsdMeshData::kInterpolateBoundaryAlwaysSharp);
    enumAttr.setInternal(true);
    addAttribute(aInterpolateBoundary);

    // Feature-adaptive toggle
    aAdaptive = numAttr.create("adaptive", "adp", MFnNumericData::kBoolean, true);
    numAttr.setInternal(true);
    addAttribute(aAdaptive);

    // Wireframe display toggle
    aWireframe = numAttr.create("wireframe", "wf", MFnNumericData::kBoolean, false);
    addAttribute(aWireframe);

    // Material attributes 
    aDiffuse = numAttr.createColor("diffuse",   "d");
    numAttr.setDefault(0.6f, 0.6f, 0.7f);
    addAttribute(aDiffuse);

    aAmbient = numAttr.createColor("ambient",   "a");
    numAttr.setDefault(0.1f, 0.1f, 0.1f);
    addAttribute(aAmbient);

    aSpecular = numAttr.createColor("specular", "s");
    numAttr.setDefault(0.3f, 0.3f, 0.3f);
    addAttribute(aSpecular);

    aShininess = numAttr.create("shininess", "shin", MFnNumericData::kFloat, 50.0f);
    numAttr.setMin(0);
    numAttr.setSoftMax(128.0f);
    addAttribute(aShininess);

    // Texture attributes
    aDiffuseMapFile = typedAttr.create("diffuseMap", "difmap", MFnData::kString);
    typedAttr.setInternal(true);
    /* don't let maya hold on to string when fileNode is disconnected */
    typedAttr.setDisconnectBehavior(MFnAttribute::kReset);
    addAttribute(aDiffuseMapFile);

    // UV set (defaults to current UV set)
    aUVSet = typedAttr.create("uvSet", "uvs", MFnData::kString);
    typedAttr.setInternal(true);
    addAttribute(aUVSet);

    // Boundary interpolation flag for face-varying data (UVs)
    aInterpolateUVBoundary = enumAttr.create("interpolateUVBoundary", "iuvb", 
                    OsdMeshData::kInterpolateBoundaryNone);
    enumAttr.addField("None",            OsdMeshData::kInterpolateBoundaryNone);
    enumAttr.addField("Edge Only",       OsdMeshData::kInterpolateBoundaryEdgeOnly);
    enumAttr.addField("Edge and Corner", OsdMeshData::kInterpolateBoundaryEdgeAndCorner);
//.........这里部分代码省略.........
开发者ID:Sei-Imai,项目名称:OpenSubdiv,代码行数:101,代码来源:OpenSubdivShader.cpp


注:本文中的MFnEnumAttribute::setInternal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。