Skip to content

Commit

Permalink
fix: get traits from geonode instead of metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelgold committed Jul 2, 2022
1 parent 67d2539 commit abc36af
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/shaderverse/blender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,28 @@
class SHADERVERSE_PG_restrictions_item(bpy.types.PropertyGroup):
"""Group of properties representing an item in the list."""


def get_traits(self, context):
def get_traits_from_metadata(self, context):
""" Get the traits from the metadata (deprecated)"""
generated_metadata = json.loads(bpy.context.scene.shaderverse.generated_metadata)
items = []

for attribute in generated_metadata:
trait_type = attribute["trait_type"]
items.append((trait_type, trait_type, ""))
return items

def get_traits_from_geonode(self, context):
""" Get the traits for restrictions from the geometry """
items = []
for modifier in bpy.context.scene.shaderverse.main_geonodes_object.modifiers.values():
node_group = modifier.node_group
print(node_group)
if node_group.type == "GEOMETRY":
for trait_type in node_group.inputs.keys():
items.append((trait_type, trait_type, ""))
return items


trait: bpy.props.EnumProperty(items=get_traits, name="Objects", description="Traits"
)
trait: bpy.props.EnumProperty(items=get_traits_from_geonode, name="Objects", description="Traits")

def __repr__(self):
active_field_object = self.get_active_field()
Expand Down

0 comments on commit abc36af

Please sign in to comment.