Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/object.c
| Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_constraint.h" | #include "BKE_constraint.h" | ||||
| #include "BKE_curve.h" | #include "BKE_curve.h" | ||||
| #include "BKE_displist.h" | #include "BKE_displist.h" | ||||
| #include "BKE_effect.h" | #include "BKE_effect.h" | ||||
| #include "BKE_font.h" | #include "BKE_font.h" | ||||
| #include "BKE_fcurve.h" | #include "BKE_fcurve.h" | ||||
| #include "BKE_gpencil_modifier.h" | #include "BKE_gpencil_modifier.h" | ||||
| #include "BKE_icons.h" | #include "BKE_icons.h" | ||||
| #include "BKE_idtype.h" | |||||
| #include "BKE_key.h" | #include "BKE_key.h" | ||||
| #include "BKE_light.h" | #include "BKE_light.h" | ||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_lattice.h" | #include "BKE_lattice.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| #include "BKE_lib_query.h" | #include "BKE_lib_query.h" | ||||
| #include "BKE_lib_remap.h" | #include "BKE_lib_remap.h" | ||||
| #include "BKE_linestyle.h" | #include "BKE_linestyle.h" | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
| * - sergey - | * - sergey - | ||||
| */ | */ | ||||
| #define VPARENT_THREADING_HACK | #define VPARENT_THREADING_HACK | ||||
| #ifdef VPARENT_THREADING_HACK | #ifdef VPARENT_THREADING_HACK | ||||
| static ThreadMutex vparent_lock = BLI_MUTEX_INITIALIZER; | static ThreadMutex vparent_lock = BLI_MUTEX_INITIALIZER; | ||||
| #endif | #endif | ||||
| static void object_init_data(ID *id) | |||||
| { | |||||
| Object *ob = (Object *)id; | |||||
| BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(ob, id)); | |||||
| MEMCPY_STRUCT_AFTER(ob, DNA_struct_default_get(Object), id); | |||||
| ob->type = OB_EMPTY; | |||||
| ob->trackflag = OB_POSY; | |||||
| ob->upflag = OB_POSZ; | |||||
| /* Animation Visualization defaults */ | |||||
| animviz_settings_init(&ob->avs); | |||||
| } | |||||
| IDTypeInfo IDType_ID_OB = { | |||||
| .id_code = ID_OB, | |||||
| .id_filter = FILTER_ID_OB, | |||||
| .main_listbase_index = INDEX_ID_OB, | |||||
| .struct_size = sizeof(Object), | |||||
| .name = "Object", | |||||
| .name_plural = "objects", | |||||
| .translation_context = BLT_I18NCONTEXT_ID_ACTION, | |||||
brecht: `ACTION` -> `OBJECT`? | |||||
mont29AuthorUnsubmitted Done Inline ActionsEeek, yes indeed, thanks! mont29: Eeek, yes indeed, thanks! | |||||
| .flags = IDTYPE_FLAGS_IS_LINKABLE, | |||||
| .init_data = object_init_data, | |||||
| }; | |||||
| void BKE_object_workob_clear(Object *workob) | void BKE_object_workob_clear(Object *workob) | ||||
| { | { | ||||
| memset(workob, 0, sizeof(Object)); | memset(workob, 0, sizeof(Object)); | ||||
| workob->scale[0] = workob->scale[1] = workob->scale[2] = 1.0f; | workob->scale[0] = workob->scale[1] = workob->scale[2] = 1.0f; | ||||
| workob->dscale[0] = workob->dscale[1] = workob->dscale[2] = 1.0f; | workob->dscale[0] = workob->dscale[1] = workob->dscale[2] = 1.0f; | ||||
| workob->rotmode = ROT_MODE_EUL; | workob->rotmode = ROT_MODE_EUL; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 712 Lines • ▼ Show 20 Lines | switch (type) { | ||||
| default: | default: | ||||
| CLOG_ERROR(&LOG, "Internal error, bad type: %d", type); | CLOG_ERROR(&LOG, "Internal error, bad type: %d", type); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| } | } | ||||
| void BKE_object_init(Object *ob, const short ob_type) | void BKE_object_init(Object *ob, const short ob_type) | ||||
| { | { | ||||
| BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(ob, id)); | object_init_data(&ob->id); | ||||
| MEMCPY_STRUCT_AFTER(ob, DNA_struct_default_get(Object), id); | |||||
| ob->type = ob_type; | ob->type = ob_type; | ||||
| if (ob->type != OB_EMPTY) { | if (ob->type != OB_EMPTY) { | ||||
| zero_v2(ob->ima_ofs); | zero_v2(ob->ima_ofs); | ||||
| } | } | ||||
| if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) { | if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) { | ||||
| ob->trackflag = OB_NEGZ; | ob->trackflag = OB_NEGZ; | ||||
| ob->upflag = OB_POSY; | ob->upflag = OB_POSY; | ||||
| } | } | ||||
| else { | |||||
| ob->trackflag = OB_POSY; | |||||
| ob->upflag = OB_POSZ; | |||||
| } | |||||
| /* Animation Visualization defaults */ | |||||
| animviz_settings_init(&ob->avs); | |||||
| } | } | ||||
| /* more general add: creates minimum required data, but without vertices etc. */ | /* more general add: creates minimum required data, but without vertices etc. */ | ||||
| Object *BKE_object_add_only_object(Main *bmain, int type, const char *name) | Object *BKE_object_add_only_object(Main *bmain, int type, const char *name) | ||||
| { | { | ||||
| Object *ob; | Object *ob; | ||||
| if (!name) { | if (!name) { | ||||
| ▲ Show 20 Lines • Show All 3,588 Lines • Show Last 20 Lines | |||||
ACTION -> OBJECT?