Changeset 999
- Timestamp:
- 07/13/20 13:51:43 (4 years ago)
- Location:
- cpp/frams
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/_demos/f0_variants_test.cpp
r986 r999 98 98 g.getFormat().c_str(), g.getComment().c_str()); 99 99 100 Model m(g, Model::SHAPE _UNKNOWN);//.getConverted('0'));100 Model m(g, Model::SHAPETYPE_UNKNOWN);//.getConverted('0')); 101 101 102 102 if (!m.isValid()) -
cpp/frams/_demos/full_props.cpp
r972 r999 75 75 loadSString(VirtFILE::Vstdin, gen); 76 76 Geno g(gen); 77 Model m(g, Model::SHAPE _UNKNOWN);77 Model m(g, Model::SHAPETYPE_UNKNOWN); 78 78 79 79 if (!m.isValid()) -
cpp/frams/_demos/genoconv_test.cpp
r994 r999 212 212 if (using_checkpoints) 213 213 { // using Model with checkpoints 214 Model m1(g2, Model::SHAPE _UNKNOWN, false, true);//true=using_checkpoints214 Model m1(g2, Model::SHAPETYPE_UNKNOWN, false, true);//true=using_checkpoints 215 215 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_checkpoints216 Model m2(g1, Model::SHAPETYPE_UNKNOWN, false, true);//true=using_checkpoints 217 217 printf("Model built from the source f%s genotype has %d checkpoints\n", g1.getFormat().c_str(), m2.getCheckpointCount()); 218 218 // accessing individual checkpoint models (if available) … … 240 240 } 241 241 242 Model mod1(g1, Model::SHAPE _UNKNOWN, 1);242 Model mod1(g1, Model::SHAPETYPE_UNKNOWN, 1); 243 243 printf("\nModel map for f%s genotype:\n", g1.getFormat().c_str()); 244 244 ModelDisplayMap dm1(mod1); … … 247 247 mod1combined.addCombined(mod1.getMap(), dm1.getMap()); 248 248 mod1combined.print(); 249 Model mod2(g2, Model::SHAPE _UNKNOWN, 1);249 Model mod2(g2, Model::SHAPETYPE_UNKNOWN, 1); 250 250 printf("\nModel map for f%s genotype:\n", g2.getFormat().c_str()); 251 251 ModelDisplayMap dm2(mod2); -
cpp/frams/_demos/genomanipulation.cpp
r990 r999 196 196 printf(cl->getPreferredOutput() ? "and provides meaningful output signal (getPreferredOutput()==1).\n" : "and doesn't provide useful output signal (getPreferredOutput()==0).\n"); 197 197 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) 199 199 printf("any shape types.\n"); 200 200 else 201 201 { 202 202 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++) 204 204 if (cl->isShapeTypeSupported((Model::ShapeType)i)) 205 205 printf(" '%s'", Model::getShapeTypeName((Model::ShapeType)i)); … … 209 209 { 210 210 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) 212 212 printf("any shapes"); 213 213 else … … 311 311 g.getFormat().c_str(), g.getComment().c_str()); 312 312 313 Model m(g, Model::SHAPE _UNKNOWN);//.getConverted('0'));313 Model m(g, Model::SHAPETYPE_UNKNOWN);//.getConverted('0')); 314 314 315 315 if (!m.isValid()) -
cpp/frams/_demos/geometry/geometrytestutils.cpp
r972 r999 63 63 if ((genoIndex == count) || (strcmp(genotype->name.c_str(), genoName) == 0)) 64 64 { 65 Model model(genotype->genotype, Model::SHAPE _UNKNOWN);65 Model model(genotype->genotype, Model::SHAPETYPE_UNKNOWN); 66 66 67 67 if (!model.isValid()) -
cpp/frams/_demos/multiline_f0_test.cpp
r986 r999 30 30 g.getFormat().c_str(), g.getComment().c_str()); 31 31 32 Model m(g, Model::SHAPE _UNKNOWN);//.getConverted('0'));32 Model m(g, Model::SHAPETYPE_UNKNOWN);//.getConverted('0')); 33 33 34 34 if (!m.isValid()) -
cpp/frams/_demos/neuro_layout_test.cpp
r972 r999 104 104 Geno g(gen); 105 105 if (!g.isValid()) { puts("invalid genotype"); return 5; } 106 Model m(g, Model::SHAPE _UNKNOWN);106 Model m(g, Model::SHAPETYPE_UNKNOWN); 107 107 if (!m.getNeuroCount()) { puts("no neural network"); return 1; } 108 108 printf("%d neurons,", m.getNeuroCount()); -
cpp/frams/_demos/neuro_test.cpp
r972 r999 77 77 Geno g(gen); 78 78 if (!g.isValid()) { puts("invalid genotype"); return 5; } 79 Model m(g, Model::SHAPE _UNKNOWN);79 Model m(g, Model::SHAPETYPE_UNKNOWN); 80 80 if (!m.getNeuroCount()) { puts("no neural network"); return 1; } 81 81 printf("%d neurons,", m.getNeuroCount()); -
cpp/frams/_demos/shapeconvert.cpp
r972 r999 67 67 loadSString(VirtFILE::Vstdin, gen); 68 68 Geno g(gen); 69 Model m(g, Model::SHAPE _UNKNOWN);69 Model m(g, Model::SHAPETYPE_UNKNOWN); 70 70 71 71 if (!m.isValid()) … … 75 75 } 76 76 77 if (m.getShapeType() != Model::SHAPE _BALL_AND_STICK)77 if (m.getShapeType() != Model::SHAPETYPE_BALL_AND_STICK) 78 78 { 79 79 logPrintf("", "shapeconvert", LOG_ERROR, "Only ball-and-stick models can be converted"); -
cpp/frams/genetics/f4/f4_oper.cpp
r974 r999 164 164 { 165 165 // make neuron 166 NeuroClass *rndclass = GenoOperators::getRandomNeuroClass(Model::SHAPE _BALL_AND_STICK);166 NeuroClass *rndclass = GenoOperators::getRandomNeuroClass(Model::SHAPETYPE_BALL_AND_STICK); 167 167 if (rndclass == NULL) 168 168 { … … 434 434 { 435 435 // '*', '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); 437 437 } 438 438 if (nc != NULL) … … 470 470 if (rndDouble(1) < 0.2f) 471 471 { 472 cl = GenoOperators::getRandomNeuroClassWithOutputAndNoInputs(Model::SHAPE _BALL_AND_STICK);472 cl = GenoOperators::getRandomNeuroClassWithOutputAndNoInputs(Model::SHAPETYPE_BALL_AND_STICK); 473 473 if (cl != NULL) 474 474 { -
cpp/frams/genetics/fB/fB_oper.cpp
r974 r999 287 287 int rndid = rndUint(tokenized.size()); // select random insertion point 288 288 std::advance(it, rndid); 289 NeuroClass *cls = getRandomNeuroClass(Model::SHAPE _BALL_AND_STICK);289 NeuroClass *cls = getRandomNeuroClass(Model::SHAPETYPE_BALL_AND_STICK); 290 290 if (cls) 291 291 { -
cpp/frams/genetics/fH/fH_oper.cpp
r974 r999 255 255 fH_Handle *handle = NULL; 256 256 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; 258 258 switch (method - FH_OPCOUNT) 259 259 { … … 440 440 if (userandomclass) 441 441 { 442 NeuroClass *nc = getRandomNeuroClass(Model::SHAPE _BALL_AND_STICK); // checking that neuron classes are available should be done before442 NeuroClass *nc = getRandomNeuroClass(Model::SHAPETYPE_BALL_AND_STICK); // checking that neuron classes are available should be done before 443 443 det = nc->getName(); 444 444 } -
cpp/frams/genetics/fL/fL_oper.cpp
r974 r999 141 141 { 142 142 SString det; 143 NeuroClass *cls = getRandomNeuroClass(Model::SHAPE _BALL_AND_STICK);143 NeuroClass *cls = getRandomNeuroClass(Model::SHAPETYPE_BALL_AND_STICK); 144 144 det = cls->getName(); 145 145 Geno_fH::mutateNeuronProperties(det); … … 201 201 return creature->words["S"]; 202 202 case FL_ADD_NEURO: 203 if (getActiveNeuroClassCount(Model::SHAPE _BALL_AND_STICK) == 0)203 if (getActiveNeuroClassCount(Model::SHAPETYPE_BALL_AND_STICK) == 0) 204 204 return creature->words["S"]; 205 205 else -
cpp/frams/genetics/geno.cpp
r988 r999 260 260 if (Geno::formatIsOneOf(g.getFormat(), Geno::F0_FORMAT_LIST)) 261 261 { 262 Model mod(g, Model::SHAPE _UNKNOWN);262 Model mod(g, Model::SHAPETYPE_UNKNOWN); 263 263 return mod.isValid(); 264 264 } -
cpp/frams/genetics/genoconv.h
r988 r999 34 34 35 35 /// 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. 38 37 /// 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. 41 39 class GenoConverter 42 40 { 43 41 public: 44 42 const char *name; //< converter name (short) 45 SString in_format, //< input format, e g. "1"46 out_format; //< output format, e g. "0"43 SString in_format, //< input format, e.g. "1" 44 out_format; //< output format, e.g. "0" 47 45 paInt enabled; //< don't touch this! (used by configuration module) 48 46 paInt mapsupport; //< set to 1 if your converter supports genotype mapping -
cpp/frams/model/geometry/modelgeoclass.cpp
r661 r999 74 74 if (m != NULL) 75 75 { 76 if (m->getShapeType() == Model::SHAPE _BALL_AND_STICK)76 if (m->getShapeType() == Model::SHAPETYPE_BALL_AND_STICK) 77 77 { 78 78 Model *converted = new Model; -
cpp/frams/model/model.cpp
r988 r999 17 17 } 18 18 19 void Model::init(ShapeType sh )19 void Model::init(ShapeType shtype) 20 20 { 21 21 partmappingchanged = 0; … … 29 29 f0map = 0; 30 30 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 35 void Model::declareShapeType(ShapeType shtype) 36 { 37 declared_shapetype = shtype; 38 38 } 39 39 … … 56 56 geno = mod.geno; 57 57 f0genoknown = 0; 58 shape = mod.shape;59 declared_shape = mod.declared_shape;58 shapetype = mod.shapetype; 59 declared_shapetype = mod.declared_shapetype; 60 60 startenergy = mod.startenergy; 61 61 modelfromgenotype = mod.modelfromgenotype; … … 117 117 :autobuildmaps(buildmaps) 118 118 { 119 init(mod.declared_shape );119 init(mod.declared_shapetype); 120 120 open(_using_checkpoints, _is_checkpoint); 121 121 internalCopy(mod); … … 169 169 delMap(); 170 170 delF0Map(); 171 init(declared_shape );171 init(declared_shapetype); 172 172 geno = Geno(); 173 173 f0geno = Geno(); … … 340 340 f0warnposition = -1; 341 341 MultiMap *convmap = autobuildmaps ? new MultiMap() : NULL; 342 if (declared_shape == SHAPE_UNKNOWN)342 if (declared_shapetype == SHAPETYPE_UNKNOWN) 343 343 f0geno = geno.getConverted(Geno::F0_FORMAT_LIST, convmap, using_checkpoints); 344 344 else 345 f0geno = geno.getConverted(genoFormatForShapeType(declared_shape ), convmap, using_checkpoints);345 f0geno = geno.getConverted(genoFormatForShapeType(declared_shapetype), convmap, using_checkpoints); 346 346 f0genoknown = 1; 347 347 if (f0geno.isInvalid()) … … 351 351 return; 352 352 } 353 if (declared_shape == SHAPE_UNKNOWN)353 if (declared_shapetype == SHAPETYPE_UNKNOWN) 354 354 declareShapeType(shapeTypeForGenoFormat(f0geno.getFormat())); 355 355 SString f0txt = f0geno.getGenes(); … … 560 560 switch (st) 561 561 { 562 case SHAPE _BALL_AND_STICK:562 case SHAPETYPE_BALL_AND_STICK: 563 563 return "0"; 564 case SHAPE _SOLIDS:564 case SHAPETYPE_SOLIDS: 565 565 return "0s"; 566 566 default: … … 572 572 { 573 573 if (format == "0") 574 return SHAPE _BALL_AND_STICK;574 return SHAPETYPE_BALL_AND_STICK; 575 575 else if (format == "0s") 576 return SHAPE _SOLIDS;576 return SHAPETYPE_SOLIDS; 577 577 else 578 return SHAPE _UNKNOWN;578 return SHAPETYPE_UNKNOWN; 579 579 580 580 } … … 584 584 switch (sh) 585 585 { 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: 591 591 default: 592 592 return "illegal"; … … 894 894 int i, k; 895 895 int ret = 1; 896 shape = SHAPE_UNKNOWN;896 shapetype = SHAPETYPE_UNKNOWN; 897 897 updateRefno(); 898 898 if ((parts.size() == 0) && (neurons.size() == 0)) return 0; … … 931 931 if (p->p.y + p->size > bbmax.y) bbmax.y = p->p.y + p->size; 932 932 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) 936 936 { 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)) 938 938 { 939 shape = SHAPE_ILLEGAL;939 shapetype = SHAPETYPE_ILLEGAL; 940 940 logPrintf("Model", "internalCheck", LOG_WARN, "Inconsistent part shapes (mixed ball-and-stick and solids shape types)%s", nameForErrors().c_str()); 941 941 } … … 1002 1002 if ((check != LIVE_CHECK) && (check != CHECKPOINT_CHECK)) 1003 1003 { 1004 if (j->shape == Joint::SHAPE_ BALL_AND_STICK)1004 if (j->shape == Joint::SHAPE_STICK) 1005 1005 { 1006 1006 if (j->d() > getMaxJoint().d.x) … … 1017 1017 ret = 0; 1018 1018 } 1019 if (shape != SHAPE_ILLEGAL)1019 if (shapetype != SHAPETYPE_ILLEGAL) 1020 1020 { 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)) 1022 1022 { 1023 shape = SHAPE_ILLEGAL;1023 shapetype = SHAPETYPE_ILLEGAL; 1024 1024 logPrintf("Model", "internalCheck", LOG_WARN, "Inconsistent joint shapes (mixed old and new shapes)%s", nameForErrors().c_str()); 1025 1025 } … … 1109 1109 } 1110 1110 1111 if (shape == SHAPE_ILLEGAL)1111 if (shapetype == SHAPETYPE_ILLEGAL) 1112 1112 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)); 1116 1116 ret = 0; 1117 1117 } … … 1335 1335 { 1336 1336 using_model = converted_model = NULL; 1337 if (m.getShapeType() == Model::SHAPE _BALL_AND_STICK)1337 if (m.getShapeType() == Model::SHAPETYPE_BALL_AND_STICK) 1338 1338 { 1339 1339 converted_model = new Model; -
cpp/frams/model/model.h
r972 r999 101 101 }; 102 102 protected: 103 ShapeType shape ;104 ShapeType declared_shape ;103 ShapeType shapetype; 104 ShapeType declared_shapetype; 105 105 106 106 SString nameForErrors() const; … … 134 134 int isValid() const { return buildstatus == valid; } 135 135 int getErrorPosition(bool includingwarnings = false); 136 ShapeType getShapeType() const { return shape ; }136 ShapeType getShapeType() const { return shapetype; } 137 137 bool isUsingCheckpoints() const { return using_checkpoints; } 138 138 bool isCheckpoint() const { return is_checkpoint; } … … 155 155 156 156 /// 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); 158 158 159 159 /// Change the declared shape type of the Model … … 333 333 334 334 /** 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)); } 336 336 /** 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; } 338 338 /** create new Neuro and add it to the model. @see addNeuro() */ 339 339 Neuro *addNewNeuro() { return addNeuro(new Neuro()); } -
cpp/frams/model/modelobj.cpp
r972 r999 58 58 void ModelObj::p_newfromstring(ExtValue *args, ExtValue *ret) 59 59 { 60 *ret = makeDynamicObject(new Model(Geno(args[0].getString()), Model::SHAPE _UNKNOWN));60 *ret = makeDynamicObject(new Model(Geno(args[0].getString()), Model::SHAPETYPE_UNKNOWN)); 61 61 } 62 62 … … 65 65 Geno *g = GenoObj::fromObject(args[0].getObject()); 66 66 if (g) 67 *ret = makeDynamicObject(new Model(*g, Model::SHAPE _UNKNOWN));67 *ret = makeDynamicObject(new Model(*g, Model::SHAPETYPE_UNKNOWN)); 68 68 else 69 69 ret->setEmpty(); … … 74 74 Model *m = NULL; 75 75 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); 77 77 else 78 78 { 79 79 Geno *g = GenoObj::fromObject(args[0].getObject(), false); 80 80 if (g) 81 m = new Model(*g, Model::SHAPE _UNKNOWN, false, true);81 m = new Model(*g, Model::SHAPETYPE_UNKNOWN, false, true); 82 82 else 83 83 logPrintf("Model", "newWithCheckpoints", LOG_ERROR, "Geno or string expected, %s found", args[0].typeDescription().c_str()); … … 178 178 void ModelObj::get_solid_model(ExtValue *ret) 179 179 { 180 if (getShapeType() != Model::SHAPE _BALL_AND_STICK)180 if (getShapeType() != Model::SHAPETYPE_BALL_AND_STICK) 181 181 ret->setEmpty(); 182 182 Model *m = new Model; -
cpp/frams/model/modelparts.cpp
r977 r999 629 629 switch (sh) 630 630 { 631 case SHAPE_BALL _AND_STICK: return "ball-and-stick";631 case SHAPE_BALL: return "ball[-and-stick]"; 632 632 case SHAPE_ELLIPSOID: return "ellipsoid"; 633 633 case SHAPE_CUBOID: return "cuboid"; … … 727 727 switch (sh) 728 728 { 729 case SHAPE_ BALL_AND_STICK: return "ball-and-stick";729 case SHAPE_STICK: return "[ball-and-]stick"; 730 730 case SHAPE_FIXED: return "fixed"; 731 731 case SHAPE_HINGE_X: return "hinge x"; -
cpp/frams/model/modelparts.h
r997 r999 34 34 { 35 35 public: 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 }; 39 40 }; 40 41 … … 73 74 }; 74 75 75 /// Part is the only real physical object in the Framsticks creature.76 /// Part is the only real physical object in creatures in Framsticks. 76 77 /// You can use this class for querying and adjusting constructed 77 /// model properties 78 /// model properties. 78 79 class Part : public PartBase 79 80 { … … 96 97 /// 97 98 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 100 103 }; 101 104 static const char* getShapeName(Shape sh); … … 110 113 double vsize; 111 114 112 Part(enum Shape s = SHAPE_BALL _AND_STICK);115 Part(enum Shape s = SHAPE_BALL); 113 116 Part(const Part &src) :PartBase(getDefaultStyle()) { operator=(src); } 114 117 void operator=(const Part &src); … … 151 154 class Pt3D rot; ///< orientation delta between parts expressed as 3 angles 152 155 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>0156 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. 154 157 SHAPE_FIXED = 1, ///< merge parts into one physical entity 155 158 SHAPE_HINGE_X = 2, ///< hinge connection, revolving around X axis defined by hinge_pos and hinge_rot 156 159 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 iteration160 SHAPE_FIRST = SHAPE_STICK, SHAPE_LAST = SHAPE_HINGE_XY // for iteration 158 161 }; 159 162 paInt shape;///< values of type Shape (paInt for integration with Param) … … 230 233 paInt preflocation; 231 234 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; 237 240 paInt supported_shape_types; //< bitfield of 'Model::shape' values: NeuroClass::SUPPORTED_SHAPE_xxx = 1 << Model::SHAPE_xxx 238 241 … … 241 244 static constexpr int SUPPORTED_JOINT_HINGE_X = 4; 242 245 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; 244 247 paInt supported_joint_shapes; //< bitfield of 'Joint::shape' values: NeuroClass::SUPPORTED_JOINT_xxx = 1 << JOINT::SHAPE_xxx 245 248 … … 257 260 NeuroClass(); 258 261 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); 260 263 /** class name for use in Neuro::setClassName(), Neuro::setDetails() (former 'moredata' field), 261 264 eg. "N","-",G" */ -
cpp/frams/model/similarity/simil_model.cpp
r972 r999 534 534 return NULL; 535 535 } 536 Model *m = new Model(*g, Model::SHAPE _UNKNOWN);536 Model *m = new Model(*g, Model::SHAPETYPE_UNKNOWN); 537 537 if (!m->isValid()) 538 538 { -
cpp/frams/userinput/modelcheckpoints.cpp
r972 r999 45 45 freeModel(); 46 46 if (g != NULL) 47 mod = new Model(*g, Model::SHAPE _UNKNOWN, true, false);47 mod = new Model(*g, Model::SHAPETYPE_UNKNOWN, true, false); 48 48 toguiCheckpoints(use_checkpoints ? EnabledUnknown : Disabled, 1, 1); 49 49 int ret = model_view.showModel(mod); … … 58 58 { 59 59 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); 61 61 if (mod_checkpoints->getCheckpointCount() > 1) 62 62 { -
cpp/frams/vm/classes/genoobj.cpp
r988 r999 64 64 void GenoObj::get_autoname(ExtValue *ret) 65 65 { 66 Model m(*this, Model::SHAPE _UNKNOWN);66 Model m(*this, Model::SHAPETYPE_UNKNOWN); 67 67 ret->setString(AutoName::makeName(m)); 68 68 }
Note: See TracChangeset
for help on using the changeset viewer.