Images as Planes: Improve option panels #104936
@ -615,7 +615,7 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
# Properties - Importing
|
||||
force_reload: BoolProperty(
|
||||
name="Force Reload", default=False,
|
||||
description="Force reloading of the image if already opened elsewhere in Blender"
|
||||
description="Force reload the image if it is already opened elsewhere in Blender"
|
||||
)
|
||||
|
||||
image_sequence: BoolProperty(
|
||||
@ -635,7 +635,10 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
'Z-': Vector(( 0, 0, -1)),
|
||||
}
|
||||
|
||||
offset: BoolProperty(name="Offset Planes", default=True, description="Offset Planes From Each Other")
|
||||
offset: BoolProperty(
|
||||
name="Offset Planes", default=True,
|
||||
description="Offset planes from each other. "
|
||||
"If disabled, multiple planes will be created at the same location")
|
||||
|
||||
OFFSET_MODES = (
|
||||
('X+', "X+", "Side by Side to the Left"),
|
||||
@ -646,24 +649,24 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
('Z-', "Z-", "Stacked Below"),
|
||||
)
|
||||
offset_axis: EnumProperty(
|
||||
name="Orientation", default='X+', items=OFFSET_MODES,
|
||||
name="Offset Direction", default='X+', items=OFFSET_MODES,
|
||||
description="How planes are oriented relative to each others' local axis"
|
||||
)
|
||||
|
||||
offset_amount: FloatProperty(
|
||||
name="Offset", soft_min=0, default=0.1, description="Space between planes",
|
||||
name="Offset Distance", soft_min=0, default=0.1, description="Set distance between each plane",
|
||||
subtype='DISTANCE', unit='LENGTH'
|
||||
)
|
||||
|
||||
AXIS_MODES = (
|
||||
('X+', "X+", "Facing Positive X"),
|
||||
('Y+', "Y+", "Facing Positive Y"),
|
||||
('Z+', "Z+ (Up)", "Facing Positive Z"),
|
||||
('X-', "X-", "Facing Negative X"),
|
||||
('Y-', "Y-", "Facing Negative Y"),
|
||||
('Z-', "Z- (Down)", "Facing Negative Z"),
|
||||
('CAM', "Face Camera", "Facing Camera"),
|
||||
('CAM_AX', "Main Axis", "Facing the Camera's dominant axis"),
|
||||
('X+', "X+", "Facing positive X"),
|
||||
('Y+', "Y+", "Facing positive Y"),
|
||||
('Z+', "Z+", "Facing positive Z"),
|
||||
('X-', "X-", "Facing negative X"),
|
||||
('Y-', "Y-", "Facing negative Y"),
|
||||
('Z-', "Z-", "Facing negative Z"),
|
||||
('CAM', "Face Camera", "Facing camera"),
|
||||
('CAM_AX', "Camera's Main Axis", "Facing the camera's dominant axis"),
|
||||
)
|
||||
align_axis: EnumProperty(
|
||||
name="Align", default='CAM_AX', items=AXIS_MODES,
|
||||
@ -673,7 +676,7 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
prev_align_axis: EnumProperty(
|
||||
items=AXIS_MODES + (('NONE', '', ''),), default='NONE', options={'HIDDEN', 'SKIP_SAVE'})
|
||||
align_track: BoolProperty(
|
||||
name="Track Camera", default=False, description="Always face the camera"
|
||||
name="Track Camera", default=False, description="Add a constraint to make the planes to track the camera"
|
||||
)
|
||||
|
||||
# -----------------
|
||||
@ -692,21 +695,21 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
|
||||
SIZE_MODES = (
|
||||
('ABSOLUTE', "Absolute", "Use absolute size"),
|
||||
('CAMERA', "Camera Relative", "Scale to the camera frame"),
|
||||
('DPI', "Dpi", "Use definition of the image as dots per inch"),
|
||||
('DPBU', "Dots/BU", "Use definition of the image as dots per Blender Unit"),
|
||||
('CAMERA', "Scale to Camera Frame", "Scale to fit or fill the camera frame"),
|
||||
('DPI', "Pixels per Inch", "Scale based on pixels per inch"),
|
||||
('DPBU', "Pixels per Blender Unit", "Scale based on pixels per Blender Unit"),
|
||||
)
|
||||
size_mode: EnumProperty(
|
||||
name="Size Mode", default='ABSOLUTE', items=SIZE_MODES,
|
||||
update=update_size_mode,
|
||||
description="How the size of the plane is computed")
|
||||
description="Set how the size of the plane is computed")
|
||||
|
||||
FILL_MODES = (
|
||||
('FILL', "Fill", "Fill camera frame, spilling outside the frame"),
|
||||
('FIT', "Fit", "Fit entire image within the camera frame"),
|
||||
)
|
||||
fill_mode: EnumProperty(name="Scale", default='FILL', items=FILL_MODES,
|
||||
description="How large in the camera frame is the plane")
|
||||
description="Method to scale the plane with the camera frame")
|
||||
|
||||
height: FloatProperty(name="Height", description="Height of the created plane",
|
||||
default=1.0, min=0.001, soft_min=0.001, subtype='DISTANCE', unit='LENGTH')
|
||||
@ -719,13 +722,13 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
SHADERS = (
|
||||
('PRINCIPLED',"Principled","Principled Shader"),
|
||||
('SHADELESS', "Shadeless", "Only visible to camera and reflections"),
|
||||
('EMISSION', "Emit", "Emission Shader"),
|
||||
('EMISSION', "Emission", "Emission Shader"),
|
||||
)
|
||||
shader: EnumProperty(name="Shader", items=SHADERS, default='PRINCIPLED', description="Node shader to use")
|
||||
|
||||
emit_strength: FloatProperty(
|
||||
name="Strength", min=0.0, default=1.0, soft_max=10.0,
|
||||
step=100, description="Brightness of Emission Texture")
|
||||
name="Emission Strength", min=0.0, default=1.0, soft_max=10.0,
|
||||
step=100, description="Strength of emission")
|
||||
|
||||
use_transparency: BoolProperty(
|
||||
name="Use Alpha", default=True,
|
||||
@ -761,11 +764,11 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
|
||||
overwrite_material: BoolProperty(
|
||||
name="Overwrite Material", default=True,
|
||||
description="Overwrite existing Material (based on material name)")
|
||||
description="Overwrite existing material with the same name")
|
||||
|
||||
compositing_nodes: BoolProperty(
|
||||
name="Setup Corner Pin", default=False,
|
||||
description="Build Compositor Nodes to reference this image "
|
||||
description="Build compositor nodes to reference this image "
|
||||
"without re-rendering")
|
||||
|
||||
# ------------------
|
||||
@ -803,7 +806,7 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
layout = self.layout
|
||||
box = layout.box()
|
||||
|
||||
box.label(text="Import Options:", icon='IMPORT')
|
||||
box.label(text="Import Options", icon='IMPORT')
|
||||
row = box.row()
|
||||
row.active = bpy.data.is_saved
|
||||
row.prop(self, "relative")
|
||||
@ -814,36 +817,36 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
def draw_material_config(self, context):
|
||||
# --- Material / Rendering Properties --- #
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
box = layout.box()
|
||||
|
||||
box.label(text="Compositing Nodes:", icon='RENDERLAYERS')
|
||||
box.prop(self, "compositing_nodes")
|
||||
box.label(text="Compositing Nodes", icon='RENDERLAYERS')
|
||||
row = box.row(align=True)
|
||||
row.use_property_split = False
|
||||
row.prop(self, "compositing_nodes")
|
||||
|
||||
layout = self.layout
|
||||
box = layout.box()
|
||||
box.label(text="Material Settings:", icon='MATERIAL')
|
||||
box.label(text="Material Settings", icon='MATERIAL')
|
||||
|
||||
box.label(text="Material Type")
|
||||
row = box.row()
|
||||
row.prop(self, 'shader', expand=True)
|
||||
row.prop(self, 'shader', expand=False)
|
||||
if self.shader == 'EMISSION':
|
||||
box.prop(self, "emit_strength")
|
||||
|
||||
box.label(text="Blend Mode")
|
||||
row = box.row()
|
||||
row.prop(self, 'blend_method', expand=True)
|
||||
if self.use_transparency and self.alpha_mode != "NONE" and self.blend_method == "OPAQUE":
|
||||
box.label(text="'Opaque' does not support alpha", icon="ERROR")
|
||||
row.prop(self, "use_backface_culling")
|
||||
|
||||
row = box.row()
|
||||
row.prop(self, 'blend_method', expand=False)
|
||||
|
||||
row = box.row()
|
||||
row.prop(self, 'shadow_method', expand=False)
|
||||
if self.blend_method == 'BLEND':
|
||||
row = box.row()
|
||||
row.prop(self, "show_transparent_back")
|
||||
|
||||
box.label(text="Shadow Mode")
|
||||
row = box.row()
|
||||
row.prop(self, 'shadow_method', expand=True)
|
||||
|
||||
row = box.row()
|
||||
row.prop(self, "use_backface_culling")
|
||||
|
||||
engine = context.scene.render.engine
|
||||
if engine not in ('CYCLES', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'):
|
||||
box.label(text=tip_("%s is not supported") % engine, icon='ERROR')
|
||||
@ -851,17 +854,16 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
box.prop(self, "overwrite_material")
|
||||
layout = self.layout
|
||||
box = layout.box()
|
||||
box.label(text="Texture Settings:", icon='TEXTURE')
|
||||
box.label(text="Interpolation")
|
||||
box.label(text="Texture Settings", icon='TEXTURE')
|
||||
row = box.row()
|
||||
row.prop(self, 'interpolation', expand=True)
|
||||
box.label(text="Extension")
|
||||
row.prop(self, 'interpolation', expand=False)
|
||||
row = box.row()
|
||||
row.prop(self, 'extension', expand=True)
|
||||
row = box.row()
|
||||
row.prop(self, "use_transparency")
|
||||
if self.use_transparency:
|
||||
sub = row.row()
|
||||
row.prop(self, 'extension', expand=False)
|
||||
col = box.column(align=False, heading="Alpha")
|
||||
row = col.row(align=True)
|
||||
row.prop(self, "use_transparency", text="")
|
||||
sub = row.row(align=True)
|
||||
sub.active = self.use_transparency
|
||||
sub.prop(self, "alpha_mode", text="")
|
||||
row = box.row()
|
||||
row.prop(self, "use_auto_refresh")
|
||||
@ -871,18 +873,10 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
layout = self.layout
|
||||
box = layout.box()
|
||||
|
||||
box.label(text="Position:", icon='SNAP_GRID')
|
||||
box.prop(self, "offset")
|
||||
col = box.column()
|
||||
row = col.row()
|
||||
row.prop(self, "offset_axis", expand=True)
|
||||
row = col.row()
|
||||
row.prop(self, "offset_amount")
|
||||
col.enabled = self.offset
|
||||
box.label(text="Transform", icon='SNAP_GRID')
|
||||
|
||||
box.label(text="Plane dimensions:", icon='ARROW_LEFTRIGHT')
|
||||
row = box.row()
|
||||
row.prop(self, "size_mode", expand=True)
|
||||
row.prop(self, "size_mode", expand=False)
|
||||
if self.size_mode == 'ABSOLUTE':
|
||||
box.prop(self, "height")
|
||||
elif self.size_mode == 'CAMERA':
|
||||
@ -891,15 +885,22 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
||||
else:
|
||||
box.prop(self, "factor")
|
||||
|
||||
box.label(text="Orientation:")
|
||||
row = box.row()
|
||||
row.enabled = 'CAM' not in self.size_mode
|
||||
row.prop(self, "align_axis")
|
||||
if 'CAM' in self.align_axis:
|
||||
row = box.row()
|
||||
row.enabled = 'CAM' in self.align_axis
|
||||
row.alignment = 'RIGHT'
|
||||
row.prop(self, "align_track")
|
||||
|
||||
row = box.row()
|
||||
row.prop(self, "offset")
|
||||
col = box.column()
|
||||
row = col.row()
|
||||
row.prop(self, "offset_axis", expand=False)
|
||||
row = col.row()
|
||||
row.prop(self, "offset_amount")
|
||||
col.enabled = self.offset
|
||||
|
||||
def draw(self, context):
|
||||
|
||||
# Draw configuration sections
|
||||
|
Loading…
Reference in New Issue
Block a user