Cleanup: Move io files to c++ #108477
@ -28,27 +28,27 @@ set(INC_SYS
|
||||
)
|
||||
|
||||
set(SRC
|
||||
io_alembic.c
|
||||
io_cache.c
|
||||
io_collada.c
|
||||
io_gpencil_export.c
|
||||
io_gpencil_import.c
|
||||
io_gpencil_utils.c
|
||||
io_obj.c
|
||||
io_ops.c
|
||||
io_ply_ops.c
|
||||
io_stl_ops.c
|
||||
io_usd.c
|
||||
io_alembic.cc
|
||||
io_cache.cc
|
||||
io_collada.cc
|
||||
io_gpencil_export.cc
|
||||
io_gpencil_import.cc
|
||||
io_gpencil_utils.cc
|
||||
io_obj.cc
|
||||
io_ops.cc
|
||||
io_ply_ops.cc
|
||||
io_stl_ops.cc
|
||||
io_usd.cc
|
||||
|
||||
io_alembic.h
|
||||
io_cache.h
|
||||
io_collada.h
|
||||
io_gpencil.h
|
||||
io_obj.h
|
||||
io_alembic.hh
|
||||
io_cache.hh
|
||||
io_collada.hh
|
||||
io_gpencil.hh
|
||||
io_obj.hh
|
||||
io_ops.h
|
||||
io_ply_ops.h
|
||||
io_stl_ops.h
|
||||
io_usd.h
|
||||
io_ply_ops.hh
|
||||
io_stl_ops.hh
|
||||
io_usd.hh
|
||||
)
|
||||
|
||||
set(LIB
|
||||
|
@ -15,8 +15,8 @@
|
||||
# include "BLI_winstuff.h"
|
||||
# endif
|
||||
|
||||
# include <errno.h>
|
||||
# include <string.h>
|
||||
# include <cerrno>
|
||||
# include <cstring>
|
||||
|
||||
# include "MEM_guardedalloc.h"
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
|
||||
# include "DEG_depsgraph.h"
|
||||
|
||||
# include "io_alembic.h"
|
||||
# include "io_alembic.hh"
|
||||
|
||||
# include "ABC_alembic.h"
|
||||
|
||||
@ -66,10 +66,10 @@ const EnumPropertyItem rna_enum_abc_export_evaluation_mode_items[] = {
|
||||
0,
|
||||
"Viewport",
|
||||
"Use Viewport settings for object visibility, modifier settings, etc"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
|
||||
RNA_boolean_set(op->ptr, "as_background_job", true);
|
||||
@ -82,8 +82,6 @@ static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *
|
||||
WM_event_add_fileselect(C, op);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
|
||||
UNUSED_VARS(event);
|
||||
}
|
||||
|
||||
static int wm_alembic_export_exec(bContext *C, wmOperator *op)
|
||||
@ -96,39 +94,38 @@ static int wm_alembic_export_exec(bContext *C, wmOperator *op)
|
||||
char filepath[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", filepath);
|
||||
|
||||
struct AlembicExportParams params = {
|
||||
.frame_start = RNA_int_get(op->ptr, "start"),
|
||||
.frame_end = RNA_int_get(op->ptr, "end"),
|
||||
AlembicExportParams params{};
|
||||
guishe marked this conversation as resolved
Outdated
|
||||
params.frame_start = RNA_int_get(op->ptr, "start");
|
||||
params.frame_end = RNA_int_get(op->ptr, "end");
|
||||
|
||||
.frame_samples_xform = RNA_int_get(op->ptr, "xsamples"),
|
||||
.frame_samples_shape = RNA_int_get(op->ptr, "gsamples"),
|
||||
params.frame_samples_xform = RNA_int_get(op->ptr, "xsamples");
|
||||
params.frame_samples_shape = RNA_int_get(op->ptr, "gsamples");
|
||||
|
||||
.shutter_open = RNA_float_get(op->ptr, "sh_open"),
|
||||
.shutter_close = RNA_float_get(op->ptr, "sh_close"),
|
||||
params.shutter_open = RNA_float_get(op->ptr, "sh_open");
|
||||
params.shutter_close = RNA_float_get(op->ptr, "sh_close");
|
||||
|
||||
.selected_only = RNA_boolean_get(op->ptr, "selected"),
|
||||
.uvs = RNA_boolean_get(op->ptr, "uvs"),
|
||||
.normals = RNA_boolean_get(op->ptr, "normals"),
|
||||
.vcolors = RNA_boolean_get(op->ptr, "vcolors"),
|
||||
.orcos = RNA_boolean_get(op->ptr, "orcos"),
|
||||
.apply_subdiv = RNA_boolean_get(op->ptr, "apply_subdiv"),
|
||||
.curves_as_mesh = RNA_boolean_get(op->ptr, "curves_as_mesh"),
|
||||
.flatten_hierarchy = RNA_boolean_get(op->ptr, "flatten"),
|
||||
.visible_objects_only = RNA_boolean_get(op->ptr, "visible_objects_only"),
|
||||
.face_sets = RNA_boolean_get(op->ptr, "face_sets"),
|
||||
.use_subdiv_schema = RNA_boolean_get(op->ptr, "subdiv_schema"),
|
||||
.export_hair = RNA_boolean_get(op->ptr, "export_hair"),
|
||||
.export_particles = RNA_boolean_get(op->ptr, "export_particles"),
|
||||
.export_custom_properties = RNA_boolean_get(op->ptr, "export_custom_properties"),
|
||||
.use_instancing = RNA_boolean_get(op->ptr, "use_instancing"),
|
||||
.packuv = RNA_boolean_get(op->ptr, "packuv"),
|
||||
.triangulate = RNA_boolean_get(op->ptr, "triangulate"),
|
||||
.quad_method = RNA_enum_get(op->ptr, "quad_method"),
|
||||
.ngon_method = RNA_enum_get(op->ptr, "ngon_method"),
|
||||
.evaluation_mode = RNA_enum_get(op->ptr, "evaluation_mode"),
|
||||
params.selected_only = RNA_boolean_get(op->ptr, "selected");
|
||||
params.uvs = RNA_boolean_get(op->ptr, "uvs");
|
||||
params.normals = RNA_boolean_get(op->ptr, "normals");
|
||||
params.vcolors = RNA_boolean_get(op->ptr, "vcolors");
|
||||
params.orcos = RNA_boolean_get(op->ptr, "orcos");
|
||||
params.apply_subdiv = RNA_boolean_get(op->ptr, "apply_subdiv");
|
||||
params.curves_as_mesh = RNA_boolean_get(op->ptr, "curves_as_mesh");
|
||||
params.flatten_hierarchy = RNA_boolean_get(op->ptr, "flatten");
|
||||
params.visible_objects_only = RNA_boolean_get(op->ptr, "visible_objects_only");
|
||||
params.face_sets = RNA_boolean_get(op->ptr, "face_sets");
|
||||
params.use_subdiv_schema = RNA_boolean_get(op->ptr, "subdiv_schema");
|
||||
params.export_hair = RNA_boolean_get(op->ptr, "export_hair");
|
||||
params.export_particles = RNA_boolean_get(op->ptr, "export_particles");
|
||||
params.export_custom_properties = RNA_boolean_get(op->ptr, "export_custom_properties");
|
||||
params.use_instancing = RNA_boolean_get(op->ptr, "use_instancing");
|
||||
params.packuv = RNA_boolean_get(op->ptr, "packuv");
|
||||
params.triangulate = RNA_boolean_get(op->ptr, "triangulate");
|
||||
params.quad_method = RNA_enum_get(op->ptr, "quad_method");
|
||||
params.ngon_method = RNA_enum_get(op->ptr, "ngon_method");
|
||||
params.evaluation_mode = eEvaluationMode(RNA_enum_get(op->ptr, "evaluation_mode"));
|
||||
|
||||
.global_scale = RNA_float_get(op->ptr, "global_scale"),
|
||||
};
|
||||
params.global_scale = RNA_float_get(op->ptr, "global_scale");
|
||||
|
||||
/* Take some defaults from the scene, if not specified explicitly. */
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@ -155,7 +152,7 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
|
||||
box = uiLayoutBox(layout);
|
||||
uiItemL(box, IFACE_("Manual Transform"), ICON_NONE);
|
||||
|
||||
uiItemR(box, imfptr, "global_scale", 0, NULL, ICON_NONE);
|
||||
uiItemR(box, imfptr, "global_scale", 0, nullptr, ICON_NONE);
|
||||
|
||||
/* Scene Options */
|
||||
box = uiLayoutBox(layout);
|
||||
@ -172,12 +169,12 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiItemR(col, imfptr, "gsamples", 0, IFACE_("Geometry"), ICON_NONE);
|
||||
|
||||
sub = uiLayoutColumn(col, true);
|
||||
uiItemR(sub, imfptr, "sh_open", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "sh_open", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "sh_close", UI_ITEM_R_SLIDER, IFACE_("Close"), ICON_NONE);
|
||||
|
||||
uiItemS(col);
|
||||
|
||||
uiItemR(col, imfptr, "flatten", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "flatten", 0, nullptr, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "use_instancing", 0, IFACE_("Use Instancing"), ICON_NONE);
|
||||
uiItemR(sub, imfptr, "export_custom_properties", 0, IFACE_("Custom Properties"), ICON_NONE);
|
||||
|
||||
@ -186,7 +183,7 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiItemR(sub, imfptr, "visible_objects_only", 0, IFACE_("Visible Objects"), ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(box, true);
|
||||
uiItemR(col, imfptr, "evaluation_mode", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "evaluation_mode", 0, nullptr, ICON_NONE);
|
||||
|
||||
/* Object Data */
|
||||
box = uiLayoutBox(layout);
|
||||
@ -195,16 +192,16 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
|
||||
|
||||
col = uiLayoutColumn(box, false);
|
||||
|
||||
uiItemR(col, imfptr, "uvs", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "uvs", 0, nullptr, ICON_NONE);
|
||||
row = uiLayoutRow(col, false);
|
||||
uiLayoutSetActive(row, RNA_boolean_get(imfptr, "uvs"));
|
||||
uiItemR(row, imfptr, "packuv", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, imfptr, "packuv", 0, nullptr, ICON_NONE);
|
||||
|
||||
uiItemR(col, imfptr, "normals", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "vcolors", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "orcos", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "face_sets", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "curves_as_mesh", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "normals", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "vcolors", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "orcos", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "face_sets", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "curves_as_mesh", 0, nullptr, ICON_NONE);
|
||||
|
||||
uiItemS(col);
|
||||
|
||||
@ -215,7 +212,7 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiItemS(col);
|
||||
|
||||
col = uiLayoutColumn(box, false);
|
||||
uiItemR(col, imfptr, "triangulate", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "triangulate", 0, nullptr, ICON_NONE);
|
||||
sub = uiLayoutColumn(col, false);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(imfptr, "triangulate"));
|
||||
uiItemR(sub, imfptr, "quad_method", 0, IFACE_("Method Quads"), ICON_NONE);
|
||||
@ -227,8 +224,8 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiItemL(row, IFACE_("Particle Systems"), ICON_PARTICLE_DATA);
|
||||
|
||||
col = uiLayoutColumn(box, true);
|
||||
uiItemR(col, imfptr, "export_hair", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "export_particles", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "export_hair", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "export_particles", 0, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void wm_alembic_export_draw(bContext *C, wmOperator *op)
|
||||
@ -236,7 +233,7 @@ static void wm_alembic_export_draw(bContext *C, wmOperator *op)
|
||||
/* Conveniently set start and end frame to match the scene's frame range. */
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
if (scene != NULL && RNA_boolean_get(op->ptr, "init_scene_frame_range")) {
|
||||
if (scene != nullptr && RNA_boolean_get(op->ptr, "init_scene_frame_range")) {
|
||||
RNA_int_set(op->ptr, "start", scene->r.sfra);
|
||||
RNA_int_set(op->ptr, "end", scene->r.efra);
|
||||
|
||||
@ -246,7 +243,7 @@ static void wm_alembic_export_draw(bContext *C, wmOperator *op)
|
||||
ui_alembic_export_settings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
static bool wm_alembic_export_check(bContext *UNUSED(C), wmOperator *op)
|
||||
static bool wm_alembic_export_check(bContext * /*C*/, wmOperator *op)
|
||||
{
|
||||
char filepath[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", filepath);
|
||||
@ -475,15 +472,15 @@ void WM_OT_alembic_export(wmOperatorType *ot)
|
||||
|
||||
/* TODO(kevin): check on de-duplicating all this with code in image_ops.c */
|
||||
|
||||
typedef struct CacheFrame {
|
||||
struct CacheFrame {
|
||||
struct CacheFrame *next, *prev;
|
||||
int framenr;
|
||||
} CacheFrame;
|
||||
};
|
||||
|
||||
static int cmp_frame(const void *a, const void *b)
|
||||
{
|
||||
const CacheFrame *frame_a = a;
|
||||
const CacheFrame *frame_b = b;
|
||||
const CacheFrame *frame_a = static_cast<const CacheFrame *>(a);
|
||||
const CacheFrame *frame_b = static_cast<const CacheFrame *>(b);
|
||||
|
||||
if (frame_a->framenr < frame_b->framenr) {
|
||||
return -1;
|
||||
@ -515,7 +512,7 @@ static int get_sequence_len(const char *filepath, int *ofs)
|
||||
}
|
||||
|
||||
DIR *dir = opendir(dirpath);
|
||||
if (dir == NULL) {
|
||||
if (dir == nullptr) {
|
||||
fprintf(stderr,
|
||||
"Error opening directory '%s': %s\n",
|
||||
dirpath,
|
||||
@ -527,11 +524,11 @@ static int get_sequence_len(const char *filepath, int *ofs)
|
||||
const char *basename = BLI_path_basename(filepath);
|
||||
const int len = strlen(basename) - (numdigit + strlen(ext));
|
||||
|
||||
ListBase frames;
|
||||
ListBase frames{};
|
||||
BLI_listbase_clear(&frames);
|
||||
|
||||
struct dirent *fname;
|
||||
while ((fname = readdir(dir)) != NULL) {
|
||||
dirent *fname;
|
||||
while ((fname = readdir(dir)) != nullptr) {
|
||||
/* do we have the right extension? */
|
||||
if (!strstr(fname->d_name, ext)) {
|
||||
continue;
|
||||
@ -541,7 +538,7 @@ static int get_sequence_len(const char *filepath, int *ofs)
|
||||
continue;
|
||||
}
|
||||
|
||||
guishe marked this conversation as resolved
Outdated
Hans Goudey
commented
This can use This can use `MEM_cnew`. Some developers expressed a preference for that when it's trivial like it is here.
|
||||
CacheFrame *cache_frame = MEM_callocN(sizeof(CacheFrame), "abc_frame");
|
||||
CacheFrame *cache_frame = MEM_cnew<CacheFrame>("abc_frame");
|
||||
|
||||
BLI_path_frame_get(fname->d_name, &cache_frame->framenr, &numdigit);
|
||||
|
||||
@ -552,9 +549,9 @@ static int get_sequence_len(const char *filepath, int *ofs)
|
||||
|
||||
BLI_listbase_sort(&frames, cmp_frame);
|
||||
|
||||
CacheFrame *cache_frame = frames.first;
|
||||
CacheFrame *cache_frame = static_cast<CacheFrame *>(frames.first);
|
||||
|
||||
if (cache_frame) {
|
||||
if (cache_frame != nullptr) {
|
||||
int frame_curr = cache_frame->framenr;
|
||||
(*ofs) = frame_curr;
|
||||
|
||||
@ -583,21 +580,21 @@ static void ui_alembic_import_settings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiLayout *row = uiLayoutRow(box, false);
|
||||
uiItemL(row, IFACE_("Manual Transform"), ICON_NONE);
|
||||
|
||||
uiItemR(box, imfptr, "scale", 0, NULL, ICON_NONE);
|
||||
uiItemR(box, imfptr, "scale", 0, nullptr, ICON_NONE);
|
||||
|
||||
box = uiLayoutBox(layout);
|
||||
row = uiLayoutRow(box, false);
|
||||
uiItemL(row, IFACE_("Options"), ICON_NONE);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(box, false);
|
||||
uiItemR(col, imfptr, "relative_path", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "set_frame_range", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "is_sequence", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "validate_meshes", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "always_add_cache_reader", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "relative_path", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "set_frame_range", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "is_sequence", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "validate_meshes", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "always_add_cache_reader", 0, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void wm_alembic_import_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
static void wm_alembic_import_draw(bContext * /*C*/, wmOperator *op)
|
||||
{
|
||||
ui_alembic_import_settings(op->layout, op->ptr);
|
||||
}
|
||||
@ -645,7 +642,7 @@ static int wm_alembic_import_exec(bContext *C, wmOperator *op)
|
||||
ED_object_mode_set(C, OB_MODE_OBJECT);
|
||||
}
|
||||
|
||||
struct AlembicImportParams params = {0};
|
||||
AlembicImportParams params = {0};
|
||||
params.global_scale = scale;
|
||||
params.sequence_len = sequence_len;
|
||||
params.sequence_offset = offset;
|
@ -31,7 +31,7 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "io_cache.h"
|
||||
#include "io_cache.hh"
|
||||
|
||||
static void reload_cachefile(bContext *C, CacheFile *cache_file)
|
||||
{
|
||||
@ -43,11 +43,11 @@ static void cachefile_init(bContext *C, wmOperator *op)
|
||||
{
|
||||
PropertyPointerRNA *pprop;
|
||||
|
||||
op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
|
||||
op->customdata = pprop = MEM_cnew<PropertyPointerRNA>("OpenPropertyPointerRNA");
|
||||
UI_context_active_but_prop_get_templateID(C, &pprop->ptr, &pprop->prop);
|
||||
}
|
||||
|
||||
static int cachefile_open_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int cachefile_open_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
|
||||
char filepath[FILE_MAX];
|
||||
@ -63,14 +63,12 @@ static int cachefile_open_invoke(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
WM_event_add_fileselect(C, op);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
|
||||
UNUSED_VARS(event);
|
||||
}
|
||||
|
||||
static void open_cancel(bContext *UNUSED(C), wmOperator *op)
|
||||
static void open_cancel(bContext * /*C*/, wmOperator *op)
|
||||
{
|
||||
MEM_freeN(op->customdata);
|
||||
op->customdata = NULL;
|
||||
op->customdata = nullptr;
|
||||
}
|
||||
|
||||
static int cachefile_open_exec(bContext *C, wmOperator *op)
|
||||
@ -85,22 +83,23 @@ static int cachefile_open_exec(bContext *C, wmOperator *op)
|
||||
|
||||
Main *bmain = CTX_data_main(C);
|
||||
|
||||
CacheFile *cache_file = BKE_libblock_alloc(bmain, ID_CF, BLI_path_basename(filepath), 0);
|
||||
CacheFile *cache_file = static_cast<CacheFile *>(
|
||||
BKE_libblock_alloc(bmain, ID_CF, BLI_path_basename(filepath), 0));
|
||||
STRNCPY(cache_file->filepath, filepath);
|
||||
DEG_id_tag_update(&cache_file->id, ID_RECALC_COPY_ON_WRITE);
|
||||
|
||||
/* Will be set when running invoke, not exec directly. */
|
||||
if (op->customdata != NULL) {
|
||||
if (op->customdata != nullptr) {
|
||||
/* hook into UI */
|
||||
PropertyPointerRNA *pprop = op->customdata;
|
||||
if (pprop->prop) {
|
||||
PropertyPointerRNA *pprop = static_cast<PropertyPointerRNA *>(op->customdata);
|
||||
if (pprop->prop != nullptr) {
|
||||
/* When creating new ID blocks, use is already 1, but RNA
|
||||
* pointer see also increases user, so this compensates it. */
|
||||
id_us_min(&cache_file->id);
|
||||
|
||||
PointerRNA idptr;
|
||||
RNA_id_pointer_create(&cache_file->id, &idptr);
|
||||
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr, NULL);
|
||||
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr, nullptr);
|
||||
RNA_property_update(C, &pprop->ptr, pprop->prop);
|
||||
}
|
||||
|
||||
@ -131,11 +130,11 @@ void CACHEFILE_OT_open(wmOperatorType *ot)
|
||||
|
||||
/* ***************************** Reload Operator **************************** */
|
||||
|
||||
static int cachefile_reload_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int cachefile_reload_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
CacheFile *cache_file = CTX_data_edit_cachefile(C);
|
||||
|
||||
if (!cache_file) {
|
||||
if (cache_file == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@ -159,7 +158,7 @@ void CACHEFILE_OT_reload(wmOperatorType *ot)
|
||||
|
||||
/* ***************************** Add Layer Operator **************************** */
|
||||
|
||||
static int cachefile_layer_open_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int cachefile_layer_open_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
|
||||
char filepath[FILE_MAX];
|
||||
@ -176,8 +175,6 @@ static int cachefile_layer_open_invoke(bContext *C, wmOperator *op, const wmEven
|
||||
WM_event_add_fileselect(C, op);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
|
||||
UNUSED_VARS(event);
|
||||
}
|
||||
|
||||
static int cachefile_layer_add_exec(bContext *C, wmOperator *op)
|
||||
@ -187,9 +184,9 @@ static int cachefile_layer_add_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
CacheFile *cache_file = op->customdata;
|
||||
CacheFile *cache_file = static_cast<CacheFile *>(op->customdata);
|
||||
|
||||
if (!cache_file) {
|
||||
if (cache_file == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@ -198,13 +195,13 @@ static int cachefile_layer_add_exec(bContext *C, wmOperator *op)
|
||||
|
||||
CacheFileLayer *layer = BKE_cachefile_add_layer(cache_file, filepath);
|
||||
|
||||
if (!layer) {
|
||||
if (layer == nullptr) {
|
||||
WM_report(RPT_ERROR, "Could not add a layer to the cache file");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
reload_cachefile(C, cache_file);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_DRAW, nullptr);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@ -229,11 +226,11 @@ void CACHEFILE_OT_layer_add(wmOperatorType *ot)
|
||||
|
||||
/* ***************************** Remove Layer Operator **************************** */
|
||||
|
||||
static int cachefile_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int cachefile_layer_remove_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
CacheFile *cache_file = CTX_data_edit_cachefile(C);
|
||||
|
||||
if (!cache_file) {
|
||||
if (cache_file == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@ -241,7 +238,7 @@ static int cachefile_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
BKE_cachefile_remove_layer(cache_file, layer);
|
||||
|
||||
reload_cachefile(C, cache_file);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_DRAW, nullptr);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@ -264,13 +261,13 @@ static int cachefile_layer_move_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
CacheFile *cache_file = CTX_data_edit_cachefile(C);
|
||||
|
||||
if (!cache_file) {
|
||||
if (cache_file == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
CacheFileLayer *layer = BKE_cachefile_get_active_layer(cache_file);
|
||||
|
||||
if (!layer) {
|
||||
if (layer == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@ -280,7 +277,7 @@ static int cachefile_layer_move_exec(bContext *C, wmOperator *op)
|
||||
cache_file->active_layer = BLI_findindex(&cache_file->layers, layer) + 1;
|
||||
/* Only reload if something moved, might be expensive. */
|
||||
reload_cachefile(C, cache_file);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_DRAW, nullptr);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@ -291,7 +288,7 @@ void CACHEFILE_OT_layer_move(wmOperatorType *ot)
|
||||
static const EnumPropertyItem layer_slot_move[] = {
|
||||
{-1, "UP", 0, "Up", ""},
|
||||
{1, "DOWN", 0, "Down", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
ot->name = "Move layer";
|
@ -34,9 +34,9 @@
|
||||
|
||||
# include "collada.h"
|
||||
|
||||
# include "io_collada.h"
|
||||
# include "io_collada.hh"
|
||||
|
||||
static int wm_collada_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
static int wm_collada_export_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
ED_fileselect_ensure_default_filepath(C, op, ".dae");
|
||||
|
||||
@ -156,16 +156,16 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
|
||||
|
||||
// Scene *scene = CTX_data_scene(C);
|
||||
|
||||
ExportSettings export_settings;
|
||||
ExportSettings export_settings{};
|
||||
|
||||
export_settings.filepath = filepath;
|
||||
|
||||
export_settings.apply_modifiers = apply_modifiers != 0;
|
||||
export_settings.global_forward = global_forward;
|
||||
export_settings.global_up = global_up;
|
||||
export_settings.global_forward = BC_global_forward_axis(global_forward);
|
||||
export_settings.global_up = BC_global_up_axis(global_up);
|
||||
export_settings.apply_global_orientation = apply_global_orientation != 0;
|
||||
|
||||
export_settings.export_mesh_type = export_mesh_type;
|
||||
export_settings.export_mesh_type = BC_export_mesh_type(export_mesh_type);
|
||||
export_settings.selected = selected != 0;
|
||||
export_settings.include_children = include_children != 0;
|
||||
export_settings.include_armatures = include_armatures != 0;
|
||||
@ -178,15 +178,17 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
|
||||
export_settings.keep_flat_curves = keep_flat_curves != 0;
|
||||
|
||||
export_settings.active_uv_only = active_uv_only != 0;
|
||||
export_settings.export_animation_type = export_animation_type;
|
||||
export_settings.export_animation_type = BC_export_animation_type(export_animation_type);
|
||||
export_settings.use_texture_copies = use_texture_copies != 0;
|
||||
|
||||
export_settings.triangulate = triangulate != 0;
|
||||
export_settings.use_object_instantiation = use_object_instantiation != 0;
|
||||
export_settings.use_blender_profile = use_blender_profile != 0;
|
||||
export_settings.sort_by_name = sort_by_name != 0;
|
||||
export_settings.object_transformation_type = export_object_transformation_type;
|
||||
export_settings.animation_transformation_type = export_animation_transformation_type;
|
||||
export_settings.object_transformation_type = BC_export_transformation_type(
|
||||
export_object_transformation_type);
|
||||
export_settings.animation_transformation_type = BC_export_transformation_type(
|
||||
export_animation_transformation_type);
|
||||
export_settings.keep_smooth_curves = keep_smooth_curves != 0;
|
||||
|
||||
if (export_animation_type != BC_ANIMATION_EXPORT_SAMPLES) {
|
||||
@ -230,17 +232,17 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
||||
bool include_animations = RNA_boolean_get(imfptr, "include_animations");
|
||||
int ui_section = RNA_enum_get(imfptr, "prop_bc_export_ui_section");
|
||||
|
||||
BC_export_animation_type animation_type = RNA_enum_get(imfptr,
|
||||
"export_animation_type_selection");
|
||||
BC_export_animation_type animation_type = BC_export_animation_type(
|
||||
RNA_enum_get(imfptr, "export_animation_type_selection"));
|
||||
|
||||
BC_export_transformation_type animation_transformation_type = RNA_enum_get(
|
||||
imfptr, "export_animation_transformation_type_selection");
|
||||
BC_export_transformation_type animation_transformation_type = BC_export_transformation_type(
|
||||
RNA_enum_get(imfptr, "export_animation_transformation_type_selection"));
|
||||
|
||||
bool sampling = animation_type == BC_ANIMATION_EXPORT_SAMPLES;
|
||||
|
||||
/* Export Options: */
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, imfptr, "prop_bc_export_ui_section", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(row, imfptr, "prop_bc_export_ui_section", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
uiLayoutSetPropDecorate(layout, false);
|
||||
@ -249,12 +251,12 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
||||
/* Export data options. */
|
||||
box = uiLayoutBox(layout);
|
||||
col = uiLayoutColumn(box, false);
|
||||
uiItemR(col, imfptr, "selected", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "selected", 0, nullptr, ICON_NONE);
|
||||
sub = uiLayoutColumn(col, false);
|
||||
uiLayoutSetEnabled(sub, RNA_boolean_get(imfptr, "selected"));
|
||||
uiItemR(sub, imfptr, "include_children", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "include_armatures", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "include_shapekeys", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "include_children", 0, nullptr, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "include_armatures", 0, nullptr, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "include_shapekeys", 0, nullptr, ICON_NONE);
|
||||
|
||||
box = uiLayoutBox(layout);
|
||||
row = uiLayoutRow(box, false);
|
||||
@ -269,7 +271,7 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiItemL(box, IFACE_("Texture Options"), ICON_TEXTURE_DATA);
|
||||
|
||||
col = uiLayoutColumn(box, false);
|
||||
uiItemR(col, imfptr, "use_texture_copies", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "use_texture_copies", 0, nullptr, ICON_NONE);
|
||||
row = uiLayoutRowWithHeading(col, true, IFACE_("UV"));
|
||||
uiItemR(row, imfptr, "active_uv_only", 0, IFACE_("Only Selected Map"), ICON_NONE);
|
||||
}
|
||||
@ -279,7 +281,7 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
||||
|
||||
col = uiLayoutColumn(box, false);
|
||||
|
||||
uiItemR(col, imfptr, "triangulate", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "triangulate", 0, nullptr, ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(col, true, IFACE_("Apply Modifiers"));
|
||||
uiItemR(row, imfptr, "apply_modifiers", 0, "", ICON_NONE);
|
||||
@ -288,10 +290,10 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiItemR(sub, imfptr, "export_mesh_type_selection", 0, "", ICON_NONE);
|
||||
|
||||
if (RNA_boolean_get(imfptr, "include_animations")) {
|
||||
uiItemR(col, imfptr, "export_animation_transformation_type_selection", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "export_animation_transformation_type_selection", 0, nullptr, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(col, imfptr, "export_object_transformation_type_selection", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "export_object_transformation_type_selection", 0, nullptr, ICON_NONE);
|
||||
}
|
||||
}
|
||||
else if (ui_section == BC_UI_SECTION_ARMATURE) {
|
||||
@ -300,25 +302,25 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiItemL(box, IFACE_("Armature Options"), ICON_ARMATURE_DATA);
|
||||
|
||||
col = uiLayoutColumn(box, false);
|
||||
uiItemR(col, imfptr, "deform_bones_only", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "open_sim", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "deform_bones_only", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "open_sim", 0, nullptr, ICON_NONE);
|
||||
}
|
||||
else if (ui_section == BC_UI_SECTION_ANIMATION) {
|
||||
/* Animation options. */
|
||||
box = uiLayoutBox(layout);
|
||||
uiItemR(box, imfptr, "include_animations", 0, NULL, ICON_NONE);
|
||||
uiItemR(box, imfptr, "include_animations", 0, nullptr, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(box, false);
|
||||
row = uiLayoutRow(col, false);
|
||||
uiLayoutSetActive(row, include_animations);
|
||||
uiItemR(row, imfptr, "export_animation_type_selection", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(row, imfptr, "export_animation_type_selection", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
||||
|
||||
uiLayoutSetActive(row, include_animations && animation_type == BC_ANIMATION_EXPORT_SAMPLES);
|
||||
if (RNA_boolean_get(imfptr, "include_animations")) {
|
||||
uiItemR(box, imfptr, "export_animation_transformation_type_selection", 0, NULL, ICON_NONE);
|
||||
uiItemR(box, imfptr, "export_animation_transformation_type_selection", 0, nullptr, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(box, imfptr, "export_object_transformation_type_selection", 0, NULL, ICON_NONE);
|
||||
uiItemR(box, imfptr, "export_object_transformation_type_selection", 0, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
row = uiLayoutColumn(col, false);
|
||||
@ -326,17 +328,17 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
||||
include_animations &&
|
||||
(animation_transformation_type == BC_TRANSFORMATION_TYPE_DECOMPOSED ||
|
||||
animation_type == BC_ANIMATION_EXPORT_KEYS));
|
||||
uiItemR(row, imfptr, "keep_smooth_curves", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, imfptr, "keep_smooth_curves", 0, nullptr, ICON_NONE);
|
||||
|
||||
sub = uiLayoutColumn(col, false);
|
||||
uiLayoutSetActive(sub, sampling && include_animations);
|
||||
uiItemR(sub, imfptr, "sampling_rate", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "keep_keyframes", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "sampling_rate", 0, nullptr, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "keep_keyframes", 0, nullptr, ICON_NONE);
|
||||
|
||||
sub = uiLayoutColumn(col, false);
|
||||
uiLayoutSetActive(sub, include_animations);
|
||||
uiItemR(sub, imfptr, "keep_flat_curves", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "include_all_actions", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "keep_flat_curves", 0, nullptr, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "include_all_actions", 0, nullptr, ICON_NONE);
|
||||
}
|
||||
else if (ui_section == BC_UI_SECTION_COLLADA) {
|
||||
/* Collada options: */
|
||||
@ -345,20 +347,20 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiItemL(row, IFACE_("Collada Options"), ICON_MODIFIER);
|
||||
|
||||
col = uiLayoutColumn(box, false);
|
||||
uiItemR(col, imfptr, "use_object_instantiation", 1, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "use_blender_profile", 1, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "sort_by_name", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "keep_bind_info", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "limit_precision", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "use_object_instantiation", 1, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "use_blender_profile", 1, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "sort_by_name", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "keep_bind_info", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "limit_precision", 0, nullptr, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void wm_collada_export_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
static void wm_collada_export_draw(bContext * /*C*/, wmOperator *op)
|
||||
{
|
||||
uiCollada_exportSettings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
static bool wm_collada_export_check(bContext *UNUSED(C), wmOperator *op)
|
||||
static bool wm_collada_export_check(bContext * /*C*/, wmOperator *op)
|
||||
{
|
||||
char filepath[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", filepath);
|
||||
@ -377,7 +379,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
|
||||
static const EnumPropertyItem prop_bc_export_mesh_type[] = {
|
||||
{BC_MESH_TYPE_VIEW, "view", 0, "Viewport", "Apply modifier's viewport settings"},
|
||||
{BC_MESH_TYPE_RENDER, "render", 0, "Render", "Apply modifier's render settings"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem prop_bc_export_global_forward[] = {
|
||||
@ -387,7 +389,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
|
||||
{BC_GLOBAL_FORWARD_MINUS_X, "-X", 0, "-X", "Global Forward is negative X Axis"},
|
||||
{BC_GLOBAL_FORWARD_MINUS_Y, "-Y", 0, "-Y", "Global Forward is negative Y Axis"},
|
||||
{BC_GLOBAL_FORWARD_MINUS_Z, "-Z", 0, "-Z", "Global Forward is negative Z Axis"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem prop_bc_export_global_up[] = {
|
||||
@ -397,7 +399,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
|
||||
{BC_GLOBAL_UP_MINUS_X, "-X", 0, "-X", "Global UP is negative X Axis"},
|
||||
{BC_GLOBAL_UP_MINUS_Y, "-Y", 0, "-Y", "Global UP is negative Y Axis"},
|
||||
{BC_GLOBAL_UP_MINUS_Z, "-Z", 0, "-Z", "Global UP is negative Z Axis"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem prop_bc_export_transformation_type[] = {
|
||||
@ -411,7 +413,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
|
||||
0,
|
||||
"Decomposed",
|
||||
"Use <rotate>, <translate> and <scale> representation for exported transformations"},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
{0, nullptr, 0, nullptr, nullptr}};
|
||||
|
||||
static const EnumPropertyItem prop_bc_export_animation_type[] = {
|
||||
{BC_ANIMATION_EXPORT_SAMPLES,
|
||||
@ -424,7 +426,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
|
||||
0,
|
||||
"Curves",
|
||||
"Export Curves (note: guided by curve keys)"},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
{0, nullptr, 0, nullptr, nullptr}};
|
||||
|
||||
static const EnumPropertyItem prop_bc_export_ui_section[] = {
|
||||
{BC_UI_SECTION_MAIN, "main", 0, "Main", "Data export section"},
|
||||
@ -432,7 +434,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
|
||||
{BC_UI_SECTION_ARMATURE, "armature", 0, "Arm", "Armature export section"},
|
||||
{BC_UI_SECTION_ANIMATION, "animation", 0, "Anim", "Animation export section"},
|
||||
{BC_UI_SECTION_COLLADA, "collada", 0, "Extra", "Collada export section"},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
{0, nullptr, 0, nullptr, nullptr}};
|
||||
|
||||
ot->name = "Export COLLADA";
|
||||
ot->description = "Save a Collada file";
|
||||
@ -688,7 +690,7 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
|
||||
|
||||
int keep_bind_info;
|
||||
int custom_normals;
|
||||
ImportSettings import_settings;
|
||||
ImportSettings import_settings{};
|
||||
|
||||
if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
|
||||
BKE_report(op->reports, RPT_ERROR, "No filepath given");
|
||||
@ -737,24 +739,24 @@ static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr)
|
||||
box = uiLayoutBox(layout);
|
||||
uiItemL(box, IFACE_("Import Data Options"), ICON_MESH_DATA);
|
||||
|
||||
uiItemR(box, imfptr, "import_units", 0, NULL, ICON_NONE);
|
||||
uiItemR(box, imfptr, "custom_normals", 0, NULL, ICON_NONE);
|
||||
uiItemR(box, imfptr, "import_units", 0, nullptr, ICON_NONE);
|
||||
uiItemR(box, imfptr, "custom_normals", 0, nullptr, ICON_NONE);
|
||||
|
||||
box = uiLayoutBox(layout);
|
||||
uiItemL(box, IFACE_("Armature Options"), ICON_ARMATURE_DATA);
|
||||
|
||||
col = uiLayoutColumn(box, false);
|
||||
uiItemR(col, imfptr, "fix_orientation", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "find_chains", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "auto_connect", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "min_chain_length", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "fix_orientation", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "find_chains", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "auto_connect", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "min_chain_length", 0, nullptr, ICON_NONE);
|
||||
|
||||
box = uiLayoutBox(layout);
|
||||
|
||||
uiItemR(box, imfptr, "keep_bind_info", 0, NULL, ICON_NONE);
|
||||
uiItemR(box, imfptr, "keep_bind_info", 0, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void wm_collada_import_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
static void wm_collada_import_draw(bContext * /*C*/, wmOperator *op)
|
||||
{
|
||||
uiCollada_importSettings(op->layout, op->ptr);
|
||||
}
|
@ -35,7 +35,7 @@
|
||||
# include "DEG_depsgraph.h"
|
||||
# include "DEG_depsgraph_query.h"
|
||||
|
||||
# include "io_gpencil.h"
|
||||
# include "io_gpencil.hh"
|
||||
|
||||
# include "gpencil_io.h"
|
||||
|
||||
@ -48,7 +48,7 @@ static void gpencil_export_common_props_definition(wmOperatorType *ot)
|
||||
{GP_EXPORT_ACTIVE, "ACTIVE", 0, "Active", "Include only the active object"},
|
||||
{GP_EXPORT_SELECTED, "SELECTED", 0, "Selected", "Include selected objects"},
|
||||
{GP_EXPORT_VISIBLE, "VISIBLE", 0, "Visible", "Include all visible objects"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_boolean(ot->srna, "use_fill", true, "Fill", "Export strokes with fill enabled");
|
||||
@ -78,7 +78,7 @@ static void gpencil_export_common_props_definition(wmOperatorType *ot)
|
||||
|
||||
/* <-------- SVG single frame export. --------> */
|
||||
# ifdef WITH_PUGIXML
|
||||
static bool wm_gpencil_export_svg_common_check(bContext *UNUSED(C), wmOperator *op)
|
||||
static bool wm_gpencil_export_svg_common_check(bContext * /*C*/, wmOperator *op)
|
||||
{
|
||||
char filepath[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", filepath);
|
||||
@ -92,7 +92,7 @@ static bool wm_gpencil_export_svg_common_check(bContext *UNUSED(C), wmOperator *
|
||||
return false;
|
||||
}
|
||||
|
||||
static int wm_gpencil_export_svg_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
static int wm_gpencil_export_svg_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
ED_fileselect_ensure_default_filepath(C, op, ".svg");
|
||||
|
||||
@ -112,7 +112,7 @@ static int wm_gpencil_export_svg_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
ARegion *region = get_invoke_region(C);
|
||||
if (region == NULL) {
|
||||
if (region == nullptr) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Unable to find valid 3D View area");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@ -123,7 +123,8 @@ static int wm_gpencil_export_svg_exec(bContext *C, wmOperator *op)
|
||||
|
||||
const bool use_fill = RNA_boolean_get(op->ptr, "use_fill");
|
||||
const bool use_norm_thickness = RNA_boolean_get(op->ptr, "use_normalized_thickness");
|
||||
const eGpencilExportSelect select_mode = RNA_enum_get(op->ptr, "selected_object_type");
|
||||
const eGpencilExportSelect select_mode = eGpencilExportSelect(
|
||||
RNA_enum_get(op->ptr, "selected_object_type"));
|
||||
|
||||
const bool use_clip_camera = RNA_boolean_get(op->ptr, "use_clip_camera");
|
||||
|
||||
@ -133,20 +134,21 @@ static int wm_gpencil_export_svg_exec(bContext *C, wmOperator *op)
|
||||
SET_FLAG_FROM_TEST(flag, use_norm_thickness, GP_EXPORT_NORM_THICKNESS);
|
||||
SET_FLAG_FROM_TEST(flag, use_clip_camera, GP_EXPORT_CLIP_CAMERA);
|
||||
|
||||
GpencilIOParams params = {.C = C,
|
||||
.region = region,
|
||||
.v3d = v3d,
|
||||
.ob = ob,
|
||||
.mode = GP_EXPORT_TO_SVG,
|
||||
.frame_start = scene->r.cfra,
|
||||
.frame_end = scene->r.cfra,
|
||||
.frame_cur = scene->r.cfra,
|
||||
.flag = flag,
|
||||
.scale = 1.0f,
|
||||
.select_mode = select_mode,
|
||||
.frame_mode = GP_EXPORT_FRAME_ACTIVE,
|
||||
.stroke_sample = RNA_float_get(op->ptr, "stroke_sample"),
|
||||
.resolution = 1.0f};
|
||||
GpencilIOParams params{};
|
||||
params.C = C;
|
||||
params.region = region;
|
||||
params.v3d = v3d;
|
||||
params.ob = ob;
|
||||
params.mode = GP_EXPORT_TO_SVG;
|
||||
params.frame_start = scene->r.cfra;
|
||||
params.frame_end = scene->r.cfra;
|
||||
params.frame_cur = scene->r.cfra;
|
||||
params.flag = flag;
|
||||
params.scale = 1.0f;
|
||||
params.select_mode = select_mode;
|
||||
params.frame_mode = GP_EXPORT_FRAME_ACTIVE;
|
||||
params.stroke_sample = RNA_float_get(op->ptr, "stroke_sample");
|
||||
params.resolution = 1.0f;
|
||||
|
||||
/* Do export. */
|
||||
WM_cursor_wait(true);
|
||||
@ -173,27 +175,27 @@ static void ui_gpencil_export_svg_settings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiItemL(row, IFACE_("Scene Options"), ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(box, false);
|
||||
uiItemR(row, imfptr, "selected_object_type", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, imfptr, "selected_object_type", 0, nullptr, ICON_NONE);
|
||||
|
||||
box = uiLayoutBox(layout);
|
||||
row = uiLayoutRow(box, false);
|
||||
uiItemL(row, IFACE_("Export Options"), ICON_NONE);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(box, false);
|
||||
uiItemR(col, imfptr, "stroke_sample", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "use_fill", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "use_normalized_thickness", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "use_clip_camera", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, imfptr, "stroke_sample", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "use_fill", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "use_normalized_thickness", 0, nullptr, ICON_NONE);
|
||||
uiItemR(col, imfptr, "use_clip_camera", 0, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void wm_gpencil_export_svg_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
static void wm_gpencil_export_svg_draw(bContext * /*C*/, wmOperator *op)
|
||||
{
|
||||
ui_gpencil_export_svg_settings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
static bool wm_gpencil_export_svg_poll(bContext *C)
|
||||
{
|
||||
if ((CTX_wm_window(C) == NULL) || (CTX_data_mode_enum(C) != CTX_MODE_OBJECT)) {
|
||||
if ((CTX_wm_window(C) == nullptr) || (CTX_data_mode_enum(C) != CTX_MODE_OBJECT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -232,7 +234,7 @@ void WM_OT_gpencil_export_svg(wmOperatorType *ot)
|
||||
|
||||
/* <-------- PDF single frame export. --------> */
|
||||
# ifdef WITH_HARU
|
||||
static bool wm_gpencil_export_pdf_common_check(bContext *UNUSED(C), wmOperator *op)
|
||||
static bool wm_gpencil_export_pdf_common_check(bContext * /*C*/, wmOperator *op)
|
||||
{
|
||||
|
||||
char filepath[FILE_MAX];
|
||||
@ -247,7 +249,7 @@ static bool wm_gpencil_export_pdf_common_check(bContext *UNUSED(C), wmOperator *
|
||||
return false;
|
||||
}
|
||||
|
||||
static int wm_gpencil_export_pdf_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
static int wm_gpencil_export_pdf_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
ED_fileselect_ensure_default_filepath(C, op, ".pdf");
|
||||
|
||||
@ -267,7 +269,7 @@ static int wm_gpencil_export_pdf_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
ARegion *region = get_invoke_region(C);
|
||||
if (region == NULL) {
|
||||
if (region == nullptr) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Unable to find valid 3D View area");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@ -286,20 +288,21 @@ static int wm_gpencil_export_pdf_exec(bContext *C, wmOperator *op)
|
||||
SET_FLAG_FROM_TEST(flag, use_fill, GP_EXPORT_FILL);
|
||||
SET_FLAG_FROM_TEST(flag, use_norm_thickness, GP_EXPORT_NORM_THICKNESS);
|
||||
|
||||
GpencilIOParams params = {.C = C,
|
||||
.region = region,
|
||||
.v3d = v3d,
|
||||
.ob = ob,
|
||||
.mode = GP_EXPORT_TO_PDF,
|
||||
.frame_start = scene->r.sfra,
|
||||
.frame_end = scene->r.efra,
|
||||
.frame_cur = scene->r.cfra,
|
||||
.flag = flag,
|
||||
.scale = 1.0f,
|
||||
.select_mode = select_mode,
|
||||
.frame_mode = frame_mode,
|
||||
.stroke_sample = RNA_float_get(op->ptr, "stroke_sample"),
|
||||
.resolution = 1.0f};
|
||||
GpencilIOParams params{};
|
||||
params.C = C;
|
||||
params.region = region;
|
||||
params.v3d = v3d;
|
||||
params.ob = ob;
|
||||
params.mode = GP_EXPORT_TO_PDF;
|
||||
params.frame_start = scene->r.sfra;
|
||||
params.frame_end = scene->r.efra;
|
||||
params.frame_cur = scene->r.cfra;
|
||||
params.flag = flag;
|
||||
params.scale = 1.0f;
|
||||
params.select_mode = select_mode;
|
||||
params.frame_mode = frame_mode;
|
||||
params.stroke_sample = RNA_float_get(op->ptr, "stroke_sample");
|
||||
params.resolution = 1.0f;
|
||||
|
||||
/* Do export. */
|
||||
WM_cursor_wait(true);
|
||||
@ -326,7 +329,7 @@ static void ui_gpencil_export_pdf_settings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiItemL(row, IFACE_("Scene Options"), ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(box, false);
|
||||
uiItemR(row, imfptr, "selected_object_type", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, imfptr, "selected_object_type", 0, nullptr, ICON_NONE);
|
||||
|
||||
box = uiLayoutBox(layout);
|
||||
row = uiLayoutRow(box, false);
|
||||
@ -339,19 +342,19 @@ static void ui_gpencil_export_pdf_settings(uiLayout *layout, PointerRNA *imfptr)
|
||||
uiLayoutSetPropSep(box, true);
|
||||
|
||||
sub = uiLayoutColumn(col, true);
|
||||
uiItemR(sub, imfptr, "stroke_sample", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "use_fill", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "use_normalized_thickness", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "stroke_sample", 0, nullptr, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "use_fill", 0, nullptr, ICON_NONE);
|
||||
uiItemR(sub, imfptr, "use_normalized_thickness", 0, nullptr, ICON_NONE);
|
||||
Usually I put a
{}
on the end likeAlembicExportParams params{}
to make this a bit safer if new fields are added since this type of struct usually won't have a default constructor.