(parent, actor, actorId, context, depth)
| 430 | |
| 431 | |
| 432 | def genericActorSerializer(parent, actor, actorId, context, depth): |
| 433 | # This kind of actor has two "children" of interest, a property and a |
| 434 | # mapper |
| 435 | actorVisibility = actor.GetVisibility() |
| 436 | mapperInstance = None |
| 437 | propertyInstance = None |
| 438 | calls = [] |
| 439 | dependencies = [] |
| 440 | |
| 441 | if actorVisibility: |
| 442 | mapper = None |
| 443 | if not hasattr(actor, "GetMapper"): |
| 444 | logger.debug("This actor does not have a GetMapper method") |
| 445 | else: |
| 446 | mapper = actor.GetMapper() |
| 447 | |
| 448 | if mapper: |
| 449 | mapperId = getReferenceId(mapper) |
| 450 | mapperInstance = serializeInstance( |
| 451 | actor, mapper, mapperId, context, depth + 1 |
| 452 | ) |
| 453 | if mapperInstance: |
| 454 | dependencies.append(mapperInstance) |
| 455 | calls.append(["setMapper", [wrapId(mapperId)]]) |
| 456 | |
| 457 | prop = None |
| 458 | if hasattr(actor, "GetProperty"): |
| 459 | prop = actor.GetProperty() |
| 460 | else: |
| 461 | logger.debug("This actor does not have a GetProperty method") |
| 462 | |
| 463 | if prop: |
| 464 | propId = getReferenceId(prop) |
| 465 | propertyInstance = serializeInstance( |
| 466 | actor, prop, propId, context, depth + 1 |
| 467 | ) |
| 468 | if propertyInstance: |
| 469 | dependencies.append(propertyInstance) |
| 470 | calls.append(["setProperty", [wrapId(propId)]]) |
| 471 | |
| 472 | # Handle texture if any |
| 473 | texture = None |
| 474 | if hasattr(actor, "GetTexture"): |
| 475 | texture = actor.GetTexture() |
| 476 | else: |
| 477 | logger.debug("This actor does not have a GetTexture method") |
| 478 | |
| 479 | if texture: |
| 480 | textureId = getReferenceId(texture) |
| 481 | textureInstance = serializeInstance( |
| 482 | actor, texture, textureId, context, depth + 1 |
| 483 | ) |
| 484 | if textureInstance: |
| 485 | dependencies.append(textureInstance) |
| 486 | calls.append(["addTexture", [wrapId(textureId)]]) |
| 487 | |
| 488 | if actorVisibility == 0 or (mapperInstance and propertyInstance): |
| 489 | return { |
nothing calls this directly
no test coverage detected