Images as Planes: Improve option panels #104936
@ -615,7 +615,7 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||||||
# Properties - Importing
|
# Properties - Importing
|
||||||
force_reload: BoolProperty(
|
force_reload: BoolProperty(
|
||||||
name="Force Reload", default=False,
|
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(
|
image_sequence: BoolProperty(
|
||||||
@ -635,7 +635,10 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||||||
'Z-': Vector(( 0, 0, -1)),
|
'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 = (
|
OFFSET_MODES = (
|
||||||
('X+', "X+", "Side by Side to the Left"),
|
('X+', "X+", "Side by Side to the Left"),
|
||||||
@ -646,24 +649,24 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||||||
('Z-', "Z-", "Stacked Below"),
|
('Z-', "Z-", "Stacked Below"),
|
||||||
)
|
)
|
||||||
offset_axis: EnumProperty(
|
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"
|
description="How planes are oriented relative to each others' local axis"
|
||||||
)
|
)
|
||||||
|
|
||||||
offset_amount: FloatProperty(
|
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'
|
subtype='DISTANCE', unit='LENGTH'
|
||||||
)
|
)
|
||||||
|
|
||||||
AXIS_MODES = (
|
AXIS_MODES = (
|
||||||
('X+', "X+", "Facing Positive X"),
|
('X+', "X+", "Facing positive X"),
|
||||||
('Y+', "Y+", "Facing Positive Y"),
|
('Y+', "Y+", "Facing positive Y"),
|
||||||
('Z+', "Z+ (Up)", "Facing Positive Z"),
|
('Z+', "Z+", "Facing positive Z"),
|
||||||
('X-', "X-", "Facing Negative X"),
|
('X-', "X-", "Facing negative X"),
|
||||||
('Y-', "Y-", "Facing Negative Y"),
|
('Y-', "Y-", "Facing negative Y"),
|
||||||
('Z-', "Z- (Down)", "Facing Negative Z"),
|
('Z-', "Z-", "Facing negative Z"),
|
||||||
('CAM', "Face Camera", "Facing Camera"),
|
('CAM', "Face Camera", "Facing camera"),
|
||||||
('CAM_AX', "Main Axis", "Facing the Camera's dominant axis"),
|
('CAM_AX', "Camera's Main Axis", "Facing the camera's dominant axis"),
|
||||||
)
|
)
|
||||||
align_axis: EnumProperty(
|
align_axis: EnumProperty(
|
||||||
name="Align", default='CAM_AX', items=AXIS_MODES,
|
name="Align", default='CAM_AX', items=AXIS_MODES,
|
||||||
@ -673,7 +676,7 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||||||
prev_align_axis: EnumProperty(
|
prev_align_axis: EnumProperty(
|
||||||
items=AXIS_MODES + (('NONE', '', ''),), default='NONE', options={'HIDDEN', 'SKIP_SAVE'})
|
items=AXIS_MODES + (('NONE', '', ''),), default='NONE', options={'HIDDEN', 'SKIP_SAVE'})
|
||||||
align_track: BoolProperty(
|
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 = (
|
SIZE_MODES = (
|
||||||
('ABSOLUTE', "Absolute", "Use absolute size"),
|
('ABSOLUTE', "Absolute", "Use absolute size"),
|
||||||
('CAMERA', "Camera Relative", "Scale to the camera frame"),
|
('CAMERA', "Scale to Camera Frame", "Scale to fit or fill the camera frame"),
|
||||||
('DPI', "Dpi", "Use definition of the image as dots per inch"),
|
('DPI', "Pixels per Inch", "Scale based on pixels per inch"),
|
||||||
('DPBU', "Dots/BU", "Use definition of the image as dots per Blender Unit"),
|
('DPBU', "Pixels per Blender Unit", "Scale based on pixels per Blender Unit"),
|
||||||
)
|
)
|
||||||
size_mode: EnumProperty(
|
size_mode: EnumProperty(
|
||||||
name="Size Mode", default='ABSOLUTE', items=SIZE_MODES,
|
name="Size Mode", default='ABSOLUTE', items=SIZE_MODES,
|
||||||
update=update_size_mode,
|
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_MODES = (
|
||||||
('FILL', "Fill", "Fill camera frame, spilling outside the frame"),
|
('FILL', "Fill", "Fill camera frame, spilling outside the frame"),
|
||||||
('FIT', "Fit", "Fit entire image within the camera frame"),
|
('FIT', "Fit", "Fit entire image within the camera frame"),
|
||||||
)
|
)
|
||||||
fill_mode: EnumProperty(name="Scale", default='FILL', items=FILL_MODES,
|
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",
|
height: FloatProperty(name="Height", description="Height of the created plane",
|
||||||
default=1.0, min=0.001, soft_min=0.001, subtype='DISTANCE', unit='LENGTH')
|
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 = (
|
SHADERS = (
|
||||||
('PRINCIPLED',"Principled","Principled Shader"),
|
('PRINCIPLED',"Principled","Principled Shader"),
|
||||||
('SHADELESS', "Shadeless", "Only visible to camera and reflections"),
|
('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")
|
shader: EnumProperty(name="Shader", items=SHADERS, default='PRINCIPLED', description="Node shader to use")
|
||||||
|
|
||||||
emit_strength: FloatProperty(
|
emit_strength: FloatProperty(
|
||||||
name="Strength", min=0.0, default=1.0, soft_max=10.0,
|
name="Emission Strength", min=0.0, default=1.0, soft_max=10.0,
|
||||||
step=100, description="Brightness of Emission Texture")
|
step=100, description="Strength of emission")
|
||||||
|
|
||||||
use_transparency: BoolProperty(
|
use_transparency: BoolProperty(
|
||||||
name="Use Alpha", default=True,
|
name="Use Alpha", default=True,
|
||||||
@ -753,7 +756,7 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||||||
|
|
||||||
use_backface_culling: BoolProperty(
|
use_backface_culling: BoolProperty(
|
||||||
name="Backface Culling", default=False,
|
name="Backface Culling", default=False,
|
||||||
description="Use back face culling to hide the back side of faces")
|
description="Use backface culling to hide the back side of faces")
|
||||||
|
|
||||||
show_transparent_back: BoolProperty(
|
show_transparent_back: BoolProperty(
|
||||||
name="Show Backface", default=True,
|
name="Show Backface", default=True,
|
||||||
@ -761,11 +764,11 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||||||
|
|
||||||
overwrite_material: BoolProperty(
|
overwrite_material: BoolProperty(
|
||||||
name="Overwrite Material", default=True,
|
name="Overwrite Material", default=True,
|
||||||
description="Overwrite existing Material (based on material name)")
|
description="Overwrite existing material with the same name")
|
||||||
|
|
||||||
compositing_nodes: BoolProperty(
|
compositing_nodes: BoolProperty(
|
||||||
name="Setup Corner Pin", default=False,
|
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")
|
"without re-rendering")
|
||||||
|
|
||||||
# ------------------
|
# ------------------
|
||||||
@ -803,7 +806,7 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||||||
layout = self.layout
|
layout = self.layout
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
|
|
||||||
box.label(text="Import Options:", icon='IMPORT')
|
box.label(text="Import Options", icon='IMPORT')
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.active = bpy.data.is_saved
|
row.active = bpy.data.is_saved
|
||||||
row.prop(self, "relative")
|
row.prop(self, "relative")
|
||||||
@ -814,36 +817,36 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||||||
def draw_material_config(self, context):
|
def draw_material_config(self, context):
|
||||||
# --- Material / Rendering Properties --- #
|
# --- Material / Rendering Properties --- #
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
layout.use_property_split = True
|
||||||
|
layout.use_property_decorate = False
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
|
|
||||||
box.label(text="Compositing Nodes:", icon='RENDERLAYERS')
|
box.label(text="Compositing Nodes", icon='RENDERLAYERS')
|
||||||
box.prop(self, "compositing_nodes")
|
row = box.row(align=True)
|
||||||
|
row.use_property_split = False
|
||||||
|
row.prop(self, "compositing_nodes")
|
||||||
|
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
box = layout.box()
|
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 = box.row()
|
||||||
row.prop(self, 'shader', expand=True)
|
row.prop(self, 'shader', expand=False)
|
||||||
if self.shader == 'EMISSION':
|
if self.shader == 'EMISSION':
|
||||||
box.prop(self, "emit_strength")
|
box.prop(self, "emit_strength")
|
||||||
|
|
||||||
box.label(text="Blend Mode")
|
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.prop(self, 'blend_method', expand=True)
|
row.prop(self, "use_backface_culling")
|
||||||
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 = box.row()
|
||||||
|
row.prop(self, 'blend_method', expand=False)
|
||||||
|
|
||||||
|
row = box.row()
|
||||||
|
row.prop(self, 'shadow_method', expand=False)
|
||||||
if self.blend_method == 'BLEND':
|
if self.blend_method == 'BLEND':
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.prop(self, "show_transparent_back")
|
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
|
engine = context.scene.render.engine
|
||||||
if engine not in ('CYCLES', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'):
|
if engine not in ('CYCLES', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'):
|
||||||
box.label(text=tip_("%s is not supported") % engine, icon='ERROR')
|
box.label(text=tip_("%s is not supported") % engine, icon='ERROR')
|
||||||
@ -851,18 +854,17 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||||||
box.prop(self, "overwrite_material")
|
box.prop(self, "overwrite_material")
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
box.label(text="Texture Settings:", icon='TEXTURE')
|
box.label(text="Texture Settings", icon='TEXTURE')
|
||||||
box.label(text="Interpolation")
|
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.prop(self, 'interpolation', expand=True)
|
row.prop(self, 'interpolation', expand=False)
|
||||||
box.label(text="Extension")
|
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.prop(self, 'extension', expand=True)
|
row.prop(self, 'extension', expand=False)
|
||||||
row = box.row()
|
col = box.column(align=False, heading="Alpha")
|
||||||
row.prop(self, "use_transparency")
|
row = col.row(align=True)
|
||||||
if self.use_transparency:
|
row.prop(self, "use_transparency", text="")
|
||||||
sub = row.row()
|
sub = row.row(align=True)
|
||||||
sub.prop(self, "alpha_mode", text="")
|
sub.active = self.use_transparency
|
||||||
|
sub.prop(self, "alpha_mode", text="")
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.prop(self, "use_auto_refresh")
|
row.prop(self, "use_auto_refresh")
|
||||||
|
|
||||||
@ -871,18 +873,10 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||||||
layout = self.layout
|
layout = self.layout
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
|
|
||||||
box.label(text="Position:", icon='SNAP_GRID')
|
box.label(text="Transform", 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="Plane dimensions:", icon='ARROW_LEFTRIGHT')
|
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.prop(self, "size_mode", expand=True)
|
row.prop(self, "size_mode", expand=False)
|
||||||
if self.size_mode == 'ABSOLUTE':
|
if self.size_mode == 'ABSOLUTE':
|
||||||
box.prop(self, "height")
|
box.prop(self, "height")
|
||||||
elif self.size_mode == 'CAMERA':
|
elif self.size_mode == 'CAMERA':
|
||||||
@ -891,14 +885,21 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
|
|||||||
else:
|
else:
|
||||||
box.prop(self, "factor")
|
box.prop(self, "factor")
|
||||||
|
|
||||||
box.label(text="Orientation:")
|
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.enabled = 'CAM' not in self.size_mode
|
row.enabled = 'CAM' not in self.size_mode
|
||||||
row.prop(self, "align_axis")
|
row.prop(self, "align_axis")
|
||||||
|
if 'CAM' in self.align_axis:
|
||||||
|
row = box.row()
|
||||||
|
row.prop(self, "align_track")
|
||||||
|
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.enabled = 'CAM' in self.align_axis
|
row.prop(self, "offset")
|
||||||
row.alignment = 'RIGHT'
|
col = box.column()
|
||||||
row.prop(self, "align_track")
|
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):
|
def draw(self, context):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user