diff --git a/components/__init__.py b/components/__init__.py index 482ca2a..fe18d49 100644 --- a/components/__init__.py +++ b/components/__init__.py @@ -1,29 +1,19 @@ -from . import custom_tags, grabbable, rigid_body, physics_shape, networked_behavior, networked_transform, networked_animation, capturable, networked_material, networked_object_material, networked_object_properties +from . import custom_tags, networked_behavior, networked_animation, networked_material, networked_object_material, networked_object_properties def register(): custom_tags.register() - grabbable.register() - rigid_body.register() - physics_shape.register() networked_behavior.register() - networked_transform.register() networked_animation.register() networked_material.register() networked_object_material.register() networked_object_properties.register() - capturable.register() def unregister(): - capturable.unregister() networked_behavior.unregister() - networked_transform.unregister() networked_animation.unregister() networked_material.unregister() networked_object_material.unregister() - rigid_body.unregister() - physics_shape.unregister() - grabbable.unregister() custom_tags.unregister() networked_object_properties.unregister() diff --git a/components/capturable.py b/components/capturable.py deleted file mode 100644 index 6f6e125..0000000 --- a/components/capturable.py +++ /dev/null @@ -1,23 +0,0 @@ -from io_hubs_addon.components.hubs_component import HubsComponent -from io_hubs_addon.components.types import NodeType, PanelType, Category -from ..utils import do_register, do_unregister - - -class Capturable(HubsComponent): - _definition = { - 'name': 'capturable', - 'display_name': 'BG Capturable', - 'category': Category.OBJECT, - 'node_type': NodeType.NODE, - 'panel_type': [PanelType.OBJECT], - 'version': (1, 0, 0), - 'icon': 'OBJECT_DATA' - } - - -def register(): - do_register(Capturable) - - -def unregister(): - do_unregister(Capturable) diff --git a/components/custom_tags.py b/components/custom_tags.py index 4a90534..7b1e68a 100644 --- a/components/custom_tags.py +++ b/components/custom_tags.py @@ -67,7 +67,7 @@ def execute(self, context): class CustomTags(HubsComponent): _definition = { 'name': 'custom-tags', - 'display_name': 'BG Custom Tags', + 'display_name': 'Custom Tags', 'category': Category.OBJECT, 'node_type': NodeType.NODE, 'panel_type': [PanelType.OBJECT, PanelType.BONE], diff --git a/components/grabbable.py b/components/grabbable.py deleted file mode 100644 index 6dbaf7e..0000000 --- a/components/grabbable.py +++ /dev/null @@ -1,39 +0,0 @@ -from bpy.props import BoolProperty -from io_hubs_addon.components.hubs_component import HubsComponent -from io_hubs_addon.components.types import Category, NodeType, PanelType -from ..utils import do_register, do_unregister - - -class Grabbable(HubsComponent): - _definition = { - 'name': 'grabbable', - 'display_name': 'BG Grabbable', - 'category': Category.OBJECT, - 'node_type': NodeType.NODE, - 'panel_type': [PanelType.OBJECT], - 'icon': 'VIEW_PAN', - 'deps': ['rigidbody', 'networked-object-properties'], - 'version': (1, 0, 0) - } - - cursor: BoolProperty( - name="By Cursor", description="Can be grabbed by a cursor", default=True) - - hand: BoolProperty( - name="By Hand", description="Can be grabbed by VR hands", default=True) - - @classmethod - def init(cls, obj): - obj.hubs_component_list.items.get('rigidbody').isDependency = True - obj.hubs_component_list.items.get('networked-object-properties').isDependency = True - from .networked_object_properties import NetworkedObjectProperties - cmp = getattr(obj, NetworkedObjectProperties.get_id()) - cmp.transform = True - - -def register(): - do_register(Grabbable) - - -def unregister(): - do_unregister(Grabbable) diff --git a/components/networked_transform.py b/components/networked_transform.py deleted file mode 100644 index 1ec9865..0000000 --- a/components/networked_transform.py +++ /dev/null @@ -1,22 +0,0 @@ -from io_hubs_addon.components.hubs_component import HubsComponent -from io_hubs_addon.components.types import NodeType, PanelType -from ..utils import do_register, do_unregister - - -class NetworkedTransform(HubsComponent): - _definition = { - 'name': 'networked-transform', - 'display_name': 'BG Networked Transform', - 'node_type': NodeType.NODE, - 'panel_type': [PanelType.OBJECT], - 'icon': 'EMPTY_AXIS', - 'version': (1, 0, 0) - } - - -def register(): - do_register(NetworkedTransform) - - -def unregister(): - do_unregister(NetworkedTransform) diff --git a/components/physics_shape.py b/components/physics_shape.py deleted file mode 100644 index b409c60..0000000 --- a/components/physics_shape.py +++ /dev/null @@ -1,97 +0,0 @@ -from bpy.props import BoolProperty, FloatProperty, EnumProperty, FloatVectorProperty -from io_hubs_addon.components.hubs_component import HubsComponent -from io_hubs_addon.components.types import Category, NodeType, PanelType -from ..utils import do_register, do_unregister - - -class PhysicsShape(HubsComponent): - _definition = { - 'name': 'physics-shape', - 'display_name': 'BG Physics Shape', - 'category': Category.OBJECT, - 'node_type': NodeType.NODE, - 'panel_type': [PanelType.OBJECT, PanelType.BONE], - 'icon': 'SCENE_DATA', - 'version': (1, 0, 0) - } - - type: EnumProperty( - name="Type", description="Type", - items=[("box", "Box Collider", "A box-shaped primitive collision shape"), - ("sphere", "Sphere Collider", "A primitive collision shape which represents a sphere"), - ("hull", "Convex Hull", - "A convex hull wrapped around the object's vertices. A good analogy for a convex hull is an elastic membrane or balloon under pressure which is placed around a given set of vertices. When released the membrane will assume the shape of the convex hull"), - ("mesh", "Mesh Collider", - "A shape made of the actual vertices of the object. This can be expensive for large meshes")], - default="hull") - - fit: EnumProperty( - name="Fit Mode", - description="Shape fitting mode", - items=[("all", "Automatic fit all", "Automatically match the shape to fit the object's vertices"), - ("manual", "Manual", "Use the manually specified dimensions to define the shape, ignoring the object's vertices")], - default="all") - - halfExtents: FloatVectorProperty( - name="Half Extents", - description="Half dimensions of the collider. (Only used when fit is set to \"manual\" and type is set to \"box\")", - unit='LENGTH', - subtype="XYZ", - default=(0.5, 0.5, 0.5)) - - minHalfExtent: FloatProperty( - name="Min Half Extent", - description="The minimum size to use when automatically generating half extents. (Only used when fit is set to \"all\" and type is set to \"box\")", - unit="LENGTH", - default=0.0) - - maxHalfExtent: FloatProperty( - name="Max Half Extent", - description="The maximum size to use when automatically generating half extents. (Only used when fit is set to \"all\" and type is set to \"box\")", - unit="LENGTH", - default=1000.0) - - sphereRadius: FloatProperty( - name="Sphere Radius", - description="Radius of the sphere collider. (Only used when fit is set to \"manual\" and type is set to \"sphere\")", - unit="LENGTH", default=0.5) - - offset: FloatVectorProperty( - name="Offset", description="An offset to apply to the collider relative to the object's origin", - unit='LENGTH', - subtype="XYZ", - default=(0.0, 0.0, 0.0)) - - includeInvisible: BoolProperty( - name="Include Invisible", - description="Include invisible objects when generating a collider. (Only used if \"fit\" is set to \"all\")", - default=False) - - def draw(self, context, layout, panel): - layout.prop(self, "type") - layout.prop(self, "fit") - if self.fit == "manual": - if self.type == "box": - layout.prop(self, "halfExtents") - elif self.type == "sphere": - layout.prop(self, "sphereRadius") - else: - if self.type == "box": - layout.prop(self, "minHalfExtent") - layout.prop(self, "maxHalfExtent") - layout.prop(self, "includeInvisible") - layout.prop(self, "offset") - - if self.fit == "manual" and (self.type == "mesh" or self.type == "hull"): - col = layout.column() - col.alert = True - col.label( - text="'Hull' and 'Mesh' do not support 'manual' fit mode", icon='ERROR') - - -def register(): - do_register(PhysicsShape) - - -def unregister(): - do_unregister(PhysicsShape) diff --git a/components/rigid_body.py b/components/rigid_body.py deleted file mode 100644 index b06f407..0000000 --- a/components/rigid_body.py +++ /dev/null @@ -1,149 +0,0 @@ -from bpy.props import BoolProperty, FloatProperty, EnumProperty, BoolVectorProperty, FloatVectorProperty -from io_hubs_addon.components.hubs_component import HubsComponent -from io_hubs_addon.components.types import Category, NodeType, PanelType -from ..utils import do_register, do_unregister - - -collision_masks = [ - ("objects", "Objects", "Interactive objects"), - ("triggers", "Triggers", "Trigger Colliders"), - ("environment", "Environment", "Environment geometry"), - ("avatars", "Avatars", "Player Avatars"), - ("media-frames", "Media Frames", "Media Frames"), -] - - -class RigidBody(HubsComponent): - _definition = { - 'name': 'rigidbody', - 'display_name': 'BG RigidBody', - 'category': Category.OBJECT, - 'node_type': NodeType.NODE, - 'panel_type': [PanelType.OBJECT], - 'icon': 'PHYSICS', - 'deps': ['physics-shape'], - 'version': (1, 0, 0) - } - - type: EnumProperty( - name="Body Type", - description="RigidBody Type", - items=[("static", "Static", "Will not ever move."), - ("dynamic", "Dynamic", "Effected by physics and gravity"), - ("kinematic", "Kinematic", "Not effected by gravity or collisions, but can be moved.")], - default="dynamic") - - disableCollision: BoolProperty( - name="Is Trigger", - description="Disable collision response, act as a trigger only", - default=False) - - collisionGroup: EnumProperty( - name="Collision Group", - description="What collision group this object belongs to. This effects what objects will collide with it.", - items=[g for g in collision_masks if g[0] != "avatars"], - default="objects") - - collisionMask: BoolVectorProperty( - name="Collision Mask", - description="What collision groups this object will collide with. Note: the other object must also be set to collide with this object's group.", - size=5, subtype='LAYER', options={'ANIMATABLE'}, - default=[value in ["objects", "triggers", "environment"] for (value, _label, _desc) in collision_masks]) - - mass: FloatProperty( - name="Mass", - description="Object's Mass", - default=1) - - linearDamping: FloatProperty( - name="Linear Damping", - description="Amount of linear damping", - default=0, - min=0.0, - soft_max=1.0, - ) - - angularDamping: FloatProperty( - name="Angular Damping", - description="Amount of angular damping", - default=0, - min=0.0, - soft_max=1.0, - ) - - linearSleepingThreshold: FloatProperty( - name="Linear Sleeping Threshold", - description="Linear velocity threshold below which the object starts to sleep", - default=0.8, - min=0.0, - soft_max=10.0, - ) - - angularSleepingThreshold: FloatProperty( - name="Angular Sleeping Threshold", - description="Angular velocity threshold below which the object starts to sleep", - default=1.0, - min=0.0, - soft_max=10.0, - ) - - angularFactor: FloatVectorProperty( - name="Angular Factor", - description="Influence of the object's rotation along the X, Y, and Z axes", - size=3, - subtype="XYZ", - default=(1.0, 1.0, 1.0), - min=0.0, - soft_max=10.0, - ) - - gravity: FloatVectorProperty( - name="Gravity", description="Object's Gravity", - unit="ACCELERATION", - subtype="ACCELERATION", - default=(0.0, -9.8, 0.0)) - - def gather(self, export_settings, object): - props = super().gather(export_settings, object) - props['collisionMask'] = [value for i, (value, _label, _desc) in enumerate( - collision_masks) if self.collisionMask[i]] - # prefer to store as an array for new components - props['gravity'] = [v for v in self.gravity] - props['angularFactor'] = [v for v in self.angularFactor] - return props - - def draw(self, context, layout, panel): - layout.prop(self, "type") - - if (self.disableCollision and self.collisionGroup != "triggers") or (self.collisionGroup == "triggers" and not self.disableCollision): - col = layout.column() - # col.alert = True - col.label( - text="When making triggers you likely want 'Is Trigger' checked and collision group set to 'Triggers'", - icon='INFO') - layout.prop(self, "collisionGroup") - layout.label(text="Collision Mask:") - col = layout.column(align=True) - for i, (_value, label, _desc) in enumerate(collision_masks): - col.prop(self, "collisionMask", text=label, index=i, toggle=True) - layout.prop(self, "disableCollision") - - layout.prop(self, "mass") - layout.prop(self, "linearDamping") - layout.prop(self, "angularDamping") - layout.prop(self, "linearSleepingThreshold") - layout.prop(self, "angularSleepingThreshold") - layout.prop(self, "angularFactor") - layout.prop(self, "gravity") - - @classmethod - def init(cls, obj): - obj.hubs_component_list.items.get('physics-shape').isDependency = True - - -def register(): - do_register(RigidBody) - - -def unregister(): - do_unregister(RigidBody) diff --git a/consts.py b/consts.py index 79975aa..55c86dd 100644 --- a/consts.py +++ b/consts.py @@ -1,8 +1,8 @@ # Nodes that are deprecated and are replaced with hardcoded nodes but we still load the nodes # from the JSON as we want the to work for backwards compatibility but we don't want them to show in # the categories -from .components import networked_animation, networked_behavior, networked_transform, rigid_body, physics_shape -from io_hubs_addon.components.definitions import text, video, audio, media_frame, visible +from .components import networked_animation, networked_behavior +from io_hubs_addon.components.definitions import text, video, audio, media_frame, visible, rigid_body, physics_shape, networked_transform DEPRECATED_NODES = [ "BGNode_hubs_material_set", "BGNode_hubs_material_getColor",