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,553 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Asset Placement Engine (Tier 9 — Semantic Asset Assembly)
|
|
3
|
+
==========================================================
|
|
4
|
+
Generates deterministic world-space placement for each asset in an
|
|
5
|
+
EnvironmentPlan.
|
|
6
|
+
|
|
7
|
+
Each asset receives:
|
|
8
|
+
- position (tx, ty, tz) — world-space translation
|
|
9
|
+
- rotation (rx, ry, rz) — Y-axis facing + optional tilt
|
|
10
|
+
- scale (sx, sy, sz) — uniform per category
|
|
11
|
+
|
|
12
|
+
Positions come from PlacementTemplates slot data.
|
|
13
|
+
Rotations come from facing-direction tables + per-slot overrides.
|
|
14
|
+
Scales come from category heuristics.
|
|
15
|
+
|
|
16
|
+
DESIGN RULES:
|
|
17
|
+
1. Deterministic — same EnvironmentPlan → same placement every time.
|
|
18
|
+
2. No randomness. No noise. Only arithmetic and lookup tables.
|
|
19
|
+
3. No bridge calls. No Houdini imports. Planning only.
|
|
20
|
+
4. Never raises — errors captured in PlacementPlan.errors.
|
|
21
|
+
|
|
22
|
+
Public API:
|
|
23
|
+
AssetPlacement
|
|
24
|
+
PlacementPlan
|
|
25
|
+
AssetPlacementEngine
|
|
26
|
+
get_asset_placement_engine()
|
|
27
|
+
reset_asset_placement_engine_for_tests()
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from __future__ import annotations
|
|
31
|
+
|
|
32
|
+
import threading
|
|
33
|
+
import time
|
|
34
|
+
import uuid
|
|
35
|
+
from dataclasses import dataclass, field
|
|
36
|
+
from typing import Any, Dict, List, Optional, Tuple
|
|
37
|
+
|
|
38
|
+
from src.runtime.assets.assembly.environment_builder import EnvironmentPlan, EnvironmentZone
|
|
39
|
+
from src.runtime.assets.assembly.placement_templates import get_placement_templates
|
|
40
|
+
from src.runtime.assets.assembly.bounding_box_extractor import get_bbox_extractor
|
|
41
|
+
from src.runtime.assets.assembly.collision_detector import get_collision_detector
|
|
42
|
+
from src.runtime.assets.assembly.clearance_validator import get_clearance_validator
|
|
43
|
+
from src.runtime.assets.assembly.placement_optimizer import get_placement_optimizer
|
|
44
|
+
from src.runtime.assets.assembly.asset_scale_analyzer import get_asset_scale_analyzer
|
|
45
|
+
from src.runtime.assets.assembly.layout_spacing_engine import get_layout_spacing_engine
|
|
46
|
+
from src.runtime.assets.assembly.placement_relationships import get_placement_relationships
|
|
47
|
+
|
|
48
|
+
# ---------------------------------------------------------------------------
|
|
49
|
+
# Category → uniform scale
|
|
50
|
+
# ---------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
_CATEGORY_SCALES: Dict[str, float] = {
|
|
53
|
+
"vehicle": 1.0,
|
|
54
|
+
"character": 1.0,
|
|
55
|
+
"robot": 1.0,
|
|
56
|
+
"machinery": 1.0,
|
|
57
|
+
"electronic": 0.8,
|
|
58
|
+
"prop": 0.7,
|
|
59
|
+
"furniture": 0.8,
|
|
60
|
+
"structure": 1.2,
|
|
61
|
+
"architectural": 1.4,
|
|
62
|
+
"terrain": 2.0,
|
|
63
|
+
"pipe": 0.9,
|
|
64
|
+
"vegetation": 1.0,
|
|
65
|
+
"creature": 1.0,
|
|
66
|
+
"weapon": 0.85,
|
|
67
|
+
"hdri": 1.0,
|
|
68
|
+
"material": 1.0,
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_DEFAULT_SCALE = 1.0
|
|
72
|
+
|
|
73
|
+
# Facing direction → base Y rotation (degrees)
|
|
74
|
+
_FACING_ROTY: Dict[str, float] = {
|
|
75
|
+
"camera": 0.0,
|
|
76
|
+
"inward": 180.0,
|
|
77
|
+
"outward": 0.0,
|
|
78
|
+
"forward": 0.0,
|
|
79
|
+
"scattered": 45.0,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# ---------------------------------------------------------------------------
|
|
84
|
+
# Data models
|
|
85
|
+
# ---------------------------------------------------------------------------
|
|
86
|
+
|
|
87
|
+
@dataclass
|
|
88
|
+
class AssetPlacement:
|
|
89
|
+
"""World-space placement for one asset."""
|
|
90
|
+
|
|
91
|
+
asset_name: str
|
|
92
|
+
zone_name: str
|
|
93
|
+
slot_index: int
|
|
94
|
+
position: Tuple[float, float, float] = (0.0, 0.0, 0.0)
|
|
95
|
+
rotation: Tuple[float, float, float] = (0.0, 0.0, 0.0)
|
|
96
|
+
scale: Tuple[float, float, float] = (1.0, 1.0, 1.0)
|
|
97
|
+
category: str = ""
|
|
98
|
+
facing: str = "camera"
|
|
99
|
+
notes: List[str] = field(default_factory=list)
|
|
100
|
+
spatial_metadata: Optional[Dict[str, Any]] = field(default=None) # SpatialMetadata.to_dict()
|
|
101
|
+
# Tier 9.6: scale classification and semantic role
|
|
102
|
+
scale_class: str = "medium" # tiny/small/medium/large/structural
|
|
103
|
+
role: str = "prop" # seating/furniture_anchor/decoration/structure/…
|
|
104
|
+
is_structural: bool = False # True → routed to structure builder
|
|
105
|
+
|
|
106
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
107
|
+
return {
|
|
108
|
+
"asset_name": self.asset_name,
|
|
109
|
+
"zone_name": self.zone_name,
|
|
110
|
+
"slot_index": self.slot_index,
|
|
111
|
+
"position": list(self.position),
|
|
112
|
+
"rotation": list(self.rotation),
|
|
113
|
+
"scale": list(self.scale),
|
|
114
|
+
"category": self.category,
|
|
115
|
+
"facing": self.facing,
|
|
116
|
+
"notes": list(self.notes),
|
|
117
|
+
"spatial_metadata": self.spatial_metadata,
|
|
118
|
+
"scale_class": self.scale_class,
|
|
119
|
+
"role": self.role,
|
|
120
|
+
"is_structural": self.is_structural,
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@classmethod
|
|
124
|
+
def from_dict(cls, d: Dict[str, Any]) -> "AssetPlacement":
|
|
125
|
+
return cls(
|
|
126
|
+
asset_name=str(d.get("asset_name", "")),
|
|
127
|
+
zone_name=str(d.get("zone_name", "")),
|
|
128
|
+
slot_index=int(d.get("slot_index", 0)),
|
|
129
|
+
position=tuple(d.get("position", [0.0, 0.0, 0.0])), # type: ignore[arg-type]
|
|
130
|
+
rotation=tuple(d.get("rotation", [0.0, 0.0, 0.0])), # type: ignore[arg-type]
|
|
131
|
+
scale=tuple(d.get("scale", [1.0, 1.0, 1.0])), # type: ignore[arg-type]
|
|
132
|
+
category=str(d.get("category", "")),
|
|
133
|
+
facing=str(d.get("facing", "camera")),
|
|
134
|
+
notes=list(d.get("notes") or []),
|
|
135
|
+
spatial_metadata=d.get("spatial_metadata"),
|
|
136
|
+
scale_class=str(d.get("scale_class", "medium")),
|
|
137
|
+
role=str(d.get("role", "prop")),
|
|
138
|
+
is_structural=bool(d.get("is_structural", False)),
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@dataclass
|
|
143
|
+
class PlacementPlan:
|
|
144
|
+
"""Placement plan for an entire environment."""
|
|
145
|
+
|
|
146
|
+
plan_id: str = field(default_factory=lambda: f"place_{uuid.uuid4().hex[:10]}")
|
|
147
|
+
environment: str = ""
|
|
148
|
+
placements: List[AssetPlacement] = field(default_factory=list)
|
|
149
|
+
zone_counts: Dict[str, int] = field(default_factory=dict)
|
|
150
|
+
total_placed: int = 0
|
|
151
|
+
collision_count: int = 0 # collisions remaining after optimization
|
|
152
|
+
clearance_violations: int = 0 # clearance violations remaining after optimization
|
|
153
|
+
spatial_optimized: bool = False
|
|
154
|
+
ok: bool = True
|
|
155
|
+
errors: List[str] = field(default_factory=list)
|
|
156
|
+
warnings: List[str] = field(default_factory=list)
|
|
157
|
+
generated_at: float = field(default_factory=time.time)
|
|
158
|
+
|
|
159
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
160
|
+
return {
|
|
161
|
+
"plan_id": self.plan_id,
|
|
162
|
+
"environment": self.environment,
|
|
163
|
+
"placements": [p.to_dict() for p in self.placements],
|
|
164
|
+
"zone_counts": dict(self.zone_counts),
|
|
165
|
+
"total_placed": self.total_placed,
|
|
166
|
+
"collision_count": self.collision_count,
|
|
167
|
+
"clearance_violations": self.clearance_violations,
|
|
168
|
+
"spatial_optimized": self.spatial_optimized,
|
|
169
|
+
"ok": self.ok,
|
|
170
|
+
"errors": list(self.errors),
|
|
171
|
+
"warnings": list(self.warnings),
|
|
172
|
+
"generated_at": self.generated_at,
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@classmethod
|
|
176
|
+
def from_dict(cls, d: Dict[str, Any]) -> "PlacementPlan":
|
|
177
|
+
return cls(
|
|
178
|
+
plan_id=str(d.get("plan_id", f"place_{uuid.uuid4().hex[:10]}")),
|
|
179
|
+
environment=str(d.get("environment", "")),
|
|
180
|
+
placements=[AssetPlacement.from_dict(p) for p in (d.get("placements") or [])],
|
|
181
|
+
zone_counts=dict(d.get("zone_counts") or {}),
|
|
182
|
+
total_placed=int(d.get("total_placed", 0)),
|
|
183
|
+
collision_count=int(d.get("collision_count", 0)),
|
|
184
|
+
clearance_violations=int(d.get("clearance_violations", 0)),
|
|
185
|
+
spatial_optimized=bool(d.get("spatial_optimized", False)),
|
|
186
|
+
ok=bool(d.get("ok", True)),
|
|
187
|
+
errors=list(d.get("errors") or []),
|
|
188
|
+
warnings=list(d.get("warnings") or []),
|
|
189
|
+
generated_at=float(d.get("generated_at", 0.0)),
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
# ---------------------------------------------------------------------------
|
|
194
|
+
# Engine
|
|
195
|
+
# ---------------------------------------------------------------------------
|
|
196
|
+
|
|
197
|
+
class AssetPlacementEngine:
|
|
198
|
+
"""
|
|
199
|
+
Generates deterministic asset placement plans from an EnvironmentPlan.
|
|
200
|
+
No randomness. No noise. Only arithmetic and lookup tables.
|
|
201
|
+
"""
|
|
202
|
+
|
|
203
|
+
def generate_placement_plan(self, env_plan: EnvironmentPlan) -> PlacementPlan:
|
|
204
|
+
"""
|
|
205
|
+
Build a full PlacementPlan from an EnvironmentPlan.
|
|
206
|
+
|
|
207
|
+
Steps:
|
|
208
|
+
1. Assign slot positions, rotations, and scales from templates.
|
|
209
|
+
2. Build SpatialMetadata for every asset (real bbox / footprint).
|
|
210
|
+
3. Run PlacementOptimizer to resolve collisions and clearance.
|
|
211
|
+
4. Run final collision / clearance validation for reporting.
|
|
212
|
+
|
|
213
|
+
Never raises — errors captured in PlacementPlan.errors.
|
|
214
|
+
"""
|
|
215
|
+
plan = PlacementPlan(environment=env_plan.environment)
|
|
216
|
+
try:
|
|
217
|
+
tmpl = get_placement_templates().get_template_or_default(env_plan.environment)
|
|
218
|
+
positions = self.assign_asset_positions(env_plan, tmpl)
|
|
219
|
+
rotations = self.assign_asset_rotations(env_plan, tmpl)
|
|
220
|
+
scales = self.assign_asset_scales(env_plan)
|
|
221
|
+
|
|
222
|
+
bbox_ext = get_bbox_extractor()
|
|
223
|
+
scale_analyzer = get_asset_scale_analyzer()
|
|
224
|
+
relationships = get_placement_relationships()
|
|
225
|
+
|
|
226
|
+
# Phase 1: build initial placements + collect spatial data
|
|
227
|
+
# 7-step scale-aware pipeline per asset:
|
|
228
|
+
# 1. Analyze asset scale (unit normalize + classify)
|
|
229
|
+
# 2. Calculate footprint
|
|
230
|
+
# 3. Select semantic zone (already done by EnvironmentBuilder)
|
|
231
|
+
# 4. Compute valid position (template slot or scale-aware fallback)
|
|
232
|
+
# 5. Validate spacing (via PlacementOptimizer below)
|
|
233
|
+
# 6. Validate collisions (via CollisionDetector below)
|
|
234
|
+
# 7. Commit placement
|
|
235
|
+
spatial_input: List[Tuple[
|
|
236
|
+
str,
|
|
237
|
+
Tuple[float, float, float],
|
|
238
|
+
Any, # SpatialMetadata
|
|
239
|
+
]] = []
|
|
240
|
+
|
|
241
|
+
for zone_name in env_plan.zone_order or list(env_plan.zones.keys()):
|
|
242
|
+
zone = env_plan.zones.get(zone_name)
|
|
243
|
+
if not zone:
|
|
244
|
+
continue
|
|
245
|
+
for idx, rec in enumerate(zone.assigned_assets):
|
|
246
|
+
asset = rec.get("asset") or {}
|
|
247
|
+
asset_name = str(asset.get("name") or asset.get("asset_id") or f"asset_{idx}")
|
|
248
|
+
key = f"{zone_name}/{asset_name}"
|
|
249
|
+
pos = positions.get(key, (0.0, 0.0, 0.0))
|
|
250
|
+
rot = rotations.get(key, (0.0, 0.0, 0.0))
|
|
251
|
+
scl = scales.get(str(asset.get("category", "")))
|
|
252
|
+
uniform_s = scl if scl is not None else _DEFAULT_SCALE
|
|
253
|
+
|
|
254
|
+
# Step 1: Analyze scale — normalizes units and classifies
|
|
255
|
+
scale_profile = scale_analyzer.analyze_asset(asset)
|
|
256
|
+
|
|
257
|
+
# Step 2: Get role for semantic routing
|
|
258
|
+
a_type = str(asset.get("type") or asset.get("asset_type") or "")
|
|
259
|
+
a_cat = str(asset.get("category") or "")
|
|
260
|
+
role = relationships.get_role(a_type, a_cat)
|
|
261
|
+
is_structural = scale_profile.is_structural
|
|
262
|
+
|
|
263
|
+
# Structural assets get flagged; position still assigned
|
|
264
|
+
# (physical realization routes them to StructureBuilder)
|
|
265
|
+
if is_structural:
|
|
266
|
+
plan.warnings.append(
|
|
267
|
+
f"Structural asset '{asset_name}' in zone '{zone_name}' "
|
|
268
|
+
f"— route to EnvironmentStructureBuilder for physical placement."
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
# Step 4: Build spatial metadata from unit-normalized dimensions
|
|
272
|
+
meta = bbox_ext.build_spatial_metadata(asset)
|
|
273
|
+
|
|
274
|
+
placement = AssetPlacement(
|
|
275
|
+
asset_name = asset_name,
|
|
276
|
+
zone_name = zone_name,
|
|
277
|
+
slot_index = idx,
|
|
278
|
+
position = pos,
|
|
279
|
+
rotation = rot,
|
|
280
|
+
scale = (uniform_s, uniform_s, uniform_s),
|
|
281
|
+
category = a_cat,
|
|
282
|
+
facing = zone.facing,
|
|
283
|
+
spatial_metadata = meta.to_dict(),
|
|
284
|
+
scale_class = scale_profile.asset_scale_class,
|
|
285
|
+
role = role,
|
|
286
|
+
is_structural = is_structural,
|
|
287
|
+
)
|
|
288
|
+
plan.placements.append(placement)
|
|
289
|
+
spatial_input.append((key, pos, meta))
|
|
290
|
+
plan.zone_counts[zone_name] = len(zone.assigned_assets)
|
|
291
|
+
|
|
292
|
+
# Phase 2: spatial optimization — resolve collisions & clearance
|
|
293
|
+
if spatial_input:
|
|
294
|
+
opt_plan = get_placement_optimizer().optimize_layout(spatial_input)
|
|
295
|
+
plan.spatial_optimized = True
|
|
296
|
+
plan.warnings.extend(opt_plan.warnings)
|
|
297
|
+
|
|
298
|
+
# Map optimized positions back to placements
|
|
299
|
+
pos_map = {p.asset_id: p.final_pos for p in opt_plan.placements}
|
|
300
|
+
for p in plan.placements:
|
|
301
|
+
opt_key = f"{p.zone_name}/{p.asset_name}"
|
|
302
|
+
if opt_key in pos_map:
|
|
303
|
+
p.position = pos_map[opt_key]
|
|
304
|
+
|
|
305
|
+
# Phase 3: post-optimization spatial validation (for reporting)
|
|
306
|
+
final_spatial = [
|
|
307
|
+
(f"{p.zone_name}/{p.asset_name}", p.position,
|
|
308
|
+
bbox_ext.build_spatial_metadata(
|
|
309
|
+
{"category": p.category, "asset_id": p.asset_name}
|
|
310
|
+
))
|
|
311
|
+
for p in plan.placements
|
|
312
|
+
]
|
|
313
|
+
if final_spatial:
|
|
314
|
+
col_report = get_collision_detector().validate_scene(final_spatial)
|
|
315
|
+
clr_report = get_clearance_validator().validate_scene_clearance(final_spatial)
|
|
316
|
+
plan.collision_count = col_report.collision_count
|
|
317
|
+
plan.clearance_violations = clr_report.violation_count
|
|
318
|
+
if col_report.collision_count > 0:
|
|
319
|
+
plan.warnings.append(
|
|
320
|
+
f"{col_report.collision_count} collision(s) remain after optimization."
|
|
321
|
+
)
|
|
322
|
+
if clr_report.violation_count > 0:
|
|
323
|
+
plan.warnings.append(
|
|
324
|
+
f"{clr_report.violation_count} clearance violation(s) remain."
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
# Legacy spacing check (duplicate-position guard)
|
|
328
|
+
spacing_result = self.validate_spacing(plan)
|
|
329
|
+
plan.warnings.extend(spacing_result.get("warnings", []))
|
|
330
|
+
|
|
331
|
+
plan.total_placed = len(plan.placements)
|
|
332
|
+
plan.ok = True
|
|
333
|
+
|
|
334
|
+
except Exception as exc:
|
|
335
|
+
plan.ok = False
|
|
336
|
+
plan.errors.append(f"Placement plan failed: {exc}")
|
|
337
|
+
|
|
338
|
+
return plan
|
|
339
|
+
|
|
340
|
+
def assign_asset_positions(
|
|
341
|
+
self,
|
|
342
|
+
env_plan: EnvironmentPlan,
|
|
343
|
+
template: Dict[str, Any],
|
|
344
|
+
) -> Dict[str, Tuple[float, float, float]]:
|
|
345
|
+
"""
|
|
346
|
+
Map each asset to a world-space (tx, ty, tz) position.
|
|
347
|
+
Key: "{zone_name}/{asset_name}"
|
|
348
|
+
"""
|
|
349
|
+
result: Dict[str, Tuple[float, float, float]] = {}
|
|
350
|
+
depths = template.get("zone_depths", {})
|
|
351
|
+
|
|
352
|
+
for zone_name in env_plan.zone_order or list(env_plan.zones.keys()):
|
|
353
|
+
zone = env_plan.zones.get(zone_name)
|
|
354
|
+
if not zone:
|
|
355
|
+
continue
|
|
356
|
+
zone_tmpl = template.get(zone_name)
|
|
357
|
+
depth_z = float(depths.get(zone_name, 0.0))
|
|
358
|
+
|
|
359
|
+
for idx, rec in enumerate(zone.assigned_assets):
|
|
360
|
+
asset = rec.get("asset") or {}
|
|
361
|
+
asset_name = str(asset.get("name") or asset.get("asset_id") or f"asset_{idx}")
|
|
362
|
+
key = f"{zone_name}/{asset_name}"
|
|
363
|
+
|
|
364
|
+
pos = _slot_position(zone_tmpl, idx, depth_z, zone.width)
|
|
365
|
+
result[key] = pos
|
|
366
|
+
|
|
367
|
+
return result
|
|
368
|
+
|
|
369
|
+
def assign_asset_rotations(
|
|
370
|
+
self,
|
|
371
|
+
env_plan: EnvironmentPlan,
|
|
372
|
+
template: Dict[str, Any],
|
|
373
|
+
) -> Dict[str, Tuple[float, float, float]]:
|
|
374
|
+
"""
|
|
375
|
+
Map each asset to a (rx, ry, rz) rotation tuple.
|
|
376
|
+
Key: "{zone_name}/{asset_name}"
|
|
377
|
+
"""
|
|
378
|
+
result: Dict[str, Tuple[float, float, float]] = {}
|
|
379
|
+
|
|
380
|
+
for zone_name in env_plan.zone_order or list(env_plan.zones.keys()):
|
|
381
|
+
zone = env_plan.zones.get(zone_name)
|
|
382
|
+
if not zone:
|
|
383
|
+
continue
|
|
384
|
+
zone_tmpl = template.get(zone_name)
|
|
385
|
+
count = len(zone.assigned_assets)
|
|
386
|
+
|
|
387
|
+
for idx, rec in enumerate(zone.assigned_assets):
|
|
388
|
+
asset = rec.get("asset") or {}
|
|
389
|
+
asset_name = str(asset.get("name") or asset.get("asset_id") or f"asset_{idx}")
|
|
390
|
+
key = f"{zone_name}/{asset_name}"
|
|
391
|
+
ry = _slot_rotation_y(zone_tmpl, idx, count, zone.facing)
|
|
392
|
+
result[key] = (0.0, ry, 0.0)
|
|
393
|
+
|
|
394
|
+
return result
|
|
395
|
+
|
|
396
|
+
def assign_asset_scales(
|
|
397
|
+
self,
|
|
398
|
+
env_plan: EnvironmentPlan,
|
|
399
|
+
) -> Dict[str, float]:
|
|
400
|
+
"""
|
|
401
|
+
Return category → uniform scale factor mapping.
|
|
402
|
+
"""
|
|
403
|
+
result: Dict[str, float] = dict(_CATEGORY_SCALES)
|
|
404
|
+
# Override from zone categories to catch any environment-specific hints
|
|
405
|
+
for zone in env_plan.zones.values():
|
|
406
|
+
for cat in zone.categories:
|
|
407
|
+
if cat not in result:
|
|
408
|
+
result[cat] = _DEFAULT_SCALE
|
|
409
|
+
return result
|
|
410
|
+
|
|
411
|
+
def validate_spacing(self, plan: PlacementPlan) -> Dict[str, Any]:
|
|
412
|
+
"""
|
|
413
|
+
Check that no two assets in the same zone share the same slot position.
|
|
414
|
+
Returns warnings list.
|
|
415
|
+
"""
|
|
416
|
+
warnings: List[str] = []
|
|
417
|
+
seen: Dict[str, set] = {}
|
|
418
|
+
for p in plan.placements:
|
|
419
|
+
key = p.zone_name
|
|
420
|
+
pos_key = (round(p.position[0], 2), round(p.position[1], 2), round(p.position[2], 2))
|
|
421
|
+
if key not in seen:
|
|
422
|
+
seen[key] = set()
|
|
423
|
+
if pos_key in seen[key]:
|
|
424
|
+
warnings.append(
|
|
425
|
+
f"Duplicate position {pos_key} in zone {p.zone_name!r} "
|
|
426
|
+
f"for asset {p.asset_name!r}."
|
|
427
|
+
)
|
|
428
|
+
seen[key].add(pos_key)
|
|
429
|
+
return {"warnings": warnings}
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
# ---------------------------------------------------------------------------
|
|
433
|
+
# Internal helpers
|
|
434
|
+
# ---------------------------------------------------------------------------
|
|
435
|
+
|
|
436
|
+
def _slot_position(
|
|
437
|
+
zone_tmpl: Any,
|
|
438
|
+
idx: int,
|
|
439
|
+
depth_z: float,
|
|
440
|
+
width: float,
|
|
441
|
+
) -> Tuple[float, float, float]:
|
|
442
|
+
"""Resolve world-space (tx, ty, tz) for a slot index in a zone template."""
|
|
443
|
+
if zone_tmpl is None:
|
|
444
|
+
# Evenly-spaced fallback
|
|
445
|
+
return (_even_offset(idx, width), 0.0, depth_z)
|
|
446
|
+
|
|
447
|
+
if isinstance(zone_tmpl, list):
|
|
448
|
+
# Wall-run / panel list — raw (x, y, z) tuples
|
|
449
|
+
if idx < len(zone_tmpl):
|
|
450
|
+
s = zone_tmpl[idx]
|
|
451
|
+
return (float(s[0]), float(s[1]), float(s[2]))
|
|
452
|
+
# Scale-aware overflow: use ~1.5 m step (replaces fixed 2.0 m)
|
|
453
|
+
base = zone_tmpl[-1] if zone_tmpl else (0.0, 0.0, depth_z)
|
|
454
|
+
step = _scale_aware_step(width)
|
|
455
|
+
return (float(base[0]), float(base[1]), float(base[2]) - (idx - len(zone_tmpl) + 1) * step)
|
|
456
|
+
|
|
457
|
+
if isinstance(zone_tmpl, dict):
|
|
458
|
+
slots_raw = zone_tmpl.get("slots")
|
|
459
|
+
y_offset = float(zone_tmpl.get("y_offset", 0.0))
|
|
460
|
+
|
|
461
|
+
if isinstance(slots_raw, dict):
|
|
462
|
+
# hero_zone keyed by count — pick actual count key or nearest
|
|
463
|
+
count = idx + 1
|
|
464
|
+
best_key = min(slots_raw.keys(), key=lambda k: abs(int(k) - count))
|
|
465
|
+
slot_list = slots_raw[best_key]
|
|
466
|
+
if idx < len(slot_list):
|
|
467
|
+
s = slot_list[idx]
|
|
468
|
+
return (float(s[0]), y_offset + float(s[1]), float(s[2]))
|
|
469
|
+
# Scale-aware overflow (replaces fixed 3.0 m)
|
|
470
|
+
last = slot_list[-1] if slot_list else (0.0, 0.0, depth_z)
|
|
471
|
+
step = _scale_aware_step(width)
|
|
472
|
+
return (float(last[0]) + (idx - len(slot_list) + 1) * step, y_offset, float(last[2]))
|
|
473
|
+
|
|
474
|
+
if isinstance(slots_raw, list):
|
|
475
|
+
if idx < len(slots_raw):
|
|
476
|
+
s = slots_raw[idx]
|
|
477
|
+
return (float(s[0]), y_offset + float(s[1]), float(s[2]))
|
|
478
|
+
last = slots_raw[-1] if slots_raw else (0.0, 0.0, depth_z)
|
|
479
|
+
step = _scale_aware_step(width)
|
|
480
|
+
return (float(last[0]) + (idx - len(slots_raw) + 1) * step, y_offset, float(last[2]))
|
|
481
|
+
|
|
482
|
+
# Fallback
|
|
483
|
+
return (_even_offset(idx, width), 0.0, depth_z)
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
def _slot_rotation_y(
|
|
487
|
+
zone_tmpl: Any,
|
|
488
|
+
idx: int,
|
|
489
|
+
count: int,
|
|
490
|
+
facing: str,
|
|
491
|
+
) -> float:
|
|
492
|
+
"""Resolve Y rotation for a slot."""
|
|
493
|
+
base = _FACING_ROTY.get(facing, 0.0)
|
|
494
|
+
|
|
495
|
+
if not isinstance(zone_tmpl, dict):
|
|
496
|
+
return base
|
|
497
|
+
|
|
498
|
+
# Per-slot rotation table (hero_zone pattern)
|
|
499
|
+
per_slot = zone_tmpl.get("rotation_y_per_slot")
|
|
500
|
+
if isinstance(per_slot, dict):
|
|
501
|
+
best_key = min(per_slot.keys(), key=lambda k: abs(int(k) - count))
|
|
502
|
+
rots = per_slot[best_key]
|
|
503
|
+
if idx < len(rots):
|
|
504
|
+
return float(rots[idx])
|
|
505
|
+
|
|
506
|
+
# Single base rotation (inward / outward zones)
|
|
507
|
+
rot_base = zone_tmpl.get("rotation_y_base")
|
|
508
|
+
if rot_base is not None:
|
|
509
|
+
side = 1.0 if idx % 2 == 0 else -1.0
|
|
510
|
+
return float(rot_base) * side
|
|
511
|
+
|
|
512
|
+
return base
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
def _even_offset(idx: int, width: float) -> float:
|
|
516
|
+
"""Simple evenly-spaced X offset centred at 0."""
|
|
517
|
+
return (idx - 0) * (width / max(1, 3))
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
def _scale_aware_step(zone_width: float) -> float:
|
|
521
|
+
"""Return a sensible overflow step (metres) based on zone width.
|
|
522
|
+
|
|
523
|
+
Replaces the hard-coded 2.0 / 3.0 m constants so overflow assets are
|
|
524
|
+
spaced relative to the zone's declared width rather than an arbitrary
|
|
525
|
+
fixed distance. Clamped to [0.8, 3.0] m.
|
|
526
|
+
"""
|
|
527
|
+
step = zone_width / 4.0
|
|
528
|
+
return max(0.8, min(3.0, step))
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
# ---------------------------------------------------------------------------
|
|
532
|
+
# Singleton
|
|
533
|
+
# ---------------------------------------------------------------------------
|
|
534
|
+
|
|
535
|
+
_INSTANCE: Optional[AssetPlacementEngine] = None
|
|
536
|
+
_INSTANCE_LOCK = threading.Lock()
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
def get_asset_placement_engine() -> AssetPlacementEngine:
|
|
540
|
+
"""Return the module-level singleton AssetPlacementEngine."""
|
|
541
|
+
global _INSTANCE
|
|
542
|
+
if _INSTANCE is None:
|
|
543
|
+
with _INSTANCE_LOCK:
|
|
544
|
+
if _INSTANCE is None:
|
|
545
|
+
_INSTANCE = AssetPlacementEngine()
|
|
546
|
+
return _INSTANCE
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
def reset_asset_placement_engine_for_tests() -> None:
|
|
550
|
+
"""Replace the singleton. For test isolation only."""
|
|
551
|
+
global _INSTANCE
|
|
552
|
+
with _INSTANCE_LOCK:
|
|
553
|
+
_INSTANCE = None
|