unitytk 0.0.11__tar.gz → 0.0.12__tar.gz

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.
Files changed (56) hide show
  1. {unitytk-0.0.11/unitytk.egg-info → unitytk-0.0.12}/PKG-INFO +1 -1
  2. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_render_opacity_e2e.py +14 -13
  3. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_shared_material_standalone.py +26 -27
  4. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/__init__.py +1 -1
  5. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/RenderEffectsController.cs +1 -1
  6. {unitytk-0.0.11 → unitytk-0.0.12/unitytk.egg-info}/PKG-INFO +1 -1
  7. {unitytk-0.0.11 → unitytk-0.0.12}/LICENSE +0 -0
  8. {unitytk-0.0.11 → unitytk-0.0.12}/MANIFEST.in +0 -0
  9. {unitytk-0.0.11 → unitytk-0.0.12}/docs/README.md +0 -0
  10. {unitytk-0.0.11 → unitytk-0.0.12}/pyproject.toml +0 -0
  11. {unitytk-0.0.11 → unitytk-0.0.12}/setup.cfg +0 -0
  12. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_asset_delivery.py +0 -0
  13. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_audio_events_integration.py +0 -0
  14. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_base_test.py +0 -0
  15. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_bool_to_fade_curve.py +0 -0
  16. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_clip_name_contract_integration.py +0 -0
  17. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_controller_runtime_integration.py +0 -0
  18. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_deploy_templates.py +0 -0
  19. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_emissive_groups_integration.py +0 -0
  20. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_fade_window_preservation.py +0 -0
  21. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_keyed_visibility.py +0 -0
  22. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_launcher.py +0 -0
  23. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_lightmap_metadata_integration.py +0 -0
  24. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_multi_section_audio_integration.py +0 -0
  25. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_render_effects_e2e.py +0 -0
  26. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_render_opacity_controller.py +0 -0
  27. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_render_opacity_integration.py +0 -0
  28. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_run_tests.py +0 -0
  29. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_scene_builder.py +0 -0
  30. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_shadow_plane_integration.py +0 -0
  31. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_shadow_plane_runtime_integration.py +0 -0
  32. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_shot_metadata_integration.py +0 -0
  33. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_shots_audio_sidebyside_integration.py +0 -0
  34. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_standalone_enduser.py +0 -0
  35. {unitytk-0.0.11 → unitytk-0.0.12}/test/test_temp_projects.py +0 -0
  36. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/asset_delivery.py +0 -0
  37. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/launcher.py +0 -0
  38. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/scene_builder.py +0 -0
  39. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/template_deployer.py +0 -0
  40. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/AudioEventController.cs +0 -0
  41. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/EmissiveGroupController.cs +0 -0
  42. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/EmissiveGroups.hlsl +0 -0
  43. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/EmissiveGroupsLit.shader +0 -0
  44. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/LightmapMetadataController.cs +0 -0
  45. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/M3trik.Unitytk.asmdef +0 -0
  46. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/README.md +0 -0
  47. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/ShadowPlane.shader +0 -0
  48. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/ShadowPlaneController.cs +0 -0
  49. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/ShadowPlaneHorizon.hlsl +0 -0
  50. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/ShotMetadataController.cs +0 -0
  51. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/UnitytkSettings.cs +0 -0
  52. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk/templates/__init__.py +0 -0
  53. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk.egg-info/SOURCES.txt +0 -0
  54. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk.egg-info/dependency_links.txt +0 -0
  55. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk.egg-info/requires.txt +0 -0
  56. {unitytk-0.0.11 → unitytk-0.0.12}/unitytk.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitytk
3
- Version: 0.0.11
3
+ Version: 0.0.12
4
4
  Summary: A modular Python toolkit for Unity interaction.
5
5
  Author-email: Ryan Simpson <m3trik@outlook.com>
6
6
  License: MIT
@@ -11,8 +11,8 @@ curve values, reimport idempotency).
11
11
  Pipeline:
12
12
  1. Maya (mayapy): build a cube + 'opacity' attr, key opacity in a
13
13
  4-key fade-in/hold/fade-out pattern, call
14
- :meth:`RenderOpacity.prepare_for_export` to dual-key visibility,
15
- export FBX.
14
+ :meth:`RenderOpacity.prepare_for_export` to stage the curve proxy
15
+ (nothing keys visibility), export FBX.
16
16
  2. Unity (batchmode): deploy ``UnitytkSettings.cs`` (the shared
17
17
  ImportGate/CarrierImport home), ``RenderEffectsController.cs`` and
18
18
  ``AudioEventController.cs``. Import the FBX. Verify:
@@ -65,7 +65,7 @@ def _unity_available() -> bool:
65
65
  # ======================================================================
66
66
 
67
67
  MAYA_EXPORT_SCRIPT = r'''
68
- """Executed inside mayapy — keys opacity, dual-keys visibility, exports FBX."""
68
+ """Executed inside mayapy — keys opacity, stages the curve proxy, exports FBX."""
69
69
  import sys, os, json
70
70
 
71
71
  # mayatk/pythontk repo roots arrive via PYTHONPATH set by the parent test.
@@ -97,11 +97,12 @@ cmds.setKeyframe(cube, attribute="opacity", time=140, value=0.0) # faded out
97
97
 
98
98
  assert cmds.attributeQuery("opacity", node=str(cube), exists=True)
99
99
 
100
- # Dual-key visibility from opacity — the Unity importer reconstructs the
101
- # fade from these step-keyed visibility transitions because Unity collapses
102
- # importAnimatedCustomProperties curves to the root and loses per-object
103
- # binding.
100
+ # Stage the curve-proxy transport: a fade_cube__opacity child carries the
101
+ # opacity curve on scale.x, which the importer rebinds to the controller
102
+ # (Unity flattens animated custom properties onto the root). Nothing keys
103
+ # visibility: presence is derived from the authored opacity downstream.
104
104
  synced = RenderOpacity.prepare_for_export(objects=[cube])
105
+ proxies = cmds.ls("*__opacity") or []
105
106
 
106
107
  vis_keys = cmds.keyframe(cube, attribute="visibility", q=True, tc=True) or []
107
108
  opa_keys = cmds.keyframe(cube, attribute="opacity", q=True, tc=True) or []
@@ -127,6 +128,7 @@ results = {
127
128
  "opacity_keys": opa_keys,
128
129
  "visibility_keys": vis_keys,
129
130
  "synced_objects": synced,
131
+ "proxies": proxies,
130
132
  }
131
133
 
132
134
  with open(os.path.join(output_dir, "maya_results.json"), "w") as f:
@@ -407,7 +409,7 @@ class TestRenderOpacityE2E(unittest.TestCase):
407
409
 
408
410
  @MayaEnv.skip_unless_available()
409
411
  def test_01_maya_export(self):
410
- """Author opacity, dual-key visibility via prepare_for_export, export FBX."""
412
+ """Author opacity, stage the curve proxy via prepare_for_export, export FBX."""
411
413
  script_path = os.path.join(self.temp_dir, "maya_export.py")
412
414
  with open(script_path, "w", encoding="utf-8") as f:
413
415
  f.write(MAYA_EXPORT_SCRIPT)
@@ -444,12 +446,11 @@ class TestRenderOpacityE2E(unittest.TestCase):
444
446
  r = self.__class__.maya_results
445
447
  self.__class__.fbx_path = r["fbx_path"]
446
448
  self.assertTrue(r["fbx_exists"])
447
- # prepare_for_export must have dual-keyed visibility
448
- self.assertGreater(
449
- len(r["visibility_keys"]),
450
- 0,
451
- "prepare_for_export should have synced visibility keys",
449
+ # prepare_for_export stages the curve proxy and keys no visibility
450
+ self.assertTrue(
451
+ r["proxies"], "prepare_for_export should have staged the opacity proxy"
452
452
  )
453
+ self.assertEqual(r["visibility_keys"], [], "no visibility mirror is written")
453
454
  # The opacity keys should match what we authored
454
455
  opa_set = {int(round(t)) for t in r["opacity_keys"]}
455
456
  self.assertEqual(opa_set, {1, 20, 100, 140})
@@ -128,13 +128,12 @@ for i, obj in enumerate(objects):
128
128
  cmds.setKeyframe(obj, attribute="opacity", time=end, value=0.0)
129
129
  cmds.setKeyframe(obj, attribute="opacity", time=60, value=0.0)
130
130
 
131
- # -- Mirror opacity → visibility before export (REQUIRED) --
132
- # The Unity importer reconstructs each per-object RenderEffectsController.opacity
133
- # curve from that object's visibility (m_Enabled) track, because Unity collapses
134
- # all same-named "opacity" custom-property curves onto the root Animator with
135
- # empty paths. An object keyed on opacity but not visibility imports zero curves.
136
- # prepare_for_export dual-keys visibility from the opacity curve (the production
137
- # scene-exporter calls this in its pre-export hook).
131
+ # -- Stage the curve-proxy transport before export (REQUIRED) --
132
+ # Unity collapses all same-named "opacity" custom-property curves onto the root
133
+ # Animator with empty paths, so each object's curve travels on a transient
134
+ # <leaf>__opacity child's scale.x, which the importer rebinds to that object's
135
+ # RenderEffectsController.opacity. prepare_for_export stages them (the production
136
+ # export bracket calls it); nothing keys visibility.
138
137
  RenderOpacity.prepare_for_export(objects)
139
138
 
140
139
  # -- Verify setup before export --
@@ -142,8 +141,8 @@ for obj in objects:
142
141
  assert cmds.attributeQuery("opacity", node=str(obj), exists=True), f"{obj} missing opacity attr"
143
142
  curves = cmds.listConnections(f"{obj}.opacity", type="animCurve")
144
143
  assert curves, f"{obj} has no animation curve on opacity"
145
- vis_keys = cmds.keyframe(obj, attribute="visibility", query=True, keyframeCount=True)
146
- assert vis_keys, f"{obj} has no visibility keys (prepare_for_export failed)"
144
+ leaf = str(obj).split("|")[-1]
145
+ assert cmds.ls(f"{leaf}__opacity"), f"{obj} has no curve proxy (prepare_for_export failed)"
147
146
 
148
147
  # -- Export FBX --
149
148
  cmds.select(objects)
@@ -163,8 +162,8 @@ results = {
163
162
  "fbx_exists": os.path.exists(fbx_path),
164
163
  "object_names": [str(o).split("|")[-1] for o in objects],
165
164
  "all_have_opacity": all(cmds.attributeQuery("opacity", node=str(o), exists=True) for o in objects),
166
- "all_have_visibility_keys": all(
167
- cmds.keyframe(o, attribute="visibility", query=True, keyframeCount=True) for o in objects
165
+ "all_have_curve_proxies": all(
166
+ cmds.ls(str(o).split("|")[-1] + "__opacity") for o in objects
168
167
  ),
169
168
  }
170
169
  with open(os.path.join(output_dir, "maya_results.json"), "w") as f:
@@ -458,12 +457,11 @@ class TestSharedMaterialStandalone(unittest.TestCase):
458
457
  fbx_path = mr["fbx_path"]
459
458
  self.assertTrue(mr["fbx_exists"], "FBX not created")
460
459
  self.assertTrue(mr["all_have_opacity"], "Not all objects have opacity attr")
461
- # Visibility track is what Unity reconstructs the per-object opacity
462
- # curve from — without it the import yields zero opacity curves.
460
+ # The curve proxy is what carries each object's opacity curve to Unity.
463
461
  self.assertTrue(
464
- mr["all_have_visibility_keys"],
465
- "Not all objects have visibility keys — opacity→visibility mirroring "
466
- "(RenderOpacity.prepare_for_export) did not run; Unity will import 0 curves",
462
+ mr["all_have_curve_proxies"],
463
+ "Not all objects have a curve proxy -- RenderOpacity.prepare_for_export "
464
+ "did not stage the transport; Unity will import 0 curves",
467
465
  )
468
466
  self.assertEqual(
469
467
  len(mr["object_names"]),
@@ -487,20 +485,21 @@ class TestSharedMaterialStandalone(unittest.TestCase):
487
485
  for name in OBJECT_NAMES:
488
486
  self.assertIn(name, fbx_content, f"Object '{name}' missing from FBX")
489
487
 
490
- # The Visibility animation track is what Unity converts into the
491
- # per-object opacity curve. Assert it is present in the FBX so a
492
- # regression is caught here, before the costly Unity launch.
493
- vis_curves = re.findall(r'"AnimCurveNode::Visibility"', fbx_content)
494
- self.assertGreaterEqual(
495
- len(vis_curves),
496
- len(OBJECT_NAMES),
497
- f"FBX has {len(vis_curves)} Visibility curves, expected >= "
498
- f"{len(OBJECT_NAMES)} — Unity reconstructs opacity from these",
488
+ # The curve proxy is what carries each object's opacity curve to Unity
489
+ # (the importer rebinds its scale.x to RenderEffectsController.opacity).
490
+ # Assert one per object is in the FBX, so a regression is caught here,
491
+ # before the costly Unity launch.
492
+ proxies = re.findall(r'"Model::(\w+)__opacity"', fbx_content)
493
+ self.assertEqual(
494
+ sorted(set(proxies)),
495
+ sorted(OBJECT_NAMES),
496
+ f"FBX carries opacity curve proxies for {sorted(set(proxies))}, "
497
+ f"expected {sorted(OBJECT_NAMES)}",
499
498
  )
500
499
 
501
500
  logger.info(
502
501
  f"Maya export OK: {len(opacity_props)} opacity props, "
503
- f"{len(vis_curves)} visibility curves, {len(OBJECT_NAMES)} objects"
502
+ f"{len(set(proxies))} curve proxies, {len(OBJECT_NAMES)} objects"
504
503
  )
505
504
 
506
505
  # === Step 2: Create Unity project ===
@@ -662,7 +661,7 @@ class TestSharedMaterialStandalone(unittest.TestCase):
662
661
  # Reimport idempotency
663
662
  ri_oc = r.get("reimport_opacity_controllers", -1)
664
663
  ri_curves = r.get("reimport_opacity_curves", -1)
665
- print(f" Reimport idempotency:")
664
+ print(" Reimport idempotency:")
666
665
  print(f" Controllers: {oc} -> {ri_oc}")
667
666
  print(f" Curves: {curves} -> {ri_curves}")
668
667
  self.assertEqual(
@@ -1,4 +1,4 @@
1
- __version__ = "0.0.11"
1
+ __version__ = "0.0.12"
2
2
 
3
3
  from .launcher import UnityLauncher, UnityFinder
4
4
  from .scene_builder import SceneBuilder
@@ -56,7 +56,7 @@ public class RenderEffectsController : MonoBehaviour
56
56
  public float highlight = 0f;
57
57
 
58
58
  [Tooltip("The DCC 'highlightColor' attribute (linear).")]
59
- public Color highlightColor = new Color(0.2f, 0.5f, 1f, 1f);
59
+ public Color highlightColor = new Color(0f, 0.088656f, 0.723055f, 1f);
60
60
 
61
61
  [Tooltip("Shader color property whose alpha channel is overridden " +
62
62
  "(e.g. _BaseColor for URP/HDRP, _Color for Built-in).")]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitytk
3
- Version: 0.0.11
3
+ Version: 0.0.12
4
4
  Summary: A modular Python toolkit for Unity interaction.
5
5
  Author-email: Ryan Simpson <m3trik@outlook.com>
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes