diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-01 19:40:25 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-01 19:40:25 +0300 |
commit | f98d74c80de7b1cae1e5a963f33c51c49f478ba1 (patch) | |
tree | 5144a2249410c0128d7e2780cb39e56aa5181ab2 /source/blender/editors/object | |
parent | 143bc9f8d4baf2a7312f3e836a464f74148c4a3b (diff) |
Curves: Move curves primitive to object add code
Currently, any time a Curves data-block is created, the `curves_random`
function runs, filling it with 500 random curves, also adding a radius
attribute. This is just left over from the prototype in the initial
commit that added the type.
This commit moves the code that creates the random data to the curve
editors module, like the other primitives are organized.
Differential Revision: https://developer.blender.org/D14211
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.cc | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index a94387961ee..39ccadd1445 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -8,6 +8,7 @@ set(INC ../../blentranslation ../../bmesh ../../depsgraph + ../../functions ../../gpencil_modifiers ../../gpu ../../ikplugin diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index 19db09961e8..7befad3b8d7 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -93,6 +93,7 @@ #include "ED_armature.h" #include "ED_curve.h" +#include "ED_curves.h" #include "ED_gpencil.h" #include "ED_mball.h" #include "ED_mesh.h" @@ -1899,6 +1900,8 @@ static bool object_hair_curves_add_poll(bContext *C) static int object_hair_curves_add_exec(bContext *C, wmOperator *op) { + using namespace blender; + ushort local_view_bits; float loc[3], rot[3]; if (!ED_object_add_generic_get_opts( @@ -1909,6 +1912,9 @@ static int object_hair_curves_add_exec(bContext *C, wmOperator *op) Object *object = ED_object_add_type(C, OB_CURVES, nullptr, loc, rot, false, local_view_bits); object->dtx |= OB_DRAWBOUNDOX; /* TODO: remove once there is actual drawing. */ + Curves *curves_id = static_cast<Curves *>(object->data); + bke::CurvesGeometry::wrap(curves_id->geometry) = ed::curves::primitive_random_sphere(500, 8); + return OPERATOR_FINISHED; } |