Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_add.cc
| Show First 20 Lines • Show All 2,038 Lines • ▼ Show 20 Lines | static int object_curves_random_add_exec(bContext *C, wmOperator *op) | ||||
| 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. */ | |||||
| Curves *curves_id = static_cast<Curves *>(object->data); | Curves *curves_id = static_cast<Curves *>(object->data); | ||||
| bke::CurvesGeometry::wrap(curves_id->geometry) = ed::curves::primitive_random_sphere(500, 8); | bke::CurvesGeometry::wrap(curves_id->geometry) = ed::curves::primitive_random_sphere(500, 8); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void OBJECT_OT_curves_random_add(wmOperatorType *ot) | void OBJECT_OT_curves_random_add(wmOperatorType *ot) | ||||
| Show All 20 Lines | static int object_curves_empty_hair_add_exec(bContext *C, wmOperator *op) | ||||
| 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 *surface_ob = CTX_data_active_object(C); | Object *surface_ob = CTX_data_active_object(C); | ||||
| 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. */ | |||||
| if (surface_ob != nullptr && surface_ob->type == OB_MESH) { | if (surface_ob != nullptr && surface_ob->type == OB_MESH) { | ||||
| Curves *curves_id = static_cast<Curves *>(object->data); | Curves *curves_id = static_cast<Curves *>(object->data); | ||||
| curves_id->surface = surface_ob; | curves_id->surface = surface_ob; | ||||
| id_us_plus(&surface_ob->id); | id_us_plus(&surface_ob->id); | ||||
| Mesh *surface_mesh = static_cast<Mesh *>(surface_ob->data); | Mesh *surface_mesh = static_cast<Mesh *>(surface_ob->data); | ||||
| const char *uv_name = CustomData_get_active_layer_name(&surface_mesh->ldata, CD_MLOOPUV); | const char *uv_name = CustomData_get_active_layer_name(&surface_mesh->ldata, CD_MLOOPUV); | ||||
| ▲ Show 20 Lines • Show All 2,126 Lines • Show Last 20 Lines | |||||