diff options
Diffstat (limited to 'release/scripts')
58 files changed, 1706 insertions, 430 deletions
diff --git a/release/scripts/modules/bpy_extras/__init__.py b/release/scripts/modules/bpy_extras/__init__.py index c8d12070de8..cd176e77aed 100644 --- a/release/scripts/modules/bpy_extras/__init__.py +++ b/release/scripts/modules/bpy_extras/__init__.py @@ -29,5 +29,6 @@ __all__ = ( "image_utils", "keyconfig_utils", "mesh_utils", + "node_utils", "view3d_utils", ) diff --git a/release/scripts/modules/bpy_extras/node_utils.py b/release/scripts/modules/bpy_extras/node_utils.py new file mode 100644 index 00000000000..3b8d4ad7c2a --- /dev/null +++ b/release/scripts/modules/bpy_extras/node_utils.py @@ -0,0 +1,47 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8-80 compliant> + +__all__ = ( + "find_node_input", + "find_output_node", + ) + + +# XXX Names are not unique. Returns the first match. +def find_node_input(node, name): + for input in node.inputs: + if input.name == name: + return input + + return None + +# Return the output node to display in the UI +def find_output_node(ntree, nodetype): + if ntree: + active_output_node = None + for node in ntree.nodes: + if getattr(node, "type", None) == nodetype: + if getattr(node, "is_active_output", True): + return node + if not active_output_node: + active_output_node = node + return active_output_node + + return None diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index c48f03c133d..8f2e69313fc 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -103,9 +103,9 @@ def add_object_align_init(context, operator): return location * rotation -def object_data_add(context, obdata, operator=None, use_active_layer=True, name=None): +def object_data_add(context, obdata, operator=None, name=None): """ - Add an object using the view context and preference to to initialize the + Add an object using the view context and preference to initialize the location, rotation and layer. :arg context: The context to use. @@ -117,53 +117,31 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True, name= :arg name: Optional name :type name: string :return: the newly created object in the scene. - :rtype: :class:`bpy.types.ObjectBase` + :rtype: :class:`bpy.types.Object` """ scene = context.scene + layer = context.render_layer + layer_collection = context.layer_collection - # ugh, could be made nicer - for ob in scene.objects: - ob.select = False + for ob in layer.objects: + ob.select_set(action='DESELECT') + + if not layer_collection: + # when there is no collection linked to this render_layer create one + scene_collection = scene.master_collection.collections.new("") + layer_collection = layer.collections.link(scene_collection) + else: + scene_collection = layer_collection.collection if name is None: name = "Object" if obdata is None else obdata.name + obj_act = layer.objects.active obj_new = bpy.data.objects.new(name, obdata) - - base = scene.objects.link(obj_new) - base.select = True - - v3d = None - if context.space_data and context.space_data.type == 'VIEW_3D': - v3d = context.space_data - - if v3d and v3d.local_view: - base.layers_from_view(context.space_data) - - if operator is not None and any(operator.layers): - base.layers = operator.layers - else: - if use_active_layer: - if v3d and v3d.local_view: - base.layers[scene.active_layer] = True - else: - if v3d and not v3d.lock_camera_and_layers: - base.layers = [True if i == v3d.active_layer - else False for i in range(len(v3d.layers))] - else: - base.layers = [True if i == scene.active_layer - else False for i in range(len(scene.layers))] - else: - if v3d: - base.layers_from_view(context.space_data) - - if operator is not None: - operator.layers = base.layers - + scene_collection.objects.link(obj_new) + obj_new.select_set(action='SELECT') obj_new.matrix_world = add_object_align_init(context, operator) - obj_act = scene.objects.active - # XXX # caused because entering edit-mode does not add a empty undo slot! if context.user_preferences.edit.use_enter_edit_mode: @@ -174,8 +152,8 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True, name= _obdata = bpy.data.meshes.new(name) obj_act = bpy.data.objects.new(_obdata.name, _obdata) obj_act.matrix_world = obj_new.matrix_world - scene.objects.link(obj_act) - scene.objects.active = obj_act + scene_collection.objects.link(obj_act) + layer.objects.active = obj_act bpy.ops.object.mode_set(mode='EDIT') # need empty undo step bpy.ops.ed.undo_push(message="Enter Editmode") @@ -183,9 +161,10 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True, name= if obj_act and obj_act.mode == 'EDIT' and obj_act.type == obj_new.type: bpy.ops.mesh.select_all(action='DESELECT') + obj_act.select_set(action='SELECT') bpy.ops.object.mode_set(mode='OBJECT') - obj_act.select = True + obj_act.select_set(action='SELECT') scene.update() # apply location # scene.objects.active = obj_new @@ -200,16 +179,14 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True, name= bpy.ops.object.join() # join into the active. if obdata: bpy.data.meshes.remove(obdata) - # base is freed, set to active object - base = scene.object_bases.active bpy.ops.object.mode_set(mode='EDIT') else: - scene.objects.active = obj_new + layer.objects.active = obj_new if context.user_preferences.edit.use_enter_edit_mode: bpy.ops.object.mode_set(mode='EDIT') - return base + return obj_new class AddObjectHelper: @@ -230,12 +207,6 @@ class AddObjectHelper: name="Rotation", subtype='EULER', ) - layers = BoolVectorProperty( - name="Layers", - size=20, - subtype='LAYER', - options={'HIDDEN', 'SKIP_SAVE'}, - ) @classmethod def poll(self, context): diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 600b29a6b2b..89d8e0746a6 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -592,6 +592,35 @@ class OrderedMeta(RNAMeta): return OrderedDictMini() # collections.OrderedDict() +# Same as 'Operator' +# only without 'as_keywords' +class Manipulator(StructRNA, metaclass=OrderedMeta): + __slots__ = () + + def __getattribute__(self, attr): + properties = StructRNA.path_resolve(self, "properties") + bl_rna = getattr(properties, "bl_rna", None) + if (bl_rna is not None) and (attr in bl_rna.properties): + return getattr(properties, attr) + return super().__getattribute__(attr) + + def __setattr__(self, attr, value): + properties = StructRNA.path_resolve(self, "properties") + bl_rna = getattr(properties, "bl_rna", None) + if (bl_rna is not None) and (attr in bl_rna.properties): + return setattr(properties, attr, value) + return super().__setattr__(attr, value) + + def __delattr__(self, attr): + properties = StructRNA.path_resolve(self, "properties") + bl_rna = getattr(properties, "bl_rna", None) + if (bl_rna is not None) and (attr in bl_rna.properties): + return delattr(properties, attr) + return super().__delattr__(attr) + + target_set_handler = _bpy._rna_manipulator_target_set_handler + + # Only defined so operators members can be used by accessing self.order # with doc generation 'self.properties.bl_rna.properties' can fail class Operator(StructRNA, metaclass=OrderedMeta): diff --git a/release/scripts/presets/keyconfig/3dsmax.py b/release/scripts/presets/keyconfig/3dsmax.py index 6d05ff6982c..09c6704df1f 100644 --- a/release/scripts/presets/keyconfig/3dsmax.py +++ b/release/scripts/presets/keyconfig/3dsmax.py @@ -7,7 +7,7 @@ kc = wm.keyconfigs.new('3dsmax') # Map Window km = kc.keymaps.new('Window', space_type='EMPTY', region_type='WINDOW', modal=False) -kmi = km.keymap_items.new('wm.window_duplicate', 'W', 'PRESS', ctrl=True, alt=True) +kmi = km.keymap_items.new('wm.window_new', 'W', 'PRESS', ctrl=True, alt=True) kmi = km.keymap_items.new('wm.read_homefile', 'N', 'PRESS', ctrl=True) kmi = km.keymap_items.new('wm.save_homefile', 'U', 'PRESS', ctrl=True) kmi = km.keymap_items.new('wm.call_menu', 'O', 'PRESS', shift=True, ctrl=True) @@ -330,7 +330,6 @@ kmi = km.keymap_items.new('object.hide_view_set', 'H', 'PRESS', shift=True) kmi.properties.unselected = True kmi = km.keymap_items.new('object.hide_render_clear', 'H', 'PRESS', ctrl=True, alt=True) kmi = km.keymap_items.new('object.hide_render_set', 'H', 'PRESS', ctrl=True) -kmi = km.keymap_items.new('object.move_to_layer', 'M', 'PRESS') kmi = km.keymap_items.new('object.delete', 'X', 'PRESS') kmi.properties.use_global = False kmi = km.keymap_items.new('object.delete', 'X', 'PRESS', shift=True) diff --git a/release/scripts/presets/keyconfig/maya.py b/release/scripts/presets/keyconfig/maya.py index 53129593a59..194b9b3c283 100644 --- a/release/scripts/presets/keyconfig/maya.py +++ b/release/scripts/presets/keyconfig/maya.py @@ -8,7 +8,7 @@ kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0]) # Map Window km = kc.keymaps.new('Window', space_type='EMPTY', region_type='WINDOW', modal=False) -kmi = km.keymap_items.new('wm.window_duplicate', 'W', 'PRESS', ctrl=True, alt=True) +kmi = km.keymap_items.new('wm.window_new', 'W', 'PRESS', ctrl=True, alt=True) kmi = km.keymap_items.new('wm.read_homefile', 'N', 'PRESS', ctrl=True) kmi = km.keymap_items.new('wm.save_homefile', 'U', 'PRESS', ctrl=True) kmi = km.keymap_items.new('wm.call_menu', 'O', 'PRESS', shift=True, ctrl=True) @@ -384,7 +384,6 @@ kmi = km.keymap_items.new('object.hide_view_clear', 'H', 'PRESS', shift=True, ct kmi = km.keymap_items.new('object.hide_view_set', 'H', 'PRESS', ctrl=True) kmi = km.keymap_items.new('object.hide_view_set', 'H', 'PRESS', alt=True) kmi.properties.unselected = True -kmi = km.keymap_items.new('object.move_to_layer', 'M', 'PRESS') kmi = km.keymap_items.new('object.delete', 'BACK_SPACE', 'PRESS') kmi = km.keymap_items.new('object.delete', 'DEL', 'PRESS') kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', shift=True) diff --git a/release/scripts/presets/operator/wm.collada_export/sl_plus_open_sim_rigged.py b/release/scripts/presets/operator/wm.collada_export/sl_plus_open_sim_rigged.py index deb23d76d91..7825a4d0f32 100644 --- a/release/scripts/presets/operator/wm.collada_export/sl_plus_open_sim_rigged.py +++ b/release/scripts/presets/operator/wm.collada_export/sl_plus_open_sim_rigged.py @@ -10,7 +10,7 @@ op.include_armatures = True op.include_shapekeys = False op.deform_bones_only = True op.active_uv_only = True -op.export_texture_type_selection = 'uv' +op.include_uv_textures = True op.use_texture_copies = True op.triangulate = True op.use_object_instantiation = False diff --git a/release/scripts/presets/operator/wm.collada_export/sl_plus_open_sim_static.py b/release/scripts/presets/operator/wm.collada_export/sl_plus_open_sim_static.py index ca9de8bf005..a13ba5c4ccc 100644 --- a/release/scripts/presets/operator/wm.collada_export/sl_plus_open_sim_static.py +++ b/release/scripts/presets/operator/wm.collada_export/sl_plus_open_sim_static.py @@ -10,7 +10,6 @@ op.include_armatures = False op.include_shapekeys = False op.deform_bones_only = False op.active_uv_only = True -op.export_texture_type_selection = 'uv' op.use_texture_copies = True op.triangulate = True op.use_object_instantiation = False diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py index 0e5acea94f9..c7152c8a22f 100644 --- a/release/scripts/startup/bl_operators/add_mesh_torus.py +++ b/release/scripts/startup/bl_operators/add_mesh_torus.py @@ -79,7 +79,7 @@ def add_torus(major_rad, minor_rad, major_seg, minor_seg): def add_uvs(mesh, minor_seg, major_seg): from math import fmod - mesh.uv_textures.new() + mesh.uv_layers.new() uv_data = mesh.uv_layers.active.data polygons = mesh.polygons u_step = 1.0 / major_seg @@ -286,4 +286,4 @@ class AddTorus(Operator, object_utils.AddObjectHelper): classes = ( AddTorus, -)
\ No newline at end of file +) diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index d8ef9e1f3ef..d0e55159733 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -235,7 +235,7 @@ class CLIP_OT_track_to_empty(Operator): ob = None ob = bpy.data.objects.new(name=track.name, object_data=None) - ob.select = True + ob.select_set(action='SELECT') context.scene.objects.link(ob) context.scene.objects.active = ob @@ -509,7 +509,7 @@ object's movement caused by this constraint""" # XXX, should probably use context.selected_editable_objects # since selected objects can be from a lib or in hidden layer! for ob in scene.objects: - if ob.select: + if ob.select_set(action='SELECT'): self._bake_object(scene, ob) return {'FINISHED'} diff --git a/release/scripts/startup/bl_operators/freestyle.py b/release/scripts/startup/bl_operators/freestyle.py index 2e46160aeeb..4cee1abf15f 100644 --- a/release/scripts/startup/bl_operators/freestyle.py +++ b/release/scripts/startup/bl_operators/freestyle.py @@ -104,7 +104,7 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator): m.range_max = max_dist return {'FINISHED'} # Find selected mesh objects - selection = [ob for ob in scene.objects if ob.select and ob.type == 'MESH' and ob.name != ref.name] + selection = [ob for ob in scene.objects if ob.select_get() and ob.type == 'MESH' and ob.name != source.name] if selection: # Compute the min/max distance from the reference to mesh vertices min_dist = sys.float_info.max diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py index 4edefd7bf9b..9151f800497 100644 --- a/release/scripts/startup/bl_operators/mesh.py +++ b/release/scripts/startup/bl_operators/mesh.py @@ -50,7 +50,7 @@ class MeshMirrorUV(Operator): @classmethod def poll(cls, context): obj = context.active_object - return (obj and obj.type == 'MESH' and obj.data.uv_textures.active) + return (obj and obj.type == 'MESH' and obj.data.uv_layers.active) def execute(self, context): DIR = (self.direction == 'NEGATIVE') diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index 307764205e6..566487d9d0e 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -81,16 +81,18 @@ class SelectPattern(Operator): # Can be pose bones or objects for item in items: if pattern_match(item.name, self.pattern): - item.select = True # hrmf, perhaps there should be a utility function for this. if is_ebone: + item.select = True item.select_head = True item.select_tail = True if item.use_connect: item_parent = item.parent if item_parent is not None: item_parent.select_tail = True + else: + item.select_set(action='SELECT') return {'FINISHED'} @@ -136,7 +138,7 @@ class SelectCamera(Operator): bpy.ops.object.select_all(action='DESELECT') scene.objects.active = camera camera.hide = False - camera.select = True + camera.select_set(action='SELECT') return {'FINISHED'} return {'CANCELLED'} @@ -202,7 +204,7 @@ class SelectHierarchy(Operator): bpy.ops.object.select_all(action='DESELECT') for obj in select_new: - obj.select = True + obj.select_set(action='SELECT') scene.objects.active = act_new return {'FINISHED'} @@ -513,7 +515,7 @@ class JoinUVs(Operator): if is_editmode: bpy.ops.object.mode_set(mode='OBJECT', toggle=False) - if not mesh.uv_textures: + if not mesh.uv_layers: self.report({'WARNING'}, "Object: %s, Mesh: '%s' has no UVs" % (obj.name, mesh.name)) @@ -551,7 +553,7 @@ class JoinUVs(Operator): else: uv_other = mesh_other.uv_layers.active if not uv_other: - mesh_other.uv_textures.new() + mesh_other.uv_layers.new() uv_other = mesh_other.uv_layers.active if not uv_other: self.report({'ERROR'}, "Could not add " @@ -644,8 +646,8 @@ class MakeDupliFace(Operator): ob_new.use_dupli_faces_scale = True ob_new.dupli_faces_scale = 1.0 / SCALE_FAC - ob_inst.select = True - ob_new.select = True + ob_inst.select_set(action='SELECT') + ob_new.select_set(action='SELECT') def execute(self, context): self._main(context) @@ -664,7 +666,7 @@ class IsolateTypeRender(Operator): for obj in context.visible_objects: - if obj.select: + if obj.select_get(): obj.hide_render = False else: if obj.type == act_type: @@ -1029,8 +1031,8 @@ class LodGenerate(Operator): for level in ob.lod_levels[1:]: level.object.hide = level.object.hide_render = True - lod.select = False - ob.select = True + lod.select_set(action='DESELECT') + ob.select_set(action='SELECT') scene.objects.active = ob return {'FINISHED'} diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py index 16f29c77bb9..39191a896c9 100644 --- a/release/scripts/startup/bl_operators/object_quick_effects.py +++ b/release/scripts/startup/bl_operators/object_quick_effects.py @@ -222,7 +222,7 @@ class QuickExplode(Operator): if self.fade: explode.show_dead = False - uv = obj.data.uv_textures.new("Explode fade") + uv = obj.data.uv_layers.new("Explode fade") explode.particle_uv = uv.name mat = object_ensure_material(obj, "Explode Fade") diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index 6792d525683..e10a2a2915e 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -65,7 +65,7 @@ class CopyRigidbodySettings(Operator): # deselect all but mesh objects for o in context.selected_objects: if o.type != 'MESH': - o.select = False + o.select_set(action='DESELECT') elif o.rigid_body is None: # Add rigidbody to object! scene.objects.active = o @@ -127,7 +127,7 @@ class BakeToKeyframes(Operator): # filter objects selection for obj in context.selected_objects: if not obj.rigid_body or obj.rigid_body.type != 'ACTIVE': - obj.select = False + obj.select_set(action='DESELECT') objects = context.selected_objects @@ -260,7 +260,7 @@ class ConnectRigidBodies(Operator): ob.location = loc context.scene.objects.link(ob) context.scene.objects.active = ob - ob.select = True + ob.select_set(action='SELECT') bpy.ops.rigidbody.constraint_add() con_obj = context.active_object @@ -305,7 +305,7 @@ class ConnectRigidBodies(Operator): # restore selection bpy.ops.object.select_all(action='DESELECT') for obj in objects: - obj.select = True + obj.select_set(action='SELECT') scene.objects.active = obj_act return {'FINISHED'} else: diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py index 25ee5cafe81..29cefd83328 100644 --- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -30,8 +30,8 @@ def extend(obj, operator, EXTEND_MODE): import bmesh me = obj.data # script will fail without UVs - if not me.uv_textures: - me.uv_textures.new() + if not me.uv_layers: + me.uv_layers.new() bm = bmesh.from_edit_mesh(me) @@ -252,4 +252,4 @@ class FollowActiveQuads(Operator): classes = ( FollowActiveQuads, -)
\ No newline at end of file +) diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py index 8ee29d15d1b..61ceb3c04c4 100644 --- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -275,12 +275,12 @@ def lightmap_uvpack(meshes, face_groups.append(faces) if PREF_NEW_UVLAYER: - me.uv_textures.new() + me.uv_layers.new() # Add face UV if it does not exist. # All new faces are selected. - if not me.uv_textures: - me.uv_textures.new() + if not me.uv_layers: + me.uv_layers.new() for face_sel in face_groups: print("\nStarting unwrap") @@ -538,6 +538,9 @@ def lightmap_uvpack(meshes, print("done") if PREF_APPLY_IMAGE: + pass + # removed with texface + ''' if not PREF_PACK_IN_ONE: image = bpy.data.images.new(name="lightmap", width=PREF_IMG_PX_SIZE, @@ -545,8 +548,8 @@ def lightmap_uvpack(meshes, ) for f in face_sel: - # f.image = image - f.id_data.uv_textures.active.data[f.index].image = image # XXX25 + f.image = image + ''' for me in meshes: me.update() @@ -672,4 +675,4 @@ class LightMapPack(Operator): classes = ( LightMapPack, -)
\ No newline at end of file +) diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py index cc590ac9502..411c318643b 100644 --- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py +++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py @@ -810,8 +810,8 @@ def main(context, # Tag as used me.tag = True - if not me.uv_textures: # Mesh has no UV Coords, don't bother. - me.uv_textures.new() + if not me.uv_layers: # Mesh has no UV Coords, don't bother. + me.uv_layers.new() uv_layer = me.uv_layers.active.data me_verts = list(me.vertices) diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index 5b609605cee..cc3d1ffc229 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -28,6 +28,7 @@ if "bpy" in locals(): _modules = [ "properties_animviz", + "properties_collection", "properties_constraint", "properties_data_armature", "properties_data_bone", @@ -39,6 +40,7 @@ _modules = [ "properties_data_mesh", "properties_data_metaball", "properties_data_modifier", + "properties_data_lightprobe", "properties_data_speaker", "properties_game", "properties_mask_common", diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py new file mode 100644 index 00000000000..9e7d29358a9 --- /dev/null +++ b/release/scripts/startup/bl_ui/properties_collection.py @@ -0,0 +1,167 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> +import bpy +from bpy.types import Panel + + +class CollectionButtonsPanel: + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "collection" + + +class COLLECTION_PT_context_collection(CollectionButtonsPanel, Panel): + bl_label = "" + bl_options = {'HIDE_HEADER'} + + def draw(self, context): + layout = self.layout + space = context.space_data + + collection = context.layer_collection + name = collection.name + if name == 'Master Collection': + layout.label(text=name, icon='COLLAPSEMENU') + else: + layout.prop(collection, "name", text="", icon='COLLAPSEMENU') + + +class COLLECTION_PT_clay_settings(CollectionButtonsPanel, Panel): + bl_label = "Render Settings" + COMPAT_ENGINES = {'BLENDER_CLAY'} + + @classmethod + def poll(cls, context): + scene = context.scene + return scene and (scene.render.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + scene_props = context.scene.collection_properties['BLENDER_CLAY'] + collection = context.layer_collection + collection_props = collection.engine_overrides['BLENDER_CLAY'] + + col = layout.column() + col.template_override_property(collection_props, scene_props, "matcap_icon", custom_template="icon_view") + col.template_override_property(collection_props, scene_props, "matcap_rotation") + col.template_override_property(collection_props, scene_props, "matcap_hue") + col.template_override_property(collection_props, scene_props, "matcap_saturation") + col.template_override_property(collection_props, scene_props, "matcap_value") + col.template_override_property(collection_props, scene_props, "ssao_factor_cavity") + col.template_override_property(collection_props, scene_props, "ssao_factor_edge") + col.template_override_property(collection_props, scene_props, "ssao_distance") + col.template_override_property(collection_props, scene_props, "ssao_attenuation") + col.template_override_property(collection_props, scene_props, "hair_brightness_randomness") + + +class COLLECTION_PT_object_mode_settings(CollectionButtonsPanel, Panel): + bl_label = "Object Mode Settings" + + @classmethod + def poll(cls, context): + ob = context.object + return ob and (ob.mode == 'OBJECT') + + def draw(self, context): + layout = self.layout + scene_props = context.scene.collection_properties['ObjectMode'] + collection = context.layer_collection + collection_props = collection.engine_overrides['ObjectMode'] + + col = layout.column() + col.template_override_property(collection_props, scene_props, "show_wire") + col.template_override_property(collection_props, scene_props, "show_backface_culling") + + +class COLLECTION_PT_edit_mode_settings(CollectionButtonsPanel, Panel): + bl_label = "Edit Mode Settings" + + @classmethod + def poll(cls, context): + ob = context.object + return ob and (ob.mode == 'EDIT') + + def draw(self, context): + layout = self.layout + scene_props = context.scene.collection_properties['EditMode'] + collection = context.layer_collection + collection_props = collection.engine_overrides['EditMode'] + + col = layout.column() + col.template_override_property(collection_props, scene_props, "show_occlude_wire") + col.template_override_property(collection_props, scene_props, "backwire_opacity") + col.template_override_property(collection_props, scene_props, "face_normals_show") + col.template_override_property(collection_props, scene_props, "vert_normals_show") + col.template_override_property(collection_props, scene_props, "loop_normals_show") + col.template_override_property(collection_props, scene_props, "normals_length") + col.template_override_property(collection_props, scene_props, "show_weight") + + +class COLLECTION_PT_paint_weight_mode_settings(CollectionButtonsPanel, Panel): + bl_label = "Weight Paint Mode Settings" + + @classmethod + def poll(cls, context): + ob = context.object + return ob and (ob.mode == 'WEIGHT_PAINT') + + def draw(self, context): + layout = self.layout + scene_props = context.scene.collection_properties['WeightPaintMode'] + collection = context.layer_collection + collection_props = collection.engine_overrides['WeightPaintMode'] + + col = layout.column() + col.template_override_property(collection_props, scene_props, "use_shading") + col.template_override_property(collection_props, scene_props, "use_wire") + + +class COLLECTION_PT_paint_vertex_mode_settings(CollectionButtonsPanel, Panel): + bl_label = "Vertex Paint Mode Settings" + + @classmethod + def poll(cls, context): + ob = context.object + return ob and (ob.mode == 'VERTEX_PAINT') + + def draw(self, context): + layout = self.layout + scene_props = context.scene.collection_properties['VertexPaintMode'] + collection = context.layer_collection + collection_props = collection.engine_overrides['VertexPaintMode'] + + col = layout.column() + col.template_override_property(collection_props, scene_props, "use_shading") + col.template_override_property(collection_props, scene_props, "use_wire") + + +classes = ( + COLLECTION_PT_context_collection, + COLLECTION_PT_clay_settings, + COLLECTION_PT_object_mode_settings, + COLLECTION_PT_edit_mode_settings, + COLLECTION_PT_paint_weight_mode_settings, + COLLECTION_PT_paint_vertex_mode_settings, +) + +if __name__ == "__main__": # only for live edit. + from bpy.utils import register_class + for cls in classes: + register_class(cls) diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index ae52ab916f1..4ce2d97d2a0 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -328,7 +328,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _context_path = "object.data" _property_type = bpy.types.Armature diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py index 132c355ed99..e6a2a266e08 100644 --- a/release/scripts/startup/bl_ui/properties_data_bone.py +++ b/release/scripts/startup/bl_ui/properties_data_bone.py @@ -438,7 +438,7 @@ class BONE_PT_deform(BoneButtonsPanel, Panel): class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _property_type = bpy.types.Bone, bpy.types.EditBone, bpy.types.PoseBone @property diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py index 14286045704..e0b92555735 100644 --- a/release/scripts/startup/bl_ui/properties_data_camera.py +++ b/release/scripts/startup/bl_ui/properties_data_camera.py @@ -37,7 +37,7 @@ class CAMERA_MT_presets(Menu): bl_label = "Camera Presets" preset_subdir = "camera" preset_operator = "script.execute_preset" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} draw = Menu.draw_preset @@ -45,14 +45,14 @@ class SAFE_AREAS_MT_presets(Menu): bl_label = "Camera Presets" preset_subdir = "safe_areas" preset_operator = "script.execute_preset" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} draw = Menu.draw_preset class DATA_PT_context_camera(CameraButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -72,7 +72,7 @@ class DATA_PT_context_camera(CameraButtonsPanel, Panel): class DATA_PT_lens(CameraButtonsPanel, Panel): bl_label = "Lens" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -114,7 +114,7 @@ class DATA_PT_lens(CameraButtonsPanel, Panel): sub = row.column(align=True) sub.prop(ccam, "longitude_min") sub.prop(ccam, "longitude_max") - elif engine == 'BLENDER_RENDER': + elif engine in {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'}: row = col.row() if cam.lens_unit == 'MILLIMETERS': row.prop(cam, "lens") @@ -137,7 +137,7 @@ class DATA_PT_lens(CameraButtonsPanel, Panel): class DATA_PT_camera_stereoscopy(CameraButtonsPanel, Panel): bl_label = "Stereoscopy" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -183,7 +183,7 @@ class DATA_PT_camera_stereoscopy(CameraButtonsPanel, Panel): class DATA_PT_camera(CameraButtonsPanel, Panel): bl_label = "Camera" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -217,7 +217,7 @@ class DATA_PT_camera(CameraButtonsPanel, Panel): class DATA_PT_camera_dof(CameraButtonsPanel, Panel): bl_label = "Depth of Field" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -234,20 +234,30 @@ class DATA_PT_camera_dof(CameraButtonsPanel, Panel): sub.active = (cam.dof_object is None) sub.prop(cam, "dof_distance", text="Distance") - hq_support = dof_options.is_hq_supported - col = split.column(align=True) - col.label("Viewport:") - sub = col.column() - sub.active = hq_support - sub.prop(dof_options, "use_high_quality") - col.prop(dof_options, "fstop") - if dof_options.use_high_quality and hq_support: - col.prop(dof_options, "blades") + if context.scene.render.engine == 'BLENDER_EEVEE': + col = split.column(align=True) + col.label("Aperture:") + engine = context.scene.render.engine + sub = col.column(align=True) + sub.prop(dof_options, "fstop") + sub.prop(dof_options, "blades") + sub.prop(dof_options, "rotation") + sub.prop(dof_options, "ratio") + else: + hq_support = dof_options.is_hq_supported + col = split.column(align=True) + col.label("Viewport:") + sub = col.column() + sub.active = hq_support + sub.prop(dof_options, "use_high_quality") + col.prop(dof_options, "fstop") + if dof_options.use_high_quality and hq_support: + col.prop(dof_options, "blades") class DATA_PT_camera_display(CameraButtonsPanel, Panel): bl_label = "Display" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -277,7 +287,7 @@ class DATA_PT_camera_display(CameraButtonsPanel, Panel): class DATA_PT_camera_safe_areas(CameraButtonsPanel, Panel): bl_label = "Safe Areas" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw_header(self, context): cam = context.camera @@ -293,7 +303,7 @@ class DATA_PT_camera_safe_areas(CameraButtonsPanel, Panel): class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _context_path = "object.data" _property_type = bpy.types.Camera diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py index 3a3ad31a8ef..6fb147007e6 100644 --- a/release/scripts/startup/bl_ui/properties_data_curve.py +++ b/release/scripts/startup/bl_ui/properties_data_curve.py @@ -136,7 +136,7 @@ class DATA_PT_shape_curve(CurveButtonsPanel, Panel): class DATA_PT_curve_texture_space(CurveButtonsPanel, Panel): bl_label = "Texture Space" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -427,7 +427,7 @@ class DATA_PT_text_boxes(CurveButtonsPanelText, Panel): class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _context_path = "object.data" _property_type = bpy.types.Curve diff --git a/release/scripts/startup/bl_ui/properties_data_lamp.py b/release/scripts/startup/bl_ui/properties_data_lamp.py index 98aa31ac915..bef2b2769d0 100644 --- a/release/scripts/startup/bl_ui/properties_data_lamp.py +++ b/release/scripts/startup/bl_ui/properties_data_lamp.py @@ -26,7 +26,7 @@ class LAMP_MT_sunsky_presets(Menu): bl_label = "Sun & Sky Presets" preset_subdir = "sunsky" preset_operator = "script.execute_preset" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} draw = Menu.draw_preset @@ -44,7 +44,7 @@ class DataButtonsPanel: class DATA_PT_context_lamp(DataButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -68,7 +68,7 @@ class DATA_PT_context_lamp(DataButtonsPanel, Panel): class DATA_PT_preview(DataButtonsPanel, Panel): bl_label = "Preview" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): self.layout.template_preview(context.lamp) @@ -76,7 +76,7 @@ class DATA_PT_preview(DataButtonsPanel, Panel): class DATA_PT_lamp(DataButtonsPanel, Panel): bl_label = "Lamp" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY'} def draw(self, context): layout = self.layout @@ -96,6 +96,7 @@ class DATA_PT_lamp(DataButtonsPanel, Panel): sub.label(text="Falloff:") sub.prop(lamp, "falloff_type", text="") sub.prop(lamp, "distance") + sub.prop(lamp, "shadow_soft_size", text="Radius") if lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED': col.label(text="Attenuation Factors:") @@ -123,6 +124,47 @@ class DATA_PT_lamp(DataButtonsPanel, Panel): col.prop(lamp, "use_diffuse") +class DATA_PT_EEVEE_lamp(DataButtonsPanel, Panel): + bl_label = "Lamp" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + + lamp = context.lamp + + layout.row().prop(lamp, "type", expand=True) + + split = layout.split() + + col = split.column() + sub = col.column() + sub.prop(lamp, "color", text="") + sub.prop(lamp, "energy") + + if lamp.type in {'POINT', 'SPOT', 'SUN'}: + sub.prop(lamp, "shadow_soft_size", text="Radius") + elif lamp.type == 'AREA': + sub = sub.column(align=True) + sub.prop(lamp, "shape", text="") + if lamp.shape == 'SQUARE': + sub.prop(lamp, "size") + elif lamp.shape == 'RECTANGLE': + sub.prop(lamp, "size", text="Size X") + sub.prop(lamp, "size_y", text="Size Y") + + col = split.column() + col.prop(lamp, "use_specular") + col.prop(lamp, "use_diffuse") + col.separator() + + if lamp.type in {'POINT', 'SPOT', 'AREA'}: + col.prop(lamp, "use_sphere") + col = col.column() + col.active = lamp.use_sphere + col.prop(lamp, "distance") + + class DATA_PT_sunsky(DataButtonsPanel, Panel): bl_label = "Sky & Atmosphere" COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -307,12 +349,46 @@ class DATA_PT_shadow(DataButtonsPanel, Panel): col.prop(lamp, "use_auto_clip_end", text="Autoclip End") sub = col.column() sub.active = not lamp.use_auto_clip_end - sub.prop(lamp, "shadow_buffer_clip_end", text=" Clip End") + sub.prop(lamp, "shadow_buffer_clip_end", text="Clip End") + + +class DATA_PT_EEVEE_shadow(DataButtonsPanel, Panel): + bl_label = "Shadow" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + lamp = context.lamp + engine = context.scene.render.engine + return (lamp and lamp.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) and (engine in cls.COMPAT_ENGINES) + + def draw_header(self, context): + lamp = context.lamp + self.layout.prop(lamp, "use_shadow", text="") + + def draw(self, context): + layout = self.layout + + lamp = context.lamp + + if lamp.type == 'SUN': + layout.label("Comming Soon") + else: + split = layout.split() + split.active = lamp.use_shadow + + col = split.column(align=True) + col.prop(lamp, "shadow_buffer_clip_start", text="Clip Start") + col.prop(lamp, "shadow_buffer_clip_end", text="Clip End") + + col = split.column(align=True) + col.prop(lamp, "shadow_buffer_bias", text="Bias") + col.prop(lamp, "shadow_buffer_exp", text="Exponent") class DATA_PT_area(DataButtonsPanel, Panel): bl_label = "Area Shape" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY'} @classmethod def poll(cls, context): @@ -338,7 +414,7 @@ class DATA_PT_area(DataButtonsPanel, Panel): class DATA_PT_spot(DataButtonsPanel, Panel): bl_label = "Spot Shape" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY'} @classmethod def poll(cls, context): @@ -371,10 +447,35 @@ class DATA_PT_spot(DataButtonsPanel, Panel): sub.prop(lamp, "halo_step", text="Step") +class DATA_PT_spot(DataButtonsPanel, Panel): + bl_label = "Spot Shape" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + lamp = context.lamp + engine = context.scene.render.engine + return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + lamp = context.lamp + + split = layout.split() + + col = split.column() + sub = col.column() + sub.prop(lamp, "spot_size", text="Size") + sub.prop(lamp, "spot_blend", text="Blend", slider=True) + col = split.column() + col.prop(lamp, "show_cone") + + class DATA_PT_falloff_curve(DataButtonsPanel, Panel): bl_label = "Falloff Curve" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -390,7 +491,7 @@ class DATA_PT_falloff_curve(DataButtonsPanel, Panel): class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _context_path = "object.data" _property_type = bpy.types.Lamp @@ -400,8 +501,10 @@ classes = ( DATA_PT_context_lamp, DATA_PT_preview, DATA_PT_lamp, + DATA_PT_EEVEE_lamp, DATA_PT_sunsky, DATA_PT_shadow, + DATA_PT_EEVEE_shadow, DATA_PT_area, DATA_PT_spot, DATA_PT_falloff_curve, diff --git a/release/scripts/startup/bl_ui/properties_data_lattice.py b/release/scripts/startup/bl_ui/properties_data_lattice.py index 4b3fd48c195..34cb323a8cb 100644 --- a/release/scripts/startup/bl_ui/properties_data_lattice.py +++ b/release/scripts/startup/bl_ui/properties_data_lattice.py @@ -78,7 +78,7 @@ class DATA_PT_lattice(DataButtonsPanel, Panel): class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _context_path = "object.data" _property_type = bpy.types.Lattice diff --git a/release/scripts/startup/bl_ui/properties_data_lightprobe.py b/release/scripts/startup/bl_ui/properties_data_lightprobe.py new file mode 100644 index 00000000000..cca5f823549 --- /dev/null +++ b/release/scripts/startup/bl_ui/properties_data_lightprobe.py @@ -0,0 +1,176 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> +import bpy +from bpy.types import Panel + + +class DataButtonsPanel: + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + @classmethod + def poll(cls, context): + engine = context.scene.render.engine + return context.lightprobe and (engine in cls.COMPAT_ENGINES) + + +class DATA_PT_context_lightprobe(DataButtonsPanel, Panel): + bl_label = "" + bl_options = {'HIDE_HEADER'} + COMPAT_ENGINES = {'BLENDER_CLAY', 'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + + ob = context.object + probe = context.lightprobe + space = context.space_data + + if ob: + layout.template_ID(ob, "data") + elif probe: + layout.template_ID(space, "pin_id") + + +class DATA_PT_lightprobe(DataButtonsPanel, Panel): + bl_label = "Probe" + COMPAT_ENGINES = {'BLENDER_CLAY', 'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + + ob = context.object + probe = context.lightprobe + + split = layout.split() + + if probe.type == 'GRID': + col = split.column(align=True) + col.label("Resolution:") + col.prop(probe, "grid_resolution_x", text="X") + col.prop(probe, "grid_resolution_y", text="Y") + col.prop(probe, "grid_resolution_z", text="Z") + + col.separator() + + col.label("Influence:") + col.prop(probe, "influence_distance", "Distance") + col.prop(probe, "falloff") + + elif probe.type == 'PLANAR': + col = split.column(align=True) + col.label("Influence:") + col.prop(probe, "influence_distance", "Distance") + col.prop(probe, "falloff") + + else: + col = split.column(align=True) + col.label("Influence:") + col.prop(probe, "influence_type", text="") + + if probe.influence_type == 'ELIPSOID': + col.prop(probe, "influence_distance", "Radius") + else: + col.prop(probe, "influence_distance", "Size") + + col.prop(probe, "falloff") + + col = split.column(align=True) + col.label("Clipping:") + col.prop(probe, "clip_start", text="Start") + + if probe.type != "PLANAR": + col.prop(probe, "clip_end", text="End") + + +class DATA_PT_lightprobe_parallax(DataButtonsPanel, Panel): + bl_label = "Parallax" + COMPAT_ENGINES = {'BLENDER_CLAY', 'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + engine = context.scene.render.engine + return context.lightprobe and context.lightprobe.type == 'CUBEMAP' and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + ob = context.object + probe = context.lightprobe + + layout.prop(probe, "use_custom_parallax") + + col = layout.column() + col.active = probe.use_custom_parallax + + row = col.row() + row.prop(probe, "parallax_type", expand=True) + + if probe.parallax_type == 'ELIPSOID': + col.prop(probe, "parallax_distance", "Radius") + else: + col.prop(probe, "parallax_distance", "Size") + + +class DATA_PT_lightprobe_display(DataButtonsPanel, Panel): + bl_label = "Display" + COMPAT_ENGINES = {'BLENDER_CLAY', 'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + + ob = context.object + probe = context.lightprobe + is_planar = (probe.type is "PLANAR") + + split = layout.split() + + col = split.column() + col.prop(probe, "show_influence") + + col = split.column() + col.active = is_planar + col.prop(probe, "show_parallax") + + col = split.column() + col.active = is_planar + col.prop(probe, "show_clip") + + row = layout.row() + row.prop(probe, "show_data") + + if probe.type != "PLANAR": + row.prop(probe, "data_draw_size", text="Size") + else: + row.prop(ob, "empty_draw_size", text="Arrow Size") + + +classes = ( + DATA_PT_context_lightprobe, + DATA_PT_lightprobe, + DATA_PT_lightprobe_parallax, + DATA_PT_lightprobe_display, +) + +if __name__ == "__main__": # only for live edit. + from bpy.utils import register_class + for cls in classes: + register_class(cls) diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index de55b4152ba..4d00b70a0fa 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -24,7 +24,7 @@ from rna_prop_ui import PropertyPanel class MESH_MT_vertex_group_specials(Menu): bl_label = "Vertex Group Specials" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -48,7 +48,7 @@ class MESH_MT_vertex_group_specials(Menu): class MESH_MT_shape_key_specials(Menu): bl_label = "Shape Key Specials" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -76,6 +76,17 @@ class MESH_UL_vgroups(UIList): layout.label(text="", icon_value=icon) +class MESH_UL_fmaps(UIList): + def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): + # assert(isinstance(item, bpy.types.FaceMap)) + fmap = item + if self.layout_type in {'DEFAULT', 'COMPACT'}: + layout.prop(fmap, "name", text="", emboss=False, icon_value=icon) + elif self.layout_type in {'GRID'}: + layout.alignment = 'CENTER' + layout.label(text="", icon_value=icon) + + class MESH_UL_shape_keys(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.ShapeKey)) @@ -126,7 +137,7 @@ class MeshButtonsPanel: class DATA_PT_context_mesh(MeshButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -143,7 +154,7 @@ class DATA_PT_context_mesh(MeshButtonsPanel, Panel): class DATA_PT_normals(MeshButtonsPanel, Panel): bl_label = "Normals" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -164,7 +175,7 @@ class DATA_PT_normals(MeshButtonsPanel, Panel): class DATA_PT_texture_space(MeshButtonsPanel, Panel): bl_label = "Texture Space" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -183,7 +194,7 @@ class DATA_PT_texture_space(MeshButtonsPanel, Panel): class DATA_PT_vertex_groups(MeshButtonsPanel, Panel): bl_label = "Vertex Groups" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -227,9 +238,50 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel): layout.prop(context.tool_settings, "vertex_group_weight", text="Weight") +class DATA_PT_face_maps(MeshButtonsPanel, Panel): + bl_label = "Face Maps" + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + + @classmethod + def poll(cls, context): + obj = context.object + return (obj and obj.type == 'MESH') + + def draw(self, context): + layout = self.layout + + ob = context.object + facemap = ob.face_maps.active + + rows = 2 + if facemap: + rows = 4 + + row = layout.row() + row.template_list("MESH_UL_fmaps", "", ob, "face_maps", ob.face_maps, "active_index", rows=rows) + + col = row.column(align=True) + col.operator("object.face_map_add", icon='ZOOMIN', text="") + col.operator("object.face_map_remove", icon='ZOOMOUT', text="") + if facemap: + col.separator() + col.operator("object.face_map_move", icon='TRIA_UP', text="").direction = 'UP' + col.operator("object.face_map_move", icon='TRIA_DOWN', text="").direction = 'DOWN' + + if ob.face_maps and (ob.mode == 'EDIT' and ob.type == 'MESH'): + row = layout.row() + + sub = row.row(align=True) + sub.operator("object.face_map_assign", text="Assign") + sub.operator("object.face_map_remove_from", text="Remove") + + sub = row.row(align=True) + sub.operator("object.face_map_select", text="Select") + sub.operator("object.face_map_deselect", text="Deselect") + class DATA_PT_shape_keys(MeshButtonsPanel, Panel): bl_label = "Shape Keys" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -322,7 +374,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel): class DATA_PT_uv_texture(MeshButtonsPanel, Panel): bl_label = "UV Maps" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -332,7 +384,7 @@ class DATA_PT_uv_texture(MeshButtonsPanel, Panel): row = layout.row() col = row.column() - col.template_list("MESH_UL_uvmaps_vcols", "uvmaps", me, "uv_textures", me.uv_textures, "active_index", rows=1) + col.template_list("MESH_UL_uvmaps_vcols", "uvmaps", me, "uv_layers", me.uv_layers, "active_index", rows=1) col = row.column(align=True) col.operator("mesh.uv_texture_add", icon='ZOOMIN', text="") @@ -341,7 +393,7 @@ class DATA_PT_uv_texture(MeshButtonsPanel, Panel): class DATA_PT_vertex_colors(MeshButtonsPanel, Panel): bl_label = "Vertex Colors" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -361,7 +413,7 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, Panel): class DATA_PT_customdata(MeshButtonsPanel, Panel): bl_label = "Geometry Data" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -387,7 +439,7 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel): class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _context_path = "object.data" _property_type = bpy.types.Mesh @@ -396,12 +448,14 @@ classes = ( MESH_MT_vertex_group_specials, MESH_MT_shape_key_specials, MESH_UL_vgroups, + MESH_UL_fmaps, MESH_UL_shape_keys, MESH_UL_uvmaps_vcols, DATA_PT_context_mesh, DATA_PT_normals, DATA_PT_texture_space, DATA_PT_vertex_groups, + DATA_PT_face_maps, DATA_PT_shape_keys, DATA_PT_uv_texture, DATA_PT_vertex_colors, diff --git a/release/scripts/startup/bl_ui/properties_data_metaball.py b/release/scripts/startup/bl_ui/properties_data_metaball.py index dd62c4523b1..e771caf49e3 100644 --- a/release/scripts/startup/bl_ui/properties_data_metaball.py +++ b/release/scripts/startup/bl_ui/properties_data_metaball.py @@ -76,7 +76,7 @@ class DATA_PT_metaball(DataButtonsPanel, Panel): class DATA_PT_mball_texture_space(DataButtonsPanel, Panel): bl_label = "Texture Space" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -131,7 +131,7 @@ class DATA_PT_metaball_element(DataButtonsPanel, Panel): class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _context_path = "object.data" _property_type = bpy.types.MetaBall diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index d72855fab6b..05321ee4486 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -355,7 +355,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col.prop(md, "texture_coords_object", text="") elif md.texture_coords == 'UV' and ob.type == 'MESH': col.label(text="UV Map:") - col.prop_search(md, "uv_layer", ob.data, "uv_textures", text="") + col.prop_search(md, "uv_layer", ob.data, "uv_layers", text="") layout.separator() @@ -387,7 +387,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): sub.active = bool(md.vertex_group) sub.prop(md, "protect") col.label(text="Particle UV") - col.prop_search(md, "particle_uv", ob.data, "uv_textures", text="") + col.prop_search(md, "particle_uv", ob.data, "uv_layers", text="") col = split.column() col.prop(md, "use_edge_cut") @@ -985,11 +985,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col = split.column() col.label(text="UV Map:") - col.prop_search(md, "uv_layer", ob.data, "uv_textures", text="") + col.prop_search(md, "uv_layer", ob.data, "uv_layers", text="") split = layout.split() col = split.column() - col.prop(md, "use_image_override") col.prop(md, "projector_count", text="Projectors") for proj in md.projectors: col.prop(proj, "object", text="") @@ -1043,7 +1042,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): if md.texture_coords == 'OBJECT': layout.prop(md, "texture_coords_object", text="Object") elif md.texture_coords == 'UV' and ob.type == 'MESH': - layout.prop_search(md, "uv_layer", ob.data, "uv_textures") + layout.prop_search(md, "uv_layer", ob.data, "uv_layers") def WAVE(self, layout, ob, md): split = layout.split() @@ -1089,7 +1088,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col.template_ID(md, "texture", new="texture.new") layout.prop(md, "texture_coords") if md.texture_coords == 'UV' and ob.type == 'MESH': - layout.prop_search(md, "uv_layer", ob.data, "uv_textures") + layout.prop_search(md, "uv_layer", ob.data, "uv_layers") elif md.texture_coords == 'OBJECT': layout.prop(md, "texture_coords_object") @@ -1156,7 +1155,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): if md.mask_tex_mapping == 'OBJECT': layout.prop(md, "mask_tex_map_object", text="Object") elif md.mask_tex_mapping == 'UV' and ob.type == 'MESH': - layout.prop_search(md, "mask_tex_uv_layer", ob.data, "uv_textures") + layout.prop_search(md, "mask_tex_uv_layer", ob.data, "uv_layers") def VERTEX_WEIGHT_EDIT(self, layout, ob, md): split = layout.split() @@ -1325,7 +1324,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col = split.column() col.label(text="UV Map:") - col.prop_search(md, "uv_layer", ob.data, "uv_textures", text="") + col.prop_search(md, "uv_layer", ob.data, "uv_layers", text="") def WIREFRAME(self, layout, ob, md): has_vgroup = bool(md.vertex_group) diff --git a/release/scripts/startup/bl_ui/properties_data_speaker.py b/release/scripts/startup/bl_ui/properties_data_speaker.py index eecb2690302..5ed9ce0478c 100644 --- a/release/scripts/startup/bl_ui/properties_data_speaker.py +++ b/release/scripts/startup/bl_ui/properties_data_speaker.py @@ -36,7 +36,7 @@ class DataButtonsPanel: class DATA_PT_context_speaker(DataButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -55,7 +55,7 @@ class DATA_PT_context_speaker(DataButtonsPanel, Panel): class DATA_PT_speaker(DataButtonsPanel, Panel): bl_label = "Sound" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -74,7 +74,7 @@ class DATA_PT_speaker(DataButtonsPanel, Panel): class DATA_PT_distance(DataButtonsPanel, Panel): bl_label = "Distance" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -97,7 +97,7 @@ class DATA_PT_distance(DataButtonsPanel, Panel): class DATA_PT_cone(DataButtonsPanel, Panel): bl_label = "Cone" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -117,7 +117,7 @@ class DATA_PT_cone(DataButtonsPanel, Panel): class DATA_PT_custom_props_speaker(DataButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _context_path = "object.data" _property_type = bpy.types.Speaker diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index 636a9707ab9..7f33041e338 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -422,10 +422,8 @@ class RENDER_PT_game_system(RenderButtonsPanel, Panel): col = row.column() col.prop(gs, "use_frame_rate") col.prop(gs, "use_restrict_animation_updates") - col.prop(gs, "use_material_caching") col = row.column() - col.prop(gs, "use_display_lists") - col.active = gs.raster_storage != 'VERTEX_BUFFER_OBJECT' + col.prop(gs, "use_material_caching") row = layout.row() row.prop(gs, "vsync") diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 73740df37e8..e7e92000723 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -21,7 +21,7 @@ import bpy from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel from bpy.app.translations import pgettext_iface as iface_ - +from bpy_extras.node_utils import find_node_input, find_output_node def active_node_mat(mat): # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate @@ -746,7 +746,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, Panel): col.prop(tan, "width_fade") ob = context.object if ob and ob.type == 'MESH': - col.prop_search(tan, "uv_layer", ob.data, "uv_textures", text="") + col.prop_search(tan, "uv_layer", ob.data, "uv_layers", text="") else: col.prop(tan, "uv_layer", text="") col.separator() @@ -795,11 +795,6 @@ class MATERIAL_PT_options(MaterialButtonsPanel, Panel): row.prop(mat, "use_light_group_local", text="Local") col = split.column() - col.prop(mat, "use_face_texture") - sub = col.column() - sub.active = mat.use_face_texture - sub.prop(mat, "use_face_texture_alpha") - col.separator() col.prop(mat, "use_vertex_color_paint") col.prop(mat, "use_vertex_color_light") col.prop(mat, "use_object_color") @@ -807,6 +802,9 @@ class MATERIAL_PT_options(MaterialButtonsPanel, Panel): if simple_material(base_mat): col.prop(mat, "pass_index") + col.label("Edit Image") + col.template_ID(mat, "edit_image") + class MATERIAL_PT_shadow(MaterialButtonsPanel, Panel): bl_label = "Shadow" @@ -1055,6 +1053,137 @@ class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, Panel): _property_type = bpy.types.Material +class EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel): + bl_label = "" + bl_context = "material" + bl_options = {'HIDE_HEADER'} + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + engine = context.scene.render.engine + return (context.material or context.object) and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + mat = context.material + ob = context.object + slot = context.material_slot + space = context.space_data + + if ob: + is_sortable = len(ob.material_slots) > 1 + rows = 1 + if (is_sortable): + rows = 4 + + row = layout.row() + + row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=rows) + + col = row.column(align=True) + col.operator("object.material_slot_add", icon='ZOOMIN', text="") + col.operator("object.material_slot_remove", icon='ZOOMOUT', text="") + + col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="") + + if is_sortable: + col.separator() + + col.operator("object.material_slot_move", icon='TRIA_UP', text="").direction = 'UP' + col.operator("object.material_slot_move", icon='TRIA_DOWN', text="").direction = 'DOWN' + + if ob.mode == 'EDIT': + row = layout.row(align=True) + row.operator("object.material_slot_assign", text="Assign") + row.operator("object.material_slot_select", text="Select") + row.operator("object.material_slot_deselect", text="Deselect") + + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "active_material", new="material.new") + row = split.row() + + if slot: + row.prop(slot, "link", text="") + else: + row.label() + elif mat: + split.template_ID(space, "pin_id") + split.separator() + + +def panel_node_draw(layout, ntree, output_type): + node = find_output_node(ntree, output_type) + + if node: + input = find_node_input(node, 'Surface') + layout.template_node_view(ntree, node, input) + return True + + return False + + +class EEVEE_MATERIAL_PT_surface(MaterialButtonsPanel, Panel): + bl_label = "Surface" + bl_context = "material" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + engine = context.scene.render.engine + return context.material and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + mat = context.material + + layout.prop(mat, "use_nodes", icon='NODETREE') + layout.separator() + + if mat.use_nodes: + if not panel_node_draw(layout, mat.node_tree, 'OUTPUT_EEVEE_MATERIAL'): + layout.label(text="No output node") + else: + raym = mat.raytrace_mirror + layout.prop(mat, "diffuse_color", text="Base Color") + layout.prop(raym, "reflect_factor", text="Metallic") + layout.prop(mat, "specular_intensity", text="Specular") + layout.prop(raym, "gloss_factor", text="Roughness") + + +class EEVEE_MATERIAL_PT_options(MaterialButtonsPanel, Panel): + bl_label = "Options" + bl_context = "material" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + engine = context.scene.render.engine + return context.material and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + mat = context.material + + layout.prop(mat, "blend_method") + + if mat.blend_method != "OPAQUE": + layout.prop(mat, "transparent_shadow_method") + + row = layout.row() + row.active = ((mat.blend_method == "CLIP") or (mat.transparent_shadow_method == "CLIP")) + layout.prop(mat, "alpha_threshold") + + if mat.blend_method not in {"OPAQUE", "CLIP", "HASHED"}: + layout.prop(mat, "transparent_hide_backside") + + + classes = ( MATERIAL_MT_sss_presets, MATERIAL_MT_specials, @@ -1083,6 +1212,9 @@ classes = ( MATERIAL_PT_volume_integration, MATERIAL_PT_volume_options, MATERIAL_PT_custom_props, + EEVEE_MATERIAL_PT_context_material, + EEVEE_MATERIAL_PT_surface, + EEVEE_MATERIAL_PT_options, ) if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 43c8300b558..0d8309268fb 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -40,7 +40,7 @@ class OBJECT_PT_context_object(ObjectButtonsPanel, Panel): layout.template_ID(space, "pin_id") else: row = layout.row() - row.template_ID(context.scene.objects, "active") + row.template_ID(context.render_layer.objects, "active") class OBJECT_PT_transform(ObjectButtonsPanel, Panel): @@ -362,7 +362,7 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit fr class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _context_path = "object" _property_type = bpy.types.Object diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index dfd20d90ec4..91f4239c067 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -96,8 +96,8 @@ class VIEW3D_MT_tools_projectpaint_clone(Menu): def draw(self, context): layout = self.layout - for i, tex in enumerate(context.active_object.data.uv_textures): - props = layout.operator("wm.context_set_int", text=tex.name, translate=False) + for i, uv_layer in enumerate(context.active_object.data.uv_layers): + props = layout.operator("wm.context_set_int", text=uv_layer.name, translate=False) props.data_path = "active_object.data.uv_texture_clone_index" props.value = i diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index 23e7c0a6787..c9012e46698 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -66,7 +66,7 @@ def particle_get_settings(context): class PARTICLE_MT_specials(Menu): bl_label = "Particle Specials" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -86,7 +86,7 @@ class PARTICLE_MT_hair_dynamics_presets(Menu): bl_label = "Hair Dynamics Presets" preset_subdir = "hair_dynamics" preset_operator = "script.execute_preset" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} draw = Menu.draw_preset @@ -131,7 +131,7 @@ class PARTICLE_UL_particle_systems(bpy.types.UIList): class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -238,7 +238,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel): class PARTICLE_PT_emission(ParticleButtonsPanel, Panel): bl_label = "Emission" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -314,7 +314,7 @@ class PARTICLE_PT_emission(ParticleButtonsPanel, Panel): class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel): bl_label = "Hair Dynamics" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -412,7 +412,7 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel): class PARTICLE_PT_cache(ParticleButtonsPanel, Panel): bl_label = "Cache" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -442,7 +442,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, Panel): class PARTICLE_PT_velocity(ParticleButtonsPanel, Panel): bl_label = "Velocity" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -493,7 +493,7 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel, Panel): class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel): bl_label = "Rotation" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -556,7 +556,7 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel): class PARTICLE_PT_physics(ParticleButtonsPanel, Panel): bl_label = "Physics" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -796,7 +796,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel): class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel): bl_label = "Boid Brain" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -899,7 +899,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel): class PARTICLE_PT_render(ParticleButtonsPanel, Panel): bl_label = "Render" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -1058,8 +1058,8 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel): if psys: col = layout.column() - col.prop_search(psys, "billboard_normal_uv", ob.data, "uv_textures") - col.prop_search(psys, "billboard_time_index_uv", ob.data, "uv_textures") + col.prop_search(psys, "billboard_normal_uv", ob.data, "uv_layers") + col.prop_search(psys, "billboard_time_index_uv", ob.data, "uv_layers") split = layout.split(percentage=0.33) split.label(text="Split UVs:") @@ -1068,7 +1068,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel): if psys: col = layout.column() col.active = part.billboard_uv_split > 1 - col.prop_search(psys, "billboard_split_uv", ob.data, "uv_textures") + col.prop_search(psys, "billboard_split_uv", ob.data, "uv_layers") row = col.row() row.label(text="Animate:") @@ -1098,7 +1098,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel): class PARTICLE_PT_draw(ParticleButtonsPanel, Panel): bl_label = "Display" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -1161,7 +1161,7 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, Panel): class PARTICLE_PT_children(ParticleButtonsPanel, Panel): bl_label = "Children" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -1290,7 +1290,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel, Panel): class PARTICLE_PT_field_weights(ParticleButtonsPanel, Panel): bl_label = "Field Weights" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -1311,7 +1311,7 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, Panel): class PARTICLE_PT_force_fields(ParticleButtonsPanel, Panel): bl_label = "Force Field Settings" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -1345,7 +1345,7 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel, Panel): class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel): bl_label = "Vertex Groups" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -1411,7 +1411,7 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel): class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _context_path = "particle_system.settings" _property_type = bpy.types.ParticleSettings diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index 0a7890670b2..6ada3c59942 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -64,6 +64,8 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel): split = layout.split(percentage=0.25) + col = split.column() + split.label(text="Presets:") sub = split.row(align=True) sub.menu("CLOTH_MT_presets", text=bpy.types.CLOTH_MT_presets.bl_label) diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index cf1d4f38038..538022a0fcf 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -276,7 +276,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel): # image format outputs if surface.surface_format == 'IMAGE': layout.operator("dpaint.bake", text="Bake Image Sequence", icon='MOD_DYNAMICPAINT') - layout.prop_search(surface, "uv_layer", ob.data, "uv_textures", text="UV Map") + layout.prop_search(surface, "uv_layer", ob.data, "uv_layers", text="UV Map") layout.separator() layout.prop(surface, "image_output_path", text="") @@ -337,7 +337,7 @@ class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, Panel): elif surface.init_color_type == 'TEXTURE': layout.prop(surface, "init_texture") - layout.prop_search(surface, "init_layername", ob.data, "uv_textures", text="UV Map") + layout.prop_search(surface, "init_layername", ob.data, "uv_layers", text="UV Map") elif surface.init_color_type == 'VERTEX_COLOR': layout.prop_search(surface, "init_layername", ob.data, "vertex_colors", text="Color Layer") diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py index 3fd47f0b8ca..bb15ba5e189 100644 --- a/release/scripts/startup/bl_ui/properties_physics_field.py +++ b/release/scripts/startup/bl_ui/properties_physics_field.py @@ -39,7 +39,7 @@ class PhysicButtonsPanel: class PHYSICS_PT_field(PhysicButtonsPanel, Panel): bl_label = "Force Fields" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -177,7 +177,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, Panel): class PHYSICS_PT_collision(PhysicButtonsPanel, Panel): bl_label = "Collision" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py index 4f0d3680834..bf070bf6acb 100644 --- a/release/scripts/startup/bl_ui/properties_physics_smoke.py +++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py @@ -158,7 +158,7 @@ class PHYSICS_PT_smoke_flow_advanced(PhysicButtonsPanel, Panel): sub.label(text="Mapping:") sub.prop(flow, "texture_map_type", expand=False, text="") if flow.texture_map_type == 'UV': - sub.prop_search(flow, "uv_layer", ob.data, "uv_textures", text="") + sub.prop_search(flow, "uv_layer", ob.data, "uv_layers", text="") if flow.texture_map_type == 'AUTO': sub.prop(flow, "texture_size") sub.prop(flow, "texture_offset") diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index a7e8d9273ad..f35b3a5f47d 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -79,7 +79,7 @@ class RENDER_PT_render(RenderButtonsPanel, Panel): class RENDER_PT_dimensions(RenderButtonsPanel, Panel): bl_label = "Dimensions" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} _frame_rate_args_prev = None _preset_class = None @@ -335,7 +335,7 @@ class RENDER_PT_post_processing(RenderButtonsPanel, Panel): class RENDER_PT_stamp(RenderButtonsPanel, Panel): bl_label = "Metadata" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -383,7 +383,7 @@ class RENDER_PT_stamp(RenderButtonsPanel, Panel): class RENDER_PT_output(RenderButtonsPanel, Panel): bl_label = "Output" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -584,6 +584,160 @@ class RENDER_PT_bake(RenderButtonsPanel, Panel): sub.prop(rd, "bake_user_scale", text="User Scale") +class RENDER_PT_clay_layer_settings(RenderButtonsPanel, Panel): + bl_label = "Clay Layer Settings" + COMPAT_ENGINES = {'BLENDER_CLAY'} + + def draw(self, context): + layout = self.layout + props = context.scene.layer_properties['BLENDER_CLAY'] + + col = layout.column() + col.prop(props, "ssao_samples") + + +class RENDER_PT_clay_collection_settings(RenderButtonsPanel, Panel): + bl_label = "Clay Collection Settings" + COMPAT_ENGINES = {'BLENDER_CLAY'} + + def draw(self, context): + layout = self.layout + props = context.scene.collection_properties['BLENDER_CLAY'] + + col = layout.column() + col.template_icon_view(props, "matcap_icon") + col.prop(props, "matcap_rotation") + col.prop(props, "matcap_hue") + col.prop(props, "matcap_saturation") + col.prop(props, "matcap_value") + col.prop(props, "ssao_factor_cavity") + col.prop(props, "ssao_factor_edge") + col.prop(props, "ssao_distance") + col.prop(props, "ssao_attenuation") + col.prop(props, "hair_brightness_randomness") + + +class RENDER_PT_eevee_poststack_settings(RenderButtonsPanel, Panel): + bl_label = "Post Process Stack" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + scene = context.scene + return scene and (scene.render.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + scene = context.scene + props = scene.layer_properties['BLENDER_EEVEE'] + + col = layout.column() + col.prop(props, "gtao_enable") + col.prop(props, "motion_blur_enable") + col.prop(props, "dof_enable") + col.prop(props, "bloom_enable") + + +class RENDER_PT_eevee_postprocess_settings(RenderButtonsPanel, Panel): + bl_label = "Post Process Settings" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + scene = context.scene + return scene and (scene.render.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + scene = context.scene + props = scene.layer_properties['BLENDER_EEVEE'] + + col = layout.column() + + col.label("Ambient Occlusion:") + col.prop(props, "gtao_use_bent_normals") + col.prop(props, "gtao_samples") + col.prop(props, "gtao_distance") + col.prop(props, "gtao_factor") + col.separator() + + col.label("Motion Blur:") + col.prop(props, "motion_blur_samples") + col.prop(props, "motion_blur_shutter") + col.separator() + + col.label("Depth of Field:") + col.prop(props, "bokeh_max_size") + col.prop(props, "bokeh_threshold") + col.separator() + + col.label("Bloom:") + col.prop(props, "bloom_threshold") + col.prop(props, "bloom_knee") + col.prop(props, "bloom_radius") + col.prop(props, "bloom_intensity") + + +class RENDER_PT_eevee_volumetric(RenderButtonsPanel, Panel): + bl_label = "Volumetric" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + scene = context.scene + return scene and (scene.render.engine in cls.COMPAT_ENGINES) + + def draw_header(self, context): + scene = context.scene + props = scene.layer_properties['BLENDER_EEVEE'] + self.layout.prop(props, "volumetric_enable", text="") + + def draw(self, context): + layout = self.layout + scene = context.scene + props = scene.layer_properties['BLENDER_EEVEE'] + + layout.active = props.volumetric_enable + col = layout.column() + col.prop(props, "volumetric_start") + col.prop(props, "volumetric_end") + col.prop(props, "volumetric_samples") + col.prop(props, "volumetric_sample_distribution") + col.prop(props, "volumetric_lights") + col.prop(props, "volumetric_light_clamp") + col.prop(props, "volumetric_shadows") + col.prop(props, "volumetric_shadow_samples") + col.prop(props, "volumetric_colored_transmittance") + + +class RENDER_PT_eevee_screen_space_reflections(RenderButtonsPanel, Panel): + bl_label = "Screen Space Reflections" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + scene = context.scene + return scene and (scene.render.engine in cls.COMPAT_ENGINES) + + def draw_header(self, context): + scene = context.scene + props = scene.layer_properties['BLENDER_EEVEE'] + self.layout.prop(props, "ssr_enable", text="") + + def draw(self, context): + layout = self.layout + scene = context.scene + props = scene.layer_properties['BLENDER_EEVEE'] + + col = layout.column() + col.prop(props, "ssr_halfres") + col.prop(props, "ssr_ray_count") + col.prop(props, "ssr_stride") + col.prop(props, "ssr_thickness") + col.prop(props, "ssr_border_fade") + col.prop(props, "ssr_firefly_fac") + + classes = ( RENDER_MT_presets, RENDER_MT_ffmpeg_presets, @@ -599,6 +753,12 @@ classes = ( RENDER_PT_output, RENDER_PT_encoding, RENDER_PT_bake, + RENDER_PT_clay_layer_settings, + RENDER_PT_clay_collection_settings, + RENDER_PT_eevee_volumetric, + RENDER_PT_eevee_screen_space_reflections, + RENDER_PT_eevee_poststack_settings, + RENDER_PT_eevee_postprocess_settings, ) if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/properties_render_layer.py b/release/scripts/startup/bl_ui/properties_render_layer.py index 084bc387822..5aeb117c071 100644 --- a/release/scripts/startup/bl_ui/properties_render_layer.py +++ b/release/scripts/startup/bl_ui/properties_render_layer.py @@ -35,7 +35,7 @@ class RenderLayerButtonsPanel: class RENDERLAYER_UL_renderlayers(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): - # assert(isinstance(item, bpy.types.SceneRenderLayer) + # assert(isinstance(item, bpy.types.SceneLayer) layer = item if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.prop(layer, "name", text="", icon_value=icon, emboss=False) @@ -48,7 +48,7 @@ class RENDERLAYER_UL_renderlayers(UIList): class RENDERLAYER_PT_layers(RenderLayerButtonsPanel, Panel): bl_label = "Layer List" bl_options = {'HIDE_HEADER'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -62,7 +62,7 @@ class RENDERLAYER_PT_layers(RenderLayerButtonsPanel, Panel): row = layout.row() col = row.column() - col.template_list("RENDERLAYER_UL_renderlayers", "", rd, "layers", rd.layers, "active_index", rows=2) + col.template_list("RENDERLAYER_UL_renderlayers", "", scene, "render_layers", scene.render_layers, "active_index", rows=2) col = row.column() sub = col.column(align=True) @@ -71,103 +71,6 @@ class RENDERLAYER_PT_layers(RenderLayerButtonsPanel, Panel): col.prop(rd, "use_single_layer", icon_only=True) -class RENDERLAYER_PT_layer_options(RenderLayerButtonsPanel, Panel): - bl_label = "Layer" - COMPAT_ENGINES = {'BLENDER_RENDER'} - - def draw(self, context): - layout = self.layout - - scene = context.scene - rd = scene.render - rl = rd.layers.active - - split = layout.split() - - col = split.column() - col.prop(scene, "layers", text="Scene") - col.label(text="") - col.prop(rl, "light_override", text="Lights") - col.prop(rl, "material_override", text="Material") - - col = split.column() - col.prop(rl, "layers", text="Layer") - col.prop(rl, "layers_zmask", text="Mask Layer") - - layout.separator() - layout.label(text="Include:") - - split = layout.split() - - col = split.column() - col.prop(rl, "use_zmask") - row = col.row() - row.prop(rl, "invert_zmask", text="Negate") - row.active = rl.use_zmask - col.prop(rl, "use_all_z") - - col = split.column() - col.prop(rl, "use_solid") - col.prop(rl, "use_halo") - col.prop(rl, "use_ztransp") - - col = split.column() - col.prop(rl, "use_sky") - col.prop(rl, "use_edge_enhance") - col.prop(rl, "use_strand") - if bpy.app.build_options.freestyle: - row = col.row() - row.prop(rl, "use_freestyle") - row.active = rd.use_freestyle - - -class RENDERLAYER_PT_layer_passes(RenderLayerButtonsPanel, Panel): - bl_label = "Passes" - bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} - - @staticmethod - def draw_pass_type_buttons(box, rl, pass_type): - # property names - use_pass_type = "use_pass_" + pass_type - exclude_pass_type = "exclude_" + pass_type - # draw pass type buttons - row = box.row() - row.prop(rl, use_pass_type) - row.prop(rl, exclude_pass_type, text="") - - def draw(self, context): - layout = self.layout - - scene = context.scene - rd = scene.render - rl = rd.layers.active - - split = layout.split() - - col = split.column() - col.prop(rl, "use_pass_combined") - col.prop(rl, "use_pass_z") - col.prop(rl, "use_pass_vector") - col.prop(rl, "use_pass_normal") - col.prop(rl, "use_pass_uv") - col.prop(rl, "use_pass_mist") - col.prop(rl, "use_pass_object_index") - col.prop(rl, "use_pass_material_index") - col.prop(rl, "use_pass_color") - - col = split.column() - col.prop(rl, "use_pass_diffuse") - self.draw_pass_type_buttons(col, rl, "specular") - self.draw_pass_type_buttons(col, rl, "shadow") - self.draw_pass_type_buttons(col, rl, "emit") - self.draw_pass_type_buttons(col, rl, "ambient_occlusion") - self.draw_pass_type_buttons(col, rl, "environment") - self.draw_pass_type_buttons(col, rl, "indirect") - self.draw_pass_type_buttons(col, rl, "reflection") - self.draw_pass_type_buttons(col, rl, "refraction") - - class RENDERLAYER_UL_renderviews(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.SceneRenderView) @@ -186,7 +89,7 @@ class RENDERLAYER_UL_renderviews(UIList): class RENDERLAYER_PT_views(RenderLayerButtonsPanel, Panel): bl_label = "Views" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} bl_options = {'DEFAULT_CLOSED'} def draw_header(self, context): @@ -227,13 +130,169 @@ class RENDERLAYER_PT_views(RenderLayerButtonsPanel, Panel): row.prop(rv, "camera_suffix", text="") +class RENDERLAYER_PT_clay_settings(RenderLayerButtonsPanel, Panel): + bl_label = "Render Settings" + COMPAT_ENGINES = {'BLENDER_CLAY'} + + @classmethod + def poll(cls, context): + scene = context.scene + return scene and (scene.render.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + scene = context.scene + scene_props = scene.layer_properties['BLENDER_CLAY'] + layer = bpy.context.render_layer + layer_props = layer.engine_overrides['BLENDER_CLAY'] + + col = layout.column() + col.template_override_property(layer_props, scene_props, "ssao_samples") + + +class RENDERLAYER_PT_eevee_poststack_settings(RenderLayerButtonsPanel, Panel): + bl_label = "Post Process Stack" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + scene = context.scene + return scene and (scene.render.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + scene = context.scene + scene_props = scene.layer_properties['BLENDER_EEVEE'] + layer = bpy.context.render_layer + layer_props = layer.engine_overrides['BLENDER_EEVEE'] + + col = layout.column() + col.template_override_property(layer_props, scene_props, "gtao_enable") + col.template_override_property(layer_props, scene_props, "motion_blur_enable") + col.template_override_property(layer_props, scene_props, "dof_enable") + col.template_override_property(layer_props, scene_props, "bloom_enable") + + +class RENDERLAYER_PT_eevee_postprocess_settings(RenderLayerButtonsPanel, Panel): + bl_label = "Post Process Settings" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + scene = context.scene + return scene and (scene.render.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + scene = context.scene + scene_props = scene.layer_properties['BLENDER_EEVEE'] + layer = bpy.context.render_layer + layer_props = layer.engine_overrides['BLENDER_EEVEE'] + + col = layout.column() + col.label("Ambient Occlusion:") + col.template_override_property(layer_props, scene_props, "gtao_use_bent_normals") + col.template_override_property(layer_props, scene_props, "gtao_samples") + col.template_override_property(layer_props, scene_props, "gtao_distance") + col.template_override_property(layer_props, scene_props, "gtao_factor") + col.separator() + + col.label("Motion Blur:") + col.template_override_property(layer_props, scene_props, "motion_blur_samples") + col.template_override_property(layer_props, scene_props, "motion_blur_shutter") + col.separator() + + col.label("Depth of Field:") + col.template_override_property(layer_props, scene_props, "bokeh_max_size") + col.template_override_property(layer_props, scene_props, "bokeh_threshold") + col.separator() + + col.label("Bloom:") + col.template_override_property(layer_props, scene_props, "bloom_threshold") + col.template_override_property(layer_props, scene_props, "bloom_knee") + col.template_override_property(layer_props, scene_props, "bloom_radius") + col.template_override_property(layer_props, scene_props, "bloom_intensity") + + +class RENDERLAYER_PT_eevee_volumetric(RenderLayerButtonsPanel, Panel): + bl_label = "Volumetric" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + scene = context.scene + return scene and (scene.render.engine in cls.COMPAT_ENGINES) + + def draw_header(self, context): + scene = context.scene + scene_props = scene.layer_properties['BLENDER_EEVEE'] + layer = bpy.context.render_layer + layer_props = layer.engine_overrides['BLENDER_EEVEE'] + + self.layout.template_override_property(layer_props, scene_props, "volumetric_enable", text="") + + def draw(self, context): + layout = self.layout + scene = context.scene + scene_props = scene.layer_properties['BLENDER_EEVEE'] + layer = bpy.context.render_layer + layer_props = layer.engine_overrides['BLENDER_EEVEE'] + + col = layout.column() + col.template_override_property(layer_props, scene_props, "volumetric_start") + col.template_override_property(layer_props, scene_props, "volumetric_end") + col.template_override_property(layer_props, scene_props, "volumetric_samples") + col.template_override_property(layer_props, scene_props, "volumetric_sample_distribution") + col.template_override_property(layer_props, scene_props, "volumetric_lights") + col.template_override_property(layer_props, scene_props, "volumetric_light_clamp") + col.template_override_property(layer_props, scene_props, "volumetric_shadows") + col.template_override_property(layer_props, scene_props, "volumetric_shadow_samples") + col.template_override_property(layer_props, scene_props, "volumetric_colored_transmittance") + + +class RENDERLAYER_PT_eevee_screen_space_reflections(RenderLayerButtonsPanel, Panel): + bl_label = "Screen Space Reflections" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + scene = context.scene + return scene and (scene.render.engine in cls.COMPAT_ENGINES) + + def draw_header(self, context): + scene = context.scene + scene_props = scene.layer_properties['BLENDER_EEVEE'] + layer = bpy.context.render_layer + layer_props = layer.engine_overrides['BLENDER_EEVEE'] + + self.layout.template_override_property(layer_props, scene_props, "ssr_enable", text="") + + def draw(self, context): + layout = self.layout + scene = context.scene + scene_props = scene.layer_properties['BLENDER_EEVEE'] + layer = bpy.context.render_layer + layer_props = layer.engine_overrides['BLENDER_EEVEE'] + + col = layout.column() + col.template_override_property(layer_props, scene_props, "ssr_halfres") + col.template_override_property(layer_props, scene_props, "ssr_ray_count") + col.template_override_property(layer_props, scene_props, "ssr_stride") + col.template_override_property(layer_props, scene_props, "ssr_thickness") + col.template_override_property(layer_props, scene_props, "ssr_border_fade") + col.template_override_property(layer_props, scene_props, "ssr_firefly_fac") + + classes = ( RENDERLAYER_UL_renderlayers, RENDERLAYER_PT_layers, - RENDERLAYER_PT_layer_options, - RENDERLAYER_PT_layer_passes, RENDERLAYER_UL_renderviews, RENDERLAYER_PT_views, + RENDERLAYER_PT_clay_settings, + RENDERLAYER_PT_eevee_poststack_settings, + RENDERLAYER_PT_eevee_postprocess_settings, + RENDERLAYER_PT_eevee_screen_space_reflections, + RENDERLAYER_PT_eevee_volumetric, ) if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index fb93c0b56f2..8c65ed2b78a 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -66,7 +66,7 @@ class SceneButtonsPanel: class SCENE_PT_scene(SceneButtonsPanel, Panel): bl_label = "Scene" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -81,7 +81,7 @@ class SCENE_PT_scene(SceneButtonsPanel, Panel): class SCENE_PT_unit(SceneButtonsPanel, Panel): bl_label = "Units" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -166,7 +166,7 @@ class SceneKeyingSetsPanel: class SCENE_PT_keying_sets(SceneButtonsPanel, SceneKeyingSetsPanel, Panel): bl_label = "Keying Sets" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -199,7 +199,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, SceneKeyingSetsPanel, Panel): class SCENE_PT_keying_set_paths(SceneButtonsPanel, SceneKeyingSetsPanel, Panel): bl_label = "Active Keying Set" - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -256,7 +256,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, SceneKeyingSetsPanel, Panel): class SCENE_PT_color_management(SceneButtonsPanel, Panel): bl_label = "Color Management" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -281,7 +281,7 @@ class SCENE_PT_color_management(SceneButtonsPanel, Panel): class SCENE_PT_audio(SceneButtonsPanel, Panel): bl_label = "Audio" bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): layout = self.layout @@ -409,7 +409,7 @@ class SCENE_PT_rigid_body_field_weights(SceneButtonsPanel, Panel): class SCENE_PT_simplify(SceneButtonsPanel, Panel): bl_label = "Simplify" - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw_header(self, context): rd = context.scene.render @@ -439,7 +439,7 @@ class SCENE_PT_simplify(SceneButtonsPanel, Panel): class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'} _context_path = "scene" _property_type = bpy.types.Scene diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 880684997bf..d309b909f92 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -459,7 +459,7 @@ def texture_filter_common(tex, layout): layout.prop(tex, "filter_type", text="") if tex.use_mipmap and tex.filter_type in {'AREA', 'EWA', 'FELINE'}: if tex.filter_type == 'FELINE': - layout.prop(tex, "filter_probes", text="Probes") + layout.prop(tex, "filter_lightprobes", text="Light Probes") else: layout.prop(tex, "filter_eccentricity", text="Eccentricity") @@ -963,7 +963,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel): split.label(text="Map:") ob = context.object if ob and ob.type == 'MESH': - split.prop_search(tex, "uv_layer", ob.data, "uv_textures", text="") + split.prop_search(tex, "uv_layer", ob.data, "uv_layers", text="") else: split.prop(tex, "uv_layer", text="") diff --git a/release/scripts/startup/bl_ui/properties_world.py b/release/scripts/startup/bl_ui/properties_world.py index 107c31567b3..fc5835d23d0 100644 --- a/release/scripts/startup/bl_ui/properties_world.py +++ b/release/scripts/startup/bl_ui/properties_world.py @@ -20,6 +20,7 @@ import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel +from bpy_extras.node_utils import find_node_input, find_output_node class WorldButtonsPanel: @@ -36,7 +37,7 @@ class WorldButtonsPanel: class WORLD_PT_context_world(WorldButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} - COMPAT_ENGINES = {'BLENDER_RENDER'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} @classmethod def poll(cls, context): @@ -244,11 +245,42 @@ class WORLD_PT_mist(WorldButtonsPanel, Panel): class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_EEVEE'} _context_path = "world" _property_type = bpy.types.World +class EEVEE_WORLD_PT_surface(WorldButtonsPanel, Panel): + bl_label = "Surface" + bl_context = "world" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + engine = context.scene.render.engine + return context.world and (engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + world = context.world + + layout.prop(world, "use_nodes", icon='NODETREE') + layout.separator() + + if world.use_nodes: + ntree = world.node_tree + node = find_output_node(ntree, 'OUTPUT_WORLD') + + if not node: + layout.label(text="No output node") + else: + input = find_node_input(node, 'Surface') + layout.template_node_view(ntree, node, input) + else: + layout.prop(world, "horizon_color", text="Color") + + classes = ( WORLD_PT_context_world, WORLD_PT_preview, @@ -259,6 +291,7 @@ classes = ( WORLD_PT_gather, WORLD_PT_mist, WORLD_PT_custom_props, + EEVEE_WORLD_PT_surface, ) if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index f070161f3da..eeb32a32066 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -481,7 +481,7 @@ class IMAGE_HT_header(Header): row.prop(toolsettings, "snap_target", text="") mesh = context.edit_object.data - layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="") + layout.prop_search(mesh.uv_layers, "active", mesh, "uv_layers", text="") if ima: if ima.is_stereo_3d: diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index a7b518dfd2e..f05808c7a2c 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -28,7 +28,10 @@ class INFO_HT_header(Header): layout = self.layout window = context.window + workspace = context.workspace + screen = context.screen scene = context.scene + layer = context.render_layer rd = scene.render row = layout.row(align=True) @@ -36,15 +39,27 @@ class INFO_HT_header(Header): INFO_MT_editor_menus.draw_collapsible(context, layout) - if window.screen.show_fullscreen: + layout.separator() + + if screen.show_fullscreen: layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous") layout.separator() else: - layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete") - layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete") + layout.template_ID(window, "workspace", new="workspace.workspace_add_menu", unlink="workspace.workspace_delete") + layout.template_search_preview(window, "screen", workspace, "screens", new="screen.new", unlink="screen.delete", rows=2, cols=6) + + if hasattr(workspace, 'object_mode'): + act_mode_item = bpy.types.Object.bl_rna.properties['mode'].enum_items[workspace.object_mode] + else: + act_mode_item = bpy.types.Object.bl_rna.properties['mode'].enum_items[layer.objects.active.mode] + layout.operator_menu_enum("object.mode_set", "mode", text=act_mode_item.name, icon=act_mode_item.icon) + + layout.template_search(workspace, "render_layer", scene, "render_layers") layout.separator() + layout.template_ID(window, "scene", new="scene.new", unlink="scene.delete") + if rd.has_multiple_engines: layout.prop(rd, "engine", text="") @@ -69,7 +84,7 @@ class INFO_HT_header(Header): return row.operator("wm.splash", text="", icon='BLENDER', emboss=False) - row.label(text=scene.statistics(), translate=False) + row.label(text=scene.statistics(context.render_layer), translate=False) class INFO_MT_editor_menus(Menu): @@ -293,7 +308,7 @@ class INFO_MT_window(Menu): layout = self.layout - layout.operator("wm.window_duplicate") + layout.operator("wm.window_new") layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER') layout.separator() diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index b37b3c5705a..2021a69059b 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -395,8 +395,7 @@ class NODE_PT_backdrop(Panel): col = layout.column(align=True) col.label(text="Offset:") - col.prop(snode, "backdrop_x", text="X") - col.prop(snode, "backdrop_y", text="Y") + col.prop(snode, "backdrop_offset", text="") col.operator("node.backimage_move", text="Move") layout.operator("node.backimage_fit", text="Fit") diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index 4eb550bbb35..054a955ab9c 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -60,6 +60,16 @@ class OUTLINER_HT_header(Header): elif space.display_mode == 'ORPHAN_DATA': layout.operator("outliner.orphans_purge") + elif space.display_mode in {'ACT_LAYER', 'MASTER_COLLECTION'}: + row = layout.row(align=True) + + row.operator("outliner.collection_new", text="", icon='NEW') + if space.display_mode == 'ACT_LAYER': + row.operator("outliner.collection_override_new", text="", icon='LINK_AREA') + row.operator("outliner.collection_link", text="", icon='LINKED') + row.operator("outliner.collection_unlink", text="", icon='UNLINKED') + row.operator("outliner.collections_delete", text="", icon='X') + class OUTLINER_MT_editor_menus(Menu): bl_idname = "OUTLINER_MT_editor_menus" @@ -88,7 +98,8 @@ class OUTLINER_MT_view(Menu): space = context.space_data if space.display_mode not in {'DATABLOCKS', 'USER_PREFERENCES', 'KEYMAPS'}: - layout.prop(space, "use_sort_alpha") + if space.display_mode not in {'ACT_LAYER', 'MASTER_COLLECTION'}: + layout.prop(space, "use_sort_alpha") layout.prop(space, "show_restrict_columns") layout.separator() layout.operator("outliner.show_active") diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 117b59d6d2f..7a777194d83 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -57,7 +57,9 @@ class USERPREF_HT_header(Header): layout.operator_context = 'INVOKE_DEFAULT' - if userpref.active_section == 'INPUT': + if userpref.active_section == 'INTERFACE': + layout.operator("wm.save_workspace_file") + elif userpref.active_section == 'INPUT': layout.operator("wm.keyconfig_import") layout.operator("wm.keyconfig_export") elif userpref.active_section == 'ADDONS': @@ -224,7 +226,6 @@ class USERPREF_PT_interface(Panel): col.prop(view, "show_large_cursors") col.prop(view, "show_view_name", text="View Name") col.prop(view, "show_playback_fps", text="Playback FPS") - col.prop(view, "use_global_scene") col.prop(view, "object_origin_size") col.separator() @@ -285,11 +286,11 @@ class USERPREF_PT_interface(Panel): #col.prop(view, "open_left_mouse_delay", text="Hold LMB") #col.prop(view, "open_right_mouse_delay", text="Hold RMB") col.prop(view, "show_manipulator") + ## Currently not working + # col.prop(view, "show_manipulator_shaded") sub = col.column() sub.active = view.show_manipulator sub.prop(view, "manipulator_size", text="Size") - sub.prop(view, "manipulator_handle_size", text="Handle Size") - sub.prop(view, "manipulator_hotspot", text="Hotspot") col.separator() col.separator() diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 02c0f69ac82..28b9180bfa9 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -635,7 +635,6 @@ class VIEW3D_MT_select_object(Menu): layout.operator("object.select_all", text="Inverse").action = 'INVERT' layout.operator("object.select_random", text="Random") layout.operator("object.select_mirror", text="Mirror") - layout.operator("object.select_by_layer", text="Select All by Layer") layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...") layout.operator("object.select_camera", text="Select Camera") @@ -1206,6 +1205,17 @@ class INFO_MT_lamp_add(Menu): layout.operator_enum("object.lamp_add", "type") +class INFO_MT_lightprobe_add(Menu): + bl_idname = "INFO_MT_lightprobe_add" + bl_label = "Light Probe" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator_enum("object.lightprobe_add", "type") + + class INFO_MT_camera_add(Menu): bl_idname = "INFO_MT_camera_add" bl_label = "Camera" @@ -1254,6 +1264,8 @@ class INFO_MT_add(Menu): layout.menu("INFO_MT_lamp_add", icon='OUTLINER_OB_LAMP') layout.separator() + layout.menu("INFO_MT_lightprobe_add") + layout.separator() layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_FORCE_FIELD') layout.separator() @@ -1327,15 +1339,6 @@ class VIEW3D_MT_object(Menu): layout.separator() - if is_local_view: - layout.operator_context = 'EXEC_REGION_WIN' - layout.operator("object.move_to_layer", text="Move out of Local View") - layout.operator_context = 'INVOKE_REGION_WIN' - else: - layout.operator("object.move_to_layer", text="Move to Layer...") - - layout.menu("VIEW3D_MT_object_showhide") - layout.operator_menu_enum("object.convert", "target") @@ -1614,17 +1617,6 @@ class VIEW3D_MT_object_quick_effects(Menu): layout.operator("object.quick_fluid") -class VIEW3D_MT_object_showhide(Menu): - bl_label = "Show/Hide" - - def draw(self, context): - layout = self.layout - - layout.operator("object.hide_view_clear", text="Show Hidden") - layout.operator("object.hide_view_set", text="Hide Selected").unselected = False - layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True - - class VIEW3D_MT_make_single_user(Menu): bl_label = "Make Single User" @@ -3149,7 +3141,6 @@ class VIEW3D_MT_edit_gpencil_interpolate(Menu): # ********** Panel ********** - class VIEW3D_PT_grease_pencil(GreasePencilDataPanel, Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' @@ -3275,6 +3266,9 @@ class VIEW3D_PT_view3d_display(Panel): col.prop(view, "show_only_render") col.prop(view, "show_world") + if context.mode in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}: + col.prop(view, "show_mode_shade_override") + col = layout.column() display_all = not view.show_only_render col.active = display_all @@ -3358,56 +3352,6 @@ class VIEW3D_PT_view3d_stereo(Panel): split.prop(view, "stereo_3d_volume_alpha", text="Alpha") -class VIEW3D_PT_view3d_shading(Panel): - bl_space_type = 'VIEW_3D' - bl_region_type = 'UI' - bl_label = "Shading" - - def draw(self, context): - layout = self.layout - - view = context.space_data - scene = context.scene - gs = scene.game_settings - obj = context.object - - col = layout.column() - - if not scene.render.use_shading_nodes: - col.prop(gs, "material_mode", text="") - - if view.viewport_shade == 'SOLID': - col.prop(view, "show_textured_solid") - col.prop(view, "use_matcap") - if view.use_matcap: - col.template_icon_view(view, "matcap_icon") - if view.viewport_shade == 'TEXTURED' or context.mode == 'PAINT_TEXTURE': - if scene.render.use_shading_nodes or gs.material_mode != 'GLSL': - col.prop(view, "show_textured_shadeless") - - col.prop(view, "show_backface_culling") - - if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}: - if obj and obj.mode == 'EDIT': - col.prop(view, "show_occlude_wire") - - fx_settings = view.fx_settings - - if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}: - sub = col.column() - sub.active = view.region_3d.view_perspective == 'CAMERA' - sub.prop(fx_settings, "use_dof") - col.prop(fx_settings, "use_ssao", text="Ambient Occlusion") - if fx_settings.use_ssao: - ssao_settings = fx_settings.ssao - subcol = col.column(align=True) - subcol.prop(ssao_settings, "factor") - subcol.prop(ssao_settings, "distance_max") - subcol.prop(ssao_settings, "attenuation") - subcol.prop(ssao_settings, "samples") - subcol.prop(ssao_settings, "color") - - class VIEW3D_PT_view3d_motion_tracking(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' @@ -3847,6 +3791,7 @@ classes = ( INFO_MT_edit_armature_add, INFO_MT_armature_add, INFO_MT_lamp_add, + INFO_MT_lightprobe_add, INFO_MT_camera_add, INFO_MT_add, VIEW3D_MT_object, @@ -3859,7 +3804,6 @@ classes = ( VIEW3D_MT_object_group, VIEW3D_MT_object_constraints, VIEW3D_MT_object_quick_effects, - VIEW3D_MT_object_showhide, VIEW3D_MT_make_single_user, VIEW3D_MT_make_links, VIEW3D_MT_object_game, @@ -3927,7 +3871,6 @@ classes = ( VIEW3D_PT_view3d_name, VIEW3D_PT_view3d_display, VIEW3D_PT_view3d_stereo, - VIEW3D_PT_view3d_shading, VIEW3D_PT_view3d_motion_tracking, VIEW3D_PT_view3d_meshdisplay, VIEW3D_PT_view3d_meshstatvis, diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 4026bc972fe..580fc03f01f 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1176,9 +1176,9 @@ class VIEW3D_MT_tools_projectpaint_uvlayer(Menu): def draw(self, context): layout = self.layout - for i, tex in enumerate(context.active_object.data.uv_textures): - props = layout.operator("wm.context_set_int", text=tex.name, translate=False) - props.data_path = "active_object.data.uv_textures.active_index" + for i, uv_layer in enumerate(context.active_object.data.uv_layers): + props = layout.operator("wm.context_set_int", text=uv_layer.name, translate=False) + props.data_path = "active_object.data.uv_layers.active_index" props.value = i @@ -1236,11 +1236,11 @@ class VIEW3D_PT_slots_projectpaint(View3DPanel, Panel): if slot and slot.index != -1: col.label("UV Map:") - col.prop_search(slot, "uv_layer", ob.data, "uv_textures", text="") + col.prop_search(slot, "uv_layer", ob.data, "uv_layers", text="") elif settings.mode == 'IMAGE': mesh = ob.data - uv_text = mesh.uv_textures.active.name if mesh.uv_textures.active else "" + uv_text = mesh.uv_layers.active.name if mesh.uv_layers.active else "" col.label("Canvas Image:") # todo this should be combinded into a single row col.template_ID(settings, "canvas", open="image.open") @@ -1278,8 +1278,8 @@ class VIEW3D_PT_stencil_projectpaint(View3DPanel, Panel): col = layout.column() col.active = ipaint.use_stencil_layer - stencil_text = mesh.uv_texture_stencil.name if mesh.uv_texture_stencil else "" - col.label("UV Map:") + stencil_text = mesh.uv_layer_stencil.name if mesh.uv_layer_stencil else "" + col.label("UV Map") col.menu("VIEW3D_MT_tools_projectpaint_stencil", text=stencil_text, translate=False) col.label("Stencil Image:") @@ -1880,9 +1880,9 @@ class VIEW3D_MT_tools_projectpaint_stencil(Menu): def draw(self, context): layout = self.layout - for i, tex in enumerate(context.active_object.data.uv_textures): - props = layout.operator("wm.context_set_int", text=tex.name, translate=False) - props.data_path = "active_object.data.uv_texture_stencil_index" + for i, uv_layer in enumerate(context.active_object.data.uv_layers): + props = layout.operator("wm.context_set_int", text=uv_layer.name, translate=False) + props.data_path = "active_object.data.uv_layer_stencil_index" props.value = i diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py index bee6ae80590..6f226e8cf87 100644 --- a/release/scripts/startup/nodeitems_builtins.py +++ b/release/scripts/startup/nodeitems_builtins.py @@ -141,6 +141,41 @@ def object_shader_nodes_poll(context): snode.shader_type == 'OBJECT') +def cycles_shader_nodes_poll(context): + return context.scene.render.engine == 'CYCLES' + + +def eevee_shader_nodes_poll(context): + return context.scene.render.engine == 'BLENDER_EEVEE' + + +def eevee_cycles_shader_nodes_poll(context): + return (cycles_shader_nodes_poll(context) or + eevee_shader_nodes_poll(context)) + + +def object_cycles_shader_nodes_poll(context): + return (object_shader_nodes_poll(context) and + cycles_shader_nodes_poll(context)) + + +def object_eevee_shader_nodes_poll(context): + return (object_shader_nodes_poll(context) and + eevee_shader_nodes_poll(context)) + + +def object_eevee_cycles_shader_nodes_poll(context): + return (object_shader_nodes_poll(context) and + eevee_cycles_shader_nodes_poll(context)) + + +# Until volume shader on objects are supported in eevee. +def volume_shader_nodes_poll(context): + return (cycles_shader_nodes_poll(context) or + (eevee_shader_nodes_poll(context) and + world_shader_nodes_poll(context))) + + # All standard node categories currently used in nodes. shader_node_categories = [ @@ -216,33 +251,36 @@ shader_node_categories = [ NodeItem("NodeGroupInput", poll=group_input_output_item_poll), ]), ShaderNewNodeCategory("SH_NEW_OUTPUT", "Output", items=[ - NodeItem("ShaderNodeOutputMaterial", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeOutputLamp", poll=object_shader_nodes_poll), + NodeItem("ShaderNodeOutputMaterial", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeOutputEeveeMaterial", poll=object_eevee_shader_nodes_poll), + NodeItem("ShaderNodeOutputLamp", poll=object_cycles_shader_nodes_poll), NodeItem("ShaderNodeOutputWorld", poll=world_shader_nodes_poll), NodeItem("ShaderNodeOutputLineStyle", poll=line_style_shader_nodes_poll), NodeItem("NodeGroupOutput", poll=group_input_output_item_poll), ]), ShaderNewNodeCategory("SH_NEW_SHADER", "Shader", items=[ - NodeItem("ShaderNodeMixShader"), - NodeItem("ShaderNodeAddShader"), - NodeItem("ShaderNodeBsdfDiffuse", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeBsdfPrincipled", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeBsdfGlossy", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeBsdfTransparent", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeBsdfRefraction", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeBsdfGlass", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeBsdfTranslucent", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeBsdfAnisotropic", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeBsdfVelvet", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeBsdfToon", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeSubsurfaceScattering", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeEmission", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeBsdfHair", poll=object_shader_nodes_poll), + NodeItem("ShaderNodeMixShader", poll=eevee_cycles_shader_nodes_poll), + NodeItem("ShaderNodeAddShader", poll=eevee_cycles_shader_nodes_poll), + NodeItem("ShaderNodeBsdfDiffuse", poll=object_eevee_cycles_shader_nodes_poll), + NodeItem("ShaderNodeBsdfPrincipled", poll=object_eevee_cycles_shader_nodes_poll), + NodeItem("ShaderNodeBsdfGlossy", poll=object_eevee_cycles_shader_nodes_poll), + NodeItem("ShaderNodeBsdfTransparent", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeBsdfRefraction", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeBsdfGlass", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeBsdfTranslucent", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeBsdfAnisotropic", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeBsdfVelvet", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeBsdfToon", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeSubsurfaceScattering", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeEmission", poll=object_eevee_cycles_shader_nodes_poll), + NodeItem("ShaderNodeBsdfHair", poll=object_cycles_shader_nodes_poll), NodeItem("ShaderNodeBackground", poll=world_shader_nodes_poll), - NodeItem("ShaderNodeAmbientOcclusion", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeHoldout", poll=object_shader_nodes_poll), - NodeItem("ShaderNodeVolumeAbsorption"), - NodeItem("ShaderNodeVolumeScatter"), + NodeItem("ShaderNodeAmbientOcclusion", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeHoldout", poll=object_cycles_shader_nodes_poll), + NodeItem("ShaderNodeVolumeAbsorption", poll=volume_shader_nodes_poll), + NodeItem("ShaderNodeVolumeScatter", poll=volume_shader_nodes_poll), + NodeItem("ShaderNodeEeveeMetallic", poll=object_eevee_shader_nodes_poll), + NodeItem("ShaderNodeEeveeSpecular", poll=object_eevee_shader_nodes_poll), ]), ShaderNewNodeCategory("SH_NEW_TEXTURE", "Texture", items=[ NodeItem("ShaderNodeTexImage"), diff --git a/release/scripts/templates_py/batch_export.py b/release/scripts/templates_py/batch_export.py index 6c77c5d6a1a..8de7a5e2903 100644 --- a/release/scripts/templates_py/batch_export.py +++ b/release/scripts/templates_py/batch_export.py @@ -18,7 +18,7 @@ bpy.ops.object.select_all(action='DESELECT') for obj in selection: - obj.select = True + obj.select_set(action='SELECT') # some exporters only use the active object scene.objects.active = obj @@ -31,7 +31,7 @@ for obj in selection: ## Can be used for multiple formats # bpy.ops.export_scene.x3d(filepath=fn + ".x3d", use_selection=True) - obj.select = False + obj.select_set(action='DESELECT') print("written:", fn) @@ -39,4 +39,4 @@ for obj in selection: scene.objects.active = obj_active for obj in selection: - obj.select = True + obj.select_set(action='SELECT') diff --git a/release/scripts/templates_py/manipulator_operator.py b/release/scripts/templates_py/manipulator_operator.py new file mode 100644 index 00000000000..00b24736b8e --- /dev/null +++ b/release/scripts/templates_py/manipulator_operator.py @@ -0,0 +1,231 @@ +# Example of an operator which uses manipulators to control its properties. +# +# Usage: Run this script, then in mesh edit-mode press Spacebar +# to activate the operator "Select Side of Plane" +# The manipulators can then be used to adjust the plane in the 3D view. +# +import bpy +import bmesh + +from bpy.types import ( + Operator, + ManipulatorGroup, +) + +from bpy.props import ( + FloatVectorProperty, +) + +def main(context, plane_co, plane_no): + obj = context.active_object + matrix = obj.matrix_world.copy() + me = obj.data + bm = bmesh.from_edit_mesh(me) + + plane_dot = plane_no.dot(plane_co) + + for v in bm.verts: + co = matrix * v.co + v.select = (plane_no.dot(co) > plane_dot) + bm.select_flush_mode() + + bmesh.update_edit_mesh(me) + + +class SelectSideOfPlane(Operator): + """UV Operator description""" + bl_idname = "mesh.select_side_of_plane" + bl_label = "Select Side of Plane" + bl_options = {'REGISTER', 'UNDO'} + + plane_co = FloatVectorProperty( + size=3, + default=(0, 0, 0), + ) + plane_no = FloatVectorProperty( + size=3, + default=(0, 0, 1), + ) + + @classmethod + def poll(cls, context): + return (context.mode == 'EDIT_MESH') + + def invoke(self, context, event): + + if not self.properties.is_property_set("plane_co"): + self.plane_co = context.scene.cursor_location + + if not self.properties.is_property_set("plane_no"): + if context.space_data.type == 'VIEW_3D': + rv3d = context.space_data.region_3d + view_inv = rv3d.view_matrix.to_3x3() + # view y axis + self.plane_no = view_inv[1].normalized() + + self.execute(context) + + if context.space_data.type == 'VIEW_3D': + wm = context.window_manager + wm.manipulator_group_type_add(SelectSideOfPlaneManipulatorGroup.bl_idname) + + return {'FINISHED'} + + def execute(self, context): + from mathutils import Vector + main(context, Vector(self.plane_co), Vector(self.plane_no)) + return {'FINISHED'} + + +# Manipulators for plane_co, plane_no +class SelectSideOfPlaneManipulatorGroup(ManipulatorGroup): + bl_idname = "MESH_WGT_select_side_of_plane" + bl_label = "Side of Plane Manipulator" + bl_space_type = 'VIEW_3D' + bl_region_type = 'WINDOW' + bl_options = {'3D'} + + # Helper functions + @staticmethod + def my_target_operator(context): + wm = context.window_manager + op = wm.operators[-1] if wm.operators else None + if isinstance(op, SelectSideOfPlane): + return op + return None + + @staticmethod + def my_view_orientation(context): + rv3d = context.space_data.region_3d + view_inv = rv3d.view_matrix.to_3x3() + return view_inv.normalized() + + @classmethod + def poll(cls, context): + op = cls.my_target_operator(context) + if op is None: + wm = context.window_manager + wm.manipulator_group_type_remove(SelectSideOfPlaneManipulatorGroup.bl_idname) + return False + return True + + def setup(self, context): + from mathutils import Matrix, Vector + + # ---- + # Grab + + def grab_get_cb(): + op = SelectSideOfPlaneManipulatorGroup.my_target_operator(context) + return op.plane_co + + def grab_set_cb(value): + op = SelectSideOfPlaneManipulatorGroup.my_target_operator(context) + op.plane_co = value + # XXX, this may change! + op.execute(context) + + mpr = self.manipulators.new("MANIPULATOR_WT_grab_3d") + mpr.target_set_handler("offset", get=grab_get_cb, set=grab_set_cb) + + mpr.use_draw_value = True + + mpr.color = 0.8, 0.8, 0.8 + mpr.alpha = 0.5 + + mpr.color_highlight = 1.0, 1.0, 1.0 + mpr.alpha_highlight = 1.0 + + mpr.scale_basis = 0.2 + + self.widget_grab = mpr + + # ---- + # Dial + + def direction_get_cb(): + op = SelectSideOfPlaneManipulatorGroup.my_target_operator(context) + + no_a = self.widget_dial.matrix_basis.col[1].xyz + no_b = Vector(op.plane_no) + + no_a = (no_a * self.view_inv).xy.normalized() + no_b = (no_b * self.view_inv).xy.normalized() + return no_a.angle_signed(no_b) + + def direction_set_cb(value): + op = SelectSideOfPlaneManipulatorGroup.my_target_operator(context) + matrix_rotate = Matrix.Rotation(-value, 3, self.rotate_axis) + no = matrix_rotate * self.widget_dial.matrix_basis.col[1].xyz + op.plane_no = no + op.execute(context) + + mpr = self.manipulators.new("MANIPULATOR_WT_dial_3d") + mpr.target_set_handler("offset", get=direction_get_cb, set=direction_set_cb) + mpr.draw_options = {'ANGLE_START_Y'} + + mpr.use_draw_value = True + + mpr.color = 0.8, 0.8, 0.8 + mpr.alpha = 0.5 + + mpr.color_highlight = 1.0, 1.0, 1.0, 1.0 + mpr.alpha_highlight = 1.0 + + self.widget_dial = mpr + + def draw_prepare(self, context): + from mathutils import Vector + + view_inv = self.my_view_orientation(context) + + self.view_inv = view_inv + self.rotate_axis = view_inv[2].xyz + self.rotate_up = view_inv[1].xyz + + op = self.my_target_operator(context) + + co = Vector(op.plane_co) + no = Vector(op.plane_no).normalized() + + # Grab + no_z = no + no_y = no_z.orthogonal() + no_x = no_z.cross(no_y) + + matrix = self.widget_grab.matrix_basis + matrix.identity() + matrix.col[0].xyz = no_x + matrix.col[1].xyz = no_y + matrix.col[2].xyz = no_z + matrix.col[3].xyz = co + + # Dial + no_z = self.rotate_axis + no_y = (no - (no.project(no_z))).normalized() + no_x = self.rotate_axis.cross(no_y) + + matrix = self.widget_dial.matrix_basis + matrix.identity() + matrix.col[0].xyz = no_x + matrix.col[1].xyz = no_y + matrix.col[2].xyz = no_z + matrix.col[3].xyz = co + + +classes = ( + SelectSideOfPlane, + SelectSideOfPlaneManipulatorGroup, +) + +def register(): + for cls in classes: + bpy.utils.register_class(cls) + + +def unregister(): + for cls in reversed(classes): + bpy.utils.unregister_class(cls) + +if __name__ == "__main__": + register() diff --git a/release/scripts/templates_py/manipulator_operator_target.py b/release/scripts/templates_py/manipulator_operator_target.py new file mode 100644 index 00000000000..0abf6f2f654 --- /dev/null +++ b/release/scripts/templates_py/manipulator_operator_target.py @@ -0,0 +1,48 @@ +# Example of a manipulator that activates an operator +# using the predefined dial manipulator to change the camera roll. +# +# Usage: Run this script and select a camera in the 3D view. +# +import bpy +from bpy.types import ( + ManipulatorGroup, +) + +class MyCameraWidgetGroup(ManipulatorGroup): + bl_idname = "OBJECT_WGT_test_camera" + bl_label = "Object Camera Test Widget" + bl_space_type = 'VIEW_3D' + bl_region_type = 'WINDOW' + bl_options = {'3D', 'PERSISTENT'} + + @classmethod + def poll(cls, context): + ob = context.object + return (ob and ob.type == 'CAMERA') + + def setup(self, context): + # Run an operator using the dial manipulator + ob = context.object + mpr = self.manipulators.new("MANIPULATOR_WT_dial_3d") + props = mpr.target_set_operator("transform.rotate") + props.constraint_axis = False, False, True + props.constraint_orientation = 'LOCAL' + props.release_confirm = True + + mpr.matrix_basis = ob.matrix_world.normalized() + mpr.line_width = 3 + + mpr.color = 0.8, 0.8, 0.8 + mpr.alpha = 0.5 + + mpr.color_highlight = 1.0, 1.0, 1.0 + mpr.alpha_highlight = 1.0 + + self.roll_widget = mpr + + def refresh(self, context): + ob = context.object + mpr = self.roll_widget + mpr.matrix_basis = ob.matrix_world.normalized() + +bpy.utils.register_class(MyCameraWidgetGroup) diff --git a/release/scripts/templates_py/manipulator_simple.py b/release/scripts/templates_py/manipulator_simple.py new file mode 100644 index 00000000000..7e02940d527 --- /dev/null +++ b/release/scripts/templates_py/manipulator_simple.py @@ -0,0 +1,45 @@ +# Example of a group that edits a single property +# using the predefined manipulator arrow. +# +# Usage: Select a lamp in the 3D view and drag the arrow at it's rear +# to change it's energy value. +# +import bpy +from bpy.types import ( + ManipulatorGroup, +) + +class MyLampWidgetGroup(ManipulatorGroup): + bl_idname = "OBJECT_WGT_lamp_test" + bl_label = "Test Lamp Widget" + bl_space_type = 'VIEW_3D' + bl_region_type = 'WINDOW' + bl_options = {'3D', 'PERSISTENT'} + + @classmethod + def poll(cls, context): + ob = context.object + return (ob and ob.type == 'LAMP') + + def setup(self, context): + # Arrow manipulator has one 'offset' property we can assign to the lamp energy. + ob = context.object + mpr = self.manipulators.new("MANIPULATOR_WT_arrow_3d") + mpr.target_set_prop("offset", ob.data, "energy") + mpr.matrix_basis = ob.matrix_world.normalized() + mpr.draw_style = 'BOX' + + mpr.color = 1.0, 0.5, 0.0 + mpr.alpha = 0.5 + + mpr.color_highlight = 1.0, 0.5, 1.0 + mpr.alpha_highlight = 0.5 + + self.energy_widget = mpr + + def refresh(self, context): + ob = context.object + mpr = self.energy_widget + mpr.matrix_basis = ob.matrix_world.normalized() + +bpy.utils.register_class(MyLampWidgetGroup) diff --git a/release/scripts/templates_py/operator_modal_view3d_raycast.py b/release/scripts/templates_py/operator_modal_view3d_raycast.py index c4d661b4c1f..e3b63813fc4 100644 --- a/release/scripts/templates_py/operator_modal_view3d_raycast.py +++ b/release/scripts/templates_py/operator_modal_view3d_raycast.py @@ -67,7 +67,7 @@ def main(context, event): # now we have the object under the mouse cursor, # we could do lots of stuff but for the example just select. if best_obj is not None: - best_obj.select = True + best_obj.select_set(action='SELECT') context.scene.objects.active = best_obj |