Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
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
Commits
3f139678
Commit
3f139678
authored
13 years ago
by
Michael Krupa
Browse files
Options
Downloads
Patches
Plain Diff
Updated to use bpy.types.Camera.angle_y property.
parent
21eaa36c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
io_anim_nuke_chan/export_nuke_chan.py
+2
-9
2 additions, 9 deletions
io_anim_nuke_chan/export_nuke_chan.py
io_anim_nuke_chan/import_nuke_chan.py
+2
-3
2 additions, 3 deletions
io_anim_nuke_chan/import_nuke_chan.py
with
4 additions
and
12 deletions
io_anim_nuke_chan/export_nuke_chan.py
+
2
−
9
View file @
3f139678
...
@@ -23,7 +23,7 @@ It takes the currently active object and writes it's transformation data
...
@@ -23,7 +23,7 @@ It takes the currently active object and writes it's transformation data
into a text file with .chan extension.
"""
into a text file with .chan extension.
"""
from
mathutils
import
Matrix
from
mathutils
import
Matrix
from
math
import
radians
,
degrees
,
atan2
from
math
import
radians
,
degrees
def
save_chan
(
context
,
filepath
,
y_up
,
rot_ord
):
def
save_chan
(
context
,
filepath
,
y_up
,
rot_ord
):
...
@@ -73,14 +73,7 @@ def save_chan(context, filepath, y_up, rot_ord):
...
@@ -73,14 +73,7 @@ def save_chan(context, filepath, y_up, rot_ord):
if
camera
:
if
camera
:
sensor_x
=
camera
.
sensor_width
sensor_x
=
camera
.
sensor_width
sensor_y
=
camera
.
sensor_height
sensor_y
=
camera
.
sensor_height
cam_lens
=
camera
.
lens
vfov
=
degrees
(
camera
.
angle_y
)
# calculate the vertical field of view
# we know the vertical size of (virtual) sensor, the focal length
# of the camera so all we need to do is to feed this data to
# atan2 function whitch returns the degree (in radians) of
# an angle formed by a triangle with two legs of a given lengths
vfov
=
degrees
(
atan2
(
sensor_y
/
2
,
cam_lens
))
*
2.0
fw
(
"
%f
"
%
vfov
)
fw
(
"
%f
"
%
vfov
)
fw
(
"
\n
"
)
fw
(
"
\n
"
)
...
...
This diff is collapsed.
Click to expand it.
io_anim_nuke_chan/import_nuke_chan.py
+
2
−
3
View file @
3f139678
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
"""
This script is an importer for the nuke
'
s .chan files
"""
"""
This script is an importer for the nuke
'
s .chan files
"""
from
mathutils
import
Vector
,
Matrix
,
Euler
from
mathutils
import
Vector
,
Matrix
,
Euler
from
math
import
radians
,
tan
from
math
import
radians
def
read_chan
(
context
,
filepath
,
z_up
,
rot_ord
,
sensor_width
,
sensor_height
):
def
read_chan
(
context
,
filepath
,
z_up
,
rot_ord
,
sensor_width
,
sensor_height
):
...
@@ -103,11 +103,10 @@ def read_chan(context, filepath, z_up, rot_ord, sensor_width, sensor_height):
...
@@ -103,11 +103,10 @@ def read_chan(context, filepath, z_up, rot_ord, sensor_width, sensor_height):
# check if the object is camera and fov data is present
# check if the object is camera and fov data is present
if
camera
and
len
(
data
)
>
7
:
if
camera
and
len
(
data
)
>
7
:
v_fov
=
float
(
data
[
7
])
camera
.
sensor_fit
=
'
HORIZONTAL
'
camera
.
sensor_fit
=
'
HORIZONTAL
'
camera
.
sensor_width
=
sensor_width
camera
.
sensor_width
=
sensor_width
camera
.
sensor_height
=
sensor_height
camera
.
sensor_height
=
sensor_height
camera
.
lens
=
(
sensor_height
/
2.0
)
/
tan
(
radians
(
v_fov
/
2.0
)
)
camera
.
angle_y
=
radiansfloat
(
data
[
7
]
)
camera
.
keyframe_insert
(
"
lens
"
)
camera
.
keyframe_insert
(
"
lens
"
)
filehandle
.
close
()
filehandle
.
close
()
...
...
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