Академический Документы
Профессиональный Документы
Культура Документы
#The one, TrueIsocam called camera, is the mathematical correct isometric camera
with the 54.736 rotation to get the 30 degrees angles at the sides of the rhombus.
#The other, GameIsocam called camera, is a camera with which you can render
isometric tiles for a 2d game. Here we need a 60 degrees angle instedad of the
54.736 one to get a proper stairs effect and a ratio of 2:1
# Then there is the special case with a 4:3 ratio, which is button 3. You can also
make 2D games with that one. The view is more topdown though as with a 2:1 ratio of
the traditional game iso view.
# The fourth button creates a simple groundplane where you can place your stuff at.
#You can of course set up everything by hand. This script is a convenient solution
so that you don't have to setup it again and again.
bl_info = {
"name": "Create IsoCam",
"description": "Creates a true isometric camera or a isometric camera for game
needs",
"author": "Reiner 'Tiles' Prokein",
"version": (1, 0),
"blender": (2, 80, 0),
"location": "Toolshelf",
"warning": "", # used for warning icon and text in addons panel
"wiki_url":
"http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Add_Mesh/Create_IsoCam
",
"category": "Create"}
import bpy
#So that's what the next two lines are good for. Setting the rotation of
the camera ...
object = bpy.context.active_object
object.rotation_euler = (0.955324, 0, 0.785398) #Attention, these are
radians. Euler angles are (54.736,0,45) Here we set the rotation for a mathematical
correct isometric view. Not to mix with the Isoview for a 2D game!
return {'FINISHED'}
# ----------------------------------------- Game isometric camera
class PR_OT_creategameisocam(bpy.types.Operator):
"""Creates a camera with isometric view for game needs"""
bl_idname = "scene.create_gameisocam"
bl_label = "GameIsocam"
bl_options = {'REGISTER', 'UNDO'}
#So that's what the next two lines are good for. Setting the rotation of
the camera ...
object = bpy.context.active_object
object.rotation_euler = (1.047198, 0, 0.785398)#Attention, these are
radians. Euler angles are (60,0,45) Here we set the rotation for a isometric view
that is used in 2D games. Not to mix with the mathematical correct Isoview!
return {'FINISHED'}
class PR_OT_creategameisocam4to3(bpy.types.Operator):
"""Creates a camera with a special 4:3 iso view for game needs"""
bl_idname = "scene.create_gameisocam4to3"
bl_label = "GameIsocam4to3"
bl_options = {'REGISTER', 'UNDO'}
#So that's what the next two lines are good for. Setting the rotation of
the camera ...
object = bpy.context.active_object
object.rotation_euler = (0.724312, 0, 0.785398)#Attention, these are
radians. Euler angles are (41.5,0,45) Here we set the rotation for a isometric view
that is used in 2D games. Not to mix with the mathematical correct Isoview!
return {'FINISHED'}
class PR_OT_creategroundplane(bpy.types.Operator):
"""Creates a groundplane in size of ten where you can put your things on"""
bl_idname = "scene.create_groundplane"
bl_label = "Groundplane"
bl_options = {'REGISTER', 'UNDO'}
object = bpy.context.active_object
object.scale = (5, 5, 0)#The plane object is created with a size of 2.
Scaling it to 10 means to scale it by factor 5
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)#
apply scale
return {'FINISHED'}
class PR_PT_createisocampanel(bpy.types.Panel):
bl_label = "Create IsoCam"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "PR Isocam"
if __name__ == "__main__":
register()