diff --git a/surfaces/blender/brokkr_bridge/__init__.py b/surfaces/blender/brokkr_bridge/__init__.py index bfe37c4..12e9774 100644 --- a/surfaces/blender/brokkr_bridge/__init__.py +++ b/surfaces/blender/brokkr_bridge/__init__.py @@ -124,6 +124,12 @@ class BrokkrPreferences(bpy.types.AddonPreferences): description="Synchronize object transforms", ) + sync_parent: bpy.props.BoolProperty( + name="Sync Parent", + default=True, + description="Synchronize object parent relationships", + ) + sync_material: bpy.props.BoolProperty( name="Sync Material", default=True, @@ -254,6 +260,7 @@ class BrokkrPreferences(bpy.types.AddonPreferences): layout.prop(self, "unity_object_id") layout.prop(self, "unity_object_path") layout.prop(self, "sync_transform") + layout.prop(self, "sync_parent") layout.prop(self, "sync_material") layout.prop(self, "sync_visibility") layout.prop(self, "sync_custom_properties") @@ -417,6 +424,7 @@ class BROKKR_OT_publish_object_sync(bpy.types.Operator): prefs.unity_object_id, prefs.unity_object_path, prefs.sync_transform, + prefs.sync_parent, prefs.sync_material, prefs.sync_visibility, prefs.sync_custom_properties, diff --git a/surfaces/blender/brokkr_bridge/blender_target.py b/surfaces/blender/brokkr_bridge/blender_target.py index 482e3f5..e928c11 100644 --- a/surfaces/blender/brokkr_bridge/blender_target.py +++ b/surfaces/blender/brokkr_bridge/blender_target.py @@ -143,6 +143,7 @@ class BrokkrBlenderTarget: unity_object_id: str, unity_path: str, sync_transform: bool, + sync_parent: bool, sync_material: bool, sync_visibility: bool, sync_custom_properties: bool, @@ -176,6 +177,7 @@ class BrokkrBlenderTarget: node.database.put(documents["sync_session"], f"sync/sessions/{normalized_session_id}", session) node.database.put(documents["sync_object_binding"], f"sync/bindings/objects/{binding_id}", binding) self._put_sync_var(node, documents, normalized_session_id, binding_id, "transform", "Transform", "Transform", "location,rotationEuler,scale", "blender-to-unity", sync_transform, "linear", now) + self._put_sync_var(node, documents, normalized_session_id, binding_id, "parent", "Parent", "parentId", "parentName", "blender-to-unity", sync_parent, "step", now) self._put_sync_var(node, documents, normalized_session_id, binding_id, "active-state", "Active State", "m_IsActive", "visible", "blender-to-unity", sync_visibility, "step", now) self._put_sync_var(node, documents, normalized_session_id, binding_id, "material", "Material", "Renderer.m_Materials", "materials", "blender-to-unity", sync_material, "step", now) unity_custom_path = _unity_custom_property_path( diff --git a/surfaces/blender/docs/install.md b/surfaces/blender/docs/install.md index 5e2f85d..aefc5cf 100644 --- a/surfaces/blender/docs/install.md +++ b/surfaces/blender/docs/install.md @@ -45,7 +45,8 @@ owns the mirror state. 9. Use the reported `cultnet://host:port` endpoint from a CultMesh/CultNet client to read snapshots or write command intents. 10. Select a Blender object and click `Object Sync` to publish a - `brokkr.sync.object_binding.v0` plus per-lane `brokkr.sync.var.v0` records. + `brokkr.sync.object_binding.v0` plus per-lane `brokkr.sync.var.v0` records + for transform, parent, visibility, material, and custom property sync. 11. Click `Timeline Sync` to publish a `brokkr.sync.timeline_binding.v0` for Blender frame/action data and Unity Timeline/Cinemachine lanes. 12. After running `brokkr-daemon sync-once` or `sync-loop`, click diff --git a/surfaces/unity/Packages/com.gamecult.brokkr/Editor/BrokkrWindow.cs b/surfaces/unity/Packages/com.gamecult.brokkr/Editor/BrokkrWindow.cs index ea50555..28a3d42 100644 --- a/surfaces/unity/Packages/com.gamecult.brokkr/Editor/BrokkrWindow.cs +++ b/surfaces/unity/Packages/com.gamecult.brokkr/Editor/BrokkrWindow.cs @@ -23,6 +23,7 @@ namespace GameCult.Brokkr.Editor private string blenderCollectionName = ""; private bool syncObjectEnabled = true; private bool syncTransform = true; + private bool syncParent = true; private bool syncActiveState = true; private bool syncMaterial; private bool syncCustomProperty; @@ -256,6 +257,7 @@ namespace GameCult.Brokkr.Editor blenderCollectionName = EditorGUILayout.TextField("Blender Collection", blenderCollectionName); syncObjectEnabled = EditorGUILayout.Toggle("Enable Object Binding", syncObjectEnabled); syncTransform = EditorGUILayout.Toggle("Sync Transform", syncTransform); + syncParent = EditorGUILayout.Toggle("Sync Parent", syncParent); syncActiveState = EditorGUILayout.Toggle("Sync Active State", syncActiveState); syncMaterial = EditorGUILayout.Toggle("Sync Material", syncMaterial); syncCustomProperty = EditorGUILayout.Toggle("Sync Custom Property", syncCustomProperty); @@ -552,6 +554,7 @@ namespace GameCult.Brokkr.Editor mirror.PublishSyncSessionAsync(session).GetAwaiter().GetResult(); mirror.PublishSyncObjectBindingAsync(binding).GetAwaiter().GetResult(); PublishSyncVar(bindingId, "transform", "Transform", "m_LocalPosition,m_LocalRotation,m_LocalScale", "location,rotationEuler,scale", syncTransform, "linear", now); + PublishSyncVar(bindingId, "parent", "Parent", "parentId", "parentName", syncParent, "step", now); PublishSyncVar(bindingId, "active-state", "Active State", "m_IsActive", "visible", syncActiveState, "step", now); PublishSyncVar(bindingId, "material", "Material", "Renderer.m_Materials", "materials", syncMaterial, "step", now); if (syncCustomProperty) diff --git a/surfaces/unity/README.md b/surfaces/unity/README.md index 7615231..5a9a15d 100644 --- a/surfaces/unity/README.md +++ b/surfaces/unity/README.md @@ -35,10 +35,13 @@ In Unity: 8. To instantiate or variant a prefab through the mirror, fill `Prefab Asset Path`, optional `Instance Name`, and optional `Variant Path`, then click the matching prefab command. -9. With the mirror running, run `brokkr-daemon sync-once` or `sync-loop`, then +9. To publish object sync policy, select a GameObject, set the object lane + toggles including transform, parent, active state, material, and property + lanes, then click `Publish Object Sync`. +10. With the mirror running, run `brokkr-daemon sync-once` or `sync-loop`, then click `Poll Sync Receipt` or leave the window open to show the latest daemon sync pass receipt. -10. To publish an ad hoc sync variable, fill `Ad Hoc Sync Var` with a binding id +11. To publish an ad hoc sync variable, fill `Ad Hoc Sync Var` with a binding id or leave it blank for a generated id, set kind/paths/authority/interpolation, then click `Publish Sync Var`.