(parent, instance, objId, context, depth)
| 1236 | |
| 1237 | |
| 1238 | def rendererSerializer(parent, instance, objId, context, depth): |
| 1239 | dependencies = [] |
| 1240 | viewPropIds = [] |
| 1241 | lightsIds = [] |
| 1242 | calls = [] |
| 1243 | |
| 1244 | # Camera |
| 1245 | camera = instance.GetActiveCamera() |
| 1246 | cameraId = getReferenceId(camera) |
| 1247 | cameraInstance = serializeInstance(instance, camera, cameraId, context, depth + 1) |
| 1248 | if cameraInstance: |
| 1249 | dependencies.append(cameraInstance) |
| 1250 | calls.append(["setActiveCamera", [wrapId(cameraId)]]) |
| 1251 | |
| 1252 | # View prop as representation containers |
| 1253 | viewPropCollection = instance.GetViewProps() |
| 1254 | for rpIdx in range(viewPropCollection.GetNumberOfItems()): |
| 1255 | viewProp = viewPropCollection.GetItemAsObject(rpIdx) |
| 1256 | viewPropId = getReferenceId(viewProp) |
| 1257 | |
| 1258 | viewPropInstance = serializeInstance( |
| 1259 | instance, viewProp, viewPropId, context, depth + 1 |
| 1260 | ) |
| 1261 | if viewPropInstance: |
| 1262 | dependencies.append(viewPropInstance) |
| 1263 | viewPropIds.append(viewPropId) |
| 1264 | |
| 1265 | calls += context.buildDependencyCallList( |
| 1266 | "%s-props" % objId, viewPropIds, "addViewProp", "removeViewProp" |
| 1267 | ) |
| 1268 | |
| 1269 | # Lights |
| 1270 | lightCollection = instance.GetLights() |
| 1271 | for lightIdx in range(lightCollection.GetNumberOfItems()): |
| 1272 | light = lightCollection.GetItemAsObject(lightIdx) |
| 1273 | lightId = getReferenceId(light) |
| 1274 | |
| 1275 | lightInstance = serializeInstance(instance, light, lightId, context, depth + 1) |
| 1276 | if lightInstance: |
| 1277 | dependencies.append(lightInstance) |
| 1278 | lightsIds.append(lightId) |
| 1279 | |
| 1280 | calls += context.buildDependencyCallList( |
| 1281 | "%s-lights" % objId, lightsIds, "addLight", "removeLight" |
| 1282 | ) |
| 1283 | |
| 1284 | if len(dependencies) > 1: |
| 1285 | return { |
| 1286 | "parent": getReferenceId(parent), |
| 1287 | "id": objId, |
| 1288 | "type": class_name(instance), |
| 1289 | "properties": { |
| 1290 | "background": instance.GetBackground(), |
| 1291 | "background2": instance.GetBackground2(), |
| 1292 | "viewport": instance.GetViewport(), |
| 1293 | # These commented properties do not yet have real setters in vtk.js |
| 1294 | # 'gradientBackground': instance.GetGradientBackground(), |
| 1295 | # 'aspect': instance.GetAspect(), |
nothing calls this directly
no test coverage detected