Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_add.cc
| Show First 20 Lines • Show All 2,080 Lines • ▼ Show 20 Lines | static int object_curves_empty_hair_add_exec(bContext *C, wmOperator *op) | ||||
| 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. */ | ||||
| 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); | |||||
| const char *uv_name = CustomData_get_active_layer_name(&surface_mesh->ldata, CD_MLOOPUV); | |||||
| if (uv_name != nullptr) { | |||||
| curves_id->surface_uv_map = BLI_strdup(uv_name); | |||||
| } | |||||
| } | } | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static bool object_curves_empty_hair_add_poll(bContext *C) | static bool object_curves_empty_hair_add_poll(bContext *C) | ||||
| { | { | ||||
| if (!U.experimental.use_new_curves_type) { | if (!U.experimental.use_new_curves_type) { | ||||
| ▲ Show 20 Lines • Show All 2,081 Lines • Show Last 20 Lines | |||||