LineArt: conversion code from v2 to v3 #118791
|
@ -29,8 +29,6 @@ struct Depsgraph;
|
|||
struct Scene;
|
||||
struct Object;
|
||||
struct Material;
|
||||
struct LineartGpencilModifierData;
|
||||
struct GreasePencilLineartModifierData;
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
|
@ -892,8 +890,3 @@ void BKE_grease_pencil_material_index_remove(GreasePencil *grease_pencil, int in
|
|||
bool BKE_grease_pencil_references_cyclic_check(const GreasePencil *id_reference,
|
||||
const GreasePencil *grease_pencil);
|
||||
bool BKE_grease_pencil_material_index_used(GreasePencil *grease_pencil, int index);
|
||||
|
||||
void BKE_grease_pencil_lineart_wrap_v3(const LineartGpencilModifierData *lmd_legacy,
|
||||
GreasePencilLineartModifierData *lmd);
|
||||
void BKE_grease_pencil_lineart_unwrap_v3(LineartGpencilModifierData *lmd_legacy,
|
||||
const GreasePencilLineartModifierData *lmd);
|
||||
|
|
|
@ -15,6 +15,8 @@ struct GreasePencilDrawing;
|
|||
struct ListBase;
|
||||
struct Main;
|
||||
struct Object;
|
||||
struct LineartGpencilModifierData;
|
||||
struct GreasePencilLineartModifierData;
|
||||
|
||||
namespace blender::bke::greasepencil::convert {
|
||||
|
||||
|
@ -30,4 +32,9 @@ void layer_adjustments_to_modifiers(Main &bmain,
|
|||
const bGPdata &src_object_data,
|
||||
Object &dst_object);
|
||||
|
||||
void lineart_wrap_v3(const LineartGpencilModifierData *lmd_legacy,
|
||||
GreasePencilLineartModifierData *lmd);
|
||||
void lineart_unwrap_v3(LineartGpencilModifierData *lmd_legacy,
|
||||
const GreasePencilLineartModifierData *lmd);
|
||||
|
||||
} // namespace blender::bke::greasepencil::convert
|
||||
|
|
|
@ -2749,105 +2749,3 @@ static void write_layer_tree(GreasePencil &grease_pencil, BlendWriter *writer)
|
|||
grease_pencil.root_group_ptr->wrap().prepare_for_dna_write();
|
||||
write_layer_tree_group(writer, grease_pencil.root_group_ptr);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
/** \name Layer tree read/write functions
|
||||
* \{ */
|
||||
|
||||
void BKE_grease_pencil_lineart_wrap_v3(const LineartGpencilModifierData *lmd_legacy,
|
||||
GreasePencilLineartModifierData *lmd)
|
||||
{
|
||||
#define LMD_WRAP(var) lmd->var = lmd_legacy->var
|
||||
|
||||
LMD_WRAP(edge_types);
|
||||
LMD_WRAP(source_type);
|
||||
LMD_WRAP(use_multiple_levels);
|
||||
LMD_WRAP(level_start);
|
||||
LMD_WRAP(level_end);
|
||||
LMD_WRAP(source_camera);
|
||||
LMD_WRAP(light_contour_object);
|
||||
LMD_WRAP(source_object);
|
||||
LMD_WRAP(source_collection);
|
||||
LMD_WRAP(target_material);
|
||||
STRNCPY(lmd->source_vertex_group, lmd_legacy->source_vertex_group);
|
||||
STRNCPY(lmd->vgname, lmd_legacy->vgname);
|
||||
LMD_WRAP(overscan);
|
||||
LMD_WRAP(shadow_camera_fov);
|
||||
LMD_WRAP(shadow_camera_size);
|
||||
LMD_WRAP(shadow_camera_near);
|
||||
LMD_WRAP(shadow_camera_far);
|
||||
LMD_WRAP(opacity);
|
||||
lmd->thickness = lmd_legacy->thickness / 2;
|
||||
LMD_WRAP(mask_switches);
|
||||
LMD_WRAP(material_mask_bits);
|
||||
LMD_WRAP(intersection_mask);
|
||||
LMD_WRAP(shadow_selection);
|
||||
LMD_WRAP(silhouette_selection);
|
||||
LMD_WRAP(crease_threshold);
|
||||
LMD_WRAP(angle_splitting_threshold);
|
||||
LMD_WRAP(chain_smooth_tolerance);
|
||||
LMD_WRAP(chaining_image_threshold);
|
||||
LMD_WRAP(calculation_flags);
|
||||
LMD_WRAP(flags);
|
||||
LMD_WRAP(stroke_depth_offset);
|
||||
LMD_WRAP(level_start_override);
|
||||
LMD_WRAP(level_end_override);
|
||||
LMD_WRAP(edge_types_override);
|
||||
LMD_WRAP(shadow_selection_override);
|
||||
LMD_WRAP(shadow_use_silhouette_override);
|
||||
LMD_WRAP(cache);
|
||||
LMD_WRAP(la_data_ptr);
|
||||
|
||||
#undef LMD_WRAP
|
||||
}
|
||||
|
||||
void BKE_grease_pencil_lineart_unwrap_v3(LineartGpencilModifierData *lmd_legacy,
|
||||
const GreasePencilLineartModifierData *lmd)
|
||||
{
|
||||
#define LMD_UNWRAP(var) lmd_legacy->var = lmd->var
|
||||
|
||||
LMD_UNWRAP(edge_types);
|
||||
LMD_UNWRAP(source_type);
|
||||
LMD_UNWRAP(use_multiple_levels);
|
||||
LMD_UNWRAP(level_start);
|
||||
LMD_UNWRAP(level_end);
|
||||
LMD_UNWRAP(source_camera);
|
||||
LMD_UNWRAP(light_contour_object);
|
||||
LMD_UNWRAP(source_object);
|
||||
LMD_UNWRAP(source_collection);
|
||||
LMD_UNWRAP(target_material);
|
||||
STRNCPY(lmd_legacy->source_vertex_group, lmd->source_vertex_group);
|
||||
STRNCPY(lmd_legacy->vgname, lmd->vgname);
|
||||
LMD_UNWRAP(overscan);
|
||||
LMD_UNWRAP(shadow_camera_fov);
|
||||
LMD_UNWRAP(shadow_camera_size);
|
||||
LMD_UNWRAP(shadow_camera_near);
|
||||
LMD_UNWRAP(shadow_camera_far);
|
||||
LMD_UNWRAP(opacity);
|
||||
lmd_legacy->thickness = lmd->thickness * 2;
|
||||
LMD_UNWRAP(mask_switches);
|
||||
LMD_UNWRAP(material_mask_bits);
|
||||
LMD_UNWRAP(intersection_mask);
|
||||
LMD_UNWRAP(shadow_selection);
|
||||
LMD_UNWRAP(silhouette_selection);
|
||||
LMD_UNWRAP(crease_threshold);
|
||||
LMD_UNWRAP(angle_splitting_threshold);
|
||||
LMD_UNWRAP(chain_smooth_tolerance);
|
||||
LMD_UNWRAP(chaining_image_threshold);
|
||||
LMD_UNWRAP(calculation_flags);
|
||||
LMD_UNWRAP(flags);
|
||||
LMD_UNWRAP(stroke_depth_offset);
|
||||
LMD_UNWRAP(level_start_override);
|
||||
LMD_UNWRAP(level_end_override);
|
||||
LMD_UNWRAP(edge_types_override);
|
||||
LMD_UNWRAP(shadow_selection_override);
|
||||
LMD_UNWRAP(shadow_use_silhouette_override);
|
||||
LMD_UNWRAP(cache);
|
||||
LMD_UNWRAP(la_data_ptr);
|
||||
|
||||
#undef LMD_UNWRAP
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -1524,7 +1524,7 @@ static void legacy_object_modifier_weight_lineart(Object &object, GpencilModifie
|
|||
auto &md_lineart = reinterpret_cast<GreasePencilLineartModifierData &>(md);
|
||||
auto &legacy_md_lineart = reinterpret_cast<LineartGpencilModifierData &>(legacy_md);
|
||||
|
||||
BKE_grease_pencil_lineart_wrap_v3(&legacy_md_lineart, &md_lineart);
|
||||
greasepencil::convert::lineart_wrap_v3(&legacy_md_lineart, &md_lineart);
|
||||
}
|
||||
|
||||
static void legacy_object_modifiers(Main & /*bmain*/, Object &object)
|
||||
|
@ -1636,4 +1636,98 @@ void legacy_gpencil_object(Main &bmain, Object &object)
|
|||
BKE_object_free_derived_caches(&object);
|
||||
}
|
||||
|
||||
void lineart_wrap_v3(const LineartGpencilModifierData *lmd_legacy,
|
||||
GreasePencilLineartModifierData *lmd)
|
||||
{
|
||||
#define LMD_WRAP(var) lmd->var = lmd_legacy->var
|
||||
|
||||
LMD_WRAP(edge_types);
|
||||
LMD_WRAP(source_type);
|
||||
LMD_WRAP(use_multiple_levels);
|
||||
LMD_WRAP(level_start);
|
||||
LMD_WRAP(level_end);
|
||||
LMD_WRAP(source_camera);
|
||||
LMD_WRAP(light_contour_object);
|
||||
LMD_WRAP(source_object);
|
||||
LMD_WRAP(source_collection);
|
||||
LMD_WRAP(target_material);
|
||||
STRNCPY(lmd->source_vertex_group, lmd_legacy->source_vertex_group);
|
||||
STRNCPY(lmd->vgname, lmd_legacy->vgname);
|
||||
LMD_WRAP(overscan);
|
||||
LMD_WRAP(shadow_camera_fov);
|
||||
LMD_WRAP(shadow_camera_size);
|
||||
LMD_WRAP(shadow_camera_near);
|
||||
LMD_WRAP(shadow_camera_far);
|
||||
LMD_WRAP(opacity);
|
||||
lmd->thickness = lmd_legacy->thickness / 2;
|
||||
LMD_WRAP(mask_switches);
|
||||
LMD_WRAP(material_mask_bits);
|
||||
LMD_WRAP(intersection_mask);
|
||||
LMD_WRAP(shadow_selection);
|
||||
LMD_WRAP(silhouette_selection);
|
||||
LMD_WRAP(crease_threshold);
|
||||
LMD_WRAP(angle_splitting_threshold);
|
||||
LMD_WRAP(chain_smooth_tolerance);
|
||||
LMD_WRAP(chaining_image_threshold);
|
||||
LMD_WRAP(calculation_flags);
|
||||
LMD_WRAP(flags);
|
||||
LMD_WRAP(stroke_depth_offset);
|
||||
LMD_WRAP(level_start_override);
|
||||
LMD_WRAP(level_end_override);
|
||||
LMD_WRAP(edge_types_override);
|
||||
LMD_WRAP(shadow_selection_override);
|
||||
LMD_WRAP(shadow_use_silhouette_override);
|
||||
LMD_WRAP(cache);
|
||||
LMD_WRAP(la_data_ptr);
|
||||
|
||||
#undef LMD_WRAP
|
||||
}
|
||||
|
||||
void lineart_unwrap_v3(LineartGpencilModifierData *lmd_legacy,
|
||||
const GreasePencilLineartModifierData *lmd)
|
||||
{
|
||||
#define LMD_UNWRAP(var) lmd_legacy->var = lmd->var
|
||||
|
||||
LMD_UNWRAP(edge_types);
|
||||
LMD_UNWRAP(source_type);
|
||||
LMD_UNWRAP(use_multiple_levels);
|
||||
LMD_UNWRAP(level_start);
|
||||
LMD_UNWRAP(level_end);
|
||||
LMD_UNWRAP(source_camera);
|
||||
LMD_UNWRAP(light_contour_object);
|
||||
LMD_UNWRAP(source_object);
|
||||
LMD_UNWRAP(source_collection);
|
||||
LMD_UNWRAP(target_material);
|
||||
STRNCPY(lmd_legacy->source_vertex_group, lmd->source_vertex_group);
|
||||
STRNCPY(lmd_legacy->vgname, lmd->vgname);
|
||||
LMD_UNWRAP(overscan);
|
||||
LMD_UNWRAP(shadow_camera_fov);
|
||||
LMD_UNWRAP(shadow_camera_size);
|
||||
LMD_UNWRAP(shadow_camera_near);
|
||||
LMD_UNWRAP(shadow_camera_far);
|
||||
LMD_UNWRAP(opacity);
|
||||
lmd_legacy->thickness = lmd->thickness * 2;
|
||||
LMD_UNWRAP(mask_switches);
|
||||
LMD_UNWRAP(material_mask_bits);
|
||||
LMD_UNWRAP(intersection_mask);
|
||||
LMD_UNWRAP(shadow_selection);
|
||||
LMD_UNWRAP(silhouette_selection);
|
||||
LMD_UNWRAP(crease_threshold);
|
||||
LMD_UNWRAP(angle_splitting_threshold);
|
||||
LMD_UNWRAP(chain_smooth_tolerance);
|
||||
LMD_UNWRAP(chaining_image_threshold);
|
||||
LMD_UNWRAP(calculation_flags);
|
||||
LMD_UNWRAP(flags);
|
||||
LMD_UNWRAP(stroke_depth_offset);
|
||||
LMD_UNWRAP(level_start_override);
|
||||
LMD_UNWRAP(level_end_override);
|
||||
LMD_UNWRAP(edge_types_override);
|
||||
LMD_UNWRAP(shadow_selection_override);
|
||||
LMD_UNWRAP(shadow_use_silhouette_override);
|
||||
LMD_UNWRAP(cache);
|
||||
LMD_UNWRAP(la_data_ptr);
|
||||
|
||||
#undef LMD_UNWRAP
|
||||
}
|
||||
|
||||
} // namespace blender::bke::greasepencil::convert
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "BKE_gpencil_legacy.h"
|
||||
#include "BKE_gpencil_modifier_legacy.h"
|
||||
#include "BKE_grease_pencil.hh"
|
||||
#include "BKE_grease_pencil_legacy_convert.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_mesh.hh"
|
||||
|
@ -3577,9 +3578,9 @@ void MOD_lineart_destroy_render_data_v3(GreasePencilLineartModifierData *lmd)
|
|||
void MOD_lineart_destroy_render_data(LineartGpencilModifierData *lmd_legacy)
|
||||
{
|
||||
GreasePencilLineartModifierData lmd;
|
||||
BKE_grease_pencil_lineart_wrap_v3(lmd_legacy, &lmd);
|
||||
greasepencil::convert::lineart_wrap_v3(lmd_legacy, &lmd);
|
||||
MOD_lineart_destroy_render_data_v3(&lmd);
|
||||
BKE_grease_pencil_lineart_unwrap_v3(lmd_legacy, &lmd);
|
||||
greasepencil::convert::lineart_unwrap_v3(lmd_legacy, &lmd);
|
||||
}
|
||||
|
||||
LineartCache *MOD_lineart_init_cache()
|
||||
|
@ -5231,10 +5232,10 @@ bool MOD_lineart_compute_feature_lines(Depsgraph *depsgraph,
|
|||
{
|
||||
bool ret = false;
|
||||
GreasePencilLineartModifierData lmd;
|
||||
BKE_grease_pencil_lineart_wrap_v3(lmd_legacy, &lmd);
|
||||
greasepencil::convert::lineart_wrap_v3(lmd_legacy, &lmd);
|
||||
ret = MOD_lineart_compute_feature_lines_v3(
|
||||
depsgraph, lmd, cached_result, enable_stroke_depth_offset);
|
||||
BKE_grease_pencil_lineart_unwrap_v3(lmd_legacy, &lmd);
|
||||
greasepencil::convert::lineart_unwrap_v3(lmd_legacy, &lmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "BKE_global.hh"
|
||||
#include "BKE_gpencil_modifier_legacy.h"
|
||||
#include "BKE_grease_pencil.hh"
|
||||
#include "BKE_grease_pencil_legacy_convert.hh"
|
||||
#include "BKE_object.hh"
|
||||
|
||||
#include "BLI_math_matrix.h"
|
||||
|
@ -26,6 +27,8 @@
|
|||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
using namespace blender::bke::greasepencil::convert;
|
||||
ChengduLittleA marked this conversation as resolved
Outdated
|
||||
|
||||
/* Shadow loading etc. ================== */
|
||||
|
||||
LineartElementLinkNode *lineart_find_matching_eln(ListBase *shadow_elns, int obindex)
|
||||
|
@ -1301,7 +1304,7 @@ bool lineart_main_try_generate_shadow(Depsgraph *depsgraph,
|
|||
{
|
||||
bool ret = false;
|
||||
GreasePencilLineartModifierData lmd;
|
||||
BKE_grease_pencil_lineart_wrap_v3(lmd_legacy, &lmd);
|
||||
lineart_wrap_v3(lmd_legacy, &lmd);
|
||||
ret = lineart_main_try_generate_shadow_v3(depsgraph,
|
||||
scene,
|
||||
original_ld,
|
||||
|
@ -1311,7 +1314,7 @@ bool lineart_main_try_generate_shadow(Depsgraph *depsgraph,
|
|||
r_eeln,
|
||||
r_calculated_edges_eln_list,
|
||||
r_shadow_ld_if_reproject);
|
||||
BKE_grease_pencil_lineart_unwrap_v3(lmd_legacy, &lmd);
|
||||
lineart_unwrap_v3(lmd_legacy, &lmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Just use
bke::greasepencil::convert::lineart_wrap_v3
instead of using the namespace in all of the file.