Changeset 999 for cpp/frams


Ignore:
Timestamp:
07/13/20 13:51:43 (4 years ago)
Author:
Maciej Komosinski
Message:

More consistent usage of "shapetype" (vs. "shape")

Location:
cpp/frams
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/f0_variants_test.cpp

    r986 r999  
    9898                g.getFormat().c_str(), g.getComment().c_str());
    9999
    100         Model m(g, Model::SHAPE_UNKNOWN);//.getConverted('0'));
     100        Model m(g, Model::SHAPETYPE_UNKNOWN);//.getConverted('0'));
    101101
    102102        if (!m.isValid())
  • cpp/frams/_demos/full_props.cpp

    r972 r999  
    7575                loadSString(VirtFILE::Vstdin, gen);
    7676        Geno g(gen);
    77         Model m(g, Model::SHAPE_UNKNOWN);
     77        Model m(g, Model::SHAPETYPE_UNKNOWN);
    7878
    7979        if (!m.isValid())
  • cpp/frams/_demos/genoconv_test.cpp

    r994 r999  
    212212        if (using_checkpoints)
    213213        { // using Model with checkpoints
    214                 Model m1(g2, Model::SHAPE_UNKNOWN, false, true);//true=using_checkpoints
     214                Model m1(g2, Model::SHAPETYPE_UNKNOWN, false, true);//true=using_checkpoints
    215215                printf("\nModel built from the converted f%s genotype has %d checkpoints\n", g2.getFormat().c_str(), m1.getCheckpointCount());
    216                 Model m2(g1, Model::SHAPE_UNKNOWN, false, true);//true=using_checkpoints
     216                Model m2(g1, Model::SHAPETYPE_UNKNOWN, false, true);//true=using_checkpoints
    217217                printf("Model built from the source f%s genotype has %d checkpoints\n", g1.getFormat().c_str(), m2.getCheckpointCount());
    218218                // accessing individual checkpoint models (if available)
     
    240240                }
    241241
    242                 Model mod1(g1, Model::SHAPE_UNKNOWN, 1);
     242                Model mod1(g1, Model::SHAPETYPE_UNKNOWN, 1);
    243243                printf("\nModel map for f%s genotype:\n", g1.getFormat().c_str());
    244244                ModelDisplayMap dm1(mod1);
     
    247247                mod1combined.addCombined(mod1.getMap(), dm1.getMap());
    248248                mod1combined.print();
    249                 Model mod2(g2, Model::SHAPE_UNKNOWN, 1);
     249                Model mod2(g2, Model::SHAPETYPE_UNKNOWN, 1);
    250250                printf("\nModel map for f%s genotype:\n", g2.getFormat().c_str());
    251251                ModelDisplayMap dm2(mod2);
  • cpp/frams/_demos/genomanipulation.cpp

    r990 r999  
    196196                        printf(cl->getPreferredOutput() ? "and provides meaningful output signal (getPreferredOutput()==1).\n" : "and doesn't provide useful output signal (getPreferredOutput()==0).\n");
    197197                        printf("Instances of '%s' can be used in models having ", cl->getName().c_str());
    198                         if (cl->getSupportedShapeTypes() == NeuroClass::SUPPORTED_SHAPE_ALL)
     198                        if (cl->getSupportedShapeTypes() == NeuroClass::SUPPORTED_SHAPETYPE_ALL)
    199199                                printf("any shape types.\n");
    200200                        else
    201201                        {
    202202                                printf("shape types:");
    203                                 for (int i = Model::SHAPE_FIRST; i <= Model::SHAPE_LAST; i++)
     203                                for (int i = Model::SHAPETYPE_FIRST; i <= Model::SHAPETYPE_LAST; i++)
    204204                                        if (cl->isShapeTypeSupported((Model::ShapeType)i))
    205205                                                printf(" '%s'", Model::getShapeTypeName((Model::ShapeType)i));
     
    209209                        {
    210210                                printf("Instances of '%s' can be attached to Joints having ", cl->getName().c_str());
    211                                 if (cl->getSupportedJointShapes() == NeuroClass::SUPPORTED_JOINT_ALL)
     211                                if (cl->getSupportedJointShapes() == NeuroClass::SUPPORTED_JOINTSHAPE_ALL)
    212212                                        printf("any shapes");
    213213                                else
     
    311311                g.getFormat().c_str(), g.getComment().c_str());
    312312
    313         Model m(g, Model::SHAPE_UNKNOWN);//.getConverted('0'));
     313        Model m(g, Model::SHAPETYPE_UNKNOWN);//.getConverted('0'));
    314314
    315315        if (!m.isValid())
  • cpp/frams/_demos/geometry/geometrytestutils.cpp

    r972 r999  
    6363                if ((genoIndex == count) || (strcmp(genotype->name.c_str(), genoName) == 0))
    6464                {
    65                         Model model(genotype->genotype, Model::SHAPE_UNKNOWN);
     65                        Model model(genotype->genotype, Model::SHAPETYPE_UNKNOWN);
    6666
    6767                        if (!model.isValid())
  • cpp/frams/_demos/multiline_f0_test.cpp

    r986 r999  
    3030                g.getFormat().c_str(), g.getComment().c_str());
    3131
    32         Model m(g, Model::SHAPE_UNKNOWN);//.getConverted('0'));
     32        Model m(g, Model::SHAPETYPE_UNKNOWN);//.getConverted('0'));
    3333
    3434        if (!m.isValid())
  • cpp/frams/_demos/neuro_layout_test.cpp

    r972 r999  
    104104        Geno g(gen);
    105105        if (!g.isValid()) { puts("invalid genotype"); return 5; }
    106         Model m(g, Model::SHAPE_UNKNOWN);
     106        Model m(g, Model::SHAPETYPE_UNKNOWN);
    107107        if (!m.getNeuroCount()) { puts("no neural network"); return 1; }
    108108        printf("%d neurons,", m.getNeuroCount());
  • cpp/frams/_demos/neuro_test.cpp

    r972 r999  
    7777        Geno g(gen);
    7878        if (!g.isValid()) { puts("invalid genotype"); return 5; }
    79         Model m(g, Model::SHAPE_UNKNOWN);
     79        Model m(g, Model::SHAPETYPE_UNKNOWN);
    8080        if (!m.getNeuroCount()) { puts("no neural network"); return 1; }
    8181        printf("%d neurons,", m.getNeuroCount());
  • cpp/frams/_demos/shapeconvert.cpp

    r972 r999  
    6767                loadSString(VirtFILE::Vstdin, gen);
    6868        Geno g(gen);
    69         Model m(g, Model::SHAPE_UNKNOWN);
     69        Model m(g, Model::SHAPETYPE_UNKNOWN);
    7070
    7171        if (!m.isValid())
     
    7575        }
    7676
    77         if (m.getShapeType() != Model::SHAPE_BALL_AND_STICK)
     77        if (m.getShapeType() != Model::SHAPETYPE_BALL_AND_STICK)
    7878        {
    7979                logPrintf("", "shapeconvert", LOG_ERROR, "Only ball-and-stick models can be converted");
  • cpp/frams/genetics/f4/f4_oper.cpp

    r974 r999  
    164164                        {
    165165                                // make neuron
    166                                 NeuroClass *rndclass = GenoOperators::getRandomNeuroClass(Model::SHAPE_BALL_AND_STICK);
     166                                NeuroClass *rndclass = GenoOperators::getRandomNeuroClass(Model::SHAPETYPE_BALL_AND_STICK);
    167167                                if (rndclass == NULL)
    168168                                {
     
    434434        {
    435435                // '*', 'G', 'T', or 'S', 1/4 chance each
    436                 nc = GenoOperators::getRandomNeuroClassWithOutputAndNoInputs(Model::SHAPE_BALL_AND_STICK);
     436                nc = GenoOperators::getRandomNeuroClassWithOutputAndNoInputs(Model::SHAPETYPE_BALL_AND_STICK);
    437437        }
    438438        if (nc != NULL)
     
    470470                if (rndDouble(1) < 0.2f)
    471471                {
    472                         cl = GenoOperators::getRandomNeuroClassWithOutputAndNoInputs(Model::SHAPE_BALL_AND_STICK);
     472                        cl = GenoOperators::getRandomNeuroClassWithOutputAndNoInputs(Model::SHAPETYPE_BALL_AND_STICK);
    473473                        if (cl != NULL)
    474474                        {
  • cpp/frams/genetics/fB/fB_oper.cpp

    r974 r999  
    287287                int rndid = rndUint(tokenized.size()); // select random insertion point
    288288                std::advance(it, rndid);
    289                 NeuroClass *cls = getRandomNeuroClass(Model::SHAPE_BALL_AND_STICK);
     289                NeuroClass *cls = getRandomNeuroClass(Model::SHAPETYPE_BALL_AND_STICK);
    290290                if (cls)
    291291                {
  • cpp/frams/genetics/fH/fH_oper.cpp

    r974 r999  
    255255                fH_Handle *handle = NULL;
    256256                method = FH_OPCOUNT + roulette(addoperations, FH_ADD_OPCOUNT);
    257                 if (getActiveNeuroClassCount(Model::SHAPE_BALL_AND_STICK) == 0) method = FH_OPCOUNT + FH_ADD_STICK;
     257                if (getActiveNeuroClassCount(Model::SHAPETYPE_BALL_AND_STICK) == 0) method = FH_OPCOUNT + FH_ADD_STICK;
    258258                switch (method - FH_OPCOUNT)
    259259                {
     
    440440        if (userandomclass)
    441441        {
    442                 NeuroClass *nc = getRandomNeuroClass(Model::SHAPE_BALL_AND_STICK); // checking that neuron classes are available should be done before
     442                NeuroClass *nc = getRandomNeuroClass(Model::SHAPETYPE_BALL_AND_STICK); // checking that neuron classes are available should be done before
    443443                det = nc->getName();
    444444        }
  • cpp/frams/genetics/fL/fL_oper.cpp

    r974 r999  
    141141                {
    142142                        SString det;
    143                         NeuroClass *cls = getRandomNeuroClass(Model::SHAPE_BALL_AND_STICK);
     143                        NeuroClass *cls = getRandomNeuroClass(Model::SHAPETYPE_BALL_AND_STICK);
    144144                        det = cls->getName();
    145145                        Geno_fH::mutateNeuronProperties(det);
     
    201201                        return creature->words["S"];
    202202                case FL_ADD_NEURO:
    203                         if (getActiveNeuroClassCount(Model::SHAPE_BALL_AND_STICK) == 0)
     203                        if (getActiveNeuroClassCount(Model::SHAPETYPE_BALL_AND_STICK) == 0)
    204204                                return creature->words["S"];
    205205                        else
  • cpp/frams/genetics/geno.cpp

    r988 r999  
    260260        if (Geno::formatIsOneOf(g.getFormat(), Geno::F0_FORMAT_LIST))
    261261        {
    262                 Model mod(g, Model::SHAPE_UNKNOWN);
     262                Model mod(g, Model::SHAPETYPE_UNKNOWN);
    263263                return mod.isValid();
    264264        }
  • cpp/frams/genetics/genoconv.h

    r988 r999  
    3434
    3535/// Base class for all Geno Converters.
    36 /// In constructor you have to set public fields
    37 /// indicating your identity and supported formats.
     36/// In constructor you have to set public fields indicating your identity and supported formats.
    3837/// Each converter serves one in-out format pair.
    39 /// Instance of your converter should be registered
    40 /// in GenoConvManager.
     38/// The instance of your converter should be registered in GenoConvManager.
    4139class GenoConverter
    4240{
    4341public:
    4442        const char *name;       //< converter name (short)
    45         SString in_format,      //< input format, eg. "1"
    46                 out_format;     //< output format, eg. "0"
     43        SString in_format,      //< input format, e.g. "1"
     44                out_format;     //< output format, e.g. "0"
    4745        paInt enabled;  //< don't touch this! (used by configuration module)
    4846        paInt mapsupport; //< set to 1 if your converter supports genotype mapping
  • cpp/frams/model/geometry/modelgeoclass.cpp

    r661 r999  
    7474        if (m != NULL)
    7575        {
    76                 if (m->getShapeType() == Model::SHAPE_BALL_AND_STICK)
     76                if (m->getShapeType() == Model::SHAPETYPE_BALL_AND_STICK)
    7777                        {
    7878                        Model *converted = new Model;
  • cpp/frams/model/model.cpp

    r988 r999  
    1717}
    1818
    19 void Model::init(ShapeType sh)
     19void Model::init(ShapeType shtype)
    2020{
    2121        partmappingchanged = 0;
     
    2929        f0map = 0;
    3030        f0genoknown = 1;
    31         shape = SHAPE_UNKNOWN;
    32         declared_shape = sh;
    33 }
    34 
    35 void Model::declareShapeType(ShapeType sh)
    36 {
    37         declared_shape = sh;
     31        shapetype = SHAPETYPE_UNKNOWN;
     32        declared_shapetype = shtype;
     33}
     34
     35void Model::declareShapeType(ShapeType shtype)
     36{
     37        declared_shapetype = shtype;
    3838}
    3939
     
    5656        geno = mod.geno;
    5757        f0genoknown = 0;
    58         shape = mod.shape;
    59         declared_shape = mod.declared_shape;
     58        shapetype = mod.shapetype;
     59        declared_shapetype = mod.declared_shapetype;
    6060        startenergy = mod.startenergy;
    6161        modelfromgenotype = mod.modelfromgenotype;
     
    117117        :autobuildmaps(buildmaps)
    118118{
    119         init(mod.declared_shape);
     119        init(mod.declared_shapetype);
    120120        open(_using_checkpoints, _is_checkpoint);
    121121        internalCopy(mod);
     
    169169        delMap();
    170170        delF0Map();
    171         init(declared_shape);
     171        init(declared_shapetype);
    172172        geno = Geno();
    173173        f0geno = Geno();
     
    340340        f0warnposition = -1;
    341341        MultiMap *convmap = autobuildmaps ? new MultiMap() : NULL;
    342         if (declared_shape == SHAPE_UNKNOWN)
     342        if (declared_shapetype == SHAPETYPE_UNKNOWN)
    343343                f0geno = geno.getConverted(Geno::F0_FORMAT_LIST, convmap, using_checkpoints);
    344344        else
    345                 f0geno = geno.getConverted(genoFormatForShapeType(declared_shape), convmap, using_checkpoints);
     345                f0geno = geno.getConverted(genoFormatForShapeType(declared_shapetype), convmap, using_checkpoints);
    346346        f0genoknown = 1;
    347347        if (f0geno.isInvalid())
     
    351351                return;
    352352        }
    353         if (declared_shape == SHAPE_UNKNOWN)
     353        if (declared_shapetype == SHAPETYPE_UNKNOWN)
    354354                declareShapeType(shapeTypeForGenoFormat(f0geno.getFormat()));
    355355        SString f0txt = f0geno.getGenes();
     
    560560        switch (st)
    561561        {
    562         case SHAPE_BALL_AND_STICK:
     562        case SHAPETYPE_BALL_AND_STICK:
    563563                return "0";
    564         case SHAPE_SOLIDS:
     564        case SHAPETYPE_SOLIDS:
    565565                return "0s";
    566566        default:
     
    572572{
    573573        if (format == "0")
    574                 return SHAPE_BALL_AND_STICK;
     574                return SHAPETYPE_BALL_AND_STICK;
    575575        else if (format == "0s")
    576                 return SHAPE_SOLIDS;
     576                return SHAPETYPE_SOLIDS;
    577577        else
    578                 return SHAPE_UNKNOWN;
     578                return SHAPETYPE_UNKNOWN;
    579579
    580580}
     
    584584        switch (sh)
    585585        {
    586         case SHAPE_BALL_AND_STICK: return "ball-and-stick";
    587         case SHAPE_SOLIDS: return "solid shapes";
    588         case SHAPE_UNKNOWN: return "unknown";
    589 
    590         case SHAPE_ILLEGAL:
     586        case SHAPETYPE_BALL_AND_STICK: return "ball-and-stick";
     587        case SHAPETYPE_SOLIDS: return "solid shapes";
     588        case SHAPETYPE_UNKNOWN: return "unknown";
     589
     590        case SHAPETYPE_ILLEGAL:
    591591        default:
    592592                return "illegal";
     
    894894        int i, k;
    895895        int ret = 1;
    896         shape = SHAPE_UNKNOWN;
     896        shapetype = SHAPETYPE_UNKNOWN;
    897897        updateRefno();
    898898        if ((parts.size() == 0) && (neurons.size() == 0)) return 0;
     
    931931                        if (p->p.y + p->size > bbmax.y) bbmax.y = p->p.y + p->size;
    932932                        if (p->p.z + p->size > bbmax.z) bbmax.z = p->p.z + p->size;
    933                         if (shape == SHAPE_UNKNOWN)
    934                                 shape = (p->shape == Part::SHAPE_BALL_AND_STICK) ? SHAPE_BALL_AND_STICK : SHAPE_SOLIDS;
    935                         else if (shape != SHAPE_ILLEGAL)
     933                        if (shapetype == SHAPETYPE_UNKNOWN)
     934                                shapetype = (p->shape == Part::SHAPE_BALL) ? SHAPETYPE_BALL_AND_STICK : SHAPETYPE_SOLIDS;
     935                        else if (shapetype != SHAPETYPE_ILLEGAL)
    936936                        {
    937                                 if ((p->shape == Part::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK))
     937                                if ((p->shape == Part::SHAPE_BALL) ^ (shapetype == SHAPETYPE_BALL_AND_STICK))
    938938                                {
    939                                         shape = SHAPE_ILLEGAL;
     939                                        shapetype = SHAPETYPE_ILLEGAL;
    940940                                        logPrintf("Model", "internalCheck", LOG_WARN, "Inconsistent part shapes (mixed ball-and-stick and solids shape types)%s", nameForErrors().c_str());
    941941                                }
     
    10021002                                if ((check != LIVE_CHECK) && (check != CHECKPOINT_CHECK))
    10031003                                {
    1004                                         if (j->shape == Joint::SHAPE_BALL_AND_STICK)
     1004                                        if (j->shape == Joint::SHAPE_STICK)
    10051005                                        {
    10061006                                                if (j->d() > getMaxJoint().d.x)
     
    10171017                                ret = 0;
    10181018                        }
    1019                         if (shape != SHAPE_ILLEGAL)
     1019                        if (shapetype != SHAPETYPE_ILLEGAL)
    10201020                        {
    1021                                 if ((j->shape == Joint::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK))
     1021                                if ((j->shape == Joint::SHAPE_STICK) ^ (shapetype == SHAPETYPE_BALL_AND_STICK))
    10221022                                {
    1023                                         shape = SHAPE_ILLEGAL;
     1023                                        shapetype = SHAPETYPE_ILLEGAL;
    10241024                                        logPrintf("Model", "internalCheck", LOG_WARN, "Inconsistent joint shapes (mixed old and new shapes)%s", nameForErrors().c_str());
    10251025                                }
     
    11091109        }
    11101110
    1111         if (shape == SHAPE_ILLEGAL)
     1111        if (shapetype == SHAPETYPE_ILLEGAL)
    11121112                ret = 0;
    1113         else if ((declared_shape != SHAPE_UNKNOWN) && (declared_shape != shape))
    1114         {
    1115                 logPrintf("Model", "internalCheck", LOG_ERROR, "Model shape type '%s' does not match the declared type '%s'", getShapeTypeName(shape), getShapeTypeName(declared_shape));
     1113        else if ((declared_shapetype != SHAPETYPE_UNKNOWN) && (declared_shapetype != shapetype))
     1114        {
     1115                logPrintf("Model", "internalCheck", LOG_ERROR, "Model shape type '%s' does not match the declared type '%s'", getShapeTypeName(shapetype), getShapeTypeName(declared_shapetype));
    11161116                ret = 0;
    11171117        }
     
    13351335{
    13361336        using_model = converted_model = NULL;
    1337         if (m.getShapeType() == Model::SHAPE_BALL_AND_STICK)
     1337        if (m.getShapeType() == Model::SHAPETYPE_BALL_AND_STICK)
    13381338        {
    13391339                converted_model = new Model;
  • cpp/frams/model/model.h

    r972 r999  
    101101        };
    102102protected:
    103         ShapeType shape;
    104         ShapeType declared_shape;
     103        ShapeType shapetype;
     104        ShapeType declared_shapetype;
    105105
    106106        SString nameForErrors() const;
     
    134134        int isValid() const { return buildstatus == valid; }
    135135        int getErrorPosition(bool includingwarnings = false);
    136         ShapeType getShapeType() const { return shape; }
     136        ShapeType getShapeType() const { return shapetype; }
    137137        bool isUsingCheckpoints() const { return using_checkpoints; }
    138138        bool isCheckpoint() const { return is_checkpoint; }
     
    155155
    156156        /// Create empty model with invalid empty genotype, declaring the shape type for later operations
    157         Model(ShapeType sh = SHAPE_UNKNOWN);
     157        Model(ShapeType sh = SHAPETYPE_UNKNOWN);
    158158
    159159        /// Change the declared shape type of the Model
     
    333333
    334334        /** create new Part and add it to the model. @see addPart()  */
    335         Part *addNewPart(Part::Shape shape = Part::SHAPE_BALL_AND_STICK) { return addPart(new Part(shape)); }
     335        Part *addNewPart(Part::Shape shape = Part::SHAPE_BALL) { return addPart(new Part(shape)); }
    336336        /** create new Joint and add it to the model. @see addJoint() */
    337         Joint *addNewJoint(Part *p1 = NULL, Part *p2 = NULL, Joint::Shape shape = Joint::SHAPE_BALL_AND_STICK) { Joint *j = addJoint(new Joint()); j->shape = shape; if ((p1 != NULL) && (p2 != NULL)) j->attachToParts(p1, p2); return j; }
     337        Joint *addNewJoint(Part *p1 = NULL, Part *p2 = NULL, Joint::Shape shape = Joint::SHAPE_STICK) { Joint *j = addJoint(new Joint()); j->shape = shape; if ((p1 != NULL) && (p2 != NULL)) j->attachToParts(p1, p2); return j; }
    338338        /** create new Neuro and add it to the model. @see addNeuro() */
    339339        Neuro *addNewNeuro() { return addNeuro(new Neuro()); }
  • cpp/frams/model/modelobj.cpp

    r972 r999  
    5858void ModelObj::p_newfromstring(ExtValue *args, ExtValue *ret)
    5959{
    60         *ret = makeDynamicObject(new Model(Geno(args[0].getString()), Model::SHAPE_UNKNOWN));
     60        *ret = makeDynamicObject(new Model(Geno(args[0].getString()), Model::SHAPETYPE_UNKNOWN));
    6161}
    6262
     
    6565        Geno *g = GenoObj::fromObject(args[0].getObject());
    6666        if (g)
    67                 *ret = makeDynamicObject(new Model(*g, Model::SHAPE_UNKNOWN));
     67                *ret = makeDynamicObject(new Model(*g, Model::SHAPETYPE_UNKNOWN));
    6868        else
    6969                ret->setEmpty();
     
    7474        Model *m = NULL;
    7575        if (args[0].getType() == TString)
    76                 m = new Model(Geno(args[0].getString()), Model::SHAPE_UNKNOWN, false, true);
     76                m = new Model(Geno(args[0].getString()), Model::SHAPETYPE_UNKNOWN, false, true);
    7777        else
    7878        {
    7979                Geno *g = GenoObj::fromObject(args[0].getObject(), false);
    8080                if (g)
    81                         m = new Model(*g, Model::SHAPE_UNKNOWN, false, true);
     81                        m = new Model(*g, Model::SHAPETYPE_UNKNOWN, false, true);
    8282                else
    8383                        logPrintf("Model", "newWithCheckpoints", LOG_ERROR, "Geno or string expected, %s found", args[0].typeDescription().c_str());
     
    178178void ModelObj::get_solid_model(ExtValue *ret)
    179179{
    180         if (getShapeType() != Model::SHAPE_BALL_AND_STICK)
     180        if (getShapeType() != Model::SHAPETYPE_BALL_AND_STICK)
    181181                ret->setEmpty();
    182182        Model *m = new Model;
  • cpp/frams/model/modelparts.cpp

    r977 r999  
    629629        switch (sh)
    630630        {
    631         case SHAPE_BALL_AND_STICK: return "ball-and-stick";
     631        case SHAPE_BALL: return "ball[-and-stick]";
    632632        case SHAPE_ELLIPSOID: return "ellipsoid";
    633633        case SHAPE_CUBOID: return "cuboid";
     
    727727        switch (sh)
    728728        {
    729         case SHAPE_BALL_AND_STICK: return "ball-and-stick";
     729        case SHAPE_STICK: return "[ball-and-]stick";
    730730        case SHAPE_FIXED: return "fixed";
    731731        case SHAPE_HINGE_X: return "hinge x";
  • cpp/frams/model/modelparts.h

    r997 r999  
    3434{
    3535public:
    36         enum ShapeType { SHAPE_BALL_AND_STICK = 0, SHAPE_SOLIDS = 1, SHAPE_UNKNOWN, SHAPE_ILLEGAL, ///< 0 and 1 have special significance - these values allow for bit operations.
    37                          SHAPE_FIRST = SHAPE_BALL_AND_STICK, SHAPE_LAST = SHAPE_SOLIDS // for iteration
    38         };
     36        enum ShapeType {
     37                SHAPETYPE_BALL_AND_STICK = 0, SHAPETYPE_SOLIDS = 1, SHAPETYPE_UNKNOWN, SHAPETYPE_ILLEGAL, ///< 0 and 1 have special significance - these values allow for bit operations.
     38                SHAPETYPE_FIRST = SHAPETYPE_BALL_AND_STICK, SHAPETYPE_LAST = SHAPETYPE_SOLIDS // for iteration
     39        };
    3940};
    4041
     
    7374};
    7475
    75 /// Part is the only real physical object in the Framsticks creature.
     76/// Part is the only real physical object in creatures in Framsticks.
    7677/// You can use this class for querying and adjusting constructed
    77 /// model properties
     78/// model properties.
    7879class Part : public PartBase
    7980{
     
    9697        ///
    9798        paInt shape;///default=old Framsticks compatible, do not mix with shapes>0
    98         enum Shape { SHAPE_BALL_AND_STICK = 0, SHAPE_ELLIPSOID = 1, SHAPE_CUBOID = 2, SHAPE_CYLINDER = 3,
    99                      SHAPE_FIRST = SHAPE_BALL_AND_STICK, SHAPE_LAST = SHAPE_CYLINDER // for iteration
     99        enum Shape {
     100                SHAPE_BALL = 0, ///<  for "ball and stick" shape type model only.
     101                SHAPE_ELLIPSOID = 1, SHAPE_CUBOID = 2, SHAPE_CYLINDER = 3,
     102                SHAPE_FIRST = SHAPE_BALL, SHAPE_LAST = SHAPE_CYLINDER // for iteration
    100103        };
    101104        static const char* getShapeName(Shape sh);
     
    110113        double vsize;
    111114
    112         Part(enum Shape s = SHAPE_BALL_AND_STICK);
     115        Part(enum Shape s = SHAPE_BALL);
    113116        Part(const Part &src) :PartBase(getDefaultStyle()) { operator=(src); }
    114117        void operator=(const Part &src);
     
    151154        class Pt3D rot; ///< orientation delta between parts expressed as 3 angles
    152155        enum Shape {
    153                 SHAPE_BALL_AND_STICK = 0, ///<  old Framsticks compatible, creates a physical rod between parts (cylinder or cuboid), do not mix with part.shape>0
     156                SHAPE_STICK = 0, ///<  for "ball and stick" shape type model, creates a physical (cylinder or cuboid) rod between parts. Do not mix with part.shape>0.
    154157                SHAPE_FIXED = 1, ///< merge parts into one physical entity
    155158                SHAPE_HINGE_X = 2, ///< hinge connection, revolving around X axis defined by hinge_pos and hinge_rot
    156159                SHAPE_HINGE_XY = 3, ///< double hinge connection, revolving around X and Y axes defined by hinge_pos and hinge_rot
    157                 SHAPE_FIRST = SHAPE_BALL_AND_STICK, SHAPE_LAST = SHAPE_HINGE_XY // for iteration
     160                SHAPE_FIRST = SHAPE_STICK, SHAPE_LAST = SHAPE_HINGE_XY // for iteration
    158161        };
    159162        paInt shape;///< values of type Shape (paInt for integration with Param)
     
    230233        paInt preflocation;
    231234
    232         enum PrefLocation { PREFER_UNATTACHED=0, PREFER_PART=1, PREFER_JOINT=2 };
    233        
    234         static constexpr int SUPPORTED_SHAPE_BALL_AND_STICK = 1;
    235         static constexpr int SUPPORTED_SHAPE_SOLIDS = 2;
    236         static constexpr int SUPPORTED_SHAPE_ALL = SUPPORTED_SHAPE_BALL_AND_STICK | SUPPORTED_SHAPE_SOLIDS;
     235        enum PrefLocation { PREFER_UNATTACHED = 0, PREFER_PART = 1, PREFER_JOINT = 2 };
     236
     237        static constexpr int SUPPORTED_SHAPETYPE_BALL_AND_STICK = 1;
     238        static constexpr int SUPPORTED_SHAPETYPE_SOLIDS = 2;
     239        static constexpr int SUPPORTED_SHAPETYPE_ALL = SUPPORTED_SHAPETYPE_BALL_AND_STICK | SUPPORTED_SHAPETYPE_SOLIDS;
    237240        paInt supported_shape_types; //< bitfield of 'Model::shape' values: NeuroClass::SUPPORTED_SHAPE_xxx = 1 << Model::SHAPE_xxx
    238241
     
    241244        static constexpr int SUPPORTED_JOINT_HINGE_X = 4;
    242245        static constexpr int SUPPORTED_JOINT_HINGE_XY = 8;
    243         static constexpr int SUPPORTED_JOINT_ALL = SUPPORTED_JOINT_BALL_AND_STICK + SUPPORTED_JOINT_FIXED + SUPPORTED_JOINT_HINGE_X + SUPPORTED_JOINT_HINGE_XY;
     246        static constexpr int SUPPORTED_JOINTSHAPE_ALL = SUPPORTED_JOINT_BALL_AND_STICK + SUPPORTED_JOINT_FIXED + SUPPORTED_JOINT_HINGE_X + SUPPORTED_JOINT_HINGE_XY;
    244247        paInt supported_joint_shapes; //< bitfield of 'Joint::shape' values: NeuroClass::SUPPORTED_JOINT_xxx = 1 << JOINT::SHAPE_xxx
    245248
     
    257260        NeuroClass();
    258261        NeuroClass(ParamEntry *_props, SString _description,
    259                    int _prefinputs, int _prefoutput, int _preflocation, int *_vectordata, bool own_vd = 1, int vhints = 0, int sup_shapes = NeuroClass::SUPPORTED_SHAPE_ALL, int sup_joints = NeuroClass::SUPPORTED_JOINT_ALL);
     262                int _prefinputs, int _prefoutput, int _preflocation, int *_vectordata, bool own_vd = 1, int vhints = 0, int sup_shapes = NeuroClass::SUPPORTED_SHAPETYPE_ALL, int sup_joints = NeuroClass::SUPPORTED_JOINTSHAPE_ALL);
    260263        /** class name for use in Neuro::setClassName(), Neuro::setDetails() (former 'moredata' field),
    261264                eg. "N","-",G" */
  • cpp/frams/model/similarity/simil_model.cpp

    r972 r999  
    534534                return NULL;
    535535        }
    536         Model *m = new Model(*g, Model::SHAPE_UNKNOWN);
     536        Model *m = new Model(*g, Model::SHAPETYPE_UNKNOWN);
    537537        if (!m->isValid())
    538538        {
  • cpp/frams/userinput/modelcheckpoints.cpp

    r972 r999  
    4545        freeModel();
    4646        if (g != NULL)
    47                 mod = new Model(*g, Model::SHAPE_UNKNOWN, true, false);
     47                mod = new Model(*g, Model::SHAPETYPE_UNKNOWN, true, false);
    4848        toguiCheckpoints(use_checkpoints ? EnabledUnknown : Disabled, 1, 1);
    4949        int ret = model_view.showModel(mod);
     
    5858        {
    5959                if (p == current_value) return;
    60                 mod_checkpoints = new Model(mod->getGeno(), Model::SHAPE_UNKNOWN, false, true);
     60                mod_checkpoints = new Model(mod->getGeno(), Model::SHAPETYPE_UNKNOWN, false, true);
    6161                if (mod_checkpoints->getCheckpointCount() > 1)
    6262                {
  • cpp/frams/vm/classes/genoobj.cpp

    r988 r999  
    6464void GenoObj::get_autoname(ExtValue *ret)
    6565{
    66         Model m(*this, Model::SHAPE_UNKNOWN);
     66        Model m(*this, Model::SHAPETYPE_UNKNOWN);
    6767        ret->setString(AutoName::makeName(m));
    6868}
Note: See TracChangeset for help on using the changeset viewer.