MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenShadingLanguage / parameter_done

Method parameter_done

src/liboslquery/oslquery.cpp:150–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148
149
150void
151OSOReaderQuery::parameter_done ()
152{
153 if (m_reading_param && m_query.nparams() > 0) {
154 // Make sure all value defaults have the right number of elements in
155 // case they were only partially initialized.
156 OSLQuery::Parameter &p (m_query.m_params.back());
157 int nvalues;
158 if (p.varlenarray)
159 nvalues = m_default_values;
160 else
161 nvalues = p.type.numelements() * p.type.aggregate;
162 if (p.type.basetype == TypeDesc::INT) {
163 p.idefault.resize (nvalues, 0);
164 p.data = &p.idefault[0];
165 }
166 else if (p.type.basetype == TypeDesc::FLOAT) {
167 p.fdefault.resize (nvalues, 0);
168 p.data = &p.fdefault[0];
169 }
170 else if (p.type.basetype == TypeDesc::STRING) {
171 p.sdefault.resize (nvalues, ustring());
172 p.data = &p.sdefault[0];
173 }
174 if (p.spacename.size())
175 p.spacename.resize (p.type.numelements(), ustring());
176 }
177
178 m_reading_param = false;
179}
180
181
182

Callers

nothing calls this directly

Calls 3

pFunction · 0.85
numelementsMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected