MCPcopy Create free account
hub / github.com/Kitware/VTK / rendererSerializer

Function rendererSerializer

Web/Python/vtkmodules/web/render_window_serializer.py:1238–1315  ·  view source on GitHub ↗
(parent, instance, objId, context, depth)

Source from the content-addressed store, hash-verified

1236
1237
1238def 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(),

Callers

nothing calls this directly

Calls 12

getReferenceIdFunction · 0.90
serializeInstanceFunction · 0.85
wrapIdFunction · 0.85
class_nameFunction · 0.85
GetActiveCameraMethod · 0.80
GetItemAsObjectMethod · 0.80
GetViewportMethod · 0.80
GetLayerMethod · 0.80
rangeClass · 0.50
appendMethod · 0.45
GetNumberOfItemsMethod · 0.45

Tested by

no test coverage detected