P2P Export - Nodes - Patch

This commit is contained in:
2026-10-06 02:10:08 -07:00
parent 9fee67d231
commit 4ab646015d
49 changed files with 2478 additions and 1164 deletions

View File

@ -34,6 +34,16 @@ else:
lnx_version = '2026.9'
lnx_commit = '$Id: 6b2644d47db169cedd95593497cc283207d23a74 $'
LNX_TORRENT_DEFAULT_TRACKERS = [
'wss://ws1.leenkx.com',
'wss://video.blender.org/tracker/socket',
]
LNX_TORRENT_DEFAULT_ICE_SERVERS = [
'stun:stun.l.google.com:19302',
'stun:global.stun.twilio.com:3478',
]
def get_project_html5_copy(self):
return self.get('lnx_project_html5_copy', False)
@ -282,6 +292,17 @@ def init_properties():
('Enabled', 'Enabled', 'Enabled'),
('Auto', 'Auto', 'Auto')],
name="Networking", default='Auto', description="Include Network library", update=assets.invalidate_compiler_cache)
bpy.types.World.lnx_torrent = EnumProperty(
items=[('Disabled', 'Disabled', 'Disabled'),
('Enabled', 'Enabled', 'Enabled')],
name="Torrent", default='Disabled', description="Include Torrent (Leenkx) library", update=assets.invalidate_compiler_cache)
bpy.types.World.lnx_torrent_download_dir = StringProperty(name="Download Path", description="Directory torrent downloads are written to. Relative paths resolve against the project directory at runtime; absolute paths are used as-is", default="Downloads", subtype='DIR_PATH', update=assets.invalidate_compiler_cache)
bpy.types.World.lnx_torrent_trackers = CollectionProperty(name="Torrent Trackers", description="Default torrent tracker announce URLs", type=bpy.types.PropertyGroup)
bpy.types.World.lnx_torrent_trackers_index = IntProperty(name="Torrent Tracker Index", default=0)
bpy.types.World.lnx_torrent_ice_servers = CollectionProperty(name="ICE Servers", description="Default ICE/STUN servers used for WebRTC peer connections", type=bpy.types.PropertyGroup)
bpy.types.World.lnx_torrent_ice_servers_index = IntProperty(name="ICE Server Index", default=0)
bpy.types.World.lnx_torrent_peer_timeout = IntProperty(name="Peer Timeout", description="Milliseconds after which an unresponsive peer is dropped", default=5 * 60 * 1000, min=0, update=assets.invalidate_compiler_cache)
bpy.types.World.lnx_torrent_heartbeat = IntProperty(name="Heartbeat", description="Milliseconds between heartbeat packets sent to peers", default=30000, min=0, update=assets.invalidate_compiler_cache)
bpy.types.World.lnx_audio = EnumProperty(
items=[('Disabled', 'Disabled', 'Disabled'),
('Enabled', 'Enabled', 'Enabled')],
@ -701,13 +722,23 @@ def create_wrd():
wrd.use_fake_user = True # Store data world object, add fake user to keep it alive
wrd.lnx_version = lnx_version
wrd.lnx_commit = lnx_commit
seed_torrent_trackers(wrd)
def seed_torrent_trackers(wrd):
if len(wrd.lnx_torrent_trackers) == 0:
for url in LNX_TORRENT_DEFAULT_TRACKERS:
wrd.lnx_torrent_trackers.add().name = url
if len(wrd.lnx_torrent_ice_servers) == 0:
for url in LNX_TORRENT_DEFAULT_ICE_SERVERS:
wrd.lnx_torrent_ice_servers.add().name = url
def init_properties_on_load():
if 'Lnx' not in bpy.data.worlds:
init_properties()
wrd = bpy.data.worlds['Lnx']
seed_torrent_trackers(wrd)
# New project?
if bpy.data.filepath == '':
wrd = bpy.data.worlds['Lnx']
wrd.lnx_debug_console = lnx.utils.get_debug_console_auto()
lnx.utils.fetch_script_names()