cam.operators.bas_relief_ops#

Fabex ‘basrelief.py’

Module to allow the creation of reliefs from Images or View Layers. (https://en.wikipedia.org/wiki/Relief#Bas-relief_or_low_relief)

Classes#

DoBasRelief

Calculate Bas Relief

ProblemAreas

Find Bas Relief Problem Areas

Module Contents#

class DoBasRelief[source]#

Bases: bpy.types.Operator

Calculate Bas Relief

bl_idname = 'scene.calculate_bas_relief'[source]#
bl_label = 'Calculate Bas Relief'[source]#
bl_options[source]#
processes = [][source]#
use_image_source: BoolProperty(name='Use Image Source', description='', default=False)[source]#
source_image_name: StringProperty(name='Image Source', description='image source')[source]#
view_layer_name: StringProperty(name='View Layer Source', description='Make a bas-relief from whatever is on this view layer')[source]#
bit_diameter: FloatProperty(name='Diameter of Ball End in mm', description='Diameter of bit which will be used for carving', min=0.01, max=50.0, default=3.175, precision=PRECISION)[source]#
pass_per_radius: IntProperty(name='Passes per Radius', description='Amount of passes per radius\n(more passes, more mesh precision)', default=2, min=1, max=10)[source]#
width_mm: IntProperty(name='Desired Width in mm', default=200, min=5, max=4000)[source]#
height_mm: IntProperty(name='Desired Height in mm', default=150, min=5, max=4000)[source]#
thickness_mm: IntProperty(name='Thickness in mm', default=15, min=5, max=100)[source]#
justify_x: EnumProperty(name='X', items=['1', 'Left', '', 0, '-0.5', 'Centered', '', 1, '-1', 'Right', '', 2], default='-1')[source]#
justify_y: EnumProperty(name='Y', items=['1', 'Bottom', '', 0, '-0.5', 'Centered', '', 2, '-1', 'Top', '', 1], default='-1')[source]#
justify_z: EnumProperty(name='Z', items=['-1', 'Below 0', '', 0, '-0.5', 'Centered', '', 2, '1', 'Above 0', '', 1], default='-1')[source]#
depth_exponent: FloatProperty(name='Depth Exponent', description='Initial depth map is taken to this power. Higher = sharper relief', min=0.5, max=10.0, default=1.0, precision=PRECISION)[source]#
silhouette_threshold: FloatProperty(name='Silhouette Threshold', description='Silhouette threshold', min=1e-06, max=1.0, default=0.003, precision=PRECISION)[source]#
recover_silhouettes: BoolProperty(name='Recover Silhouettes', description='', default=True)[source]#
silhouette_scale: FloatProperty(name='Silhouette Scale', description='Silhouette scale', min=1e-06, max=5.0, default=0.3, precision=PRECISION)[source]#
silhouette_exponent: IntProperty(name='Silhouette Square Exponent', description='If lower, true depth distances between objects will be more visibe in the relief', default=3, min=0, max=5)[source]#
attenuation: FloatProperty(name='Gradient Attenuation', description='Gradient attenuation', min=1e-06, max=100.0, default=1.0, precision=PRECISION)[source]#
min_gridsize: IntProperty(name='Minimum Grid Size', default=16, min=2, max=512)[source]#
smooth_iterations: IntProperty(name='Smooth Iterations', default=1, min=1, max=64)[source]#
vcycle_iterations: IntProperty(name='V-Cycle Iterations', description='Set higher for planar constraint', default=2, min=1, max=128)[source]#
linbcg_iterations: IntProperty(name='LINBCG Iterations', description='Set lower for flatter relief, and when using planar constraint', default=5, min=1, max=64)[source]#
use_planar: BoolProperty(name='Use Planar Constraint', description='', default=False)[source]#
gradient_scaling_mask_use: BoolProperty(name='Scale Gradients with Mask', description='', default=False)[source]#
decimate_ratio: FloatProperty(name='Decimate Ratio', description='Simplify the mesh using the Decimate modifier. The lower the value the more simplyfied', min=0.01, max=1.0, default=0.1, precision=PRECISION)[source]#
gradient_scaling_mask_name: StringProperty(name='Scaling Mask Name', description='Mask name')[source]#
scale_down_before_use: BoolProperty(name='Scale Down Image Before Processing', description='', default=False)[source]#
scale_down_before: FloatProperty(name='Image Scale', description='Image scale', min=0.025, max=1.0, default=0.5, precision=PRECISION)[source]#
detail_enhancement_use: BoolProperty(name='Enhance Details', description='Enhance details by frequency analysis', default=False)[source]#
detail_enhancement_amount: FloatProperty(name='Amount', description='Image scale', min=0.025, max=1.0, default=0.5, precision=PRECISION)[source]#
advanced: BoolProperty(name='Advanced Options', description='Show advanced options', default=True)[source]#
invoke(context, event)[source]#
execute(context)[source]#

Execute the relief rendering process based on the provided context.

This function retrieves the scene and its associated bas relief settings. It checks if an image source is being used and sets the view layer name accordingly. The function then attempts to render the scene and generate the relief. If any errors occur during these processes, they are reported, and the operation is canceled.

Parameters:

context – The context in which the function is executed.

Returns:

A dictionary indicating the result of the operation, either

Return type:

dict

draw(context)[source]#

Draw the user interface for the bas relief settings.

This method constructs the layout for the bas relief settings in the Blender user interface. It includes various properties and options that allow users to configure the bas relief calculations, such as selecting images, adjusting parameters, and setting justification options. The layout is dynamically updated based on user selections, providing a comprehensive interface for manipulating bas relief settings.

Parameters:

context (bpy.context) – The context in which the UI is being drawn.

Returns:

This method does not return any value; it modifies the layout directly.

Return type:

None

class ProblemAreas[source]#

Bases: bpy.types.Operator

Find Bas Relief Problem Areas

bl_idname = 'scene.problemareas_bas_relief'[source]#
bl_label = 'Problem Areas Bas Relief'[source]#
bl_options[source]#
processes = [][source]#
execute(context)[source]#

Execute the operation related to the bas relief settings in the current scene.

This method retrieves the current scene from the Blender context and accesses the bas relief settings. It then calls the problemAreas function to perform operations related to those settings. The method concludes by returning a status indicating that the operation has finished successfully.

Parameters:

context (bpy.context) – The current Blender context, which provides access

Returns:

A dictionary with a status key indicating the operation result, specifically {‘FINISHED’}.

Return type:

dict