|
@@ -266,7 +266,7 @@ get_panda_uvset_name() {
|
|
|
// properties.
|
|
// properties.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void MayaShaderColorDef::
|
|
void MayaShaderColorDef::
|
|
|
-find_textures_legacy(MayaShader *shader, MObject color, bool _texture_copy, Filename _texture_out_dir, bool trans) {
|
|
|
|
|
|
|
+find_textures_legacy(MayaShader *shader, MObject color, bool trans) {
|
|
|
LRGBColor color_gain;
|
|
LRGBColor color_gain;
|
|
|
if (get_vec3_attribute(color, "colorGain", color_gain)) {
|
|
if (get_vec3_attribute(color, "colorGain", color_gain)) {
|
|
|
color_gain[0] = color_gain[0] > 1.0 ? 1.0 : color_gain[0];
|
|
color_gain[0] = color_gain[0] > 1.0 ? 1.0 : color_gain[0];
|
|
@@ -302,23 +302,6 @@ find_textures_legacy(MayaShader *shader, MObject color, bool _texture_copy, File
|
|
|
_has_texture = false;
|
|
_has_texture = false;
|
|
|
set_string_attribute(color, "fileTextureName", "");
|
|
set_string_attribute(color, "fileTextureName", "");
|
|
|
}
|
|
}
|
|
|
- // create directory, copy texture, modify texture filename
|
|
|
|
|
- if (_texture_copy) {
|
|
|
|
|
- if (_texture_out_dir[_texture_out_dir.length()-1] != '/')
|
|
|
|
|
- _texture_out_dir+="/";
|
|
|
|
|
- _texture_out_dir.make_dir();
|
|
|
|
|
- Filename texture_copy_filename=Filename(_texture_out_dir, _texture_filename.get_basename());
|
|
|
|
|
- if (_texture_filename.copy_to(texture_copy_filename)) {
|
|
|
|
|
- _texture_filename=texture_copy_filename;
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- maya_cat.warning()
|
|
|
|
|
- <<"unable to copy texture files from "<<_texture_filename.get_dirname()
|
|
|
|
|
- <<" to "<<_texture_out_dir<<"\n"
|
|
|
|
|
- <<"make sure you have the access right to the assigned directory\n"
|
|
|
|
|
- <<"the output egg file will adapt to the original texture files' path\n";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
get_vec2_attribute(color, "coverage", _coverage);
|
|
get_vec2_attribute(color, "coverage", _coverage);
|
|
@@ -356,7 +339,7 @@ find_textures_legacy(MayaShader *shader, MObject color, bool _texture_copy, File
|
|
|
image_plug.connectedTo(image_pa, true, false);
|
|
image_plug.connectedTo(image_pa, true, false);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < image_pa.length(); i++) {
|
|
for (size_t i = 0; i < image_pa.length(); i++) {
|
|
|
- find_textures_legacy(shader, image_pa[0].node(), _texture_copy, _texture_out_dir);
|
|
|
|
|
|
|
+ find_textures_legacy(shader, image_pa[0].node());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -463,7 +446,7 @@ find_textures_legacy(MayaShader *shader, MObject color, bool _texture_copy, File
|
|
|
maya_cat.debug() << pl.name().asChar() << " next:connectedTo: " << pla_name << endl;
|
|
maya_cat.debug() << pl.name().asChar() << " next:connectedTo: " << pla_name << endl;
|
|
|
}
|
|
}
|
|
|
MayaShaderColorDef *color_p = new MayaShaderColorDef;
|
|
MayaShaderColorDef *color_p = new MayaShaderColorDef;
|
|
|
- color_p->find_textures_legacy(shader, pla[j].node(), _texture_copy, _texture_out_dir);
|
|
|
|
|
|
|
+ color_p->find_textures_legacy(shader, pla[j].node());
|
|
|
color_p->_blend_type = bt;
|
|
color_p->_blend_type = bt;
|
|
|
size_t loc = color_p->_texture_name.find('.',0);
|
|
size_t loc = color_p->_texture_name.find('.',0);
|
|
|
if (loc != string::npos) {
|
|
if (loc != string::npos) {
|
|
@@ -477,7 +460,7 @@ find_textures_legacy(MayaShader *shader, MObject color, bool _texture_copy, File
|
|
|
if (maya_cat.is_debug()) {
|
|
if (maya_cat.is_debug()) {
|
|
|
maya_cat.debug() << pl.name().asChar() << " first:connectedTo: " << pla_name << endl;
|
|
maya_cat.debug() << pl.name().asChar() << " first:connectedTo: " << pla_name << endl;
|
|
|
}
|
|
}
|
|
|
- find_textures_legacy(shader, pla[j].node(), _texture_copy, _texture_out_dir);
|
|
|
|
|
|
|
+ find_textures_legacy(shader, pla[j].node());
|
|
|
_texture_name.assign(pla[j].name().asChar());
|
|
_texture_name.assign(pla[j].name().asChar());
|
|
|
_blend_type = bt;
|
|
_blend_type = bt;
|
|
|
size_t loc = _texture_name.find('.',0);
|
|
size_t loc = _texture_name.find('.',0);
|
|
@@ -519,7 +502,7 @@ find_textures_legacy(MayaShader *shader, MObject color, bool _texture_copy, File
|
|
|
// to the provided MayaShaderColorList.
|
|
// to the provided MayaShaderColorList.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void MayaShaderColorDef::
|
|
void MayaShaderColorDef::
|
|
|
-find_textures_modern(const string &shadername, MayaShaderColorList &list, MPlug inplug,bool _texture_copy, Filename _texture_out_dir, bool is_alpha) {
|
|
|
|
|
|
|
+find_textures_modern(const string &shadername, MayaShaderColorList &list, MPlug inplug, bool is_alpha) {
|
|
|
|
|
|
|
|
MPlugArray outplugs;
|
|
MPlugArray outplugs;
|
|
|
inplug.connectedTo(outplugs, true, false);
|
|
inplug.connectedTo(outplugs, true, false);
|
|
@@ -558,24 +541,6 @@ find_textures_modern(const string &shadername, MayaShaderColorList &list, MPlug
|
|
|
|
|
|
|
|
def->_color_object = new MObject(source);
|
|
def->_color_object = new MObject(source);
|
|
|
def->_texture_filename = Filename::from_os_specific(filename);
|
|
def->_texture_filename = Filename::from_os_specific(filename);
|
|
|
- // create directory, copy texture, modify texture filename
|
|
|
|
|
- if (_texture_copy) {
|
|
|
|
|
- if (_texture_out_dir[_texture_out_dir.length()-1] != '/') {
|
|
|
|
|
- _texture_out_dir+="/";
|
|
|
|
|
- }
|
|
|
|
|
- _texture_out_dir.make_dir();
|
|
|
|
|
- Filename texture_copy_filename=Filename(_texture_out_dir, def->_texture_filename.get_basename());
|
|
|
|
|
- if (def->_texture_filename.copy_to(texture_copy_filename)) {
|
|
|
|
|
- def->_texture_filename=texture_copy_filename;
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- maya_cat.warning()
|
|
|
|
|
- <<"unable to copy texture files from "<<def->_texture_filename.get_dirname()
|
|
|
|
|
- <<" to "<<_texture_out_dir<<"\n"
|
|
|
|
|
- <<"make sure you have the access right to the assigned directory\n"
|
|
|
|
|
- <<"the output egg file will adapt to the original texture files' path\n";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
def->_texture_name = sourceFn.name().asChar();
|
|
def->_texture_name = sourceFn.name().asChar();
|
|
|
|
|
|
|
|
get_vec2_attribute(source, "coverage", def->_coverage);
|
|
get_vec2_attribute(source, "coverage", def->_coverage);
|
|
@@ -620,7 +585,7 @@ find_textures_modern(const string &shadername, MayaShaderColorList &list, MPlug
|
|
|
image_plug.connectedTo(image_pa, true, false);
|
|
image_plug.connectedTo(image_pa, true, false);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < image_pa.length(); i++) {
|
|
for (size_t i = 0; i < image_pa.length(); i++) {
|
|
|
- find_textures_modern(shadername, list, image_pa[0], _texture_copy, _texture_out_dir, is_alpha);
|
|
|
|
|
|
|
+ find_textures_modern(shadername, list, image_pa[0], is_alpha);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -672,7 +637,7 @@ find_textures_modern(const string &shadername, MayaShaderColorList &list, MPlug
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
size_t before = list.size();
|
|
size_t before = list.size();
|
|
|
- find_textures_modern(shadername, list, color, _texture_copy, _texture_out_dir, is_alpha);
|
|
|
|
|
|
|
+ find_textures_modern(shadername, list, color, is_alpha);
|
|
|
int blendValue;
|
|
int blendValue;
|
|
|
blend.getValue(blendValue);
|
|
blend.getValue(blendValue);
|
|
|
for (size_t sub=before; sub<list.size(); sub++) {
|
|
for (size_t sub=before; sub<list.size(); sub++) {
|
|
@@ -689,7 +654,7 @@ find_textures_modern(const string &shadername, MayaShaderColorList &list, MPlug
|
|
|
|
|
|
|
|
if (source.apiType() == MFn::kReverse) {
|
|
if (source.apiType() == MFn::kReverse) {
|
|
|
MPlug input_plug = sourceFn.findPlug("input");
|
|
MPlug input_plug = sourceFn.findPlug("input");
|
|
|
- find_textures_modern(shadername, list, input_plug, _texture_copy, _texture_out_dir, is_alpha);
|
|
|
|
|
|
|
+ find_textures_modern(shadername, list, input_plug, is_alpha);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|