[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2361] trunk/py/scripts/addons: fix for x3d export and some minor pep8 edits
Campbell Barton
ideasman42 at gmail.com
Mon Sep 26 17:44:11 CEST 2011
Revision: 2361
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2361
Author: campbellbarton
Date: 2011-09-26 15:44:10 +0000 (Mon, 26 Sep 2011)
Log Message:
-----------
fix for x3d export and some minor pep8 edits
Modified Paths:
--------------
trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
trunk/py/scripts/addons/mocap/__init__.py
trunk/py/scripts/addons/render_povray/render.py
trunk/py/scripts/addons/space_view3d_screencast_keys.py
Modified: trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/export_x3d.py 2011-09-26 15:29:44 UTC (rev 2360)
+++ trunk/py/scripts/addons/io_scene_x3d/export_x3d.py 2011-09-26 15:44:10 UTC (rev 2361)
@@ -201,12 +201,11 @@
w[0] = ('(mat3(normalize((view_matrix*%s)[0].xyz), normalize((view_matrix*%s)[1].xyz), normalize((view_matrix*%s)[2].xyz)) * -%s)' %
(last_transform, last_transform, last_transform, w[0]))
-
l = "\tlamp_visibility_sun_hemi(" + ", ".join(w)
elif l.lstrip().startswith("lamp_visibility_spot_circle("):
w = l.split(', ')
w[0] = w[0][len("lamp_visibility_spot_circle(") + 1:]
-
+
if not h3d_is_object_view(scene, frag_uniform_var_map[w[0]]):
w[0] = '(mat3(normalize(view_matrix[0].xyz), normalize(view_matrix[1].xyz), normalize(view_matrix[2].xyz)) * -%s)' % w[0]
else:
@@ -486,44 +485,14 @@
if not mesh.faces:
return
- texface_use_halo = 0
- texface_use_billboard = 0
- # texface_use_collision = 0
+ use_collnode = bool([mod for mod in obj.modifiers
+ if mod.type == 'COLLISION'
+ if mod.show_viewport])
- use_halonode = False
- use_billnode = False
- use_collnode = False
-
- if mesh.uv_textures.active: # if mesh.faceUV:
- for face in mesh.uv_textures.active.data: # for face in mesh.faces:
- texface_use_halo |= face.use_halo
- texface_use_billboard |= face.use_billboard
- # texface_use_collision |= face.use_collision
- # texface_use_object_color |= face.use_object_color
-
- # use modifier instead
- texface_use_collision = bool([mod for mod in obj.modifiers
- if mod.type == 'COLLISION'
- if mod.show_viewport])
-
- if texface_use_halo:
- fw('%s<Billboard axisOfRotation="0 0 0">\n' % ident)
- use_halonode = True
- ident += '\t'
- elif texface_use_billboard:
- fw('%s<Billboard axisOfRotation="0 1 0">\n' % ident)
- use_billnode = True
- ident += '\t'
- elif texface_use_collision:
+ if use_collnode:
fw('%s<Collision enabled="true">\n' % ident)
- use_collnode = True
ident += '\t'
- del texface_use_halo
- del texface_use_billboard
- del texface_use_collision
- # del texface_use_object_color
-
ident = writeTransform_begin(ident, matrix, suffix_quoted_str(obj_id, "_TRANSFORM"))
if mesh.tag:
@@ -569,7 +538,7 @@
mesh_faces_vertices = [f.vertices[:] for f in mesh_faces]
if is_uv and True in mesh_materials_use_face_texture:
- mesh_faces_image = [(fuv.image if (mesh_materials_use_face_texture[mesh_faces_materials[i]] and fuv.use_image) else mesh_material_images[mesh_faces_materials[i]]) for i, fuv in enumerate(mesh.uv_textures.active.data)]
+ mesh_faces_image = [(fuv.image if (mesh_materials_use_face_texture[mesh_faces_materials[i]]) else mesh_material_images[mesh_faces_materials[i]]) for i, fuv in enumerate(mesh.uv_textures.active.data)]
mesh_faces_image_unique = set(mesh_faces_image)
elif len(set(mesh_material_images) | {None}) > 1: # make sure there is at least one image
mesh_faces_image = [mesh_material_images[material_index] for material_index in mesh_faces_materials]
@@ -936,14 +905,8 @@
ident = writeTransform_end(ident)
- if use_halonode:
+ if use_collnode:
ident = ident[:-1]
- fw('%s</Billboard>\n' % ident)
- elif use_billnode:
- ident = ident[:-1]
- fw('%s</Billboard>\n' % ident)
- elif use_collnode:
- ident = ident[:-1]
fw('%s</Collision>\n' % ident)
def writeMaterial(ident, material, world):
@@ -1090,7 +1053,7 @@
field_descr = " <!--- H3D View Matrix Patch -->"
fw('%s<field name="%s" type="SFMatrix4f" accessType="inputOutput" />%s\n' % (ident, H3D_VIEW_MATRIX, field_descr))
frag_vars = ["uniform mat4 %s;" % H3D_VIEW_MATRIX]
-
+
# annoying!, we need to track if some of the directional lamp
# vars are children of the camera or not, since this adjusts how
# they are patched.
@@ -1174,7 +1137,7 @@
h3d_material_route.append(
'<ROUTE fromNode=%s fromField="direction" toNode=%s toField="%s" />%s' %
(lamp_id, material_id, uniform['varname'], field_descr))
-
+
else:
assert(0)
@@ -1387,13 +1350,12 @@
# make transform node relative
obj_matrix = obj_main_matrix_world_invert * obj_matrix
-
# H3D - use for writing a dummy transform parent
is_dummy_tx = False
if obj_type == 'CAMERA':
writeViewpoint(ident, obj, obj_matrix, scene)
-
+
if use_h3d and scene.camera == obj:
view_id = uuid_cache_view[obj]
fw('%s<Transform DEF="%s">\n' % (ident, H3D_CAMERA_FOLLOW))
@@ -1403,7 +1365,7 @@
])
is_dummy_tx = True
ident += '\t'
-
+
elif obj_type in {'MESH', 'CURVE', 'SURF', 'FONT'}:
if (obj_type != 'MESH') or (use_apply_modifiers and obj.is_modified(scene, 'PREVIEW')):
try:
Modified: trunk/py/scripts/addons/mocap/__init__.py
===================================================================
--- trunk/py/scripts/addons/mocap/__init__.py 2011-09-26 15:29:44 UTC (rev 2360)
+++ trunk/py/scripts/addons/mocap/__init__.py 2011-09-26 15:44:10 UTC (rev 2361)
@@ -53,8 +53,8 @@
from . import mocap_constraints
from . import retarget
from . import mocap_tools
-
+
# MocapConstraint class
# Defines MocapConstraint datatype, used to add and configute mocap constraints
# Attached to Armature data
@@ -67,6 +67,7 @@
else:
return False
+
class MocapConstraint(bpy.types.PropertyGroup):
name = StringProperty(name="Name",
default="Mocap Fix",
Modified: trunk/py/scripts/addons/render_povray/render.py
===================================================================
--- trunk/py/scripts/addons/render_povray/render.py 2011-09-26 15:29:44 UTC (rev 2360)
+++ trunk/py/scripts/addons/render_povray/render.py 2011-09-26 15:44:10 UTC (rev 2361)
@@ -1,4 +1,4 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
+# ##### 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
Modified: trunk/py/scripts/addons/space_view3d_screencast_keys.py
===================================================================
--- trunk/py/scripts/addons/space_view3d_screencast_keys.py 2011-09-26 15:29:44 UTC (rev 2360)
+++ trunk/py/scripts/addons/space_view3d_screencast_keys.py 2011-09-26 15:44:10 UTC (rev 2361)
@@ -16,22 +16,6 @@
#
# ##### END GPL LICENSE BLOCK #####
-# #####
-#
-# Modification history:
-# - Version 1,4
-# - 07-sep-2011 (Gaia Clary):
-# - settings now stored in blend file
-# - grouping mouse&text
-# - mouse_size and font_size separated
-# - boundingBox for improved readability.
-# - missing mouse "release" clicks added
-#
-# ####
-
-# <pep8 compliant>
-
-
bl_info = {
'name': 'Screencast Keys',
'author': 'Paulo Gomes, Bart Crouch, John E. Herrenyo',
@@ -49,6 +33,20 @@
'category': '3D View'}
+# #####
+#
+# Modification history:
+# - Version 1,4
+# - 07-sep-2011 (Gaia Clary):
+# - settings now stored in blend file
+# - grouping mouse&text
+# - mouse_size and font_size separated
+# - boundingBox for improved readability.
+# - missing mouse "release" clicks added
+#
+# ####
+
+
import bgl
import blf
import bpy
More information about the Bf-extensions-cvs
mailing list