mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
ignore directories as texture filenames
This commit is contained in:
parent
60193c50ae
commit
c292cfc628
@ -166,7 +166,7 @@ read_surface_shader(MObject shader) {
|
|||||||
color_plug.connectedTo(color_pa, true, false);
|
color_plug.connectedTo(color_pa, true, false);
|
||||||
|
|
||||||
for (size_t i = 0; i < color_pa.length(); i++) {
|
for (size_t i = 0; i < color_pa.length(); i++) {
|
||||||
_color.read_surface_color(color_pa[0].node());
|
_color.read_surface_color(this, color_pa[0].node());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ read_surface_shader(MObject shader) {
|
|||||||
trans_plug.connectedTo(trans_pa, true, false);
|
trans_plug.connectedTo(trans_pa, true, false);
|
||||||
|
|
||||||
for (size_t i = 0; i < trans_pa.length(); i++) {
|
for (size_t i = 0; i < trans_pa.length(); i++) {
|
||||||
_transparency.read_surface_color(trans_pa[0].node());
|
_transparency.read_surface_color(this, trans_pa[0].node());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "mayaShaderColorDef.h"
|
#include "mayaShaderColorDef.h"
|
||||||
|
#include "mayaShader.h"
|
||||||
#include "maya_funcs.h"
|
#include "maya_funcs.h"
|
||||||
#include "config_maya.h"
|
#include "config_maya.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
@ -181,7 +182,7 @@ reset_maya_texture(const Filename &texture) {
|
|||||||
// properties.
|
// properties.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void MayaShaderColorDef::
|
void MayaShaderColorDef::
|
||||||
read_surface_color(MObject color) {
|
read_surface_color(const MayaShader *shader, MObject color) {
|
||||||
RGBColorf color_gain;
|
RGBColorf color_gain;
|
||||||
if (get_vec3f_attribute(color, "colorGain", color_gain)) {
|
if (get_vec3f_attribute(color, "colorGain", color_gain)) {
|
||||||
_color_gain[0] *= color_gain[0];
|
_color_gain[0] *= color_gain[0];
|
||||||
@ -199,6 +200,13 @@ read_surface_color(MObject color) {
|
|||||||
_has_texture = get_string_attribute(color, "fileTextureName", filename);
|
_has_texture = get_string_attribute(color, "fileTextureName", filename);
|
||||||
if (_has_texture) {
|
if (_has_texture) {
|
||||||
_texture = Filename::from_os_specific(filename);
|
_texture = Filename::from_os_specific(filename);
|
||||||
|
if (_texture.is_directory()) {
|
||||||
|
maya_cat.warning()
|
||||||
|
<< "Shader " << shader->get_name()
|
||||||
|
<< " references texture filename " << filename
|
||||||
|
<< " which is a directory; ignoring.\n";
|
||||||
|
_has_texture = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get_vec2f_attribute(color, "coverage", _coverage);
|
get_vec2f_attribute(color, "coverage", _coverage);
|
||||||
@ -224,7 +232,7 @@ read_surface_color(MObject color) {
|
|||||||
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++) {
|
||||||
read_surface_color(image_pa[0].node());
|
read_surface_color(shader, image_pa[0].node());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "lmatrix.h"
|
#include "lmatrix.h"
|
||||||
|
|
||||||
class MObject;
|
class MObject;
|
||||||
|
class MayaShader;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : MayaShaderColorDef
|
// Class : MayaShaderColorDef
|
||||||
@ -82,7 +83,7 @@ public:
|
|||||||
double _rotate_uv;
|
double _rotate_uv;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void read_surface_color(MObject color);
|
void read_surface_color(const MayaShader *shader, MObject color);
|
||||||
void set_projection_type(const string &type);
|
void set_projection_type(const string &type);
|
||||||
|
|
||||||
LPoint2d map_planar(const LPoint3d &pos, const LPoint3d ¢roid) const;
|
LPoint2d map_planar(const LPoint3d &pos, const LPoint3d ¢roid) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user