From f1e4fbcf0252e629c8692dfaf484206ee5a2ba83 Mon Sep 17 00:00:00 2001 From: Spiderguy-F Date: Fri, 8 Nov 2024 14:07:06 +0100 Subject: [PATCH 1/3] created tooltips for components in component_tooltips.py --- .../definitions/component_tooltips.py | 43 +++++++++++++++++++ addons/io_hubs_addon/components/operators.py | 19 ++++++++ 2 files changed, 62 insertions(+) create mode 100644 addons/io_hubs_addon/components/definitions/component_tooltips.py diff --git a/addons/io_hubs_addon/components/definitions/component_tooltips.py b/addons/io_hubs_addon/components/definitions/component_tooltips.py new file mode 100644 index 00000000..dd429dd7 --- /dev/null +++ b/addons/io_hubs_addon/components/definitions/component_tooltips.py @@ -0,0 +1,43 @@ +component_descriptions = { + 'directional-light' : 'A light that emits parallel light in a specific direction, like the sun', + 'loop-animation' : 'Play an animation for this object on a loop', + 'media-frame' : 'Displays a media like images, PDFs, and videos', + 'particle-emitter' : 'A component that emits particles', + 'simple-water' : 'A component that creates water effect, including waves', + 'spawner' : 'A component that spawns entities', + 'text' : 'A component that displays text', + 'waypoint' : 'A component that defines a way/spawn point', + 'loop-animation' : 'Plays an animation for this object on a loop', + 'uv-scroll' : 'Scroll the UVs of a material (animate the texture)', + 'morph-audio-feedback' : 'Control a shapekey for an avatar based on mic volume', + 'personal-space-invader' : 'Fade out other avatars if they get too close', + 'scale-audio-feedback' : 'Scale this object based on mic volume', + 'audio' : 'A component that plays audio', + 'zone-audio-source' : 'Play audio when an avatar enters a zone', + 'audio-target' : 'A component that plays audio based on the distance between two entities', + 'audio-zone' : 'Play audio when an avatar enters a zone', + 'image' : 'Displays an image from a URL', + 'model' : 'Loads a 3D model from a URL', + 'pdf' : 'Loads a PDF from a URL', + 'video' : 'Loads a video from a URL', + 'custom-tags' : 'A component that adds custom tags to an entity', + 'visible' : 'Hide this object in hubs', + 'shadow' : 'Make this object cast dynamic shadows', + 'rigidbody' : 'A component that adds physics to an entity', + 'physics-shape' : 'Define the shape of a physics object', + 'grabbable' : 'Players can move this object around', + 'frustrum' : 'A component that defines a frustrum', + 'billboard' : 'Make the object face the player', + 'ammo-shape' : '[OBSOLETE] define the physics shape of an entity', + 'mirror' : 'Create a mirror effect for your room', + 'nav-mesh' : 'Define navigation mesh that limits where avatars can walk', + 'scene-preview-camera' : 'A component that creates a scene preview camera', + 'skybox' : 'Creates a procedural sky', + 'spot-light' : 'A component that creates a spot light', + 'point-light' : 'A component that creates a point light', + 'hemisphere-light' : 'A component that creates a hemisphere light', + 'link' : 'Create an interactable hyperlink', + 'fog' : 'Add fog to the scene', + 'audio-settings' : 'Define audio drop off settings', + 'environment-settings' : 'Define Background image and Evnironment settings', +} \ No newline at end of file diff --git a/addons/io_hubs_addon/components/operators.py b/addons/io_hubs_addon/components/operators.py index 2907e0cb..4ecc034a 100644 --- a/addons/io_hubs_addon/components/operators.py +++ b/addons/io_hubs_addon/components/operators.py @@ -1,6 +1,7 @@ import bpy from bpy.props import StringProperty, IntProperty, BoolProperty, CollectionProperty from bpy.types import Operator, PropertyGroup + from functools import reduce from .types import PanelType, MigrationType @@ -11,6 +12,7 @@ from .gizmos import update_gizmos from .utils import is_linked, redraw_component_ui from ..icons import get_hubs_icons +from .definitions import component_tooltips import os @@ -55,6 +57,23 @@ def poll(cls, context): return True + @classmethod + def description(cls, context, properties): + component = properties.component_name + if component == '': + panel_type = None + for item in properties.items(): + _, panel_type = item + tooltip = "Add a hubs component to this object" if panel_type == "object" \ + else "Add a hubs component to the scene" + return tooltip + try: + return component_tooltips.component_descriptions[component] + except: + print(properties.component_name + ': Please add me to component_tooltips.py') + return "No description available for " + component + + def execute(self, context): if self.component_name == '': return From 35c72a3d0db08798aa80b59a0ee20df2aed5803f Mon Sep 17 00:00:00 2001 From: Spiderguy-F Date: Mon, 11 Nov 2024 10:35:44 +0100 Subject: [PATCH 2/3] Removed tab stop formatting in dict --- .../definitions/component_tooltips.py | 84 +++++++++---------- addons/io_hubs_addon/components/operators.py | 1 - 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/addons/io_hubs_addon/components/definitions/component_tooltips.py b/addons/io_hubs_addon/components/definitions/component_tooltips.py index dd429dd7..e09a6cd4 100644 --- a/addons/io_hubs_addon/components/definitions/component_tooltips.py +++ b/addons/io_hubs_addon/components/definitions/component_tooltips.py @@ -1,43 +1,43 @@ component_descriptions = { - 'directional-light' : 'A light that emits parallel light in a specific direction, like the sun', - 'loop-animation' : 'Play an animation for this object on a loop', - 'media-frame' : 'Displays a media like images, PDFs, and videos', - 'particle-emitter' : 'A component that emits particles', - 'simple-water' : 'A component that creates water effect, including waves', - 'spawner' : 'A component that spawns entities', - 'text' : 'A component that displays text', - 'waypoint' : 'A component that defines a way/spawn point', - 'loop-animation' : 'Plays an animation for this object on a loop', - 'uv-scroll' : 'Scroll the UVs of a material (animate the texture)', - 'morph-audio-feedback' : 'Control a shapekey for an avatar based on mic volume', - 'personal-space-invader' : 'Fade out other avatars if they get too close', - 'scale-audio-feedback' : 'Scale this object based on mic volume', - 'audio' : 'A component that plays audio', - 'zone-audio-source' : 'Play audio when an avatar enters a zone', - 'audio-target' : 'A component that plays audio based on the distance between two entities', - 'audio-zone' : 'Play audio when an avatar enters a zone', - 'image' : 'Displays an image from a URL', - 'model' : 'Loads a 3D model from a URL', - 'pdf' : 'Loads a PDF from a URL', - 'video' : 'Loads a video from a URL', - 'custom-tags' : 'A component that adds custom tags to an entity', - 'visible' : 'Hide this object in hubs', - 'shadow' : 'Make this object cast dynamic shadows', - 'rigidbody' : 'A component that adds physics to an entity', - 'physics-shape' : 'Define the shape of a physics object', - 'grabbable' : 'Players can move this object around', - 'frustrum' : 'A component that defines a frustrum', - 'billboard' : 'Make the object face the player', - 'ammo-shape' : '[OBSOLETE] define the physics shape of an entity', - 'mirror' : 'Create a mirror effect for your room', - 'nav-mesh' : 'Define navigation mesh that limits where avatars can walk', - 'scene-preview-camera' : 'A component that creates a scene preview camera', - 'skybox' : 'Creates a procedural sky', - 'spot-light' : 'A component that creates a spot light', - 'point-light' : 'A component that creates a point light', - 'hemisphere-light' : 'A component that creates a hemisphere light', - 'link' : 'Create an interactable hyperlink', - 'fog' : 'Add fog to the scene', - 'audio-settings' : 'Define audio drop off settings', - 'environment-settings' : 'Define Background image and Evnironment settings', -} \ No newline at end of file + 'directional-light' : 'A light that emits parallel light in a specific direction, like the sun', + 'loop-animation' : 'Play an animation for this object on a loop', + 'media-frame' : 'Displays a media like images, PDFs, and videos', + 'particle-emitter' : 'A component that emits particles', + 'simple-water' : 'A component that creates water effect, including waves', + 'spawner' : 'A component that spawns entities', + 'text' : 'A component that displays text', + 'waypoint' : 'A component that defines a way/spawn point', + 'loop-animation' : 'Plays an animation for this object on a loop', + 'uv-scroll' : 'Scroll the UVs of a material (animate the texture)', + 'morph-audio-feedback' : 'Control a shapekey for an avatar based on mic volume', + 'personal-space-invader' : 'Fade out other avatars if they get too close', + 'scale-audio-feedback' : 'Scale this object based on mic volume', + 'audio' : 'A component that plays audio', + 'zone-audio-source' : 'Play audio when an avatar enters a zone', + 'audio-target' : 'A component that plays audio based on the distance between two entities', + 'audio-zone' : 'Play audio when an avatar enters a zone', + 'image' : 'Displays an image from a URL', + 'model' : 'Loads a 3D model from a URL', + 'pdf' : 'Loads a PDF from a URL', + 'video' : 'Loads a video from a URL', + 'custom-tags' : 'A component that adds custom tags to an entity', + 'visible' : 'Hide this object in hubs', + 'shadow' : 'Make this object cast dynamic shadows', + 'rigidbody' : 'A component that adds physics to an entity', + 'physics-shape' : 'Define the shape of a physics object', + 'grabbable' : 'Players can move this object around', + 'frustrum' : 'A component that defines a frustrum', + 'billboard' : 'Make the object face the player', + 'ammo-shape' : '[OBSOLETE] define the physics shape of an entity', + 'mirror' : 'Create a mirror effect for your room', + 'nav-mesh' : 'Define navigation mesh that limits where avatars can walk', + 'scene-preview-camera' : 'A component that creates a scene preview camera', + 'skybox' : 'Creates a procedural sky', + 'spot-light' : 'A component that creates a spot light', + 'point-light' : 'A component that creates a point light', + 'hemisphere-light' : 'A component that creates a hemisphere light', + 'link' : 'Create an interactable hyperlink', + 'fog' : 'Add fog to the scene', + 'audio-settings' : 'Define audio drop off settings', + 'environment-settings' : 'Define Background image and Evnironment settings', +} diff --git a/addons/io_hubs_addon/components/operators.py b/addons/io_hubs_addon/components/operators.py index 4ecc034a..43ad9063 100644 --- a/addons/io_hubs_addon/components/operators.py +++ b/addons/io_hubs_addon/components/operators.py @@ -73,7 +73,6 @@ def description(cls, context, properties): print(properties.component_name + ': Please add me to component_tooltips.py') return "No description available for " + component - def execute(self, context): if self.component_name == '': return From e41b74c479cafd8d087795cbeb60e01909829e88 Mon Sep 17 00:00:00 2001 From: Spiderguy-F Date: Mon, 11 Nov 2024 11:05:54 +0100 Subject: [PATCH 3/3] Removed more whitespaces --- .../definitions/component_tooltips.py | 82 +++++++++---------- addons/io_hubs_addon/components/operators.py | 6 +- 2 files changed, 42 insertions(+), 46 deletions(-) diff --git a/addons/io_hubs_addon/components/definitions/component_tooltips.py b/addons/io_hubs_addon/components/definitions/component_tooltips.py index e09a6cd4..718506f2 100644 --- a/addons/io_hubs_addon/components/definitions/component_tooltips.py +++ b/addons/io_hubs_addon/components/definitions/component_tooltips.py @@ -1,43 +1,43 @@ component_descriptions = { - 'directional-light' : 'A light that emits parallel light in a specific direction, like the sun', - 'loop-animation' : 'Play an animation for this object on a loop', - 'media-frame' : 'Displays a media like images, PDFs, and videos', - 'particle-emitter' : 'A component that emits particles', - 'simple-water' : 'A component that creates water effect, including waves', - 'spawner' : 'A component that spawns entities', - 'text' : 'A component that displays text', - 'waypoint' : 'A component that defines a way/spawn point', - 'loop-animation' : 'Plays an animation for this object on a loop', - 'uv-scroll' : 'Scroll the UVs of a material (animate the texture)', - 'morph-audio-feedback' : 'Control a shapekey for an avatar based on mic volume', - 'personal-space-invader' : 'Fade out other avatars if they get too close', - 'scale-audio-feedback' : 'Scale this object based on mic volume', - 'audio' : 'A component that plays audio', - 'zone-audio-source' : 'Play audio when an avatar enters a zone', - 'audio-target' : 'A component that plays audio based on the distance between two entities', - 'audio-zone' : 'Play audio when an avatar enters a zone', - 'image' : 'Displays an image from a URL', - 'model' : 'Loads a 3D model from a URL', - 'pdf' : 'Loads a PDF from a URL', - 'video' : 'Loads a video from a URL', - 'custom-tags' : 'A component that adds custom tags to an entity', - 'visible' : 'Hide this object in hubs', - 'shadow' : 'Make this object cast dynamic shadows', - 'rigidbody' : 'A component that adds physics to an entity', - 'physics-shape' : 'Define the shape of a physics object', - 'grabbable' : 'Players can move this object around', - 'frustrum' : 'A component that defines a frustrum', - 'billboard' : 'Make the object face the player', - 'ammo-shape' : '[OBSOLETE] define the physics shape of an entity', - 'mirror' : 'Create a mirror effect for your room', - 'nav-mesh' : 'Define navigation mesh that limits where avatars can walk', - 'scene-preview-camera' : 'A component that creates a scene preview camera', - 'skybox' : 'Creates a procedural sky', - 'spot-light' : 'A component that creates a spot light', - 'point-light' : 'A component that creates a point light', - 'hemisphere-light' : 'A component that creates a hemisphere light', - 'link' : 'Create an interactable hyperlink', - 'fog' : 'Add fog to the scene', - 'audio-settings' : 'Define audio drop off settings', - 'environment-settings' : 'Define Background image and Evnironment settings', + 'directional-light': 'A light that emits parallel light in a specific direction, like the sun', + 'loop-animation': 'Play an animation for this object on a loop', + 'media-frame': 'Displays a media like images, PDFs, and videos', + 'particle-emitter': 'A component that emits particles', + 'simple-water': 'A component that creates water effect, including waves', + 'spawner': 'A component that spawns entities', + 'text': 'A component that displays text', + 'waypoint': 'A component that defines a way/spawn point', + 'loop-animation': 'Plays an animation for this object on a loop', + 'uv-scroll': 'Scroll the UVs of a material (animate the texture)', + 'morph-audio-feedback': 'Control a shapekey for an avatar based on mic volume', + 'personal-space-invader': 'Fade out other avatars if they get too close', + 'scale-audio-feedback': 'Scale this object based on mic volume', + 'audio': 'A component that plays audio', + 'zone-audio-source': 'Play audio when an avatar enters a zone', + 'audio-target': 'A component that plays audio based on the distance between two entities', + 'audio-zone': 'Play audio when an avatar enters a zone', + 'image': 'Displays an image from a URL', + 'model': 'Loads a 3D model from a URL', + 'pdf': 'Loads a PDF from a URL', + 'video': 'Loads a video from a URL', + 'custom-tags': 'A component that adds custom tags to an entity', + 'visible': 'Hide this object in hubs', + 'shadow': 'Make this object cast dynamic shadows', + 'rigidbody': 'A component that adds physics to an entity', + 'physics-shape': 'Define the shape of a physics object', + 'grabbable': 'Players can move this object around', + 'frustrum': 'A component that defines a frustrum', + 'billboard': 'Make the object face the player', + 'ammo-shape': '[OBSOLETE] define the physics shape of an entity', + 'mirror': 'Create a mirror effect for your room', + 'nav-mesh': 'Define navigation mesh that limits where avatars can walk', + 'scene-preview-camera': 'A component that creates a scene preview camera', + 'skybox': 'Creates a procedural sky', + 'spot-light': 'A component that creates a spot light', + 'point-light': 'A component that creates a point light', + 'hemisphere-light': 'A component that creates a hemisphere light', + 'link': 'Create an interactable hyperlink', + 'fog': 'Add fog to the scene', + 'audio-settings': 'Define audio drop off settings', + 'environment-settings': 'Define Background image and Evnironment settings', } diff --git a/addons/io_hubs_addon/components/operators.py b/addons/io_hubs_addon/components/operators.py index 43ad9063..5580aff9 100644 --- a/addons/io_hubs_addon/components/operators.py +++ b/addons/io_hubs_addon/components/operators.py @@ -67,11 +67,7 @@ def description(cls, context, properties): tooltip = "Add a hubs component to this object" if panel_type == "object" \ else "Add a hubs component to the scene" return tooltip - try: - return component_tooltips.component_descriptions[component] - except: - print(properties.component_name + ': Please add me to component_tooltips.py') - return "No description available for " + component + return component_tooltips.component_descriptions[component] def execute(self, context): if self.component_name == '':