Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuelegissi committed Jul 18, 2022
1 parent a5f9120 commit a23d065
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
7 changes: 1 addition & 6 deletions bl/panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,7 @@ class VIEW3D_PT_bf_ob_utils(Panel):
@classmethod
def poll(cls, context):
ob = context.object
return (
ob
and ob.type == "MESH"
and not ob.bf_is_tmp
and ob.bf_namelist_cls in ("ON_MESH", "ON_GEOM") # FIXME
)
return ob and ob.type == "MESH" and not ob.bf_is_tmp

def draw_header(self, context):
self.layout.label(text=f"FDS {context.object.bf_namelist_cls[3:7]} Utils")
Expand Down
39 changes: 27 additions & 12 deletions types/bf_namelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def has_bf_param(cls, bf_param):
"""!
Check if bf_param (class) is in cls.bf_params.
@param bf_param: parameter to be tested.
@return True or False.
@return True or False.
"""
return bf_param in cls.bf_params

Expand Down Expand Up @@ -114,7 +114,7 @@ def draw_operators(self, context, layout):
@param layout: the Blender panel layout.
@return used layout.
"""
layout.label(text="None")
layout.label(text="None available")

def draw(self, context, layout):
"""!
Expand Down Expand Up @@ -175,7 +175,12 @@ def from_fds_list(self, context, fds_list, fds_label=None):
try:
bf_param.set_value(context=context, value=fds_param.get_value())
except BFNotImported as err:
utils.ui.write_bl_text(context, bl_text=context.scene.bf_config_text, header="-- Import error", texts=(str(err),))
utils.ui.write_bl_text(
context,
bl_text=context.scene.bf_config_text,
header="-- Import error",
texts=(str(err),),
)
else:
bf_param.set_exported(context=context, value=True)
is_imported = True
Expand All @@ -184,11 +189,14 @@ def from_fds_list(self, context, fds_list, fds_label=None):
bf_param_other = self._get_bf_param_other()
if not is_imported and bf_param_other:
try:
bf_param_other.set_value(
context, value=fds_param.to_string()
)
bf_param_other.set_value(context, value=fds_param.to_string())
except BFNotImported as err:
utils.ui.write_bl_text(context, bl_text=context.scene.bf_config_text, header="-- Import error", texts=(str(err),))
utils.ui.write_bl_text(
context,
bl_text=context.scene.bf_config_text,
header="-- Import error",
texts=(str(err),),
)
else:
is_imported = True

Expand Down Expand Up @@ -226,6 +234,7 @@ def set_appearance(self, context):
return
self.element.render.engine = "BLENDER_WORKBENCH"


class BFNamelistOb(BFNamelist):
"""!
Blender representation of an FDS namelist group related to a Blender Object.
Expand Down Expand Up @@ -258,7 +267,7 @@ def set_appearance(self, context):
ob = self.element
ob.display_type = "TEXTURED"
# ob.show_in_front = show_in_front # unused
# ob.show_wire = show_wire # unused
# ob.show_wire = show_wire # unused

def draw_header(self, context, layout, panel):
ob = self.element
Expand All @@ -268,7 +277,13 @@ def draw_header(self, context, layout, panel):
return
# Manage all others
if self.bpy_export:
layout.prop(self.element, self.bpy_export, icon_only=True, toggle=False, invert_checkbox=True)
layout.prop(
self.element,
self.bpy_export,
icon_only=True,
toggle=False,
invert_checkbox=True,
)
if self.description:
panel.bl_label = f"FDS {self.label} ({self.description})"
else:
Expand All @@ -286,7 +301,7 @@ def draw(self, context, layout):
row.operator("scene.bf_hide_fds_geometry", icon="HIDE_ON")
else:
row.operator("object.bf_show_fds_geometry", icon="HIDE_OFF")
row.operator("object.bf_show_fds_code", icon="HIDE_OFF")
row.operator("object.bf_show_fds_code", icon="HIDE_OFF")
return super().draw(context, layout)


Expand All @@ -309,7 +324,7 @@ def set_appearance(self, context):
return
# This forces the use of diffuse_color for 3DView render
self.element.use_nodes = False

def draw_header(self, context, layout, panel):
ma = self.element
if self.bpy_export and ma.name not in config.DEFAULT_MAS:
Expand All @@ -328,4 +343,4 @@ def draw(self, context, layout):
layout.prop(ma, "diffuse_color", text="RGB")
return
# Manage all others
return super().draw(context, layout)
return super().draw(context, layout)

0 comments on commit a23d065

Please sign in to comment.