53 if (frame_end <= frame_start) {
77 const bool only_selected,
84 if ((adt ==
nullptr) || (adt->
action ==
nullptr)) {
90 for (i = 0, bezt = fcurve->bezt; i < fcurve->totvert; i++, bezt++) {
92 if ((bezt->
f2 &
SELECT) || (!only_selected)) {
94 int key = (int)bezt->
vec[1][0];
110 if (dob->ob->type !=
OB_MESH) {
113 elem = MEM_cnew<GpBakeOb>(__func__);
124 bool simple_material =
false;
128 if (obact ==
nullptr) {
133 elem = MEM_cnew<GpBakeOb>(__func__);
140 simple_material |=
true;
150 elem = MEM_cnew<GpBakeOb>(__func__);
162 return simple_material;
179 ListBase ob_selected_list = {
nullptr,
nullptr};
183 if (ob_selected_list.
first ==
nullptr) {
206 const int frame_offset =
RNA_int_get(op->
ptr,
"frame_target") - frame_start;
212 Object *ob_gpencil =
nullptr;
217 if (ob_gpencil !=
nullptr) {
220 ob_gpencil =
nullptr;
224 ob_gpencil =
nullptr;
229 if (ob_gpencil ==
nullptr) {
231 const float loc[3] = {0.0f, 0.0f, 0.0f};
273 for (
int i = frame_start; i < frame_end + 1; i++) {
276 if ((key % step != 0) && (i != frame_end)) {
312 if (gpf ==
nullptr) {
318 depsgraph, &gsc, sctx, gpl, gpf, gps, project_type,
false);
332 int actcol = ob_gpencil->actcol;
333 for (
int slot = 1; slot <= ob_gpencil->totcol; slot++) {
335 ob_gpencil->actcol = slot;
338 if (actcol >= slot) {
343 ob_gpencil->actcol = actcol;
358 if (sctx !=
nullptr) {
362 if (keyframe_list !=
nullptr) {
395 {0,
nullptr, 0,
nullptr,
nullptr},
401 ot->
name =
"Bake Mesh Animation to Grease Pencil";
402 ot->
idname =
"GPENCIL_OT_bake_mesh_animation";
403 ot->
description =
"Bake mesh animation to grease pencil strokes";
419 "Target grease pencil");
423 ot->
srna,
"frame_start", 1, 1, 100000,
"Start Frame",
"The start frame", 1, 100000);
426 ot->
srna,
"frame_end", 250, 1, 100000,
"End Frame",
"The end frame of animation", 1, 100000);
429 prop =
RNA_def_int(
ot->
srna,
"step", 1, 1, 100,
"Step",
"Step between generated frames", 1, 100);
440 "Threshold to determine ends of the strokes",
451 "Offset strokes from fill",
460 "Only Selected Keyframes",
461 "Convert only selected keyframes");
463 ot->
srna,
"frame_target", 1, 1, 100000,
"Target Frame",
"Destination frame", 1, 100000);
struct AnimData * BKE_animdata_from_id(const struct ID *id)
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
#define CTX_DATA_BEGIN(C, Type, instance, member)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
struct ListBase * object_duplilist(struct Depsgraph *depsgraph, struct Scene *sce, struct Object *ob)
void free_object_duplilist(struct ListBase *lb)
bool BKE_gpencil_convert_mesh(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_gp, struct Object *ob_mesh, float angle, int thickness, float offset, const float matrix[4][4], int frame_offset, bool use_seams, bool use_faces, bool use_vgroups)
struct Object * BKE_view_layer_non_active_selected_object(struct ViewLayer *view_layer, const struct View3D *v3d)
General operations, lookup, etc. for materials.
bool BKE_object_material_slot_remove(struct Main *bmain, struct Object *ob)
bool BKE_object_material_slot_used(struct Object *object, short actcol)
General operations, lookup, etc. for blender objects.
bool BKE_object_obdata_is_libdata(const struct Object *ob)
void BKE_report(ReportList *reports, eReportType type, const char *message)
void BKE_scene_graph_update_for_newframe(struct Depsgraph *depsgraph)
bool BLI_ghash_haskey(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_int_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define POINTER_FROM_INT(i)
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
float DEG_get_ctime(const Depsgraph *graph)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
SnapObjectContext * ED_transform_snap_object_context_create(struct Scene *scene, int flag)
void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx)
Read Guarded memory(de)allocation.
int main(int argc, char *argv[])
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
const Depsgraph * depsgraph
const EnumPropertyItem rna_gpencil_reproject_type_items[]
void gpencil_point_conversion_init(struct bContext *C, GP_SpaceConversion *r_gsc)
static int gpencil_bake_mesh_animation_exec(bContext *C, wmOperator *op)
static void gpencil_bake_free_ob_list(ListBase *list)
static bool gpencil_bake_mesh_animation_poll(bContext *C)
static void animdata_keyframe_list_get(ListBase *ob_list, const bool only_selected, GHash *r_keyframes)
static void gpencil_bake_set_frame_end(struct Main *UNUSED(main), struct Scene *UNUSED(scene), struct PointerRNA *ptr)
static int gpencil_bake_mesh_animation_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
void GPENCIL_OT_bake_mesh_animation(wmOperatorType *ot)
static void gpencil_bake_duplilist(Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *list)
static bool gpencil_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene, ListBase *list)
Object * ED_gpencil_add_object(bContext *C, const float loc[3], ushort local_view_bits)
void ED_gpencil_stroke_reproject(Depsgraph *depsgraph, const GP_SpaceConversion *gsc, SnapObjectContext *sctx, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps, const eGP_ReprojectModes mode, const bool keep_original)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
static void area(int d1, int d2, int e1, int e2, float weights[2])
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
int RNA_int_get(PointerRNA *ptr, const char *name)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
PropertyRNA * RNA_def_float_distance(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_update_runtime(PropertyRNA *prop, const void *func)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
PropertyRNA * RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
unsigned short local_view_uuid
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_cursor_wait(bool val)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width)