Skip to content

Commit 4366561

Browse files
chellmuthChris Hellmuth
authored andcommitted
Switch from isDefault to isAuthoredValue
1 parent 11fa751 commit 4366561

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

source/MaterialXGenOslNetwork/OslNetworkShaderGenerator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ ShaderPtr OslNetworkShaderGenerator::generate(const string& name, ElementPtr ele
6565

6666
const ShaderOutput* connection = input->getConnection();
6767
if (!connection || connection->getNode() == &graph) {
68-
if (input->isDefault())
68+
if (!input->isAuthoredValue())
6969
continue;
7070

7171
if (input->getName() == "backsurfaceshader"
7272
|| input->getName() == "displacementshader")
73-
continue; // FIXME: these aren't getting pruned by isDefault
73+
continue; // FIXME: these aren't getting pruned by isAuthoredValue
7474

7575
string value = _syntax->getValue(input);
7676
if (value == "null_closure()")

source/MaterialXGenShader/ShaderNode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,14 @@ ShaderNodePtr ShaderNode::create(const ShaderGraph* parent, const string& name,
199199
if (context.getShaderGenerator().getSyntax().remapEnumeration(portValue, portType, enumNames, enumResult))
200200
{
201201
input = newNode->addInput(port->getName(), enumResult.first);
202-
input->setValue(enumResult.second, true);
202+
input->setValue(enumResult.second, false);
203203
}
204204
else
205205
{
206206
input = newNode->addInput(port->getName(), portType);
207207
if (!portValue.empty())
208208
{
209-
input->setValue(port->getResolvedValue(), true);
209+
input->setValue(port->getResolvedValue(), false);
210210
}
211211
}
212212
if (port->getIsUniform())

source/MaterialXGenShader/ShaderNode.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,17 @@ class MX_GENSHADER_API ShaderPort : public std::enable_shared_from_this<ShaderPo
165165
const string& getSemantic() const { return _semantic; }
166166

167167
/// Set a value on this port.
168-
void setValue(ValuePtr value, bool isDefault = false) { _value = value; _isDefault = isDefault; }
168+
void setValue(ValuePtr value, bool isAuthoredValue = true)
169+
{
170+
_value = value;
171+
_isAuthoredValue = isAuthoredValue;
172+
}
169173

170174
/// Return the value set on this port.
171175
ValuePtr getValue() const { return _value; }
172176

173-
// Is the value still its default.
174-
bool isDefault() const { return _isDefault; }
177+
// Has the value been overridden.
178+
bool isAuthoredValue() const { return _isAuthoredValue; }
175179

176180
/// Return the value set on this port as a string, or an empty string if there is no value.
177181
string getValueString() const;
@@ -259,7 +263,7 @@ class MX_GENSHADER_API ShaderPort : public std::enable_shared_from_this<ShaderPo
259263
string _geomprop;
260264
ShaderMetadataVecPtr _metadata;
261265
uint32_t _flags;
262-
bool _isDefault{false};
266+
bool _isAuthoredValue{false};
263267
};
264268

265269
/// @class ShaderInput

0 commit comments

Comments
 (0)