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


C++ BaseObject::GetClone方法代码示例

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


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

示例1: GetContour

SplineObject* Voxelify::GetContour(BaseObject *op, BaseDocument *doc, Real lod, BaseThread *bt){
    BaseContainer *data = op->GetDataInstance();
    BaseObject* parent=(BaseObject*)data->GetLink(CTT_OBJECT_LINK,doc,Obase);
    if (!parent) return NULL;
    
    LONG startObject = data->GetLong(START_FRAME);
    LONG endObject = data->GetLong(END_FRAME);
    
    if (startObject >=endObject) return NULL;
    
    maxSeg = data->GetReal(CTTSPOBJECT_MAXSEG,30.);
    minSeg = data->GetReal(CTTSPOBJECT_MINSEG);
    
    LONG delta = data->GetLong(OBJECT_SKIP,1);
    delta = delta < 1 ? 1 : delta;
    
    GeDynamicArray<BaseObject*> children;
    GeDynamicArray<GeDynamicArray<Vector> > splineAtPoint;
    
    BaseObject* chld = NULL;
    LONG trck = 0;
    for (chld=parent->GetDownLast(); chld; chld=chld->GetPred()) {
        if (trck >= startObject && trck<= endObject && trck % delta == 0){
            children.Push((BaseObject*)chld->GetClone(COPYFLAGS_NO_HIERARCHY|COPYFLAGS_NO_ANIMATION|COPYFLAGS_NO_BITS,NULL));
        }
        trck++;
    }
    
    if (children.GetCount() < 2) {
        return NULL;
    }
    
    LONG splineInterpolation = data->GetLong(SPLINEOBJECT_INTERPOLATION);
    LONG longestPercent = data->GetLong(TAKE_LONGEST, 1);
    longestPercent = longestPercent > 100 ? 100: longestPercent;

    parentMatrix = parent->GetMl();
    GeDynamicArray<GeDynamicArray<Vector> > objectPoints(children.GetCount());
	StatusSetBar(0);
    StatusSetText("Collecting Points");
    vector<vector<float> > points;
    std::vector<VGrid> grids;

    LONG gridSize = data->GetLong(GRID_SIZE, 1);
    if (!(gridSize > 0)) return NULL;
    for (int k= 0; k < children.GetCount(); k++){
        Matrix ml;
        DoRecursion(op,children[k],objectPoints[k], ml);
        points = objectPointsToPoints(objectPoints[k]);
        GePrint(children[k]->GetName());
        grids.push_back(vox.voxelify(points,gridSize, 12, 1.0));
        if (k % 5 == 0){
            LONG progress = 10 + (50*k)/children.GetCount();
            StatusSetBar(progress);
            StatusSetText(LongToString(progress)+"%");
            if (bt && bt->TestBreak()){
                //break; //this break seems to be kicking in randomly killing the loop
            }
        }
    }

    StatusSetText("Building Splines");
    
    SplineObject* parentSpline = ComputeSpline(bt, grids, longestPercent, splineAtPoint);
    
    ModelingCommandData mcd;
    mcd.doc = doc;
    mcd.op = parentSpline;
    
    if(!SendModelingCommand(MCOMMAND_JOIN, mcd)){
        return NULL;
    }
    
    SplineObject* ret = ToSpline(mcd.result->GetIndex(0L));
    
    ret->GetDataInstance()->SetLong(SPLINEOBJECT_INTERPOLATION, splineInterpolation);
    
    for (int k=0; k<children.GetCount(); k++){
        if (children[k]){
            BaseObject::Free(children[k]);
        }
    }
    
    return ret;
Error:
    for (int i = 0; i < children.GetCount(); i++){
        BaseObject::Free(children[i]);
    }
    return NULL;
}
开发者ID:eighteight,项目名称:Voxelify,代码行数:90,代码来源:voxelify.cpp


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