Changeset View
Changeset View
Standalone View
Standalone View
source/blender/io/gpencil/intern/gpencil_io_base.cc
| Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | GpencilIO::GpencilIO(const GpencilIOParams *iparams) | ||||
| else { | else { | ||||
| is_camera_ = false; | is_camera_ = false; | ||||
| is_ortho_ = false; | is_ortho_ = false; | ||||
| /* Calc selected object boundbox. Need set initial value to some variables. */ | /* Calc selected object boundbox. Need set initial value to some variables. */ | ||||
| camera_ratio_ = 1.0f; | camera_ratio_ = 1.0f; | ||||
| offset_.x = 0.0f; | offset_.x = 0.0f; | ||||
| offset_.y = 0.0f; | offset_.y = 0.0f; | ||||
| create_object_list(); | |||||
| selected_objects_boundbox_calc(); | selected_objects_boundbox_calc(); | ||||
| rctf boundbox; | rctf boundbox; | ||||
| selected_objects_boundbox_get(&boundbox); | selected_objects_boundbox_get(&boundbox); | ||||
| render_x_ = boundbox.xmax - boundbox.xmin; | render_x_ = boundbox.xmax - boundbox.xmin; | ||||
| render_y_ = boundbox.ymax - boundbox.ymin; | render_y_ = boundbox.ymax - boundbox.ymin; | ||||
| offset_.x = boundbox.xmin; | offset_.x = boundbox.xmin; | ||||
| offset_.y = boundbox.ymin; | offset_.y = boundbox.ymin; | ||||
| ▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void GpencilIO::prepare_stroke_export_colors(Object *ob, bGPDstroke *gps) | void GpencilIO::prepare_stroke_export_colors(Object *ob, bGPDstroke *gps) | ||||
| { | { | ||||
| MaterialGPencilStyle *gp_style = BKE_gpencil_material_settings(ob, gps->mat_nr + 1); | MaterialGPencilStyle *gp_style = BKE_gpencil_material_settings(ob, gps->mat_nr + 1); | ||||
| /* Stroke color. */ | /* Stroke color. */ | ||||
| copy_v4_v4(stroke_color_, gp_style->stroke_rgba); | copy_v4_v4(stroke_color_, gp_style->stroke_rgba); | ||||
| avg_opacity_ = 0; | avg_opacity_ = 0.0f; | ||||
| /* Get average vertex color and apply. */ | /* Get average vertex color and apply. */ | ||||
| float avg_color[4] = {0.0f, 0.0f, 0.0f, 0.0f}; | float avg_color[4] = {0.0f, 0.0f, 0.0f, 0.0f}; | ||||
| for (const bGPDspoint &pt : Span(gps->points, gps->totpoints)) { | for (const bGPDspoint &pt : Span(gps->points, gps->totpoints)) { | ||||
| add_v4_v4(avg_color, pt.vert_color); | add_v4_v4(avg_color, pt.vert_color); | ||||
| avg_opacity_ += pt.strength; | avg_opacity_ += pt.strength; | ||||
| } | } | ||||
| mul_v4_v4fl(avg_color, avg_color, 1.0f / (float)gps->totpoints); | mul_v4_v4fl(avg_color, avg_color, 1.0f / (float)gps->totpoints); | ||||
| ▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines | |||||