ansimionescu

Code example - MESH_OT_subdivide

Jun 14th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.43 KB | None | 0 0
  1. blender-svn/blender/source/blender/editors/mesh/editmesh_tools.c
  2.  
  3. void MESH_OT_subdivide(wmOperatorType *ot)
  4. {
  5.     PropertyRNA *prop;
  6.  
  7.     /* identifiers */
  8.     ot->name = "Subdivide";
  9.     ot->description = "Subdivide selected edges";
  10.     ot->idname = "MESH_OT_subdivide";
  11.  
  12.     /* api callbacks */
  13.     ot->exec = edbm_subdivide_exec;
  14.     ot->poll = ED_operator_editmesh;
  15.  
  16.     /* flags */
  17.     ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
  18.  
  19.     /* properties */
  20.     prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
  21.     /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
  22.     RNA_def_property_flag(prop, PROP_SKIP_SAVE);
  23.  
  24.     RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, FLT_MAX, "Smoothness", "Smoothness factor", 0.0f, 1.0f);
  25.  
  26.     RNA_def_boolean(ot->srna, "quadtri", 0, "Quad/Tri Mode", "Tries to prevent ngons");
  27.     RNA_def_enum(ot->srna, "quadcorner", prop_mesh_cornervert_types, SUBD_STRAIGHT_CUT,
  28.                  "Quad Corner Type", "How to subdivide quad corners (anything other than Straight Cut will prevent ngons)");
  29.  
  30.     RNA_def_float(ot->srna, "fractal", 0.0f, 0.0f, FLT_MAX, "Fractal", "Fractal randomness factor", 0.0f, 1000.0f);
  31.     RNA_def_float(ot->srna, "fractal_along_normal", 0.0f, 0.0f, 1.0f, "Along Normal", "Apply fractal displacement along normal only", 0.0f, 1.0f);
  32.     RNA_def_int(ot->srna, "seed", 0, 0, 10000, "Random Seed", "Seed for the random number generator", 0, 50);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment