MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/MaterialX / _writeImageImplementation

Function _writeImageImplementation

python/Scripts/genmdl.py:129–152  ·  view source on GitHub ↗
(file, outputType)

Source from the content-addressed store, hash-verified

127
128# Basic template for writing out logic for "image" node definition
129def _writeImageImplementation(file, outputType):
130 file.write(INDENT + 'if ( mxp_uaddressmode == mx_addressmode_type_constant\n')
131 file.write(INDENT + ' && ( mxp_texcoord.x < 0.0 || mxp_texcoord.x > 1.0))\n')
132 file.write(INDENT + INDENT + 'return mxp_default;\n')
133 file.write(INDENT + 'if ( mxp_vaddressmode == mx_addressmode_type_constant\n')
134 file.write(INDENT + ' && ( mxp_texcoord.y < 0.0 || mxp_texcoord.y > 1.0))\n')
135 file.write(INDENT + INDENT + 'return mxp_default;\n\n')
136
137 file.write(INDENT + outputType + ' returnValue')
138 isColor4 = (outputType == 'color4')
139 if isColor4:
140 outputType = 'float4'
141 outputType = 'mk_color4( ::tex::lookup_' + outputType
142 else:
143 outputType = '::tex::lookup_' + outputType
144 outputValue = 'tex: mxp_file, \n' \
145 + INDENT*6 + 'coord: mxp_texcoord,\n' \
146 + INDENT*6 + 'wrap_u: map_addressmode(mxp_uaddressmode),\n' \
147 + INDENT*6 + 'wrap_v: map_addressmode(mxp_vaddressmode)'
148 _writeValueAssignment(file, outputValue, outputType, True)
149 if isColor4:
150 file.write(')')
151 file.write(';\n')
152 file.write(INDENT + 'return returnValue;\n')
153
154def _writeOneArgumentFunc(file, outputType, functionName):
155 if outputType == 'color4':

Callers 1

mainFunction · 0.85

Calls 2

_writeValueAssignmentFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected