Skip to content

Commit

Permalink
feat(props): Add missing Visibility Cond props
Browse files Browse the repository at this point in the history
  • Loading branch information
NMC-TBone authored and StjerneIdioten committed Nov 21, 2023
1 parent 5024983 commit 8452aed
Showing 1 changed file with 48 additions and 36 deletions.
84 changes: 48 additions & 36 deletions addon/i3dio/ui/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ class I3DNodeObjectAttributes(bpy.types.PropertyGroup):
'day_of_year_end': {'name': 'dayOfYearEnd', 'default': 0},
'weather_required_mask': {'name': 'weatherRequiredMask', 'default': '0', 'type': 'HEX'},
'weather_prevent_mask': {'name': 'weatherPreventMask', 'default': '0', 'type': 'HEX'},
'viewer_spaciality_required_mask': {'name': 'viewerSpacialityRequiredMask', 'default': '0', 'type': 'HEX'},
'viewer_spaciality_prevent_mask': {'name': 'viewerSpacialityPreventMask', 'default': '0', 'type': 'HEX'},
'render_invisible': {'name': 'renderInvisible', 'default': False},
'visible_shader_parameter': {'name': 'visibleShaderParameter', 'default': 1.0},
'joint': {'name': 'joint', 'default': False},
'projection': {'name': 'projection', 'default': False},
'projection_distance': {'name': 'projDistance', 'default': 0.01},
Expand Down Expand Up @@ -315,7 +319,35 @@ class I3DNodeObjectAttributes(bpy.types.PropertyGroup):
"Summer = 100 / "
"Summer + Sun = 101",
default=i3d_map['weather_prevent_mask']['default']
)
)

viewer_spaciality_required_mask: StringProperty(
name="Viewer Spaciality Required Mask (Hex)",
description="The Viewer Spaciality Required Mask as a hexadecimal value.",
default=i3d_map['viewer_spaciality_required_mask']['default']
)

viewer_spaciality_prevent_mask: StringProperty(
name="Viewer Spaciality Prevent Mask (Hex)",
description="The Viewer Spaciality Prevent Mask as a hexadecimal value.",
default=i3d_map['viewer_spaciality_prevent_mask']['default']
)

render_invisible: BoolProperty(
name="Render Invisible",
description='If set, the object is always rendered and "visibility"'
'must be controlled in the shader using the visible shader parameter',
default=i3d_map['render_invisible']['default']
)

visible_shader_parameter: FloatProperty(
name="Visible Shader Parameter",
description='This value is applied to the "visibility" shader parameter when the object is visible.'
'If conditions are not met, 0 is passed to the shader.',
default=i3d_map['visible_shader_parameter']['default'],
min=-100,
max=100
)

joint: BoolProperty(
name="Joint",
Expand Down Expand Up @@ -524,48 +556,28 @@ def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
obj = bpy.context.active_object
row = layout.row()
row.prop(obj.i3d_attributes, 'use_parent')

row = layout.row()
row.prop(obj.i3d_attributes, 'minute_of_day_start')
if obj.i3d_attributes.use_parent == True:
row.enabled = False

row = layout.row()
row.prop(obj.i3d_attributes, 'minute_of_day_end')
if obj.i3d_attributes.use_parent == True:
row.enabled = False
obj = context.active_object
i3d_attributes = obj.i3d_attributes
use_parent = i3d_attributes.use_parent

row = layout.row()
row.prop(obj.i3d_attributes, 'day_of_year_start')
if obj.i3d_attributes.use_parent == True:
row.enabled = False
row.prop(i3d_attributes, 'use_parent')

row = layout.row()
row.prop(obj.i3d_attributes, 'day_of_year_end')
if obj.i3d_attributes.use_parent == True:
row.enabled = False
properties = ['minute_of_day_start', 'minute_of_day_end',
'day_of_year_start', 'day_of_year_end',
'weather_required_mask', 'weather_prevent_mask',
'viewer_spaciality_required_mask', 'viewer_spaciality_prevent_mask',
'render_invisible', 'visible_shader_parameter']

for prop in properties:
row = layout.row()
row.prop(i3d_attributes, prop)
row.enabled = not use_parent

row = layout.row()
row.prop(obj.i3d_attributes, 'weather_required_mask')
if obj.i3d_attributes.use_parent == True:
row.enabled = False
if use_parent:
i3d_attributes.property_unset(prop)

row = layout.row()
row.prop(obj.i3d_attributes, 'weather_prevent_mask')
if obj.i3d_attributes.use_parent == True:
row.enabled = False

if obj.i3d_attributes.use_parent == True:
obj.i3d_attributes.property_unset('minute_of_day_start')
obj.i3d_attributes.property_unset('minute_of_day_end')
obj.i3d_attributes.property_unset('day_of_year_start')
obj.i3d_attributes.property_unset('day_of_year_end')
obj.i3d_attributes.property_unset('weather_required_mask')
obj.i3d_attributes.property_unset('weather_prevent_mask')

@register
class I3DMergeGroup(bpy.types.PropertyGroup):
Expand Down

0 comments on commit 8452aed

Please sign in to comment.