vibrante-node-runtime 2.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- src/__init__.py +1 -0
- src/runtime/__init__.py +187 -0
- src/runtime/agent_runtime.py +315 -0
- src/runtime/ai_planner.py +371 -0
- src/runtime/approval_pipeline.py +237 -0
- src/runtime/architectural_features/__init__.py +68 -0
- src/runtime/architectural_features/architectural_feature_realizer.py +279 -0
- src/runtime/architectural_features/architectural_plan.py +421 -0
- src/runtime/architectural_features/architectural_plan_builder.py +428 -0
- src/runtime/architectural_features/environment_architecture_review.py +398 -0
- src/runtime/asset_identity/__init__.py +103 -0
- src/runtime/asset_identity/asset_identity_auditor.py +532 -0
- src/runtime/asset_identity/identity_review.py +248 -0
- src/runtime/asset_identity/identity_serializer.py +76 -0
- src/runtime/asset_identity/identity_statistics.py +132 -0
- src/runtime/asset_identity/opaque_id_detector.py +167 -0
- src/runtime/asset_identity/role_engine_validator.py +134 -0
- src/runtime/asset_identity/role_geometry_validator.py +161 -0
- src/runtime/asset_knowledge_graph.py +505 -0
- src/runtime/asset_staging_manager.py +350 -0
- src/runtime/assets/__init__.py +310 -0
- src/runtime/assets/acquisition/__init__.py +109 -0
- src/runtime/assets/acquisition/acquisition_manager.py +431 -0
- src/runtime/assets/acquisition/download_registry.py +324 -0
- src/runtime/assets/acquisition/fab_library_scanner.py +384 -0
- src/runtime/assets/acquisition/library_index.py +379 -0
- src/runtime/assets/acquisition/library_watcher.py +362 -0
- src/runtime/assets/acquisition/megascans_scanner.py +551 -0
- src/runtime/assets/acquisition_online/__init__.py +211 -0
- src/runtime/assets/acquisition_online/acquisition_pipeline.py +279 -0
- src/runtime/assets/acquisition_online/asset_cache_manager.py +265 -0
- src/runtime/assets/acquisition_online/asset_fetcher.py +361 -0
- src/runtime/assets/acquisition_online/asset_provenance_tracker.py +231 -0
- src/runtime/assets/acquisition_online/download_queue.py +297 -0
- src/runtime/assets/acquisition_online/download_review.py +253 -0
- src/runtime/assets/acquisition_online/download_scheduler.py +188 -0
- src/runtime/assets/acquisition_online/download_serializer.py +116 -0
- src/runtime/assets/acquisition_online/download_statistics.py +145 -0
- src/runtime/assets/acquisition_online/fab_socket_receiver.py +449 -0
- src/runtime/assets/acquisition_online/megascans_auth.py +408 -0
- src/runtime/assets/acquisition_online/megascans_download.py +391 -0
- src/runtime/assets/acquisition_online/megascans_search.py +313 -0
- src/runtime/assets/acquisition_online/project_asset_staging.py +221 -0
- src/runtime/assets/acquisition_online/provider_session_manager.py +182 -0
- src/runtime/assets/acquisition_online/quixel_bridge_client.py +380 -0
- src/runtime/assets/assembly/__init__.py +288 -0
- src/runtime/assets/assembly/anchor_asset_engine.py +387 -0
- src/runtime/assets/assembly/architectural_templates.py +493 -0
- src/runtime/assets/assembly/asset_clustering_engine.py +343 -0
- src/runtime/assets/assembly/asset_placement_engine.py +553 -0
- src/runtime/assets/assembly/asset_scale_analyzer.py +278 -0
- src/runtime/assets/assembly/bounding_box_extractor.py +227 -0
- src/runtime/assets/assembly/clearance_validator.py +204 -0
- src/runtime/assets/assembly/collision_detector.py +208 -0
- src/runtime/assets/assembly/composition_constraints.py +291 -0
- src/runtime/assets/assembly/decorative_population_engine.py +419 -0
- src/runtime/assets/assembly/environment_blueprint.py +92 -0
- src/runtime/assets/assembly/environment_builder.py +401 -0
- src/runtime/assets/assembly/environment_completeness_review.py +500 -0
- src/runtime/assets/assembly/environment_review.py +454 -0
- src/runtime/assets/assembly/environment_scale_review.py +490 -0
- src/runtime/assets/assembly/environment_structure_builder.py +344 -0
- src/runtime/assets/assembly/environment_zones.py +332 -0
- src/runtime/assets/assembly/footprint_calculator.py +181 -0
- src/runtime/assets/assembly/layout_spacing_engine.py +350 -0
- src/runtime/assets/assembly/placement_optimizer.py +272 -0
- src/runtime/assets/assembly/placement_relationships.py +380 -0
- src/runtime/assets/assembly/placement_templates.py +1024 -0
- src/runtime/assets/assembly/scene_population_engine.py +351 -0
- src/runtime/assets/assembly/semantic_placement_rules.py +323 -0
- src/runtime/assets/assembly/spatial_metadata.py +118 -0
- src/runtime/assets/assembly/spatial_review.py +304 -0
- src/runtime/assets/assembly/storytelling_layout_engine.py +768 -0
- src/runtime/assets/assembly/unit_normalizer.py +192 -0
- src/runtime/assets/cache/__init__.py +39 -0
- src/runtime/assets/cache/asset_cache.py +330 -0
- src/runtime/assets/cache/asset_storage.py +234 -0
- src/runtime/assets/cache/asset_sync.py +280 -0
- src/runtime/assets/discovery/__init__.py +17 -0
- src/runtime/assets/discovery/asset_discovery_engine.py +223 -0
- src/runtime/assets/download/__init__.py +24 -0
- src/runtime/assets/download/asset_download_manager.py +275 -0
- src/runtime/assets/geometry/__init__.py +149 -0
- src/runtime/assets/geometry/asset_metrics.py +476 -0
- src/runtime/assets/geometry/bounding_box_extractor.py +478 -0
- src/runtime/assets/geometry/geometry_analyzer.py +251 -0
- src/runtime/assets/geometry/geometry_review.py +463 -0
- src/runtime/assets/geometry/geometry_serializer.py +121 -0
- src/runtime/assets/geometry/geometry_statistics.py +206 -0
- src/runtime/assets/geometry/ground_contact_detector.py +277 -0
- src/runtime/assets/geometry/pivot_detector.py +248 -0
- src/runtime/assets/geometry/support_surface_detector.py +299 -0
- src/runtime/assets/logging/__init__.py +17 -0
- src/runtime/assets/logging/asset_logger.py +153 -0
- src/runtime/assets/metadata/__init__.py +65 -0
- src/runtime/assets/metadata/asset_metadata_enricher.py +215 -0
- src/runtime/assets/metadata/asset_provenance.py +273 -0
- src/runtime/assets/metadata/asset_semantic_mapper.py +265 -0
- src/runtime/assets/metadata/provider_normalizer.py +364 -0
- src/runtime/assets/providers/__init__.py +38 -0
- src/runtime/assets/providers/base.py +218 -0
- src/runtime/assets/providers/local_library_provider.py +209 -0
- src/runtime/assets/providers/polyhaven_provider.py +268 -0
- src/runtime/assets/providers/provider_manager.py +229 -0
- src/runtime/assets/providers/quixel_provider.py +277 -0
- src/runtime/assets/providers/sketchfab_live_provider.py +515 -0
- src/runtime/assets/providers/sketchfab_provider.py +327 -0
- src/runtime/assets/providers/studio_library_provider.py +323 -0
- src/runtime/assets/providers/usd_library_provider.py +310 -0
- src/runtime/assets/ranking/__init__.py +17 -0
- src/runtime/assets/ranking/asset_ranking_engine.py +365 -0
- src/runtime/assets/real_world_scale.py +189 -0
- src/runtime/assets/realization/__init__.py +162 -0
- src/runtime/assets/realization/asset_converter.py +282 -0
- src/runtime/assets/realization/asset_dependency_resolver.py +285 -0
- src/runtime/assets/realization/asset_importer.py +298 -0
- src/runtime/assets/realization/asset_instancer.py +269 -0
- src/runtime/assets/realization/asset_material_mapper.py +337 -0
- src/runtime/assets/realization/asset_normalizer.py +319 -0
- src/runtime/assets/realization/asset_realization_review.py +416 -0
- src/runtime/assets/realization/asset_validation_pipeline.py +316 -0
- src/runtime/assets/realization/realization_serializer.py +172 -0
- src/runtime/assets/realization/realization_statistics.py +265 -0
- src/runtime/assets/realization/scene_asset_realizer.py +405 -0
- src/runtime/assets/realization/usd_builder.py +272 -0
- src/runtime/assets/recommendations/__init__.py +17 -0
- src/runtime/assets/recommendations/asset_recommendation_engine.py +260 -0
- src/runtime/assets/schema/__init__.py +38 -0
- src/runtime/assets/schema/asset_descriptor.py +484 -0
- src/runtime/assets/semantic/__init__.py +234 -0
- src/runtime/assets/semantic/asset_catalog.py +368 -0
- src/runtime/assets/semantic/asset_catalog_review.py +266 -0
- src/runtime/assets/semantic/asset_catalog_serializer.py +103 -0
- src/runtime/assets/semantic/asset_catalog_statistics.py +130 -0
- src/runtime/assets/semantic/asset_catalog_sync.py +248 -0
- src/runtime/assets/semantic/asset_cinematic_mapper.py +156 -0
- src/runtime/assets/semantic/asset_environment_mapper.py +459 -0
- src/runtime/assets/semantic/asset_knowledge_graph.py +257 -0
- src/runtime/assets/semantic/asset_lookdev_mapper.py +180 -0
- src/runtime/assets/semantic/asset_manifest_reader.py +236 -0
- src/runtime/assets/semantic/asset_metadata_extractor.py +167 -0
- src/runtime/assets/semantic/asset_metadata_provider.py +231 -0
- src/runtime/assets/semantic/asset_query_engine.py +240 -0
- src/runtime/assets/semantic/asset_role_classifier.py +193 -0
- src/runtime/assets/semantic/asset_storytelling_mapper.py +163 -0
- src/runtime/assets/semantic/megascans_metadata_client.py +345 -0
- src/runtime/assets/semantic/semantic_asset_enricher.py +232 -0
- src/runtime/assets/serialization/__init__.py +15 -0
- src/runtime/assets/serialization/asset_serializer.py +201 -0
- src/runtime/assets/suitability/__init__.py +115 -0
- src/runtime/assets/suitability/asset_suitability_engine.py +345 -0
- src/runtime/assets/suitability/asset_suitability_review.py +193 -0
- src/runtime/assets/suitability/asset_suitability_serializer.py +67 -0
- src/runtime/assets/suitability/asset_suitability_statistics.py +141 -0
- src/runtime/assets/suitability/environment_affinity.py +290 -0
- src/runtime/assets/suitability/material_affinity.py +247 -0
- src/runtime/assets/suitability/placement_affinity.py +153 -0
- src/runtime/assets/suitability/role_affinity.py +205 -0
- src/runtime/assets/suitability/scale_affinity.py +150 -0
- src/runtime/assets/suitability/story_affinity.py +235 -0
- src/runtime/assets/suitability/style_affinity.py +252 -0
- src/runtime/assets/validation/__init__.py +17 -0
- src/runtime/assets/validation/asset_validation_engine.py +281 -0
- src/runtime/assets/vector_search/__init__.py +193 -0
- src/runtime/assets/vector_search/asset_embedding_builder.py +132 -0
- src/runtime/assets/vector_search/asset_vector_store.py +264 -0
- src/runtime/assets/vector_search/catalog_vector_index_builder.py +155 -0
- src/runtime/assets/vector_search/embedding_provider.py +294 -0
- src/runtime/assets/vector_search/hybrid_ranking_engine.py +241 -0
- src/runtime/assets/vector_search/intent_embedding_engine.py +99 -0
- src/runtime/assets/vector_search/intent_parser.py +462 -0
- src/runtime/assets/vector_search/retrieval_pipeline.py +275 -0
- src/runtime/assets/vector_search/retrieval_review.py +281 -0
- src/runtime/assets/vector_search/retrieval_serializer.py +91 -0
- src/runtime/assets/vector_search/retrieval_statistics.py +133 -0
- src/runtime/assets/vector_search/semantic_similarity.py +116 -0
- src/runtime/assets/vector_search/vector_search_engine.py +246 -0
- src/runtime/atmosphere_orchestrator.py +412 -0
- src/runtime/audit_store.py +230 -0
- src/runtime/capability_catalog.py +2324 -0
- src/runtime/capability_registry.py +225 -0
- src/runtime/cinematic_camera_engine.py +497 -0
- src/runtime/cinematic_composition.py +399 -0
- src/runtime/cinematic_scene_review.py +539 -0
- src/runtime/contextual_reasoning.py +286 -0
- src/runtime/dependency_graph.py +205 -0
- src/runtime/distributed_runtime.py +348 -0
- src/runtime/environment/__init__.py +189 -0
- src/runtime/environment/anchor_asset_builder.py +389 -0
- src/runtime/environment/atmosphere_builder.py +307 -0
- src/runtime/environment/decorative_population.py +320 -0
- src/runtime/environment/environment_blueprint.py +107 -0
- src/runtime/environment/environment_completeness.py +234 -0
- src/runtime/environment/environment_requirements.py +224 -0
- src/runtime/environment/environment_review.py +320 -0
- src/runtime/environment/environment_serializer.py +100 -0
- src/runtime/environment/environment_statistics.py +149 -0
- src/runtime/environment/environment_structure_builder.py +391 -0
- src/runtime/environment/environment_template_library.py +388 -0
- src/runtime/environment/environment_zone_builder.py +334 -0
- src/runtime/environment/support_asset_builder.py +243 -0
- src/runtime/environment_realization/__init__.py +177 -0
- src/runtime/environment_realization/architectural_constraint_solver.py +230 -0
- src/runtime/environment_realization/beam_builder.py +221 -0
- src/runtime/environment_realization/ceiling_builder.py +186 -0
- src/runtime/environment_realization/environment_execution_engine.py +228 -0
- src/runtime/environment_realization/environment_realization_engine.py +119 -0
- src/runtime/environment_realization/environment_review.py +250 -0
- src/runtime/environment_realization/environment_serializer.py +77 -0
- src/runtime/environment_realization/environment_statistics.py +134 -0
- src/runtime/environment_realization/floor_builder.py +198 -0
- src/runtime/environment_realization/opening_builder.py +224 -0
- src/runtime/environment_realization/room_shell_builder.py +215 -0
- src/runtime/environment_realization/room_shell_completeness_validator.py +303 -0
- src/runtime/environment_realization/structural_attachment_enforcer.py +386 -0
- src/runtime/environment_realization/structural_builder.py +314 -0
- src/runtime/environment_realization/structural_elements.py +258 -0
- src/runtime/environment_realization/structural_routing_engine.py +390 -0
- src/runtime/environment_realization/wall_builder.py +199 -0
- src/runtime/environment_rules.py +239 -0
- src/runtime/environment_shell/__init__.py +187 -0
- src/runtime/environment_shell/environment_readiness_gate.py +187 -0
- src/runtime/environment_shell/environment_shell_audit.py +184 -0
- src/runtime/environment_shell/environment_shell_blueprint.py +267 -0
- src/runtime/environment_shell/environment_shell_builder.py +265 -0
- src/runtime/environment_shell/environment_shell_state.py +133 -0
- src/runtime/environment_shell/shell_ceiling_builder.py +114 -0
- src/runtime/environment_shell/shell_floor_builder.py +96 -0
- src/runtime/environment_shell/shell_phase_result.py +66 -0
- src/runtime/environment_shell/shell_review.py +241 -0
- src/runtime/environment_shell/shell_serializer.py +67 -0
- src/runtime/environment_shell/shell_statistics.py +141 -0
- src/runtime/environment_shell/shell_validator.py +138 -0
- src/runtime/environment_shell/shell_wall_builder.py +156 -0
- src/runtime/environment_shell/structural_anchor_generator.py +200 -0
- src/runtime/environment_shell/structural_element_placer.py +193 -0
- src/runtime/environments/__init__.py +67 -0
- src/runtime/environments/environment_registry.py +1139 -0
- src/runtime/environments/environment_statistics.py +219 -0
- src/runtime/execution_explainer.py +399 -0
- src/runtime/execution_quality.py +258 -0
- src/runtime/execution_review.py +221 -0
- src/runtime/execution_scheduler.py +263 -0
- src/runtime/failure_intelligence.py +341 -0
- src/runtime/goal_decomposer.py +532 -0
- src/runtime/houdini_asset_realizer.py +329 -0
- src/runtime/houdini_runtime.py +992 -0
- src/runtime/intent_parser.py +275 -0
- src/runtime/knowledge_graph.py +310 -0
- src/runtime/layout/__init__.py +172 -0
- src/runtime/layout/affordance_engine.py +384 -0
- src/runtime/layout/anchor_layout_engine.py +244 -0
- src/runtime/layout/decoration_layout_engine.py +325 -0
- src/runtime/layout/furniture_cluster_builder.py +381 -0
- src/runtime/layout/layout_review.py +265 -0
- src/runtime/layout/layout_serializer.py +77 -0
- src/runtime/layout/layout_statistics.py +123 -0
- src/runtime/layout/relationship_graph.py +165 -0
- src/runtime/layout/relationship_graph_builder.py +699 -0
- src/runtime/layout/relationship_layout_engine.py +1101 -0
- src/runtime/layout/relationship_realization_auditor.py +849 -0
- src/runtime/layout/semantic_layout_engine.py +327 -0
- src/runtime/layout/surface_placement_engine.py +270 -0
- src/runtime/layout/wall_attachment_engine.py +243 -0
- src/runtime/layout_realization/__init__.py +183 -0
- src/runtime/layout_realization/cluster_realizer.py +212 -0
- src/runtime/layout_realization/collision_solver.py +359 -0
- src/runtime/layout_realization/identity_metadata_writer.py +257 -0
- src/runtime/layout_realization/layout_application_engine.py +242 -0
- src/runtime/layout_realization/layout_realization_engine.py +293 -0
- src/runtime/layout_realization/layout_validator.py +315 -0
- src/runtime/layout_realization/metadata_application_engine.py +187 -0
- src/runtime/layout_realization/realization_review.py +268 -0
- src/runtime/layout_realization/realization_serializer.py +77 -0
- src/runtime/layout_realization/realization_statistics.py +151 -0
- src/runtime/layout_realization/relationship_metadata_writer.py +305 -0
- src/runtime/layout_realization/relationship_persistence_auditor.py +426 -0
- src/runtime/layout_realization/relationship_realizer.py +294 -0
- src/runtime/layout_realization/scene_constraint_solver.py +317 -0
- src/runtime/layout_realization/surface_realizer.py +195 -0
- src/runtime/layout_realization/transform_resolver.py +268 -0
- src/runtime/layout_realization/wall_attachment_realizer.py +182 -0
- src/runtime/layout_transform_engine.py +341 -0
- src/runtime/lighting/__init__.py +215 -0
- src/runtime/lighting/lighting_color_engine.py +252 -0
- src/runtime/lighting/lighting_environment_mapper.py +792 -0
- src/runtime/lighting/lighting_exposure_engine.py +213 -0
- src/runtime/lighting/lighting_hierarchy_engine.py +248 -0
- src/runtime/lighting/lighting_knowledge.py +342 -0
- src/runtime/lighting/lighting_language.py +239 -0
- src/runtime/lighting/lighting_mood_engine.py +230 -0
- src/runtime/lighting/lighting_patterns.py +522 -0
- src/runtime/lighting/lighting_plan_builder.py +320 -0
- src/runtime/lighting/lighting_readability_engine.py +273 -0
- src/runtime/lighting/lighting_recommendation_engine.py +205 -0
- src/runtime/lighting/lighting_review.py +370 -0
- src/runtime/lighting/lighting_serializer.py +71 -0
- src/runtime/lighting/lighting_statistics.py +142 -0
- src/runtime/lighting/lighting_strategy_engine.py +239 -0
- src/runtime/lighting/lighting_validation.py +183 -0
- src/runtime/llm_provider.py +340 -0
- src/runtime/lookdev/__init__.py +137 -0
- src/runtime/lookdev/lookdev_patterns.py +216 -0
- src/runtime/lookdev/lookdev_review.py +389 -0
- src/runtime/lookdev/lookdev_serializer.py +71 -0
- src/runtime/lookdev/lookdev_statistics.py +133 -0
- src/runtime/lookdev/lookdev_validation.py +203 -0
- src/runtime/lookdev/material_assignment_engine.py +331 -0
- src/runtime/lookdev/material_knowledge.py +244 -0
- src/runtime/lookdev/material_library.py +311 -0
- src/runtime/lookdev/material_recommendation.py +394 -0
- src/runtime/lookdev/renderer_profiles.py +281 -0
- src/runtime/mcp_runtime.py +357 -0
- src/runtime/mcp_server_runtime.py +386 -0
- src/runtime/mcp_session.py +261 -0
- src/runtime/mcp_tool_registry.py +2169 -0
- src/runtime/mcp_transport.py +206 -0
- src/runtime/multi_dcc_runtime.py +316 -0
- src/runtime/orchestration_heuristics.py +360 -0
- src/runtime/pattern_library.py +344 -0
- src/runtime/plan_validator.py +314 -0
- src/runtime/planning/__init__.py +103 -0
- src/runtime/planning/camera/__init__.py +1 -0
- src/runtime/planning/camera/camera_planner.py +179 -0
- src/runtime/planning/composition/__init__.py +1 -0
- src/runtime/planning/composition/composition_planner.py +223 -0
- src/runtime/planning/logging/__init__.py +1 -0
- src/runtime/planning/logging/planning_logger.py +109 -0
- src/runtime/planning/planners/__init__.py +1 -0
- src/runtime/planning/planners/asset_query_generator.py +265 -0
- src/runtime/planning/planners/scene_planner.py +199 -0
- src/runtime/planning/planners/zone_planner.py +271 -0
- src/runtime/planning/recommendations/__init__.py +1 -0
- src/runtime/planning/recommendations/scene_plan_recommendation_engine.py +228 -0
- src/runtime/planning/schema/__init__.py +23 -0
- src/runtime/planning/schema/scene_plan.py +569 -0
- src/runtime/planning/serialization/__init__.py +1 -0
- src/runtime/planning/serialization/plan_serializer.py +147 -0
- src/runtime/planning/validators/__init__.py +1 -0
- src/runtime/planning/validators/scene_plan_validator.py +210 -0
- src/runtime/planning_memory.py +242 -0
- src/runtime/predictive_execution.py +393 -0
- src/runtime/procedural_scene_assembler.py +415 -0
- src/runtime/production_memory.py +309 -0
- src/runtime/production_scoring.py +422 -0
- src/runtime/reality/__init__.py +197 -0
- src/runtime/reality/architectural_integrity_validator.py +220 -0
- src/runtime/reality/beam_connection_validator.py +205 -0
- src/runtime/reality/composition_engine.py +206 -0
- src/runtime/reality/correction_applier.py +159 -0
- src/runtime/reality/correction_pass_engine.py +253 -0
- src/runtime/reality/density_engine.py +145 -0
- src/runtime/reality/floating_object_detector.py +206 -0
- src/runtime/reality/functional_zone_builder.py +260 -0
- src/runtime/reality/geometry_inspector.py +229 -0
- src/runtime/reality/human_reasoning_engine.py +284 -0
- src/runtime/reality/reality_intelligence_engine.py +182 -0
- src/runtime/reality/reality_scene_model.py +351 -0
- src/runtime/reality/reality_serializer.py +75 -0
- src/runtime/reality/reality_statistics.py +145 -0
- src/runtime/reality/support_rule_engine.py +248 -0
- src/runtime/reality/visual_review_engine.py +217 -0
- src/runtime/recommendation_engine.py +358 -0
- src/runtime/render_preparation_engine.py +463 -0
- src/runtime/resource_estimator.py +256 -0
- src/runtime/resource_optimizer.py +343 -0
- src/runtime/review_engine.py +768 -0
- src/runtime/review_feedback.py +325 -0
- src/runtime/runtime_analytics.py +330 -0
- src/runtime/runtime_bootstrap.py +137 -0
- src/runtime/runtime_constraints.py +317 -0
- src/runtime/runtime_federation_api.py +297 -0
- src/runtime/runtime_identity.py +70 -0
- src/runtime/runtime_narration.py +493 -0
- src/runtime/runtime_prompt_context.py +682 -0
- src/runtime/scene_awareness.py +559 -0
- src/runtime/scene_cache.py +277 -0
- src/runtime/scene_hierarchy_builder.py +258 -0
- src/runtime/scene_layout_planner.py +292 -0
- src/runtime/scene_realization_review.py +452 -0
- src/runtime/scene_recommendation_engine.py +398 -0
- src/runtime/scene_validation/__init__.py +118 -0
- src/runtime/scene_validation/occupancy_validator.py +176 -0
- src/runtime/scene_validation/orphan_detector.py +205 -0
- src/runtime/scene_validation/plausibility_engine.py +236 -0
- src/runtime/scene_validation/relationship_validator.py +238 -0
- src/runtime/scene_validation/routing_audit.py +556 -0
- src/runtime/scene_validation/scene_reality_validator.py +229 -0
- src/runtime/scene_validation/support_surface_validator.py +155 -0
- src/runtime/scene_validation/validation_review.py +207 -0
- src/runtime/scene_validation/validation_serializer.py +74 -0
- src/runtime/scene_validation/validation_statistics.py +142 -0
- src/runtime/semantic/__init__.py +113 -0
- src/runtime/semantic/enrichers/__init__.py +12 -0
- src/runtime/semantic/enrichers/scene_intent_enricher.py +305 -0
- src/runtime/semantic/logging/__init__.py +18 -0
- src/runtime/semantic/logging/semantic_logger.py +298 -0
- src/runtime/semantic/prompts/__init__.py +12 -0
- src/runtime/semantic/prompts/intent_prompt_builder.py +317 -0
- src/runtime/semantic/recommendations/__init__.py +17 -0
- src/runtime/semantic/recommendations/intent_recommendation_engine.py +434 -0
- src/runtime/semantic/scene_intent_extractor.py +455 -0
- src/runtime/semantic/schema/__init__.py +40 -0
- src/runtime/semantic/schema/scene_intent_schema.py +349 -0
- src/runtime/semantic/serialization/__init__.py +16 -0
- src/runtime/semantic/serialization/intent_serializer.py +248 -0
- src/runtime/semantic/validators/__init__.py +14 -0
- src/runtime/semantic/validators/scene_intent_validator.py +284 -0
- src/runtime/semantic_execution.py +348 -0
- src/runtime/semantic_import_controller.py +408 -0
- src/runtime/semantic_lighting_engine.py +566 -0
- src/runtime/semantic_memory.py +257 -0
- src/runtime/semantic_registry.py +386 -0
- src/runtime/semantic_scene_templates.py +387 -0
- src/runtime/storage/__init__.py +18 -0
- src/runtime/storage/memory_backend.py +294 -0
- src/runtime/storage/serialization.py +211 -0
- src/runtime/storage/sqlite_backend.py +365 -0
- src/runtime/structure/__init__.py +135 -0
- src/runtime/structure/environment_structural_affinity.py +254 -0
- src/runtime/structure/geometry_role_detector.py +182 -0
- src/runtime/structure/metadata_role_classifier.py +279 -0
- src/runtime/structure/structural_asset_classifier.py +331 -0
- src/runtime/structure/structural_placement_rules.py +326 -0
- src/runtime/structure/structural_review.py +682 -0
- src/runtime/structure/structural_serializer.py +113 -0
- src/runtime/structure/structural_statistics.py +209 -0
- src/runtime/studio/__init__.py +71 -0
- src/runtime/studio/cross_project_learning.py +263 -0
- src/runtime/studio/knowledge_recommendation.py +324 -0
- src/runtime/studio/knowledge_serializer.py +154 -0
- src/runtime/studio/knowledge_statistics.py +107 -0
- src/runtime/studio/production_benchmark.py +240 -0
- src/runtime/studio/project_memory.py +250 -0
- src/runtime/studio/review_analytics.py +166 -0
- src/runtime/studio/studio_knowledge.py +284 -0
- src/runtime/studio/studio_metrics.py +155 -0
- src/runtime/studio/studio_standards.py +262 -0
- src/runtime/studio_knowledge.py +328 -0
- src/runtime/transaction_manager.py +367 -0
- src/runtime/validation_engine.py +234 -0
- src/runtime/visual_hierarchy_engine.py +452 -0
- src/runtime/worker_runtime.py +236 -0
- src/runtime/workflow_federation.py +316 -0
- src/runtime/workflow_optimizer.py +407 -0
- src/runtime/workflow_templates.py +421 -0
- src/runtime/workflows/__init__.py +129 -0
- src/runtime/workflows/workflow_blueprint.py +394 -0
- src/runtime/workflows/workflow_executor.py +344 -0
- src/runtime/workflows/workflow_pack.py +403 -0
- src/runtime/workflows/workflow_recommendation.py +353 -0
- src/runtime/workflows/workflow_registry.py +165 -0
- src/runtime/workflows/workflow_review.py +336 -0
- src/runtime/workflows/workflow_serializer.py +149 -0
- src/runtime/workflows/workflow_statistics.py +205 -0
- src/runtime/workflows/workflow_validator.py +272 -0
- src/utils/__init__.py +0 -0
- src/utils/hou_bridge.py +262 -0
- src/utils/vibrante_config.py +272 -0
- vibrante_node_runtime-2.5.1.dist-info/METADATA +47 -0
- vibrante_node_runtime-2.5.1.dist-info/RECORD +472 -0
- vibrante_node_runtime-2.5.1.dist-info/WHEEL +5 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/CLA.md +96 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/COMMERCIAL_LICENSE.md +170 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSE +178 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/AGPL-3.0.txt +661 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0-SCOPE.md +53 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0.txt +396 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/GPL-3.0.txt +674 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/LGPL-3.0.txt +165 -0
- vibrante_node_runtime-2.5.1.dist-info/licenses/LICENSES/README.md +65 -0
- vibrante_node_runtime-2.5.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Scene Population Engine (Tier 9 — Semantic Asset Assembly)
|
|
3
|
+
===========================================================
|
|
4
|
+
Populates environments intelligently by assigning assets to semantic
|
|
5
|
+
population groups and validating the result for production balance.
|
|
6
|
+
|
|
7
|
+
Population groups:
|
|
8
|
+
hero_assets — 1–3 primary narrative assets
|
|
9
|
+
support_assets — flanking/contextual assets
|
|
10
|
+
detail_assets — small props and dressing
|
|
11
|
+
atmosphere_assets — fog, particles, HDRI
|
|
12
|
+
storytelling_assets — narrative-specific items (debris, damage, etc.)
|
|
13
|
+
|
|
14
|
+
DESIGN RULES:
|
|
15
|
+
1. Deterministic — same EnvironmentPlan → same population every time.
|
|
16
|
+
2. No bridge calls. No Houdini imports. Planning only.
|
|
17
|
+
3. Population is driven by zone role + category.
|
|
18
|
+
4. Never raises — errors captured in PopulationPlan.errors.
|
|
19
|
+
|
|
20
|
+
Public API:
|
|
21
|
+
PopulationGroup
|
|
22
|
+
PopulationPlan
|
|
23
|
+
ScenePopulationEngine
|
|
24
|
+
get_scene_population_engine()
|
|
25
|
+
reset_scene_population_engine_for_tests()
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
from __future__ import annotations
|
|
29
|
+
|
|
30
|
+
import threading
|
|
31
|
+
import time
|
|
32
|
+
import uuid
|
|
33
|
+
from dataclasses import dataclass, field
|
|
34
|
+
from typing import Any, Dict, List, Optional, Set
|
|
35
|
+
|
|
36
|
+
from src.runtime.assets.assembly.environment_builder import EnvironmentPlan
|
|
37
|
+
|
|
38
|
+
# ---------------------------------------------------------------------------
|
|
39
|
+
# Category → population group mapping
|
|
40
|
+
# ---------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
_CAT_TO_GROUP: Dict[str, str] = {
|
|
43
|
+
# hero
|
|
44
|
+
"vehicle": "hero_assets",
|
|
45
|
+
"character": "hero_assets",
|
|
46
|
+
"robot": "hero_assets",
|
|
47
|
+
"machinery": "hero_assets",
|
|
48
|
+
"creature": "hero_assets",
|
|
49
|
+
# support
|
|
50
|
+
"structure": "support_assets",
|
|
51
|
+
"electronic": "support_assets",
|
|
52
|
+
"furniture": "support_assets",
|
|
53
|
+
"weapon": "support_assets",
|
|
54
|
+
# detail
|
|
55
|
+
"prop": "detail_assets",
|
|
56
|
+
"pipe": "detail_assets",
|
|
57
|
+
"conduit": "detail_assets",
|
|
58
|
+
# atmosphere
|
|
59
|
+
"hdri": "atmosphere_assets",
|
|
60
|
+
"material": "atmosphere_assets",
|
|
61
|
+
"terrain": "atmosphere_assets",
|
|
62
|
+
"vegetation": "atmosphere_assets",
|
|
63
|
+
# storytelling (architectural context)
|
|
64
|
+
"architectural": "storytelling_assets",
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
_ALL_GROUPS = frozenset({
|
|
68
|
+
"hero_assets", "support_assets", "detail_assets",
|
|
69
|
+
"atmosphere_assets", "storytelling_assets",
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
# Max assets per group — used for balance validation
|
|
73
|
+
_GROUP_MAX: Dict[str, int] = {
|
|
74
|
+
"hero_assets": 3,
|
|
75
|
+
"support_assets": 10,
|
|
76
|
+
"detail_assets": 12,
|
|
77
|
+
"atmosphere_assets": 6,
|
|
78
|
+
"storytelling_assets": 8,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
# ---------------------------------------------------------------------------
|
|
83
|
+
# Data models
|
|
84
|
+
# ---------------------------------------------------------------------------
|
|
85
|
+
|
|
86
|
+
@dataclass
|
|
87
|
+
class PopulationGroup:
|
|
88
|
+
"""One named population group within a scene."""
|
|
89
|
+
|
|
90
|
+
group_name: str
|
|
91
|
+
level: str # sparse, moderate, dense
|
|
92
|
+
assets: List[Dict[str, Any]] = field(default_factory=list)
|
|
93
|
+
max_assets: int = 8
|
|
94
|
+
zone_names: List[str] = field(default_factory=list)
|
|
95
|
+
notes: List[str] = field(default_factory=list)
|
|
96
|
+
|
|
97
|
+
@property
|
|
98
|
+
def asset_count(self) -> int:
|
|
99
|
+
return len(self.assets)
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def fill_ratio(self) -> float:
|
|
103
|
+
if self.max_assets <= 0:
|
|
104
|
+
return 0.0
|
|
105
|
+
return min(1.0, self.asset_count / self.max_assets)
|
|
106
|
+
|
|
107
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
108
|
+
return {
|
|
109
|
+
"group_name": self.group_name,
|
|
110
|
+
"level": self.level,
|
|
111
|
+
"assets": list(self.assets),
|
|
112
|
+
"max_assets": self.max_assets,
|
|
113
|
+
"zone_names": list(self.zone_names),
|
|
114
|
+
"notes": list(self.notes),
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@classmethod
|
|
118
|
+
def from_dict(cls, d: Dict[str, Any]) -> "PopulationGroup":
|
|
119
|
+
return cls(
|
|
120
|
+
group_name=str(d.get("group_name", "")),
|
|
121
|
+
level=str(d.get("level", "moderate")),
|
|
122
|
+
assets=list(d.get("assets") or []),
|
|
123
|
+
max_assets=int(d.get("max_assets", 8)),
|
|
124
|
+
zone_names=list(d.get("zone_names") or []),
|
|
125
|
+
notes=list(d.get("notes") or []),
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@dataclass
|
|
130
|
+
class PopulationPlan:
|
|
131
|
+
"""Full population plan for an environment."""
|
|
132
|
+
|
|
133
|
+
plan_id: str = field(default_factory=lambda: f"pop_{uuid.uuid4().hex[:10]}")
|
|
134
|
+
environment: str = ""
|
|
135
|
+
groups: Dict[str, PopulationGroup] = field(default_factory=dict)
|
|
136
|
+
total_assets: int = 0
|
|
137
|
+
balance_score: float = 0.0 # 0.0–1.0
|
|
138
|
+
ok: bool = True
|
|
139
|
+
errors: List[str] = field(default_factory=list)
|
|
140
|
+
warnings: List[str] = field(default_factory=list)
|
|
141
|
+
generated_at: float = field(default_factory=time.time)
|
|
142
|
+
|
|
143
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
144
|
+
return {
|
|
145
|
+
"plan_id": self.plan_id,
|
|
146
|
+
"environment": self.environment,
|
|
147
|
+
"groups": {n: g.to_dict() for n, g in self.groups.items()},
|
|
148
|
+
"total_assets": self.total_assets,
|
|
149
|
+
"balance_score": self.balance_score,
|
|
150
|
+
"ok": self.ok,
|
|
151
|
+
"errors": list(self.errors),
|
|
152
|
+
"warnings": list(self.warnings),
|
|
153
|
+
"generated_at": self.generated_at,
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@classmethod
|
|
157
|
+
def from_dict(cls, d: Dict[str, Any]) -> "PopulationPlan":
|
|
158
|
+
return cls(
|
|
159
|
+
plan_id=str(d.get("plan_id", f"pop_{uuid.uuid4().hex[:10]}")),
|
|
160
|
+
environment=str(d.get("environment", "")),
|
|
161
|
+
groups={n: PopulationGroup.from_dict(g) for n, g in (d.get("groups") or {}).items()},
|
|
162
|
+
total_assets=int(d.get("total_assets", 0)),
|
|
163
|
+
balance_score=float(d.get("balance_score", 0.0)),
|
|
164
|
+
ok=bool(d.get("ok", True)),
|
|
165
|
+
errors=list(d.get("errors") or []),
|
|
166
|
+
warnings=list(d.get("warnings") or []),
|
|
167
|
+
generated_at=float(d.get("generated_at", 0.0)),
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
# ---------------------------------------------------------------------------
|
|
172
|
+
# Engine
|
|
173
|
+
# ---------------------------------------------------------------------------
|
|
174
|
+
|
|
175
|
+
class ScenePopulationEngine:
|
|
176
|
+
"""
|
|
177
|
+
Populates environments by assigning assets to population groups
|
|
178
|
+
and validating production balance.
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
def populate_scene(self, env_plan: EnvironmentPlan) -> PopulationPlan:
|
|
182
|
+
"""
|
|
183
|
+
Build a PopulationPlan from an EnvironmentPlan.
|
|
184
|
+
Never raises — errors captured in PopulationPlan.errors.
|
|
185
|
+
"""
|
|
186
|
+
plan = PopulationPlan(environment=env_plan.environment)
|
|
187
|
+
try:
|
|
188
|
+
# Initialise empty groups
|
|
189
|
+
plan.groups = {name: PopulationGroup(
|
|
190
|
+
group_name=name,
|
|
191
|
+
level="sparse",
|
|
192
|
+
max_assets=_GROUP_MAX[name],
|
|
193
|
+
) for name in _ALL_GROUPS}
|
|
194
|
+
|
|
195
|
+
# Assign assets
|
|
196
|
+
self.assign_population_levels(env_plan, plan)
|
|
197
|
+
|
|
198
|
+
# Validate balance
|
|
199
|
+
balance = self.validate_population_balance(plan)
|
|
200
|
+
plan.balance_score = balance.get("balance_score", 0.0)
|
|
201
|
+
plan.warnings.extend(balance.get("warnings", []))
|
|
202
|
+
|
|
203
|
+
plan.total_assets = sum(g.asset_count for g in plan.groups.values())
|
|
204
|
+
plan.ok = True
|
|
205
|
+
|
|
206
|
+
except Exception as exc:
|
|
207
|
+
plan.ok = False
|
|
208
|
+
plan.errors.append(f"Population failed: {exc}")
|
|
209
|
+
|
|
210
|
+
return plan
|
|
211
|
+
|
|
212
|
+
def assign_population_levels(
|
|
213
|
+
self,
|
|
214
|
+
env_plan: EnvironmentPlan,
|
|
215
|
+
plan: PopulationPlan,
|
|
216
|
+
) -> None:
|
|
217
|
+
"""
|
|
218
|
+
Assign all zone assets to their population groups in-place.
|
|
219
|
+
Mutates plan.groups.
|
|
220
|
+
"""
|
|
221
|
+
for zone_name, zone in env_plan.zones.items():
|
|
222
|
+
for rec in zone.assigned_assets:
|
|
223
|
+
asset = rec.get("asset") or {}
|
|
224
|
+
category = str(asset.get("category", "")).lower()
|
|
225
|
+
group_name = _CAT_TO_GROUP.get(category, "support_assets")
|
|
226
|
+
|
|
227
|
+
group = plan.groups.get(group_name)
|
|
228
|
+
if group is None:
|
|
229
|
+
continue
|
|
230
|
+
|
|
231
|
+
if group.asset_count < group.max_assets:
|
|
232
|
+
group.assets.append(rec)
|
|
233
|
+
if zone_name not in group.zone_names:
|
|
234
|
+
group.zone_names.append(zone_name)
|
|
235
|
+
else:
|
|
236
|
+
# Overflow to detail_assets
|
|
237
|
+
detail = plan.groups.get("detail_assets")
|
|
238
|
+
if detail and detail.asset_count < detail.max_assets * 2:
|
|
239
|
+
detail.assets.append(rec)
|
|
240
|
+
else:
|
|
241
|
+
plan.warnings.append(
|
|
242
|
+
f"Asset {asset.get('name', '?')!r} could not be placed "
|
|
243
|
+
f"in any group — all groups full."
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
# Update levels based on fill ratio
|
|
247
|
+
for group in plan.groups.values():
|
|
248
|
+
group.level = _fill_level(group.fill_ratio)
|
|
249
|
+
|
|
250
|
+
def assign_support_assets(
|
|
251
|
+
self,
|
|
252
|
+
assets: List[Dict[str, Any]],
|
|
253
|
+
) -> List[Dict[str, Any]]:
|
|
254
|
+
"""Filter a recommendation list to support-category assets."""
|
|
255
|
+
support_cats = {"structure", "electronic", "furniture", "weapon"}
|
|
256
|
+
return [
|
|
257
|
+
a for a in assets
|
|
258
|
+
if str((a.get("asset") or {}).get("category", "")).lower() in support_cats
|
|
259
|
+
]
|
|
260
|
+
|
|
261
|
+
def assign_detail_assets(
|
|
262
|
+
self,
|
|
263
|
+
assets: List[Dict[str, Any]],
|
|
264
|
+
) -> List[Dict[str, Any]]:
|
|
265
|
+
"""Filter a recommendation list to detail-category assets."""
|
|
266
|
+
detail_cats = {"prop", "pipe", "conduit"}
|
|
267
|
+
return [
|
|
268
|
+
a for a in assets
|
|
269
|
+
if str((a.get("asset") or {}).get("category", "")).lower() in detail_cats
|
|
270
|
+
]
|
|
271
|
+
|
|
272
|
+
def validate_population_balance(self, plan: PopulationPlan) -> Dict[str, Any]:
|
|
273
|
+
"""
|
|
274
|
+
Check that population groups are proportionally balanced.
|
|
275
|
+
Returns balance_score (0–1) and advisory warnings.
|
|
276
|
+
"""
|
|
277
|
+
warnings: List[str] = []
|
|
278
|
+
score = 1.0
|
|
279
|
+
|
|
280
|
+
hero = plan.groups.get("hero_assets")
|
|
281
|
+
supp = plan.groups.get("support_assets")
|
|
282
|
+
det = plan.groups.get("detail_assets")
|
|
283
|
+
|
|
284
|
+
# Hero must have at least one asset
|
|
285
|
+
if hero and hero.asset_count == 0:
|
|
286
|
+
warnings.append("No hero assets — scene lacks a primary narrative focal point.")
|
|
287
|
+
score -= 0.4
|
|
288
|
+
|
|
289
|
+
# Support should not be empty if hero is populated
|
|
290
|
+
if hero and hero.asset_count > 0 and supp and supp.asset_count == 0:
|
|
291
|
+
warnings.append("No support assets — hero will look isolated without context.")
|
|
292
|
+
score -= 0.2
|
|
293
|
+
|
|
294
|
+
# Hero should not exceed its max
|
|
295
|
+
if hero and hero.asset_count > hero.max_assets:
|
|
296
|
+
warnings.append(
|
|
297
|
+
f"Hero group over-populated ({hero.asset_count} > {hero.max_assets})."
|
|
298
|
+
)
|
|
299
|
+
score -= 0.15
|
|
300
|
+
|
|
301
|
+
# Detail should not dominate
|
|
302
|
+
total = sum(g.asset_count for g in plan.groups.values())
|
|
303
|
+
if total > 0 and det:
|
|
304
|
+
detail_ratio = det.asset_count / total
|
|
305
|
+
if detail_ratio > 0.6:
|
|
306
|
+
warnings.append(
|
|
307
|
+
f"Detail assets dominate ({detail_ratio:.0%}) — scene may look cluttered."
|
|
308
|
+
)
|
|
309
|
+
score -= 0.1
|
|
310
|
+
|
|
311
|
+
return {
|
|
312
|
+
"balance_score": max(0.0, score),
|
|
313
|
+
"warnings": warnings,
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
# ---------------------------------------------------------------------------
|
|
318
|
+
# Helpers
|
|
319
|
+
# ---------------------------------------------------------------------------
|
|
320
|
+
|
|
321
|
+
def _fill_level(ratio: float) -> str:
|
|
322
|
+
if ratio <= 0.25:
|
|
323
|
+
return "sparse"
|
|
324
|
+
if ratio <= 0.65:
|
|
325
|
+
return "moderate"
|
|
326
|
+
return "dense"
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
# ---------------------------------------------------------------------------
|
|
330
|
+
# Singleton
|
|
331
|
+
# ---------------------------------------------------------------------------
|
|
332
|
+
|
|
333
|
+
_INSTANCE: Optional[ScenePopulationEngine] = None
|
|
334
|
+
_INSTANCE_LOCK = threading.Lock()
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
def get_scene_population_engine() -> ScenePopulationEngine:
|
|
338
|
+
"""Return the module-level singleton ScenePopulationEngine."""
|
|
339
|
+
global _INSTANCE
|
|
340
|
+
if _INSTANCE is None:
|
|
341
|
+
with _INSTANCE_LOCK:
|
|
342
|
+
if _INSTANCE is None:
|
|
343
|
+
_INSTANCE = ScenePopulationEngine()
|
|
344
|
+
return _INSTANCE
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def reset_scene_population_engine_for_tests() -> None:
|
|
348
|
+
"""Replace the singleton. For test isolation only."""
|
|
349
|
+
global _INSTANCE
|
|
350
|
+
with _INSTANCE_LOCK:
|
|
351
|
+
_INSTANCE = None
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Semantic Placement Rules (Tier 9.4 — Real Asset Spatial Intelligence)
|
|
3
|
+
====================================================================
|
|
4
|
+
Defines semantic relationships between placement types:
|
|
5
|
+
- Which types act as anchors and support child assets
|
|
6
|
+
(table supports chair, lantern, bucket)
|
|
7
|
+
- Where types prefer to be placed (bucket → service_area / wall zone)
|
|
8
|
+
- Preferred facing per type
|
|
9
|
+
|
|
10
|
+
DESIGN RULES:
|
|
11
|
+
1. No Houdini imports. No bridge calls. Rule tables only.
|
|
12
|
+
2. All rules are deterministic lookup tables — no heuristic logic.
|
|
13
|
+
3. Never raises in public methods.
|
|
14
|
+
|
|
15
|
+
Public API:
|
|
16
|
+
PlacementRule
|
|
17
|
+
SemanticPlacementRules
|
|
18
|
+
get_semantic_placement_rules()
|
|
19
|
+
reset_semantic_placement_rules_for_tests()
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import threading
|
|
25
|
+
from dataclasses import dataclass, field
|
|
26
|
+
from typing import Any, Dict, List, Optional
|
|
27
|
+
|
|
28
|
+
# ---------------------------------------------------------------------------
|
|
29
|
+
# PlacementRule dataclass
|
|
30
|
+
# ---------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class PlacementRule:
|
|
34
|
+
"""Semantic placement rules for one placement_type."""
|
|
35
|
+
|
|
36
|
+
placement_type: str
|
|
37
|
+
is_anchor: bool = False
|
|
38
|
+
supports: List[str] = field(default_factory=list) # child types
|
|
39
|
+
preferred_anchor: Optional[str] = None # anchor this attaches to
|
|
40
|
+
preferred_zones: List[str] = field(default_factory=list) # zone name fragments
|
|
41
|
+
anchor_distance_min: float = 0.5 # meters
|
|
42
|
+
anchor_distance_max: float = 1.5 # meters
|
|
43
|
+
facing_preferred: str = "inward"
|
|
44
|
+
clearance_radius: float = 0.3 # metres
|
|
45
|
+
|
|
46
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
47
|
+
return {
|
|
48
|
+
"placement_type": self.placement_type,
|
|
49
|
+
"is_anchor": self.is_anchor,
|
|
50
|
+
"supports": list(self.supports),
|
|
51
|
+
"preferred_anchor": self.preferred_anchor,
|
|
52
|
+
"preferred_zones": list(self.preferred_zones),
|
|
53
|
+
"anchor_distance_min": self.anchor_distance_min,
|
|
54
|
+
"anchor_distance_max": self.anchor_distance_max,
|
|
55
|
+
"facing_preferred": self.facing_preferred,
|
|
56
|
+
"clearance_radius": self.clearance_radius,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# ---------------------------------------------------------------------------
|
|
61
|
+
# Built-in rule table (16 types)
|
|
62
|
+
# ---------------------------------------------------------------------------
|
|
63
|
+
|
|
64
|
+
_BUILTIN_RULES: List[PlacementRule] = [
|
|
65
|
+
PlacementRule(
|
|
66
|
+
placement_type="table",
|
|
67
|
+
is_anchor=True,
|
|
68
|
+
supports=["chair", "stool", "bucket", "lantern"],
|
|
69
|
+
preferred_zones=["hero_zone", "midground"],
|
|
70
|
+
anchor_distance_min=0.0,
|
|
71
|
+
anchor_distance_max=0.0,
|
|
72
|
+
facing_preferred="camera",
|
|
73
|
+
clearance_radius=1.1,
|
|
74
|
+
),
|
|
75
|
+
PlacementRule(
|
|
76
|
+
placement_type="chair",
|
|
77
|
+
preferred_anchor="table",
|
|
78
|
+
preferred_zones=["hero_zone", "midground"],
|
|
79
|
+
anchor_distance_min=0.8,
|
|
80
|
+
anchor_distance_max=1.5,
|
|
81
|
+
facing_preferred="face_anchor",
|
|
82
|
+
clearance_radius=0.3,
|
|
83
|
+
),
|
|
84
|
+
PlacementRule(
|
|
85
|
+
placement_type="bench",
|
|
86
|
+
is_anchor=True,
|
|
87
|
+
supports=["bucket", "lantern"],
|
|
88
|
+
preferred_zones=["midground", "service_area"],
|
|
89
|
+
anchor_distance_min=0.0,
|
|
90
|
+
anchor_distance_max=0.0,
|
|
91
|
+
facing_preferred="camera",
|
|
92
|
+
clearance_radius=0.9,
|
|
93
|
+
),
|
|
94
|
+
PlacementRule(
|
|
95
|
+
placement_type="bucket",
|
|
96
|
+
preferred_zones=["service_area", "background",
|
|
97
|
+
"wall_run_left", "wall_run_right"],
|
|
98
|
+
anchor_distance_min=0.2,
|
|
99
|
+
anchor_distance_max=0.8,
|
|
100
|
+
facing_preferred="inward",
|
|
101
|
+
clearance_radius=0.2,
|
|
102
|
+
),
|
|
103
|
+
PlacementRule(
|
|
104
|
+
placement_type="barrel",
|
|
105
|
+
preferred_zones=["service_area", "background", "midground"],
|
|
106
|
+
anchor_distance_min=0.3,
|
|
107
|
+
anchor_distance_max=1.5,
|
|
108
|
+
facing_preferred="scattered",
|
|
109
|
+
clearance_radius=0.3,
|
|
110
|
+
),
|
|
111
|
+
PlacementRule(
|
|
112
|
+
placement_type="machine",
|
|
113
|
+
is_anchor=True,
|
|
114
|
+
supports=["pipe", "electronic", "bucket"],
|
|
115
|
+
preferred_zones=["hero_zone", "midground"],
|
|
116
|
+
anchor_distance_min=0.0,
|
|
117
|
+
anchor_distance_max=0.0,
|
|
118
|
+
facing_preferred="camera",
|
|
119
|
+
clearance_radius=2.0,
|
|
120
|
+
),
|
|
121
|
+
PlacementRule(
|
|
122
|
+
placement_type="crane",
|
|
123
|
+
is_anchor=True,
|
|
124
|
+
supports=["pipe"],
|
|
125
|
+
preferred_zones=["hero_zone"],
|
|
126
|
+
anchor_distance_min=0.0,
|
|
127
|
+
anchor_distance_max=0.0,
|
|
128
|
+
facing_preferred="camera",
|
|
129
|
+
clearance_radius=5.0,
|
|
130
|
+
),
|
|
131
|
+
PlacementRule(
|
|
132
|
+
placement_type="pipe",
|
|
133
|
+
preferred_anchor="machine",
|
|
134
|
+
preferred_zones=["midground", "background", "service_area"],
|
|
135
|
+
anchor_distance_min=1.0,
|
|
136
|
+
anchor_distance_max=3.0,
|
|
137
|
+
facing_preferred="inward",
|
|
138
|
+
clearance_radius=0.1,
|
|
139
|
+
),
|
|
140
|
+
PlacementRule(
|
|
141
|
+
placement_type="wall",
|
|
142
|
+
is_anchor=True,
|
|
143
|
+
supports=["lantern", "pipe", "column"],
|
|
144
|
+
preferred_zones=["background",
|
|
145
|
+
"wall_run_left", "wall_run_right",
|
|
146
|
+
"wall_panel_left", "wall_panel_right"],
|
|
147
|
+
anchor_distance_min=0.0,
|
|
148
|
+
anchor_distance_max=0.0,
|
|
149
|
+
facing_preferred="inward",
|
|
150
|
+
clearance_radius=0.15,
|
|
151
|
+
),
|
|
152
|
+
PlacementRule(
|
|
153
|
+
placement_type="door",
|
|
154
|
+
preferred_anchor="wall",
|
|
155
|
+
preferred_zones=["background"],
|
|
156
|
+
anchor_distance_min=0.0,
|
|
157
|
+
anchor_distance_max=0.5,
|
|
158
|
+
facing_preferred="camera",
|
|
159
|
+
clearance_radius=0.5,
|
|
160
|
+
),
|
|
161
|
+
PlacementRule(
|
|
162
|
+
placement_type="lantern",
|
|
163
|
+
preferred_anchor="table",
|
|
164
|
+
preferred_zones=["hero_zone", "midground",
|
|
165
|
+
"wall_run_left", "wall_run_right"],
|
|
166
|
+
anchor_distance_min=0.0,
|
|
167
|
+
anchor_distance_max=1.5,
|
|
168
|
+
facing_preferred="inward",
|
|
169
|
+
clearance_radius=0.15,
|
|
170
|
+
),
|
|
171
|
+
PlacementRule(
|
|
172
|
+
placement_type="column",
|
|
173
|
+
is_anchor=True,
|
|
174
|
+
supports=["lantern"],
|
|
175
|
+
preferred_zones=["background", "midground"],
|
|
176
|
+
anchor_distance_min=0.0,
|
|
177
|
+
anchor_distance_max=0.0,
|
|
178
|
+
facing_preferred="inward",
|
|
179
|
+
clearance_radius=0.3,
|
|
180
|
+
),
|
|
181
|
+
PlacementRule(
|
|
182
|
+
placement_type="platform",
|
|
183
|
+
is_anchor=True,
|
|
184
|
+
supports=["machine", "chair", "barrel", "bucket"],
|
|
185
|
+
preferred_zones=["hero_zone", "midground"],
|
|
186
|
+
anchor_distance_min=0.0,
|
|
187
|
+
anchor_distance_max=0.0,
|
|
188
|
+
facing_preferred="camera",
|
|
189
|
+
clearance_radius=1.5,
|
|
190
|
+
),
|
|
191
|
+
PlacementRule(
|
|
192
|
+
placement_type="vehicle",
|
|
193
|
+
preferred_zones=["hero_zone"],
|
|
194
|
+
anchor_distance_min=0.0,
|
|
195
|
+
anchor_distance_max=0.0,
|
|
196
|
+
facing_preferred="camera",
|
|
197
|
+
clearance_radius=2.5,
|
|
198
|
+
),
|
|
199
|
+
PlacementRule(
|
|
200
|
+
placement_type="terrain",
|
|
201
|
+
is_anchor=True,
|
|
202
|
+
supports=[
|
|
203
|
+
"table", "chair", "bench", "machine",
|
|
204
|
+
"vehicle", "barrel", "bucket",
|
|
205
|
+
],
|
|
206
|
+
preferred_zones=["background"],
|
|
207
|
+
anchor_distance_min=0.0,
|
|
208
|
+
anchor_distance_max=0.0,
|
|
209
|
+
facing_preferred="inward",
|
|
210
|
+
clearance_radius=5.0,
|
|
211
|
+
),
|
|
212
|
+
PlacementRule(
|
|
213
|
+
placement_type="unknown",
|
|
214
|
+
preferred_zones=["midground", "background"],
|
|
215
|
+
anchor_distance_min=0.3,
|
|
216
|
+
anchor_distance_max=1.0,
|
|
217
|
+
facing_preferred="camera",
|
|
218
|
+
clearance_radius=0.3,
|
|
219
|
+
),
|
|
220
|
+
]
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
# ---------------------------------------------------------------------------
|
|
224
|
+
# Engine
|
|
225
|
+
# ---------------------------------------------------------------------------
|
|
226
|
+
|
|
227
|
+
class SemanticPlacementRules:
|
|
228
|
+
"""Registry and evaluator for semantic placement rules."""
|
|
229
|
+
|
|
230
|
+
def __init__(self) -> None:
|
|
231
|
+
self._rules: Dict[str, PlacementRule] = {
|
|
232
|
+
r.placement_type: r for r in _BUILTIN_RULES
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
def get_rule(self, placement_type: str) -> PlacementRule:
|
|
236
|
+
"""Return the rule for *placement_type*, falling back to 'unknown'."""
|
|
237
|
+
return self._rules.get(placement_type, self._rules["unknown"])
|
|
238
|
+
|
|
239
|
+
def is_valid_anchor_relationship(
|
|
240
|
+
self,
|
|
241
|
+
anchor_type: str,
|
|
242
|
+
child_type: str,
|
|
243
|
+
) -> bool:
|
|
244
|
+
"""Return True if *child_type* is permitted to attach to *anchor_type*."""
|
|
245
|
+
rule = self._rules.get(anchor_type)
|
|
246
|
+
return rule is not None and rule.is_anchor and child_type in rule.supports
|
|
247
|
+
|
|
248
|
+
def check_zone_compatibility(
|
|
249
|
+
self,
|
|
250
|
+
placement_type: str,
|
|
251
|
+
zone_name: str,
|
|
252
|
+
) -> Dict[str, Any]:
|
|
253
|
+
"""
|
|
254
|
+
Return {"compatible": bool, "preferred": bool, "note": str}.
|
|
255
|
+
All placement types are compatible with all zones — only preference varies.
|
|
256
|
+
"""
|
|
257
|
+
rule = self.get_rule(placement_type)
|
|
258
|
+
preferred = any(pz in zone_name for pz in rule.preferred_zones)
|
|
259
|
+
return {
|
|
260
|
+
"compatible": True,
|
|
261
|
+
"preferred": preferred,
|
|
262
|
+
"note": (
|
|
263
|
+
f"'{placement_type}' prefers {rule.preferred_zones} — "
|
|
264
|
+
f"zone '{zone_name}' is {'preferred' if preferred else 'non-preferred'}."
|
|
265
|
+
),
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
def evaluate_semantic_compliance(
|
|
269
|
+
self,
|
|
270
|
+
placements: List[Dict[str, Any]],
|
|
271
|
+
) -> Dict[str, Any]:
|
|
272
|
+
"""
|
|
273
|
+
Score how well placed assets comply with semantic zone preferences.
|
|
274
|
+
|
|
275
|
+
Each placement dict: {"asset_id", "zone_name", "placement_type"}.
|
|
276
|
+
Returns {"score": float, "violations": List[str], "compliant_count": int, "total": int}.
|
|
277
|
+
"""
|
|
278
|
+
violations: List[str] = []
|
|
279
|
+
total = len(placements)
|
|
280
|
+
compliant = 0
|
|
281
|
+
|
|
282
|
+
for p in placements:
|
|
283
|
+
pt = str(p.get("placement_type", "unknown"))
|
|
284
|
+
zone = str(p.get("zone_name", ""))
|
|
285
|
+
check = self.check_zone_compatibility(pt, zone)
|
|
286
|
+
if check["preferred"]:
|
|
287
|
+
compliant += 1
|
|
288
|
+
else:
|
|
289
|
+
violations.append(
|
|
290
|
+
f"'{p.get('asset_id', '?')}' ({pt}) placed in "
|
|
291
|
+
f"non-preferred zone '{zone}'."
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
return {
|
|
295
|
+
"score": 1.0 if total == 0 else compliant / total,
|
|
296
|
+
"violations": violations,
|
|
297
|
+
"compliant_count": compliant,
|
|
298
|
+
"total": total,
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
# ---------------------------------------------------------------------------
|
|
303
|
+
# Singleton
|
|
304
|
+
# ---------------------------------------------------------------------------
|
|
305
|
+
_INSTANCE: Optional[SemanticPlacementRules] = None
|
|
306
|
+
_INSTANCE_LOCK = threading.Lock()
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def get_semantic_placement_rules() -> SemanticPlacementRules:
|
|
310
|
+
"""Return the module-level singleton SemanticPlacementRules."""
|
|
311
|
+
global _INSTANCE
|
|
312
|
+
if _INSTANCE is None:
|
|
313
|
+
with _INSTANCE_LOCK:
|
|
314
|
+
if _INSTANCE is None:
|
|
315
|
+
_INSTANCE = SemanticPlacementRules()
|
|
316
|
+
return _INSTANCE
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
def reset_semantic_placement_rules_for_tests() -> None:
|
|
320
|
+
"""Replace the singleton. For test isolation only."""
|
|
321
|
+
global _INSTANCE
|
|
322
|
+
with _INSTANCE_LOCK:
|
|
323
|
+
_INSTANCE = None
|