Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons-contrib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons-contrib
Commits
022c9f91
Commit
022c9f91
authored
13 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
set indent from 3 -> 4 spaces, replace bpy.context with context when its available
parent
5e35eda9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
space_view3d_add_surround_cameras.py
+148
-150
148 additions, 150 deletions
space_view3d_add_surround_cameras.py
with
148 additions
and
150 deletions
space_view3d_add_surround_cameras.py
+
148
−
150
View file @
022c9f91
...
...
@@ -54,177 +54,175 @@ bpy.types.WindowManager.surround_screens_init = BoolProperty(
# GUI panel
class
AddSurroundCamerasPanel
(
bpy
.
types
.
Panel
):
bl_space_type
=
'
VIEW_3D
'
bl_region_type
=
'
TOOLS
'
bl_label
=
"
Surround Projection
"
def
draw
(
self
,
context
):
layout
=
self
.
layout
col
=
layout
.
column
(
align
=
True
)
row
=
col
.
row
()
row
.
prop
(
context
.
window_manager
,
"
num_surround_screens
"
)
row
=
col
.
row
()
row
.
operator
(
'
objects.add_surround_cameras
'
,
icon
=
'
CAMERA_DATA
'
)
row
=
col
.
row
()
row
.
operator
(
'
scene.add_linked_scenes_for_surround_cameras
'
,
icon
=
'
SCENE_DATA
'
)
col
=
layout
.
column
(
align
=
True
)
row
=
col
.
row
()
row
.
operator
(
'
objects.remove_surround_cameras
'
,
icon
=
'
X
'
)
row
=
col
.
row
()
row
.
operator
(
'
objects.remove_linked_scenes_for_surround_cameras
'
,
icon
=
'
X
'
)
bl_space_type
=
'
VIEW_3D
'
bl_region_type
=
'
TOOLS
'
bl_label
=
"
Surround Projection
"
def
draw
(
self
,
context
):
layout
=
self
.
layout
col
=
layout
.
column
(
align
=
True
)
row
=
col
.
row
()
row
.
prop
(
context
.
window_manager
,
"
num_surround_screens
"
)
row
=
col
.
row
()
row
.
operator
(
'
objects.add_surround_cameras
'
,
icon
=
'
CAMERA_DATA
'
)
row
=
col
.
row
()
row
.
operator
(
'
scene.add_linked_scenes_for_surround_cameras
'
,
icon
=
'
SCENE_DATA
'
)
col
=
layout
.
column
(
align
=
True
)
row
=
col
.
row
()
row
.
operator
(
'
objects.remove_surround_cameras
'
,
icon
=
'
X
'
)
row
=
col
.
row
()
row
.
operator
(
'
objects.remove_linked_scenes_for_surround_cameras
'
,
icon
=
'
X
'
)
# operator for adding cameras
class
AddSurroundCamerasOperator
(
bpy
.
types
.
Operator
):
bl_idname
=
'
objects.add_surround_cameras
'
bl_label
=
"
Add Cameras
"
bl_description
=
"
Add n cameras
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
@classmethod
def
poll
(
cls
,
context
):
return
context
.
window_manager
.
previous_num_surround_screens
is
-
1
def
execute
(
self
,
context
):
numScreens
=
context
.
window_manager
.
num_surround_screens
# add an empty for the camera origin if not already present
originExists
=
False
for
object
in
bpy
.
data
.
objects
:
if
object
.
name
==
"
CameraOrigin
"
:
bpy
.
ops
.
object
.
select_name
(
name
=
"
CameraOrigin
"
)
origin
=
bpy
.
context
.
active_object
originExists
=
True
break
if
not
originExists
:
bpy
.
ops
.
object
.
add
()
origin
=
bpy
.
context
.
active_object
origin
.
name
=
"
CameraOrigin
"
origin
.
location
=
bpy
.
context
.
scene
.
cursor_location
for
i
in
range
(
0
,
numScreens
):
# add a new camer
bpy
.
ops
.
object
.
camera_add
()
# get the current camera
cam
=
bpy
.
context
.
active_object
# name the camera
cameraName
=
"
Camera
"
+
str
(
i
)
cam
.
name
=
cameraName
cam
.
data
.
name
=
cameraName
# position camera
cam
.
location
=
0
,
0
,
0
cam
.
rotation_euler
=
(
pi
/
2
),
0
,
((
-
2
*
pi
)
/
numScreens
)
*
i
# set the field of view angle
cam
.
data
.
angle
=
(
2
*
pi
)
/
numScreens
# make the parent of the camera the origin
cam
.
parent
=
origin
bpy
.
ops
.
object
.
select_name
(
name
=
"
CameraOrigin
"
)
context
.
window_manager
.
previous_num_surround_screens
=
numScreens
return
{
'
FINISHED
'
}
bl_idname
=
'
objects.add_surround_cameras
'
bl_label
=
"
Add Cameras
"
bl_description
=
"
Add n cameras
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
@classmethod
def
poll
(
cls
,
context
):
return
context
.
window_manager
.
previous_num_surround_screens
is
-
1
def
execute
(
self
,
context
):
numScreens
=
context
.
window_manager
.
num_surround_screens
# add an empty for the camera origin if not already present
originExists
=
False
for
object
in
bpy
.
data
.
objects
:
if
object
.
name
==
"
CameraOrigin
"
:
bpy
.
ops
.
object
.
select_name
(
name
=
"
CameraOrigin
"
)
origin
=
context
.
active_object
originExists
=
True
break
if
not
originExists
:
bpy
.
ops
.
object
.
add
()
origin
=
context
.
active_object
origin
.
name
=
"
CameraOrigin
"
origin
.
location
=
context
.
scene
.
cursor_location
for
i
in
range
(
0
,
numScreens
):
# add a new camer
bpy
.
ops
.
object
.
camera_add
()
# get the current camera
cam
=
context
.
active_object
# name the camera
cameraName
=
"
Camera
"
+
str
(
i
)
cam
.
name
=
cameraName
cam
.
data
.
name
=
cameraName
# position camera
cam
.
location
=
0
,
0
,
0
cam
.
rotation_euler
=
(
pi
/
2
),
0
,
((
-
2
*
pi
)
/
numScreens
)
*
i
# set the field of view angle
cam
.
data
.
angle
=
(
2
*
pi
)
/
numScreens
# make the parent of the camera the origin
cam
.
parent
=
origin
bpy
.
ops
.
object
.
select_name
(
name
=
"
CameraOrigin
"
)
context
.
window_manager
.
previous_num_surround_screens
=
numScreens
return
{
'
FINISHED
'
}
# operator for creating new linked scenes for each camera
class
AddSurroundScenesOperator
(
bpy
.
types
.
Operator
):
bl_idname
=
'
scene.add_linked_scenes_for_surround_cameras
'
bl_label
=
"
Make Scenes
"
bl_description
=
"
Creates new scenes with linked object data for each camera
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
@classmethod
def
poll
(
cls
,
context
):
if
context
.
window_manager
.
previous_num_surround_screens
is
not
-
1
and
context
.
window_manager
.
surround_screens_init
is
False
:
return
True
return
False
def
execute
(
self
,
context
):
numScreens
=
context
.
window_manager
.
previous_num_surround_screens
sceneName
=
bpy
.
context
.
scene
.
name
renderpath
=
bpy
.
context
.
scene
.
render
.
filepath
for
i
in
range
(
0
,
numScreens
):
thisScene
=
sceneName
+
"
-Camera
"
+
str
(
i
)
bpy
.
ops
.
scene
.
new
(
type
=
'
LINK_OBJECTS
'
)
bpy
.
context
.
scene
.
name
=
thisScene
bpy
.
context
.
scene
.
camera
=
bpy
.
data
.
objects
[
"
Camera
"
+
str
(
i
)]
bpy
.
context
.
scene
.
render
.
filepath
=
renderpath
+
thisScene
bpy
.
context
.
screen
.
scene
=
bpy
.
data
.
scenes
[
sceneName
]
context
.
window_manager
.
surround_screens_init
=
True
return
{
'
FINISHED
'
}
bl_idname
=
'
scene.add_linked_scenes_for_surround_cameras
'
bl_label
=
"
Make Scenes
"
bl_description
=
"
Creates new scenes with linked object data for each camera
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
@classmethod
def
poll
(
cls
,
context
):
if
context
.
window_manager
.
previous_num_surround_screens
is
not
-
1
and
context
.
window_manager
.
surround_screens_init
is
False
:
return
True
return
False
def
execute
(
self
,
context
):
numScreens
=
context
.
window_manager
.
previous_num_surround_screens
sceneName
=
context
.
scene
.
name
renderpath
=
context
.
scene
.
render
.
filepath
for
i
in
range
(
0
,
numScreens
):
thisScene
=
sceneName
+
"
-Camera
"
+
str
(
i
)
bpy
.
ops
.
scene
.
new
(
type
=
'
LINK_OBJECTS
'
)
context
.
scene
.
name
=
thisScene
context
.
scene
.
camera
=
bpy
.
data
.
objects
[
"
Camera
"
+
str
(
i
)]
context
.
scene
.
render
.
filepath
=
renderpath
+
thisScene
context
.
screen
.
scene
=
bpy
.
data
.
scenes
[
sceneName
]
context
.
window_manager
.
surround_screens_init
=
True
return
{
'
FINISHED
'
}
# operator for removing the surround scenes
class
RemoveSurroundScenesOperator
(
bpy
.
types
.
Operator
):
bl_idname
=
'
objects.remove_linked_scenes_for_surround_cameras
'
bl_label
=
"
Remove Scenes
"
bl_description
=
"
Removes all surround scenes
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
@classmethod
def
poll
(
cls
,
context
):
return
context
.
window_manager
.
surround_screens_init
is
True
def
execute
(
self
,
context
):
numScreens
=
context
.
window_manager
.
previous_num_surround_screens
for
scene
in
list
(
bpy
.
data
.
scenes
):
if
re
.
search
(
"
-Camera
"
,
scene
.
name
):
bpy
.
data
.
scenes
.
remove
(
scene
)
context
.
window_manager
.
surround_screens_init
=
False
return
{
'
FINISHED
'
}
bl_idname
=
'
objects.remove_linked_scenes_for_surround_cameras
'
bl_label
=
"
Remove Scenes
"
bl_description
=
"
Removes all surround scenes
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
@classmethod
def
poll
(
cls
,
context
):
return
context
.
window_manager
.
surround_screens_init
is
True
def
execute
(
self
,
context
):
numScreens
=
context
.
window_manager
.
previous_num_surround_screens
for
scene
in
list
(
bpy
.
data
.
scenes
):
if
re
.
search
(
"
-Camera
"
,
scene
.
name
):
bpy
.
data
.
scenes
.
remove
(
scene
)
context
.
window_manager
.
surround_screens_init
=
False
return
{
'
FINISHED
'
}
# operator for removing the surround cameras/scenes
class
RemoveSurroundCamerasOperator
(
bpy
.
types
.
Operator
):
bl_idname
=
'
objects.remove_surround_cameras
'
bl_label
=
"
Remove Cameras
"
bl_description
=
"
Removes all surround cameras
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
@classmethod
def
poll
(
cls
,
context
):
if
context
.
window_manager
.
previous_num_surround_screens
is
not
-
1
and
context
.
window_manager
.
surround_screens_init
is
False
:
return
True
return
False
def
execute
(
self
,
context
):
numScreens
=
context
.
window_manager
.
previous_num_surround_screens
for
object
in
bpy
.
data
.
objects
:
if
object
.
type
==
'
CAMERA
'
:
bpy
.
ops
.
object
.
select_name
(
name
=
object
.
name
)
bpy
.
ops
.
object
.
delete
()
context
.
window_manager
.
previous_num_surround_screens
=
-
1
return
{
'
FINISHED
'
}
bl_idname
=
'
objects.remove_surround_cameras
'
bl_label
=
"
Remove Cameras
"
bl_description
=
"
Removes all surround cameras
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
@classmethod
def
poll
(
cls
,
context
):
if
context
.
window_manager
.
previous_num_surround_screens
is
not
-
1
and
context
.
window_manager
.
surround_screens_init
is
False
:
return
True
return
False
def
execute
(
self
,
context
):
numScreens
=
context
.
window_manager
.
previous_num_surround_screens
for
object
in
bpy
.
data
.
objects
:
if
object
.
type
==
'
CAMERA
'
:
bpy
.
ops
.
object
.
select_name
(
name
=
object
.
name
)
bpy
.
ops
.
object
.
delete
()
context
.
window_manager
.
previous_num_surround_screens
=
-
1
return
{
'
FINISHED
'
}
def
register
():
bpy
.
utils
.
register_module
(
__name__
)
pass
def
unregister
():
bpy
.
utils
.
unregister_module
(
__name__
)
pass
if
__name__
==
"
__main__
"
:
register
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment