mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
remove backstage object before palettizing
This commit is contained in:
parent
3be7a57292
commit
7125ac9121
@ -25,14 +25,15 @@
|
||||
#include "palettizer.h"
|
||||
#include "filenameUnifier.h"
|
||||
|
||||
#include <eggData.h>
|
||||
#include <eggTextureCollection.h>
|
||||
#include <datagram.h>
|
||||
#include <datagramIterator.h>
|
||||
#include <bamReader.h>
|
||||
#include <bamWriter.h>
|
||||
#include <executionEnvironment.h>
|
||||
#include <dSearchPath.h>
|
||||
#include "eggData.h"
|
||||
#include "eggGroup.h"
|
||||
#include "eggTextureCollection.h"
|
||||
#include "datagram.h"
|
||||
#include "datagramIterator.h"
|
||||
#include "bamReader.h"
|
||||
#include "bamWriter.h"
|
||||
#include "executionEnvironment.h"
|
||||
#include "dSearchPath.h"
|
||||
|
||||
TypeHandle EggFile::_type_handle;
|
||||
|
||||
@ -449,6 +450,8 @@ read_egg() {
|
||||
}
|
||||
|
||||
_data = data;
|
||||
remove_backstage(_data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -515,6 +518,41 @@ write_texture_refs(ostream &out, int indent_level) const {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggFile::remove_backstage
|
||||
// Access: Private
|
||||
// Description: Recursively walks the egg hierarchy and removes any
|
||||
// "backstage" nodes found from the scene graph
|
||||
// completely. These aren't part of the egg scene
|
||||
// anyway, and removing them early helps reduce
|
||||
// confusion.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void EggFile::
|
||||
remove_backstage(EggGroupNode *node) {
|
||||
EggGroupNode::iterator ci;
|
||||
ci = node->begin();
|
||||
while (ci != node->end()) {
|
||||
EggNode *child = (*ci);
|
||||
bool remove_child = false;
|
||||
|
||||
if (child->is_of_type(EggGroup::get_class_type())) {
|
||||
EggGroup *egg_group;
|
||||
DCAST_INTO_V(egg_group, child);
|
||||
remove_child = egg_group->has_object_type("backstage");
|
||||
}
|
||||
|
||||
if (remove_child) {
|
||||
ci = node->erase(ci);
|
||||
} else {
|
||||
if (child->is_of_type(EggGroupNode::get_class_type())) {
|
||||
// Recurse on children.
|
||||
remove_backstage(DCAST(EggGroupNode, child));
|
||||
}
|
||||
++ci;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggFile::register_with_read_factory
|
||||
// Access: Public, Static
|
||||
|
@ -79,6 +79,9 @@ public:
|
||||
void write_description(ostream &out, int indent_level = 0) const;
|
||||
void write_texture_refs(ostream &out, int indent_level = 0) const;
|
||||
|
||||
private:
|
||||
void remove_backstage(EggGroupNode *node);
|
||||
|
||||
private:
|
||||
EggData *_data;
|
||||
Filename _current_directory;
|
||||
|
@ -445,13 +445,6 @@ get_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) {
|
||||
if (group->is_of_type(EggGroup::get_class_type())) {
|
||||
EggGroup *egg_group;
|
||||
DCAST_INTO_V(egg_group, group);
|
||||
for (int i = 0; i < egg_group->get_num_object_types(); i++) {
|
||||
if (cmp_nocase_uh(egg_group->get_object_type(i), "backstage") == 0) {
|
||||
// If we reach a <Group> node with the "backstage" flag set,
|
||||
// ignore it and everything under it.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (egg_group->get_dart_type() != EggGroup::DT_none) {
|
||||
// If it's a character, we might change the kind of remapping we
|
||||
@ -541,13 +534,6 @@ update_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) {
|
||||
if (group->is_of_type(EggGroup::get_class_type())) {
|
||||
EggGroup *egg_group;
|
||||
DCAST_INTO_V(egg_group, group);
|
||||
for (int i = 0; i < egg_group->get_num_object_types(); i++) {
|
||||
if (cmp_nocase_uh(egg_group->get_object_type(i), "backstage") == 0) {
|
||||
// If we reach a <Group> node with the "backstage" flag set,
|
||||
// ignore it and everything under it.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (egg_group->get_dart_type() != EggGroup::DT_none) {
|
||||
// If it's a character, we might change the kind of remapping we
|
||||
|
Loading…
x
Reference in New Issue
Block a user