mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
fix -tbnall in maya2egg
This commit is contained in:
parent
c1f598e117
commit
fc20e548d9
@ -122,7 +122,7 @@ EggVertex::
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool EggVertex::
|
||||
has_uv(const string &name) const {
|
||||
UVMap::const_iterator ui = _uv_map.find(name);
|
||||
UVMap::const_iterator ui = _uv_map.find(EggVertexUV::filter_name(name));
|
||||
if (ui != _uv_map.end()) {
|
||||
EggVertexUV *uv_obj = (*ui).second;
|
||||
return !uv_obj->has_w();
|
||||
@ -139,7 +139,7 @@ has_uv(const string &name) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool EggVertex::
|
||||
has_uvw(const string &name) const {
|
||||
UVMap::const_iterator ui = _uv_map.find(name);
|
||||
UVMap::const_iterator ui = _uv_map.find(EggVertexUV::filter_name(name));
|
||||
if (ui != _uv_map.end()) {
|
||||
EggVertexUV *uv_obj = (*ui).second;
|
||||
return uv_obj->has_w();
|
||||
@ -156,7 +156,7 @@ has_uvw(const string &name) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
TexCoordd EggVertex::
|
||||
get_uv(const string &name) const {
|
||||
UVMap::const_iterator ui = _uv_map.find(name);
|
||||
UVMap::const_iterator ui = _uv_map.find(EggVertexUV::filter_name(name));
|
||||
nassertr(ui != _uv_map.end(), TexCoordd::zero());
|
||||
return (*ui).second->get_uv();
|
||||
}
|
||||
@ -170,7 +170,7 @@ get_uv(const string &name) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
const TexCoord3d &EggVertex::
|
||||
get_uvw(const string &name) const {
|
||||
UVMap::const_iterator ui = _uv_map.find(name);
|
||||
UVMap::const_iterator ui = _uv_map.find(EggVertexUV::filter_name(name));
|
||||
nassertr(ui != _uv_map.end(), TexCoord3d::zero());
|
||||
return (*ui).second->get_uvw();
|
||||
}
|
||||
@ -184,16 +184,17 @@ get_uvw(const string &name) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void EggVertex::
|
||||
set_uv(const string &name, const TexCoordd &uv) {
|
||||
PT(EggVertexUV) &uv_obj = _uv_map[name];
|
||||
string fname = EggVertexUV::filter_name(name);
|
||||
PT(EggVertexUV) &uv_obj = _uv_map[fname];
|
||||
|
||||
if (uv_obj.is_null()) {
|
||||
uv_obj = new EggVertexUV(name, uv);
|
||||
uv_obj = new EggVertexUV(fname, uv);
|
||||
} else {
|
||||
uv_obj = new EggVertexUV(*uv_obj);
|
||||
uv_obj->set_uv(uv);
|
||||
}
|
||||
|
||||
nassertv(get_uv(name) == uv);
|
||||
nassertv(get_uv(fname) == uv);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -206,16 +207,17 @@ set_uv(const string &name, const TexCoordd &uv) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void EggVertex::
|
||||
set_uvw(const string &name, const TexCoord3d &uvw) {
|
||||
PT(EggVertexUV) &uv_obj = _uv_map[name];
|
||||
string fname = EggVertexUV::filter_name(name);
|
||||
PT(EggVertexUV) &uv_obj = _uv_map[fname];
|
||||
|
||||
if (uv_obj.is_null()) {
|
||||
uv_obj = new EggVertexUV(name, uvw);
|
||||
uv_obj = new EggVertexUV(fname, uvw);
|
||||
} else {
|
||||
uv_obj = new EggVertexUV(*uv_obj);
|
||||
uv_obj->set_uvw(uvw);
|
||||
}
|
||||
|
||||
nassertv(get_uvw(name) == uvw);
|
||||
nassertv(get_uvw(fname) == uvw);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -230,7 +232,7 @@ set_uvw(const string &name, const TexCoord3d &uvw) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
const EggVertexUV *EggVertex::
|
||||
get_uv_obj(const string &name) const {
|
||||
UVMap::const_iterator ui = _uv_map.find(name);
|
||||
UVMap::const_iterator ui = _uv_map.find(EggVertexUV::filter_name(name));
|
||||
if (ui != _uv_map.end()) {
|
||||
return (*ui).second;
|
||||
}
|
||||
@ -247,7 +249,7 @@ get_uv_obj(const string &name) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
EggVertexUV *EggVertex::
|
||||
modify_uv_obj(const string &name) {
|
||||
UVMap::iterator ui = _uv_map.find(name);
|
||||
UVMap::iterator ui = _uv_map.find(EggVertexUV::filter_name(name));
|
||||
if (ui != _uv_map.end()) {
|
||||
if ((*ui).second->get_ref_count() != 1) {
|
||||
// Copy on write.
|
||||
@ -279,7 +281,7 @@ set_uv_obj(EggVertexUV *uv) {
|
||||
///////////////////////////////////////////////////////////////////
|
||||
void EggVertex::
|
||||
clear_uv(const string &name) {
|
||||
_uv_map.erase(name);
|
||||
_uv_map.erase(EggVertexUV::filter_name(name));
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,18 +17,31 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggVertexUV::filter_name
|
||||
// Access: Published, Static
|
||||
// Description: Returns the actual name that should be set for a
|
||||
// given name string. Usually this is the same string
|
||||
// that is input, but for historical reasons the texture
|
||||
// coordinate name "default" is mapped to the empty
|
||||
// string.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE string EggVertexUV::
|
||||
filter_name(const string &name) {
|
||||
if (name == "default") {
|
||||
return string();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggVertexUV::set_name
|
||||
// Access: Public
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void EggVertexUV::
|
||||
set_name(const string &name) {
|
||||
if (name == "default") {
|
||||
clear_name();
|
||||
} else {
|
||||
Namable::set_name(name);
|
||||
}
|
||||
Namable::set_name(filter_name(name));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -41,6 +41,7 @@ PUBLISHED:
|
||||
EggVertexUV &operator = (const EggVertexUV ©);
|
||||
virtual ~EggVertexUV();
|
||||
|
||||
INLINE static string filter_name(const string &name);
|
||||
INLINE void set_name(const string &name);
|
||||
|
||||
INLINE int get_num_dimensions() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user