mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
fix -tbnall in maya2egg
This commit is contained in:
parent
c1f598e117
commit
fc20e548d9
@ -122,7 +122,7 @@ EggVertex::
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool EggVertex::
|
bool EggVertex::
|
||||||
has_uv(const string &name) const {
|
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()) {
|
if (ui != _uv_map.end()) {
|
||||||
EggVertexUV *uv_obj = (*ui).second;
|
EggVertexUV *uv_obj = (*ui).second;
|
||||||
return !uv_obj->has_w();
|
return !uv_obj->has_w();
|
||||||
@ -139,7 +139,7 @@ has_uv(const string &name) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool EggVertex::
|
bool EggVertex::
|
||||||
has_uvw(const string &name) const {
|
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()) {
|
if (ui != _uv_map.end()) {
|
||||||
EggVertexUV *uv_obj = (*ui).second;
|
EggVertexUV *uv_obj = (*ui).second;
|
||||||
return uv_obj->has_w();
|
return uv_obj->has_w();
|
||||||
@ -156,7 +156,7 @@ has_uvw(const string &name) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
TexCoordd EggVertex::
|
TexCoordd EggVertex::
|
||||||
get_uv(const string &name) const {
|
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());
|
nassertr(ui != _uv_map.end(), TexCoordd::zero());
|
||||||
return (*ui).second->get_uv();
|
return (*ui).second->get_uv();
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ get_uv(const string &name) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
const TexCoord3d &EggVertex::
|
const TexCoord3d &EggVertex::
|
||||||
get_uvw(const string &name) const {
|
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());
|
nassertr(ui != _uv_map.end(), TexCoord3d::zero());
|
||||||
return (*ui).second->get_uvw();
|
return (*ui).second->get_uvw();
|
||||||
}
|
}
|
||||||
@ -184,16 +184,17 @@ get_uvw(const string &name) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void EggVertex::
|
void EggVertex::
|
||||||
set_uv(const string &name, const TexCoordd &uv) {
|
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()) {
|
if (uv_obj.is_null()) {
|
||||||
uv_obj = new EggVertexUV(name, uv);
|
uv_obj = new EggVertexUV(fname, uv);
|
||||||
} else {
|
} else {
|
||||||
uv_obj = new EggVertexUV(*uv_obj);
|
uv_obj = new EggVertexUV(*uv_obj);
|
||||||
uv_obj->set_uv(uv);
|
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::
|
void EggVertex::
|
||||||
set_uvw(const string &name, const TexCoord3d &uvw) {
|
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()) {
|
if (uv_obj.is_null()) {
|
||||||
uv_obj = new EggVertexUV(name, uvw);
|
uv_obj = new EggVertexUV(fname, uvw);
|
||||||
} else {
|
} else {
|
||||||
uv_obj = new EggVertexUV(*uv_obj);
|
uv_obj = new EggVertexUV(*uv_obj);
|
||||||
uv_obj->set_uvw(uvw);
|
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::
|
const EggVertexUV *EggVertex::
|
||||||
get_uv_obj(const string &name) const {
|
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()) {
|
if (ui != _uv_map.end()) {
|
||||||
return (*ui).second;
|
return (*ui).second;
|
||||||
}
|
}
|
||||||
@ -247,7 +249,7 @@ get_uv_obj(const string &name) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
EggVertexUV *EggVertex::
|
EggVertexUV *EggVertex::
|
||||||
modify_uv_obj(const string &name) {
|
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 != _uv_map.end()) {
|
||||||
if ((*ui).second->get_ref_count() != 1) {
|
if ((*ui).second->get_ref_count() != 1) {
|
||||||
// Copy on write.
|
// Copy on write.
|
||||||
@ -279,7 +281,7 @@ set_uv_obj(EggVertexUV *uv) {
|
|||||||
///////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////
|
||||||
void EggVertex::
|
void EggVertex::
|
||||||
clear_uv(const string &name) {
|
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
|
// Function: EggVertexUV::set_name
|
||||||
// Access: Public
|
// Access: Published
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE void EggVertexUV::
|
INLINE void EggVertexUV::
|
||||||
set_name(const string &name) {
|
set_name(const string &name) {
|
||||||
if (name == "default") {
|
Namable::set_name(filter_name(name));
|
||||||
clear_name();
|
|
||||||
} else {
|
|
||||||
Namable::set_name(name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -41,6 +41,7 @@ PUBLISHED:
|
|||||||
EggVertexUV &operator = (const EggVertexUV ©);
|
EggVertexUV &operator = (const EggVertexUV ©);
|
||||||
virtual ~EggVertexUV();
|
virtual ~EggVertexUV();
|
||||||
|
|
||||||
|
INLINE static string filter_name(const string &name);
|
||||||
INLINE void set_name(const string &name);
|
INLINE void set_name(const string &name);
|
||||||
|
|
||||||
INLINE int get_num_dimensions() const;
|
INLINE int get_num_dimensions() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user