Skip to content

Commit

Permalink
Merge branch 'Hubs-Foundation:master' into LightMapBakeOperator
Browse files Browse the repository at this point in the history
  • Loading branch information
GottfriedHofmann authored Jan 14, 2025
2 parents 9a3f6f4 + 95ca43b commit c90e25d
Show file tree
Hide file tree
Showing 15 changed files with 193 additions and 517 deletions.
26 changes: 25 additions & 1 deletion addons/io_hubs_addon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"author": "The Hubs Community",
"description": "Tools for developing glTF assets for Hubs",
"blender": (3, 1, 2),
"version": (1, 6, 0, "dev_build"),
"version": (1, 7, 1, "dev_build"),
"location": "",
"wiki_url": "https://github.com/Hubs-Foundation/hubs-blender-exporter",
"tracker_url": "https://github.com/Hubs-Foundation/hubs-blender-exporter/issues",
Expand All @@ -25,6 +25,30 @@
create_prefs_dir()


# Blender 4.2+ glTF Extension Import/Export Settings Panel
def draw(context, layout):
layout_header, layout_body = layout.panel('HBA_PT_Import_Export_Panel', default_closed=True)
sfile = context.space_data
operator = sfile.active_operator

# Panel Header
if operator.bl_idname == "EXPORT_SCENE_OT_gltf":
props = bpy.context.scene.HubsComponentsExtensionProperties
elif operator.bl_idname == "IMPORT_SCENE_OT_gltf":
props = bpy.context.scene.HubsComponentsExtensionImportProperties

layout_header.use_property_split = False
layout_header.prop(props, 'enabled', text="")
layout_header.label(text="Hubs Components")

# Panel Body
if layout_body:
if operator.bl_idname == "EXPORT_SCENE_OT_gltf":
gltf_exporter.HubsGLTFExportPanel.draw_body(context, layout_body)
elif operator.bl_idname == "IMPORT_SCENE_OT_gltf":
gltf_importer.HubsGLTFImportPanel.draw_body(context, layout_body)


def register():
icons.register()
preferences.register()
Expand Down
2 changes: 1 addition & 1 deletion addons/io_hubs_addon/components/definitions/ammo_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class AmmoShape(HubsComponent):
_definition = {
'name': 'ammo-shape',
'display_name': 'Ammo Shape (deprecated)',
'display_name': 'Ammo Shape',
'category': Category.OBJECT,
'node_type': NodeType.NODE,
'panel_type': [PanelType.OBJECT, PanelType.BONE],
Expand Down
44 changes: 0 additions & 44 deletions addons/io_hubs_addon/components/definitions/grabbable.py

This file was deleted.

14 changes: 0 additions & 14 deletions addons/io_hubs_addon/components/definitions/networked_transform.py

This file was deleted.

17 changes: 16 additions & 1 deletion addons/io_hubs_addon/components/definitions/particle_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ParticleEmitter(HubsComponent):

src: StringProperty(
name="Image Source", description="The web address (URL) of the image to use for each particle",
default="https://example.org/spoke/assets/images/dot-75db99b125fe4e9afbe58696320bea73.png")
default="https://assets.example.org/spoke/assets/images/dot-75db99b125fe4e9afbe58696320bea73.png")

ageRandomness: FloatProperty(
name="Age Randomness", description="Age Randomness", default=10.0)
Expand Down Expand Up @@ -107,6 +107,21 @@ class ParticleEmitter(HubsComponent):
angularVelocity: FloatProperty(
name="Angular Velocity", description="Angular Velocity", unit="VELOCITY", default=0.0)

def draw(self, context, layout, panel):
alert_src = getattr(self, "src") == self.bl_rna.properties['src'].default
for key in self.get_properties():
if not self.bl_rna.properties[key].is_hidden:
row = layout.row()
if key == "src" and alert_src:
row.alert = True
row.prop(data=self, property=key)
if key == "src" and alert_src:
warning_row = layout.row()
warning_row.alert = True
warning_row.label(
text="Warning: the default URL won't work unless you replace 'example.org' with the domain of your Hubs instance.",
icon='ERROR')

def gather(self, export_settings, object):
props = super().gather(export_settings, object)
props['startVelocity'] = {
Expand Down
134 changes: 0 additions & 134 deletions addons/io_hubs_addon/components/definitions/physics_shape.py

This file was deleted.

17 changes: 9 additions & 8 deletions addons/io_hubs_addon/components/definitions/reflection_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def modal(self, context, event):
else:
update_image_editors(old_img, img)

probe_component['envMapTexture'] = img
probe_component.envMapTexture = img

# Pack image and update filepaths so that it displays/unpacks nicely for the user.
# Note: updating the filepaths prints an error to the terminal, but otherwise seems to work fine.
Expand Down Expand Up @@ -338,14 +338,15 @@ def restore_render_props(self):

def setup_probe_render(self, context):
probe = self.probes[self.probe_index]
cycles_settings = self.camera_data.cycles if bpy.app.version < (4, 0, 0) else self.camera_data

self.camera_data.type = "PANO"
self.camera_data.cycles.panorama_type = "EQUIRECTANGULAR"
cycles_settings.panorama_type = "EQUIRECTANGULAR"

self.camera_data.cycles.longitude_min = -math.pi
self.camera_data.cycles.longitude_max = math.pi
self.camera_data.cycles.latitude_min = -math.pi / 2
self.camera_data.cycles.latitude_max = math.pi / 2
cycles_settings.longitude_min = -math.pi
cycles_settings.longitude_max = math.pi
cycles_settings.latitude_min = -math.pi / 2
cycles_settings.latitude_max = math.pi / 2

self.camera_data.clip_start = probe.data.clip_start
self.camera_data.clip_end = probe.data.clip_end
Expand Down Expand Up @@ -448,11 +449,11 @@ def execute(self, context):
for probe in probes:
if f.name.startswith(f"{probe.name} - EnvMap"):
probe_component = probe.hubs_component_reflection_probe
old_img = probe_component['envMapTexture']
old_img = probe_component.envMapTexture

img = bpy.data.images.load(
filepath=os.path.join(dirname, f.name))
probe_component['envMapTexture'] = img
probe_component.envMapTexture = img

if old_img:
if self.overwrite_images:
Expand Down
Loading

0 comments on commit c90e25d

Please sign in to comment.