[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4591] contrib/py/scripts/addons: fixed + adding back add_scene_elements for future development
Brendon Murphy
meta.androcto1 at gmail.com
Mon Jun 24 01:30:41 CEST 2013
Revision: 4591
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4591
Author: meta-androcto
Date: 2013-06-23 23:30:40 +0000 (Sun, 23 Jun 2013)
Log Message:
-----------
fixed + adding back add_scene_elements for future development
Added Paths:
-----------
contrib/py/scripts/addons/add_scene_elements/
contrib/py/scripts/addons/add_scene_elements/__init__.py
contrib/py/scripts/addons/add_scene_elements/scene_camera.py
contrib/py/scripts/addons/add_scene_elements/scene_lighting.py
contrib/py/scripts/addons/add_scene_elements/scene_materials.py
contrib/py/scripts/addons/add_scene_elements/scene_objects.py
contrib/py/scripts/addons/add_scene_elements/scene_objects_cycles.py
Added: contrib/py/scripts/addons/add_scene_elements/__init__.py
===================================================================
--- contrib/py/scripts/addons/add_scene_elements/__init__.py (rev 0)
+++ contrib/py/scripts/addons/add_scene_elements/__init__.py 2013-06-23 23:30:40 UTC (rev 4591)
@@ -0,0 +1,102 @@
+# ##### 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, parts based on work by Erich Toven #
+
+bl_info = {
+ "name": "Scene Elements",
+ "author": "Meta Androcto, ",
+ "version": (0, 2),
+ "blender": (2, 64, 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": "http://projects.blender.org/tracker/index.php?"\
+ "func=detail&aid=32682",
+ "category": "Object"}
+
+
+if "bpy" in locals():
+ import imp
+ imp.reload(scene_camera)
+ imp.reload(scene_lighting)
+ imp.reload(scene_materials)
+ imp.reload(scene_objects)
+ imp.reload(scene_objects_cycles)
+
+else:
+ from . import scene_camera
+ from . import scene_lighting
+ from . import scene_materials
+ from . import scene_objects
+ from . import scene_objects_cycles
+
+import bpy
+
+class INFO_MT_mesh_objects_add(bpy.types.Menu):
+ # Define the "mesh objects" menu
+ bl_idname = "INFO_MT_scene_elements"
+ bl_label = "Scene Elements"
+
+ 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")
+
+class INFO_MT_mesh_lamps_add(bpy.types.Menu):
+ # Define the "mesh objects" menu
+ bl_idname = "INFO_MT_scene_lamps"
+ bl_label = "Lighting Elements"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("object.add_single_spot",
+ text="Add Single Spot")
+ layout.operator("object.add_basic_3point",
+ text="Add 3 Point Spot Setup")
+ layout.operator("object.add_basic_2point",
+ text="Add 2 Point Setup")
+ layout.operator("object.add_area_3point",
+ text="Add 3 Point Setup")
+
+# Register all operators and panels
+# Define "Extras" menu
+def menu_func(self, context):
+ self.layout.menu("INFO_MT_scene_elements", icon="PLUGIN")
+ self.layout.menu("INFO_MT_scene_lamps", icon="PLUGIN")
+def register():
+ bpy.utils.register_module(__name__)
+ # Add "Extras" menu to the "Add Mesh" menu
+ bpy.types.INFO_MT_add.append(menu_func)
+
+def unregister():
+ bpy.utils.unregister_module(__name__)
+ # Remove "Extras" menu from the "Add Mesh" menu.
+ bpy.types.INFO_MT_add.remove(menu_func)
+
+if __name__ == "__main__":
+ register()
Added: contrib/py/scripts/addons/add_scene_elements/scene_camera.py
===================================================================
--- contrib/py/scripts/addons/add_scene_elements/scene_camera.py (rev 0)
+++ contrib/py/scripts/addons/add_scene_elements/scene_camera.py 2013-06-23 23:30:40 UTC (rev 4591)
@@ -0,0 +1,89 @@
+'''# ##### 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 #####
+
+bl_info = {
+ "name": "Scene Lighting Presets",
+ "author": "meta-androcto",
+ "version": (0,1),
+ "blender": (2, 63, 0),
+ "location": "View3D > Tool Shelf > Scene Lighting Presets",
+ "description": "Creates Scenes with Lighting presets",
+ "warning": "",
+ "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/",
+ "tracker_url": "",
+ "category": "Object"}
+'''
+import bpy, mathutils, math
+from math import pi
+from bpy.props import *
+from mathutils import Vector
+
+class add_scene_camera(bpy.types.Operator):
+ bl_idname = "camera.add_scene"
+ bl_label = "Camera Only"
+ bl_description = "Empty scene with Camera"
+ bl_register = True
+ bl_undo = True
+
+ def execute(self, context):
+ blend_data = context.blend_data
+ ob = bpy.context.active_object
+
+# add new scene
+ bpy.ops.scene.new(type="NEW")
+ scene = bpy.context.scene
+ scene.name = "scene_camera"
+# render settings
+ render = scene.render
+ render.resolution_x = 1920
+ render.resolution_y = 1080
+ render.resolution_percentage = 50
+# add new world
+ world = bpy.data.worlds.new("Camera_World")
+ scene.world = world
+ world.use_sky_blend = True
+ world.use_sky_paper = True
+ world.horizon_color = (0.004393,0.02121,0.050)
+ world.zenith_color = (0.03335,0.227,0.359)
+ world.light_settings.use_ambient_occlusion = True
+ world.light_settings.ao_factor = 0.25
+# add camera
+ bpy.ops.object.camera_add(location = (7.48113,-6.50764,5.34367), rotation = (1.109319,0.010817,0.814928),)
+ cam = bpy.context.active_object.data
+ cam.lens = 35
+ cam.draw_size = 0.1
+
+ return {"FINISHED"}
+
+#### REGISTER ####
+def add_object_button(self, context):
+ self.layout.menu("INFO_MT_camera.add_scene", icon="PLUGIN")
+
+def register():
+ bpy.utils.register_module(__name__)
+
+ bpy.types.INFO_MT_add.append(add_object_button)
+
+def unregister():
+ bpy.utils.unregister_module(__name__)
+
+ bpy.types.INFO_MT_add.remove(add_object_button)
+
+
+if __name__ == '__main__':
+ register()
Added: contrib/py/scripts/addons/add_scene_elements/scene_lighting.py
===================================================================
--- contrib/py/scripts/addons/add_scene_elements/scene_lighting.py (rev 0)
+++ contrib/py/scripts/addons/add_scene_elements/scene_lighting.py 2013-06-23 23:30:40 UTC (rev 4591)
@@ -0,0 +1,244 @@
+'''
+bl_info = {
+ "name": "Add 3 Point Lighting Setup",
+ "author": "Erich Toven" meta-androcto
+ "version": (1, 1),
+ "blender": (2, 56, 0),
+ "api": 34765,
+ "location": "View3D > Add",
+ "description": "Adds a new 3 point lighting setup",
+ "warning": "Very Alpha!",
+ "wiki_url": "",
+ "tracker_url": "",
+ "category": "Object"}
+
+
+'''
+import bpy, mathutils, math
+from math import pi
+from bpy.props import FloatVectorProperty
+#from add_utils import AddObjectHelper, add_object_data
+from mathutils import Vector
+
+
+class functions():
+ def addTrackToConstraint(ob, name, target):
+ cns = ob.constraints.new('TRACK_TO')
+ cns.name = name
+ cns.target = target
+ cns.track_axis = 'TRACK_NEGATIVE_Z'
+ cns.up_axis = 'UP_Y'
+ cns.owner_space = 'LOCAL'
+ cns.target_space = 'LOCAL'
+ return
+
+class AddSingleSpot(bpy.types.Operator):
+
+ bl_idname = "object.add_single_spot"
+ bl_label = "Add Single Spot Setup"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ def execute(self, context):
+
+ ### Add basic 3 point lighting setup ###
+ bpy.ops.object.add(type='EMPTY', view_align=False, enter_editmode=False, location=(0.000000, 0.000000, 0.000000))
+ empty1 = bpy.context.object
+
+ bpy.ops.object.lamp_add(type='SPOT', view_align=False, location=(0.000000, -10.000000, 10.000000), rotation=(-52.103, 15.548, -169.073))
+ lamp1 = bpy.context.object
+
+ ### Configure Lighting Setup ###
+ lamp1.name = 'Single_Spot1'
+
+ lamp1.data.energy = 4.0
+ lamp1.data.distance = 25.0
+ lamp1.data.spot_size = 1.396264
+ lamp1.data.spot_blend = 1
+ lamp1.data.shadow_method = 'BUFFER_SHADOW'
+ lamp1.data.shadow_buffer_type = 'HALFWAY'
+ lamp1.data.shadow_filter_type = 'GAUSS'
+ lamp1.data.shadow_buffer_soft = 10
+ lamp1.data.shadow_buffer_size = 2048
+ lamp1.data.shadow_buffer_bias = 0.100
+ lamp1.data.shadow_buffer_samples = 8
+ lamp1.data.use_auto_clip_start = True
+ lamp1.data.use_auto_clip_end = True
+
+ functions.addTrackToConstraint(lamp1,'AutoTrack',empty1)
+
+ return {'FINISHED'}
+
+class AddArea3point(bpy.types.Operator):
+ bl_idname = "object.add_area_3point"
+ bl_label = "add 3 Point Area Setup"
+ bl_options = {'REGISTER', 'UNDO'}
+ bl_description = "Add 3 Point lights to Scene"
+ def execute(self, context):
+ ### Add basic 3 point lighting setup ###
+
+ bpy.ops.object.lamp_add(type='POINT', view_align=False, location=(-12.848104, 18.574114, 7.496113), rotation=(1.537930, 0.711540, 3.687180))
+ lamp1 = bpy.context.object
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list