me-main #1

Merged
Nate Rupsis merged 123 commits from me-main into main 2023-02-13 18:39:11 +01:00
6 changed files with 11 additions and 11 deletions
Showing only changes of commit 343bb4a5a3 - Show all commits

View File

@ -109,7 +109,7 @@ extern "C" char build_hash[];
#include <cerrno> #include <cerrno>
char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n) const char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n)
{ {
int layer_index = CustomData_get_layer_index(data, type); int layer_index = CustomData_get_layer_index(data, type);
if (layer_index < 0) { if (layer_index < 0) {
@ -119,7 +119,7 @@ char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int
return data->layers[layer_index + n].name; return data->layers[layer_index + n].name;
} }
char *bc_CustomData_get_active_layer_name(const CustomData *data, int type) const char *bc_CustomData_get_active_layer_name(const CustomData *data, int type)
{ {
/* get the layer index of the active layer of type */ /* get the layer index of the active layer of type */
int layer_index = CustomData_get_active_layer_index(data, type); int layer_index = CustomData_get_active_layer_index(data, type);

View File

@ -312,7 +312,7 @@ static bool collect_vertex_counts_per_poly(Mesh *me,
return is_triangulated; return is_triangulated;
} }
std::string GeometryExporter::makeVertexColorSourceId(std::string &geom_id, char *layer_name) std::string GeometryExporter::makeVertexColorSourceId(std::string &geom_id, const char *layer_name)
{ {
std::string result = getIdBySemantics(geom_id, COLLADASW::InputSemantic::COLOR) + "-" + std::string result = getIdBySemantics(geom_id, COLLADASW::InputSemantic::COLOR) + "-" +
layer_name; layer_name;
@ -390,7 +390,7 @@ void GeometryExporter::create_mesh_primitive_list(short material_index,
int map_index = 0; int map_index = 0;
for (int a = 0; a < totlayer_mcol; a++) { for (int a = 0; a < totlayer_mcol; a++) {
char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_BYTE_COLOR, a); const char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_BYTE_COLOR, a);
COLLADASW::Input input4(COLLADASW::InputSemantic::COLOR, COLLADASW::Input input4(COLLADASW::InputSemantic::COLOR,
makeUrl(makeVertexColorSourceId(geom_id, layer_name)), makeUrl(makeVertexColorSourceId(geom_id, layer_name)),
(has_uvs) ? 3 : 2, /* all color layers have same index order */ (has_uvs) ? 3 : 2, /* all color layers have same index order */
@ -489,7 +489,7 @@ void GeometryExporter::createVertexColorSource(std::string geom_id, Mesh *me)
COLLADASW::FloatSourceF source(mSW); COLLADASW::FloatSourceF source(mSW);
char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_BYTE_COLOR, a); const char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_BYTE_COLOR, a);
std::string layer_id = makeVertexColorSourceId(geom_id, layer_name); std::string layer_id = makeVertexColorSourceId(geom_id, layer_name);
source.setId(layer_id); source.setId(layer_id);

View File

@ -87,7 +87,7 @@ class GeometryExporter : COLLADASW::LibraryGeometries {
std::string getIdBySemantics(std::string geom_id, std::string getIdBySemantics(std::string geom_id,
COLLADASW::InputSemantic::Semantics type, COLLADASW::InputSemantic::Semantics type,
std::string other_suffix = ""); std::string other_suffix = "");
std::string makeVertexColorSourceId(std::string &geom_id, char *layer_name); std::string makeVertexColorSourceId(std::string &geom_id, const char *layer_name);
COLLADASW::URI getUrlBySemantics(std::string geom_id, COLLADASW::URI getUrlBySemantics(std::string geom_id,
COLLADASW::InputSemantic::Semantics type, COLLADASW::InputSemantic::Semantics type,

View File

@ -44,7 +44,7 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial &bind_materia
int active_uv_index = CustomData_get_active_layer_index(&me->ldata, CD_PROP_FLOAT2); int active_uv_index = CustomData_get_active_layer_index(&me->ldata, CD_PROP_FLOAT2);
for (int b = 0; b < num_layers; b++) { for (int b = 0; b < num_layers; b++) {
if (!active_uv_only || b == active_uv_index) { if (!active_uv_only || b == active_uv_index) {
char *name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_FLOAT2, b); const char *name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_FLOAT2, b);
im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", map_index++)); im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", map_index++));
} }
} }

View File

@ -1076,7 +1076,7 @@ static std::string bc_get_active_uvlayer_name(Mesh *me)
{ {
int num_layers = CustomData_number_of_layers(&me->ldata, CD_PROP_FLOAT2); int num_layers = CustomData_number_of_layers(&me->ldata, CD_PROP_FLOAT2);
if (num_layers) { if (num_layers) {
char *layer_name = bc_CustomData_get_active_layer_name(&me->ldata, CD_PROP_FLOAT2); const char *layer_name = bc_CustomData_get_active_layer_name(&me->ldata, CD_PROP_FLOAT2);
if (layer_name) { if (layer_name) {
return std::string(layer_name); return std::string(layer_name);
} }
@ -1101,7 +1101,7 @@ static std::string bc_get_uvlayer_name(Mesh *me, int layer)
{ {
int num_layers = CustomData_number_of_layers(&me->ldata, CD_PROP_FLOAT2); int num_layers = CustomData_number_of_layers(&me->ldata, CD_PROP_FLOAT2);
if (num_layers && layer < num_layers) { if (num_layers && layer < num_layers) {
char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_FLOAT2, layer); const char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_FLOAT2, layer);
if (layer_name) { if (layer_name) {
return std::string(layer_name); return std::string(layer_name);
} }

View File

@ -125,8 +125,8 @@ extern Mesh *bc_get_mesh_copy(BlenderContext &blender_context,
extern Object *bc_get_assigned_armature(Object *ob); extern Object *bc_get_assigned_armature(Object *ob);
extern bool bc_has_object_type(LinkNode *export_set, short obtype); extern bool bc_has_object_type(LinkNode *export_set, short obtype);
extern char *bc_CustomData_get_layer_name(const CustomData *data, int type, int n); extern const char *bc_CustomData_get_layer_name(const CustomData *data, int type, int n);
extern char *bc_CustomData_get_active_layer_name(const CustomData *data, int type); extern const char *bc_CustomData_get_active_layer_name(const CustomData *data, int type);
extern void bc_bubble_sort_by_Object_name(LinkNode *export_set); extern void bc_bubble_sort_by_Object_name(LinkNode *export_set);
/** /**