Skip to content

Commit

Permalink
Merge branch 'even-more-components'
Browse files Browse the repository at this point in the history
  • Loading branch information
netpro2k committed May 21, 2021
2 parents 02c052f + 5daa2df commit be619a9
Show file tree
Hide file tree
Showing 5 changed files with 358 additions and 17 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def add_hubs_components(self, gltf2_object, blender_object, export_settings):
component_class_name = component_class.__name__
component = getattr(blender_object, component_class_name)
component_data[component_name] = gather_properties(export_settings, blender_object, component, component_definition, hubs_config)
is_networked |= component_name in ("link", "image", "audio", "video")
is_networked |= component_definition.get("networked", False)

# NAF-supported media require a network ID
if is_networked:
Expand Down
10 changes: 9 additions & 1 deletion components.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import bpy
import re
from bpy.props import IntVectorProperty, BoolProperty, FloatProperty, StringProperty, EnumProperty
from bpy.props import PointerProperty, FloatVectorProperty, CollectionProperty, IntProperty
from bpy.types import PropertyGroup, Material, Image, Object
Expand Down Expand Up @@ -98,9 +99,16 @@ def define_type(type_name, hubs_context):

return define_class(final_class_name, class_definition, hubs_context)


def camel_to_title(s):
return re.sub(r'((?<=[a-z])[A-Z]|(?<!\A)[A-Z](?=[a-z]))', r' \1', s).title()

def dash_to_title(s):
return s.replace("-", " ").title()

def define_property(class_name, property_name, property_definition, hubs_context):
property_type = property_definition['type']
display_name = property_definition.get("label", property_name)
display_name = property_definition.get("label", camel_to_title(property_name))

if property_type == 'int':
return IntProperty(
Expand Down
Loading

0 comments on commit be619a9

Please sign in to comment.