forked from bartvdbraak/blender
code cleanup: collada
- when bubble sorting names - dont convert to str::string just to compare strings - use BLI_linklist_index() to check if an item is in the list - quiet some warnings
This commit is contained in:
parent
9f6a66d5f9
commit
664c95d1eb
@ -187,9 +187,12 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene *sce,
|
|||||||
node.setNodeName(node_name);
|
node.setNodeName(node_name);
|
||||||
node.setNodeSid(node_sid);
|
node.setNodeSid(node_sid);
|
||||||
|
|
||||||
/*if ( bone->childbase.first == NULL || BLI_countlist(&(bone->childbase))>=2)
|
#if 0
|
||||||
|
if (bone->childbase.first == NULL || BLI_countlist(&(bone->childbase)) >= 2) {
|
||||||
add_blender_leaf_bone( bone, ob_arm , node );
|
add_blender_leaf_bone( bone, ob_arm , node );
|
||||||
else{*/
|
}
|
||||||
|
else {
|
||||||
|
#endif
|
||||||
node.start();
|
node.start();
|
||||||
|
|
||||||
add_bone_transform(ob_arm, bone, node);
|
add_bone_transform(ob_arm, bone, node);
|
||||||
|
@ -386,7 +386,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
|
|||||||
Object *new_child = NULL;
|
Object *new_child = NULL;
|
||||||
if (inodes.getCount()) { // \todo loop through instance nodes
|
if (inodes.getCount()) { // \todo loop through instance nodes
|
||||||
const COLLADAFW::UniqueId& id = inodes[0]->getInstanciatedObjectId();
|
const COLLADAFW::UniqueId& id = inodes[0]->getInstanciatedObjectId();
|
||||||
fprintf(stderr, "Doing %d child nodes\n", node_map.count(id));
|
fprintf(stderr, "Doing %d child nodes\n", (int)node_map.count(id));
|
||||||
new_child = create_instance_node(object_map.find(id)->second, node_map[id], child_node, sce, is_library_node);
|
new_child = create_instance_node(object_map.find(id)->second, node_map[id], child_node, sce, is_library_node);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -31,8 +31,7 @@ extern "C" {
|
|||||||
#ifndef __EXPORTSETTINGS_H__
|
#ifndef __EXPORTSETTINGS_H__
|
||||||
#define __EXPORTSETTINGS_H__
|
#define __EXPORTSETTINGS_H__
|
||||||
|
|
||||||
struct ExportSettings
|
struct ExportSettings {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
bool apply_modifiers;
|
bool apply_modifiers;
|
||||||
bool selected;
|
bool selected;
|
||||||
|
@ -49,8 +49,7 @@ int collada_import(bContext *C, const char *filepath)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int collada_export(
|
int collada_export(Scene *sce,
|
||||||
Scene *sce,
|
|
||||||
const char *filepath,
|
const char *filepath,
|
||||||
|
|
||||||
int apply_modifiers,
|
int apply_modifiers,
|
||||||
|
@ -37,8 +37,7 @@ extern "C" {
|
|||||||
* both return 1 on success, 0 on error
|
* both return 1 on success, 0 on error
|
||||||
*/
|
*/
|
||||||
int collada_import(bContext *C, const char *filepath);
|
int collada_import(bContext *C, const char *filepath);
|
||||||
int collada_export(
|
int collada_export(Scene *sce,
|
||||||
Scene *sce,
|
|
||||||
const char *filepath,
|
const char *filepath,
|
||||||
int apply_modifiers,
|
int apply_modifiers,
|
||||||
|
|
||||||
|
@ -193,30 +193,19 @@ bool bc_is_base_node(LinkNode *export_set, Object *ob)
|
|||||||
|
|
||||||
bool bc_is_in_Export_set(LinkNode *export_set, Object *ob)
|
bool bc_is_in_Export_set(LinkNode *export_set, Object *ob)
|
||||||
{
|
{
|
||||||
LinkNode *node = export_set;
|
return (BLI_linklist_index(export_set, ob) != -1);
|
||||||
|
|
||||||
while (node) {
|
|
||||||
Object *element = (Object *)node->link;
|
|
||||||
|
|
||||||
if (element == ob)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
node= node->next;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bc_has_object_type(LinkNode *export_set, short obtype)
|
bool bc_has_object_type(LinkNode *export_set, short obtype)
|
||||||
{
|
{
|
||||||
LinkNode *node = export_set;
|
LinkNode *node;
|
||||||
|
|
||||||
while (node) {
|
for (node = export_set; node; node = node->next) {
|
||||||
Object *ob = (Object *)node->link;
|
Object *ob = (Object *)node->link;
|
||||||
|
/* XXX - why is this checking for ob->data? - we could be looking for empties */
|
||||||
if (ob->type == obtype && ob->data) {
|
if (ob->type == obtype && ob->data) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
node= node->next;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -245,10 +234,7 @@ void bc_bubble_sort_by_Object_name(LinkNode *export_set)
|
|||||||
Object *a = (Object *)current->link;
|
Object *a = (Object *)current->link;
|
||||||
Object *b = (Object *)current->next->link;
|
Object *b = (Object *)current->next->link;
|
||||||
|
|
||||||
std::string str_a (a->id.name);
|
if (strcmp(a->id.name, b->id.name) > 0) {
|
||||||
std::string str_b (b->id.name);
|
|
||||||
|
|
||||||
if (str_a.compare(str_b) > 0) {
|
|
||||||
current->link = b;
|
current->link = b;
|
||||||
current->next->link = a;
|
current->next->link = a;
|
||||||
sorted = false;
|
sorted = false;
|
||||||
@ -272,7 +258,7 @@ bool bc_is_root_bone(Bone *aBone, bool deform_bones_only) {
|
|||||||
root = bone;
|
root = bone;
|
||||||
bone = bone->parent;
|
bone = bone->parent;
|
||||||
}
|
}
|
||||||
return aBone==root;
|
return (aBone == root);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return !(aBone->parent);
|
return !(aBone->parent);
|
||||||
|
@ -2213,8 +2213,6 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
||||||
{
|
{
|
||||||
ID *id = imfptr->id.data;
|
|
||||||
|
|
||||||
uiLayout *box, *row;
|
uiLayout *box, *row;
|
||||||
|
|
||||||
// Export Options:
|
// Export Options:
|
||||||
@ -2253,7 +2251,7 @@ void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wm_collada_export_draw(bContext *C, wmOperator *op)
|
static void wm_collada_export_draw(bContext *UNUSED(C), wmOperator *op)
|
||||||
{
|
{
|
||||||
PointerRNA ptr;
|
PointerRNA ptr;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user