Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_add.cc
| Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "ED_armature.h" | #include "ED_armature.h" | ||||
| #include "ED_curve.h" | #include "ED_curve.h" | ||||
| #include "ED_curves.h" | |||||
| #include "ED_gpencil.h" | #include "ED_gpencil.h" | ||||
| #include "ED_mball.h" | #include "ED_mball.h" | ||||
| #include "ED_mesh.h" | #include "ED_mesh.h" | ||||
| #include "ED_node.h" | #include "ED_node.h" | ||||
| #include "ED_object.h" | #include "ED_object.h" | ||||
| #include "ED_outliner.h" | #include "ED_outliner.h" | ||||
| #include "ED_physics.h" | #include "ED_physics.h" | ||||
| #include "ED_render.h" | #include "ED_render.h" | ||||
| ▲ Show 20 Lines • Show All 1,790 Lines • ▼ Show 20 Lines | static bool object_hair_curves_add_poll(bContext *C) | ||||
| if (!U.experimental.use_new_curves_type) { | if (!U.experimental.use_new_curves_type) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return ED_operator_objectmode(C); | return ED_operator_objectmode(C); | ||||
| } | } | ||||
| static int object_hair_curves_add_exec(bContext *C, wmOperator *op) | static int object_hair_curves_add_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| using namespace blender; | |||||
| ushort local_view_bits; | ushort local_view_bits; | ||||
| float loc[3], rot[3]; | float loc[3], rot[3]; | ||||
| if (!ED_object_add_generic_get_opts( | if (!ED_object_add_generic_get_opts( | ||||
| C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr)) { | C, op, 'Z', loc, rot, nullptr, nullptr, &local_view_bits, nullptr)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| Object *object = ED_object_add_type(C, OB_CURVES, nullptr, loc, rot, false, local_view_bits); | 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. */ | 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); | |||||
JacquesLucke: Guess now would be a good time to add the move constructor/assignment? | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void OBJECT_OT_hair_curves_add(wmOperatorType *ot) | void OBJECT_OT_hair_curves_add(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Add Hair Curves"; | ot->name = "Add Hair Curves"; | ||||
| ot->description = "Add a hair curves object to the scene"; | ot->description = "Add a hair curves object to the scene"; | ||||
| ▲ Show 20 Lines • Show All 992 Lines • Show Last 20 Lines | |||||
Guess now would be a good time to add the move constructor/assignment?