[Bf-extensions-cvs] [98f1144] master: initial commit Test Scene, Lights, Turnaround: T48882

meta-androcto noreply at git.blender.org
Tue Jul 19 13:11:31 CEST 2016


Commit: 98f1144dcccf5759498f102ac084bbeeeab7dc2c
Author: meta-androcto
Date:   Tue Jul 19 21:10:56 2016 +1000
Branches: master
https://developer.blender.org/rBAC98f1144dcccf5759498f102ac084bbeeeab7dc2c

initial commit Test Scene, Lights, Turnaround: T48882

===================================================================

A	add_test_scene_elements/__init__.py
A	add_test_scene_elements/add_light_template.py
A	add_test_scene_elements/camera_turnaround.py
A	add_test_scene_elements/scene_camera.py
A	add_test_scene_elements/scene_materials.py
A	add_test_scene_elements/scene_objects.py
A	add_test_scene_elements/scene_objects_cycles.py
A	add_test_scene_elements/scene_texture_render.py
A	add_test_scene_elements/trilighting.py

===================================================================

diff --git a/add_test_scene_elements/__init__.py b/add_test_scene_elements/__init__.py
new file mode 100644
index 0000000..104c29e
--- /dev/null
+++ b/add_test_scene_elements/__init__.py
@@ -0,0 +1,146 @@
+# ##### 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 #####
+# by meta-androcto #
+
+bl_info = {
+    "name": "Test Scene, Light, Camera",
+    "author": "Meta Androcto",
+    "version": (0, 2),
+    "blender": (2, 77, 0),
+    "location": "View3D > Add > Scene Elements",
+    "description": "Add Scenes & Lights, Objects.",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6"
+    "/Py/Scripts",
+    "tracker_url": "",
+    "category": "Tools"}
+
+
+if "bpy" in locals():
+    import importlib
+    importlib.reload(scene_camera)
+    importlib.reload(scene_materials)
+    importlib.reload(scene_objects)
+    importlib.reload(scene_objects_cycles)
+    importlib.reload(scene_texture_render)
+    importlib.reload(add_light_template)
+    importlib.reload(trilighting)
+    importlib.reload(camera_turnaround)
+
+else:
+    from . import scene_camera
+    from . import scene_materials
+    from . import scene_objects
+    from . import scene_objects_cycles
+    from . import scene_texture_render
+    from . import add_light_template
+    from . import trilighting
+    from . import camera_turnaround
+
+import bpy
+
+
+class INFO_MT_scene_elements_add(bpy.types.Menu):
+    # Define the "mesh objects" menu
+    bl_idname = "INFO_MT_scene_elements"
+    bl_label = "Test scenes"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'INVOKE_REGION_WIN'
+        layout.operator("camera.add_scene",
+                        text="Scene_Camera")
+        layout.operator("materials.add_scene",
+                        text="Scene_Objects_BI")
+        layout.operator("plane.add_scene",
+                        text="Scene_Plane")
+        layout.operator("objects_cycles.add_scene",
+                        text="Scene_Objects_Cycles")
+        layout.operator("objects_texture.add_scene",
+                        text="Scene_Textures_Cycles")
+
+class INFO_MT_mesh_lamps_add(bpy.types.Menu):
+    # Define the "mesh objects" menu
+    bl_idname = "INFO_MT_scene_lamps"
+    bl_label = "Lighting Sets"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'INVOKE_REGION_WIN'
+        layout.operator("object.add_light_template",
+                        text="Add Light Template")
+        layout.operator("object.trilighting",
+                        text="Add Tri Lighting")
+
+class INFO_MT_mesh_cameras_add(bpy.types.Menu):
+    # Define the "mesh objects" menu
+    bl_idname = "INFO_MT_scene_cameras"
+    bl_label = "Camera Sets"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'INVOKE_REGION_WIN'
+        layout.operator("object.rotate_around",
+                        text="Turnaround Camera")
+
+# Define menu
+def menu(self, context):
+
+    layout = self.layout
+    layout.operator_context = 'INVOKE_REGION_WIN'
+    self.layout.separator()
+    self.layout.menu("INFO_MT_scene_elements", icon="SCENE_DATA")
+    self.layout.menu("INFO_MT_scene_lamps", icon="LAMP_SPOT")
+    self.layout.menu("INFO_MT_scene_cameras", icon="OUTLINER_DATA_CAMERA")
+
+# Addons Preferences
+
+
+class AddonPreferences(bpy.types.AddonPreferences):
+    bl_idname = __name__
+
+    def draw(self, context):
+        layout = self.layout
+        layout.label(text="Lighting Sets:")
+        layout.label(text="Spots, Points & Tri Lights")
+        layout.label(text="Test Scenes:")
+        layout.label(text="Basic pre-built test scenes Cycles & BI")
+
+
+def register():
+    camera_turnaround.register()
+    bpy.utils.register_module(__name__)
+    # Add "Extras" menu to the "Add Mesh" menu
+    bpy.types.INFO_MT_add.append(menu)
+    try:
+        bpy.types.VIEW3D_MT_AddMenu.prepend(menu)
+    except:
+        pass
+
+def unregister():
+    camera_turnaround.unregister()
+    # Remove "Extras" menu from the "Add Mesh" menu.
+    bpy.types.INFO_MT_add.remove(menu)
+    try:
+        bpy.types.VIEW3D_MT_AddMenu.remove(menu)
+    except:
+        pass
+    bpy.utils.unregister_module(__name__)
+
+if __name__ == "__main__":
+    register()
diff --git a/add_test_scene_elements/add_light_template.py b/add_test_scene_elements/add_light_template.py
new file mode 100644
index 0000000..36fc6a0
--- /dev/null
+++ b/add_test_scene_elements/add_light_template.py
@@ -0,0 +1,119 @@
+# gpl: author rebellion
+
+'''
+bl_info = {
+    "name": "Light Template",
+    "author": "Rebellion",
+    "version": (1, 0),
+    "blender": (2, 7, 0),
+    "location": "View3D > Add > Lights Template",
+    "description": "Adds  a light/camera template to your scene",
+    "warning": "",
+    "wiki_url": "",
+    "category": "Camera"}
+'''
+
+import bpy
+from bpy.types import Operator
+from bpy.props import BoolProperty
+from bpy_extras.object_utils import AddObjectHelper, object_data_add
+from mathutils import Vector
+
+
+def add_lamps(self, context):
+
+    if self.bKeyLight:
+        keyLight = bpy.data.lamps.new(name="Key_Light", type="SPOT")
+        ob = bpy.data.objects.new("Key_Light", keyLight)
+        constraint = ob.constraints.new(type='COPY_LOCATION')
+        constraint.use_offset = True
+        constraint.owner_space = 'LOCAL'
+        constraint.target = self.camera
+        constraint = ob.constraints.new(type='TRACK_TO')
+        constraint.target = self.target
+        constraint.track_axis = 'TRACK_NEGATIVE_Z'
+        constraint.up_axis = 'UP_X'
+        constraint.owner_space = 'LOCAL'
+        bpy.context.scene.objects.link(ob)
+        ob.rotation_euler[2] = -0.785398
+
+    if self.bFillLight:
+        fillLight = bpy.data.lamps.new(name="Fill_Light", type="SPOT")
+        ob = bpy.data.objects.new("Fill_Light", fillLight)
+        constraint = ob.constraints.new(type='COPY_LOCATION')
+        constraint.use_offset = True
+        constraint.owner_space = 'LOCAL'
+        constraint.target = self.camera
+        constraint = ob.constraints.new(type='TRACK_TO')
+        constraint.target = self.target
+        constraint.track_axis = 'TRACK_NEGATIVE_Z'
+        constraint.up_axis = 'UP_X'
+        constraint.owner_space = 'LOCAL'
+        bpy.context.scene.objects.link(ob)
+        ob.rotation_euler[2] = 0.785398
+        ob.data.energy = 0.3
+
+    if self.bBackLight:
+        backLight = bpy.data.lamps.new(name="Back_Light", type="SPOT")
+        ob = bpy.data.objects.new("Back_Light", backLight)
+        constraint = ob.constraints.new(type='COPY_LOCATION')
+        constraint.use_offset = True
+        constraint.owner_space = 'LOCAL'
+        constraint.target = self.camera
+        constraint = ob.constraints.new(type='TRACK_TO')
+        constraint.target = self.target
+        constraint.track_axis = 'TRACK_NEGATIVE_Z'
+        constraint.up_axis = 'UP_X'
+        constraint.owner_space = 'LOCAL'
+        bpy.context.scene.objects.link(ob)
+        ob.rotation_euler[2] = 3.14159
+        ob.data.energy = 0.2
+
+    if self.camera_constraint:
+        constraint = self.camera.constraints.new(type='TRACK_TO')
+        constraint.target = self.target
+        constraint.track_axis = 'TRACK_NEGATIVE_Z'
+        constraint.up_axis = 'UP_Y'
+
+
+class OBJECT_OT_add_light_template(Operator):
+    """Add light template"""
+    bl_idname = "object.add_light_template"
+    bl_label = "Add Light Template"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    camera = None
+    target = None
+
+    bKeyLight = BoolProperty(name="Key Light", default=True)
+    bFillLight = BoolProperty(name="Fill Light")
+    bBackLight = BoolProperty(name="Back Light")
+
+    camera_constraint = BoolProperty(name="Camera Constraint")
+
+    def execute(self, context):
+
+        objects = bpy.context.selected_objects
+
+        if len(objects) == 2:
+            for ob in objects:
+                if ob.type == 'CAMERA':
+                    self.camera = ob
+                else:
+                    self.target = ob
+
+        elif len(objects) == 1:
+            if objects[0].type == 'CAMERA':
+                self.camera = objects[0]
+                bpy.ops.object.empty_add()
+                self.target = context.active_object
+            else:
+                self.camera = context.scene.camera
+                self.target = context.active_object
+        elif len(objects) == 0:
+            bpy.ops.object.empty_add()
+            self.target = context.active_object
+            self.camera = context.scene.camera
+
+        add_lamps(self, context)
+        return {'FINISHED'}
diff --git a/add_test_scene_elements/camera_turnaround.py b/add_test_scene_elements/camera_turnaround.py
new file mode 100644
index 0000000..5dd1920
--- /dev/null
+++ b/add_test_scene_elements/camera_turnaround.py
@@ -0,0 +1,256 @@
+# gpl: author Antonio Vazquez (antonioya)
+
+bl_info = {
+    "name": "Turnaround camera around object",
+    "author": "Antonio Vazquez (antonioya)",
+    "version": (0, 2, 4),
+    "blender": (2, 68, 0),
+    "location": "View3D > Toolshelf > Turnaround camera",
+    "description": "Add a camera rotation around selected object.",
+    "category": "Camera"}
+
+
+import bpy
+import math
+
+# Action class
+class RunAction(bpy.types.Operator):
+    bl_idname = "object.rotate_around"
+    bl_label = "Turnaround"
+    bl

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list