Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release')
-rw-r--r--release/Makefile6
-rw-r--r--release/VERSION2
-rw-r--r--release/bin/.blender/.Blanguages23
-rw-r--r--release/bin/.blender/.bfont.ttfbin0 -> 65932 bytes
-rwxr-xr-xrelease/bin/blender-thumbnailer.py131
-rw-r--r--release/datafiles/brushicons/add.pngbin0 -> 10948 bytes
-rw-r--r--release/datafiles/brushicons/blob.pngbin0 -> 10703 bytes
-rw-r--r--release/datafiles/brushicons/blur.pngbin0 -> 9327 bytes
-rw-r--r--release/datafiles/brushicons/clay.pngbin0 -> 11181 bytes
-rw-r--r--release/datafiles/brushicons/clone.pngbin0 -> 10774 bytes
-rw-r--r--release/datafiles/brushicons/crease.pngbin0 -> 8638 bytes
-rw-r--r--release/datafiles/brushicons/darken.pngbin0 -> 9653 bytes
-rw-r--r--release/datafiles/brushicons/draw.pngbin0 -> 11349 bytes
-rw-r--r--release/datafiles/brushicons/fill.pngbin0 -> 16892 bytes
-rw-r--r--release/datafiles/brushicons/flatten.pngbin0 -> 9114 bytes
-rw-r--r--release/datafiles/brushicons/grab.pngbin0 -> 8045 bytes
-rw-r--r--release/datafiles/brushicons/inflate.pngbin0 -> 8840 bytes
-rw-r--r--release/datafiles/brushicons/layer.pngbin0 -> 11004 bytes
-rw-r--r--release/datafiles/brushicons/lighten.pngbin0 -> 9437 bytes
-rw-r--r--release/datafiles/brushicons/mix.pngbin0 -> 10448 bytes
-rw-r--r--release/datafiles/brushicons/multiply.pngbin0 -> 10039 bytes
-rw-r--r--release/datafiles/brushicons/nudge.pngbin0 -> 18012 bytes
-rw-r--r--release/datafiles/brushicons/pinch.pngbin0 -> 9880 bytes
-rw-r--r--release/datafiles/brushicons/scrape.pngbin0 -> 13055 bytes
-rw-r--r--release/datafiles/brushicons/smear.pngbin0 -> 9358 bytes
-rw-r--r--release/datafiles/brushicons/smooth.pngbin0 -> 16428 bytes
-rw-r--r--release/datafiles/brushicons/snake_hook.pngbin0 -> 9710 bytes
-rw-r--r--release/datafiles/brushicons/soften.pngbin0 -> 9219 bytes
-rw-r--r--release/datafiles/brushicons/subtract.pngbin0 -> 10173 bytes
-rw-r--r--release/datafiles/brushicons/texdraw.pngbin0 -> 9462 bytes
-rw-r--r--release/datafiles/brushicons/thumb.pngbin0 -> 9098 bytes
-rw-r--r--release/datafiles/brushicons/twist.pngbin0 -> 10889 bytes
-rw-r--r--release/datafiles/brushicons/vertexdraw.pngbin0 -> 10253 bytes
-rw-r--r--release/datafiles/splash.pngbin204235 -> 185087 bytes
-rw-r--r--release/plugins/Makefile2
-rw-r--r--release/plugins/bmake2
-rw-r--r--release/plugins/sequence/Makefile2
-rw-r--r--release/plugins/texture/Makefile2
-rw-r--r--release/scripts/io/engine_render_pov.py1001
-rw-r--r--release/scripts/io/export_3ds.py55
-rw-r--r--release/scripts/io/export_fbx.py154
-rw-r--r--release/scripts/io/export_mdd.py41
-rw-r--r--release/scripts/io/export_obj.py467
-rw-r--r--release/scripts/io/export_ply.py33
-rw-r--r--release/scripts/io/export_x3d.py124
-rw-r--r--release/scripts/io/import_anim_bvh.py14
-rw-r--r--release/scripts/io/import_scene_3ds.py252
-rw-r--r--release/scripts/io/import_scene_obj.py196
-rw-r--r--release/scripts/io/import_shape_mdd.py11
-rw-r--r--release/scripts/io/netrender/__init__.py42
-rw-r--r--release/scripts/io/netrender/client.py29
-rw-r--r--release/scripts/io/netrender/master.py21
-rw-r--r--release/scripts/io/netrender/master_html.py7
-rw-r--r--release/scripts/io/netrender/operators.py93
-rw-r--r--[-rwxr-xr-x]release/scripts/io/netrender/repath.py25
-rw-r--r--release/scripts/io/netrender/slave.py43
-rw-r--r--release/scripts/io/netrender/ui.py344
-rw-r--r--release/scripts/io/netrender/utils.py17
-rw-r--r--release/scripts/keyingsets/keyingsets_utils.py16
-rw-r--r--release/scripts/modules/add_object_utils.py12
-rw-r--r--release/scripts/modules/bpy/__init__.py4
-rw-r--r--release/scripts/modules/bpy/utils.py170
-rw-r--r--release/scripts/modules/bpy_types.py118
-rw-r--r--release/scripts/modules/graphviz_export.py4
-rw-r--r--release/scripts/modules/rigify/__init__.py56
-rw-r--r--release/scripts/modules/rigify/arm_biped.py64
-rw-r--r--release/scripts/modules/rigify/copy.py4
-rw-r--r--release/scripts/modules/rigify/delta.py8
-rw-r--r--release/scripts/modules/rigify/eye_balls.py24
-rw-r--r--release/scripts/modules/rigify/eye_lid.py78
-rw-r--r--release/scripts/modules/rigify/finger_curl.py40
-rw-r--r--release/scripts/modules/rigify/leg_biped.py70
-rw-r--r--release/scripts/modules/rigify/leg_quadruped.py44
-rw-r--r--release/scripts/modules/rigify/mouth.py68
-rw-r--r--release/scripts/modules/rigify/neck.py24
-rw-r--r--release/scripts/modules/rigify/neck_flex.py34
-rw-r--r--release/scripts/modules/rigify/palm_curl.py16
-rw-r--r--release/scripts/modules/rigify/shape_key_control.py2
-rw-r--r--release/scripts/modules/rigify/shape_key_distance.py2
-rw-r--r--release/scripts/modules/rigify/shape_key_rotdiff.py2
-rw-r--r--release/scripts/modules/rigify/spine_pivot_flex.py52
-rw-r--r--release/scripts/modules/rigify/stretch.py6
-rw-r--r--release/scripts/modules/rigify/stretch_twist.py155
-rw-r--r--release/scripts/modules/rigify/tail_control.py10
-rw-r--r--release/scripts/modules/rigify/tongue.py34
-rw-r--r--release/scripts/modules/rigify/track_dual.py6
-rw-r--r--release/scripts/modules/rigify/track_reverse.py4
-rw-r--r--release/scripts/modules/rigify_utils.py8
-rw-r--r--release/scripts/modules/rna_info.py29
-rw-r--r--release/scripts/modules/rna_prop_ui.py133
-rw-r--r--release/scripts/op/add_armature_human.py152
-rw-r--r--release/scripts/op/add_mesh_torus.py6
-rw-r--r--release/scripts/op/fcurve_euler_filter.py15
-rw-r--r--release/scripts/op/image.py37
-rw-r--r--release/scripts/op/mesh.py38
-rw-r--r--release/scripts/op/nla.py8
-rw-r--r--release/scripts/op/object.py138
-rw-r--r--release/scripts/op/object_align.py5
-rw-r--r--release/scripts/op/object_randomize_transform.py2
-rw-r--r--release/scripts/op/presets.py87
-rw-r--r--release/scripts/op/screen_play_rendered_anim.py8
-rw-r--r--release/scripts/op/sequencer.py35
-rw-r--r--release/scripts/op/uv.py15
-rw-r--r--release/scripts/op/uvcalc_follow_active.py21
-rw-r--r--release/scripts/op/uvcalc_smart_project.py29
-rw-r--r--release/scripts/op/vertexpaint_dirt.py22
-rw-r--r--release/scripts/op/wm.py191
-rw-r--r--release/scripts/presets/interaction/blender.py18
-rw-r--r--release/scripts/presets/interaction/maya.py38
-rw-r--r--release/scripts/templates/gamelogic.py2
-rw-r--r--release/scripts/templates/operator.py6
-rw-r--r--release/scripts/templates/operator_modal.py2
-rw-r--r--release/scripts/templates/operator_modal_draw.py12
-rw-r--r--release/scripts/templates/operator_modal_view3d.py3
-rw-r--r--release/scripts/templates/operator_simple.py10
-rw-r--r--release/scripts/templates/operator_uv.py13
-rw-r--r--release/scripts/templates/panel_simple.py2
-rw-r--r--release/scripts/ui/properties_animviz.py145
-rw-r--r--release/scripts/ui/properties_data_armature.py194
-rw-r--r--release/scripts/ui/properties_data_armature_rigify.py63
-rw-r--r--release/scripts/ui/properties_data_bone.py280
-rw-r--r--release/scripts/ui/properties_data_camera.py84
-rw-r--r--release/scripts/ui/properties_data_curve.py194
-rw-r--r--release/scripts/ui/properties_data_empty.py26
-rw-r--r--release/scripts/ui/properties_data_lamp.py272
-rw-r--r--release/scripts/ui/properties_data_lattice.py68
-rw-r--r--release/scripts/ui/properties_data_mesh.py159
-rw-r--r--release/scripts/ui/properties_data_metaball.py84
-rw-r--r--release/scripts/ui/properties_data_modifier.py439
-rw-r--r--release/scripts/ui/properties_game.py313
-rw-r--r--release/scripts/ui/properties_material.py900
-rw-r--r--release/scripts/ui/properties_object.py205
-rw-r--r--release/scripts/ui/properties_object_constraint.py503
-rw-r--r--release/scripts/ui/properties_particle.py460
-rw-r--r--release/scripts/ui/properties_physics_cloth.py88
-rw-r--r--release/scripts/ui/properties_physics_common.py65
-rw-r--r--release/scripts/ui/properties_physics_field.py101
-rw-r--r--release/scripts/ui/properties_physics_fluid.py137
-rw-r--r--release/scripts/ui/properties_physics_smoke.py138
-rw-r--r--release/scripts/ui/properties_physics_softbody.py116
-rw-r--r--release/scripts/ui/properties_render.py357
-rw-r--r--release/scripts/ui/properties_scene.py129
-rw-r--r--release/scripts/ui/properties_texture.py555
-rw-r--r--release/scripts/ui/properties_world.py255
-rw-r--r--release/scripts/ui/space_buttons.py72
-rw-r--r--release/scripts/ui/space_console.py28
-rw-r--r--release/scripts/ui/space_dopesheet.py27
-rw-r--r--release/scripts/ui/space_filebrowser.py38
-rw-r--r--release/scripts/ui/space_graph.py29
-rw-r--r--release/scripts/ui/space_image.py241
-rw-r--r--release/scripts/ui/space_info.py41
-rw-r--r--release/scripts/ui/space_logic.py43
-rw-r--r--release/scripts/ui/space_nla.py25
-rw-r--r--release/scripts/ui/space_node.py27
-rw-r--r--release/scripts/ui/space_outliner.py23
-rw-r--r--release/scripts/ui/space_sequencer.py368
-rw-r--r--release/scripts/ui/space_text.py90
-rw-r--r--release/scripts/ui/space_time.py63
-rw-r--r--release/scripts/ui/space_userpref.py353
-rw-r--r--release/scripts/ui/space_userpref_keymap.py189
-rw-r--r--release/scripts/ui/space_view3d.py347
-rw-r--r--release/scripts/ui/space_view3d_toolbar.py442
-rw-r--r--release/text/copyright.txt33
-rw-r--r--release/text/readme.html10
164 files changed, 5939 insertions, 8231 deletions
diff --git a/release/Makefile b/release/Makefile
index 809ac548724..bef76b349b2 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -16,7 +16,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
@@ -114,8 +114,8 @@ install: package
ifneq ($(OS), darwin)
@[ ! -d $(OCGDIR)/bin/.blender ] || \
cp -r $(OCGDIR)/bin/.blender $(DISTDIR)
- @cp $(NANBLENDERHOME)/bin/.blender/.Blanguages $(CONFDIR)
- @cp $(NANBLENDERHOME)/bin/.blender/.bfont.ttf $(CONFDIR)
+ @cp $(NANBLENDERHOME)/release/bin/.blender/.Blanguages $(CONFDIR)
+ @cp $(NANBLENDERHOME)/release/bin/.blender/.bfont.ttf $(CONFDIR)
endif
@echo "----> Copy blender$(EXT0) executable"
ifeq ($(TYPE),-static)
diff --git a/release/VERSION b/release/VERSION
index 49d0a5da421..c43732bd65a 100644
--- a/release/VERSION
+++ b/release/VERSION
@@ -1 +1 @@
-2.5-alpha2
+2.5-beta
diff --git a/release/bin/.blender/.Blanguages b/release/bin/.blender/.Blanguages
new file mode 100644
index 00000000000..9f3b3ef80dc
--- /dev/null
+++ b/release/bin/.blender/.Blanguages
@@ -0,0 +1,23 @@
+English:en_US
+Japanese:ja_JP
+Dutch:nl_NL
+Italian:it_IT
+German:de_DE
+Finnish:fi_FI
+Swedish:sv_SE
+French:fr_FR
+Spanish:es_ES
+Catalan:ca_ES
+Czech:cs_CZ
+Brazilian Portuguese:pt_BR
+Simplified Chinese:zh_CN
+Russian:ru_RU
+Croatian:hr_HR
+Serbian:sr
+Ukrainian:uk_UA
+Polish:pl_PL
+Romanian:ro
+Arabic:ar
+Bulgarian:bg
+Greek:el
+Korean:ko
diff --git a/release/bin/.blender/.bfont.ttf b/release/bin/.blender/.bfont.ttf
new file mode 100644
index 00000000000..58cd6b5e61e
--- /dev/null
+++ b/release/bin/.blender/.bfont.ttf
Binary files differ
diff --git a/release/bin/blender-thumbnailer.py b/release/bin/blender-thumbnailer.py
new file mode 100755
index 00000000000..27d6259d172
--- /dev/null
+++ b/release/bin/blender-thumbnailer.py
@@ -0,0 +1,131 @@
+#!/usr/bin/python
+
+# ##### 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 #####
+
+"""
+Thumbnailer runs with python 2.6 and 3.x.
+To run automatically with nautilus:
+ gconftool --type boolean --set /desktop/gnome/thumbnailers/application@x-blender/enable true
+ gconftool --type string --set /desktop/gnome/thumbnailers/application@x-blender/command "blender-thumbnailer.py %i %o"
+"""
+
+import struct
+
+def blend_extract_thumb(path):
+ import os
+
+ # def MAKE_ID(tag): ord(tag[0])<<24 | ord(tag[1])<<16 | ord(tag[2])<<8 | ord(tag[3])
+ REND = 1145980242 # MAKE_ID(b'REND')
+ TEST = 1414743380 # MAKE_ID(b'TEST')
+
+ blendfile = open(path, 'rb')
+
+ head = blendfile.read(12)
+
+ if head[0:2] == b'\x1f\x8b': # gzip magic
+ import gzip
+ blendfile.close()
+ blendfile = gzip.open(path, 'rb')
+ head = blendfile.read(12)
+
+ if not head.startswith(b'BLENDER'):
+ blendfile.close()
+ return None, 0, 0
+
+ is_64_bit = (head[7] == b'-')
+
+ # true for PPC, false for X86
+ is_big_endian = (head[8] == b'V')
+
+ # blender pre 2.5 had no thumbs
+ if head[9:11] <= b'24':
+ return None, 0, 0
+
+ sizeof_bhead = 24 if is_64_bit else 20
+ int_endian_pair = '>ii' if is_big_endian else '<ii'
+
+ while True:
+ bhead = blendfile.read(sizeof_bhead)
+
+ if len(bhead) < sizeof_bhead:
+ return None, 0, 0
+
+ code, length = struct.unpack(int_endian_pair, bhead[0:8]) # 8 == sizeof(int) * 2
+
+ if code == REND:
+ blendfile.seek(length, os.SEEK_CUR)
+ else:
+ break
+
+
+ if code != TEST:
+ return None, 0, 0
+
+ try:
+ x, y = struct.unpack(int_endian_pair, blendfile.read(8)) # 8 == sizeof(int) * 2
+ except struct.error:
+ return None, 0, 0
+
+ length -= 8 # sizeof(int) * 2
+
+ if length != x * y * 4:
+ return None, 0, 0
+
+ image_buffer = blendfile.read(length)
+
+ if len(image_buffer) != length:
+ return None, 0, 0
+
+ return image_buffer, x, y
+
+
+def write_png(buf, width, height):
+ import zlib
+
+ # reverse the vertical line order and add null bytes at the start
+ width_byte_4 = width * 4
+ raw_data = b"".join([b'\x00' + buf[span:span + width_byte_4] for span in range((height - 1) * width * 4, -1, - width_byte_4)])
+
+ def png_pack(png_tag, data):
+ chunk_head = png_tag + data
+ return struct.pack("!I", len(data)) + chunk_head + struct.pack("!I", 0xFFFFFFFF & zlib.crc32(chunk_head))
+
+ return b"".join([
+ b'\x89PNG\r\n\x1a\n',
+ png_pack(b'IHDR', struct.pack("!2I5B", width, height, 8, 6, 0, 0, 0)),
+ png_pack(b'IDAT', zlib.compress(raw_data, 9)),
+ png_pack(b'IEND', b'')])
+
+
+if __name__ == '__main__':
+ import sys
+
+ if len(sys.argv) < 2:
+ print("Expected 2 arguments <input.blend> <output.png>")
+ else:
+ file_in = sys.argv[-2]
+
+ buf, width, height = blend_extract_thumb(file_in)
+
+ if buf:
+ file_out = sys.argv[-1]
+
+ f = open(file_out, "wb")
+ f.write(write_png(buf, width, height))
+ f.close()
diff --git a/release/datafiles/brushicons/add.png b/release/datafiles/brushicons/add.png
new file mode 100644
index 00000000000..ad041bed130
--- /dev/null
+++ b/release/datafiles/brushicons/add.png
Binary files differ
diff --git a/release/datafiles/brushicons/blob.png b/release/datafiles/brushicons/blob.png
new file mode 100644
index 00000000000..1d63d1e873c
--- /dev/null
+++ b/release/datafiles/brushicons/blob.png
Binary files differ
diff --git a/release/datafiles/brushicons/blur.png b/release/datafiles/brushicons/blur.png
new file mode 100644
index 00000000000..6b8fc4b6053
--- /dev/null
+++ b/release/datafiles/brushicons/blur.png
Binary files differ
diff --git a/release/datafiles/brushicons/clay.png b/release/datafiles/brushicons/clay.png
new file mode 100644
index 00000000000..dab73b7cbdd
--- /dev/null
+++ b/release/datafiles/brushicons/clay.png
Binary files differ
diff --git a/release/datafiles/brushicons/clone.png b/release/datafiles/brushicons/clone.png
new file mode 100644
index 00000000000..89677961d81
--- /dev/null
+++ b/release/datafiles/brushicons/clone.png
Binary files differ
diff --git a/release/datafiles/brushicons/crease.png b/release/datafiles/brushicons/crease.png
new file mode 100644
index 00000000000..ac057e081c1
--- /dev/null
+++ b/release/datafiles/brushicons/crease.png
Binary files differ
diff --git a/release/datafiles/brushicons/darken.png b/release/datafiles/brushicons/darken.png
new file mode 100644
index 00000000000..ee312c7a04f
--- /dev/null
+++ b/release/datafiles/brushicons/darken.png
Binary files differ
diff --git a/release/datafiles/brushicons/draw.png b/release/datafiles/brushicons/draw.png
new file mode 100644
index 00000000000..2cbc8052312
--- /dev/null
+++ b/release/datafiles/brushicons/draw.png
Binary files differ
diff --git a/release/datafiles/brushicons/fill.png b/release/datafiles/brushicons/fill.png
new file mode 100644
index 00000000000..654ec7b66fc
--- /dev/null
+++ b/release/datafiles/brushicons/fill.png
Binary files differ
diff --git a/release/datafiles/brushicons/flatten.png b/release/datafiles/brushicons/flatten.png
new file mode 100644
index 00000000000..401226be862
--- /dev/null
+++ b/release/datafiles/brushicons/flatten.png
Binary files differ
diff --git a/release/datafiles/brushicons/grab.png b/release/datafiles/brushicons/grab.png
new file mode 100644
index 00000000000..d3ebbef31ad
--- /dev/null
+++ b/release/datafiles/brushicons/grab.png
Binary files differ
diff --git a/release/datafiles/brushicons/inflate.png b/release/datafiles/brushicons/inflate.png
new file mode 100644
index 00000000000..f3ad313add8
--- /dev/null
+++ b/release/datafiles/brushicons/inflate.png
Binary files differ
diff --git a/release/datafiles/brushicons/layer.png b/release/datafiles/brushicons/layer.png
new file mode 100644
index 00000000000..df3b02fb766
--- /dev/null
+++ b/release/datafiles/brushicons/layer.png
Binary files differ
diff --git a/release/datafiles/brushicons/lighten.png b/release/datafiles/brushicons/lighten.png
new file mode 100644
index 00000000000..6dacf6dcc75
--- /dev/null
+++ b/release/datafiles/brushicons/lighten.png
Binary files differ
diff --git a/release/datafiles/brushicons/mix.png b/release/datafiles/brushicons/mix.png
new file mode 100644
index 00000000000..d871d241769
--- /dev/null
+++ b/release/datafiles/brushicons/mix.png
Binary files differ
diff --git a/release/datafiles/brushicons/multiply.png b/release/datafiles/brushicons/multiply.png
new file mode 100644
index 00000000000..2dd32463627
--- /dev/null
+++ b/release/datafiles/brushicons/multiply.png
Binary files differ
diff --git a/release/datafiles/brushicons/nudge.png b/release/datafiles/brushicons/nudge.png
new file mode 100644
index 00000000000..84964e91f30
--- /dev/null
+++ b/release/datafiles/brushicons/nudge.png
Binary files differ
diff --git a/release/datafiles/brushicons/pinch.png b/release/datafiles/brushicons/pinch.png
new file mode 100644
index 00000000000..b60bcd66a36
--- /dev/null
+++ b/release/datafiles/brushicons/pinch.png
Binary files differ
diff --git a/release/datafiles/brushicons/scrape.png b/release/datafiles/brushicons/scrape.png
new file mode 100644
index 00000000000..9b7a57c1b9f
--- /dev/null
+++ b/release/datafiles/brushicons/scrape.png
Binary files differ
diff --git a/release/datafiles/brushicons/smear.png b/release/datafiles/brushicons/smear.png
new file mode 100644
index 00000000000..4cdc2205c46
--- /dev/null
+++ b/release/datafiles/brushicons/smear.png
Binary files differ
diff --git a/release/datafiles/brushicons/smooth.png b/release/datafiles/brushicons/smooth.png
new file mode 100644
index 00000000000..052e2452d13
--- /dev/null
+++ b/release/datafiles/brushicons/smooth.png
Binary files differ
diff --git a/release/datafiles/brushicons/snake_hook.png b/release/datafiles/brushicons/snake_hook.png
new file mode 100644
index 00000000000..f8351d909ee
--- /dev/null
+++ b/release/datafiles/brushicons/snake_hook.png
Binary files differ
diff --git a/release/datafiles/brushicons/soften.png b/release/datafiles/brushicons/soften.png
new file mode 100644
index 00000000000..2b2e9116f30
--- /dev/null
+++ b/release/datafiles/brushicons/soften.png
Binary files differ
diff --git a/release/datafiles/brushicons/subtract.png b/release/datafiles/brushicons/subtract.png
new file mode 100644
index 00000000000..c28975ecf20
--- /dev/null
+++ b/release/datafiles/brushicons/subtract.png
Binary files differ
diff --git a/release/datafiles/brushicons/texdraw.png b/release/datafiles/brushicons/texdraw.png
new file mode 100644
index 00000000000..1241349a15e
--- /dev/null
+++ b/release/datafiles/brushicons/texdraw.png
Binary files differ
diff --git a/release/datafiles/brushicons/thumb.png b/release/datafiles/brushicons/thumb.png
new file mode 100644
index 00000000000..8c39075fc8a
--- /dev/null
+++ b/release/datafiles/brushicons/thumb.png
Binary files differ
diff --git a/release/datafiles/brushicons/twist.png b/release/datafiles/brushicons/twist.png
new file mode 100644
index 00000000000..53904427660
--- /dev/null
+++ b/release/datafiles/brushicons/twist.png
Binary files differ
diff --git a/release/datafiles/brushicons/vertexdraw.png b/release/datafiles/brushicons/vertexdraw.png
new file mode 100644
index 00000000000..8bd2dc1be8a
--- /dev/null
+++ b/release/datafiles/brushicons/vertexdraw.png
Binary files differ
diff --git a/release/datafiles/splash.png b/release/datafiles/splash.png
index 78a44ba9cb5..89e195937bc 100644
--- a/release/datafiles/splash.png
+++ b/release/datafiles/splash.png
Binary files differ
diff --git a/release/plugins/Makefile b/release/plugins/Makefile
index 3ed2ee2161e..ee7086b331d 100644
--- a/release/plugins/Makefile
+++ b/release/plugins/Makefile
@@ -15,7 +15,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
diff --git a/release/plugins/bmake b/release/plugins/bmake
index f03e9270011..9740bfa716a 100644
--- a/release/plugins/bmake
+++ b/release/plugins/bmake
@@ -16,7 +16,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
diff --git a/release/plugins/sequence/Makefile b/release/plugins/sequence/Makefile
index 0e1463fae7f..ab847adf5fe 100644
--- a/release/plugins/sequence/Makefile
+++ b/release/plugins/sequence/Makefile
@@ -15,7 +15,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
diff --git a/release/plugins/texture/Makefile b/release/plugins/texture/Makefile
index 0e1463fae7f..ab847adf5fe 100644
--- a/release/plugins/texture/Makefile
+++ b/release/plugins/texture/Makefile
@@ -15,7 +15,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
diff --git a/release/scripts/io/engine_render_pov.py b/release/scripts/io/engine_render_pov.py
deleted file mode 100644
index 9cda4375ecc..00000000000
--- a/release/scripts/io/engine_render_pov.py
+++ /dev/null
@@ -1,1001 +0,0 @@
-# ##### 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 #####
-
-# <pep8 compliant>
-
-import bpy
-
-from math import atan, pi, degrees
-import subprocess
-import os
-import sys
-import time
-
-import platform as pltfrm
-
-if pltfrm.architecture()[0] == '64bit':
- bitness = 64
-else:
- bitness = 32
-
-
-def write_pov(filename, scene=None, info_callback=None):
- file = open(filename, 'w')
-
- # Only for testing
- if not scene:
- scene = bpy.data.scenes[0]
-
- render = scene.render
- world = scene.world
-
- def uniqueName(name, nameSeq):
-
- if name not in nameSeq:
- return name
-
- name_orig = name
- i = 1
- while name in nameSeq:
- name = '%s_%.3d' % (name_orig, i)
- i += 1
-
- return name
-
- def writeMatrix(matrix):
- file.write('\tmatrix <%.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f>\n' %\
- (matrix[0][0], matrix[0][1], matrix[0][2], matrix[1][0], matrix[1][1], matrix[1][2], matrix[2][0], matrix[2][1], matrix[2][2], matrix[3][0], matrix[3][1], matrix[3][2]))
-
- def writeObjectMaterial(material):
- if material and material.transparency_method == 'RAYTRACE':
- file.write('\tinterior { ior %.6f }\n' % material.raytrace_transparency.ior)
-
- # Other interior args
- # fade_distance 2
- # fade_power [Value]
- # fade_color
-
- # dispersion
- # dispersion_samples
-
- materialNames = {}
- DEF_MAT_NAME = 'Default'
-
- def writeMaterial(material):
- # Assumes only called once on each material
-
- if material:
- name_orig = material.name
- else:
- name_orig = DEF_MAT_NAME
-
- name = materialNames[name_orig] = uniqueName(bpy.utils.clean_name(name_orig), materialNames)
-
- file.write('#declare %s = finish {\n' % name)
-
- if material:
- file.write('\tdiffuse %.3g\n' % material.diffuse_intensity)
- file.write('\tspecular %.3g\n' % material.specular_intensity)
-
- file.write('\tambient %.3g\n' % material.ambient)
- #file.write('\tambient rgb <%.3g, %.3g, %.3g>\n' % tuple([c*material.ambient for c in world.ambient_color])) # povray blends the global value
-
- # map hardness between 0.0 and 1.0
- roughness = ((1.0 - ((material.specular_hardness - 1.0) / 510.0)))
- # scale from 0.0 to 0.1
- roughness *= 0.1
- # add a small value because 0.0 is invalid
- roughness += (1 / 511.0)
-
- file.write('\troughness %.3g\n' % roughness)
-
- # 'phong 70.0 '
-
- if material.raytrace_mirror.enabled:
- raytrace_mirror = material.raytrace_mirror
- if raytrace_mirror.reflect_factor:
- file.write('\treflection {\n')
- file.write('\t\trgb <%.3g, %.3g, %.3g>' % tuple(material.mirror_color))
- file.write('\t\tfresnel 1 falloff %.3g exponent %.3g metallic %.3g} ' % (raytrace_mirror.fresnel, raytrace_mirror.fresnel_factor, raytrace_mirror.reflect_factor))
-
- else:
- file.write('\tdiffuse 0.8\n')
- file.write('\tspecular 0.2\n')
-
-
- # This is written into the object
- '''
- if material and material.transparency_method=='RAYTRACE':
- 'interior { ior %.3g} ' % material.raytrace_transparency.ior
- '''
-
- #file.write('\t\t\tcrand 1.0\n') # Sand granyness
- #file.write('\t\t\tmetallic %.6f\n' % material.spec)
- #file.write('\t\t\tphong %.6f\n' % material.spec)
- #file.write('\t\t\tphong_size %.6f\n' % material.spec)
- #file.write('\t\t\tbrilliance %.6f ' % (material.specular_hardness/256.0) # Like hardness
-
- file.write('}\n')
-
- def exportCamera():
- camera = scene.camera
- matrix = camera.matrix_world
-
- # compute resolution
- Qsize = float(render.resolution_x) / float(render.resolution_y)
-
- file.write('camera {\n')
- file.write('\tlocation <0, 0, 0>\n')
- file.write('\tlook_at <0, 0, -1>\n')
- file.write('\tright <%s, 0, 0>\n' % - Qsize)
- file.write('\tup <0, 1, 0>\n')
- file.write('\tangle %f \n' % (360.0 * atan(16.0 / camera.data.lens) / pi))
-
- file.write('\trotate <%.6f, %.6f, %.6f>\n' % tuple([degrees(e) for e in matrix.rotation_part().to_euler()]))
- file.write('\ttranslate <%.6f, %.6f, %.6f>\n' % (matrix[3][0], matrix[3][1], matrix[3][2]))
- file.write('}\n')
-
- def exportLamps(lamps):
- # Get all lamps
- for ob in lamps:
- lamp = ob.data
-
- matrix = ob.matrix_world
-
- color = tuple([c * lamp.energy for c in lamp.color]) # Colour is modified by energy
-
- file.write('light_source {\n')
- file.write('\t< 0,0,0 >\n')
- file.write('\tcolor rgb<%.3g, %.3g, %.3g>\n' % color)
-
- if lamp.type == 'POINT': # Point Lamp
- pass
- elif lamp.type == 'SPOT': # Spot
- file.write('\tspotlight\n')
-
- # Falloff is the main radius from the centre line
- file.write('\tfalloff %.2f\n' % (degrees(lamp.spot_size) / 2.0)) # 1 TO 179 FOR BOTH
- file.write('\tradius %.6f\n' % ((degrees(lamp.spot_size) / 2.0) * (1.0 - lamp.spot_blend)))
-
- # Blender does not have a tightness equivilent, 0 is most like blender default.
- file.write('\ttightness 0\n') # 0:10f
-
- file.write('\tpoint_at <0, 0, -1>\n')
- elif lamp.type == 'SUN':
- file.write('\tparallel\n')
- file.write('\tpoint_at <0, 0, -1>\n') # *must* be after 'parallel'
-
- elif lamp.type == 'AREA':
-
- size_x = lamp.size
- samples_x = lamp.shadow_ray_samples_x
- if lamp.shape == 'SQUARE':
- size_y = size_x
- samples_y = samples_x
- else:
- size_y = lamp.size_y
- samples_y = lamp.shadow_ray_samples_y
-
- file.write('\tarea_light <%d,0,0>,<0,0,%d> %d, %d\n' % (size_x, size_y, samples_x, samples_y))
- if lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
- if lamp.jitter:
- file.write('\tjitter\n')
- else:
- file.write('\tadaptive 1\n')
- file.write('\tjitter\n')
-
- if lamp.shadow_method == 'NOSHADOW':
- file.write('\tshadowless\n')
-
- file.write('\tfade_distance %.6f\n' % lamp.distance)
- file.write('\tfade_power %d\n' % 1) # Could use blenders lamp quad?
- writeMatrix(matrix)
-
- file.write('}\n')
-
- def exportMeta(metas):
-
- # TODO - blenders 'motherball' naming is not supported.
-
- for ob in metas:
- meta = ob.data
-
- file.write('blob {\n')
- file.write('\t\tthreshold %.4g\n' % meta.threshold)
-
- try:
- material = meta.materials[0] # lame! - blender cant do enything else.
- except:
- material = None
-
- for elem in meta.elements:
-
- if elem.type not in ('BALL', 'ELLIPSOID'):
- continue # Not supported
-
- loc = elem.location
-
- stiffness = elem.stiffness
- if elem.negative:
- stiffness = - stiffness
-
- if elem.type == 'BALL':
-
- file.write('\tsphere { <%.6g, %.6g, %.6g>, %.4g, %.4g ' % (loc.x, loc.y, loc.z, elem.radius, stiffness))
-
- # After this wecould do something simple like...
- # "pigment {Blue} }"
- # except we'll write the color
-
- elif elem.type == 'ELLIPSOID':
- # location is modified by scale
- file.write('\tsphere { <%.6g, %.6g, %.6g>, %.4g, %.4g ' % (loc.x / elem.size_x, loc.y / elem.size_y, loc.z / elem.size_z, elem.radius, stiffness))
- file.write('scale <%.6g, %.6g, %.6g> ' % (elem.size_x, elem.size_y, elem.size_z))
-
- if material:
- diffuse_color = material.diffuse_color
-
- if material.transparency and material.transparency_method == 'RAYTRACE':
- trans = 1.0 - material.raytrace_transparency.filter
- else:
- trans = 0.0
-
- file.write('pigment {rgbft<%.3g, %.3g, %.3g, %.3g, %.3g>} finish {%s} }\n' % \
- (diffuse_color[0], diffuse_color[1], diffuse_color[2], 1.0 - material.alpha, trans, materialNames[material.name]))
-
- else:
- file.write('pigment {rgb<1 1 1>} finish {%s} }\n' % DEF_MAT_NAME) # Write the finish last.
-
- writeObjectMaterial(material)
-
- writeMatrix(ob.matrix_world)
-
- file.write('}\n')
-
- def exportMeshs(scene, sel):
-
- ob_num = 0
-
- for ob in sel:
- ob_num += 1
-
- if ob.type in ('LAMP', 'CAMERA', 'EMPTY', 'META', 'ARMATURE'):
- continue
-
- me = ob.data
- me_materials = me.materials
-
- me = ob.create_mesh(scene, True, 'RENDER')
-
- if not me:
- continue
-
- if info_callback:
- info_callback('Object %2.d of %2.d (%s)' % (ob_num, len(sel), ob.name))
-
- #if ob.type!='MESH':
- # continue
- # me = ob.data
-
- matrix = ob.matrix_world
- try:
- uv_layer = me.active_uv_texture.data
- except:
- uv_layer = None
-
- try:
- vcol_layer = me.active_vertex_color.data
- except:
- vcol_layer = None
-
- faces_verts = [f.verts for f in me.faces]
- faces_normals = [tuple(f.normal) for f in me.faces]
- verts_normals = [tuple(v.normal) for v in me.verts]
-
- # quads incur an extra face
- quadCount = len([f for f in faces_verts if len(f) == 4])
-
- file.write('mesh2 {\n')
- file.write('\tvertex_vectors {\n')
- file.write('\t\t%s' % (len(me.verts))) # vert count
- for v in me.verts:
- file.write(',\n\t\t<%.6f, %.6f, %.6f>' % tuple(v.co)) # vert count
- file.write('\n }\n')
-
-
- # Build unique Normal list
- uniqueNormals = {}
- for fi, f in enumerate(me.faces):
- fv = faces_verts[fi]
- # [-1] is a dummy index, use a list so we can modify in place
- if f.smooth: # Use vertex normals
- for v in fv:
- key = verts_normals[v]
- uniqueNormals[key] = [-1]
- else: # Use face normal
- key = faces_normals[fi]
- uniqueNormals[key] = [-1]
-
- file.write('\tnormal_vectors {\n')
- file.write('\t\t%d' % len(uniqueNormals)) # vert count
- idx = 0
- for no, index in uniqueNormals.items():
- file.write(',\n\t\t<%.6f, %.6f, %.6f>' % no) # vert count
- index[0] = idx
- idx += 1
- file.write('\n }\n')
-
-
- # Vertex colours
- vertCols = {} # Use for material colours also.
-
- if uv_layer:
- # Generate unique UV's
- uniqueUVs = {}
-
- for fi, uv in enumerate(uv_layer):
-
- if len(faces_verts[fi]) == 4:
- uvs = uv.uv1, uv.uv2, uv.uv3, uv.uv4
- else:
- uvs = uv.uv1, uv.uv2, uv.uv3
-
- for uv in uvs:
- uniqueUVs[tuple(uv)] = [-1]
-
- file.write('\tuv_vectors {\n')
- #print unique_uvs
- file.write('\t\t%s' % (len(uniqueUVs))) # vert count
- idx = 0
- for uv, index in uniqueUVs.items():
- file.write(',\n\t\t<%.6f, %.6f>' % uv)
- index[0] = idx
- idx += 1
- '''
- else:
- # Just add 1 dummy vector, no real UV's
- file.write('\t\t1') # vert count
- file.write(',\n\t\t<0.0, 0.0>')
- '''
- file.write('\n }\n')
-
-
- if me.vertex_colors:
-
- for fi, f in enumerate(me.faces):
- material_index = f.material_index
- material = me_materials[material_index]
-
- if material and material.vertex_color_paint:
-
- col = vcol_layer[fi]
-
- if len(faces_verts[fi]) == 4:
- cols = col.color1, col.color2, col.color3, col.color4
- else:
- cols = col.color1, col.color2, col.color3
-
- for col in cols:
- key = col[0], col[1], col[2], material_index # Material index!
- vertCols[key] = [-1]
-
- else:
- if material:
- diffuse_color = tuple(material.diffuse_color)
- key = diffuse_color[0], diffuse_color[1], diffuse_color[2], material_index
- vertCols[key] = [-1]
-
-
- else:
- # No vertex colours, so write material colours as vertex colours
- for i, material in enumerate(me_materials):
-
- if material:
- diffuse_color = tuple(material.diffuse_color)
- key = diffuse_color[0], diffuse_color[1], diffuse_color[2], i # i == f.mat
- vertCols[key] = [-1]
-
-
- # Vert Colours
- file.write('\ttexture_list {\n')
- file.write('\t\t%s' % (len(vertCols))) # vert count
- idx = 0
- for col, index in vertCols.items():
-
- if me_materials:
- material = me_materials[col[3]]
- material_finish = materialNames[material.name]
-
- if material.transparency and material.transparency_method == 'RAYTRACE':
- trans = 1.0 - material.raytrace_transparency.filter
- else:
- trans = 0.0
-
- else:
- material_finish = DEF_MAT_NAME # not working properly,
- trans = 0.0
-
- #print material.apl
- file.write(',\n\t\ttexture { pigment {rgbft<%.3g, %.3g, %.3g, %.3g, %.3g>} finish {%s}}' %
- (col[0], col[1], col[2], 1.0 - material.alpha, trans, material_finish))
-
- index[0] = idx
- idx += 1
-
- file.write('\n }\n')
-
- # Face indicies
- file.write('\tface_indices {\n')
- file.write('\t\t%d' % (len(me.faces) + quadCount)) # faces count
- for fi, f in enumerate(me.faces):
- fv = faces_verts[fi]
- material_index = f.material_index
- if len(fv) == 4:
- indicies = (0, 1, 2), (0, 2, 3)
- else:
- indicies = ((0, 1, 2),)
-
- if vcol_layer:
- col = vcol_layer[fi]
-
- if len(fv) == 4:
- cols = col.color1, col.color2, col.color3, col.color4
- else:
- cols = col.color1, col.color2, col.color3
-
-
- if not me_materials or me_materials[material_index] == None: # No materials
- for i1, i2, i3 in indicies:
- file.write(',\n\t\t<%d,%d,%d>' % (fv[i1], fv[i2], fv[i3])) # vert count
- else:
- material = me_materials[material_index]
- for i1, i2, i3 in indicies:
- if me.vertex_colors and material.vertex_color_paint:
- # Colour per vertex - vertex colour
-
- col1 = cols[i1]
- col2 = cols[i2]
- col3 = cols[i3]
-
- ci1 = vertCols[col1[0], col1[1], col1[2], material_index][0]
- ci2 = vertCols[col2[0], col2[1], col2[2], material_index][0]
- ci3 = vertCols[col3[0], col3[1], col3[2], material_index][0]
- else:
- # Colour per material - flat material colour
- diffuse_color = material.diffuse_color
- ci1 = ci2 = ci3 = vertCols[diffuse_color[0], diffuse_color[1], diffuse_color[2], f.material_index][0]
-
- file.write(',\n\t\t<%d,%d,%d>, %d,%d,%d' % (fv[i1], fv[i2], fv[i3], ci1, ci2, ci3)) # vert count
-
-
- file.write('\n }\n')
-
- # normal_indices indicies
- file.write('\tnormal_indices {\n')
- file.write('\t\t%d' % (len(me.faces) + quadCount)) # faces count
- for fi, fv in enumerate(faces_verts):
-
- if len(fv) == 4:
- indicies = (0, 1, 2), (0, 2, 3)
- else:
- indicies = ((0, 1, 2),)
-
- for i1, i2, i3 in indicies:
- if f.smooth:
- file.write(',\n\t\t<%d,%d,%d>' %\
- (uniqueNormals[verts_normals[fv[i1]]][0],\
- uniqueNormals[verts_normals[fv[i2]]][0],\
- uniqueNormals[verts_normals[fv[i3]]][0])) # vert count
- else:
- idx = uniqueNormals[faces_normals[fi]][0]
- file.write(',\n\t\t<%d,%d,%d>' % (idx, idx, idx)) # vert count
-
- file.write('\n }\n')
-
- if uv_layer:
- file.write('\tuv_indices {\n')
- file.write('\t\t%d' % (len(me.faces) + quadCount)) # faces count
- for fi, fv in enumerate(faces_verts):
-
- if len(fv) == 4:
- indicies = (0, 1, 2), (0, 2, 3)
- else:
- indicies = ((0, 1, 2),)
-
- uv = uv_layer[fi]
- if len(faces_verts[fi]) == 4:
- uvs = tuple(uv.uv1), tuple(uv.uv2), tuple(uv.uv3), tuple(uv.uv4)
- else:
- uvs = tuple(uv.uv1), tuple(uv.uv2), tuple(uv.uv3)
-
- for i1, i2, i3 in indicies:
- file.write(',\n\t\t<%d,%d,%d>' %\
- (uniqueUVs[uvs[i1]][0],\
- uniqueUVs[uvs[i2]][0],\
- uniqueUVs[uvs[i2]][0])) # vert count
- file.write('\n }\n')
-
- if me.materials:
- material = me.materials[0] # dodgy
- writeObjectMaterial(material)
-
- writeMatrix(matrix)
- file.write('}\n')
-
- bpy.data.meshes.remove(me)
-
- def exportWorld(world):
- if not world:
- return
-
- mist = world.mist
-
- if mist.use_mist:
- file.write('fog {\n')
- file.write('\tdistance %.6f\n' % mist.depth)
- file.write('\tcolor rgbt<%.3g, %.3g, %.3g, %.3g>\n' % (tuple(world.horizon_color) + (1 - mist.intensity,)))
- #file.write('\tfog_offset %.6f\n' % mist.start)
- #file.write('\tfog_alt 5\n')
- #file.write('\tturbulence 0.2\n')
- #file.write('\tturb_depth 0.3\n')
- file.write('\tfog_type 1\n')
- file.write('}\n')
-
- def exportGlobalSettings(scene):
-
- file.write('global_settings {\n')
-
- if scene.pov_radio_enable:
- file.write('\tradiosity {\n')
- file.write("\t\tadc_bailout %.4g\n" % scene.pov_radio_adc_bailout)
- file.write("\t\talways_sample %d\n" % scene.pov_radio_always_sample)
- file.write("\t\tbrightness %.4g\n" % scene.pov_radio_brightness)
- file.write("\t\tcount %d\n" % scene.pov_radio_count)
- file.write("\t\terror_bound %.4g\n" % scene.pov_radio_error_bound)
- file.write("\t\tgray_threshold %.4g\n" % scene.pov_radio_gray_threshold)
- file.write("\t\tlow_error_factor %.4g\n" % scene.pov_radio_low_error_factor)
- file.write("\t\tmedia %d\n" % scene.pov_radio_media)
- file.write("\t\tminimum_reuse %.4g\n" % scene.pov_radio_minimum_reuse)
- file.write("\t\tnearest_count %d\n" % scene.pov_radio_nearest_count)
- file.write("\t\tnormal %d\n" % scene.pov_radio_normal)
- file.write("\t\trecursion_limit %d\n" % scene.pov_radio_recursion_limit)
- file.write('\t}\n')
-
- if world:
- file.write("\tambient_light rgb<%.3g, %.3g, %.3g>\n" % tuple(world.ambient_color))
-
- file.write('}\n')
-
-
- # Convert all materials to strings we can access directly per vertex.
- writeMaterial(None) # default material
-
- for material in bpy.data.materials:
- writeMaterial(material)
-
- exportCamera()
- #exportMaterials()
- sel = scene.objects
- exportLamps([l for l in sel if l.type == 'LAMP'])
- exportMeta([l for l in sel if l.type == 'META'])
- exportMeshs(scene, sel)
- exportWorld(scene.world)
- exportGlobalSettings(scene)
-
- file.close()
-
-
-def write_pov_ini(filename_ini, filename_pov, filename_image):
- scene = bpy.data.scenes[0]
- render = scene.render
-
- x = int(render.resolution_x * render.resolution_percentage * 0.01)
- y = int(render.resolution_y * render.resolution_percentage * 0.01)
-
- file = open(filename_ini, 'w')
-
- file.write('Input_File_Name="%s"\n' % filename_pov)
- file.write('Output_File_Name="%s"\n' % filename_image)
-
- file.write('Width=%d\n' % x)
- file.write('Height=%d\n' % y)
-
- # Needed for border render.
- '''
- file.write('Start_Column=%d\n' % part.x)
- file.write('End_Column=%d\n' % (part.x+part.w))
-
- file.write('Start_Row=%d\n' % (part.y))
- file.write('End_Row=%d\n' % (part.y+part.h))
- '''
-
- file.write('Display=0\n')
- file.write('Pause_When_Done=0\n')
- file.write('Output_File_Type=T\n') # TGA, best progressive loading
- file.write('Output_Alpha=1\n')
-
- if render.render_antialiasing:
- aa_mapping = {'5': 2, '8': 3, '11': 4, '16': 5} # method 1 assumed
- file.write('Antialias=1\n')
- file.write('Antialias_Depth=%d\n' % aa_mapping[render.antialiasing_samples])
- else:
- file.write('Antialias=0\n')
-
- file.close()
-
-# Radiosity panel, use in the scene for now.
-FloatProperty = bpy.types.Scene.FloatProperty
-IntProperty = bpy.types.Scene.IntProperty
-BoolProperty = bpy.types.Scene.BoolProperty
-
-# Not a real pov option, just to know if we should write
-BoolProperty(attr="pov_radio_enable",
- name="Enable Radiosity",
- description="Enable povrays radiosity calculation",
- default=False)
-BoolProperty(attr="pov_radio_display_advanced",
- name="Advanced Options",
- description="Show advanced options",
- default=False)
-
-# Real pov options
-FloatProperty(attr="pov_radio_adc_bailout",
- name="ADC Bailout",
- description="The adc_bailout for radiosity rays. Use adc_bailout = 0.01 / brightest_ambient_object for good results",
- min=0.0, max=1000.0, soft_min=0.0, soft_max=1.0, default=0.01)
-
-BoolProperty(attr="pov_radio_always_sample",
- name="Always Sample",
- description="Only use the data from the pretrace step and not gather any new samples during the final radiosity pass",
- default=True)
-
-FloatProperty(attr="pov_radio_brightness",
- name="Brightness",
- description="Amount objects are brightened before being returned upwards to the rest of the system",
- min=0.0, max=1000.0, soft_min=0.0, soft_max=10.0, default=1.0)
-
-IntProperty(attr="pov_radio_count",
- name="Ray Count",
- description="Number of rays that are sent out whenever a new radiosity value has to be calculated",
- min=1, max=1600, default=35)
-
-FloatProperty(attr="pov_radio_error_bound",
- name="Error Bound",
- description="One of the two main speed/quality tuning values, lower values are more accurate",
- min=0.0, max=1000.0, soft_min=0.1, soft_max=10.0, default=1.8)
-
-FloatProperty(attr="pov_radio_gray_threshold",
- name="Gray Threshold",
- description="One of the two main speed/quality tuning values, lower values are more accurate",
- min=0.0, max=1.0, soft_min=0, soft_max=1, default=0.0)
-
-FloatProperty(attr="pov_radio_low_error_factor",
- name="Low Error Factor",
- description="If you calculate just enough samples, but no more, you will get an image which has slightly blotchy lighting",
- min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=0.5)
-
-# max_sample - not available yet
-BoolProperty(attr="pov_radio_media",
- name="Media",
- description="Radiosity estimation can be affected by media",
- default=False)
-
-FloatProperty(attr="pov_radio_minimum_reuse",
- name="Minimum Reuse",
- description="Fraction of the screen width which sets the minimum radius of reuse for each sample point (At values higher than 2% expect errors)",
- min=0.0, max=1.0, soft_min=0.1, soft_max=0.1, default=0.015)
-
-IntProperty(attr="pov_radio_nearest_count",
- name="Nearest Count",
- description="Number of old ambient values blended together to create a new interpolated value",
- min=1, max=20, default=5)
-
-BoolProperty(attr="pov_radio_normal",
- name="Normals",
- description="Radiosity estimation can be affected by normals",
- default=False)
-
-IntProperty(attr="pov_radio_recursion_limit",
- name="Recursion Limit",
- description="how many recursion levels are used to calculate the diffuse inter-reflection",
- min=1, max=20, default=3)
-
-
-class PovrayRender(bpy.types.RenderEngine):
- bl_idname = 'POVRAY_RENDER'
- bl_label = "Povray"
- DELAY = 0.02
-
- def _export(self, scene):
- import tempfile
-
- self._temp_file_in = tempfile.mktemp(suffix='.pov')
- self._temp_file_out = tempfile.mktemp(suffix='.tga')
- self._temp_file_ini = tempfile.mktemp(suffix='.ini')
- '''
- self._temp_file_in = '/test.pov'
- self._temp_file_out = '/test.tga'
- self._temp_file_ini = '/test.ini'
- '''
-
- def info_callback(txt):
- self.update_stats("", "POVRAY: " + txt)
-
- write_pov(self._temp_file_in, scene, info_callback)
-
- def _render(self):
-
- try:
- os.remove(self._temp_file_out) # so as not to load the old file
- except:
- pass
-
- write_pov_ini(self._temp_file_ini, self._temp_file_in, self._temp_file_out)
-
- print ("***-STARTING-***")
-
- pov_binary = "povray"
-
- if sys.platform == 'win32':
- import winreg
- regKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, 'Software\\POV-Ray\\v3.6\\Windows')
-
- if bitness == 64:
- pov_binary = winreg.QueryValueEx(regKey, 'Home')[0] + '\\bin\\pvengine64'
- else:
- pov_binary = winreg.QueryValueEx(regKey, 'Home')[0] + '\\bin\\pvengine'
-
- if 1:
- # TODO, when povray isnt found this gives a cryptic error, would be nice to be able to detect if it exists
- try:
- self._process = subprocess.Popen([pov_binary, self._temp_file_ini]) # stdout=subprocess.PIPE, stderr=subprocess.PIPE
- except OSError:
- # TODO, report api
- print("POVRAY: could not execute '%s', possibly povray isn't installed" % pov_binary)
- import traceback
- traceback.print_exc()
- print ("***-DONE-***")
- return False
-
- else:
- # This works too but means we have to wait until its done
- os.system('%s %s' % (pov_binary, self._temp_file_ini))
-
- print ("***-DONE-***")
- return True
-
- def _cleanup(self):
- for f in (self._temp_file_in, self._temp_file_ini, self._temp_file_out):
- try:
- os.remove(f)
- except:
- pass
-
- self.update_stats("", "")
-
- def render(self, scene):
-
- self.update_stats("", "POVRAY: Exporting data from Blender")
- self._export(scene)
- self.update_stats("", "POVRAY: Parsing File")
-
- if not self._render():
- self.update_stats("", "POVRAY: Not found")
- return
-
- r = scene.render
-
- # compute resolution
- x = int(r.resolution_x * r.resolution_percentage * 0.01)
- y = int(r.resolution_y * r.resolution_percentage * 0.01)
-
- # Wait for the file to be created
- while not os.path.exists(self._temp_file_out):
- if self.test_break():
- try:
- self._process.terminate()
- except:
- pass
- break
-
- if self._process.poll() != None:
- self.update_stats("", "POVRAY: Failed")
- break
-
- time.sleep(self.DELAY)
-
- if os.path.exists(self._temp_file_out):
-
- self.update_stats("", "POVRAY: Rendering")
-
- prev_size = -1
-
- def update_image():
- result = self.begin_result(0, 0, x, y)
- lay = result.layers[0]
- # possible the image wont load early on.
- try:
- lay.load_from_file(self._temp_file_out)
- except:
- pass
- self.end_result(result)
-
- # Update while povray renders
- while True:
-
- # test if povray exists
- if self._process.poll() is not None:
- update_image()
- break
-
- # user exit
- if self.test_break():
- try:
- self._process.terminate()
- except:
- pass
-
- break
-
- # Would be nice to redirect the output
- # stdout_value, stderr_value = self._process.communicate() # locks
-
-
- # check if the file updated
- new_size = os.path.getsize(self._temp_file_out)
-
- if new_size != prev_size:
- update_image()
- prev_size = new_size
-
- time.sleep(self.DELAY)
-
- self._cleanup()
-
-
-# Use some of the existing buttons.
-import properties_render
-properties_render.RENDER_PT_render.COMPAT_ENGINES.add('POVRAY_RENDER')
-properties_render.RENDER_PT_dimensions.COMPAT_ENGINES.add('POVRAY_RENDER')
-properties_render.RENDER_PT_antialiasing.COMPAT_ENGINES.add('POVRAY_RENDER')
-properties_render.RENDER_PT_output.COMPAT_ENGINES.add('POVRAY_RENDER')
-del properties_render
-
-# Use only a subset of the world panels
-import properties_world
-properties_world.WORLD_PT_preview.COMPAT_ENGINES.add('POVRAY_RENDER')
-properties_world.WORLD_PT_context_world.COMPAT_ENGINES.add('POVRAY_RENDER')
-properties_world.WORLD_PT_world.COMPAT_ENGINES.add('POVRAY_RENDER')
-properties_world.WORLD_PT_mist.COMPAT_ENGINES.add('POVRAY_RENDER')
-del properties_world
-
-# Example of wrapping every class 'as is'
-import properties_material
-for member in dir(properties_material):
- subclass = getattr(properties_material, member)
- try:
- subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
- except:
- pass
-del properties_material
-import properties_data_mesh
-for member in dir(properties_data_mesh):
- subclass = getattr(properties_data_mesh, member)
- try:
- subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
- except:
- pass
-del properties_data_mesh
-import properties_texture
-for member in dir(properties_texture):
- subclass = getattr(properties_texture, member)
- try:
- subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
- except:
- pass
-del properties_texture
-import properties_data_camera
-for member in dir(properties_data_camera):
- subclass = getattr(properties_data_camera, member)
- try:
- subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
- except:
- pass
-del properties_data_camera
-
-
-class RenderButtonsPanel(bpy.types.Panel):
- bl_space_type = 'PROPERTIES'
- bl_region_type = 'WINDOW'
- bl_context = "render"
- # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
-
- def poll(self, context):
- rd = context.scene.render
- return (rd.use_game_engine == False) and (rd.engine in self.COMPAT_ENGINES)
-
-
-class RENDER_PT_povray_radiosity(RenderButtonsPanel):
- bl_label = "Radiosity"
- COMPAT_ENGINES = {'POVRAY_RENDER'}
-
- def draw_header(self, context):
- scene = context.scene
-
- self.layout.prop(scene, "pov_radio_enable", text="")
-
- def draw(self, context):
- layout = self.layout
-
- scene = context.scene
- rd = scene.render
-
- layout.active = scene.pov_radio_enable
-
- split = layout.split()
-
- col = split.column()
- col.prop(scene, "pov_radio_count", text="Rays")
- col.prop(scene, "pov_radio_recursion_limit", text="Recursions")
- col = split.column()
- col.prop(scene, "pov_radio_error_bound", text="Error")
-
- layout.prop(scene, "pov_radio_display_advanced")
-
- if scene.pov_radio_display_advanced:
- split = layout.split()
-
- col = split.column()
- col.prop(scene, "pov_radio_adc_bailout", slider=True)
- col.prop(scene, "pov_radio_gray_threshold", slider=True)
- col.prop(scene, "pov_radio_low_error_factor", slider=True)
-
- col = split.column()
- col.prop(scene, "pov_radio_brightness")
- col.prop(scene, "pov_radio_minimum_reuse", text="Min Reuse")
- col.prop(scene, "pov_radio_nearest_count")
-
- split = layout.split()
-
- col = split.column()
- col.label(text="Estimation Influence:")
- col.prop(scene, "pov_radio_media")
- col.prop(scene, "pov_radio_normal")
-
- col = split.column()
- col.prop(scene, "pov_radio_always_sample")
-
-
-classes = [
- PovrayRender,
- RENDER_PT_povray_radiosity]
-
-
-def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
-
-
-def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
-
-if __name__ == "__main__":
- register()
diff --git a/release/scripts/io/export_3ds.py b/release/scripts/io/export_3ds.py
index 4fd889c75c6..4a5521bd9e9 100644
--- a/release/scripts/io/export_3ds.py
+++ b/release/scripts/io/export_3ds.py
@@ -564,14 +564,14 @@ def extract_triangles(mesh):
img = None
for i, face in enumerate(mesh.faces):
- f_v = face.verts
+ f_v = face.vertices
# f_v = face.v
uf = mesh.active_uv_texture.data[i] if do_uv else None
if do_uv:
f_uv = uf.uv
- # f_uv = (uf.uv1, uf.uv2, uf.uv3, uf.uv4) if face.verts[3] else (uf.uv1, uf.uv2, uf.uv3)
+ # f_uv = (uf.uv1, uf.uv2, uf.uv3, uf.uv4) if face.vertices[3] else (uf.uv1, uf.uv2, uf.uv3)
# f_uv = face.uv
img = uf.image if uf else None
# img = face.image
@@ -761,18 +761,18 @@ def make_mesh_chunk(mesh, materialDict):
if len(mesh.uv_textures):
# if mesh.faceUV:
# Remove the face UVs and convert it to vertex UV:
- vert_array, uv_array, tri_list = remove_face_uv(mesh.verts, tri_list)
+ vert_array, uv_array, tri_list = remove_face_uv(mesh.vertices, tri_list)
else:
# Add the vertices to the vertex array:
vert_array = _3ds_array()
- for vert in mesh.verts:
+ for vert in mesh.vertices:
vert_array.add(_3ds_point_3d(vert.co))
# If the mesh has vertex UVs, create an array of UVs:
if len(mesh.sticky):
# if mesh.vertexUV:
uv_array = _3ds_array()
for uv in mesh.sticky:
-# for vert in mesh.verts:
+# for vert in mesh.vertices:
uv_array.add(_3ds_point_uv(uv.co))
# uv_array.add(_3ds_point_uv(vert.uvco))
else:
@@ -922,7 +922,7 @@ def make_kf_obj_node(obj, name_to_id):
"""
# import BPyMessages
-def save_3ds(filename, context):
+def write(filename, context):
'''Save the Blender scene to a 3ds file.'''
# Time the export
@@ -941,7 +941,8 @@ def save_3ds(filename, context):
sce = context.scene
# sce= bpy.data.scenes.active
- bpy.ops.object.mode_set(mode='OBJECT')
+ if context.object:
+ bpy.ops.object.mode_set(mode='OBJECT')
# Initialize the main chunk (primary):
primary = _3ds_chunk(PRIMARY)
@@ -1006,7 +1007,7 @@ def save_3ds(filename, context):
mat = mat_ls[mat_index]
if mat: mat_name = mat.name
else: mat_name = None
- # else there alredy set to none
+ # else there already set to none
img = uf.image
# img = f.image
@@ -1064,7 +1065,7 @@ def save_3ds(filename, context):
'''
if not blender_mesh.users:
bpy.data.meshes.remove(blender_mesh)
-# blender_mesh.verts = None
+# blender_mesh.vertices = None
i+=i
@@ -1106,50 +1107,46 @@ def save_3ds(filename, context):
#primary.dump()
-# if __name__=='__main__':
-# if struct:
-# Blender.Window.FileSelector(save_3ds, "Export 3DS", Blender.sys.makename(ext='.3ds'))
-# else:
-# Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
-# # save_3ds('/test_b.3ds')
+# # write('/test_b.3ds')
from bpy.props import *
class Export3DS(bpy.types.Operator):
'''Export to 3DS file format (.3ds)'''
bl_idname = "export.autodesk_3ds"
bl_label = 'Export 3DS'
- # List of operator properties, the attributes will be assigned
- # to the class instance from the operator settings before calling.
-
-
filepath = StringProperty(name="File Path", description="Filepath used for exporting the 3DS file", maxlen= 1024, default= "")
check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
+ @classmethod
+ def poll(cls, context): # Poll isnt working yet
+ return context.active_object != None
+
def execute(self, context):
- save_3ds(self.properties.filepath, context)
+ filepath = self.properties.filepath
+ filepath = bpy.path.ensure_ext(filepath, ".3ds")
+
+ write(filepath, context)
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
- return {'RUNNING_MODAL'}
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".3ds"
- def poll(self, context): # Poll isnt working yet
- return context.active_object != None
+ context.manager.add_fileselect(self)
+ return {'RUNNING_MODAL'}
# Add to a menu
def menu_func(self, context):
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".3ds"
- self.layout.operator(Export3DS.bl_idname, text="3D Studio (.3ds)").filepath = default_path
+ self.layout.operator(Export3DS.bl_idname, text="3D Studio (.3ds)")
def register():
- bpy.types.register(Export3DS)
bpy.types.INFO_MT_file_export.append(menu_func)
+
def unregister():
- bpy.types.unregister(Export3DS)
bpy.types.INFO_MT_file_export.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/io/export_fbx.py b/release/scripts/io/export_fbx.py
index 4505b56b41c..60e9e90e11b 100644
--- a/release/scripts/io/export_fbx.py
+++ b/release/scripts/io/export_fbx.py
@@ -55,7 +55,7 @@ import math # math.pi
import shutil # for file copying
import bpy
-from mathutils import Vector, Euler, Matrix, RotationMatrix
+from mathutils import Vector, Euler, Matrix
def copy_file(source, dest):
# XXX - remove, can use shutil
@@ -75,7 +75,7 @@ def copy_images(dest_dir, textures):
image_paths = set()
for tex in textures:
- image_paths.add(bpy.utils.expandpath(tex.filepath))
+ image_paths.add(bpy.path.abspath(tex.filepath))
# Now copy images
copyCount = 0
@@ -83,7 +83,7 @@ def copy_images(dest_dir, textures):
if Blender.sys.exists(image_path):
# Make a name for the target path.
dest_image_path = dest_dir + image_path.split('\\')[-1].split('/')[-1]
- if not Blender.sys.exists(dest_image_path): # Image isnt alredy there
+ if not Blender.sys.exists(dest_image_path): # Image isnt already there
print('\tCopying "%s" > "%s"' % (image_path, dest_image_path))
try:
copy_file(image_path, dest_image_path)
@@ -107,19 +107,19 @@ def eulerRadToDeg(eul):
mtx4_identity = Matrix()
# testing
-mtx_x90 = RotationMatrix( math.pi/2, 3, 'X') # used
-#mtx_x90n = RotationMatrix(-90, 3, 'x')
-#mtx_y90 = RotationMatrix( 90, 3, 'y')
-#mtx_y90n = RotationMatrix(-90, 3, 'y')
-#mtx_z90 = RotationMatrix( 90, 3, 'z')
-#mtx_z90n = RotationMatrix(-90, 3, 'z')
-
-#mtx4_x90 = RotationMatrix( 90, 4, 'x')
-mtx4_x90n = RotationMatrix(-math.pi/2, 4, 'X') # used
-#mtx4_y90 = RotationMatrix( 90, 4, 'y')
-mtx4_y90n = RotationMatrix(-math.pi/2, 4, 'Y') # used
-mtx4_z90 = RotationMatrix( math.pi/2, 4, 'Z') # used
-mtx4_z90n = RotationMatrix(-math.pi/2, 4, 'Z') # used
+mtx_x90 = Matrix.Rotation( math.pi/2, 3, 'X') # used
+#mtx_x90n = Matrix.Rotation(-90, 3, 'x')
+#mtx_y90 = Matrix.Rotation( 90, 3, 'y')
+#mtx_y90n = Matrix.Rotation(-90, 3, 'y')
+#mtx_z90 = Matrix.Rotation( 90, 3, 'z')
+#mtx_z90n = Matrix.Rotation(-90, 3, 'z')
+
+#mtx4_x90 = Matrix.Rotation( 90, 4, 'x')
+mtx4_x90n = Matrix.Rotation(-math.pi/2, 4, 'X') # used
+#mtx4_y90 = Matrix.Rotation( 90, 4, 'y')
+mtx4_y90n = Matrix.Rotation(-math.pi/2, 4, 'Y') # used
+mtx4_z90 = Matrix.Rotation( math.pi/2, 4, 'Z') # used
+mtx4_z90n = Matrix.Rotation(-math.pi/2, 4, 'Z') # used
# def strip_path(p):
# return p.split('\\')[-1].split('/')[-1]
@@ -176,7 +176,7 @@ def sane_name(data, dct):
name = 'unnamed' # blank string, ASKING FOR TROUBLE!
else:
- name = bpy.utils.clean_name(name) # use our own
+ name = bpy.path.clean_name(name) # use our own
while name in iter(dct.values()): name = increment_string(name)
@@ -200,14 +200,14 @@ def sane_groupname(data): return sane_name(data, sane_name_mapping_group)
# FORCE_CWD - dont use the basepath, just add a ./ to the filename.
# use when we know the file will be in the basepath.
# '''
-# fname = bpy.utils.expandpath(fname_orig)
+# fname = bpy.path.abspath(fname_orig)
# # fname = Blender.sys.expandpath(fname_orig)
# fname_strip = os.path.basename(fname)
# # fname_strip = strip_path(fname)
# if FORCE_CWD:
# fname_rel = '.' + os.sep + fname_strip
# else:
-# fname_rel = bpy.utils.relpath(fname, basepath)
+# fname_rel = bpy.path.relpath(fname, basepath)
# # fname_rel = Blender.sys.relpath(fname, basepath)
# if fname_rel.startswith('//'): fname_rel = '.' + os.sep + fname_rel[2:]
# return fname, fname_strip, fname_rel
@@ -221,7 +221,7 @@ def mat4x4str(mat):
def getVertsFromGroup(me, group_index):
ret = []
- for i, v in enumerate(me.verts):
+ for i, v in enumerate(me.vertices):
for g in v.groups:
if g.group == group_index:
ret.append((i, g.weight))
@@ -243,11 +243,11 @@ def BPyMesh_meshWeight2List(ob):
if not len_groupNames:
# no verts? return a vert aligned empty list
- return [[] for i in range(len(me.verts))], []
+ return [[] for i in range(len(me.vertices))], []
else:
- vWeightList= [[0.0]*len_groupNames for i in range(len(me.verts))]
+ vWeightList= [[0.0]*len_groupNames for i in range(len(me.vertices))]
- for i, v in enumerate(me.verts):
+ for i, v in enumerate(me.vertices):
for g in v.groups:
vWeightList[i][g.group] = g.weight
@@ -305,7 +305,8 @@ def write(filename, batch_objects = None, \
BATCH_OWN_DIR = False
):
- bpy.ops.object.mode_set(mode='OBJECT')
+ if bpy.context.object:
+ bpy.ops.object.mode_set(mode='OBJECT')
# ----------------- Batch support!
if BATCH_ENABLE:
@@ -353,13 +354,13 @@ def write(filename, batch_objects = None, \
new_fbxpath = fbxpath # own dir option modifies, we need to keep an original
for data in data_seq: # scene or group
- newname = BATCH_FILE_PREFIX + bpy.utils.clean_name(data.name)
-# newname = BATCH_FILE_PREFIX + BPySys.bpy.utils.clean_name(data.name)
+ newname = BATCH_FILE_PREFIX + bpy.path.clean_name(data.name)
+# newname = BATCH_FILE_PREFIX + BPySys.bpy.path.clean_name(data.name)
if BATCH_OWN_DIR:
new_fbxpath = fbxpath + newname + os.sep
- # path may alredy exist
+ # path may already exist
# TODO - might exist but be a file. unlikely but should probably account for it.
if bpy.utils.exists(new_fbxpath) == 0:
@@ -391,7 +392,7 @@ def write(filename, batch_objects = None, \
# Call self with modified args
- # Dont pass batch options since we alredy usedt them
+ # Dont pass batch options since we already usedt them
write(filename, data.objects,
context,
False,
@@ -561,7 +562,7 @@ def write(filename, batch_objects = None, \
elif type =='CAMERA':
# elif ob and type =='Camera':
y = matrix_rot * Vector((0.0, 1.0, 0.0))
- matrix_rot = RotationMatrix(math.pi/2, 3, y) * matrix_rot
+ matrix_rot = Matrix.Rotation(math.pi/2, 3, y) * matrix_rot
return matrix_rot
@@ -663,7 +664,7 @@ def write(filename, batch_objects = None, \
rot = tuple(matrix_rot.to_euler())
elif ob and ob.type =='Camera':
y = matrix_rot * Vector((0.0, 1.0, 0.0))
- matrix_rot = RotationMatrix(math.pi/2, 3, y) * matrix_rot
+ matrix_rot = Matrix.Rotation(math.pi/2, 3, y) * matrix_rot
rot = tuple(matrix_rot.to_euler())
else:
rot = tuple(matrix_rot.to_euler())
@@ -947,10 +948,7 @@ def write(filename, batch_objects = None, \
render = scene.render
width = render.resolution_x
height = render.resolution_y
-# render = scene.render
-# width = render.sizeX
-# height = render.sizeY
- aspect = float(width)/height
+ aspect = width / height
data = my_cam.blenObject.data
@@ -962,11 +960,9 @@ def write(filename, batch_objects = None, \
file.write('\n\t\t\tProperty: "FieldOfView", "FieldOfView", "A+",%.6f' % math.degrees(data.angle))
file.write('\n\t\t\tProperty: "FieldOfViewX", "FieldOfView", "A+",1')
file.write('\n\t\t\tProperty: "FieldOfViewY", "FieldOfView", "A+",1')
- file.write('\n\t\t\tProperty: "FocalLength", "Real", "A+",14.0323972702026')
+ # file.write('\n\t\t\tProperty: "FocalLength", "Real", "A+",14.0323972702026')
file.write('\n\t\t\tProperty: "OpticalCenterX", "Real", "A+",%.6f' % data.shift_x) # not sure if this is in the correct units?
-# file.write('\n\t\t\tProperty: "OpticalCenterX", "Real", "A+",%.6f' % data.shiftX) # not sure if this is in the correct units?
file.write('\n\t\t\tProperty: "OpticalCenterY", "Real", "A+",%.6f' % data.shift_y) # ditto
-# file.write('\n\t\t\tProperty: "OpticalCenterY", "Real", "A+",%.6f' % data.shiftY) # ditto
file.write('\n\t\t\tProperty: "BackgroundColor", "Color", "A+",0,0,0')
file.write('\n\t\t\tProperty: "TurnTable", "Real", "A+",0')
file.write('\n\t\t\tProperty: "DisplayTurnTableIcon", "bool", "",1')
@@ -975,7 +971,7 @@ def write(filename, batch_objects = None, \
file.write('\n\t\t\tProperty: "UseRealTimeMotionBlur", "bool", "",1')
file.write('\n\t\t\tProperty: "ResolutionMode", "enum", "",0')
file.write('\n\t\t\tProperty: "ApertureMode", "enum", "",2')
- file.write('\n\t\t\tProperty: "GateFit", "enum", "",0')
+ file.write('\n\t\t\tProperty: "GateFit", "enum", "",2')
file.write('\n\t\t\tProperty: "CameraFormat", "enum", "",0')
file.write('\n\t\t\tProperty: "AspectW", "double", "",%i' % width)
file.write('\n\t\t\tProperty: "AspectH", "double", "",%i' % height)
@@ -1086,7 +1082,7 @@ def write(filename, batch_objects = None, \
else:
do_shadow = 0
- if light.only_shadow or (not light.diffuse and not light.specular):
+ if light.use_only_shadow or (not light.diffuse and not light.specular):
# if mode & Blender.Lamp.Modes.OnlyShadow or (mode & Blender.Lamp.Modes.NoDiffuse and mode & Blender.Lamp.Modes.NoSpecular):
do_light = 0
else:
@@ -1194,7 +1190,7 @@ def write(filename, batch_objects = None, \
# mat_spec = mat.spec/2.0
mat_alpha = mat.alpha
mat_emit = mat.emit
- mat_shadeless = mat.shadeless
+ mat_shadeless = mat.use_shadeless
# mat_shadeless = mat.mode & Blender.Material.Modes.SHADELESS
if mat_shadeless:
mat_shader = 'Lambert'
@@ -1254,7 +1250,7 @@ def write(filename, batch_objects = None, \
file.write('\n\t}')
def copy_image(image):
- fn = bpy.utils.expandpath(image.filepath)
+ fn = bpy.path.abspath(image.filepath)
fn_strip = os.path.basename(fn)
if EXP_IMAGE_COPY:
@@ -1331,9 +1327,9 @@ def write(filename, batch_objects = None, \
Property: "CurrentMappingType", "enum", "",0
Property: "UVSwap", "bool", "",0''')
- file.write('\n\t\t\tProperty: "WrapModeU", "enum", "",%i' % tex.clamp_x)
+ file.write('\n\t\t\tProperty: "WrapModeU", "enum", "",%i' % tex.use_clamp_x)
# file.write('\n\t\t\tProperty: "WrapModeU", "enum", "",%i' % tex.clampX)
- file.write('\n\t\t\tProperty: "WrapModeV", "enum", "",%i' % tex.clamp_y)
+ file.write('\n\t\t\tProperty: "WrapModeV", "enum", "",%i' % tex.use_clamp_y)
# file.write('\n\t\t\tProperty: "WrapModeV", "enum", "",%i' % tex.clampY)
file.write('''
@@ -1402,7 +1398,7 @@ def write(filename, batch_objects = None, \
# TODO - this is a bit lazy, we could have a simple write loop
# for this case because all weights are 1.0 but for now this is ok
# Parent Bones arent used all that much anyway.
- vgroup_data = [(j, 1.0) for j in range(len(my_mesh.blenData.verts))]
+ vgroup_data = [(j, 1.0) for j in range(len(my_mesh.blenData.vertices))]
else:
# This bone is not a parent of this mesh object, no weights
vgroup_data = []
@@ -1491,7 +1487,7 @@ def write(filename, batch_objects = None, \
file.write('\n\t\tVertices: ')
i=-1
- for v in me.verts:
+ for v in me.vertices:
if i==-1:
file.write('%.6f,%.6f,%.6f' % tuple(v.co)); i=0
else:
@@ -1503,7 +1499,7 @@ def write(filename, batch_objects = None, \
file.write('\n\t\tPolygonVertexIndex: ')
i=-1
for f in me.faces:
- fi = f.verts[:]
+ fi = f.vertices[:]
# last index XORd w. -1 indicates end of face
fi[-1] = fi[-1] ^ -1
@@ -1523,8 +1519,8 @@ def write(filename, batch_objects = None, \
# write loose edges as faces.
for ed in me.edges:
- if ed.loose:
- ed_val = ed.verts[:]
+ if ed.is_loose:
+ ed_val = ed.vertices[:]
ed_val = ed_val[0], ed_val[-1] ^ -1
if i==-1:
@@ -1542,14 +1538,14 @@ def write(filename, batch_objects = None, \
i=-1
for ed in me.edges:
if i==-1:
- file.write('%i,%i' % (ed.verts[0], ed.verts[1]))
+ file.write('%i,%i' % (ed.vertices[0], ed.vertices[1]))
# file.write('%i,%i' % (ed.v1.index, ed.v2.index))
i=0
else:
if i==13:
file.write('\n\t\t')
i=0
- file.write(',%i,%i' % (ed.verts[0], ed.verts[1]))
+ file.write(',%i,%i' % (ed.vertices[0], ed.vertices[1]))
# file.write(',%i,%i' % (ed.v1.index, ed.v2.index))
i+=1
@@ -1564,7 +1560,7 @@ def write(filename, batch_objects = None, \
Normals: ''')
i=-1
- for v in me.verts:
+ for v in me.vertices:
if i==-1:
file.write('%.15f,%.15f,%.15f' % tuple(v.normal)); i=0
# file.write('%.15f,%.15f,%.15f' % tuple(v.no)); i=0
@@ -1588,11 +1584,11 @@ def write(filename, batch_objects = None, \
i=-1
for f in me.faces:
if i==-1:
- file.write('%i' % f.smooth); i=0
+ file.write('%i' % f.use_smooth); i=0
else:
if i==54:
file.write('\n '); i=0
- file.write(',%i' % f.smooth)
+ file.write(',%i' % f.use_smooth)
i+=1
file.write('\n\t\t}')
@@ -1606,27 +1602,23 @@ def write(filename, batch_objects = None, \
ReferenceInformationType: "Direct"
Smoothing: ''')
-# SHARP = Blender.Mesh.EdgeFlags.SHARP
i=-1
for ed in me.edges:
if i==-1:
- file.write('%i' % (ed.sharp)); i=0
-# file.write('%i' % ((ed.flag&SHARP)!=0)); i=0
+ file.write('%i' % (ed.use_edge_sharp)); i=0
else:
if i==54:
file.write('\n '); i=0
- file.write(',%i' % (ed.sharp))
-# file.write(',%i' % ((ed.flag&SHARP)!=0))
+ file.write(',%i' % (ed.use_edge_sharp))
i+=1
file.write('\n\t\t}')
-# del SHARP
# small utility function
# returns a slice of data depending on number of face verts
# data is either a MeshTextureFace or MeshColor
def face_data(data, face):
- totvert = len(f.verts)
+ totvert = len(f.vertices)
return data[:totvert]
@@ -2076,7 +2068,7 @@ def write(filename, batch_objects = None, \
# ob.copy().link(me)
# # If new mesh has no vgroups we can try add if verts are teh same
# if not me.getVertGroupNames(): # vgroups were not kept by the modifier
-# if len(me.verts) == len(orig_mesh.verts):
+# if len(me.vertices) == len(orig_mesh.vertices):
# groupNames, vWeightDict = BPyMesh.meshWeight2Dict(orig_mesh)
# BPyMesh.dict2MeshWeight(me, groupNames, vWeightDict)
@@ -2763,7 +2755,7 @@ Takes: {''')
act_end = end
else:
# use existing name
- if blenAction == blenActionDefault: # have we alredy got the name
+ if blenAction == blenActionDefault: # have we already got the name
file.write('\n\tTake: "%s" {' % sane_name_mapping_take[blenAction.name])
else:
file.write('\n\tTake: "%s" {' % sane_takename(blenAction))
@@ -2782,7 +2774,7 @@ Takes: {''')
# Set the action active
for my_bone in ob_arms:
- if blenAction in my_bone.blenActionList:
+ if ob.animation_data and blenAction in my_bone.blenActionList:
ob.animation_data.action = blenAction
# print '\t\tSetting Action!', blenAction
# scene.update(1)
@@ -2918,7 +2910,7 @@ Takes: {''')
for val, frame in context_bone_anim_keys:
if frame != context_bone_anim_keys[0][1]: # not the first
file.write(',')
- # frame is alredy one less then blenders frame
+ # frame is already one less then blenders frame
file.write('\n\t\t\t\t\t\t\t%i,%.15f,L' % (fbx_time(frame), val ))
if i==0: file.write('\n\t\t\t\t\t\tColor: 1,0,0')
@@ -2940,7 +2932,8 @@ Takes: {''')
# end action loop. set original actions
# do this after every loop incase actions effect eachother.
for my_bone in ob_arms:
- my_bone.blenObject.animation_data.action = my_bone.blenAction
+ if my_bone.blenObject.animation_data:
+ my_bone.blenObject.animation_data.action = my_bone.blenAction
file.write('\n}')
@@ -2964,7 +2957,7 @@ Takes: {''')
# Clear mesh data Only when writing with modifiers applied
for me in meshes_to_clear:
bpy.data.meshes.remove(me)
-# me.verts = None
+# me.vertices = None
# --------------------------- Footer
if world:
@@ -3037,7 +3030,7 @@ Takes: {''')
# --------------------------------------------
# UI Function - not a part of the exporter.
-# this is to seperate the user interface from the rest of the exporter.
+# this is to separate the user interface from the rest of the exporter.
# from Blender import Draw, Window
EVENT_NONE = 0
EVENT_EXIT = 1
@@ -3364,20 +3357,24 @@ class ExportFBX(bpy.types.Operator):
BATCH_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen=1024, default="")
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.active_object
def execute(self, context):
if not self.properties.filepath:
raise Exception("filepath not set")
+ filepath = self.properties.filepath
+ filepath = bpy.path.ensure_ext(filepath, ".fbx")
+
GLOBAL_MATRIX = mtx4_identity
GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.properties.TX_SCALE
if self.properties.TX_XROT90: GLOBAL_MATRIX = mtx4_x90n * GLOBAL_MATRIX
if self.properties.TX_YROT90: GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX
if self.properties.TX_ZROT90: GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
- write(self.properties.filepath,
+ write(filepath,
None, # XXX
context,
self.properties.EXP_OBS_SELECTED,
@@ -3397,13 +3394,17 @@ class ExportFBX(bpy.types.Operator):
self.properties.BATCH_ENABLE,
self.properties.BATCH_GROUP,
self.properties.BATCH_FILE_PREFIX,
- self.properties.BATCH_OWN_DIR)
+ self.properties.BATCH_OWN_DIR,
+ )
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".fbx"
+
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
@@ -3415,7 +3416,7 @@ class ExportFBX(bpy.types.Operator):
# NOTES (all line numbers correspond to original export_fbx.py (under release/scripts)
# - Draw.PupMenu alternative in 2.5?, temporarily replaced PupMenu with print
-# - get rid of bpy.utils.clean_name somehow
+# - get rid of bpy.path.clean_name somehow
# + fixed: isinstance(inst, bpy.types.*) doesn't work on RNA objects: line 565
# + get rid of BPyObject_getObjectArmature, move it in RNA?
# - BATCH_ENABLE and BATCH_GROUP options: line 327
@@ -3430,24 +3431,21 @@ class ExportFBX(bpy.types.Operator):
# - bpy.data.remove_scene: line 366
# - bpy.sys.time move to bpy.sys.util?
# - new scene creation, activation: lines 327-342, 368
-# - uses bpy.utils.expandpath, *.relpath - replace at least relpath
+# - uses bpy.path.abspath, *.relpath - replace at least relpath
# SMALL or COSMETICAL
# - find a way to get blender version, and put it in bpy.util?, old was Blender.Get('version')
def menu_func(self, context):
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".fbx"
- self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX (.fbx)").filepath = default_path
+ self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX (.fbx)")
def register():
- bpy.types.register(ExportFBX)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
- bpy.types.unregister(ExportFBX)
bpy.types.INFO_MT_file_export.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/io/export_mdd.py b/release/scripts/io/export_mdd.py
index d2e53070910..b2eda13fc8f 100644
--- a/release/scripts/io/export_mdd.py
+++ b/release/scripts/io/export_mdd.py
@@ -65,7 +65,7 @@ def check_vertcount(mesh, vertcount):
'''
check and make sure the vertcount is consistent throughout the frame range
'''
- if len(mesh.verts) != vertcount:
+ if len(mesh.vertices) != vertcount:
raise Exception('Error, number of verts has changed during animation, cannot export')
f.close()
zero_file(filepath)
@@ -94,7 +94,7 @@ def write(filename, sce, ob, PREF_STARTFRAME, PREF_ENDFRAME, PREF_FPS):
[0.0, 0.0, 0.0, 1.0],\
)
- numverts = len(me.verts)
+ numverts = len(me.vertices)
numframes = PREF_ENDFRAME - PREF_STARTFRAME + 1
PREF_FPS = float(PREF_FPS)
@@ -114,7 +114,7 @@ def write(filename, sce, ob, PREF_STARTFRAME, PREF_ENDFRAME, PREF_FPS):
check_vertcount(me, numverts)
me.transform(mat_flip * ob.matrix_world)
- f.write(pack(">%df" % (numverts * 3), *[axis for v in me.verts for axis in v.co]))
+ f.write(pack(">%df" % (numverts * 3), *[axis for v in me.vertices for axis in v.co]))
for frame in range(PREF_STARTFRAME, PREF_ENDFRAME + 1):#in order to start at desired frame
"""
@@ -128,10 +128,10 @@ def write(filename, sce, ob, PREF_STARTFRAME, PREF_ENDFRAME, PREF_FPS):
me.transform(mat_flip * ob.matrix_world)
# Write the vertex data
- f.write(pack(">%df" % (numverts * 3), *[axis for v in me.verts for axis in v.co]))
+ f.write(pack(">%df" % (numverts * 3), *[axis for v in me.vertices for axis in v.co]))
"""
- me_tmp.verts= None
+ me_tmp.vertices= None
"""
f.close()
@@ -165,36 +165,43 @@ class ExportMDD(bpy.types.Operator):
frame_start = IntProperty(name="Start Frame", description="Start frame for baking", min=minframe, max=maxframe, default=1)
frame_end = IntProperty(name="End Frame", description="End frame for baking", min=minframe, max=maxframe, default=250)
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.active_object
return (ob and ob.type == 'MESH')
def execute(self, context):
- if not self.properties.filepath:
- raise Exception("filename not set")
- write(self.properties.filepath, context.scene, context.active_object,
- self.properties.frame_start, self.properties.frame_end, self.properties.fps)
+ filepath = self.properties.filepath
+ filepath = bpy.path.ensure_ext(filepath, ".mdd")
+
+ write(filepath,
+ context.scene,
+ context.active_object,
+ self.properties.frame_start,
+ self.properties.frame_end,
+ self.properties.fps,
+ )
+
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".mdd"
+
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
- import os
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".mdd"
- self.layout.operator(ExportMDD.bl_idname, text="Lightwave Point Cache (.mdd)").filepath = default_path
+ self.layout.operator(ExportMDD.bl_idname, text="Lightwave Point Cache (.mdd)")
def register():
- bpy.types.register(ExportMDD)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
- bpy.types.unregister(ExportMDD)
bpy.types.INFO_MT_file_export.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/io/export_obj.py b/release/scripts/io/export_obj.py
index 626b92c3591..53c4a324ed1 100644
--- a/release/scripts/io/export_obj.py
+++ b/release/scripts/io/export_obj.py
@@ -18,13 +18,6 @@
# <pep8 compliant>
-"""
-Name: 'Wavefront (.obj)...'
-Blender: 248
-Group: 'Export'
-Tooltip: 'Save a Wavefront OBJ File'
-"""
-
__author__ = "Campbell Barton, Jiri Hnidek, Paolo Ciccone"
__url__ = ['http://wiki.blender.org/index.php/Scripts/Manual/Export/wavefront_obj', 'www.blender.org', 'blenderartists.org']
__version__ = "1.21"
@@ -49,16 +42,6 @@ import shutil
import bpy
import mathutils
-
-# Returns a tuple - path,extension.
-# 'hello.obj' > ('hello', '.obj')
-def splitExt(path):
- dotidx = path.rfind('.')
- if dotidx == -1:
- return path, ''
- else:
- return path[:dotidx], path[dotidx:]
-
def fixName(name):
if name == None:
return 'None'
@@ -73,7 +56,7 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
dest_dir = os.path.dirname(filepath)
def copy_image(image):
- fn = bpy.utils.expandpath(image.filepath)
+ fn = bpy.path.abspath(image.filepath)
fn_strip = os.path.basename(fn)
if copy_images:
rel = fn_strip
@@ -88,7 +71,7 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
file = open(filepath, "w")
# XXX
-# file.write('# Blender MTL File: %s\n' % Blender.Get('filepath').split('\\')[-1].split('/')[-1])
+# file.write('# Blender MTL File: %s\n' % Blender.Get('filepath').split('\\')[-1].split('/')[-1])
file.write('# Material Count: %i\n' % len(mtl_dict))
# Write material/image combinations we have used.
for key, (mtl_mat_name, mat, img) in mtl_dict.items():
@@ -100,7 +83,7 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
if mat:
file.write('Ns %.6f\n' % ((mat.specular_hardness-1) * 1.9607843137254901) ) # Hardness, convert blenders 1-511 to MTL's
- file.write('Ka %.6f %.6f %.6f\n' % tuple([c*mat.ambient for c in worldAmb]) ) # Ambient, uses mirror colour,
+ file.write('Ka %.6f %.6f %.6f\n' % tuple([c*mat.ambient for c in worldAmb]) ) # Ambient, uses mirror colour,
file.write('Kd %.6f %.6f %.6f\n' % tuple([c*mat.diffuse_intensity for c in mat.diffuse_color]) ) # Diffuse
file.write('Ks %.6f %.6f %.6f\n' % tuple([c*mat.specular_intensity for c in mat.specular_color]) ) # Specular
if hasattr(mat, "ior"):
@@ -110,7 +93,7 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
file.write('d %.6f\n' % mat.alpha) # Alpha (obj uses 'd' for dissolve)
# 0 to disable lighting, 1 for ambient & diffuse only (specular color set to black), 2 for full lighting.
- if mat.shadeless:
+ if mat.use_shadeless:
file.write('illum 0\n') # ignore lighting
elif mat.specular_intensity == 0:
file.write('illum 1\n') # no specular.
@@ -120,25 +103,25 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
else:
#write a dummy material here?
file.write('Ns 0\n')
- file.write('Ka %.6f %.6f %.6f\n' % tuple([c for c in worldAmb]) ) # Ambient, uses mirror colour,
+ file.write('Ka %.6f %.6f %.6f\n' % tuple([c for c in worldAmb]) ) # Ambient, uses mirror colour,
file.write('Kd 0.8 0.8 0.8\n')
file.write('Ks 0.8 0.8 0.8\n')
file.write('d 1\n') # No alpha
file.write('illum 2\n') # light normaly
# Write images!
- if img: # We have an image on the face!
+ if img: # We have an image on the face!
# write relative image path
rel = copy_image(img)
file.write('map_Kd %s\n' % rel) # Diffuse mapping image
-# file.write('map_Kd %s\n' % img.filepath.split('\\')[-1].split('/')[-1]) # Diffuse mapping image
+# file.write('map_Kd %s\n' % img.filepath.split('\\')[-1].split('/')[-1]) # Diffuse mapping image
elif mat: # No face image. if we havea material search for MTex image.
for mtex in mat.texture_slots:
if mtex and mtex.texture.type == 'IMAGE':
try:
filepath = copy_image(mtex.texture.image)
-# filepath = mtex.texture.image.filepath.split('\\')[-1].split('/')[-1]
+# filepath = mtex.texture.image.filepath.split('\\')[-1].split('/')[-1]
file.write('map_Kd %s\n' % filepath) # Diffuse mapping image
break
except:
@@ -164,8 +147,8 @@ def copy_file(source, dest):
def copy_images(dest_dir):
if dest_dir[-1] != os.sep:
dest_dir += os.sep
-# if dest_dir[-1] != sys.sep:
-# dest_dir += sys.sep
+# if dest_dir[-1] != sys.sep:
+# dest_dir += sys.sep
# Get unique image names
uniqueImages = {}
@@ -188,20 +171,20 @@ def copy_images(dest_dir):
# Now copy images
copyCount = 0
-# for bImage in uniqueImages.values():
-# image_path = bpy.utils.expandpath(bImage.filepath)
-# if bpy.sys.exists(image_path):
-# # Make a name for the target path.
-# dest_image_path = dest_dir + image_path.split('\\')[-1].split('/')[-1]
-# if not bpy.utils.exists(dest_image_path): # Image isnt alredy there
-# print('\tCopying "%s" > "%s"' % (image_path, dest_image_path))
-# copy_file(image_path, dest_image_path)
-# copyCount+=1
+# for bImage in uniqueImages.values():
+# image_path = bpy.path.abspath(bImage.filepath)
+# if bpy.sys.exists(image_path):
+# # Make a name for the target path.
+# dest_image_path = dest_dir + image_path.split('\\')[-1].split('/')[-1]
+# if not bpy.utils.exists(dest_image_path): # Image isnt already there
+# print('\tCopying "%s" > "%s"' % (image_path, dest_image_path))
+# copy_file(image_path, dest_image_path)
+# copyCount+=1
-# paths= bpy.util.copy_images(uniqueImages.values(), dest_dir)
+# paths= bpy.util.copy_images(uniqueImages.values(), dest_dir)
print('\tCopied %d images' % copyCount)
-# print('\tCopied %d images' % copyCount)
+# print('\tCopied %d images' % copyCount)
# XXX not converted
def test_nurbs_compat(ob):
@@ -224,8 +207,8 @@ def write_nurb(file, ob, ob_mat):
Vector = Blender.mathutils.Vector
for nu in cu:
- if nu.type==0: DEG_ORDER_U = 1
- else: DEG_ORDER_U = nu.orderU-1 # Tested to be correct
+ if nu.type==0: DEG_ORDER_U = 1
+ else: DEG_ORDER_U = nu.orderU-1 # Tested to be correct
if nu.type==1:
print("\tWarning, bezier curve:", ob.name, "only poly and nurbs curves supported")
@@ -282,7 +265,7 @@ def write_nurb(file, ob, ob_mat):
return tot_verts
-def write(filepath, objects, scene,
+def write_file(filepath, objects, scene,
EXPORT_TRI=False,
EXPORT_EDGES=False,
EXPORT_NORMALS=False,
@@ -299,7 +282,7 @@ def write(filepath, objects, scene,
EXPORT_POLYGROUPS=False,
EXPORT_CURVE_AS_NURBS=True):
'''
- Basic write function. The context and options must be alredy set
+ Basic write function. The context and options must be already set
This can be accessed externaly
eg.
write( 'c:\\test\\foobar.obj', Blender.Object.GetSelected() ) # Using default options.
@@ -325,10 +308,10 @@ def write(filepath, objects, scene,
of vertices is the face's group
"""
weightDict = {}
- for vert_index in face.verts:
-# for vert in face:
+ for vert_index in face.vertices:
+# for vert in face:
vWeights = vWeightMap[vert_index]
-# vWeights = vWeightMap[vert]
+# vWeights = vWeightMap[vert]
for vGroupName, weight in vWeights:
weightDict[vGroupName] = weightDict.get(vGroupName, 0) + weight
@@ -343,7 +326,7 @@ def write(filepath, objects, scene,
def getVertsFromGroup(me, group_index):
ret = []
- for i, v in enumerate(me.verts):
+ for i, v in enumerate(me.vertices):
for g in v.groups:
if g.group == group_index:
ret.append((i, g.weight))
@@ -355,8 +338,8 @@ def write(filepath, objects, scene,
temp_mesh_name = '~tmp-mesh'
time1 = time.clock()
-# time1 = sys.time()
-# scn = Scene.GetCurrent()
+# time1 = sys.time()
+# scn = Scene.GetCurrent()
file = open(filepath, "w")
@@ -370,7 +353,7 @@ def write(filepath, objects, scene,
file.write('mtllib %s\n' % ( mtlfilepath.split('\\')[-1].split('/')[-1] ))
if EXPORT_ROTX90:
- mat_xrot90= mathutils.RotationMatrix(-math.pi/2, 4, 'X')
+ mat_xrot90= mathutils.Matrix.Rotation(-math.pi/2, 4, 'X')
# Initialize totals, these are updated each object
totverts = totuvco = totno = 1
@@ -408,15 +391,15 @@ def write(filepath, objects, scene,
for ob, ob_mat in obs:
# XXX postponed
-# # Nurbs curve support
-# if EXPORT_CURVE_AS_NURBS and test_nurbs_compat(ob):
-# if EXPORT_ROTX90:
-# ob_mat = ob_mat * mat_xrot90
+# # Nurbs curve support
+# if EXPORT_CURVE_AS_NURBS and test_nurbs_compat(ob):
+# if EXPORT_ROTX90:
+# ob_mat = ob_mat * mat_xrot90
-# totverts += write_nurb(file, ob, ob_mat)
+# totverts += write_nurb(file, ob, ob_mat)
-# continue
-# end nurbs
+# continue
+# end nurbs
if ob.type != 'MESH':
continue
@@ -428,16 +411,19 @@ def write(filepath, objects, scene,
else:
me.transform(ob_mat)
-# # Will work for non meshes now! :)
-# me= BPyMesh.getMeshFromObject(ob, containerMesh, EXPORT_APPLY_MODIFIERS, EXPORT_POLYGROUPS, scn)
-# if not me:
-# continue
+# # Will work for non meshes now! :)
+# me= BPyMesh.getMeshFromObject(ob, containerMesh, EXPORT_APPLY_MODIFIERS, EXPORT_POLYGROUPS, scn)
+# if not me:
+# continue
if EXPORT_UV:
faceuv = len(me.uv_textures) > 0
+ uv_layer = me.active_uv_texture.data[:]
else:
faceuv = False
+ me_verts = me.vertices[:]
+
# XXX - todo, find a better way to do triangulation
# ...removed convert_to_triface because it relies on editmesh
'''
@@ -446,7 +432,7 @@ def write(filepath, objects, scene,
# Add a dummy object to it.
has_quads = False
for f in me.faces:
- if f.verts[3] != 0:
+ if f.vertices[3] != 0:
has_quads = True
break
@@ -468,7 +454,7 @@ def write(filepath, objects, scene,
else:
edges = []
- if not (len(face_index_pairs)+len(edges)+len(me.verts)): # Make sure there is somthing to write
+ if not (len(face_index_pairs)+len(edges)+len(me.vertices)): # Make sure there is somthing to write
# clean up
bpy.data.meshes.remove(me)
@@ -479,13 +465,13 @@ def write(filepath, objects, scene,
# High Quality Normals
if EXPORT_NORMALS and face_index_pairs:
me.calc_normals()
-# if EXPORT_NORMALS_HQ:
-# BPyMesh.meshCalcNormals(me)
-# else:
-# # transforming normals is incorrect
-# # when the matrix is scaled,
-# # better to recalculate them
-# me.calcNormals()
+# if EXPORT_NORMALS_HQ:
+# BPyMesh.meshCalcNormals(me)
+# else:
+# # transforming normals is incorrect
+# # when the matrix is scaled,
+# # better to recalculate them
+# me.calcNormals()
materials = me.materials
@@ -510,29 +496,24 @@ def write(filepath, objects, scene,
if EXPORT_KEEP_VERT_ORDER:
pass
elif faceuv:
- # XXX update
- tface = me.active_uv_texture.data
-
- face_index_pairs.sort(key=lambda a: (a[0].material_index, hash(tface[a[1]].image), a[0].smooth))
+ face_index_pairs.sort(key=lambda a: (a[0].material_index, hash(uv_layer[a[1]].image), a[0].use_smooth))
elif len(materials) > 1:
- face_index_pairs.sort(key = lambda a: (a[0].material_index, a[0].smooth))
+ face_index_pairs.sort(key = lambda a: (a[0].material_index, a[0].use_smooth))
else:
# no materials
- face_index_pairs.sort(key = lambda a: a[0].smooth)
-# if EXPORT_KEEP_VERT_ORDER:
-# pass
-# elif faceuv:
-# try: faces.sort(key = lambda a: (a.mat, a.image, a.smooth))
-# except: faces.sort(lambda a,b: cmp((a.mat, a.image, a.smooth), (b.mat, b.image, b.smooth)))
-# elif len(materials) > 1:
-# try: faces.sort(key = lambda a: (a.mat, a.smooth))
-# except: faces.sort(lambda a,b: cmp((a.mat, a.smooth), (b.mat, b.smooth)))
-# else:
-# # no materials
-# try: faces.sort(key = lambda a: a.smooth)
-# except: faces.sort(lambda a,b: cmp(a.smooth, b.smooth))
-
- faces = [pair[0] for pair in face_index_pairs]
+ face_index_pairs.sort(key = lambda a: a[0].use_smooth)
+# if EXPORT_KEEP_VERT_ORDER:
+# pass
+# elif faceuv:
+# try: faces.sort(key = lambda a: (a.mat, a.image, a.use_smooth))
+# except: faces.sort(lambda a,b: cmp((a.mat, a.image, a.use_smooth), (b.mat, b.image, b.use_smooth)))
+# elif len(materials) > 1:
+# try: faces.sort(key = lambda a: (a.mat, a.use_smooth))
+# except: faces.sort(lambda a,b: cmp((a.mat, a.use_smooth), (b.mat, b.use_smooth)))
+# else:
+# # no materials
+# try: faces.sort(key = lambda a: a.use_smooth)
+# except: faces.sort(lambda a,b: cmp(a.use_smooth, b.use_smooth))
# Set the default mat to no material and no image.
contextMat = (0, 0) # Can never be this, so we will label a new material teh first chance we get.
@@ -553,28 +534,17 @@ def write(filepath, objects, scene,
# Vert
- for v in me.verts:
+ for v in me_verts:
file.write('v %.6f %.6f %.6f\n' % tuple(v.co))
# UV
if faceuv:
- uv_face_mapping = [[0,0,0,0] for f in faces] # a bit of a waste for tri's :/
+ uv_face_mapping = [[0,0,0,0] for i in range(len(face_index_pairs))] # a bit of a waste for tri's :/
uv_dict = {} # could use a set() here
- uv_layer = me.active_uv_texture
+ uv_layer = me.active_uv_texture.data
for f, f_index in face_index_pairs:
-
- tface = uv_layer.data[f_index]
-
- # workaround, since tface.uv iteration is wrong atm
- uvs = tface.uv
- # uvs = [tface.uv1, tface.uv2, tface.uv3]
-
- # # add another UV if it's a quad
- # if len(f.verts) == 4:
- # uvs.append(tface.uv4)
-
- for uv_index, uv in enumerate(uvs):
+ for uv_index, uv in enumerate(uv_layer[f_index].uv):
uvkey = veckey2d(uv)
try:
uv_face_mapping[f_index][uv_index] = uv_dict[uvkey]
@@ -582,27 +552,16 @@ def write(filepath, objects, scene,
uv_face_mapping[f_index][uv_index] = uv_dict[uvkey] = len(uv_dict)
file.write('vt %.6f %.6f\n' % tuple(uv))
-# uv_dict = {} # could use a set() here
-# for f_index, f in enumerate(faces):
-
-# for uv_index, uv in enumerate(f.uv):
-# uvkey = veckey2d(uv)
-# try:
-# uv_face_mapping[f_index][uv_index] = uv_dict[uvkey]
-# except:
-# uv_face_mapping[f_index][uv_index] = uv_dict[uvkey] = len(uv_dict)
-# file.write('vt %.6f %.6f\n' % tuple(uv))
-
uv_unique_count = len(uv_dict)
-# del uv, uvkey, uv_dict, f_index, uv_index
+# del uv, uvkey, uv_dict, f_index, uv_index
# Only need uv_unique_count and uv_face_mapping
# NORMAL, Smooth/Non smoothed.
if EXPORT_NORMALS:
- for f in faces:
- if f.smooth:
- for vIdx in f.verts:
- v = me.verts[vIdx]
+ for f, f_index in face_index_pairs:
+ if f.use_smooth:
+ for v_idx in f.vertices:
+ v = me_verts[v_idx]
noKey = veckey3d(v.normal)
if noKey not in globalNormals:
globalNormals[noKey] = totno
@@ -622,66 +581,66 @@ def write(filepath, objects, scene,
# XXX
if EXPORT_POLYGROUPS:
# Retrieve the list of vertex groups
-# vertGroupNames = me.getVertGroupNames()
+# vertGroupNames = me.getVertGroupNames()
currentVGroup = ''
# Create a dictionary keyed by face id and listing, for each vertex, the vertex groups it belongs to
- vgroupsMap = [[] for _i in range(len(me.verts))]
-# vgroupsMap = [[] for _i in xrange(len(me.verts))]
+ vgroupsMap = [[] for _i in range(len(me_verts))]
+# vgroupsMap = [[] for _i in xrange(len(me_verts))]
for g in ob.vertex_groups:
-# for vertexGroupName in vertGroupNames:
- for vIdx, vWeight in getVertsFromGroup(me, g.index):
-# for vIdx, vWeight in me.getVertsFromGroup(vertexGroupName, 1):
- vgroupsMap[vIdx].append((g.name, vWeight))
+# for vertexGroupName in vertGroupNames:
+ for v_idx, vWeight in getVertsFromGroup(me, g.index):
+# for v_idx, vWeight in me.getVertsFromGroup(vertexGroupName, 1):
+ vgroupsMap[v_idx].append((g.name, vWeight))
- for f_index, f in enumerate(faces):
- f_v = [{"index": index, "vertex": me.verts[index]} for index in f.verts]
+ for f, f_index in face_index_pairs:
+ f_v = [me_verts[v_idx] for v_idx in f.vertices]
- # if f.verts[3] == 0:
- # f_v.pop()
+ # if f.vertices[3] == 0:
+ # f_v.pop()
-# f_v= f.v
- f_smooth= f.smooth
+# f_v= f.v
+ f_smooth= f.use_smooth
f_mat = min(f.material_index, len(materialNames)-1)
-# f_mat = min(f.mat, len(materialNames)-1)
+# f_mat = min(f.mat, len(materialNames)-1)
if faceuv:
- tface = me.active_uv_texture.data[face_index_pairs[f_index][1]]
+ tface = uv_layer[f_index]
f_image = tface.image
f_uv = tface.uv
# f_uv= [tface.uv1, tface.uv2, tface.uv3]
- # if len(f.verts) == 4:
- # f_uv.append(tface.uv4)
-# f_image = f.image
-# f_uv= f.uv
+ # if len(f.vertices) == 4:
+ # f_uv.append(tface.uv4)
+# f_image = f.image
+# f_uv= f.uv
# MAKE KEY
if faceuv and f_image: # Object is always true.
- key = materialNames[f_mat], f_image.name
+ key = materialNames[f_mat], f_image.name
else:
- key = materialNames[f_mat], None # No image, use None instead.
+ key = materialNames[f_mat], None # No image, use None instead.
# Write the vertex group
if EXPORT_POLYGROUPS:
if len(ob.vertex_groups):
# find what vertext group the face belongs to
theVGroup = findVertexGroupName(f,vgroupsMap)
- if theVGroup != currentVGroup:
+ if theVGroup != currentVGroup:
currentVGroup = theVGroup
file.write('g %s\n' % theVGroup)
-# # Write the vertex group
-# if EXPORT_POLYGROUPS:
-# if vertGroupNames:
-# # find what vertext group the face belongs to
-# theVGroup = findVertexGroupName(f,vgroupsMap)
-# if theVGroup != currentVGroup:
-# currentVGroup = theVGroup
-# file.write('g %s\n' % theVGroup)
+# # Write the vertex group
+# if EXPORT_POLYGROUPS:
+# if vertGroupNames:
+# # find what vertext group the face belongs to
+# theVGroup = findVertexGroupName(f,vgroupsMap)
+# if theVGroup != currentVGroup:
+# currentVGroup = theVGroup
+# file.write('g %s\n' % theVGroup)
# CHECK FOR CONTEXT SWITCH
if key == contextMat:
- pass # Context alredy switched, dont do anything
+ pass # Context already switched, dont do anything
else:
if key[0] == None and key[1] == None:
# Write a null material, since we know the context has changed.
@@ -725,21 +684,21 @@ def write(filepath, objects, scene,
if f_smooth: # Smoothed, use vertex normals
for vi, v in enumerate(f_v):
file.write( ' %d/%d/%d' % \
- (v["index"] + totverts,
+ (v.index + totverts,
totuvco + uv_face_mapping[f_index][vi],
- globalNormals[ veckey3d(v["vertex"].normal) ]) ) # vert, uv, normal
+ globalNormals[ veckey3d(v.normal) ]) ) # vert, uv, normal
else: # No smoothing, face normals
no = globalNormals[ veckey3d(f.normal) ]
for vi, v in enumerate(f_v):
file.write( ' %d/%d/%d' % \
- (v["index"] + totverts,
+ (v.index + totverts,
totuvco + uv_face_mapping[f_index][vi],
no) ) # vert, uv, normal
else: # No Normals
for vi, v in enumerate(f_v):
file.write( ' %d/%d' % (\
- v["index"] + totverts,\
+ v.index + totverts,\
totuvco + uv_face_mapping[f_index][vi])) # vert, uv
face_vert_index += len(f_v)
@@ -749,25 +708,25 @@ def write(filepath, objects, scene,
if f_smooth: # Smoothed, use vertex normals
for v in f_v:
file.write( ' %d//%d' %
- (v["index"] + totverts, globalNormals[ veckey3d(v["vertex"].normal) ]) )
+ (v.index + totverts, globalNormals[ veckey3d(v.normal) ]) )
else: # No smoothing, face normals
no = globalNormals[ veckey3d(f.normal) ]
for v in f_v:
- file.write( ' %d//%d' % (v["index"] + totverts, no) )
+ file.write( ' %d//%d' % (v.index + totverts, no) )
else: # No Normals
for v in f_v:
- file.write( ' %d' % (v["index"] + totverts) )
+ file.write( ' %d' % (v.index + totverts) )
file.write('\n')
# Write edges.
if EXPORT_EDGES:
for ed in edges:
- if ed.loose:
- file.write('f %d %d\n' % (ed.verts[0] + totverts, ed.verts[1] + totverts))
+ if ed.is_loose:
+ file.write('f %d %d\n' % (ed.vertices[0] + totverts, ed.vertices[1] + totverts))
# Make the indicies global rather then per mesh
- totverts += len(me.verts)
+ totverts += len(me_verts)
if faceuv:
totuvco += uv_unique_count
@@ -783,52 +742,52 @@ def write(filepath, objects, scene,
# Now we have all our materials, save them
if EXPORT_MTL:
write_mtl(scene, mtlfilepath, EXPORT_COPY_IMAGES, mtl_dict)
-# if EXPORT_COPY_IMAGES:
-# dest_dir = os.path.basename(filepath)
-# # dest_dir = filepath
-# # # Remove chars until we are just the path.
-# # while dest_dir and dest_dir[-1] not in '\\/':
-# # dest_dir = dest_dir[:-1]
-# if dest_dir:
-# copy_images(dest_dir, mtl_dict)
-# else:
-# print('\tError: "%s" could not be used as a base for an image path.' % filepath)
+# if EXPORT_COPY_IMAGES:
+# dest_dir = os.path.basename(filepath)
+# # dest_dir = filepath
+# # # Remove chars until we are just the path.
+# # while dest_dir and dest_dir[-1] not in '\\/':
+# # dest_dir = dest_dir[:-1]
+# if dest_dir:
+# copy_images(dest_dir, mtl_dict)
+# else:
+# print('\tError: "%s" could not be used as a base for an image path.' % filepath)
print("OBJ Export time: %.2f" % (time.clock() - time1))
-# print "OBJ Export time: %.2f" % (sys.time() - time1)
-
-def do_export(filepath, context,
- EXPORT_APPLY_MODIFIERS = True, # not used
- EXPORT_ROTX90 = True, # wrong
- EXPORT_TRI = False, # ok
- EXPORT_EDGES = False,
- EXPORT_NORMALS = False, # not yet
- EXPORT_NORMALS_HQ = False, # not yet
- EXPORT_UV = True, # ok
- EXPORT_MTL = True,
- EXPORT_SEL_ONLY = True, # ok
- EXPORT_ALL_SCENES = False, # XXX not working atm
- EXPORT_ANIMATION = False,
- EXPORT_COPY_IMAGES = False,
- EXPORT_BLEN_OBS = True,
- EXPORT_GROUP_BY_OB = False,
- EXPORT_GROUP_BY_MAT = False,
- EXPORT_KEEP_VERT_ORDER = False,
- EXPORT_POLYGROUPS = False,
- EXPORT_CURVE_AS_NURBS = True):
+
+def write(filepath, context,
+ EXPORT_TRI, # ok
+ EXPORT_EDGES,
+ EXPORT_NORMALS, # not yet
+ EXPORT_NORMALS_HQ, # not yet
+ EXPORT_UV, # ok
+ EXPORT_MTL,
+ EXPORT_COPY_IMAGES,
+ EXPORT_APPLY_MODIFIERS, # ok
+ EXPORT_ROTX90, # wrong
+ EXPORT_BLEN_OBS,
+ EXPORT_GROUP_BY_OB,
+ EXPORT_GROUP_BY_MAT,
+ EXPORT_KEEP_VERT_ORDER,
+ EXPORT_POLYGROUPS,
+ EXPORT_CURVE_AS_NURBS,
+ EXPORT_SEL_ONLY, # ok
+ EXPORT_ALL_SCENES, # XXX not working atm
+ EXPORT_ANIMATION): # Not used
- base_name, ext = splitExt(filepath)
+ base_name, ext = os.path.splitext(filepath)
context_name = [base_name, '', '', ext] # Base name, scene name, frame number, extension
orig_scene = context.scene
# Exit edit mode before exporting, so current object states are exported properly.
- bpy.ops.object.mode_set(mode='OBJECT')
+ if context.object:
+ bpy.ops.object.mode_set(mode='OBJECT')
-# if EXPORT_ALL_SCENES:
-# export_scenes = bpy.data.scenes
-# else:
-# export_scenes = [orig_scene]
+# if EXPORT_ALL_SCENES:
+# export_scenes = bpy.data.scenes
+# else:
+# export_scenes = [orig_scene]
# XXX only exporting one scene atm since changing
# current scene is not possible.
@@ -837,17 +796,17 @@ def do_export(filepath, context,
export_scenes = [orig_scene]
# Export all scenes.
- for scn in export_scenes:
- # scn.makeCurrent() # If already current, this is not slow.
- # context = scn.getRenderingContext()
- orig_frame = scn.frame_current
+ for scene in export_scenes:
+ # scene.makeCurrent() # If already current, this is not slow.
+ # context = scene.getRenderingContext()
+ orig_frame = scene.frame_current
if EXPORT_ALL_SCENES: # Add scene name into the context_name
- context_name[1] = '_%s' % bpy.utils.clean_name(scn.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
+ context_name[1] = '_%s' % bpy.path.clean_name(scene.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
# Export an animation?
if EXPORT_ANIMATION:
- scene_frames = range(scn.frame_start, context.frame_end + 1) # Up to and including the end frame.
+ scene_frames = range(scene.frame_start, context.frame_end + 1) # Up to and including the end frame.
else:
scene_frames = [orig_frame] # Dont export an animation.
@@ -856,30 +815,39 @@ def do_export(filepath, context,
if EXPORT_ANIMATION: # Add frame to the filepath.
context_name[2] = '_%.6d' % frame
- scn.frame_current = frame
+ scene.frame_current = frame
if EXPORT_SEL_ONLY:
- export_objects = context.selected_objects
+ objects = context.selected_objects
else:
- export_objects = scn.objects
+ objects = scene.objects
full_path= ''.join(context_name)
# erm... bit of a problem here, this can overwrite files when exporting frames. not too bad.
# EXPORT THE FILE.
- write(full_path, export_objects, scn,
- EXPORT_TRI, EXPORT_EDGES, EXPORT_NORMALS,
- EXPORT_NORMALS_HQ, EXPORT_UV, EXPORT_MTL,
- EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS,
- EXPORT_ROTX90, EXPORT_BLEN_OBS,
- EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER,
- EXPORT_POLYGROUPS, EXPORT_CURVE_AS_NURBS)
-
-
- scn.frame_current = orig_frame
+ write_file(full_path, objects, scene,
+ EXPORT_TRI,
+ EXPORT_EDGES,
+ EXPORT_NORMALS,
+ EXPORT_NORMALS_HQ,
+ EXPORT_UV,
+ EXPORT_MTL,
+ EXPORT_COPY_IMAGES,
+ EXPORT_APPLY_MODIFIERS,
+ EXPORT_ROTX90,
+ EXPORT_BLEN_OBS,
+ EXPORT_GROUP_BY_OB,
+ EXPORT_GROUP_BY_MAT,
+ EXPORT_KEEP_VERT_ORDER,
+ EXPORT_POLYGROUPS,
+ EXPORT_CURVE_AS_NURBS)
+
+
+ scene.frame_current = orig_frame
# Restore old active scene.
-# orig_scene.makeCurrent()
-# Window.WaitCursor(0)
+# orig_scene.makeCurrent()
+# Window.WaitCursor(0)
'''
@@ -904,12 +872,12 @@ class ExportOBJ(bpy.types.Operator):
check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
# context group
- use_selection = BoolProperty(name="Selection Only", description="", default= False)
+ use_selection = BoolProperty(name="Selection Only", description="Export selected objects only", default= False)
use_all_scenes = BoolProperty(name="All Scenes", description="", default= False)
- use_animation = BoolProperty(name="All Animation", description="", default= False)
+ use_animation = BoolProperty(name="Animation", description="", default= False)
# object group
- use_modifiers = BoolProperty(name="Apply Modifiers", description="", default= True)
+ use_modifiers = BoolProperty(name="Apply Modifiers", description="Apply modifiers (preview resolution)", default= True)
use_rotate90 = BoolProperty(name="Rotate X90", description="", default= True)
# extra data group
@@ -933,47 +901,47 @@ class ExportOBJ(bpy.types.Operator):
def execute(self, context):
filepath = self.properties.filepath
- if not filepath.lower().endswith(".obj"):
- filepath += ".obj"
-
- do_export(filepath, context,
- EXPORT_TRI=self.properties.use_triangles,
- EXPORT_EDGES=self.properties.use_edges,
- EXPORT_NORMALS=self.properties.use_normals,
- EXPORT_NORMALS_HQ=self.properties.use_hq_normals,
- EXPORT_UV=self.properties.use_uvs,
- EXPORT_MTL=self.properties.use_materials,
- EXPORT_COPY_IMAGES=self.properties.copy_images,
- EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
- EXPORT_ROTX90=self.properties.use_rotate90,
- EXPORT_BLEN_OBS=self.properties.use_blen_objects,
- EXPORT_GROUP_BY_OB=self.properties.group_by_object,
- EXPORT_GROUP_BY_MAT=self.properties.group_by_material,
- EXPORT_KEEP_VERT_ORDER=self.properties.keep_vertex_order,
- EXPORT_POLYGROUPS=self.properties.use_vertex_groups,
- EXPORT_CURVE_AS_NURBS=self.properties.use_nurbs,
- EXPORT_SEL_ONLY=self.properties.use_selection,
- EXPORT_ALL_SCENES=self.properties.use_all_scenes)
+ filepath = bpy.path.ensure_ext(filepath, ".obj")
+
+ write(filepath, context,
+ EXPORT_TRI=self.properties.use_triangles,
+ EXPORT_EDGES=self.properties.use_edges,
+ EXPORT_NORMALS=self.properties.use_normals,
+ EXPORT_NORMALS_HQ=self.properties.use_hq_normals,
+ EXPORT_UV=self.properties.use_uvs,
+ EXPORT_MTL=self.properties.use_materials,
+ EXPORT_COPY_IMAGES=self.properties.copy_images,
+ EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
+ EXPORT_ROTX90=self.properties.use_rotate90,
+ EXPORT_BLEN_OBS=self.properties.use_blen_objects,
+ EXPORT_GROUP_BY_OB=self.properties.group_by_object,
+ EXPORT_GROUP_BY_MAT=self.properties.group_by_material,
+ EXPORT_KEEP_VERT_ORDER=self.properties.keep_vertex_order,
+ EXPORT_POLYGROUPS=self.properties.use_vertex_groups,
+ EXPORT_CURVE_AS_NURBS=self.properties.use_nurbs,
+ EXPORT_SEL_ONLY=self.properties.use_selection,
+ EXPORT_ALL_SCENES=self.properties.use_all_scenes,
+ EXPORT_ANIMATION=self.properties.use_animation)
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".obj"
+
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".obj"
- self.layout.operator(ExportOBJ.bl_idname, text="Wavefront (.obj)").filepath = default_path
+ self.layout.operator(ExportOBJ.bl_idname, text="Wavefront (.obj)")
def register():
- bpy.types.register(ExportOBJ)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
- bpy.types.unregister(ExportOBJ)
bpy.types.INFO_MT_file_export.remove(menu_func)
@@ -986,4 +954,3 @@ def unregister():
if __name__ == "__main__":
register()
-
diff --git a/release/scripts/io/export_ply.py b/release/scripts/io/export_ply.py
index 0b936bdceb2..1a4fd7a6ff9 100644
--- a/release/scripts/io/export_ply.py
+++ b/release/scripts/io/export_ply.py
@@ -99,7 +99,8 @@ def write(filename, scene, ob, \
Window.WaitCursor(1)
"""
- bpy.ops.object.mode_set(mode='OBJECT')
+ if scene.objects.active:
+ bpy.ops.object.mode_set(mode='OBJECT')
#mesh = BPyMesh.getMeshFromObject(ob, None, EXPORT_APPLY_MODIFIERS, False, scn) # XXX
if EXPORT_APPLY_MODIFIERS:
@@ -146,7 +147,7 @@ def write(filename, scene, ob, \
# incase
color = uvcoord = uvcoord_key = normal = normal_key = None
- mesh_verts = mesh.verts # save a lookup
+ mesh_verts = mesh.vertices # save a lookup
ply_verts = [] # list of dictionaries
# vdict = {} # (index, normal, uv) -> new index
vdict = [{} for i in range(len(mesh_verts))]
@@ -155,7 +156,7 @@ def write(filename, scene, ob, \
for i, f in enumerate(mesh.faces):
- smooth = f.smooth
+ smooth = f.use_smooth
if not smooth:
normal = tuple(f.normal)
normal_key = rvec3d(normal)
@@ -167,7 +168,7 @@ def write(filename, scene, ob, \
col = active_col_layer[i]
col = col.color1, col.color2, col.color3, col.color4
- f_verts = f.verts
+ f_verts = f.vertices
pf = ply_faces[i]
for j, vidx in enumerate(f_verts):
@@ -274,16 +275,15 @@ class ExportPLY(bpy.types.Operator):
use_uvs = BoolProperty(name="UVs", description="Exort the active UV layer", default=True)
use_colors = BoolProperty(name="Vertex Colors", description="Exort the active vertex color layer", default=True)
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.active_object != None
def execute(self, context):
- # print("Selected: " + context.active_object.name)
+ filepath = self.properties.filepath
+ filepath = bpy.path.ensure_ext(filepath, ".ply")
- if not self.properties.filepath:
- raise Exception("filename not set")
-
- write(self.properties.filepath, context.scene, context.active_object,\
+ write(filepath, context.scene, context.active_object,\
EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
EXPORT_NORMALS=self.properties.use_normals,
EXPORT_UV=self.properties.use_uvs,
@@ -293,8 +293,11 @@ class ExportPLY(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".ply"
+
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def draw(self, context):
@@ -310,18 +313,14 @@ class ExportPLY(bpy.types.Operator):
def menu_func(self, context):
- import os
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".ply"
- self.layout.operator(ExportPLY.bl_idname, text="Stanford (.ply)").filepath = default_path
+ self.layout.operator(ExportPLY.bl_idname, text="Stanford (.ply)")
def register():
- bpy.types.register(ExportPLY)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
- bpy.types.unregister(ExportPLY)
bpy.types.INFO_MT_file_export.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/io/export_x3d.py b/release/scripts/io/export_x3d.py
index 1bad80f6d8e..aafb7c922a1 100644
--- a/release/scripts/io/export_x3d.py
+++ b/release/scripts/io/export_x3d.py
@@ -81,7 +81,7 @@ from export_3ds import create_derived_objects, free_derived_objects
#
DEG2RAD=0.017453292519943295
-MATWORLD= mathutils.RotationMatrix(-90, 4, 'X')
+MATWORLD= mathutils.Matrix.Rotation(-90, 4, 'X')
####################################
# Global Variables
@@ -406,13 +406,13 @@ class x3d_class:
# if mesh.faceUV:
for face in mesh.active_uv_texture.data:
# for face in mesh.faces:
- if face.halo and 'HALO' not in mode:
+ if face.use_halo and 'HALO' not in mode:
mode += ['HALO']
- if face.billboard and 'BILLBOARD' not in mode:
+ if face.use_billboard and 'BILLBOARD' not in mode:
mode += ['BILLBOARD']
- if face.object_color and 'OBJECT_COLOR' not in mode:
+ if face.use_object_color and 'OBJECT_COLOR' not in mode:
mode += ['OBJECT_COLOR']
- if face.collision and 'COLLISION' not in mode:
+ if face.use_collision and 'COLLISION' not in mode:
mode += ['COLLISION']
# mode |= face.mode
@@ -461,7 +461,7 @@ class x3d_class:
self.writeIndented("<Shape>\n",1)
maters=mesh.materials
hasImageTexture=0
- issmooth=0
+ is_smooth = False
if len(maters) > 0 or mesh.active_uv_texture:
# if len(maters) > 0 or mesh.faceUV:
@@ -470,7 +470,7 @@ class x3d_class:
if len(maters) >= 1:
mat=maters[0]
# matFlags = mat.getMode()
- if not mat.face_texture:
+ if not mat.use_face_texture:
# if not matFlags & Blender.Material.Modes['TEXFACE']:
self.writeMaterial(mat, self.cleanStr(mat.name,''), world)
# self.writeMaterial(mat, self.cleanStr(maters[0].name,''), world)
@@ -516,11 +516,11 @@ class x3d_class:
self.file.write("solid=\"true\" ")
for face in mesh.faces:
- if face.smooth:
- issmooth=1
- break
- if issmooth==1:
- creaseAngle=(mesh.autosmooth_angle)*(math.pi/180.0)
+ if face.use_smooth:
+ is_smooth = True
+ break
+ if is_smooth == True:
+ creaseAngle=(mesh.auto_smooth_angle)*(math.pi/180.0)
# creaseAngle=(mesh.degr)*(math.pi/180.0)
self.file.write("creaseAngle=\"%s\" " % (round(creaseAngle,self.cp)))
@@ -581,7 +581,7 @@ class x3d_class:
if self.writingcoords == 0:
self.file.write('coordIndex="')
for face in mesh.faces:
- fv = face.verts
+ fv = face.vertices
# fv = face.v
if len(fv)==3:
@@ -604,7 +604,7 @@ class x3d_class:
# mesh.transform(ob.matrix_world)
self.writeIndented("<Coordinate DEF=\"%s%s\" \n" % ("coord_",meshName), 1)
self.file.write("\t\t\t\tpoint=\"")
- for v in mesh.verts:
+ for v in mesh.vertices:
self.file.write("%.6f %.6f %.6f, " % tuple(v.co))
self.file.write("\" />")
self.writeIndented("\n", -1)
@@ -618,7 +618,7 @@ class x3d_class:
# for face in mesh.faces:
# workaround, since tface.uv iteration is wrong atm
uvs = face.uv
- # uvs = [face.uv1, face.uv2, face.uv3, face.uv4] if face.verts[3] else [face.uv1, face.uv2, face.uv3]
+ # uvs = [face.uv1, face.uv2, face.uv3, face.uv4] if face.vertices[3] else [face.uv1, face.uv2, face.uv3]
for uv in uvs:
# for uv in face.uv:
@@ -699,7 +699,7 @@ class x3d_class:
# specB = (mat.specCol[2]+0.001)/(1.25/(mat.spec+0.001))
transp = 1-mat.alpha
# matFlags = mat.getMode()
- if mat.shadeless:
+ if mat.use_shadeless:
# if matFlags & Blender.Material.Modes['SHADELESS']:
ambient = 1
shine = 1
@@ -731,7 +731,7 @@ class x3d_class:
def writeBackground(self, world, alltextures):
if world: worldname = world.name
else: return
- blending = (world.blend_sky, world.paper_sky, world.real_sky)
+ blending = (world.blend_sky, world.paper_sky, world.use_sky_real)
# blending = world.getSkytype()
grd = world.horizon_color
# grd = world.getHor()
@@ -794,7 +794,7 @@ class x3d_class:
pic = tex.image
# using .expandpath just in case, os.path may not expect //
- basename = os.path.basename(bpy.utils.expandpath(pic.filepath))
+ basename = os.path.basename(bpy.path.abspath(pic.filepath))
pic = alltextures[i].image
# pic = alltextures[i].getImage()
@@ -912,7 +912,7 @@ class x3d_class:
# if EXPORT_APPLY_MODIFIERS:
# if containerMesh:
- # containerMesh.verts = None
+ # containerMesh.vertices = None
self.cleanup()
@@ -964,13 +964,8 @@ class x3d_class:
if mesh.active_uv_texture:
# if mesh.faceUV:
for face in mesh.active_uv_texture.data:
- # for face in mesh.faces:
- sidename='';
- if face.twoside:
- # if face.mode & Mesh.FaceModes.TWOSIDE:
- sidename='two'
- else:
- sidename='one'
+ # for face in mesh.faces
+ sidename = "two" if face.use_twoside else "one"
if sidename in sided:
sided[sidename]+=1
@@ -1003,8 +998,8 @@ class x3d_class:
if face.mode & Mesh.FaceModes.TWOSIDE:
print("Debug: face.mode twosided")
- print("Debug: face.transp=0x%x (enum)" % face.transp)
- if face.transp == Mesh.FaceTranspModes.SOLID:
+ print("Debug: face.transp=0x%x (enum)" % face.blend_type)
+ if face.blend_type == Mesh.FaceTranspModes.SOLID:
print("Debug: face.transp.SOLID")
if face.image:
@@ -1030,7 +1025,7 @@ class x3d_class:
# print("Debug: mesh.faceUV=%d" % mesh.faceUV)
print("Debug: mesh.hasVertexColours=%d" % (len(mesh.vertex_colors) > 0))
# print("Debug: mesh.hasVertexColours=%d" % mesh.hasVertexColours())
- print("Debug: mesh.verts=%d" % len(mesh.verts))
+ print("Debug: mesh.vertices=%d" % len(mesh.vertices))
print("Debug: mesh.faces=%d" % len(mesh.faces))
print("Debug: mesh.materials=%d" % len(mesh.materials))
@@ -1140,7 +1135,7 @@ class x3d_class:
# Callbacks, needed before Main
##########################################################
-def x3d_export(filename,
+def write(filename,
context,
EXPORT_APPLY_MODIFIERS=False,
EXPORT_TRI=False,
@@ -1156,8 +1151,9 @@ def x3d_export(filename,
scene = context.scene
world = scene.world
-
- bpy.ops.object.mode_set(mode='OBJECT')
+
+ if scene.objects.active:
+ bpy.ops.object.mode_set(mode='OBJECT')
# XXX these are global textures while .Get() returned only scene's?
alltextures = bpy.data.textures
@@ -1174,47 +1170,6 @@ def x3d_export(filename,
)
-def x3d_export_ui(filename):
- if not filename.endswith(extension):
- filename += extension
- #if _safeOverwrite and sys.exists(filename):
- # result = Draw.PupMenu("File Already Exists, Overwrite?%t|Yes%x1|No%x0")
- #if(result != 1):
- # return
-
- # Get user options
- EXPORT_APPLY_MODIFIERS = Draw.Create(1)
- EXPORT_TRI = Draw.Create(0)
- EXPORT_GZIP = Draw.Create( filename.lower().endswith('.x3dz') )
-
- # Get USER Options
- pup_block = [\
- ('Apply Modifiers', EXPORT_APPLY_MODIFIERS, 'Use transformed mesh data from each object.'),\
- ('Triangulate', EXPORT_TRI, 'Triangulate quads.'),\
- ('Compress', EXPORT_GZIP, 'GZip the resulting file, requires a full python install'),\
- ]
-
- if not Draw.PupBlock('Export...', pup_block):
- return
-
- Blender.Window.EditMode(0)
- Blender.Window.WaitCursor(1)
-
- x3d_export(filename,\
- EXPORT_APPLY_MODIFIERS = EXPORT_APPLY_MODIFIERS.val,\
- EXPORT_TRI = EXPORT_TRI.val,\
- EXPORT_GZIP = EXPORT_GZIP.val\
- )
-
- Blender.Window.WaitCursor(0)
-
-
-
-#########################################################
-# main routine
-#########################################################
-
-
from bpy.props import *
class ExportX3D(bpy.types.Operator):
@@ -1232,26 +1187,35 @@ class ExportX3D(bpy.types.Operator):
compress = BoolProperty(name="Compress", description="GZip the resulting file, requires a full python install", default=False)
def execute(self, context):
- x3d_export(self.properties.filepath, context, self.properties.apply_modifiers, self.properties.triangulate, self.properties.compress)
+ filepath = self.properties.filepath
+ filepath = bpy.path.ensure_ext(filepath, ".x3d")
+
+ write(filepath,
+ context,
+ self.properties.apply_modifiers,
+ self.properties.triangulate,
+ self.properties.compress,
+ )
+
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".x3d"
+
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".x3d"
- self.layout.operator(ExportX3D.bl_idname, text="X3D Extensible 3D (.x3d)").filepath = default_path
+ self.layout.operator(ExportX3D.bl_idname, text="X3D Extensible 3D (.x3d)")
def register():
- bpy.types.register(ExportX3D)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
- bpy.types.unregister(ExportX3D)
bpy.types.INFO_MT_file_export.remove(menu_func)
# NOTES
diff --git a/release/scripts/io/import_anim_bvh.py b/release/scripts/io/import_anim_bvh.py
index d497ac47065..04cae915a49 100644
--- a/release/scripts/io/import_anim_bvh.py
+++ b/release/scripts/io/import_anim_bvh.py
@@ -23,7 +23,7 @@ from math import radians
import bpy
import mathutils
-from mathutils import Vector, Euler, Matrix, RotationMatrix, TranslationMatrix
+from mathutils import Vector, Euler, Matrix
class bvh_node_class(object):
@@ -78,7 +78,7 @@ MATRIX_IDENTITY_4x4 = Matrix([1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0,
def eulerRotate(x, y, z, rot_order):
# Clamp all values between 0 and 360, values outside this raise an error.
- mats = [RotationMatrix(x, 3, 'X'), RotationMatrix(y, 3, 'Y'), RotationMatrix(z, 3, 'Z')]
+ mats = [Matrix.Rotation(x, 3, 'X'), Matrix.Rotation(y, 3, 'Y'), Matrix.Rotation(z, 3, 'Z')]
return (MATRIX_IDENTITY_3x3 * mats[rot_order[0]] * (mats[rot_order[1]] * (mats[rot_order[2]]))).to_euler()
# Should work but doesnt!
@@ -347,7 +347,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
scn = context.scene
#XXX scn.objects.selected = []
for ob in scn.objects:
- ob.selected = False
+ ob.select = False
scn.set_frame(IMPORT_START_FRAME)
@@ -356,7 +356,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
scn.objects.link(arm_ob)
- arm_ob.selected = True
+ arm_ob.select = True
scn.objects.active = arm_ob
print(scn.objects.active)
@@ -426,7 +426,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
bvh_node.parent and\
bvh_node.parent.temp.name not in ZERO_AREA_BONES and\
bvh_node.parent.rest_tail_local == bvh_node.rest_head_local:
- bvh_node.temp.connected = True
+ bvh_node.temp.use_connect = True
# Replace the editbone with the editbone name,
# to avoid memory errors accessing the editbone outside editmode
@@ -529,7 +529,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
prev_euler[i] = euler
if bvh_node.has_loc:
- pose_bone.location = (bone_rest_matrix_inv * TranslationMatrix(Vector((lx, ly, lz)) - bvh_node.rest_head_local)).translation_part()
+ pose_bone.location = (bone_rest_matrix_inv * Matrix.Translation(Vector((lx, ly, lz)) - bvh_node.rest_head_local)).translation_part()
if bvh_node.has_loc:
pose_bone.keyframe_insert("location")
@@ -612,12 +612,10 @@ def menu_func(self, context):
def register():
- bpy.types.register(BvhImporter)
bpy.types.INFO_MT_file_import.append(menu_func)
def unregister():
- bpy.types.unregister(BvhImporter)
bpy.types.INFO_MT_file_import.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/io/import_scene_3ds.py b/release/scripts/io/import_scene_3ds.py
index 7b3004d4f52..6378d93df62 100644
--- a/release/scripts/io/import_scene_3ds.py
+++ b/release/scripts/io/import_scene_3ds.py
@@ -141,7 +141,7 @@ import os
import time
import struct
-from import_scene_obj import unpack_face_list, load_image
+from import_scene_obj import load_image
import bpy
import mathutils
@@ -312,10 +312,10 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
contextMaterial = None
contextMatrix_rot = None # Blender.mathutils.Matrix(); contextMatrix.identity()
#contextMatrix_tx = None # Blender.mathutils.Matrix(); contextMatrix.identity()
- contextMesh_vertls = None
+ contextMesh_vertls = None # flat array: (verts * 3)
contextMesh_facels = None
contextMeshMaterials = {} # matname:[face_idxs]
- contextMeshUV = None
+ contextMeshUV = None # flat array (verts * 2)
TEXTURE_DICT = {}
MATDICT = {}
@@ -333,113 +333,69 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
# print STRUCT_SIZE_4x3MAT, ' STRUCT_SIZE_4x3MAT'
def putContextMesh(myContextMesh_vertls, myContextMesh_facels, myContextMeshMaterials):
-
- materialFaces = set() # faces that have a material. Can optimize?
-
- # Now make copies with assigned materils.
-
- def makeMeshMaterialCopy(matName, faces):
- '''
- Make a new mesh with only face the faces that use this material.
- faces can be any iterable object - containing ints.
- '''
-
- faceVertUsers = [False] * len(myContextMesh_vertls)
- ok = 0
- for fIdx in faces:
- for vindex in myContextMesh_facels[fIdx]:
- faceVertUsers[vindex] = True
- if matName != None: # if matName is none then this is a set(), meaning we are using the untextured faces and do not need to store textured faces.
- materialFaces.add(fIdx)
- ok = 1
-
- if not ok:
- return
-
- myVertMapping = {}
- vertMappingIndex = 0
-
- vertsToUse = [i for i in range(len(myContextMesh_vertls)) if faceVertUsers[i]]
- myVertMapping = {ii: i for i, ii in enumerate(vertsToUse)}
-
- tempName= '%s_%s' % (contextObName, matName) # matName may be None.
- bmesh = bpy.data.meshes.new(tempName)
-
- if matName == None:
- img = None
+
+ bmesh = bpy.data.meshes.new(contextObName)
+ if myContextMesh_vertls:
+
+ bmesh.add_geometry(len(myContextMesh_vertls)//3, 0, len(myContextMesh_facels))
+ bmesh.vertices.foreach_set("co", myContextMesh_vertls)
+
+ eekadoodle_faces = []
+ for v1, v2, v3 in myContextMesh_facels:
+ eekadoodle_faces.extend([v3, v1, v2, 0] if v3 == 0 else [v1, v2, v3, 0])
+ bmesh.faces.foreach_set("vertices_raw", eekadoodle_faces)
+
+ if bmesh.faces and contextMeshUV:
+ bmesh.add_uv_texture()
+ uv_faces = bmesh.active_uv_texture.data[:]
else:
- bmat = MATDICT[matName][1]
- bmesh.add_material(bmat)
-# bmesh.materials = [bmat]
- try: img = TEXTURE_DICT[bmat.name]
- except: img = None
-
-# bmesh_verts = bmesh.verts
- if len(vertsToUse):
- bmesh.add_geometry(len(vertsToUse), 0, len(faces))
-
- # XXX why add extra vertex?
-# bmesh_verts.extend( [Vector()] )
- bmesh.verts.foreach_set("co", [x for tup in [myContextMesh_vertls[i] for i in vertsToUse] for x in tup])
-# bmesh_verts.extend( [myContextMesh_vertls[i] for i in vertsToUse] )
-
- # +1 because of DUMMYVERT
- bmesh.faces.foreach_set("verts_raw", unpack_face_list([[myVertMapping[vindex] for vindex in myContextMesh_facels[fIdx]] for fIdx in faces]))
-# face_mapping = bmesh.faces.extend( [ [ bmesh_verts[ myVertMapping[vindex]+1] for vindex in myContextMesh_facels[fIdx]] for fIdx in faces ], indexList=True )
-
- if bmesh.faces and (contextMeshUV or img):
- bmesh.add_uv_texture()
- for ii, i in enumerate(faces):
-
- # Mapped index- faces may have not been added- if so, then map to the correct index
- # BUGGY API - face_mapping is not always the right length
-# map_index = face_mapping[ii]
-
- if 1:
-# if map_index != None:
- targetFace = bmesh.faces[ii]
-# targetFace = bmesh.faces[map_index]
-
- uf = bmesh.active_uv_texture.data[ii]
-
- if contextMeshUV:
- # v.index-1 because of the DUMMYVERT
- uvs = [contextMeshUV[vindex] for vindex in myContextMesh_facels[i]]
-
- if len(myContextMesh_facels[i]) == 3:
- uf.uv1, uf.uv2, uf.uv3, uf.uv4 = uvs + [(0.0, 0.0)]
- else:
- uf.uv1, uf.uv2, uf.uv3, uf.uv4 = uvs
-# targetFace.uv = [contextMeshUV[vindex] for vindex in myContextMesh_facels[i]]
- if img:
- uf.image = img
-
- # to get this image to show up in 'Textured' shading mode
- uf.tex = True
-
- # bmesh.transform(contextMatrix)
- ob = bpy.data.objects.new(tempName, bmesh)
- SCN.objects.link(ob)
-# ob = SCN_OBJECTS.new(bmesh, tempName)
- '''
- if contextMatrix_tx:
- ob.setMatrix(contextMatrix_tx)
- '''
-
- if contextMatrix_rot:
- ob.matrix_world = contextMatrix_rot
-
- importedObjects.append(ob)
- bmesh.update()
-# bmesh.calcNormals()
-
- for matName, faces in myContextMeshMaterials.items():
- makeMeshMaterialCopy(matName, faces)
-
- if len(materialFaces) != len(myContextMesh_facels):
- # Invert material faces.
- makeMeshMaterialCopy(None, set(range(len( myContextMesh_facels ))) - materialFaces)
- #raise 'Some UnMaterialed faces', len(contextMesh.faces)
+ uv_faces = None
+
+ for mat_idx, (matName, faces) in enumerate(myContextMeshMaterials.items()):
+ if matName is None:
+ bmesh.add_material(None)
+ else:
+ bmat = MATDICT[matName][1]
+ bmesh.add_material(bmat) # can be None
+ img = TEXTURE_DICT.get(bmat.name)
+
+ if uv_faces and img:
+ for fidx in faces:
+ bmesh.faces[fidx].material_index = mat_idx
+ uf = uv_faces[fidx]
+ uf.image = img
+ uf.use_image = True
+ else:
+ for fidx in faces:
+ bmesh.faces[fidx].material_index = mat_idx
+
+ if uv_faces:
+ for fidx, uf in enumerate(uv_faces):
+ face = myContextMesh_facels[fidx]
+ v1, v2, v3 = face
+
+ # eekadoodle
+ if v3 == 0:
+ v1, v2, v3 = v3, v1, v2
+
+ uf.uv1 = contextMeshUV[v1 * 2:(v1 * 2) + 2]
+ uf.uv2 = contextMeshUV[v2 * 2:(v2 * 2) + 2]
+ uf.uv3 = contextMeshUV[v3 * 2:(v3 * 2) + 2]
+ # always a tri
+
+ ob = bpy.data.objects.new(tempName, bmesh)
+ SCN.objects.link(ob)
+
+ '''
+ if contextMatrix_tx:
+ ob.setMatrix(contextMatrix_tx)
+ '''
+
+ if contextMatrix_rot:
+ ob.matrix_world = contextMatrix_rot
+
+ importedObjects.append(ob)
+ bmesh.update()
#a spare chunk
new_chunk = chunk()
@@ -667,14 +623,10 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
new_chunk.bytes_read += 2
# print 'number of verts: ', num_verts
- def getvert():
- temp_data = struct.unpack('<3f', file.read(STRUCT_SIZE_3FLOAT))
- new_chunk.bytes_read += STRUCT_SIZE_3FLOAT #12: 3 floats x 4 bytes each
- return temp_data
-
- #contextMesh.verts.extend( [Vector(),] ) # DUMMYVERT! - remove when blenders internals are fixed.
- contextMesh_vertls = [getvert() for i in range(num_verts)]
-
+ contextMesh_vertls = struct.unpack('<%df' % (num_verts * 3), file.read(STRUCT_SIZE_3FLOAT * num_verts))
+ new_chunk.bytes_read += STRUCT_SIZE_3FLOAT * num_verts
+ # dummyvert is not used atm!
+
#print 'object verts: bytes read: ', new_chunk.bytes_read
elif (new_chunk.ID == OBJECT_FACES):
@@ -684,15 +636,11 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
new_chunk.bytes_read += 2
#print 'number of faces: ', num_faces
- def getface():
- # print '\ngetting a face'
- temp_data = file.read(STRUCT_SIZE_4UNSIGNED_SHORT)
- new_chunk.bytes_read += STRUCT_SIZE_4UNSIGNED_SHORT #4 short ints x 2 bytes each
- v1,v2,v3,dummy = struct.unpack('<4H', temp_data)
- return v1, v2, v3
-
- contextMesh_facels = [ getface() for i in range(num_faces) ]
-
+ # print '\ngetting a face'
+ temp_data = file.read(STRUCT_SIZE_4UNSIGNED_SHORT * num_faces)
+ new_chunk.bytes_read += STRUCT_SIZE_4UNSIGNED_SHORT * num_faces #4 short ints x 2 bytes each
+ contextMesh_facels = struct.unpack('<%dH' % (num_faces * 4), temp_data)
+ contextMesh_facels = [contextMesh_facels[i - 3:i] for i in range(3, (num_faces * 4) + 3, 4)]
elif (new_chunk.ID == OBJECT_MATERIAL):
# print 'elif (new_chunk.ID == OBJECT_MATERIAL):'
@@ -703,12 +651,11 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
num_faces_using_mat = struct.unpack('<H', temp_data)[0]
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT
- def getmat():
- temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
- new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT
- return struct.unpack('<H', temp_data)[0]
+
+ temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT * num_faces_using_mat)
+ new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * num_faces_using_mat
- contextMeshMaterials[material_name]= [ getmat() for i in range(num_faces_using_mat) ]
+ contextMeshMaterials[material_name]= struct.unpack("<%dH" % (num_faces_using_mat), temp_data)
#look up the material in all the materials
@@ -717,12 +664,9 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
num_uv = struct.unpack('<H', temp_data)[0]
new_chunk.bytes_read += 2
- def getuv():
- temp_data = file.read(STRUCT_SIZE_2FLOAT)
- new_chunk.bytes_read += STRUCT_SIZE_2FLOAT #2 float x 4 bytes each
- return mathutils.Vector( struct.unpack('<2f', temp_data) )
-
- contextMeshUV = [ getuv() for i in range(num_uv) ]
+ temp_data = file.read(STRUCT_SIZE_2FLOAT * num_uv)
+ new_chunk.bytes_read += STRUCT_SIZE_2FLOAT * num_uv
+ contextMeshUV = struct.unpack('<%df' % (num_uv * 2), temp_data)
elif (new_chunk.ID == OBJECT_TRANS_MATRIX):
# How do we know the matrix size? 54 == 4x4 48 == 4x3
@@ -771,7 +715,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
#print contextMatrix_rot
contextMatrix_rot.invert()
#print contextMatrix_rot
- #contextMatrix_tx = Blender.mathutils.TranslationMatrix(0.5 * Blender.mathutils.Vector(data[9:]))
+ #contextMatrix_tx = mathutils.Matrix.Translation(0.5 * Blender.mathutils.Vector(data[9:]))
#contextMatrix_tx.invert()
#tx.invert()
@@ -806,7 +750,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
# FINISHED LOOP
# There will be a number of objects still not added
- if contextMesh_facels != None:
+ if CreateBlenderObject:
putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials)
def load_3ds(filename, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, APPLY_MATRIX=False):
@@ -883,14 +827,12 @@ def load_3ds(filename, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True,
# REMOVE DUMMYVERT, - remove this in the next release when blenders internal are fixed.
-
-# for ob in importedObjects:
-# if ob.type == 'MESH':
-# # if ob.type=='Mesh':
-# me = ob.getData(mesh=1)
-# me.verts.delete([me.verts[0],])
-# if not APPLY_MATRIX:
-# me.transform(ob.matrix_world.copy().invert())
+ for ob in importedObjects:
+ if ob.type == 'MESH':
+ me = ob.data
+# me.vertices.delete([me.vertices[0],]) # XXX, todo
+ if not APPLY_MATRIX:
+ me.transform(ob.matrix_world.copy().invert())
# Done DUMMYVERT
"""
@@ -1009,15 +951,19 @@ class IMPORT_OT_autodesk_3ds(bpy.types.Operator):
# List of operator properties, the attributes will be assigned
# to the class instance from the operator settings before calling.
-
filepath = StringProperty(name="File Path", description="Filepath used for importing the 3DS file", maxlen= 1024, default= "")
-# size_constraint = FloatProperty(name="Size Constraint", description="Scale the model by 10 until it reacehs the size constraint. Zero Disables.", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=10.0),
-# search_images = BoolProperty(name="Image Search", description="Search subdirectories for any assosiated images (Warning, may be slow)", default=True),
-# apply_matrix = BoolProperty(name="Transform Fix", description="Workaround for object transformations importing incorrectly", default=False),
+ constrain_size = FloatProperty(name="Size Constraint", description="Scale the model by 10 until it reacehs the size constraint. Zero Disables.", min=0.0, max=1000.0, soft_min=0.0, soft_max=1000.0, default=10.0)
+ search_images = BoolProperty(name="Image Search", description="Search subdirectories for any assosiated images (Warning, may be slow)", default=True)
+ apply_transform = BoolProperty(name="Apply Transform", description="Workaround for object transformations importing incorrectly", default=False)
def execute(self, context):
- load_3ds(self.properties.filepath, context, 0.0, False, False)
+ load_3ds(self.properties.filepath,
+ context,
+ IMPORT_CONSTRAIN_BOUNDS=self.properties.constrain_size,
+ IMAGE_SEARCH=self.properties.search_images,
+ APPLY_MATRIX=self.properties.apply_transform)
+
return {'FINISHED'}
def invoke(self, context, event):
@@ -1030,11 +976,9 @@ def menu_func(self, context):
self.layout.operator(IMPORT_OT_autodesk_3ds.bl_idname, text="3D Studio (.3ds)")
def register():
- bpy.types.register(IMPORT_OT_autodesk_3ds)
bpy.types.INFO_MT_file_import.append(menu_func)
def unregister():
- bpy.types.unregister(IMPORT_OT_autodesk_3ds)
bpy.types.INFO_MT_file_import.remove(menu_func)
# NOTES:
diff --git a/release/scripts/io/import_scene_obj.py b/release/scripts/io/import_scene_obj.py
index afe82410557..655f797750e 100644
--- a/release/scripts/io/import_scene_obj.py
+++ b/release/scripts/io/import_scene_obj.py
@@ -82,23 +82,21 @@ def unpack_list(list_of_tuples):
# same as above except that it adds 0 for triangle faces
def unpack_face_list(list_of_tuples):
- l = []
- for t in list_of_tuples:
- face = [i for i in t]
-
- if len(face) != 3 and len(face) != 4:
- raise RuntimeError("{0} vertices in face.".format(len(face)))
-
- # rotate indices if the 4th is 0
- if len(face) == 4 and face[3] == 0:
- face = [face[3], face[0], face[1], face[2]]
+ # allocate the entire list
+ flat_ls = [0] * (len(list_of_tuples) * 4)
+ i = 0
- if len(face) == 3:
- face.append(0)
-
- l.extend(face)
+ for t in list_of_tuples:
+ if len(t) == 3:
+ if t[2] == 0:
+ t = t[1], t[2], t[0]
+ else: # assuem quad
+ if t[3] == 0 or t[2] == 0:
+ t = t[2], t[3], t[0], t[1]
- return l
+ flat_ls[i:i + len(t)] = t
+ i += 4
+ return flat_ls
def BPyMesh_ngon(from_data, indices, PREF_FIX_LOOPS= True):
'''
@@ -139,7 +137,7 @@ def BPyMesh_ngon(from_data, indices, PREF_FIX_LOOPS= True):
if type(from_data) in (tuple, list):
verts= [Vector(from_data[i]) for ii, i in enumerate(indices)]
else:
- verts= [from_data.verts[i].co for ii, i in enumerate(indices)]
+ verts= [from_data.vertices[i].co for ii, i in enumerate(indices)]
for i in range(len(verts)-1, 0, -1): # same as reversed(xrange(1, len(verts))):
if verts[i][1]==verts[i-1][0]:
@@ -156,7 +154,7 @@ def BPyMesh_ngon(from_data, indices, PREF_FIX_LOOPS= True):
if type(from_data) in (tuple, list):
verts= [vert_treplet(Vector(from_data[i]), ii) for ii, i in enumerate(indices)]
else:
- verts= [vert_treplet(from_data.verts[i].co, ii) for ii, i in enumerate(indices)]
+ verts= [vert_treplet(from_data.vertices[i].co, ii) for ii, i in enumerate(indices)]
edges= [(i, i-1) for i in range(len(verts))]
if edges:
@@ -305,24 +303,28 @@ def load_image(imagepath, dirname):
if os.path.exists(imagepath):
return bpy.data.images.load(imagepath)
- variants = [os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
+ variants = [imagepath, os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
- for path in variants:
- if os.path.exists(path):
- return bpy.data.images.load(path)
- else:
- print(path, "doesn't exist")
+ for filepath in variants:
+ for nfilepath in (filepath, bpy.path.resolve_ncase(filepath)):
+ if os.path.exists(nfilepath):
+ return bpy.data.images.load(nfilepath)
# TODO comprehensiveImageLoad also searched in bpy.config.textureDir
return None
def obj_image_load(imagepath, DIR, IMAGE_SEARCH):
-
if '_' in imagepath:
image= load_image(imagepath.replace('_', ' '), DIR)
- if image: return image
+ if image:
+ return image
- return load_image(imagepath, DIR)
+ image = load_image(imagepath, DIR)
+ if image:
+ return image
+
+ print("failed to load '%s' doesn't exist", imagepath)
+ return None
# def obj_image_load(imagepath, DIR, IMAGE_SEARCH):
# '''
@@ -373,38 +375,32 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
# Image has alpha
# XXX bitmask won't work?
- blender_material.add_texture(texture, "UV", ("COLOR", "ALPHA"))
+ blender_material.add_texture(texture, 'UV', {'COLOR', 'ALPHA'})
texture.mipmap = True
texture.interpolation = True
texture.use_alpha = True
- blender_material.z_transparency = True
+ blender_material.use_transparency = True
blender_material.alpha = 0.0
-
-# blender_material.setTexture(0, texture, Texture.TexCo.UV, Texture.MapTo.COL | Texture.MapTo.ALPHA)
-# texture.setImageFlags('MipMap', 'InterPol', 'UseAlpha')
-# blender_material.mode |= Material.Modes.ZTRANSP
-# blender_material.alpha = 0.0
else:
- blender_material.add_texture(texture, "UV", "COLOR")
-# blender_material.setTexture(0, texture, Texture.TexCo.UV, Texture.MapTo.COL)
+ blender_material.add_texture(texture, 'UV', 'COLOR')
# adds textures to faces (Textured/Alt-Z mode)
# Only apply the diffuse texture to the face if the image has not been set with the inline usemat func.
unique_material_images[context_material_name]= image, has_data # set the texface image
elif type == 'Ka':
- blender_material.add_texture(texture, "UV", "AMBIENT")
+ blender_material.add_texture(texture, 'UV', 'AMBIENT')
# blender_material.setTexture(1, texture, Texture.TexCo.UV, Texture.MapTo.CMIR) # TODO- Add AMB to BPY API
elif type == 'Ks':
- blender_material.add_texture(texture, "UV", "SPECULARITY")
+ blender_material.add_texture(texture, 'UV', 'SPECULARITY')
# blender_material.setTexture(2, texture, Texture.TexCo.UV, Texture.MapTo.SPEC)
elif type == 'Bump':
- blender_material.add_texture(texture, "UV", "NORMAL")
+ blender_material.add_texture(texture, 'UV', 'NORMAL')
# blender_material.setTexture(3, texture, Texture.TexCo.UV, Texture.MapTo.NOR)
elif type == 'D':
- blender_material.add_texture(texture, "UV", "ALPHA")
+ blender_material.add_texture(texture, 'UV', 'ALPHA')
blender_material.z_transparency = True
blender_material.alpha = 0.0
# blender_material.setTexture(4, texture, Texture.TexCo.UV, Texture.MapTo.ALPHA)
@@ -413,15 +409,14 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
# Todo, unset deffuse material alpha if it has an alpha channel
elif type == 'refl':
- blender_material.add_texture(texture, "UV", "REFLECTION")
+ blender_material.add_texture(texture, 'UV', 'REFLECTION')
# blender_material.setTexture(5, texture, Texture.TexCo.UV, Texture.MapTo.REF)
# Add an MTL with the same name as the obj if no MTLs are spesified.
temp_mtl = os.path.splitext((os.path.basename(filepath)))[0] + '.mtl'
- if os.path.exists(DIR + temp_mtl) and temp_mtl not in material_libs:
-# if sys.exists(DIR + temp_mtl) and temp_mtl not in material_libs:
+ if os.path.exists(os.path.join(DIR, temp_mtl)) and temp_mtl not in material_libs:
material_libs.append( temp_mtl )
del temp_mtl
@@ -435,11 +430,9 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
unique_material_images[None]= None, False
for libname in material_libs:
- mtlpath= DIR + libname
+ mtlpath= os.path.join(DIR, libname)
if not os.path.exists(mtlpath):
-# if not sys.exists(mtlpath):
- #print '\tError Missing MTL: "%s"' % mtlpath
- pass
+ print ("\tError Missing MTL: '%s'" % mtlpath)
else:
#print '\t\tloading mtl: "%s"' % mtlpath
context_material= None
@@ -504,49 +497,32 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
-def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP, SPLIT_MATERIALS):
+def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP):
'''
- Takes vert_loc and faces, and seperates into multiple sets of
+ Takes vert_loc and faces, and separates into multiple sets of
(verts_loc, faces, unique_materials, dataname)
'''
filename = os.path.splitext((os.path.basename(filepath)))[0]
- if not SPLIT_OB_OR_GROUP and not SPLIT_MATERIALS:
+ if not SPLIT_OB_OR_GROUP:
# use the filename for the object name since we arnt chopping up the mesh.
return [(verts_loc, faces, unique_materials, filename)]
-
def key_to_name(key):
# if the key is a tuple, join it to make a string
- if type(key) == tuple:
- return '%s_%s' % key
- elif not key:
+ if not key:
return filename # assume its a string. make sure this is true if the splitting code is changed
else:
return key
# Return a key that makes the faces unique.
- if SPLIT_OB_OR_GROUP and not SPLIT_MATERIALS:
- def face_key(face):
- return face[4] # object
-
- elif not SPLIT_OB_OR_GROUP and SPLIT_MATERIALS:
- def face_key(face):
- return face[2] # material
-
- else: # Both
- def face_key(face):
- return face[4], face[2] # object,material
-
-
face_split_dict= {}
oldkey= -1 # initialize to a value that will never match the key
for face in faces:
-
- key= face_key(face)
+ key= face[4]
if oldkey != key:
# Check the key has changed.
@@ -571,7 +547,6 @@ def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP,
vert_remap[i]= new_index # set the new remapped index so we only add once and can reference next time.
face_vert_loc_indicies[enum] = new_index # remap to the local index
verts_split.append( verts_loc[i] ) # add the vert to the local verts
-
else:
face_vert_loc_indicies[enum] = vert_remap[i] # remap to the local index
@@ -581,12 +556,11 @@ def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP,
faces_split.append(face)
-
# remove one of the itemas and reorder
return [(value[0], value[1], value[2], key_to_name(key)) for key, value in list(face_split_dict.items())]
-def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, verts_tex, faces, unique_materials, unique_material_images, unique_smooth_groups, vertex_groups, dataname):
+def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, verts_tex, faces, unique_materials, unique_material_images, unique_smooth_groups, vertex_groups, dataname):
'''
Takes all the data gathered and generates a mesh, adding the new object to new_objects
deals with fgons, sharp edges and assigning materials
@@ -703,18 +677,18 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
# make sure the list isnt too big
for material in materials:
me.add_material(material)
- #me.verts.extend([(0,0,0)]) # dummy vert
+ #me.vertices.extend([(0,0,0)]) # dummy vert
me.add_geometry(len(verts_loc), 0, len(faces))
# verts_loc is a list of (x, y, z) tuples
- me.verts.foreach_set("co", unpack_list(verts_loc))
-# me.verts.extend(verts_loc)
+ me.vertices.foreach_set("co", unpack_list(verts_loc))
+# me.vertices.extend(verts_loc)
# faces is a list of (vert_indices, texco_indices, ...) tuples
# XXX faces should contain either 3 or 4 verts
# XXX no check for valid face indices
- me.faces.foreach_set("verts_raw", unpack_face_list([f[0] for f in faces]))
+ me.faces.foreach_set("vertices_raw", unpack_face_list([f[0] for f in faces]))
# face_mapping= me.faces.extend([f[0] for f in faces], indexList=True)
if verts_tex and me.faces:
@@ -752,7 +726,7 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
if context_smooth_group:
- blender_face.smooth= True
+ blender_face.use_smooth = True
if context_material:
if context_material_old is not context_material:
@@ -768,14 +742,12 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
blender_tface= me.uv_textures[0].data[i]
if context_material:
- image, has_data= unique_material_images[context_material]
+ image, has_data = unique_material_images[context_material]
if image: # Can be none if the material dosnt have an image.
- blender_tface.image= image
-# blender_face.image= image
- if has_data:
-# if has_data and image.depth == 32:
- blender_tface.transp = 'ALPHA'
-# blender_face.transp |= ALPHA
+ blender_tface.image = image
+ blender_tface.use_image = True
+ if has_data and image.depth == 32:
+ blender_tface.blend_type = 'ALPHA'
# BUG - Evil eekadoodle problem where faces that have vert index 0 location at 3 or 4 are shuffled.
if len(face_vert_loc_indicies)==4:
@@ -804,7 +776,7 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
me.add_geometry(0, len(edges), 0)
# edges should be a list of (a, b) tuples
- me.edges.foreach_set("verts", unpack_list(edges))
+ me.edges.foreach_set("vertices", unpack_list(edges))
# me_edges.extend( edges )
# del me_edges
@@ -819,8 +791,8 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
# if CREATE_FGONS and fgon_edges:
# for fgon_edge in fgon_edges.keys():
# for ed in me.edges:
-# if edges_match(fgon_edge, ed.verts):
-# ed.fgon = True
+# if edges_match(fgon_edge, ed.vertices):
+# ed.is_fgon = True
# if CREATE_FGONS and fgon_edges:
# FGON= Mesh.EdgeFlags.FGON
@@ -833,8 +805,8 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
# if unique_smooth_groups and sharp_edges:
# for sharp_edge in sharp_edges.keys():
# for ed in me.edges:
-# if edges_match(sharp_edge, ed.verts):
-# ed.sharp = True
+# if edges_match(sharp_edge, ed.vertices):
+# ed.use_edge_sharp = True
# if unique_smooth_groups and sharp_edges:
# SHARP= Mesh.EdgeFlags.SHARP
@@ -847,7 +819,6 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
# me.calcNormals()
ob= bpy.data.objects.new("Mesh", me)
- scn.objects.link(ob)
new_objects.append(ob)
# Create the vertex groups. No need to have the flag passed here since we test for the
@@ -861,7 +832,7 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
# me.assignVertsToGroup(group_name, group_indicies, 1.00, Mesh.AssignModes.REPLACE)
-def create_nurbs(scn, context_nurbs, vert_loc, new_objects):
+def create_nurbs(context_nurbs, vert_loc, new_objects):
'''
Add nurbs object to blender, only support one type at the moment
'''
@@ -936,8 +907,9 @@ def create_nurbs(scn, context_nurbs, vert_loc, new_objects):
if do_closed:
nu.flagU |= 1
'''
+
+ ob= bpy.data.objects.new("Mesh", me)
- ob = scn.objects.new(cu)
new_objects.append(ob)
@@ -1262,7 +1234,6 @@ def load_obj(filepath,
# bpy.ops.OBJECT_OT_select_all()
scene = context.scene
-# scn = bpy.data.scenes.active
# scn.objects.selected = []
new_objects= [] # put new objects here
@@ -1271,14 +1242,20 @@ def load_obj(filepath,
if SPLIT_OBJECTS or SPLIT_GROUPS: SPLIT_OB_OR_GROUP = True
else: SPLIT_OB_OR_GROUP = False
- for verts_loc_split, faces_split, unique_materials_split, dataname in split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP, SPLIT_MATERIALS):
+ for verts_loc_split, faces_split, unique_materials_split, dataname in split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP):
# Create meshes from the data, warning 'vertex_groups' wont support splitting
- create_mesh(scene, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc_split, verts_tex, faces_split, unique_materials_split, unique_material_images, unique_smooth_groups, vertex_groups, dataname)
+ create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc_split, verts_tex, faces_split, unique_materials_split, unique_material_images, unique_smooth_groups, vertex_groups, dataname)
# nurbs support
# for context_nurbs in nurbs:
# create_nurbs(scn, context_nurbs, verts_loc, new_objects)
+ # Create new obj
+ for obj in new_objects:
+ scene.objects.link(obj)
+
+ scene.update()
+
axis_min= [ 1000000000]*3
axis_max= [-1000000000]*3
@@ -1320,14 +1297,13 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
if BPyMessages.Error_NoFile(filepath):
return
- global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, CLAMP_SIZE, IMAGE_SEARCH, POLYGROUPS, KEEP_VERT_ORDER, ROTATE_X90
+ global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, CLAMP_SIZE, IMAGE_SEARCH, POLYGROUPS, KEEP_VERT_ORDER, ROTATE_X90
CREATE_SMOOTH_GROUPS= Draw.Create(0)
CREATE_FGONS= Draw.Create(1)
CREATE_EDGES= Draw.Create(1)
SPLIT_OBJECTS= Draw.Create(0)
SPLIT_GROUPS= Draw.Create(0)
- SPLIT_MATERIALS= Draw.Create(0)
CLAMP_SIZE= Draw.Create(10.0)
IMAGE_SEARCH= Draw.Create(1)
POLYGROUPS= Draw.Create(0)
@@ -1346,7 +1322,6 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
'Separate objects from obj...',\
('Object', SPLIT_OBJECTS, 'Import OBJ Objects into Blender Objects'),\
('Group', SPLIT_GROUPS, 'Import OBJ Groups into Blender Objects'),\
- ('Split Materials', SPLIT_MATERIALS, 'Import each material into a seperate mesh'),\
'Options...',\
('Keep Vert Order', KEEP_VERT_ORDER, 'Keep vert and face order, disables some other options.'),\
('Clamp Scale:', CLAMP_SIZE, 0.0, 1000.0, 'Clamp the size to this maximum (Zero to Disable)'),\
@@ -1359,7 +1334,6 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
if KEEP_VERT_ORDER.val:
SPLIT_OBJECTS.val = False
SPLIT_GROUPS.val = False
- SPLIT_MATERIALS.val = False
'''
@@ -1381,25 +1355,25 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
GLOBALS['EVENT'] = e
def do_split(e,v):
- global SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, KEEP_VERT_ORDER, POLYGROUPS
- if SPLIT_OBJECTS.val or SPLIT_GROUPS.val or SPLIT_MATERIALS.val:
+ global SPLIT_OBJECTS, SPLIT_GROUPS, KEEP_VERT_ORDER, POLYGROUPS
+ if SPLIT_OBJECTS.val or SPLIT_GROUPS.val:
KEEP_VERT_ORDER.val = 0
POLYGROUPS.val = 0
else:
KEEP_VERT_ORDER.val = 1
def do_vertorder(e,v):
- global SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, KEEP_VERT_ORDER
+ global SPLIT_OBJECTS, SPLIT_GROUPS, KEEP_VERT_ORDER
if KEEP_VERT_ORDER.val:
- SPLIT_OBJECTS.val = SPLIT_GROUPS.val = SPLIT_MATERIALS.val = 0
+ SPLIT_OBJECTS.val = SPLIT_GROUPS.val = 0
else:
- if not (SPLIT_OBJECTS.val or SPLIT_GROUPS.val or SPLIT_MATERIALS.val):
+ if not (SPLIT_OBJECTS.val or SPLIT_GROUPS.val):
KEEP_VERT_ORDER.val = 1
def do_polygroups(e,v):
- global SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, KEEP_VERT_ORDER, POLYGROUPS
+ global SPLIT_OBJECTS, SPLIT_GROUPS, KEEP_VERT_ORDER, POLYGROUPS
if POLYGROUPS.val:
- SPLIT_OBJECTS.val = SPLIT_GROUPS.val = SPLIT_MATERIALS.val = 0
+ SPLIT_OBJECTS.val = SPLIT_GROUPS.val = 0
def do_help(e,v):
url = __url__[0]
@@ -1419,7 +1393,7 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
ui_x -= 165
ui_y -= 90
- global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, CLAMP_SIZE, IMAGE_SEARCH, POLYGROUPS, KEEP_VERT_ORDER, ROTATE_X90
+ global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, CLAMP_SIZE, IMAGE_SEARCH, POLYGROUPS, KEEP_VERT_ORDER, ROTATE_X90
Draw.Label('Import...', ui_x+9, ui_y+159, 220, 21)
Draw.BeginAlign()
@@ -1432,7 +1406,6 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
Draw.BeginAlign()
SPLIT_OBJECTS = Draw.Toggle('Object', EVENT_REDRAW, ui_x+9, ui_y+89, 55, 21, SPLIT_OBJECTS.val, 'Import OBJ Objects into Blender Objects', do_split)
SPLIT_GROUPS = Draw.Toggle('Group', EVENT_REDRAW, ui_x+64, ui_y+89, 55, 21, SPLIT_GROUPS.val, 'Import OBJ Groups into Blender Objects', do_split)
- SPLIT_MATERIALS = Draw.Toggle('Split Materials', EVENT_REDRAW, ui_x+119, ui_y+89, 60, 21, SPLIT_MATERIALS.val, 'Import each material into a seperate mesh', do_split)
Draw.EndAlign()
# Only used for user feedback
@@ -1492,7 +1465,6 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
CREATE_EDGES.val,\
SPLIT_OBJECTS.val,\
SPLIT_GROUPS.val,\
- SPLIT_MATERIALS.val,\
ROTATE_X90.val,\
IMAGE_SEARCH.val,\
POLYGROUPS.val
@@ -1506,7 +1478,6 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
CREATE_EDGES.val,\
SPLIT_OBJECTS.val,\
SPLIT_GROUPS.val,\
- SPLIT_MATERIALS.val,\
ROTATE_X90.val,\
IMAGE_SEARCH.val,\
POLYGROUPS.val
@@ -1570,7 +1541,6 @@ class IMPORT_OT_obj(bpy.types.Operator):
CREATE_EDGES = BoolProperty(name="Lines as Edges", description="Import lines and faces with 2 verts as edge", default= True)
SPLIT_OBJECTS = BoolProperty(name="Object", description="Import OBJ Objects into Blender Objects", default= True)
SPLIT_GROUPS = BoolProperty(name="Group", description="Import OBJ Groups into Blender Objects", default= True)
- SPLIT_MATERIALS = BoolProperty(name="Split Materials", description="Import each material into a seperate mesh", default= False)
# old comment: only used for user feedback
# disabled this option because in old code a handler for it disabled SPLIT* params, it's not passed to load_obj
# KEEP_VERT_ORDER = BoolProperty(name="Keep Vert Order", description="Keep vert and face order, disables split options, enable for morph targets", default= True)
@@ -1591,7 +1561,6 @@ class IMPORT_OT_obj(bpy.types.Operator):
self.properties.CREATE_EDGES,
self.properties.SPLIT_OBJECTS,
self.properties.SPLIT_GROUPS,
- self.properties.SPLIT_MATERIALS,
self.properties.ROTATE_X90,
self.properties.IMAGE_SEARCH,
self.properties.POLYGROUPS)
@@ -1599,8 +1568,7 @@ class IMPORT_OT_obj(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
@@ -1609,11 +1577,9 @@ def menu_func(self, context):
def register():
- bpy.types.register(IMPORT_OT_obj)
bpy.types.INFO_MT_file_import.append(menu_func)
def unregister():
- bpy.types.unregister(IMPORT_OT_obj)
bpy.types.INFO_MT_file_import.remove(menu_func)
diff --git a/release/scripts/io/import_shape_mdd.py b/release/scripts/io/import_shape_mdd.py
index ec0e7696630..c7b199918a2 100644
--- a/release/scripts/io/import_shape_mdd.py
+++ b/release/scripts/io/import_shape_mdd.py
@@ -12,7 +12,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENCE BLOCK *****
@@ -66,7 +66,7 @@ def mdd_import(filepath, ob, scene, PREF_START_FRAME=0, PREF_JUMP=1):
ob.active_shape_key_index = len(ob.data.shape_keys.keys)-1
index = len(ob.data.shape_keys.keys)-1
- ob.shape_key_lock = True
+ ob.show_shape_key = True
verts = ob.data.shape_keys.keys[len(ob.data.shape_keys.keys)-1].data
@@ -74,7 +74,7 @@ def mdd_import(filepath, ob, scene, PREF_START_FRAME=0, PREF_JUMP=1):
for v in verts: # 12 is the size of 3 floats
v.co[:] = unpack('>3f', file.read(12))
#me.update()
- ob.shape_key_lock = False
+ ob.show_shape_key = False
# insert keyframes
@@ -120,7 +120,8 @@ class importMDD(bpy.types.Operator):
#fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default=25)
frame_start = IntProperty(name="Start Frame", description="Start frame for inserting animation", min=minframe, max=maxframe, default=0)
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.active_object
return (ob and ob.type == 'MESH')
@@ -143,12 +144,10 @@ def menu_func(self, context):
def register():
- bpy.types.register(importMDD)
bpy.types.INFO_MT_file_import.append(menu_func)
def unregister():
- bpy.types.unregister(importMDD)
bpy.types.INFO_MT_file_import.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/io/netrender/__init__.py b/release/scripts/io/netrender/__init__.py
index f5f104d6d92..5a705e95aa8 100644
--- a/release/scripts/io/netrender/__init__.py
+++ b/release/scripts/io/netrender/__init__.py
@@ -18,16 +18,31 @@
# This directory is a Python package.
-from netrender import model
-from netrender import operators
-from netrender import client
-from netrender import slave
-from netrender import master
-from netrender import master_html
-from netrender import utils
-from netrender import balancing
-from netrender import ui
-from netrender import repath
+# To support reload properly, try to access a package var, if it's there, reload everything
+try:
+ init_data
+
+ reload(model)
+ reload(operators)
+ reload(client)
+ reload(slave)
+ reload(master)
+ reload(master_html)
+ reload(utils)
+ reload(balancing)
+ reload(ui)
+ reload(repath)
+except:
+ from netrender import model
+ from netrender import operators
+ from netrender import client
+ from netrender import slave
+ from netrender import master
+ from netrender import master_html
+ from netrender import utils
+ from netrender import balancing
+ from netrender import ui
+ from netrender import repath
jobs = []
slaves = []
@@ -38,11 +53,10 @@ init_data = True
init_address = True
def register():
- pass # TODO
+ ui.addProperties()
+
def unregister():
import bpy
- bpy.types.unregister(ui.NetRenderJob)
- bpy.types.unregister(ui.NetRenderSettings)
- bpy.types.unregister(ui.NetRenderSlave)
+ bpy.types.Scene.RemoveProperty("network_render")
diff --git a/release/scripts/io/netrender/client.py b/release/scripts/io/netrender/client.py
index 9f6d1a7639e..6f0f6460ae1 100644
--- a/release/scripts/io/netrender/client.py
+++ b/release/scripts/io/netrender/client.py
@@ -41,7 +41,7 @@ def addFluidFiles(job, path):
job.addFile(path + fluid_file, current_frame, current_frame)
def addPointCache(job, ob, point_cache, default_path):
- if not point_cache.disk_cache:
+ if not point_cache.use_disk_cache:
return
@@ -49,7 +49,7 @@ def addPointCache(job, ob, point_cache, default_path):
if name == "":
name = "".join(["%02X" % ord(c) for c in ob.name])
- cache_path = bpy.utils.expandpath(point_cache.filepath) if point_cache.external else default_path
+ cache_path = bpy.path.abspath(point_cache.filepath) if point_cache.use_external else default_path
index = "%02i" % point_cache.index
@@ -113,7 +113,7 @@ def clientSendJob(conn, scene, anim = False):
# LIBRARIES
###########################
for lib in bpy.data.libraries:
- file_path = bpy.utils.expandpath(lib.filepath)
+ file_path = bpy.path.abspath(lib.filepath)
if os.path.exists(file_path):
job.addFile(file_path)
@@ -122,7 +122,7 @@ def clientSendJob(conn, scene, anim = False):
###########################
for image in bpy.data.images:
if image.source == "FILE" and not image.packed_file:
- file_path = bpy.utils.expandpath(image.filepath)
+ file_path = bpy.path.abspath(image.filepath)
if os.path.exists(file_path):
job.addFile(file_path)
@@ -139,17 +139,17 @@ def clientSendJob(conn, scene, anim = False):
for object in bpy.data.objects:
for modifier in object.modifiers:
if modifier.type == 'FLUID_SIMULATION' and modifier.settings.type == "DOMAIN":
- addFluidFiles(job, bpy.utils.expandpath(modifier.settings.path))
+ addFluidFiles(job, bpy.path.abspath(modifier.settings.path))
elif modifier.type == "CLOTH":
addPointCache(job, object, modifier.point_cache, default_path)
elif modifier.type == "SOFT_BODY":
addPointCache(job, object, modifier.point_cache, default_path)
elif modifier.type == "SMOKE" and modifier.smoke_type == "TYPE_DOMAIN":
addPointCache(job, object, modifier.domain_settings.point_cache_low, default_path)
- if modifier.domain_settings.highres:
+ if modifier.domain_settings.use_high_resolution:
addPointCache(job, object, modifier.domain_settings.point_cache_high, default_path)
- elif modifier.type == "MULTIRES" and modifier.external:
- file_path = bpy.utils.expandpath(modifier.filepath)
+ elif modifier.type == "MULTIRES" and modifier.is_external:
+ file_path = bpy.path.abspath(modifier.filepath)
job.addFile(file_path)
# particles modifier are stupid and don't contain data
@@ -171,6 +171,7 @@ def clientSendJob(conn, scene, anim = False):
# try to send path first
conn.request("POST", "/job", repr(job.serialize()))
response = conn.getresponse()
+ response.read()
job_id = response.getheader("job-id")
@@ -181,6 +182,7 @@ def clientSendJob(conn, scene, anim = False):
conn.request("PUT", fileURL(job_id, rfile.index), f)
f.close()
response = conn.getresponse()
+ response.read()
# server will reply with ACCEPTED until all files are found
@@ -189,7 +191,6 @@ def clientSendJob(conn, scene, anim = False):
def requestResult(conn, job_id, frame):
conn.request("GET", renderURL(job_id, frame))
-@rnaType
class NetworkRenderEngine(bpy.types.RenderEngine):
bl_idname = 'NET_RENDER'
bl_label = "Network Render"
@@ -209,7 +210,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
address = "" if netsettings.server_address == "[default]" else netsettings.server_address
- master.runMaster((address, netsettings.server_port), netsettings.master_broadcast, netsettings.master_clear, netsettings.path, self.update_stats, self.test_break)
+ master.runMaster((address, netsettings.server_port), netsettings.master_broadcast, netsettings.use_master_clear, netsettings.path, self.update_stats, self.test_break)
def render_slave(self, scene):
@@ -237,6 +238,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
requestResult(conn, job_id, scene.frame_current)
response = conn.getresponse()
+ response.read()
if response.status == http.client.NO_CONTENT:
new_job = True
@@ -245,16 +247,19 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
requestResult(conn, job_id, scene.frame_current)
response = conn.getresponse()
+ response.read()
while response.status == http.client.ACCEPTED and not self.test_break():
time.sleep(1)
requestResult(conn, job_id, scene.frame_current)
response = conn.getresponse()
+ response.read()
# cancel new jobs (animate on network) on break
if self.test_break() and new_job:
conn.request("POST", cancelURL(job_id))
response = conn.getresponse()
+ response.read()
print( response.status, response.reason )
netsettings.job_id = 0
@@ -266,7 +271,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
x= int(r.resolution_x*r.resolution_percentage*0.01)
y= int(r.resolution_y*r.resolution_percentage*0.01)
- f = open(netsettings.path + "output.exr", "wb")
+ f = open(os.path.join(netsettings.path, "output.exr"), "wb")
buf = response.read(1024)
while buf:
@@ -276,7 +281,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
f.close()
result = self.begin_result(0, 0, x, y)
- result.load_from_file(netsettings.path + "output.exr")
+ result.load_from_file(os.path.join(netsettings.path, "output.exr"))
self.end_result(result)
conn.close()
diff --git a/release/scripts/io/netrender/master.py b/release/scripts/io/netrender/master.py
index f227f61a536..6deb925420b 100644
--- a/release/scripts/io/netrender/master.py
+++ b/release/scripts/io/netrender/master.py
@@ -89,7 +89,7 @@ class MRenderJob(netrender.model.RenderJob):
def save(self):
if self.save_path:
- f = open(self.save_path + "job.txt", "w")
+ f = open(os.path.join(self.save_path, "job.txt"), "w")
f.write(repr(self.serialize()))
f.close()
@@ -134,8 +134,8 @@ class MRenderJob(netrender.model.RenderJob):
self.status = JOB_QUEUED
def addLog(self, frames):
- log_name = "_".join(("%04d" % f for f in frames)) + ".log"
- log_path = self.save_path + log_name
+ log_name = "_".join(("%06d" % f for f in frames)) + ".log"
+ log_path = os.path.join(self.save_path, log_name)
for number in frames:
frame = self[number]
@@ -260,7 +260,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
elif frame.status == DONE:
self.server.stats("", "Sending result to client")
- filename = job.save_path + "%04d" % frame_number + ".exr"
+ filename = os.path.join(job.save_path, "%06d.exr" % frame_number)
f = open(filename, 'rb')
self.send_head(content = "image/x-exr")
@@ -294,7 +294,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
if frame.status in (QUEUED, DISPATCHED):
self.send_head(http.client.ACCEPTED)
elif frame.status == DONE:
- filename = job.save_path + "%04d" % frame_number + ".exr"
+ filename = os.path.join(job.save_path, "%06d.exr" % frame_number)
thumbname = thumbnail(filename)
@@ -716,7 +716,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
if file_index > 0:
file_path = prefixPath(job.save_path, render_file.filepath, main_path)
else:
- file_path = job.save_path + main_name
+ file_path = os.path.join(job.save_path, main_name)
buf = self.rfile.read(length)
@@ -772,7 +772,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
if job_result == DONE:
length = int(self.headers['content-length'])
buf = self.rfile.read(length)
- f = open(job.save_path + "%04d" % job_frame + ".exr", 'wb')
+ f = open(os.path.join(job.save_path, "%06d.exr" % job_frame), 'wb')
f.write(buf)
f.close()
@@ -822,13 +822,12 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
if job.type == netrender.model.JOB_BLENDER:
length = int(self.headers['content-length'])
buf = self.rfile.read(length)
- f = open(job.save_path + "%04d" % job_frame + ".jpg", 'wb')
+ f = open(os.path.join(job.save_path, "%06d.jpg" % job_frame), 'wb')
f.write(buf)
f.close()
del buf
- self.send_head()
else: # frame not found
self.send_head(http.client.NO_CONTENT)
else: # job not found
@@ -880,7 +879,7 @@ class RenderMasterServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
self.job_id = 0
if subdir:
- self.path = path + "master_" + str(os.getpid()) + os.sep
+ self.path = os.path.join(path, "master_" + str(os.getpid()))
else:
self.path = path
@@ -1007,7 +1006,7 @@ class RenderMasterServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
self.jobs_map[job.id] = job
# create job directory
- job.save_path = self.path + "job_" + job.id + os.sep
+ job.save_path = os.path.join(self.path, "job_" + job.id)
if not os.path.exists(job.save_path):
os.mkdir(job.save_path)
diff --git a/release/scripts/io/netrender/master_html.py b/release/scripts/io/netrender/master_html.py
index c3695cd4f0f..74155f6bd66 100644
--- a/release/scripts/io/netrender/master_html.py
+++ b/release/scripts/io/netrender/master_html.py
@@ -27,9 +27,10 @@ def get(handler):
def output(text):
handler.wfile.write(bytes(text, encoding='utf8'))
- def head(title):
+ def head(title, refresh = False):
output("<html><head>")
- output("<meta http-equiv='refresh' content=5>")
+ if refresh:
+ output("<meta http-equiv='refresh' content=5>")
output("<script src='/html/netrender.js' type='text/javascript'></script>")
# output("<script src='/html/json2.js' type='text/javascript'></script>")
output("<title>")
@@ -104,7 +105,7 @@ def get(handler):
f.close()
elif handler.path == "/html" or handler.path == "/":
handler.send_head(content = "text/html")
- head("NetRender")
+ head("NetRender", refresh = True)
output("<h2>Jobs</h2>")
diff --git a/release/scripts/io/netrender/operators.py b/release/scripts/io/netrender/operators.py
index 858ec800dbc..252b1146b67 100644
--- a/release/scripts/io/netrender/operators.py
+++ b/release/scripts/io/netrender/operators.py
@@ -26,13 +26,13 @@ from netrender.utils import *
import netrender.client as client
import netrender.model
-@rnaType
class RENDER_OT_netslave_bake(bpy.types.Operator):
'''NEED DESCRIPTION'''
bl_idname = "render.netslavebake"
bl_label = "Bake all in file"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return True
def execute(self, context):
@@ -52,27 +52,27 @@ class RENDER_OT_netslave_bake(bpy.types.Operator):
modifier.settings.path = relative_path
bpy.ops.fluid.bake({"active_object": object, "scene": scene})
elif modifier.type == "CLOTH":
- modifier.point_cache.step = 1
- modifier.point_cache.disk_cache = True
- modifier.point_cache.external = False
+ modifier.point_cache.frame_step = 1
+ modifier.point_cache.use_disk_cache = True
+ modifier.point_cache.use_external = False
elif modifier.type == "SOFT_BODY":
- modifier.point_cache.step = 1
- modifier.point_cache.disk_cache = True
- modifier.point_cache.external = False
+ modifier.point_cache.frame_step = 1
+ modifier.point_cache.use_disk_cache = True
+ modifier.point_cache.use_external = False
elif modifier.type == "SMOKE" and modifier.smoke_type == "TYPE_DOMAIN":
- modifier.domain_settings.point_cache_low.step = 1
- modifier.domain_settings.point_cache_low.disk_cache = True
- modifier.domain_settings.point_cache_low.external = False
- modifier.domain_settings.point_cache_high.step = 1
- modifier.domain_settings.point_cache_high.disk_cache = True
- modifier.domain_settings.point_cache_high.external = False
+ modifier.domain_settings.point_cache_low.use_step = 1
+ modifier.domain_settings.point_cache_low.use_disk_cache = True
+ modifier.domain_settings.point_cache_low.use_external = False
+ modifier.domain_settings.point_cache_high.use_step = 1
+ modifier.domain_settings.point_cache_high.use_disk_cache = True
+ modifier.domain_settings.point_cache_high.use_external = False
# particles modifier are stupid and don't contain data
# we have to go through the object property
for psys in object.particle_systems:
- psys.point_cache.step = 1
- psys.point_cache.disk_cache = True
- psys.point_cache.external = False
+ psys.point_cache.use_step = 1
+ psys.point_cache.use_disk_cache = True
+ psys.point_cache.use_external = False
psys.point_cache.filepath = relative_path
bpy.ops.ptcache.bake_all()
@@ -84,13 +84,13 @@ class RENDER_OT_netslave_bake(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class RENDER_OT_netclientanim(bpy.types.Operator):
'''Start rendering an animation on network'''
bl_idname = "render.netclientanim"
bl_label = "Animation on network"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return True
def execute(self, context):
@@ -111,13 +111,13 @@ class RENDER_OT_netclientanim(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class RENDER_OT_netclientrun(bpy.types.Operator):
'''Start network rendering service'''
bl_idname = "render.netclientstart"
bl_label = "Start Service"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return True
def execute(self, context):
@@ -128,13 +128,13 @@ class RENDER_OT_netclientrun(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class RENDER_OT_netclientsend(bpy.types.Operator):
'''Send Render Job to the Network'''
bl_idname = "render.netclientsend"
bl_label = "Send job"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return True
def execute(self, context):
@@ -158,13 +158,13 @@ class RENDER_OT_netclientsend(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class RENDER_OT_netclientsendframe(bpy.types.Operator):
'''Send Render Job with current frame to the Network'''
bl_idname = "render.netclientsendframe"
bl_label = "Send current frame job"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return True
def execute(self, context):
@@ -188,13 +188,13 @@ class RENDER_OT_netclientsendframe(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class RENDER_OT_netclientstatus(bpy.types.Operator):
'''Refresh the status of the current jobs'''
bl_idname = "render.netclientstatus"
bl_label = "Client Status"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return True
def execute(self, context):
@@ -205,6 +205,7 @@ class RENDER_OT_netclientstatus(bpy.types.Operator):
conn.request("GET", "/status")
response = conn.getresponse()
+ response.read()
print( response.status, response.reason )
jobs = (netrender.model.RenderJob.materialize(j) for j in eval(str(response.read(), encoding='utf8')))
@@ -228,13 +229,13 @@ class RENDER_OT_netclientstatus(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class RENDER_OT_netclientblacklistslave(bpy.types.Operator):
'''Operator documentation text, will be used for the operator tooltip and python docs.'''
bl_idname = "render.netclientblacklistslave"
bl_label = "Client Blacklist Slave"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return True
def execute(self, context):
@@ -258,13 +259,13 @@ class RENDER_OT_netclientblacklistslave(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class RENDER_OT_netclientwhitelistslave(bpy.types.Operator):
'''Operator documentation text, will be used for the operator tooltip and python docs.'''
bl_idname = "render.netclientwhitelistslave"
bl_label = "Client Whitelist Slave"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return True
def execute(self, context):
@@ -289,13 +290,13 @@ class RENDER_OT_netclientwhitelistslave(bpy.types.Operator):
return self.execute(context)
-@rnaType
class RENDER_OT_netclientslaves(bpy.types.Operator):
'''Refresh status about available Render slaves'''
bl_idname = "render.netclientslaves"
bl_label = "Client Slaves"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return True
def execute(self, context):
@@ -306,6 +307,7 @@ class RENDER_OT_netclientslaves(bpy.types.Operator):
conn.request("GET", "/slaves")
response = conn.getresponse()
+ response.read()
print( response.status, response.reason )
slaves = (netrender.model.RenderSlave.materialize(s) for s in eval(str(response.read(), encoding='utf8')))
@@ -334,13 +336,13 @@ class RENDER_OT_netclientslaves(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class RENDER_OT_netclientcancel(bpy.types.Operator):
'''Cancel the selected network rendering job.'''
bl_idname = "render.netclientcancel"
bl_label = "Client Cancel"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
netsettings = context.scene.network_render
return netsettings.active_job_index >= 0 and len(netsettings.jobs) > 0
@@ -354,6 +356,7 @@ class RENDER_OT_netclientcancel(bpy.types.Operator):
conn.request("POST", cancelURL(job.id))
response = conn.getresponse()
+ response.read()
print( response.status, response.reason )
netsettings.jobs.remove(netsettings.active_job_index)
@@ -363,13 +366,13 @@ class RENDER_OT_netclientcancel(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class RENDER_OT_netclientcancelall(bpy.types.Operator):
'''Cancel all running network rendering jobs.'''
bl_idname = "render.netclientcancelall"
bl_label = "Client Cancel All"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return True
def execute(self, context):
@@ -380,6 +383,7 @@ class RENDER_OT_netclientcancelall(bpy.types.Operator):
conn.request("POST", "/clear")
response = conn.getresponse()
+ response.read()
print( response.status, response.reason )
while(len(netsettings.jobs) > 0):
@@ -390,13 +394,13 @@ class RENDER_OT_netclientcancelall(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class netclientdownload(bpy.types.Operator):
'''Download render results from the network'''
bl_idname = "render.netclientdownload"
bl_label = "Client Download"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
netsettings = context.scene.network_render
return netsettings.active_job_index >= 0 and len(netsettings.jobs) > 0
@@ -412,6 +416,7 @@ class netclientdownload(bpy.types.Operator):
for frame in job.frames:
client.requestResult(conn, job.id, frame.number)
response = conn.getresponse()
+ response.read()
if response.status != http.client.OK:
print("missing", frame.number)
@@ -419,7 +424,7 @@ class netclientdownload(bpy.types.Operator):
print("got back", frame.number)
- f = open(netsettings.path + "%06d" % frame.number + ".exr", "wb")
+ f = open(os.path.join(netsettings.path, "%06d.exr" % frame.number), "wb")
buf = response.read(1024)
while buf:
@@ -435,13 +440,13 @@ class netclientdownload(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class netclientscan(bpy.types.Operator):
'''Listen on network for master server broadcasting its address and port.'''
bl_idname = "render.netclientscan"
bl_label = "Client Scan"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return True
def execute(self, context):
@@ -458,13 +463,13 @@ class netclientscan(bpy.types.Operator):
def invoke(self, context, event):
return self.execute(context)
-@rnaType
class netclientweb(bpy.types.Operator):
'''Open new window with information about running rendering jobs'''
bl_idname = "render.netclientweb"
bl_label = "Open Master Monitor"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
netsettings = context.scene.network_render
return netsettings.server_address != "[default]"
diff --git a/release/scripts/io/netrender/repath.py b/release/scripts/io/netrender/repath.py
index 7f9befd34fb..3ac9636b628 100755..100644
--- a/release/scripts/io/netrender/repath.py
+++ b/release/scripts/io/netrender/repath.py
@@ -66,10 +66,10 @@ def update(job):
def process(paths):
def processPointCache(point_cache):
- point_cache.external = False
+ point_cache.use_external = False
def processFluid(fluid):
- new_path = path_map.get(fluid.path, None)
+ new_path = path_map.get(fluid.filepath, None)
if new_path:
fluid.path = new_path
@@ -83,14 +83,17 @@ def process(paths):
elif paths[i].endswith(".bobj.gz"):
path_map[os.path.split(paths[i])[0]] = os.path.split(paths[i+1])[0]
else:
- path_map[paths[i]] = paths[i+1]
+ path_map[os.path.split(paths[i])[1]] = paths[i+1]
+
+ # TODO original paths aren't really the orignal path (they are the normalized path
+ # so we repath using the filenames only.
###########################
# LIBRARIES
###########################
for lib in bpy.data.libraries:
- file_path = bpy.utils.expandpath(lib.filepath)
- new_path = path_map.get(file_path, None)
+ file_path = bpy.path.abspath(lib.filepath)
+ new_path = path_map.get(os.path.split(file_path)[1], None)
if new_path:
lib.filepath = new_path
@@ -99,8 +102,8 @@ def process(paths):
###########################
for image in bpy.data.images:
if image.source == "FILE" and not image.packed_file:
- file_path = bpy.utils.expandpath(image.filepath)
- new_path = path_map.get(file_path, None)
+ file_path = bpy.path.abspath(image.filepath)
+ new_path = path_map.get(os.path.split(file_path)[1], None)
if new_path:
image.filepath = new_path
@@ -118,10 +121,10 @@ def process(paths):
processPointCache(modifier.point_cache)
elif modifier.type == "SMOKE" and modifier.smoke_type == "TYPE_DOMAIN":
processPointCache(modifier.domain_settings.point_cache_low)
- if modifier.domain_settings.highres:
+ if modifier.domain_settings.use_high_resolution:
processPointCache(modifier.domain_settings.point_cache_high)
- elif modifier.type == "MULTIRES" and modifier.external:
- file_path = bpy.utils.expandpath(modifier.filepath)
+ elif modifier.type == "MULTIRES" and modifier.is_external:
+ file_path = bpy.path.abspath(modifier.filepath)
new_path = path_map.get(file_path, None)
if new_path:
modifier.filepath = new_path
@@ -144,4 +147,4 @@ if __name__ == "__main__":
process(args)
- bpy.ops.wm.save_as_mainfile(path=new_path, check_existing=False)
+ bpy.ops.wm.save_as_mainfile(filepath=new_path, check_existing=False)
diff --git a/release/scripts/io/netrender/slave.py b/release/scripts/io/netrender/slave.py
index 9fd00152dc1..b383481824b 100644
--- a/release/scripts/io/netrender/slave.py
+++ b/release/scripts/io/netrender/slave.py
@@ -59,8 +59,8 @@ def slave_Info():
def testCancel(conn, job_id, frame_number):
conn.request("HEAD", "/status", headers={"job-id":job_id, "job-frame": str(frame_number)})
- # cancelled if job isn't found anymore
- if conn.getresponse().status == http.client.NO_CONTENT:
+ # canceled if job isn't found anymore
+ if responseStatus(conn) == http.client.NO_CONTENT:
return True
else:
return False
@@ -79,7 +79,9 @@ def testFile(conn, job_id, slave_id, rfile, JOB_PREFIX, main_path = None):
job_full_path = prefixPath(JOB_PREFIX, rfile.filepath, main_path, force = True)
if not found:
- temp_path = JOB_PREFIX + "slave.temp"
+ # Force prefix path if not found
+ job_full_path = prefixPath(JOB_PREFIX, rfile.filepath, main_path, force = True)
+ temp_path = os.path.join(JOB_PREFIX, "slave.temp")
conn.request("GET", fileURL(job_id, rfile.index), headers={"slave-id":slave_id})
response = conn.getresponse()
@@ -111,10 +113,11 @@ def render_slave(engine, netsettings, threads):
if conn:
conn.request("POST", "/slave", repr(slave_Info().serialize()))
response = conn.getresponse()
+ response.read()
slave_id = response.getheader("slave-id")
- NODE_PREFIX = netsettings.path + "slave_" + slave_id + os.sep
+ NODE_PREFIX = os.path.join(netsettings.path, "slave_" + slave_id)
if not os.path.exists(NODE_PREFIX):
os.mkdir(NODE_PREFIX)
@@ -130,7 +133,7 @@ def render_slave(engine, netsettings, threads):
job = netrender.model.RenderJob.materialize(eval(str(response.read(), encoding='utf8')))
engine.update_stats("", "Network render processing job from master")
- JOB_PREFIX = NODE_PREFIX + "job_" + job.id + os.sep
+ JOB_PREFIX = os.path.join(NODE_PREFIX, "job_" + job.id)
if not os.path.exists(JOB_PREFIX):
os.mkdir(JOB_PREFIX)
@@ -155,6 +158,7 @@ def render_slave(engine, netsettings, threads):
logfile = netrender.model.LogFile(job.id, slave_id, [frame.number for frame in job.frames])
conn.request("POST", "/log", bytes(repr(logfile.serialize()), encoding='utf8'))
response = conn.getresponse()
+ response.read()
first_frame = job.frames[0].number
@@ -170,7 +174,7 @@ def render_slave(engine, netsettings, threads):
frame_args += ["-f", str(frame.number)]
val = SetErrorMode()
- process = subprocess.Popen([BLENDER_PATH, "-b", "-noaudio", job_full_path, "-t", str(threads), "-o", JOB_PREFIX + "######", "-E", "BLENDER_RENDER", "-F", "MULTILAYER"] + frame_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ process = subprocess.Popen([BLENDER_PATH, "-b", "-noaudio", job_full_path, "-t", str(threads), "-o", os.path.join(JOB_PREFIX, "######"), "-E", "BLENDER_RENDER", "-F", "MULTILAYER"] + frame_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
RestoreErrorMode(val)
elif job.type == netrender.model.JOB_PROCESS:
command = job.frames[0].command
@@ -194,9 +198,10 @@ def render_slave(engine, netsettings, threads):
# (only need to update on one frame, they are linked
conn.request("PUT", logURL(job.id, first_frame), stdout, headers=headers)
response = conn.getresponse()
+ response.read()
# Also output on console
- if netsettings.slave_thumb:
+ if netsettings.use_slave_output_log:
print(str(stdout, encoding='utf8'), end="")
stdout = bytes()
@@ -214,18 +219,21 @@ def render_slave(engine, netsettings, threads):
if cancelled:
# kill process if needed
if process.poll() == None:
- process.terminate()
+ try:
+ process.terminate()
+ except OSError:
+ pass
continue # to next frame
# flush the rest of the logs
if stdout:
# Also output on console
- if netsettings.slave_thumb:
+ if netsettings.use_slave_thumb:
print(str(stdout, encoding='utf8'), end="")
# (only need to update on one frame, they are linked
conn.request("PUT", logURL(job.id, first_frame), stdout, headers=headers)
- if conn.getresponse().status == http.client.NO_CONTENT:
+ if responseStatus(conn) == http.client.NO_CONTENT:
continue
total_t = time.time() - start_t
@@ -246,26 +254,27 @@ def render_slave(engine, netsettings, threads):
if job.type == netrender.model.JOB_BLENDER:
# send image back to server
- filename = JOB_PREFIX + "%06d" % frame.number + ".exr"
+ filename = os.path.join(JOB_PREFIX, "%06d.exr" % frame.number)
# thumbnail first
- if netsettings.slave_thumb:
+ if netsettings.use_slave_thumb:
thumbname = thumbnail(filename)
f = open(thumbname, 'rb')
conn.request("PUT", "/thumb", f, headers=headers)
f.close()
- conn.getresponse()
+ responseStatus(conn)
+
f = open(filename, 'rb')
conn.request("PUT", "/render", f, headers=headers)
f.close()
- if conn.getresponse().status == http.client.NO_CONTENT:
+ if responseStatus(conn) == http.client.NO_CONTENT:
continue
elif job.type == netrender.model.JOB_PROCESS:
conn.request("PUT", "/render", headers=headers)
- if conn.getresponse().status == http.client.NO_CONTENT:
+ if responseStatus(conn) == http.client.NO_CONTENT:
continue
else:
headers["job-result"] = str(ERROR)
@@ -273,7 +282,7 @@ def render_slave(engine, netsettings, threads):
headers["job-frame"] = str(frame.number)
# send error result back to server
conn.request("PUT", "/render", headers=headers)
- if conn.getresponse().status == http.client.NO_CONTENT:
+ if responseStatus(conn) == http.client.NO_CONTENT:
continue
engine.update_stats("", "Network render connected to master, waiting for jobs")
@@ -288,7 +297,7 @@ def render_slave(engine, netsettings, threads):
conn.close()
- if netsettings.slave_clear:
+ if netsettings.use_slave_clear:
clearSlave(NODE_PREFIX)
if __name__ == "__main__":
diff --git a/release/scripts/io/netrender/ui.py b/release/scripts/io/netrender/ui.py
index c60b10c484a..c2d943f63f8 100644
--- a/release/scripts/io/netrender/ui.py
+++ b/release/scripts/io/netrender/ui.py
@@ -36,6 +36,11 @@ DISPATCHED = 1
DONE = 2
ERROR = 3
+def base_poll(cls, context):
+ rd = context.scene.render
+ return (rd.use_game_engine==False) and (rd.engine in cls.COMPAT_ENGINES)
+
+
def init_file():
if netrender.init_file != bpy.data.filepath:
netrender.init_file = bpy.data.filepath
@@ -81,17 +86,21 @@ class RenderButtonsPanel():
bl_region_type = "WINDOW"
bl_context = "render"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
-
- def poll(self, context):
+
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
- return (rd.use_game_engine==False) and (rd.engine in self.COMPAT_ENGINES)
+ return (rd.use_game_engine==False) and (rd.engine in cls.COMPAT_ENGINES)
# Setting panel, use in the scene for now.
-@rnaType
class RENDER_PT_network_settings(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Network Settings"
COMPAT_ENGINES = {'NET_RENDER'}
+ @classmethod
+ def poll(cls, context):
+ return super(RENDER_PT_network_settings, cls).poll(context)
+
def draw(self, context):
layout = self.layout
@@ -122,15 +131,14 @@ class RENDER_PT_network_settings(bpy.types.Panel, RenderButtonsPanel):
layout.operator("render.netclientweb", icon='QUESTION')
-@rnaType
class RENDER_PT_network_slave_settings(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Slave Settings"
COMPAT_ENGINES = {'NET_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
scene = context.scene
- return (super().poll(context)
- and scene.network_render.mode == "RENDER_SLAVE")
+ return super(RENDER_PT_network_slave_settings, cls).poll(context) and scene.network_render.mode == "RENDER_SLAVE"
def draw(self, context):
layout = self.layout
@@ -139,23 +147,23 @@ class RENDER_PT_network_slave_settings(bpy.types.Panel, RenderButtonsPanel):
rd = scene.render
netsettings = scene.network_render
- layout.prop(netsettings, "slave_clear")
- layout.prop(netsettings, "slave_thumb")
- layout.prop(netsettings, "slave_outputlog")
+ layout.prop(netsettings, "use_slave_clear")
+ layout.prop(netsettings, "use_slave_thumb")
+ layout.prop(netsettings, "use_slave_output_log")
layout.label(text="Threads:")
layout.prop(rd, "threads_mode", expand=True)
sub = layout.column()
sub.enabled = rd.threads_mode == 'FIXED'
sub.prop(rd, "threads")
-@rnaType
+
class RENDER_PT_network_master_settings(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Master Settings"
COMPAT_ENGINES = {'NET_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
scene = context.scene
- return (super().poll(context)
- and scene.network_render.mode == "RENDER_MASTER")
+ return super(RENDER_PT_network_master_settings, cls).poll(context) and scene.network_render.mode == "RENDER_MASTER"
def draw(self, context):
layout = self.layout
@@ -163,18 +171,17 @@ class RENDER_PT_network_master_settings(bpy.types.Panel, RenderButtonsPanel):
scene = context.scene
netsettings = scene.network_render
- layout.prop(netsettings, "master_broadcast")
- layout.prop(netsettings, "master_clear")
+ layout.prop(netsettings, "use_master_broadcast")
+ layout.prop(netsettings, "use_master_clear")
-@rnaType
class RENDER_PT_network_job(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Job Settings"
COMPAT_ENGINES = {'NET_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
scene = context.scene
- return (super().poll(context)
- and scene.network_render.mode == "RENDER_CLIENT")
+ return super(RENDER_PT_network_job, cls).poll(context) and scene.network_render.mode == "RENDER_CLIENT"
def draw(self, context):
layout = self.layout
@@ -207,19 +214,18 @@ class RENDER_PT_network_job(bpy.types.Panel, RenderButtonsPanel):
row.prop(netsettings, "priority")
row.prop(netsettings, "chunks")
-@rnaType
class RENDER_PT_network_slaves(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Slaves Status"
COMPAT_ENGINES = {'NET_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
scene = context.scene
netsettings = scene.network_render
if netsettings.mode != "RENDER_CLIENT":
return False
verify_address(netsettings)
- return (super().poll(context)
- and netsettings.server_address != "[default]")
+ return super(RENDER_PT_network_slaves, cls).poll(context) and netsettings.server_address != "[default]"
def draw(self, context):
layout = self.layout
@@ -246,19 +252,18 @@ class RENDER_PT_network_slaves(bpy.types.Panel, RenderButtonsPanel):
layout.label(text="Seen: " + time.ctime(slave.last_seen))
layout.label(text="Stats: " + slave.stats)
-@rnaType
class RENDER_PT_network_slaves_blacklist(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Slaves Blacklist"
COMPAT_ENGINES = {'NET_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
scene = context.scene
netsettings = scene.network_render
if netsettings.mode != "RENDER_CLIENT":
return False
verify_address(netsettings)
- return (super().poll(context)
- and netsettings.server_address != "[default]")
+ return super(RENDER_PT_network_slaves_blacklist, cls).poll(context) and netsettings.server_address != "[default]"
def draw(self, context):
layout = self.layout
@@ -284,19 +289,18 @@ class RENDER_PT_network_slaves_blacklist(bpy.types.Panel, RenderButtonsPanel):
layout.label(text="Seen: " + time.ctime(slave.last_seen))
layout.label(text="Stats: " + slave.stats)
-@rnaType
class RENDER_PT_network_jobs(bpy.types.Panel, RenderButtonsPanel):
bl_label = "Jobs"
COMPAT_ENGINES = {'NET_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
scene = context.scene
netsettings = scene.network_render
if netsettings.mode != "RENDER_CLIENT":
return False
verify_address(netsettings)
- return (super().poll(context)
- and netsettings.server_address != "[default]")
+ return super(RENDER_PT_network_jobs, cls).poll(context) and netsettings.server_address != "[default]"
def draw(self, context):
layout = self.layout
@@ -325,150 +329,148 @@ class RENDER_PT_network_jobs(bpy.types.Panel, RenderButtonsPanel):
layout.label(text="Done: %04i" % job.results[DONE])
layout.label(text="Error: %04i" % job.results[ERROR])
-@rnaType
class NetRenderSettings(bpy.types.IDPropertyGroup):
pass
-@rnaType
class NetRenderSlave(bpy.types.IDPropertyGroup):
pass
-@rnaType
class NetRenderJob(bpy.types.IDPropertyGroup):
pass
-bpy.types.Scene.PointerProperty(attr="network_render", type=NetRenderSettings, name="Network Render", description="Network Render Settings")
-
-NetRenderSettings.StringProperty( attr="server_address",
- name="Server address",
- description="IP or name of the master render server",
- maxlen = 128,
- default = "[default]")
-
-NetRenderSettings.IntProperty( attr="server_port",
- name="Server port",
- description="port of the master render server",
- default = 8000,
- min=1,
- max=65535)
-
-NetRenderSettings.BoolProperty( attr="master_broadcast",
- name="Broadcast",
- description="broadcast master server address on local network",
- default = True)
-
-NetRenderSettings.BoolProperty( attr="slave_clear",
- name="Clear on exit",
- description="delete downloaded files on exit",
- default = True)
-
-NetRenderSettings.BoolProperty( attr="slave_thumb",
- name="Generate thumbnails",
- description="Generate thumbnails on slaves instead of master",
- default = False)
-
-NetRenderSettings.BoolProperty( attr="slave_outputlog",
- name="Output render log on console",
- description="Output render text log to console as well as sending it to the master",
- default = True)
-
-NetRenderSettings.BoolProperty( attr="master_clear",
- name="Clear on exit",
- description="delete saved files on exit",
- default = False)
-
-default_path = os.environ.get("TEMP")
-
-if not default_path:
- if os.name == 'nt':
- default_path = "c:/tmp/"
- else:
- default_path = "/tmp/"
-elif not default_path.endswith(os.sep):
- default_path += os.sep
-
-NetRenderSettings.StringProperty( attr="path",
- name="Path",
- description="Path for temporary files",
- maxlen = 128,
- default = default_path,
- subtype='FILE_PATH')
-
-NetRenderSettings.StringProperty( attr="job_name",
- name="Job name",
- description="Name of the job",
- maxlen = 128,
- default = "[default]")
-
-NetRenderSettings.StringProperty( attr="job_category",
- name="Job category",
- description="Category of the job",
- maxlen = 128,
- default = "")
-
-NetRenderSettings.IntProperty( attr="chunks",
- name="Chunks",
- description="Number of frame to dispatch to each slave in one chunk",
- default = 5,
- min=1,
- max=65535)
-
-NetRenderSettings.IntProperty( attr="priority",
- name="Priority",
- description="Priority of the job",
- default = 1,
- min=1,
- max=10)
-
-NetRenderSettings.StringProperty( attr="job_id",
- name="Network job id",
- description="id of the last sent render job",
- maxlen = 64,
- default = "")
-
-NetRenderSettings.IntProperty( attr="active_slave_index",
- name="Index of the active slave",
- description="",
- default = -1,
- min= -1,
- max=65535)
-
-NetRenderSettings.IntProperty( attr="active_blacklisted_slave_index",
- name="Index of the active slave",
- description="",
- default = -1,
- min= -1,
- max=65535)
-
-NetRenderSettings.IntProperty( attr="active_job_index",
- name="Index of the active job",
- description="",
- default = -1,
- min= -1,
- max=65535)
-
-NetRenderSettings.EnumProperty(attr="mode",
- items=(
- ("RENDER_CLIENT", "Client", "Act as render client"),
- ("RENDER_MASTER", "Master", "Act as render master"),
- ("RENDER_SLAVE", "Slave", "Act as render slave"),
- ),
- name="Network mode",
- description="Mode of operation of this instance",
- default="RENDER_CLIENT")
-
-NetRenderSettings.CollectionProperty(attr="slaves", type=NetRenderSlave, name="Slaves", description="")
-NetRenderSettings.CollectionProperty(attr="slaves_blacklist", type=NetRenderSlave, name="Slaves Blacklist", description="")
-NetRenderSettings.CollectionProperty(attr="jobs", type=NetRenderJob, name="Job List", description="")
-
-NetRenderSlave.StringProperty( attr="name",
- name="Name of the slave",
- description="",
- maxlen = 64,
- default = "")
-
-NetRenderJob.StringProperty( attr="name",
- name="Name of the job",
- description="",
- maxlen = 128,
- default = "")
+def addProperties():
+ bpy.types.Scene.PointerProperty(attr="network_render", type=NetRenderSettings, name="Network Render", description="Network Render Settings")
+
+ NetRenderSettings.StringProperty( attr="server_address",
+ name="Server address",
+ description="IP or name of the master render server",
+ maxlen = 128,
+ default = "[default]")
+
+ NetRenderSettings.IntProperty( attr="server_port",
+ name="Server port",
+ description="port of the master render server",
+ default = 8000,
+ min=1,
+ max=65535)
+
+ NetRenderSettings.BoolProperty( attr="use_master_broadcast",
+ name="Broadcast",
+ description="broadcast master server address on local network",
+ default = True)
+
+ NetRenderSettings.BoolProperty( attr="use_slave_clear",
+ name="Clear on exit",
+ description="delete downloaded files on exit",
+ default = True)
+
+ NetRenderSettings.BoolProperty( attr="use_slave_thumb",
+ name="Generate thumbnails",
+ description="Generate thumbnails on slaves instead of master",
+ default = False)
+
+ NetRenderSettings.BoolProperty( attr="use_slave_output_log",
+ name="Output render log on console",
+ description="Output render text log to console as well as sending it to the master",
+ default = True)
+
+ NetRenderSettings.BoolProperty( attr="use_master_clear",
+ name="Clear on exit",
+ description="delete saved files on exit",
+ default = False)
+
+ default_path = os.environ.get("TEMP")
+
+ if not default_path:
+ if os.name == 'nt':
+ default_path = "c:/tmp/"
+ else:
+ default_path = "/tmp/"
+ elif not default_path.endswith(os.sep):
+ default_path += os.sep
+
+ NetRenderSettings.StringProperty( attr="path",
+ name="Path",
+ description="Path for temporary files",
+ maxlen = 128,
+ default = default_path,
+ subtype='FILE_PATH')
+
+ NetRenderSettings.StringProperty( attr="job_name",
+ name="Job name",
+ description="Name of the job",
+ maxlen = 128,
+ default = "[default]")
+
+ NetRenderSettings.StringProperty( attr="job_category",
+ name="Job category",
+ description="Category of the job",
+ maxlen = 128,
+ default = "")
+
+ NetRenderSettings.IntProperty( attr="chunks",
+ name="Chunks",
+ description="Number of frame to dispatch to each slave in one chunk",
+ default = 5,
+ min=1,
+ max=65535)
+
+ NetRenderSettings.IntProperty( attr="priority",
+ name="Priority",
+ description="Priority of the job",
+ default = 1,
+ min=1,
+ max=10)
+
+ NetRenderSettings.StringProperty( attr="job_id",
+ name="Network job id",
+ description="id of the last sent render job",
+ maxlen = 64,
+ default = "")
+
+ NetRenderSettings.IntProperty( attr="active_slave_index",
+ name="Index of the active slave",
+ description="",
+ default = -1,
+ min= -1,
+ max=65535)
+
+ NetRenderSettings.IntProperty( attr="active_blacklisted_slave_index",
+ name="Index of the active slave",
+ description="",
+ default = -1,
+ min= -1,
+ max=65535)
+
+ NetRenderSettings.IntProperty( attr="active_job_index",
+ name="Index of the active job",
+ description="",
+ default = -1,
+ min= -1,
+ max=65535)
+
+ NetRenderSettings.EnumProperty(attr="mode",
+ items=(
+ ("RENDER_CLIENT", "Client", "Act as render client"),
+ ("RENDER_MASTER", "Master", "Act as render master"),
+ ("RENDER_SLAVE", "Slave", "Act as render slave"),
+ ),
+ name="Network mode",
+ description="Mode of operation of this instance",
+ default="RENDER_CLIENT")
+
+ NetRenderSettings.CollectionProperty(attr="slaves", type=NetRenderSlave, name="Slaves", description="")
+ NetRenderSettings.CollectionProperty(attr="slaves_blacklist", type=NetRenderSlave, name="Slaves Blacklist", description="")
+ NetRenderSettings.CollectionProperty(attr="jobs", type=NetRenderJob, name="Job List", description="")
+
+ NetRenderSlave.StringProperty( attr="name",
+ name="Name of the slave",
+ description="",
+ maxlen = 64,
+ default = "")
+
+ NetRenderJob.StringProperty( attr="name",
+ name="Name of the job",
+ description="",
+ maxlen = 128,
+ default = "")
diff --git a/release/scripts/io/netrender/utils.py b/release/scripts/io/netrender/utils.py
index 6288b9747c0..81617ac0d30 100644
--- a/release/scripts/io/netrender/utils.py
+++ b/release/scripts/io/netrender/utils.py
@@ -57,9 +57,10 @@ FRAME_STATUS_TEXT = {
ERROR: "Error"
}
-def rnaType(rna_type):
- if bpy: bpy.types.register(rna_type)
- return rna_type
+def responseStatus(conn):
+ response = conn.getresponse()
+ response.read()
+ return response.status
def reporting(report, message, errorType = None):
if errorType:
@@ -171,20 +172,20 @@ def prefixPath(prefix_directory, file_path, prefix_path, force = False):
# if an absolute path, make sure path exists, if it doesn't, use relative local path
full_path = file_path
if force or not os.path.exists(full_path):
- p, n = os.path.split(full_path)
+ p, n = os.path.split(os.path.normpath(full_path))
if prefix_path and p.startswith(prefix_path):
if len(prefix_path) < len(p):
- directory = prefix_directory + p[len(prefix_path)+1:] + os.sep # +1 to remove separator
+ directory = os.path.join(prefix_directory, p[len(prefix_path)+1:]) # +1 to remove separator
if not os.path.exists(directory):
os.mkdir(directory)
else:
directory = prefix_directory
- full_path = directory + n
+ full_path = os.path.join(directory, n)
else:
- full_path = prefix_directory + n
+ full_path = os.path.join(prefix_directory, n)
else:
- full_path = prefix_directory + file_path
+ full_path = (prefix_directory, file_path)
return full_path
diff --git a/release/scripts/keyingsets/keyingsets_utils.py b/release/scripts/keyingsets/keyingsets_utils.py
index 77b0f3ebacd..a26483e57ce 100644
--- a/release/scripts/keyingsets/keyingsets_utils.py
+++ b/release/scripts/keyingsets/keyingsets_utils.py
@@ -96,14 +96,14 @@ def get_transform_generators_base_info(data):
# Location
def RKS_GEN_location(ksi, context, ks, data):
# get id-block and path info
- id_block, base_path, grouping= get_transform_generators_base_info(data)
+ id_block, base_path, grouping = get_transform_generators_base_info(data)
# add the property name to the base path
path = path_add_property(base_path, "location")
# add Keying Set entry for this...
if grouping:
- ks.paths.add(id_block, path, grouping_method='NAMED', group_name=grouping)
+ ks.paths.add(id_block, path, group_method='NAMED', group_name=grouping)
else:
ks.paths.add(id_block, path)
@@ -123,7 +123,7 @@ def RKS_GEN_rotation(ksi, context, ks, data):
# add Keying Set entry for this...
if grouping:
- ks.paths.add(id_block, path, grouping_method='NAMED', group_name=grouping)
+ ks.paths.add(id_block, path, group_method='NAMED', group_name=grouping)
else:
ks.paths.add(id_block, path)
@@ -137,7 +137,7 @@ def RKS_GEN_scaling(ksi, context, ks, data):
# add Keying Set entry for this...
if grouping:
- ks.paths.add(id_block, path, grouping_method='NAMED', group_name=grouping)
+ ks.paths.add(id_block, path, group_method='NAMED', group_name=grouping)
else:
ks.paths.add(id_block, path)
@@ -147,15 +147,11 @@ def RKS_GEN_scaling(ksi, context, ks, data):
classes = []
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/modules/add_object_utils.py b/release/scripts/modules/add_object_utils.py
index cef368c529d..eaa97512f89 100644
--- a/release/scripts/modules/add_object_utils.py
+++ b/release/scripts/modules/add_object_utils.py
@@ -25,11 +25,11 @@ import mathutils
def add_object_align_init(context, operator):
if operator and operator.properties.is_property_set("location") and operator.properties.is_property_set("rotation"):
- location = mathutils.TranslationMatrix(mathutils.Vector(operator.properties.location))
+ location = mathutils.Matrix.Translation(mathutils.Vector(operator.properties.location))
rotation = mathutils.Euler(operator.properties.rotation).to_matrix().resize4x4()
else:
# TODO, local view cursor!
- location = mathutils.TranslationMatrix(context.scene.cursor_location)
+ location = mathutils.Matrix.Translation(context.scene.cursor_location)
if context.user_preferences.edit.object_align == 'VIEW' and context.space_data.type == 'VIEW_3D':
rotation = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
@@ -50,12 +50,12 @@ def add_object_data(context, obdata, operator=None):
# ugh, could be made nicer
for ob in scene.objects:
- ob.selected = False
+ ob.select = False
obj_new = bpy.data.objects.new(obdata.name, obdata)
base = scene.objects.link(obj_new)
- base.selected = True
+ base.select = True
if context.space_data and context.space_data.type == 'VIEW_3D':
base.layers_from_view(context.space_data)
@@ -68,7 +68,7 @@ def add_object_data(context, obdata, operator=None):
if obj_act and obj_act.mode == 'EDIT' and obj_act.type == obj_new.type:
bpy.ops.object.mode_set(mode='OBJECT')
- obj_act.selected = True
+ obj_act.select = True
scene.update() # apply location
#scene.objects.active = obj_new
@@ -77,7 +77,7 @@ def add_object_data(context, obdata, operator=None):
bpy.ops.object.mode_set(mode='EDIT')
else:
scene.objects.active = obj_new
- if context.user_preferences.edit.enter_edit_mode:
+ if context.user_preferences.edit.use_enter_edit_mode:
bpy.ops.object.mode_set(mode='EDIT')
return base
diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py
index 1e6db441599..5b7d5a76336 100644
--- a/release/scripts/modules/bpy/__init__.py
+++ b/release/scripts/modules/bpy/__init__.py
@@ -26,7 +26,7 @@ data = _bpy.data
context = _bpy.context
# python modules
-from bpy import utils
+from bpy import utils, path
from bpy import ops as _ops_module
@@ -48,7 +48,7 @@ def _main():
import pydoc
pydoc.getpager = lambda: pydoc.plainpager
pydoc.Helper.getline = lambda self, prompt: None
- pydoc.TextDoc.bold = lambda self, text: text
+ pydoc.TextDoc.use_bold = lambda self, text: text
# if "-d" in sys.argv: # Enable this to measure startup speed
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py
index 5cde7091257..7cfe476c2e7 100644
--- a/release/scripts/modules/bpy/utils.py
+++ b/release/scripts/modules/bpy/utils.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
"""
-This module contains utility functions spesific to blender but
+This module contains utility functions specific to blender but
not assosiated with blenders internal data.
"""
@@ -27,8 +27,8 @@ import bpy as _bpy
import os as _os
import sys as _sys
-from _bpy import home_paths, blend_paths
-
+from _bpy import blend_paths
+from _bpy import script_paths as _bpy_script_paths
def _test_import(module_name, loaded_modules):
import traceback
@@ -59,7 +59,7 @@ def modules_from_path(path, loaded_modules):
:arg path: this path is scanned for scripts and packages.
:type path: string
- :arg loaded_modules: alredy loaded module names, files matching these names will be ignored.
+ :arg loaded_modules: already loaded module names, files matching these names will be ignored.
:type loaded_modules: set
:return: all loaded modules.
:rtype: list
@@ -83,9 +83,9 @@ def modules_from_path(path, loaded_modules):
modules.append(mod)
return modules
-
-_loaded = [] # store loaded modules for reloading.
-_bpy_types = __import__("bpy_types") # keep for comparisons, never ever reload this.
+
+_global_loaded_modules = [] # store loaded module names for reloading.
+import bpy_types as _bpy_types # keep for comparisons, never ever reload this.
def load_scripts(reload_scripts=False, refresh_scripts=False):
@@ -100,12 +100,39 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
import traceback
import time
+ # must be set back to True on exits
+ _bpy_types._register_immediate = False
+
t_main = time.time()
loaded_modules = set()
if refresh_scripts:
original_modules = _sys.modules.values()
+
+ if reload_scripts:
+ _bpy_types.TypeMap.clear()
+ _bpy_types.PropertiesMap.clear()
+
+ def register_module_call(mod):
+ _bpy_types._register_module(mod.__name__)
+ register = getattr(mod, "register", None)
+ if register:
+ try:
+ register()
+ except:
+ traceback.print_exc()
+ else:
+ print("\nWarning! '%s' has no register function, this is now a requirement for registerable scripts." % mod.__file__)
+
+ def unregister_module_call(mod):
+ _bpy_types._unregister_module(mod.__name__)
+ unregister = getattr(mod, "unregister", None)
+ if unregister:
+ try:
+ unregister()
+ except:
+ traceback.print_exc()
def sys_path_ensure(path):
if path not in _sys.path: # reloading would add twice
@@ -133,48 +160,23 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
mod = test_reload(mod)
if mod:
- register = getattr(mod, "register", None)
- if register:
- try:
- register()
- except:
- traceback.print_exc()
- else:
- print("\nWarning! '%s' has no register function, this is now a requirement for registerable scripts." % mod.__file__)
- _loaded.append(mod)
+ register_module_call(mod)
+ _global_loaded_modules.append(mod.__name__)
if reload_scripts:
- # TODO, this is broken but should work, needs looking into
- '''
- # reload modules that may not be directly included
- for type_class_name in dir(_bpy.types):
- type_class = getattr(_bpy.types, type_class_name)
- module_name = getattr(type_class, "__module__", "")
-
- if module_name and module_name != "bpy.types": # hard coded for C types
- loaded_modules.add(module_name)
-
- # sorting isnt needed but rather it be pradictable
- for module_name in sorted(loaded_modules):
- print("Reloading:", module_name)
- test_reload(_sys.modules[module_name])
- '''
+ # module names -> modules
+ _global_loaded_modules[:] = [_sys.modules[mod_name] for mod_name in _global_loaded_modules]
# loop over and unload all scripts
- _loaded.reverse()
- for mod in _loaded:
- unregister = getattr(mod, "unregister", None)
- if unregister:
- try:
- unregister()
- except:
- traceback.print_exc()
+ _global_loaded_modules.reverse()
+ for mod in _global_loaded_modules:
+ unregister_module_call(mod)
- for mod in _loaded:
- reload(mod)
+ for mod in _global_loaded_modules:
+ test_reload(mod)
- _loaded[:] = []
+ _global_loaded_modules[:] = []
user_path = user_script_path()
@@ -196,7 +198,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
# load addons
used_ext = {ext.module for ext in _bpy.context.user_preferences.addons}
- paths = script_paths("addons")
+ paths = script_paths("addons") + script_paths("addons_contrib")
for path in paths:
sys_path_ensure(path)
@@ -209,79 +211,11 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
print("gc.collect() -> %d" % gc.collect())
if _bpy.app.debug:
- print("Time %.4f" % (time.time() - t_main))
-
-
-def expandpath(path):
- """
- Returns the absolute path relative to the current blend file using the "//" prefix.
- """
- if path.startswith("//"):
- return _os.path.join(_os.path.dirname(_bpy.data.filepath), path[2:])
-
- return path
-
-
-def relpath(path, start=None):
- """
- Returns the path relative to the current blend file using the "//" prefix.
+ print("Python Script Load Time %.4f" % (time.time() - t_main))
+
+ _bpy_types._register_immediate = True
- :arg start: Relative to this path, when not set the current filename is used.
- :type start: string
- """
- if not path.startswith("//"):
- if start is None:
- start = _os.path.dirname(_bpy.data.filepath)
- return "//" + _os.path.relpath(path, start)
-
- return path
-
-
-_unclean_chars = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, \
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, \
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 58, 59, 60, 61, 62, 63, \
- 64, 91, 92, 93, 94, 96, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, \
- 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, \
- 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, \
- 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, \
- 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, \
- 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, \
- 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, \
- 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, \
- 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, \
- 245, 246, 247, 248, 249, 250, 251, 252, 253, 254]
-
-_unclean_chars = ''.join([chr(i) for i in _unclean_chars])
-
-
-def clean_name(name, replace="_"):
- """
- Returns a name with characters replaced that may cause problems under various circumstances, such as writing to a file.
- All characters besides A-Z/a-z, 0-9 are replaced with "_"
- or the replace argument if defined.
- """
- for ch in _unclean_chars:
- name = name.replace(ch, replace)
- return name
-
-
-def display_name(name):
- """
- Creates a display string from name to be used menus and the user interface.
- Capitalize the first letter in all lowercase names, mixed case names are kept as is.
- Intended for use with filenames and module names.
- """
- name_base = _os.path.splitext(name)[0]
-
- # string replacements
- name_base = name_base.replace("_colon_", ":")
- name_base = name_base.replace("_", " ")
-
- if name_base.islower():
- return name_base.capitalize()
- else:
- return name_base
# base scripts
@@ -290,7 +224,7 @@ _scripts = (_os.path.normpath(_scripts), )
def user_script_path():
- path = _bpy.context.user_preferences.filepaths.python_scripts_directory
+ path = _bpy.context.user_preferences.filepaths.script_directory
if path:
path = _os.path.normpath(path)
@@ -309,11 +243,11 @@ def script_paths(subdir=None, user=True):
# add user scripts dir
if user:
- user_script_path = _bpy.context.user_preferences.filepaths.python_scripts_directory
+ user_script_path = _bpy.context.user_preferences.filepaths.script_directory
else:
user_script_path = None
- for path in home_paths("scripts") + (user_script_path, ):
+ for path in _bpy_script_paths() + (user_script_path, ):
if path:
path = _os.path.normpath(path)
if path not in scripts and _os.path.isdir(path):
@@ -336,7 +270,7 @@ _presets = _os.path.join(_scripts[0], "presets") # FIXME - multiple paths
def preset_paths(subdir):
'''
- Returns a list of paths for a spesific preset.
+ Returns a list of paths for a specific preset.
'''
return (_os.path.join(_presets, subdir), )
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 9d6f5ce7b2f..5030e9f4868 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -19,6 +19,7 @@
# <pep8 compliant>
from _bpy import types as bpy_types
+import _bpy
from mathutils import Vector
StructRNA = bpy_types.Struct.__bases__[0]
@@ -51,7 +52,7 @@ class Library(bpy_types.ID):
# See: readblenentry.c, IDTYPE_FLAGS_ISLINKABLE, we could make this an attribute in rna.
attr_links = "actions", "armatures", "brushes", "cameras", \
- "curves", "gpencil", "groups", "images", \
+ "curves", "grease_pencil", "groups", "images", \
"lamps", "lattices", "materials", "metaballs", \
"meshes", "node_groups", "objects", "scenes", \
"sounds", "textures", "texts", "fonts", "worlds"
@@ -308,11 +309,11 @@ class Mesh(bpy_types.ID):
self.add_geometry(len(verts), len(edges), len(faces))
verts_flat = [f for v in verts for f in v]
- self.verts.foreach_set("co", verts_flat)
+ self.vertices.foreach_set("co", verts_flat)
del verts_flat
edges_flat = [i for e in edges for i in e]
- self.edges.foreach_set("verts", edges_flat)
+ self.edges.foreach_set("vertices", edges_flat)
del edges_flat
def treat_face(f):
@@ -323,7 +324,7 @@ class Mesh(bpy_types.ID):
return f
faces_flat = [v for f in faces for v in treat_face(f)]
- self.faces.foreach_set("verts_raw", faces_flat)
+ self.faces.foreach_set("vertices_raw", faces_flat)
del faces_flat
@property
@@ -371,7 +372,7 @@ class Mesh(bpy_types.ID):
for f in faces:
# if len(f) == 4:
- if f.verts_raw[3] != 0:
+ if f.vertices_raw[3] != 0:
edge_keys = f.edge_keys
for i, edkey in enumerate(f.edge_keys):
edges.setdefault(edkey, []).append(edge_keys[OTHER_INDEX[i]])
@@ -444,11 +445,11 @@ class Mesh(bpy_types.ID):
if not hasattr(edges, "pop"):
edges = edges[:]
- edge_dict = {ed.key: ed for ed in self.edges if ed.selected}
+ edge_dict = {ed.key: ed for ed in self.edges if ed.select}
while edges:
current_edge = edges.pop()
- vert_end, vert_start = current_edge.verts[:]
+ vert_end, vert_start = current_edge.vertices[:]
line_poly = [vert_start, vert_end]
ok = True
@@ -459,7 +460,7 @@ class Mesh(bpy_types.ID):
while i:
i -= 1
ed = edges[i]
- v1, v2 = ed.verts
+ v1, v2 = ed.vertices
if v1 == vert_end:
line_poly.append(v2)
vert_end = line_poly[-1]
@@ -494,7 +495,7 @@ class MeshEdge(StructRNA):
@property
def key(self):
- return ord_ind(*tuple(self.verts))
+ return ord_ind(*tuple(self.vertices))
class MeshFace(StructRNA):
@@ -503,8 +504,8 @@ class MeshFace(StructRNA):
@property
def center(self):
"""The midpoint of the face."""
- face_verts = self.verts[:]
- mesh_verts = self.id_data.verts
+ face_verts = self.vertices[:]
+ mesh_verts = self.id_data.vertices
if len(face_verts) == 3:
return (mesh_verts[face_verts[0]].co + mesh_verts[face_verts[1]].co + mesh_verts[face_verts[2]].co) / 3.0
else:
@@ -512,7 +513,7 @@ class MeshFace(StructRNA):
@property
def edge_keys(self):
- verts = self.verts[:]
+ verts = self.vertices[:]
if len(verts) == 3:
return ord_ind(verts[0], verts[1]), ord_ind(verts[1], verts[2]), ord_ind(verts[2], verts[0])
@@ -524,7 +525,7 @@ class Text(bpy_types.ID):
def as_string(self):
"""Return the text as a string."""
- return "\n".join(line.line for line in self.lines)
+ return "\n".join(line.body for line in self.lines)
def from_string(self, string):
"""Replace text with this string."""
@@ -539,8 +540,83 @@ class Text(bpy_types.ID):
import collections
+TypeMap = {}
+# Properties (IDPropertyGroup) are different from types because they need to be registered
+# before adding sub properties to them, so they are registered on definition
+# and unregistered on unload
+PropertiesMap = {}
-class OrderedMeta(type):
+# Using our own loading function we set this to false
+# so when running a script directly in the text editor
+# registers moduals instantly.
+_register_immediate = True
+
+def _unregister_module(module, free=True):
+ for t in TypeMap.get(module, ()):
+ try:
+ bpy_types.unregister(t)
+ except:
+ import traceback
+ print("bpy.utils._unregister_module(): Module '%s' failed to unregister class '%s.%s'" % (module, t.__module__, t.__name__))
+ traceback.print_exc()
+
+ if free == True and module in TypeMap:
+ del TypeMap[module]
+
+
+ for t in PropertiesMap.get(module, ()):
+ try:
+ bpy_types.unregister(t)
+ except:
+ import traceback
+ print("bpy.utils._unload_module(): Module '%s' failed to unregister class '%s.%s'" % (module, t.__module__, t.__name__))
+ traceback.print_exc()
+
+ if free == True and module in PropertiesMap:
+ del PropertiesMap[module]
+
+
+def _register_module(module):
+ for t in TypeMap.get(module, ()):
+ try:
+ bpy_types.register(t)
+ except:
+ import traceback
+ print("bpy.utils._register_module(): Module '%s' failed to register class '%s.%s'" % (module, t.__module__, t.__name__))
+ traceback.print_exc()
+
+
+class RNAMeta(type):
+ @classmethod
+ def _register_immediate(cls):
+ return _register_immediate
+
+ def __new__(cls, name, bases, classdict, **args):
+ result = type.__new__(cls, name, bases, classdict)
+ if bases and bases[0] != StructRNA:
+ module = result.__module__
+
+ ClassMap = TypeMap
+
+ # Register right away if needed
+ if cls._register_immediate():
+ bpy_types.register(result)
+ ClassMap = PropertiesMap
+
+ # first part of packages only
+ if "." in module:
+ module = module[:module.index(".")]
+
+ ClassMap.setdefault(module, []).append(result)
+
+ return result
+
+class RNAMetaRegister(RNAMeta):
+ @classmethod
+ def _register_immediate(cls):
+ return True
+
+class OrderedMeta(RNAMeta):
def __init__(cls, name, bases, attributes):
super(OrderedMeta, cls).__init__(name, bases, attributes)
@@ -549,7 +625,6 @@ class OrderedMeta(type):
def __prepare__(name, bases, **kwargs):
return collections.OrderedDict()
-
# Only defined so operators members can be used by accessing self.order
class Operator(StructRNA, metaclass=OrderedMeta):
__slots__ = ()
@@ -564,7 +639,12 @@ class Macro(StructRNA, metaclass=OrderedMeta):
def define(self, opname):
from _bpy import ops
return ops.macro_define(self, opname)
+
+class IDPropertyGroup(StructRNA, metaclass=RNAMetaRegister):
+ __slots__ = ()
+class RenderEngine(StructRNA, metaclass=RNAMeta):
+ __slots__ = ()
class _GenericUI:
__slots__ = ()
@@ -606,15 +686,15 @@ class _GenericUI:
pass
-class Panel(StructRNA, _GenericUI):
+class Panel(StructRNA, _GenericUI, metaclass=RNAMeta):
__slots__ = ()
-class Header(StructRNA, _GenericUI):
+class Header(StructRNA, _GenericUI, metaclass=RNAMeta):
__slots__ = ()
-class Menu(StructRNA, _GenericUI):
+class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
__slots__ = ()
def path_menu(self, searchpaths, operator, props_default={}):
@@ -638,7 +718,7 @@ class Menu(StructRNA, _GenericUI):
if f.startswith("."):
continue
- preset_name = bpy.utils.display_name(f)
+ preset_name = bpy.path.display_name(f)
props = layout.operator(operator, text=preset_name)
for attr, value in props_default.items():
diff --git a/release/scripts/modules/graphviz_export.py b/release/scripts/modules/graphviz_export.py
index 900d69670d5..2389e1f9020 100644
--- a/release/scripts/modules/graphviz_export.py
+++ b/release/scripts/modules/graphviz_export.py
@@ -66,7 +66,7 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr
print("")
for bone in bones:
b = arm.bones[bone]
- print(">>", bone, ["*>", "->"][b.connected], getattr(getattr(b, "parent", ""), "name", ""))
+ print(">>", bone, ["*>", "->"][b.use_connect], getattr(getattr(b, "parent", ""), "name", ""))
label = [bone]
bone = arm.bones[bone]
@@ -103,7 +103,7 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr
parent = bone.parent
if parent:
parent_name = parent.name
- connected = bone.connected
+ connected = bone.use_connect
elif FAKE_PARENT:
parent_name = 'Object::%s' % obj.name
connected = False
diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py
index ef8f62ad058..98d9bb235a2 100644
--- a/release/scripts/modules/rigify/__init__.py
+++ b/release/scripts/modules/rigify/__init__.py
@@ -159,8 +159,8 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
# Not needed but catches any errors before duplicating
validate_rig(context, obj_orig)
- global_undo = context.user_preferences.edit.global_undo
- context.user_preferences.edit.global_undo = False
+ use_global_undo = context.user_preferences.edit.use_global_undo
+ context.user_preferences.edit.use_global_undo = False
mode_orig = context.mode
rest_backup = obj_orig.data.pose_position
obj_orig.data.pose_position = 'REST'
@@ -191,8 +191,8 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
obj.animation_data_clear()
# Select generated rig object
- obj_orig.selected = False
- obj.selected = True
+ obj_orig.select = False
+ obj.select = True
scene.objects.active = obj
# Remove all bones from the generated rig armature.
@@ -212,9 +212,9 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
# Select the temp rigs for merging
for objt in scene.objects:
- objt.selected = False # deselect all objects
- temp_rig_1.selected = True
- temp_rig_2.selected = True
+ objt.select = False # deselect all objects
+ temp_rig_1.select = True
+ temp_rig_2.select = True
scene.objects.active = temp_rig_2
# Merge the temporary rigs
@@ -225,8 +225,8 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
# Select the generated rig
for objt in scene.objects:
- objt.selected = False # deselect all objects
- obj.selected = True
+ objt.select = False # deselect all objects
+ obj.select = True
scene.objects.active = obj
# Copy over the pose_bone properties
@@ -282,7 +282,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
edit_bone.head = (0.0, 0.0, 0.0)
edit_bone.tail = (0.0, 1.0, 0.0)
edit_bone.roll = 0.0
- edit_bone.layer = ROOT_LAYERS
+ edit_bone.layers = ROOT_LAYERS
bpy.ops.object.mode_set(mode='OBJECT')
# key: bone name
@@ -412,7 +412,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
else:
root_ebone_tmp = root_ebone
- ebone.connected = False
+ ebone.use_connect = False
ebone.parent = root_ebone_tmp
'''
@@ -429,7 +429,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
con.target = obj
con.subtarget = bone_name
- if not pbone.bone.connected:
+ if not pbone.bone.use_connect:
con = pbone.constraints.new('COPY_LOCATION')
con.target = obj
con.subtarget = bone_name
@@ -445,33 +445,33 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
layer_second_last[30] = True
for bone_name, bone in arm.bones.items():
- bone.deform = False # Non DEF bones shouldn't deform
+ bone.use_deform = False # Non DEF bones shouldn't deform
if bone_name.startswith(ORG_PREFIX):
- bone.layer = ORG_LAYERS
+ bone.layers = ORG_LAYERS
elif bone_name.startswith(MCH_PREFIX): # XXX fixme
- bone.layer = MCH_LAYERS
+ bone.layers = MCH_LAYERS
elif bone_name.startswith(DEF_PREFIX): # XXX fixme
- bone.layer = DEF_LAYERS
- bone.deform = True
+ bone.layers = DEF_LAYERS
+ bone.use_deform = True
else:
# Assign bone appearance if there is a widget for it
obj.pose.bones[bone_name].custom_shape = context.scene.objects.get(WGT_PREFIX + bone_name)
- layer_tot[:] = [max(lay) for lay in zip(layer_tot, bone.layer)]
+ layer_tot[:] = [max(lay) for lay in zip(layer_tot, bone.layers)]
# Only for demo'ing
layer_show = [a and not (b or c or d) for a, b, c, d in zip(layer_tot, ORG_LAYERS, MCH_LAYERS, DEF_LAYERS)]
- arm.layer = layer_show
+ arm.layers = layer_show
- # obj.restrict_view = True
- obj.data.draw_axes = False
+ # obj.hide = True
+ obj.data.show_axes = False
bpy.ops.object.mode_set(mode=mode_orig)
obj_orig.data.pose_position = rest_backup
obj.data.pose_position = 'POSE'
obj_orig.data.pose_position = 'POSE'
- context.user_preferences.edit.global_undo = global_undo
+ context.user_preferences.edit.use_global_undo = use_global_undo
print("Done.\n")
@@ -490,8 +490,8 @@ def generate_test(context, metarig_type="", GENERATE_FINAL=True):
scene.objects.link(obj_new)
scene.objects.active = obj_new
for obj in scene.objects:
- obj.selected = False
- obj_new.selected = True
+ obj.select = False
+ obj_new.select = True
for module_name in get_submodule_types():
if (metarig_type and module_name != metarig_type):
@@ -537,7 +537,7 @@ def generate_test_all(context, GRAPH=False):
base_name = os.path.splitext(bpy.data.filepath)[0]
for obj, obj_new in new_objects:
for obj in (obj, obj_new):
- fn = base_name + "-" + bpy.utils.clean_name(obj.name)
+ fn = base_name + "-" + bpy.path.clean_name(obj.name)
path_dot = fn + ".dot"
path_png = fn + ".png"
@@ -548,11 +548,11 @@ def generate_test_all(context, GRAPH=False):
i = 0
for obj, obj_new in new_objects:
- obj.data.drawtype = 'STICK'
+ obj.data.draw_type = 'STICK'
obj.location[1] += i
obj_new.location[1] += i
- obj_new.selected = False
- obj.selected = True
+ obj_new.select = False
+ obj.select = True
i += 4
diff --git a/release/scripts/modules/rigify/arm_biped.py b/release/scripts/modules/rigify/arm_biped.py
index 7a99eb5d80a..ac878c3c076 100644
--- a/release/scripts/modules/rigify/arm_biped.py
+++ b/release/scripts/modules/rigify/arm_biped.py
@@ -37,24 +37,24 @@ def metarig_template():
bone.head[:] = 0.0000, -0.0425, 0.0000
bone.tail[:] = 0.0942, -0.0075, 0.0333
bone.roll = -0.2227
- bone.connected = False
+ bone.use_connect = False
bone = arm.edit_bones.new('upper_arm')
bone.head[:] = 0.1066, -0.0076, -0.0010
bone.tail[:] = 0.2855, 0.0206, -0.0104
bone.roll = 1.6152
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['shoulder']
bone = arm.edit_bones.new('forearm')
bone.head[:] = 0.2855, 0.0206, -0.0104
bone.tail[:] = 0.4550, -0.0076, -0.0023
bone.roll = 1.5153
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['upper_arm']
bone = arm.edit_bones.new('hand')
bone.head[:] = 0.4550, -0.0076, -0.0023
bone.tail[:] = 0.5423, -0.0146, -0.0131
bone.roll = -3.0083
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['forearm']
bpy.ops.object.mode_set(mode='OBJECT')
@@ -78,7 +78,7 @@ def metarig_definition(obj, orig_bone_name):
hands = []
for pbone in obj.pose.bones:
index = pbone.parent_index(mt.arm_p)
- if index == 2 and pbone.bone.connected and pbone.bone.parent.connected:
+ if index == 2 and pbone.bone.use_connect and pbone.bone.parent.use_connect:
hands.append(pbone)
if len(hands) != 1:
@@ -106,12 +106,12 @@ def ik(obj, definitions, base_names, options):
ik_chain = mt.copy(to_fmt="MCH-%s_ik", base_names=base_names, exclude_attrs=["shoulder"])
# IK needs no parent_index
- ik_chain.hand_e.connected = False
+ ik_chain.hand_e.use_connect = False
ik_chain.hand_e.parent = None
- ik_chain.hand_e.local_location = False
+ ik_chain.hand_e.use_local_location = False
ik_chain.rename("hand", get_base_name(base_names[mt.hand]) + "_ik" + get_side_name(mt.hand))
- ik_chain.arm_e.connected = False
+ ik_chain.arm_e.use_connect = False
ik_chain.arm_e.parent = mt.shoulder_e
# Add the bone used for the arms poll target
@@ -119,7 +119,7 @@ def ik(obj, definitions, base_names, options):
ik.pole = add_pole_target_bone(obj, mt.forearm, "elbow_target" + get_side_name(mt.forearm), mode='ZAVERAGE')
ik.update()
- ik.pole_e.local_location = False
+ ik.pole_e.use_local_location = False
# option: elbow_parent
elbow_parent_name = options.get("elbow_parent", "")
@@ -137,8 +137,8 @@ def ik(obj, definitions, base_names, options):
ik.pole_vis = add_stretch_to(obj, mt.forearm, ik.pole, "VIS-%s_ik" % base_names[mt.forearm])
ik.update()
- ik.hand_vis_e.restrict_select = True
- ik.pole_vis_e.restrict_select = True
+ ik.hand_vis_e.hide_select = True
+ ik.pole_vis_e.hide_select = True
bpy.ops.object.mode_set(mode='OBJECT')
@@ -147,9 +147,9 @@ def ik(obj, definitions, base_names, options):
ik_chain.update()
# Set IK dof
- ik_chain.forearm_p.ik_dof_x = True
- ik_chain.forearm_p.ik_dof_y = False
- ik_chain.forearm_p.ik_dof_z = False
+ ik_chain.forearm_p.lock_ik_x = False
+ ik_chain.forearm_p.lock_ik_y = True
+ ik_chain.forearm_p.lock_ik_z = True
con = ik_chain.forearm_p.constraints.new('IK')
con.target = obj
@@ -161,18 +161,18 @@ def ik(obj, definitions, base_names, options):
con.use_stretch = True
con.use_target = True
con.use_rotation = False
- con.chain_length = 2
+ con.chain_count = 2
con.pole_angle = -pi/2
# last step setup layers
if "ik_layer" in options:
layer = [n==options["ik_layer"] for n in range(0,32)]
else:
- layer = list(mt.arm_b.layer)
- ik_chain.hand_b.layer = layer
- ik.hand_vis_b.layer = layer
- ik.pole_b.layer = layer
- ik.pole_vis_b.layer = layer
+ layer = list(mt.arm_b.layers)
+ ik_chain.hand_b.layers = layer
+ ik.hand_vis_b.layers = layer
+ ik.pole_b.layers = layer
+ ik.pole_vis_b.layers = layer
bpy.ops.object.mode_set(mode='EDIT')
# don't blend the shoulder
@@ -197,7 +197,7 @@ def fk(obj, definitions, base_names, options):
# upper arm constrains to this.
ex.socket_e = copy_bone_simple(arm, mt.arm, "MCH-%s_socket" % base_names[mt.arm])
ex.socket = ex.socket_e.name
- ex.socket_e.connected = False
+ ex.socket_e.use_connect = False
ex.socket_e.parent = mt.shoulder_e
ex.socket_e.length *= 0.5
@@ -206,11 +206,11 @@ def fk(obj, definitions, base_names, options):
ex.hand_delta_e = copy_bone_simple(arm, fk_chain.hand, "MCH-delta_%s" % base_names[mt.hand], parent=True)
ex.hand_delta = ex.hand_delta_e.name
ex.hand_delta_e.length *= 0.5
- ex.hand_delta_e.connected = False
+ ex.hand_delta_e.use_connect = False
if "hand_roll" in options:
ex.hand_delta_e.roll += radians(options["hand_roll"])
- fk_chain.hand_e.connected = False
+ fk_chain.hand_e.use_connect = False
fk_chain.hand_e.parent = ex.hand_delta_e
bpy.ops.object.mode_set(mode='OBJECT')
@@ -273,10 +273,10 @@ def fk(obj, definitions, base_names, options):
if "fk_layer" in options:
layer = [n==options["fk_layer"] for n in range(0,32)]
else:
- layer = list(mt.arm_b.layer)
- fk_chain.arm_b.layer = layer
- fk_chain.forearm_b.layer = layer
- fk_chain.hand_b.layer = layer
+ layer = list(mt.arm_b.layers)
+ fk_chain.arm_b.layers = layer
+ fk_chain.forearm_b.layers = layer
+ fk_chain.hand_b.layers = layer
# Forearm was getting wrong roll somehow. Hack to fix that.
bpy.ops.object.mode_set(mode='EDIT')
@@ -295,8 +295,8 @@ def deform(obj, definitions, base_names, options):
# Create upper arm bones: two bones, each half of the upper arm.
uarm1 = copy_bone_simple(obj.data, definitions[1], "DEF-%s.01" % base_names[definitions[1]], parent=True)
uarm2 = copy_bone_simple(obj.data, definitions[1], "DEF-%s.02" % base_names[definitions[1]], parent=True)
- uarm1.connected = False
- uarm2.connected = False
+ uarm1.use_connect = False
+ uarm2.use_connect = False
uarm2.parent = uarm1
center = uarm1.center
uarm1.tail = center
@@ -305,8 +305,8 @@ def deform(obj, definitions, base_names, options):
# Create forearm bones: two bones, each half of the forearm.
farm1 = copy_bone_simple(obj.data, definitions[2], "DEF-%s.01" % base_names[definitions[2]], parent=True)
farm2 = copy_bone_simple(obj.data, definitions[2], "DEF-%s.02" % base_names[definitions[2]], parent=True)
- farm1.connected = False
- farm2.connected = False
+ farm1.use_connect = False
+ farm2.use_connect = False
farm2.parent = farm1
center = farm1.center
farm1.tail = center
@@ -314,7 +314,7 @@ def deform(obj, definitions, base_names, options):
# Create twist bone
twist = copy_bone_simple(obj.data, definitions[2], "MCH-arm_twist")
- twist.connected = False
+ twist.use_connect = False
twist.parent = obj.data.edit_bones[definitions[3]]
twist.length /= 2
diff --git a/release/scripts/modules/rigify/copy.py b/release/scripts/modules/rigify/copy.py
index e0bff555a9b..c051e5bb7f6 100644
--- a/release/scripts/modules/rigify/copy.py
+++ b/release/scripts/modules/rigify/copy.py
@@ -33,7 +33,7 @@ def metarig_template():
bone.head[:] = 0.0000, 0.0000, 0.0000
bone.tail[:] = 0.0000, 0.0000, 1.0000
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bpy.ops.object.mode_set(mode='OBJECT')
pbone = obj.pose.bones['Bone']
@@ -98,7 +98,7 @@ def control(obj, definitions, base_names, options):
cp.cpy_p.lock_scale = tuple(mt.cpy_p.lock_scale)
# Layers
- cp.cpy_b.layer = list(mt.cpy_b.layer)
+ cp.cpy_b.layers = list(mt.cpy_b.layers)
return (mt.cpy,)
diff --git a/release/scripts/modules/rigify/delta.py b/release/scripts/modules/rigify/delta.py
index dce03b5f412..d0b4fbccce9 100644
--- a/release/scripts/modules/rigify/delta.py
+++ b/release/scripts/modules/rigify/delta.py
@@ -34,18 +34,18 @@ def metarig_template():
bone.head[:] = 0.0000, 0.0000, 0.0000
bone.tail[:] = -0.0000, 0.7382, 0.1895
bone.roll = -0.0000
- bone.connected = False
+ bone.use_connect = False
bone = arm.edit_bones.new('delta')
bone.head[:] = -0.0497, 0.8414, 0.3530
bone.tail[:] = -0.2511, 1.1588, 0.9653
bone.roll = 2.6044
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['bonesker']
bone = arm.edit_bones.new('boney')
bone.head[:] = 0.7940, 2.5592, 0.4134
bone.tail[:] = 0.7940, 3.3975, 0.4890
bone.roll = 3.1416
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['delta']
bpy.ops.object.mode_set(mode='OBJECT')
@@ -67,7 +67,7 @@ def metarig_definition(obj, orig_bone_name):
if len(children) != 1:
raise RigifyError("only 1 child supported for delta on bone '%s'" % delta.name)
- if delta.connected:
+ if delta.use_connect:
raise RigifyError("bone cannot be connected to its parent '%s'" % delta.name)
bone_definition = [delta.name, children[0].name]
diff --git a/release/scripts/modules/rigify/eye_balls.py b/release/scripts/modules/rigify/eye_balls.py
index 48f0448dfb3..f65d56b9f2b 100644
--- a/release/scripts/modules/rigify/eye_balls.py
+++ b/release/scripts/modules/rigify/eye_balls.py
@@ -134,7 +134,7 @@ def metarig_template():
bone.head[:] = 0.0000, 0.0000, 0.0000
bone.tail[:] = 0.0000, 0.0000, 1.0000
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bpy.ops.object.mode_set(mode='OBJECT')
pbone = obj.pose.bones['Bone']
@@ -328,8 +328,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'SCALE_X'
con.frame_start = -20
con.frame_end = 20
- con.minimum = 0.0
- con.maximum = 2.0
+ con.min = 0.0
+ con.max = 2.0
con.target_space = 'LOCAL'
@@ -379,15 +379,15 @@ def control(obj, definitions, base_names, options):
# Set layers
- #layer = list(bb[definitions[2]].layer)
- #bb[lid1].layer = layer
- #bb[lid2].layer = layer
- #bb[lid3].layer = layer
- #bb[lid4].layer = layer
- #bb[lid5].layer = layer
- #bb[lid6].layer = layer
- #bb[lid7].layer = layer
- #bb[lid8].layer = layer
+ #layer = list(bb[definitions[2]].layers)
+ #bb[lid1].layers = layer
+ #bb[lid2].layers = layer
+ #bb[lid3].layers = layer
+ #bb[lid4].layers = layer
+ #bb[lid5].layers = layer
+ #bb[lid6].layers = layer
+ #bb[lid7].layers = layer
+ #bb[lid8].layers = layer
return (None,)
diff --git a/release/scripts/modules/rigify/eye_lid.py b/release/scripts/modules/rigify/eye_lid.py
index bb9749011c2..3f336e268c6 100644
--- a/release/scripts/modules/rigify/eye_lid.py
+++ b/release/scripts/modules/rigify/eye_lid.py
@@ -56,7 +56,7 @@ def metarig_template():
bone.head[:] = 0.0000, 0.0000, 0.0000
bone.tail[:] = 0.0000, 0.0000, 1.0000
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bpy.ops.object.mode_set(mode='OBJECT')
pbone = obj.pose.bones['Bone']
@@ -148,10 +148,10 @@ def deform(obj, definitions, base_names, options):
eb[dlid3].parent = eb[dlid4]
eb[dlid33].parent = eb[dlid3]
- eb[dlid2].connected = True
- eb[dlid22].connected = True
- eb[dlid3].connected = True
- eb[dlid33].connected = True
+ eb[dlid2].use_connect = True
+ eb[dlid22].use_connect = True
+ eb[dlid3].use_connect = True
+ eb[dlid33].use_connect = True
eb[dlid1].bbone_segments = 8
eb[dlid2].bbone_segments = 8
@@ -170,10 +170,10 @@ def deform(obj, definitions, base_names, options):
eb[dlid7].parent = eb[dlid8]
eb[dlid77].parent = eb[dlid7]
- eb[dlid6].connected = True
- eb[dlid66].connected = True
- eb[dlid7].connected = True
- eb[dlid77].connected = True
+ eb[dlid6].use_connect = True
+ eb[dlid66].use_connect = True
+ eb[dlid7].use_connect = True
+ eb[dlid77].use_connect = True
eb[dlid5].bbone_segments = 8
eb[dlid6].bbone_segments = 8
@@ -436,8 +436,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'LOCATION_Y'
con.frame_start = -30
con.frame_end = 30
- con.minimum = -distance*2
- con.maximum = distance
+ con.min = -distance*2
+ con.max = distance
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -455,8 +455,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'LOCATION_Y'
con.frame_start = -30
con.frame_end = 30
- con.minimum = -distance*2
- con.maximum = distance
+ con.min = -distance*2
+ con.max = distance
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -473,8 +473,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'LOCATION_Y'
con.frame_start = -30
con.frame_end = 30
- con.minimum = -distance*2
- con.maximum = distance
+ con.min = -distance*2
+ con.max = distance
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -491,8 +491,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'LOCATION_Y'
con.frame_start = -30
con.frame_end = 30
- con.minimum = -distance*2
- con.maximum = distance
+ con.min = -distance*2
+ con.max = distance
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -509,8 +509,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'LOCATION_Y'
con.frame_start = -30
con.frame_end = 30
- con.minimum = -distance*2
- con.maximum = distance
+ con.min = -distance*2
+ con.max = distance
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -528,8 +528,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'LOCATION_Y'
con.frame_start = -30
con.frame_end = 30
- con.minimum = -distance
- con.maximum = distance*2
+ con.min = -distance
+ con.max = distance*2
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -546,8 +546,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'LOCATION_Y'
con.frame_start = -30
con.frame_end = 30
- con.minimum = -distance
- con.maximum = distance*2
+ con.min = -distance
+ con.max = distance*2
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -564,8 +564,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'LOCATION_Y'
con.frame_start = -30
con.frame_end = 30
- con.minimum = -distance
- con.maximum = distance*2
+ con.min = -distance
+ con.max = distance*2
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -582,8 +582,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'LOCATION_Y'
con.frame_start = -30
con.frame_end = 30
- con.minimum = -distance
- con.maximum = distance*2
+ con.min = -distance
+ con.max = distance*2
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -600,8 +600,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'LOCATION_Y'
con.frame_start = -30
con.frame_end = 30
- con.minimum = -distance
- con.maximum = distance*2
+ con.min = -distance
+ con.max = distance*2
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -615,15 +615,15 @@ def control(obj, definitions, base_names, options):
# Set layers
- layer = list(bb[definitions[2]].layer)
- bb[lid1].layer = layer
- bb[lid2].layer = layer
- bb[lid3].layer = layer
- bb[lid4].layer = layer
- bb[lid5].layer = layer
- bb[lid6].layer = layer
- bb[lid7].layer = layer
- bb[lid8].layer = layer
+ layer = list(bb[definitions[2]].layers)
+ bb[lid1].layers = layer
+ bb[lid2].layers = layer
+ bb[lid3].layers = layer
+ bb[lid4].layers = layer
+ bb[lid5].layers = layer
+ bb[lid6].layers = layer
+ bb[lid7].layers = layer
+ bb[lid8].layers = layer
return (None,)
@@ -648,7 +648,7 @@ def make_lid_stretch_bone(obj, name, bone1, bone2, roll_alpha):
# Create the bone, pointing from bone1 to bone2
bone_e = copy_bone_simple(obj.data, bone1, name, parent=True)
- bone_e.connected = False
+ bone_e.use_connect = False
bone_e.tail = eb[bone2].head
bone = bone_e.name
diff --git a/release/scripts/modules/rigify/finger_curl.py b/release/scripts/modules/rigify/finger_curl.py
index 63f1816012b..947ec75c9f8 100644
--- a/release/scripts/modules/rigify/finger_curl.py
+++ b/release/scripts/modules/rigify/finger_curl.py
@@ -35,18 +35,18 @@ def metarig_template():
bone.head[:] = 0.0000, 0.0000, 0.0000
bone.tail[:] = 0.0353, -0.0184, -0.0053
bone.roll = -2.8722
- bone.connected = False
+ bone.use_connect = False
bone = arm.edit_bones.new('finger.02')
bone.head[:] = 0.0353, -0.0184, -0.0053
bone.tail[:] = 0.0702, -0.0364, -0.0146
bone.roll = -2.7099
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger.01']
bone = arm.edit_bones.new('finger.03')
bone.head[:] = 0.0702, -0.0364, -0.0146
bone.tail[:] = 0.0903, -0.0461, -0.0298
bone.roll = -2.1709
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger.02']
bpy.ops.object.mode_set(mode='OBJECT')
@@ -84,8 +84,8 @@ def deform(obj, definitions, base_names, options):
# Create base digit bones: two bones, each half of the base digit.
f1a = copy_bone_simple(obj.data, definitions[0], "DEF-%s.01" % base_names[definitions[0]], parent=True)
f1b = copy_bone_simple(obj.data, definitions[0], "DEF-%s.02" % base_names[definitions[0]], parent=True)
- f1a.connected = False
- f1b.connected = False
+ f1a.use_connect = False
+ f1b.use_connect = False
f1b.parent = f1a
center = f1a.center
f1a.tail = center
@@ -182,7 +182,7 @@ def main(obj, bone_definition, base_names, options):
else:
tot_len = eb[org_f1].length + eb[org_f2].length
control = copy_bone_simple(arm, bone_definition[0], base_name + get_side_name(base_names[bone_definition[0]]), parent=True).name
- eb[control].connected = eb[org_f1].connected
+ eb[control].use_connect = eb[org_f1].use_connect
eb[control].parent = eb[org_f1].parent
eb[control].length = tot_len
@@ -203,12 +203,12 @@ def main(obj, bone_definition, base_names, options):
# Set parents of the bones, interleaving the driver bones with the secondary control bones
if three_digits:
- eb[f3].connected = False
- eb[df3].connected = False
- eb[f2].connected = False
- eb[df2].connected = False
- eb[f1].connected = False
- eb[df1].connected = eb[org_f1].connected
+ eb[f3].use_connect = False
+ eb[df3].use_connect = False
+ eb[f2].use_connect = False
+ eb[df2].use_connect = False
+ eb[f1].use_connect = False
+ eb[df1].use_connect = eb[org_f1].use_connect
if three_digits:
eb[f3].parent = eb[df3]
@@ -223,7 +223,7 @@ def main(obj, bone_definition, base_names, options):
socket = copy_bone_simple(arm, org_f1, "MCH-socket_"+control, parent=True).name
hinge = copy_bone_simple(arm, eb[org_f1].parent.name, "MCH-hinge_"+control).name
- eb[control].connected = False
+ eb[control].use_connect = False
eb[control].parent = eb[hinge]
# Create the deform rig while we're still in edit mode
@@ -362,16 +362,16 @@ def main(obj, bone_definition, base_names, options):
if "ex_layer" in options:
layer = [n==options["ex_layer"] for n in range(0,32)]
else:
- layer = list(arm.bones[bone_definition[0]].layer)
+ layer = list(arm.bones[bone_definition[0]].layers)
#for bone_name in [f1, f2, f3]:
- # arm.bones[bone_name].layer = layer
- arm.bones[f1].layer = layer
- arm.bones[f2].layer = layer
+ # arm.bones[bone_name].layers = layer
+ arm.bones[f1].layers = layer
+ arm.bones[f2].layers = layer
if three_digits:
- arm.bones[f3].layer = layer
+ arm.bones[f3].layers = layer
- layer = list(arm.bones[bone_definition[0]].layer)
- bb[control].layer = layer
+ layer = list(arm.bones[bone_definition[0]].layers)
+ bb[control].layers = layer
# no blending the result of this
return None
diff --git a/release/scripts/modules/rigify/leg_biped.py b/release/scripts/modules/rigify/leg_biped.py
index 53028986873..d2ddba9f549 100644
--- a/release/scripts/modules/rigify/leg_biped.py
+++ b/release/scripts/modules/rigify/leg_biped.py
@@ -36,36 +36,36 @@ def metarig_template():
bone.head[:] = 0.0000, 0.0000, 0.0000
bone.tail[:] = 0.0000, 0.0000, 0.2506
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bone = arm.edit_bones.new('thigh')
bone.head[:] = 0.1253, 0.0000, -0.0000
bone.tail[:] = 0.0752, -0.0251, -0.4260
bone.roll = 0.1171
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hips']
bone = arm.edit_bones.new('shin')
bone.head[:] = 0.0752, -0.0251, -0.4260
bone.tail[:] = 0.0752, 0.0000, -0.8771
bone.roll = 0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['thigh']
bone = arm.edit_bones.new('foot')
bone.head[:] = 0.0752, 0.0000, -0.8771
bone.tail[:] = 0.1013, -0.1481, -0.9773
bone.roll = -0.4662
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['shin']
bone = arm.edit_bones.new('toe')
bone.head[:] = 0.1013, -0.1481, -0.9773
bone.tail[:] = 0.1100, -0.2479, -0.9773
bone.roll = 3.1416
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['foot']
bone = arm.edit_bones.new('heel')
bone.head[:] = 0.0652, 0.0501, -1.0024
bone.tail[:] = 0.0927, -0.1002, -1.0024
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['foot']
bpy.ops.object.mode_set(mode='OBJECT')
@@ -109,11 +109,11 @@ def metarig_definition(obj, orig_bone_name):
if len(children) != 2:
raise RigifyError("expected the foot bone:'%s' to have 2 children" % bone.name)
- if children[0].connected == children[1].connected:
+ if children[0].use_connect == children[1].use_connect:
raise RigifyError("expected one bone to be connected")
toe, heel = children
- if heel.connected:
+ if heel.use_connect:
toe, heel = heel, toe
@@ -154,7 +154,7 @@ def ik(obj, bone_definition, base_names, options):
ik.foot_e = copy_bone_simple(arm, mt.heel, base_foot_name + "_ik" + get_side_name(base_names[mt_chain.foot]))
ik.foot = ik.foot_e.name
ik.foot_e.translate(mt_chain.foot_e.head - ik.foot_e.head)
- ik.foot_e.local_location = False
+ ik.foot_e.use_local_location = False
# foot roll: heel pointing backwards, half length
ik.foot_roll_e = copy_bone_simple(arm, mt.heel, base_foot_name + "_roll" + get_side_name(base_names[mt_chain.foot]))
@@ -180,11 +180,11 @@ def ik(obj, bone_definition, base_names, options):
# rename 'MCH-toe' --> to 'toe_ik' and make the child of ik.foot_roll_01
# ------------------ FK or IK?
ik_chain.rename("toe", get_base_name(base_names[mt_chain.toe]) + "_ik" + get_side_name(base_names[mt_chain.toe]))
- ik_chain.toe_e.connected = False
+ ik_chain.toe_e.use_connect = False
ik_chain.toe_e.parent = ik.foot_roll_01_e
# re-parent ik_chain.foot to the
- ik_chain.foot_e.connected = False
+ ik_chain.foot_e.use_connect = False
ik_chain.foot_e.parent = ik.foot_roll_02_e
@@ -198,7 +198,7 @@ def ik(obj, bone_definition, base_names, options):
ik.knee_target_e.translate(offset)
ik.knee_target_e.length *= 0.5
ik.knee_target_e.parent = ik.foot_e
- ik.knee_target_e.local_location = False
+ ik.knee_target_e.use_local_location = False
# roll the bone to point up... could also point in the same direction as ik.foot_roll
# ik.foot_roll_02_e.matrix * Vector((0.0, 0.0, 1.0)) # ACK!, no rest matrix in editmode
@@ -211,9 +211,9 @@ def ik(obj, bone_definition, base_names, options):
ik_chain.update()
# Set IK dof
- ik_chain.shin_p.ik_dof_x = True
- ik_chain.shin_p.ik_dof_y = False
- ik_chain.shin_p.ik_dof_z = False
+ ik_chain.shin_p.lock_ik_x = False
+ ik_chain.shin_p.lock_ik_y = True
+ ik_chain.shin_p.lock_ik_z = True
# Set rotation modes and axis locks
ik.foot_roll_p.rotation_mode = 'XYZ'
@@ -225,7 +225,7 @@ def ik(obj, bone_definition, base_names, options):
# IK
con = ik_chain.shin_p.constraints.new('IK')
- con.chain_length = 2
+ con.chain_count = 2
con.iterations = 500
con.pole_angle = -pi / 2.0
con.use_tail = True
@@ -256,22 +256,22 @@ def ik(obj, bone_definition, base_names, options):
con.owner_space = 'LOCAL'
if con_l is cons[-1][-1]:
- con.minimum_x = 0.0
- con.maximum_x = 180.0 # XXX -deg
+ con.min_x = 0.0
+ con.max_x = 180.0 # XXX -deg
else:
- con.minimum_x = -180.0 # XXX -deg
- con.maximum_x = 0.0
+ con.min_x = -180.0 # XXX -deg
+ con.max_x = 0.0
# last step setup layers
if "ik_layer" in options:
layer = [n == options["ik_layer"] for n in range(0, 32)]
else:
- layer = list(mt_chain.thigh_b.layer)
+ layer = list(mt_chain.thigh_b.layers)
for attr in ik_chain.attr_names:
- getattr(ik_chain, attr + "_b").layer = layer
+ getattr(ik_chain, attr + "_b").layers = layer
for attr in ik.attr_names:
- getattr(ik, attr + "_b").layer = layer
+ getattr(ik, attr + "_b").layers = layer
bpy.ops.object.mode_set(mode='EDIT')
@@ -312,11 +312,11 @@ def fk(obj, bone_definition, base_names, options):
foot = foot_e.name
foot_e.translate(mt_chain.foot_e.head - foot_e.head)
foot_e.parent = fk_chain.shin_e
- foot_e.connected = fk_chain.foot_e.connected
- fk_chain.foot_e.connected = False
+ foot_e.use_connect = fk_chain.foot_e.use_connect
+ fk_chain.foot_e.use_connect = False
fk_chain.foot_e.parent = foot_e
- fk_chain.thigh_e.connected = False
+ fk_chain.thigh_e.use_connect = False
fk_chain.thigh_e.parent = ex.thigh_hinge_e
bpy.ops.object.mode_set(mode='OBJECT')
@@ -370,12 +370,12 @@ def fk(obj, bone_definition, base_names, options):
if "fk_layer" in options:
layer = [n == options["fk_layer"] for n in range(0, 32)]
else:
- layer = list(mt_chain.thigh_b.layer)
+ layer = list(mt_chain.thigh_b.layers)
for attr in fk_chain.attr_names:
- getattr(fk_chain, attr + "_b").layer = layer
+ getattr(fk_chain, attr + "_b").layers = layer
for attr in ex.attr_names:
- getattr(ex, attr + "_b").layer = layer
- arm.bones[foot].layer = layer
+ getattr(ex, attr + "_b").layers = layer
+ arm.bones[foot].layers = layer
bpy.ops.object.mode_set(mode='EDIT')
@@ -390,8 +390,8 @@ def deform(obj, definitions, base_names, options):
# Create upper leg bones: two bones, each half of the upper leg.
uleg1 = copy_bone_simple(obj.data, definitions[1], "DEF-%s.01" % base_names[definitions[1]], parent=True)
uleg2 = copy_bone_simple(obj.data, definitions[1], "DEF-%s.02" % base_names[definitions[1]], parent=True)
- uleg1.connected = False
- uleg2.connected = False
+ uleg1.use_connect = False
+ uleg2.use_connect = False
uleg2.parent = uleg1
center = uleg1.center
uleg1.tail = center
@@ -400,8 +400,8 @@ def deform(obj, definitions, base_names, options):
# Create lower leg bones: two bones, each half of the lower leg.
lleg1 = copy_bone_simple(obj.data, definitions[2], "DEF-%s.01" % base_names[definitions[2]], parent=True)
lleg2 = copy_bone_simple(obj.data, definitions[2], "DEF-%s.02" % base_names[definitions[2]], parent=True)
- lleg1.connected = False
- lleg2.connected = False
+ lleg1.use_connect = False
+ lleg2.use_connect = False
lleg2.parent = lleg1
center = lleg1.center
lleg1.tail = center
@@ -410,7 +410,7 @@ def deform(obj, definitions, base_names, options):
# Create a bone for the second lower leg deform bone to twist with
twist = copy_bone_simple(obj.data, lleg2.name, "MCH-leg_twist")
twist.length /= 4
- twist.connected = False
+ twist.use_connect = False
twist.parent = obj.data.edit_bones[definitions[3]]
# Create foot bone
diff --git a/release/scripts/modules/rigify/leg_quadruped.py b/release/scripts/modules/rigify/leg_quadruped.py
index 688387bbd53..739a6402c4b 100644
--- a/release/scripts/modules/rigify/leg_quadruped.py
+++ b/release/scripts/modules/rigify/leg_quadruped.py
@@ -37,30 +37,30 @@ def metarig_template():
bone.head[:] = -0.0728, -0.2427, 0.0000
bone.tail[:] = -0.0728, -0.2427, 0.2427
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bone = arm.edit_bones.new('thigh')
bone.head[:] = 0.0000, 0.0000, -0.0000
bone.tail[:] = 0.0813, -0.2109, -0.3374
bone.roll = -0.4656
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['body']
bone = arm.edit_bones.new('shin')
bone.head[:] = 0.0813, -0.2109, -0.3374
bone.tail[:] = 0.0714, -0.0043, -0.5830
bone.roll = -0.2024
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['thigh']
bone = arm.edit_bones.new('foot')
bone.head[:] = 0.0714, -0.0043, -0.5830
bone.tail[:] = 0.0929, -0.0484, -0.7652
bone.roll = -0.3766
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['shin']
bone = arm.edit_bones.new('toe')
bone.head[:] = 0.0929, -0.0484, -0.7652
bone.tail[:] = 0.1146, -0.1244, -0.7652
bone.roll = -0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['foot']
bpy.ops.object.mode_set(mode='OBJECT')
@@ -120,7 +120,7 @@ def ik(obj, bone_definition, base_names, options):
ik_chain = mt_chain.copy(to_fmt="MCH-%s.ik", base_names=base_names)
- ik_chain.thigh_e.connected = False
+ ik_chain.thigh_e.use_connect = False
ik_chain.thigh_e.parent = mt.hips_e
ik_chain.foot_e.parent = None
@@ -128,10 +128,10 @@ def ik(obj, bone_definition, base_names, options):
ik_chain.rename("toe", get_base_name(base_names[bone_definition[4]]) + "_ik" + get_side_name(base_names[bone_definition[4]]))
# keep the foot_ik as the parent
- ik_chain.toe_e.connected = False
+ ik_chain.toe_e.use_connect = False
# Foot uses pose space, not local space, for translation
- ik_chain.foot_e.local_location = False
+ ik_chain.foot_e.use_local_location = False
# must be after disconnecting the toe
ik_chain.foot_e.align_orientation(mt_chain.toe_e)
@@ -141,7 +141,7 @@ def ik(obj, bone_definition, base_names, options):
# knee rotator
knee_rotator = copy_bone_simple(arm, mt_chain.toe, "knee_rotator" + get_side_name(base_names[mt_chain.foot]), parent=True).name
- eb[knee_rotator].connected = False
+ eb[knee_rotator].use_connect = False
eb[knee_rotator].parent = eb[mt.hips]
eb[knee_rotator].head = eb[ik_chain.thigh].head
eb[knee_rotator].tail = eb[knee_rotator].head + eb[mt_chain.toe].vector
@@ -156,7 +156,7 @@ def ik(obj, bone_definition, base_names, options):
# then align it with the foot but reverse direction.
ik.foot_roll_e = copy_bone_simple(arm, mt_chain.toe, get_base_name(base_names[mt_chain.foot]) + "_roll" + get_side_name(base_names[mt_chain.foot]))
ik.foot_roll = ik.foot_roll_e.name
- ik.foot_roll_e.connected = False
+ ik.foot_roll_e.use_connect = False
ik.foot_roll_e.parent = ik_chain.foot_e
ik.foot_roll_e.head -= mt_chain.toe_e.vector.normalize() * mt_chain.foot_e.length
ik.foot_roll_e.tail = ik.foot_roll_e.head - (mt_chain.foot_e.vector.normalize() * mt_chain.toe_e.length)
@@ -175,7 +175,7 @@ def ik(obj, bone_definition, base_names, options):
ik.foot_target_e.parent = ik.foot_roll_01_e
ik.foot_target_e.align_orientation(ik_chain.foot_e)
ik.foot_target_e.length = ik_chain.foot_e.length / 2.0
- ik.foot_target_e.connected = True
+ ik.foot_target_e.use_connect = True
# MCH-foot.02 child of MCH-foot
ik.foot_roll_02_e = copy_bone_simple(arm, mt_chain.foot, "MCH-%s_02" % base_names[mt_chain.foot])
@@ -268,7 +268,7 @@ def ik(obj, bone_definition, base_names, options):
# IK
con = ik_chain.shin_p.constraints.new('IK')
- con.chain_length = 2
+ con.chain_count = 2
con.iterations = 500
con.pole_angle = -90.0 # XXX - in deg!
con.use_tail = True
@@ -289,12 +289,12 @@ def ik(obj, bone_definition, base_names, options):
if "ik_layer" in options:
layer = [n==options["ik_layer"] for n in range(0,32)]
else:
- layer = list(mt_chain.thigh_b.layer)
+ layer = list(mt_chain.thigh_b.layers)
for attr in ik_chain.attr_names:
- obj.data.bones[getattr(ik_chain, attr)].layer = layer
+ obj.data.bones[getattr(ik_chain, attr)].layers = layer
for attr in ik.attr_names:
- obj.data.bones[getattr(ik, attr)].layer = layer
- obj.data.bones[knee_rotator].layer = layer
+ obj.data.bones[getattr(ik, attr)].layers = layer
+ obj.data.bones[knee_rotator].layers = layer
return None, ik_chain.thigh, ik_chain.shin, ik_chain.foot, ik_chain.toe
@@ -325,7 +325,7 @@ def fk(obj, bone_definition, base_names, options):
eb[hinge].length = eb[mt.hips].length / 2
# Make leg child of hinge
- eb[fk_chain.thigh].connected = False
+ eb[fk_chain.thigh].use_connect = False
eb[fk_chain.thigh].parent = eb[hinge]
@@ -396,8 +396,8 @@ def deform(obj, definitions, base_names, options):
# Create upper leg bones: two bones, each half of the upper leg.
uleg1 = copy_bone_simple(obj.data, definitions[1], "DEF-%s.01" % base_names[definitions[1]], parent=True)
uleg2 = copy_bone_simple(obj.data, definitions[1], "DEF-%s.02" % base_names[definitions[1]], parent=True)
- uleg1.connected = False
- uleg2.connected = False
+ uleg1.use_connect = False
+ uleg2.use_connect = False
uleg2.parent = uleg1
center = uleg1.center
uleg1.tail = center
@@ -406,8 +406,8 @@ def deform(obj, definitions, base_names, options):
# Create lower leg bones: two bones, each half of the lower leg.
lleg1 = copy_bone_simple(obj.data, definitions[2], "DEF-%s.01" % base_names[definitions[2]], parent=True)
lleg2 = copy_bone_simple(obj.data, definitions[2], "DEF-%s.02" % base_names[definitions[2]], parent=True)
- lleg1.connected = False
- lleg2.connected = False
+ lleg1.use_connect = False
+ lleg2.use_connect = False
lleg2.parent = lleg1
center = lleg1.center
lleg1.tail = center
@@ -416,7 +416,7 @@ def deform(obj, definitions, base_names, options):
# Create a bone for the second lower leg deform bone to twist with
twist = copy_bone_simple(obj.data, lleg2.name, "MCH-leg_twist")
twist.length /= 4
- twist.connected = False
+ twist.use_connect = False
twist.parent = obj.data.edit_bones[definitions[3]]
# Create foot bone
diff --git a/release/scripts/modules/rigify/mouth.py b/release/scripts/modules/rigify/mouth.py
index d516a48ec95..ce232b91e7b 100644
--- a/release/scripts/modules/rigify/mouth.py
+++ b/release/scripts/modules/rigify/mouth.py
@@ -93,7 +93,7 @@ def metarig_template():
bone.head[:] = 0.0000, 0.0000, 0.0000
bone.tail[:] = 0.0000, 0.0000, 1.0000
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bpy.ops.object.mode_set(mode='OBJECT')
pbone = obj.pose.bones['Bone']
@@ -151,8 +151,8 @@ def deform(obj, definitions, base_names, options):
eb[spread_l_2].tail = eb[definitions[5]].head
eb[spread_l_1].roll = 0
eb[spread_l_2].roll = 0
- eb[spread_l_1].connected = False
- eb[spread_l_2].connected = False
+ eb[spread_l_1].use_connect = False
+ eb[spread_l_2].use_connect = False
eb[spread_l_1].parent = eb[definitions[6]]
eb[spread_l_2].parent = eb[definitions[6]]
@@ -162,8 +162,8 @@ def deform(obj, definitions, base_names, options):
eb[spread_r_2].tail = eb[definitions[3]].head
eb[spread_r_1].roll = 0
eb[spread_r_2].roll = 0
- eb[spread_r_1].connected = False
- eb[spread_r_2].connected = False
+ eb[spread_r_1].use_connect = False
+ eb[spread_r_2].use_connect = False
eb[spread_r_1].parent = eb[definitions[2]]
eb[spread_r_2].parent = eb[definitions[2]]
@@ -171,7 +171,7 @@ def deform(obj, definitions, base_names, options):
# Jaw open bones (for driving corrective shape keys)
jopen1 = copy_bone_simple(obj.data, jaw, "MCH-"+base_names[jaw]+".track1", parent=True).name
- eb[jopen1].connected = False
+ eb[jopen1].use_connect = False
eb[jopen1].head = eb[jaw].tail
eb[jopen1].tail = eb[jopen1].head + Vector((0, 0, eb[jaw].length/4))
@@ -426,7 +426,7 @@ def control(obj, definitions, base_names, options):
# Jaw open tracker
jopent = copy_bone_simple(obj.data, jaw_e.name, "MCH-"+base_names[jaw_e.name]+".track", parent=True).name
- eb[jopent].connected = False
+ eb[jopent].use_connect = False
eb[jopent].tail = jaw_e.tail + Vector((0.0, 0.0, jaw_e.length))
eb[jopent].head = jaw_e.tail
@@ -458,7 +458,7 @@ def control(obj, definitions, base_names, options):
con.target = obj
con.subtarget = jaw
con.head_tail = 1.0
- con.original_length = bb[jopent].length
+ con.rest_length = bb[jopent].length
con.volume = 'NO_VOLUME'
# Head lips to jaw lips
@@ -545,8 +545,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'SCALE_Y'
con.frame_start = 0
con.frame_end = 60
- con.minimum = 0.0
- con.maximum = 1.0
+ con.min = 0.0
+ con.max = 1.0
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -563,8 +563,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'SCALE_Y'
con.frame_start = 0
con.frame_end = 60
- con.minimum = 0.0
- con.maximum = 1.0
+ con.min = 0.0
+ con.max = 1.0
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -581,8 +581,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'SCALE_Y'
con.frame_start = 0
con.frame_end = 60
- con.minimum = 0.0
- con.maximum = 1.0
+ con.min = 0.0
+ con.max = 1.0
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -599,8 +599,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'SCALE_Y'
con.frame_start = 0
con.frame_end = 60
- con.minimum = 0.0
- con.maximum = 1.0
+ con.min = 0.0
+ con.max = 1.0
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -617,8 +617,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'SCALE_Y'
con.frame_start = 0
con.frame_end = 60
- con.minimum = 0.0
- con.maximum = 1.0
+ con.min = 0.0
+ con.max = 1.0
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -635,8 +635,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'SCALE_Y'
con.frame_start = 0
con.frame_end = 60
- con.minimum = 0.0
- con.maximum = 1.0
+ con.min = 0.0
+ con.max = 1.0
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -653,8 +653,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'SCALE_Y'
con.frame_start = 0
con.frame_end = 60
- con.minimum = 0.0
- con.maximum = 1.0
+ con.min = 0.0
+ con.max = 1.0
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -671,8 +671,8 @@ def control(obj, definitions, base_names, options):
con.transform_channel = 'SCALE_Y'
con.frame_start = 0
con.frame_end = 60
- con.minimum = 0.0
- con.maximum = 1.0
+ con.min = 0.0
+ con.max = 1.0
con.target_space = 'LOCAL'
fcurve = con.driver_add("influence")
driver = fcurve.driver
@@ -684,15 +684,15 @@ def control(obj, definitions, base_names, options):
# Set layers
- layer = list(bb[definitions[2]].layer)
- bb[lip1].layer = layer
- bb[lip2].layer = layer
- bb[lip3].layer = layer
- bb[lip4].layer = layer
- bb[lip5].layer = layer
- bb[lip6].layer = layer
- bb[lip7].layer = layer
- bb[lip8].layer = layer
+ layer = list(bb[definitions[2]].layers)
+ bb[lip1].layers = layer
+ bb[lip2].layers = layer
+ bb[lip3].layers = layer
+ bb[lip4].layers = layer
+ bb[lip5].layers = layer
+ bb[lip6].layers = layer
+ bb[lip7].layers = layer
+ bb[lip8].layers = layer
return (None,)
@@ -717,7 +717,7 @@ def make_lip_stretch_bone(obj, name, bone1, bone2, roll_alpha):
# Create the bone, pointing from bone1 to bone2
bone_e = copy_bone_simple(obj.data, bone1, name, parent=True)
- bone_e.connected = False
+ bone_e.use_connect = False
bone_e.tail = eb[bone2].head
bone = bone_e.name
diff --git a/release/scripts/modules/rigify/neck.py b/release/scripts/modules/rigify/neck.py
index 0d2ab25bcc9..56717f0ebb0 100644
--- a/release/scripts/modules/rigify/neck.py
+++ b/release/scripts/modules/rigify/neck.py
@@ -35,42 +35,42 @@ def metarig_template():
#bone.head[:] = 0.0000, -0.0276, -0.1328
#bone.tail[:] = 0.0000, -0.0170, -0.0197
#bone.roll = 0.0000
- #bone.connected = False
+ #bone.use_connect = False
#bone = arm.edit_bones.new('head')
#bone.head[:] = 0.0000, -0.0170, -0.0197
#bone.tail[:] = 0.0000, 0.0726, 0.1354
#bone.roll = 0.0000
- #bone.connected = True
+ #bone.use_connect = True
#bone.parent = arm.edit_bones['body']
#bone = arm.edit_bones.new('neck.01')
#bone.head[:] = 0.0000, -0.0170, -0.0197
#bone.tail[:] = 0.0000, -0.0099, 0.0146
#bone.roll = 0.0000
- #bone.connected = False
+ #bone.use_connect = False
#bone.parent = arm.edit_bones['head']
#bone = arm.edit_bones.new('neck.02')
#bone.head[:] = 0.0000, -0.0099, 0.0146
#bone.tail[:] = 0.0000, -0.0242, 0.0514
#bone.roll = 0.0000
- #bone.connected = True
+ #bone.use_connect = True
#bone.parent = arm.edit_bones['neck.01']
#bone = arm.edit_bones.new('neck.03')
#bone.head[:] = 0.0000, -0.0242, 0.0514
#bone.tail[:] = 0.0000, -0.0417, 0.0868
#bone.roll = 0.0000
- #bone.connected = True
+ #bone.use_connect = True
#bone.parent = arm.edit_bones['neck.02']
#bone = arm.edit_bones.new('neck.04')
#bone.head[:] = 0.0000, -0.0417, 0.0868
#bone.tail[:] = 0.0000, -0.0509, 0.1190
#bone.roll = 0.0000
- #bone.connected = True
+ #bone.use_connect = True
#bone.parent = arm.edit_bones['neck.03']
#bone = arm.edit_bones.new('neck.05')
#bone.head[:] = 0.0000, -0.0509, 0.1190
#bone.tail[:] = 0.0000, -0.0537, 0.1600
#bone.roll = 0.0000
- #bone.connected = True
+ #bone.use_connect = True
#bone.parent = arm.edit_bones['neck.04']
#
#bpy.ops.object.mode_set(mode='OBJECT')
@@ -330,13 +330,13 @@ def main(obj, bone_definition, base_names, options):
if "ex_layer" in options:
layer = [n==options["ex_layer"] for n in range(0,32)]
else:
- layer = list(arm.bones[bone_definition[1]].layer)
+ layer = list(arm.bones[bone_definition[1]].layers)
for bone in neck:
- bb[bone].layer = layer
+ bb[bone].layers = layer
- layer = list(arm.bones[bone_definition[1]].layer)
- bb[neck_ctrl].layer = layer
- bb[head_ctrl].layer = layer
+ layer = list(arm.bones[bone_definition[1]].layers)
+ bb[neck_ctrl].layers = layer
+ bb[head_ctrl].layers = layer
# no blending the result of this
diff --git a/release/scripts/modules/rigify/neck_flex.py b/release/scripts/modules/rigify/neck_flex.py
index 08f963434d1..1ab14e281b9 100644
--- a/release/scripts/modules/rigify/neck_flex.py
+++ b/release/scripts/modules/rigify/neck_flex.py
@@ -36,42 +36,42 @@ def metarig_template():
bone.head[:] = 0.0000, -0.0276, -0.1328
bone.tail[:] = 0.0000, -0.0170, -0.0197
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bone = arm.edit_bones.new('head')
bone.head[:] = 0.0000, -0.0170, -0.0197
bone.tail[:] = 0.0000, 0.0726, 0.1354
bone.roll = 0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['body']
bone = arm.edit_bones.new('neck.01')
bone.head[:] = 0.0000, -0.0170, -0.0197
bone.tail[:] = 0.0000, -0.0099, 0.0146
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['head']
bone = arm.edit_bones.new('neck.02')
bone.head[:] = 0.0000, -0.0099, 0.0146
bone.tail[:] = 0.0000, -0.0242, 0.0514
bone.roll = 0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['neck.01']
bone = arm.edit_bones.new('neck.03')
bone.head[:] = 0.0000, -0.0242, 0.0514
bone.tail[:] = 0.0000, -0.0417, 0.0868
bone.roll = 0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['neck.02']
bone = arm.edit_bones.new('neck.04')
bone.head[:] = 0.0000, -0.0417, 0.0868
bone.tail[:] = 0.0000, -0.0509, 0.1190
bone.roll = 0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['neck.03']
bone = arm.edit_bones.new('neck.05')
bone.head[:] = 0.0000, -0.0509, 0.1190
bone.tail[:] = 0.0000, -0.0537, 0.1600
bone.roll = 0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['neck.04']
bpy.ops.object.mode_set(mode='OBJECT')
@@ -156,7 +156,7 @@ def main(obj, bone_definition, base_names, options):
# Copy the head bone and offset
ex.head_e = copy_bone_simple(arm, mt.head, "MCH-%s" % base_names[mt.head], parent=True)
- ex.head_e.connected = False
+ ex.head_e.use_connect = False
ex.head = ex.head_e.name
# offset
head_length = ex.head_e.length
@@ -165,7 +165,7 @@ def main(obj, bone_definition, base_names, options):
# Yes, use the body bone but call it a head hinge
ex.head_hinge_e = copy_bone_simple(arm, mt.body, "MCH-%s_hinge" % base_names[mt.head], parent=False)
- ex.head_hinge_e.connected = False
+ ex.head_hinge_e.use_connect = False
ex.head_hinge = ex.head_hinge_e.name
ex.head_hinge_e.head.y += head_length / 4.0
ex.head_hinge_e.tail.y += head_length / 4.0
@@ -173,7 +173,7 @@ def main(obj, bone_definition, base_names, options):
# Insert the neck socket, the head copys this loation
ex.neck_socket_e = arm.edit_bones.new("MCH-%s_socked" % neck_chain_basename)
ex.neck_socket = ex.neck_socket_e.name
- ex.neck_socket_e.connected = False
+ ex.neck_socket_e.use_connect = False
ex.neck_socket_e.parent = mt.body_e
ex.neck_socket_e.head = mt.head_e.head
ex.neck_socket_e.tail = mt.head_e.head - Vector((0.0, neck_chain_segment_length / 2.0, 0.0))
@@ -195,9 +195,9 @@ def main(obj, bone_definition, base_names, options):
neck_e_parent.roll = mt.head_e.roll
orig_parent = neck_e.parent
- neck_e.connected = False
+ neck_e.use_connect = False
neck_e.parent = neck_e_parent
- neck_e_parent.connected = False
+ neck_e_parent.use_connect = False
if i == 0:
neck_e_parent.parent = mt.body_e
@@ -334,14 +334,14 @@ def main(obj, bone_definition, base_names, options):
if "ex_layer" in options:
layer = [n == options["ex_layer"] for n in range(0, 32)]
else:
- layer = list(arm.bones[bone_definition[1]].layer)
+ layer = list(arm.bones[bone_definition[1]].layers)
for attr in ex_chain.attr_names:
- getattr(ex_chain, attr + "_b").layer = layer
+ getattr(ex_chain, attr + "_b").layers = layer
for attr in ex.attr_names:
- getattr(ex, attr + "_b").layer = layer
+ getattr(ex, attr + "_b").layers = layer
- layer = list(arm.bones[bone_definition[1]].layer)
- ex.head_ctrl_b.layer = layer
+ layer = list(arm.bones[bone_definition[1]].layers)
+ ex.head_ctrl_b.layers = layer
# no blending the result of this
diff --git a/release/scripts/modules/rigify/palm_curl.py b/release/scripts/modules/rigify/palm_curl.py
index 2bdd28a348a..369d6928e45 100644
--- a/release/scripts/modules/rigify/palm_curl.py
+++ b/release/scripts/modules/rigify/palm_curl.py
@@ -35,42 +35,42 @@ def metarig_template():
bone.head[:] = 0.0004, -0.0629, 0.0000
bone.tail[:] = 0.0021, -0.0209, 0.0000
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bone = arm.edit_bones.new('palm.03')
bone.head[:] = -0.0000, 0.0000, 0.0000
bone.tail[:] = 0.0025, 0.0644, -0.0065
bone.roll = -3.1396
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand']
bone = arm.edit_bones.new('palm.02')
bone.head[:] = 0.0252, -0.0000, 0.0000
bone.tail[:] = 0.0324, 0.0627, -0.0065
bone.roll = -3.1357
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand']
bone = arm.edit_bones.new('palm.01')
bone.head[:] = 0.0504, 0.0000, 0.0000
bone.tail[:] = 0.0703, 0.0508, -0.0065
bone.roll = -3.1190
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand']
bone = arm.edit_bones.new('palm.04')
bone.head[:] = -0.0252, 0.0000, 0.0000
bone.tail[:] = -0.0286, 0.0606, -0.0065
bone.roll = 3.1386
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand']
bone = arm.edit_bones.new('palm.05')
bone.head[:] = -0.0504, 0.0000, 0.0000
bone.tail[:] = -0.0669, 0.0534, -0.0065
bone.roll = 3.1239
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand']
bone = arm.edit_bones.new('thumb')
bone.head[:] = 0.0682, -0.0148, 0.0000
bone.tail[:] = 0.1063, 0.0242, -0.0065
bone.roll = -3.0929
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand']
bpy.ops.object.mode_set(mode='OBJECT')
@@ -263,7 +263,7 @@ def main(obj, bone_definition, base_names, options):
# last step setup layers
- arm.bones[control_name].layer = list(arm.bones[bone_definition[1]].layer)
+ arm.bones[control_name].layers = list(arm.bones[bone_definition[1]].layers)
# no blending the result of this
diff --git a/release/scripts/modules/rigify/shape_key_control.py b/release/scripts/modules/rigify/shape_key_control.py
index ac3987ca7e1..1bfca60255d 100644
--- a/release/scripts/modules/rigify/shape_key_control.py
+++ b/release/scripts/modules/rigify/shape_key_control.py
@@ -74,7 +74,7 @@ def metarig_template():
#bone.head[:] = 0.0000, 0.0000, 0.0000
#bone.tail[:] = 0.0000, 0.0000, 1.0000
#bone.roll = 0.0000
- #bone.connected = False
+ #bone.use_connect = False
#
#bpy.ops.object.mode_set(mode='OBJECT')
#pbone = obj.pose.bones['Bone']
diff --git a/release/scripts/modules/rigify/shape_key_distance.py b/release/scripts/modules/rigify/shape_key_distance.py
index 06dd3d67d4b..7d69517216f 100644
--- a/release/scripts/modules/rigify/shape_key_distance.py
+++ b/release/scripts/modules/rigify/shape_key_distance.py
@@ -71,7 +71,7 @@ def metarig_template():
bone.head[:] = 0.0000, 0.0000, 0.0000
bone.tail[:] = 0.0000, 0.0000, 1.0000
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bpy.ops.object.mode_set(mode='OBJECT')
pbone = obj.pose.bones['Bone']
diff --git a/release/scripts/modules/rigify/shape_key_rotdiff.py b/release/scripts/modules/rigify/shape_key_rotdiff.py
index 7049bcf74bb..dfc3b914a6a 100644
--- a/release/scripts/modules/rigify/shape_key_rotdiff.py
+++ b/release/scripts/modules/rigify/shape_key_rotdiff.py
@@ -71,7 +71,7 @@ def metarig_template():
bone.head[:] = 0.0000, 0.0000, 0.0000
bone.tail[:] = 0.0000, 0.0000, 1.0000
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bpy.ops.object.mode_set(mode='OBJECT')
pbone = obj.pose.bones['Bone']
diff --git a/release/scripts/modules/rigify/spine_pivot_flex.py b/release/scripts/modules/rigify/spine_pivot_flex.py
index d3bab72d9a1..645ee4045cc 100644
--- a/release/scripts/modules/rigify/spine_pivot_flex.py
+++ b/release/scripts/modules/rigify/spine_pivot_flex.py
@@ -36,54 +36,54 @@ def metarig_template():
bone.head[:] = 0.0000, -0.0306, 0.1039
bone.tail[:] = 0.0000, -0.0306, -0.0159
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bone = arm.edit_bones.new('rib_cage')
bone.head[:] = 0.0000, -0.0306, 0.1039
bone.tail[:] = 0.0000, -0.0306, 0.2236
bone.roll = -0.0000
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['pelvis']
bone = arm.edit_bones.new('spine.01')
bone.head[:] = 0.0000, 0.0000, -0.0000
bone.tail[:] = 0.0000, -0.0306, 0.1039
bone.roll = -0.0000
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['rib_cage']
bone = arm.edit_bones.new('spine.02')
bone.head[:] = 0.0000, -0.0306, 0.1039
bone.tail[:] = -0.0000, -0.0398, 0.2045
bone.roll = -0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['spine.01']
bone = arm.edit_bones.new('spine.03')
bone.head[:] = -0.0000, -0.0398, 0.2045
bone.tail[:] = -0.0000, -0.0094, 0.2893
bone.roll = -0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['spine.02']
bone = arm.edit_bones.new('spine.04')
bone.head[:] = -0.0000, -0.0094, 0.2893
bone.tail[:] = -0.0000, 0.0335, 0.3595
bone.roll = -0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['spine.03']
bone = arm.edit_bones.new('spine.05')
bone.head[:] = -0.0000, 0.0335, 0.3595
bone.tail[:] = -0.0000, 0.0555, 0.4327
bone.roll = -0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['spine.04']
bone = arm.edit_bones.new('spine.06')
bone.head[:] = -0.0000, 0.0555, 0.4327
bone.tail[:] = -0.0000, 0.0440, 0.5207
bone.roll = -0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['spine.05']
bone = arm.edit_bones.new('spine.07')
bone.head[:] = -0.0000, 0.0440, 0.5207
bone.tail[:] = -0.0000, 0.0021, 0.5992
bone.roll = -0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['spine.06']
bpy.ops.object.mode_set(mode='OBJECT')
@@ -147,7 +147,7 @@ def deform(obj, definitions, base_names, options):
def main(obj, bone_definition, base_names, options):
- from mathutils import Vector, RotationMatrix
+ from mathutils import Vector, Matrix
from math import radians, pi
arm = obj.data
@@ -172,7 +172,7 @@ def main(obj, bone_definition, base_names, options):
ex.pelvis_copy_e = copy_bone_simple(arm, mt.pelvis, base_names[mt.pelvis]) # no parent
ex.pelvis_copy = ex.pelvis_copy_e.name
- ex.pelvis_copy_e.local_location = False
+ ex.pelvis_copy_e.use_local_location = False
# copy the pelvis, offset to make MCH-spine_rotate and MCH-ribcage_hinge
ex.ribcage_hinge_e = copy_bone_simple(arm, mt.pelvis, "MCH-%s_hinge" % base_names[mt.ribcage])
@@ -182,7 +182,7 @@ def main(obj, bone_definition, base_names, options):
ex.spine_rotate_e = copy_bone_simple(arm, mt.ribcage, "MCH-%s_rotate" % spine_chain_basename)
ex.spine_rotate = ex.spine_rotate_e.name
ex.spine_rotate_e.translate(Vector((0.0, spine_chain_segment_length / 2.0, 0.0)))
- ex.spine_rotate_e.connected = False
+ ex.spine_rotate_e.use_connect = False
ex.spine_rotate_e.parent = ex.pelvis_copy_e
@@ -191,7 +191,7 @@ def main(obj, bone_definition, base_names, options):
ex.ribcage_copy_e = copy_bone_simple(arm, mt.ribcage, base_names[mt.ribcage])
ex.ribcage_copy = ex.ribcage_copy_e.name
- ex.ribcage_copy_e.connected = False
+ ex.ribcage_copy_e.use_connect = False
ex.ribcage_copy_e.parent = ex.ribcage_hinge_e
spine_chain = [child.name for child in spine_chain]
@@ -219,7 +219,7 @@ def main(obj, bone_definition, base_names, options):
ebone = copy_bone_simple(arm, child_name, "MCH-rev_%s" % child_name_orig)
setattr(rv_chain, attr, ebone.name)
- ebone.connected = False
+ ebone.use_connect = False
mt_chain.update()
ex_chain.update()
@@ -230,13 +230,13 @@ def main(obj, bone_definition, base_names, options):
attr = ex_chain.attr_names[i] + "_e"
ebone = getattr(ex_chain, attr)
if i == 0:
- ebone.connected = False
+ ebone.use_connect = False
ebone.parent = ex.pelvis_copy_e
else:
attr_parent = ex_chain.attr_names[i - 1] + "_e"
ebone.parent = getattr(ex_chain, attr_parent)
- # intentional! get the parent from the other paralelle chain member
+ # intentional! get the parent from the other parallel chain member
getattr(rv_chain, attr).parent = ebone
@@ -255,16 +255,16 @@ def main(obj, bone_definition, base_names, options):
spine_e = getattr(ex_chain, ex_chain.attr_names[i] + "_e")
orig_parent = spine_e.parent
- spine_e.connected = False
+ spine_e.use_connect = False
spine_e.parent = spine_e_parent
- spine_e_parent.connected = False
+ spine_e_parent.use_connect = False
spine_e_parent.parent = orig_parent
# Rotate the rev chain 180 about the by the first bones center point
pivot = (rv_chain.spine_01_e.head + rv_chain.spine_01_e.tail) * 0.5
- matrix = RotationMatrix(radians(180), 3, 'X')
+ matrix = Matrix.Rotation(radians(180), 3, 'X')
for i, attr in enumerate(rv_chain.attr_names): # similar to neck
spine_e = getattr(rv_chain, attr + "_e")
# use the first bone as the pivot
@@ -465,17 +465,17 @@ def main(obj, bone_definition, base_names, options):
if "ex_layer" in options:
layer = [n == options["ex_layer"] for n in range(0, 32)]
else:
- layer = list(arm.bones[bone_definition[1]].layer)
+ layer = list(arm.bones[bone_definition[1]].layers)
for attr in ex.attr_names:
- getattr(ex, attr + "_b").layer = layer
+ getattr(ex, attr + "_b").layers = layer
for attr in ex_chain.attr_names:
- getattr(ex_chain, attr + "_b").layer = layer
+ getattr(ex_chain, attr + "_b").layers = layer
for attr in rv_chain.attr_names:
- getattr(rv_chain, attr + "_b").layer = layer
+ getattr(rv_chain, attr + "_b").layers = layer
- layer = list(arm.bones[bone_definition[1]].layer)
- arm.bones[ex.pelvis_copy].layer = layer
- arm.bones[ex.ribcage_copy].layer = layer
+ layer = list(arm.bones[bone_definition[1]].layers)
+ arm.bones[ex.pelvis_copy].layers = layer
+ arm.bones[ex.ribcage_copy].layers = layer
# no support for blending chains
return None
diff --git a/release/scripts/modules/rigify/stretch.py b/release/scripts/modules/rigify/stretch.py
index 1c3d317b4b1..6a498e5aa29 100644
--- a/release/scripts/modules/rigify/stretch.py
+++ b/release/scripts/modules/rigify/stretch.py
@@ -35,7 +35,7 @@ RIG_TYPE = "stretch"
# bone.head[:] = 0.0000, 0.0000, 0.0000
# bone.tail[:] = 0.0000, 0.0000, 1.0000
# bone.roll = 0.0000
-# bone.connected = False
+# bone.use_connect = False
#
# bpy.ops.object.mode_set(mode='OBJECT')
# pbone = obj.pose.bones['Bone']
@@ -84,7 +84,7 @@ def main(obj, bone_definition, base_names, options):
mbone2 = "ORG-" + options["to"]
bone_e = copy_bone_simple(obj.data, mbone1, "DEF-%s" % base_names[bone_definition[0]])
- bone_e.connected = False
+ bone_e.use_connect = False
bone_e.parent = eb[mbone1]
bone_e.tail = eb[mbone2].head
bone = bone_e.name
@@ -100,7 +100,7 @@ def main(obj, bone_definition, base_names, options):
con = pb[bone].constraints.new('STRETCH_TO')
con.target = obj
con.subtarget = mbone2
- con.original_length = bb[bone].length
+ con.rest_length = bb[bone].length
if preserve_volume:
con.volume = 'VOLUME_XZX'
else:
diff --git a/release/scripts/modules/rigify/stretch_twist.py b/release/scripts/modules/rigify/stretch_twist.py
index 66719d80d42..ac64d4369cd 100644
--- a/release/scripts/modules/rigify/stretch_twist.py
+++ b/release/scripts/modules/rigify/stretch_twist.py
@@ -1,3 +1,4 @@
+<<<<<<< .working
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
@@ -150,3 +151,157 @@ def main(obj, bone_definition, base_names, options):
return tuple()
+=======
+# ##### 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 #####
+
+# <pep8 compliant>
+
+import bpy
+from rigify import RigifyError
+from rigify_utils import copy_bone_simple
+
+METARIG_NAMES = tuple()
+RIG_TYPE = "stretch_twist"
+
+# TODO
+#def metarig_template():
+# # generated by rigify.write_meta_rig
+# bpy.ops.object.mode_set(mode='EDIT')
+# obj = bpy.context.active_object
+# arm = obj.data
+# bone = arm.edit_bones.new('Bone')
+# bone.head[:] = 0.0000, 0.0000, 0.0000
+# bone.tail[:] = 0.0000, 0.0000, 1.0000
+# bone.roll = 0.0000
+# bone.use_connect = False
+#
+# bpy.ops.object.mode_set(mode='OBJECT')
+# pbone = obj.pose.bones['Bone']
+# pbone['type'] = 'copy'
+
+bool_map = {0:False, 1:True,
+ 0.0:False, 1.0:True,
+ "false":False, "true":True,
+ "False":False, "True":True,
+ "no":False, "yes":True,
+ "No":False, "Yes":True}
+
+def metarig_definition(obj, orig_bone_name):
+ return (orig_bone_name,)
+
+
+
+
+def main(obj, bone_definition, base_names, options):
+ """ A dual-bone stretchy bone setup. Each half follows the twist of the
+ bone on its side.
+ Deformation only (no controls).
+ """
+ # Verify required parameter
+ if "to" not in options:
+ raise RigifyError("'%s' rig type requires a 'to' parameter (bone: %s)" % (RIG_TYPE, base_names[0]))
+ if type(options["to"]) is not str:
+ raise RigifyError("'%s' rig type 'to' parameter must be a string (bone: %s)" % (RIG_TYPE, base_names[0]))
+ if ("ORG-" + options["to"]) not in obj.data.bones:
+ raise RigifyError("'%s' rig type 'to' parameter must name a bone in the metarig (bone: %s)" % (RIG_TYPE, base_names[0]))
+
+ preserve_volume = None
+ # Check optional parameter
+ if "preserve_volume" in options:
+ try:
+ preserve_volume = bool_map[options["preserve_volume"]]
+ except KeyError:
+ preserve_volume = False
+
+ eb = obj.data.edit_bones
+ bb = obj.data.bones
+ pb = obj.pose.bones
+
+ bpy.ops.object.mode_set(mode='EDIT')
+ arm = obj.data
+
+ mbone1 = bone_definition[0]
+ mbone2 = "ORG-" + options["to"]
+
+ bone_e = copy_bone_simple(obj.data, mbone1, "MCH-%s" % base_names[bone_definition[0]])
+ bone_e.use_connect = False
+ bone_e.parent = None
+ bone_e.head = (eb[mbone1].head + eb[mbone2].head) / 2
+ bone_e.tail = (bone_e.head[0], bone_e.head[1], bone_e.head[2]+0.1)
+ mid_bone = bone_e.name
+
+ bone_e = copy_bone_simple(obj.data, mbone1, "DEF-%s.01" % base_names[bone_definition[0]])
+ bone_e.use_connect = False
+ bone_e.parent = eb[mbone1]
+ bone_e.tail = eb[mid_bone].head
+ bone1 = bone_e.name
+
+ bone_e = copy_bone_simple(obj.data, mbone2, "DEF-%s.02" % base_names[bone_definition[0]])
+ bone_e.use_connect = False
+ bone_e.parent = eb[mbone2]
+ bone_e.tail = eb[mid_bone].head
+ bone2 = bone_e.name
+
+
+
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+ # Constraints
+
+ # Mid bone
+ con = pb[mid_bone].constraints.new('COPY_LOCATION')
+ con.target = obj
+ con.subtarget = mbone1
+
+ con = pb[mid_bone].constraints.new('COPY_LOCATION')
+ con.target = obj
+ con.subtarget = mbone2
+ con.influence = 0.5
+
+ # Bone 1
+ con = pb[bone1].constraints.new('DAMPED_TRACK')
+ con.target = obj
+ con.subtarget = mid_bone
+
+ con = pb[bone1].constraints.new('STRETCH_TO')
+ con.target = obj
+ con.subtarget = mid_bone
+ con.rest_length = bb[bone1].length
+ if preserve_volume:
+ con.volume = 'VOLUME_XZX'
+ else:
+ con.volume = 'NO_VOLUME'
+
+ # Bone 2
+ con = pb[bone2].constraints.new('DAMPED_TRACK')
+ con.target = obj
+ con.subtarget = mid_bone
+
+ con = pb[bone2].constraints.new('STRETCH_TO')
+ con.target = obj
+ con.subtarget = mid_bone
+ con.rest_length = bb[bone2].length
+ if preserve_volume:
+ con.volume = 'VOLUME_XZX'
+ else:
+ con.volume = 'NO_VOLUME'
+
+ return tuple()
+
+>>>>>>> .merge-right.r31523
diff --git a/release/scripts/modules/rigify/tail_control.py b/release/scripts/modules/rigify/tail_control.py
index 47da9778913..50a9bb236da 100644
--- a/release/scripts/modules/rigify/tail_control.py
+++ b/release/scripts/modules/rigify/tail_control.py
@@ -12,7 +12,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
@@ -22,7 +22,7 @@ import bpy
from rigify import RigifyError
from rigify_utils import bone_class_instance, copy_bone_simple
from rna_prop_ui import rna_idprop_ui_prop_get
-from mathutils import Vector, RotationMatrix
+from mathutils import Vector, Matrix
from math import radians, pi
# not used, defined for completeness
@@ -40,7 +40,7 @@ def metarig_template():
#bone.head[:] = 0.0000, -0.0306, 0.1039
#bone.tail[:] = 0.0000, -0.0306, -0.0159
#bone.roll = 0.0000
- #bone.connected = False
+ #bone.use_connect = False
#bpy.ops.object.mode_set(mode='OBJECT')
#pbone = obj.pose.bones['tail.01']
@@ -85,9 +85,9 @@ def main(obj, bone_definitions, base_names, options):
for bone_def in bone_definitions:
bone = copy_bone_simple(arm, bone_def, base_names[bone_def], parent=True).name
if i == 1: # Don't change parent of first tail bone
- eb[bone].connected = False
+ eb[bone].use_connect = False
eb[bone].parent = eb[hinge2]
- eb[bone].local_location = False
+ eb[bone].use_local_location = False
i = 1
bones += [bone]
diff --git a/release/scripts/modules/rigify/tongue.py b/release/scripts/modules/rigify/tongue.py
index b6dfe756b71..fd32f3d0556 100644
--- a/release/scripts/modules/rigify/tongue.py
+++ b/release/scripts/modules/rigify/tongue.py
@@ -37,42 +37,42 @@ def metarig_template():
#bone.head[:] = 0.0000, -0.0276, -0.1328
#bone.tail[:] = 0.0000, -0.0170, -0.0197
#bone.roll = 0.0000
- #bone.connected = False
+ #bone.use_connect = False
#bone = arm.edit_bones.new('head')
#bone.head[:] = 0.0000, -0.0170, -0.0197
#bone.tail[:] = 0.0000, 0.0726, 0.1354
#bone.roll = 0.0000
- #bone.connected = True
+ #bone.use_connect = True
#bone.parent = arm.edit_bones['body']
#bone = arm.edit_bones.new('neck.01')
#bone.head[:] = 0.0000, -0.0170, -0.0197
#bone.tail[:] = 0.0000, -0.0099, 0.0146
#bone.roll = 0.0000
- #bone.connected = False
+ #bone.use_connect = False
#bone.parent = arm.edit_bones['head']
#bone = arm.edit_bones.new('neck.02')
#bone.head[:] = 0.0000, -0.0099, 0.0146
#bone.tail[:] = 0.0000, -0.0242, 0.0514
#bone.roll = 0.0000
- #bone.connected = True
+ #bone.use_connect = True
#bone.parent = arm.edit_bones['neck.01']
#bone = arm.edit_bones.new('neck.03')
#bone.head[:] = 0.0000, -0.0242, 0.0514
#bone.tail[:] = 0.0000, -0.0417, 0.0868
#bone.roll = 0.0000
- #bone.connected = True
+ #bone.use_connect = True
#bone.parent = arm.edit_bones['neck.02']
#bone = arm.edit_bones.new('neck.04')
#bone.head[:] = 0.0000, -0.0417, 0.0868
#bone.tail[:] = 0.0000, -0.0509, 0.1190
#bone.roll = 0.0000
- #bone.connected = True
+ #bone.use_connect = True
#bone.parent = arm.edit_bones['neck.03']
#bone = arm.edit_bones.new('neck.05')
#bone.head[:] = 0.0000, -0.0509, 0.1190
#bone.tail[:] = 0.0000, -0.0537, 0.1600
#bone.roll = 0.0000
- #bone.connected = True
+ #bone.use_connect = True
#bone.parent = arm.edit_bones['neck.04']
#
#bpy.ops.object.mode_set(mode='OBJECT')
@@ -159,7 +159,7 @@ def main(obj, bone_definition, base_names, options):
# Copy the head bone and offset
ex.head_e = copy_bone_simple(arm, mt.head, "MCH-%s" % base_names[mt.head], parent=True)
- ex.head_e.connected = False
+ ex.head_e.use_connect = False
ex.head = ex.head_e.name
# offset
head_length = ex.head_e.length
@@ -168,7 +168,7 @@ def main(obj, bone_definition, base_names, options):
# Yes, use the body bone but call it a head hinge
ex.head_hinge_e = copy_bone_simple(arm, mt.body, "MCH-%s_hinge" % base_names[mt.head], parent=False)
- ex.head_hinge_e.connected = False
+ ex.head_hinge_e.use_connect = False
ex.head_hinge = ex.head_hinge_e.name
ex.head_hinge_e.head.y += head_length / 4.0
ex.head_hinge_e.tail.y += head_length / 4.0
@@ -176,7 +176,7 @@ def main(obj, bone_definition, base_names, options):
# Insert the neck socket, the head copys this loation
ex.neck_socket_e = arm.edit_bones.new("MCH-%s_socked" % neck_chain_basename)
ex.neck_socket = ex.neck_socket_e.name
- ex.neck_socket_e.connected = False
+ ex.neck_socket_e.use_connect = False
ex.neck_socket_e.parent = mt.body_e
ex.neck_socket_e.head = mt.head_e.head
ex.neck_socket_e.tail = mt.head_e.head - Vector((0.0, neck_chain_segment_length / 2.0, 0.0))
@@ -198,9 +198,9 @@ def main(obj, bone_definition, base_names, options):
neck_e_parent.roll = mt.head_e.roll
orig_parent = neck_e.parent
- neck_e.connected = False
+ neck_e.use_connect = False
neck_e.parent = neck_e_parent
- neck_e_parent.connected = False
+ neck_e_parent.use_connect = False
if i == 0:
neck_e_parent.parent = mt.body_e
@@ -346,14 +346,14 @@ def main(obj, bone_definition, base_names, options):
if "ex_layer" in options:
layer = [n==options["ex_layer"] for n in range(0,32)]
else:
- layer = list(arm.bones[bone_definition[1]].layer)
+ layer = list(arm.bones[bone_definition[1]].layers)
for attr in ex_chain.attr_names:
- getattr(ex_chain, attr + "_b").layer = layer
+ getattr(ex_chain, attr + "_b").layers = layer
for attr in ex.attr_names:
- getattr(ex, attr + "_b").layer = layer
+ getattr(ex, attr + "_b").layers = layer
- layer = list(arm.bones[bone_definition[1]].layer)
- ex.head_ctrl_b.layer = layer
+ layer = list(arm.bones[bone_definition[1]].layers)
+ ex.head_ctrl_b.layers = layer
# no blending the result of this
diff --git a/release/scripts/modules/rigify/track_dual.py b/release/scripts/modules/rigify/track_dual.py
index 38c2a86ab32..f9c48a3bfcb 100644
--- a/release/scripts/modules/rigify/track_dual.py
+++ b/release/scripts/modules/rigify/track_dual.py
@@ -35,7 +35,7 @@ RIG_TYPE = "track_dual"
# bone.head[:] = 0.0000, 0.0000, 0.0000
# bone.tail[:] = 0.0000, 0.0000, 1.0000
# bone.roll = 0.0000
-# bone.connected = False
+# bone.use_connect = False
#
# bpy.ops.object.mode_set(mode='OBJECT')
# pbone = obj.pose.bones['Bone']
@@ -76,13 +76,13 @@ def main(obj, bone_definition, base_names, options):
mbone2 = "ORG-" + options["to"]
bone_e = copy_bone_simple(obj.data, mbone1, "DEF-%s.01" % base_names[bone_definition[0]])
- bone_e.connected = False
+ bone_e.use_connect = False
bone_e.parent = eb[mbone1]
bone_e.tail = (eb[mbone1].head + eb[mbone2].head) / 2
bone1 = bone_e.name
bone_e = copy_bone_simple(obj.data, mbone2, "DEF-%s.02" % base_names[bone_definition[0]])
- bone_e.connected = False
+ bone_e.use_connect = False
bone_e.parent = eb[mbone1]
bone_e.tail = (eb[mbone1].head + eb[mbone2].head) / 2
bone2 = bone_e.name
diff --git a/release/scripts/modules/rigify/track_reverse.py b/release/scripts/modules/rigify/track_reverse.py
index 21d38c28920..a65ac0e9416 100644
--- a/release/scripts/modules/rigify/track_reverse.py
+++ b/release/scripts/modules/rigify/track_reverse.py
@@ -35,7 +35,7 @@ RIG_TYPE = "track_reverse"
# bone.head[:] = 0.0000, 0.0000, 0.0000
# bone.tail[:] = 0.0000, 0.0000, 1.0000
# bone.roll = 0.0000
-# bone.connected = False
+# bone.use_connect = False
#
# bpy.ops.object.mode_set(mode='OBJECT')
# pbone = obj.pose.bones['Bone']
@@ -78,7 +78,7 @@ def main(obj, bone_definition, base_names, options):
mbone2 = "ORG-" + options["to"]
bone_e = copy_bone_simple(obj.data, mbone2, "DEF-%s.02" % base_names[bone_definition[0]])
- bone_e.connected = False
+ bone_e.use_connect = False
bone_e.parent = eb[mbone1]
bone_e.tail = eb[mbone1].head
bone = bone_e.name
diff --git a/release/scripts/modules/rigify_utils.py b/release/scripts/modules/rigify_utils.py
index 25ab6bebf48..a270af949da 100644
--- a/release/scripts/modules/rigify_utils.py
+++ b/release/scripts/modules/rigify_utils.py
@@ -67,7 +67,7 @@ def add_stretch_to(obj, from_name, to_name, name):
con = stretch_pbone.constraints.new('STRETCH_TO')
con.target = obj
con.subtarget = to_name
- con.original_length = (head - tail).length
+ con.rest_length = (head - tail).length
con.keep_axis = 'PLANE_X'
con.volume = 'NO_VOLUME'
@@ -81,13 +81,13 @@ def copy_bone_simple(arm, from_bone, name, parent=False):
ebone_new = arm.edit_bones.new(name)
if parent:
- ebone_new.connected = ebone.connected
+ ebone_new.use_connect = ebone.use_connect
ebone_new.parent = ebone.parent
ebone_new.head = ebone.head
ebone_new.tail = ebone.tail
ebone_new.roll = ebone.roll
- ebone_new.layer = list(ebone.layer)
+ ebone_new.layers = list(ebone.layers)
return ebone_new
@@ -276,7 +276,7 @@ def write_meta_rig(obj, func_name="metarig_template"):
code.append(" bone.head[:] = %.4f, %.4f, %.4f" % bone.head.to_tuple(4))
code.append(" bone.tail[:] = %.4f, %.4f, %.4f" % bone.tail.to_tuple(4))
code.append(" bone.roll = %.4f" % bone.roll)
- code.append(" bone.connected = %s" % str(bone.connected))
+ code.append(" bone.use_connect = %s" % str(bone.use_connect))
if bone.parent:
code.append(" bone.parent = arm.edit_bones['%s']" % bone.parent.name)
diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py
index 3fd70fedd8c..0a93121c559 100644
--- a/release/scripts/modules/rna_info.py
+++ b/release/scripts/modules/rna_info.py
@@ -302,6 +302,7 @@ class InfoFunctionRNA:
self.identifier = rna_func.identifier
# self.name = rna_func.name # functions have no name!
self.description = rna_func.description.strip()
+ self.is_classmethod = not rna_func.use_self
self.args = []
self.return_values = ()
@@ -313,7 +314,7 @@ class InfoFunctionRNA:
for rna_prop in rna_func.parameters.values():
prop = GetInfoPropertyRNA(rna_prop, parent_id)
- if rna_prop.use_output:
+ if rna_prop.is_output:
self.return_values.append(prop)
else:
self.args.append(prop)
@@ -594,7 +595,7 @@ def BuildRNAInfo():
op_mods = dir(bpy.ops)
for op_mod_name in sorted(op_mods):
- if op_mod_name.startswith('__') or op_mod_name in ("add", "remove"):
+ if op_mod_name.startswith('__'):
continue
op_mod = getattr(bpy.ops, op_mod_name)
@@ -625,18 +626,28 @@ def BuildRNAInfo():
if __name__ == "__main__":
import rna_info
struct = rna_info.BuildRNAInfo()[0]
- data = ""
+ data = []
for struct_id, v in sorted(struct.items()):
- struct_id_str = "".join(sid for sid in struct_id if struct_id)
- props = [(prop.identifier, prop) for prop in v.properties]
+ struct_id_str = v.identifier # "".join(sid for sid in struct_id if struct_id)
+
+ for base in v.get_bases():
+ struct_id_str = base.identifier + "|" + struct_id_str
+ props = [(prop.identifier, prop) for prop in v.properties]
for prop_id, prop in sorted(props):
- if prop.type == 'boolean':
- continue
- data += "%s.%s -> %s: %s%s %s\n" % (struct_id_str, prop.identifier, prop.identifier, prop.type, ", (read-only)" if prop.is_readonly else "", prop.description)
+ # if prop.type == 'boolean':
+ # continue
+ prop_type = prop.type
+ if prop.array_length > 0:
+ prop_type += "[%d]" % prop.array_length
+
+ data.append("%s.%s -> %s: %s%s %s" % (struct_id_str, prop.identifier, prop.identifier, prop_type, ", (read-only)" if prop.is_readonly else "", prop.description))
+ data.sort()
if bpy.app.background:
- print(data)
+ import sys
+ sys.stderr.write("\n".join(data))
+ sys.stderr.write("\n\nEOF\n")
else:
text = bpy.data.texts.new(name="api.py")
text.from_string(data)
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index 3e8662c275f..63762855737 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -124,7 +124,7 @@ def draw(layout, context, context_member, use_edit=True):
assign_props(prop, val_draw, key)
-class PropertyPanel(bpy.types.Panel):
+class PropertyPanel():
"""
The subclass should have its own poll function
and the variable '_context_path' MUST be set.
@@ -132,133 +132,10 @@ class PropertyPanel(bpy.types.Panel):
bl_label = "Custom Properties"
bl_default_closed = True
+ @classmethod
+ def poll(cls, context):
+ bool(eval("context.%s" % cls._context_path))
+
def draw(self, context):
draw(self.layout, context, self._context_path)
-
-from bpy.props import *
-
-
-rna_path = StringProperty(name="Property Edit",
- description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'})
-
-rna_value = StringProperty(name="Property Value",
- description="Property value edit", maxlen=1024, default="")
-
-rna_property = StringProperty(name="Property Name",
- description="Property name edit", maxlen=1024, default="")
-
-rna_min = FloatProperty(name="Min", default=0.0, precision=3)
-rna_max = FloatProperty(name="Max", default=1.0, precision=3)
-
-
-class WM_OT_properties_edit(bpy.types.Operator):
- '''Internal use (edit a property data_path)'''
- bl_idname = "wm.properties_edit"
- bl_label = "Edit Property"
-
- data_path = rna_path
- property = rna_property
- value = rna_value
- min = rna_min
- max = rna_max
- description = StringProperty(name="Tip", default="")
-
- def execute(self, context):
- data_path = self.properties.data_path
- value = self.properties.value
- prop = self.properties.property
- prop_old = self._last_prop[0]
-
- try:
- value_eval = eval(value)
- except:
- value_eval = value
-
- # First remove
- item = eval("context.%s" % data_path)
-
- rna_idprop_ui_prop_clear(item, prop_old)
- exec_str = "del item['%s']" % prop_old
- # print(exec_str)
- exec(exec_str)
-
-
- # Reassign
- exec_str = "item['%s'] = %s" % (prop, repr(value_eval))
- # print(exec_str)
- exec(exec_str)
- self._last_prop[:] = [prop]
-
- prop_type = type(item[prop])
-
- prop_ui = rna_idprop_ui_prop_get(item, prop)
-
- if prop_type in (float, int):
-
- prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.properties.min)
- prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.properties.max)
-
- prop_ui['description'] = self.properties.description
-
- return {'FINISHED'}
-
- def invoke(self, context, event):
-
- self._last_prop = [self.properties.property]
-
- item = eval("context.%s" % self.properties.data_path)
-
- # setup defaults
- prop_ui = rna_idprop_ui_prop_get(item, self.properties.property, False) # dont create
- if prop_ui:
- self.properties.min = prop_ui.get("min", -1000000000)
- self.properties.max = prop_ui.get("max", 1000000000)
- self.properties.description = prop_ui.get("description", "")
-
- wm = context.manager
- # This crashes, TODO - fix
- #return wm.invoke_props_popup(self, event)
-
- wm.invoke_props_popup(self, event)
- return {'RUNNING_MODAL'}
-
-
-class WM_OT_properties_add(bpy.types.Operator):
- '''Internal use (edit a property data_path)'''
- bl_idname = "wm.properties_add"
- bl_label = "Add Property"
-
- data_path = rna_path
-
- def execute(self, context):
- item = eval("context.%s" % self.properties.data_path)
-
- def unique_name(names):
- prop = 'prop'
- prop_new = prop
- i = 1
- while prop_new in names:
- prop_new = prop + str(i)
- i += 1
-
- return prop_new
-
- property = unique_name(item.keys())
-
- item[property] = 1.0
- return {'FINISHED'}
-
-
-class WM_OT_properties_remove(bpy.types.Operator):
- '''Internal use (edit a property data_path)'''
- bl_idname = "wm.properties_remove"
- bl_label = "Remove Property"
-
- data_path = rna_path
- property = rna_property
-
- def execute(self, context):
- item = eval("context.%s" % self.properties.data_path)
- del item[self.properties.property]
- return {'FINISHED'}
diff --git a/release/scripts/op/add_armature_human.py b/release/scripts/op/add_armature_human.py
index 164bbfb100b..e0558e84315 100644
--- a/release/scripts/op/add_armature_human.py
+++ b/release/scripts/op/add_armature_human.py
@@ -33,426 +33,426 @@ def metarig_template():
bone.head[:] = -0.0000, -0.0145, 1.1263
bone.tail[:] = -0.0000, -0.0145, 0.9563
bone.roll = 3.1416
- bone.connected = False
+ bone.use_connect = False
bone = arm.edit_bones.new('torso')
bone.head[:] = -0.0000, -0.0145, 1.1263
bone.tail[:] = -0.0000, -0.0145, 1.2863
bone.roll = 3.1416
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['pelvis']
bone = arm.edit_bones.new('spine.01')
bone.head[:] = 0.0000, 0.0394, 0.9688
bone.tail[:] = -0.0000, -0.0145, 1.1263
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['torso']
bone = arm.edit_bones.new('spine.02')
bone.head[:] = -0.0000, -0.0145, 1.1263
bone.tail[:] = -0.0000, -0.0213, 1.2884
bone.roll = -0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['spine.01']
bone = arm.edit_bones.new('thigh.L')
bone.head[:] = 0.0933, -0.0421, 1.0434
bone.tail[:] = 0.0933, -0.0516, 0.5848
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['spine.01']
bone = arm.edit_bones.new('thigh.R')
bone.head[:] = -0.0933, -0.0421, 1.0434
bone.tail[:] = -0.0933, -0.0516, 0.5848
bone.roll = -0.0000
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['spine.01']
bone = arm.edit_bones.new('spine.03')
bone.head[:] = -0.0000, -0.0213, 1.2884
bone.tail[:] = -0.0000, 0.0160, 1.3705
bone.roll = -0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['spine.02']
bone = arm.edit_bones.new('shin.L')
bone.head[:] = 0.0933, -0.0516, 0.5848
bone.tail[:] = 0.0915, 0.0100, 0.1374
bone.roll = 0.0034
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['thigh.L']
bone = arm.edit_bones.new('shin.R')
bone.head[:] = -0.0933, -0.0516, 0.5848
bone.tail[:] = -0.0915, 0.0100, 0.1374
bone.roll = -0.0034
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['thigh.R']
bone = arm.edit_bones.new('spine.04')
bone.head[:] = -0.0000, 0.0160, 1.3705
bone.tail[:] = -0.0000, 0.0590, 1.4497
bone.roll = -0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['spine.03']
bone = arm.edit_bones.new('foot.L')
bone.head[:] = 0.0915, 0.0100, 0.1374
bone.tail[:] = 0.1033, -0.0968, 0.0510
bone.roll = 2.8964
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['shin.L']
bone = arm.edit_bones.new('foot.R')
bone.head[:] = -0.0915, 0.0100, 0.1374
bone.tail[:] = -0.1033, -0.0968, 0.0510
bone.roll = -2.8793
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['shin.R']
bone = arm.edit_bones.new('neck_base')
bone.head[:] = -0.0000, 0.0590, 1.4497
bone.tail[:] = -0.0000, 0.0401, 1.5389
bone.roll = -0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['spine.04']
bone = arm.edit_bones.new('toe.L')
bone.head[:] = 0.1033, -0.0968, 0.0510
bone.tail[:] = 0.1136, -0.1848, 0.0510
bone.roll = 0.0001
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['foot.L']
bone = arm.edit_bones.new('heel.L')
bone.head[:] = 0.0809, 0.0969, -0.0000
bone.tail[:] = 0.1020, -0.0846, -0.0000
bone.roll = -0.0001
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['foot.L']
bone = arm.edit_bones.new('toe.R')
bone.head[:] = -0.1033, -0.0968, 0.0510
bone.tail[:] = -0.1136, -0.1848, 0.0510
bone.roll = -0.0002
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['foot.R']
bone = arm.edit_bones.new('heel.R')
bone.head[:] = -0.0809, 0.0969, -0.0000
bone.tail[:] = -0.1020, -0.0846, -0.0000
bone.roll = -0.0000
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['foot.R']
bone = arm.edit_bones.new('head')
bone.head[:] = -0.0000, 0.0401, 1.5389
bone.tail[:] = -0.0000, 0.0401, 1.5979
bone.roll = 3.1416
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['neck_base']
bone = arm.edit_bones.new('DLT-shoulder.L')
bone.head[:] = 0.0141, -0.0346, 1.4991
bone.tail[:] = 0.1226, 0.0054, 1.4991
bone.roll = 0.0005
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['neck_base']
bone = arm.edit_bones.new('DLT-shoulder.R')
bone.head[:] = -0.0141, -0.0346, 1.4991
bone.tail[:] = -0.1226, 0.0054, 1.4991
bone.roll = -0.0005
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['neck_base']
bone = arm.edit_bones.new('neck.01')
bone.head[:] = -0.0000, 0.0401, 1.5389
bone.tail[:] = -0.0000, 0.0176, 1.5916
bone.roll = 0.0000
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['head']
bone = arm.edit_bones.new('shoulder.L')
bone.head[:] = 0.0141, -0.0346, 1.4991
bone.tail[:] = 0.1226, 0.0216, 1.5270
bone.roll = -0.1225
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['DLT-shoulder.L']
bone = arm.edit_bones.new('shoulder.R')
bone.head[:] = -0.0141, -0.0346, 1.4991
bone.tail[:] = -0.1226, 0.0216, 1.5270
bone.roll = 0.0849
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['DLT-shoulder.R']
bone = arm.edit_bones.new('neck.02')
bone.head[:] = -0.0000, 0.0176, 1.5916
bone.tail[:] = -0.0000, 0.0001, 1.6499
bone.roll = 0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['neck.01']
bone = arm.edit_bones.new('DLT-upper_arm.L')
bone.head[:] = 0.1482, 0.0483, 1.4943
bone.tail[:] = 0.2586, 0.1057, 1.5124
bone.roll = 1.4969
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['shoulder.L']
bone = arm.edit_bones.new('DLT-upper_arm.R')
bone.head[:] = -0.1482, 0.0483, 1.4943
bone.tail[:] = -0.2586, 0.1057, 1.5124
bone.roll = -1.4482
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['shoulder.R']
bone = arm.edit_bones.new('neck.03')
bone.head[:] = -0.0000, 0.0001, 1.6499
bone.tail[:] = -0.0000, 0.0001, 1.8522
bone.roll = 0.0000
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['neck.02']
bone = arm.edit_bones.new('upper_arm.L')
bone.head[:] = 0.1482, 0.0483, 1.4943
bone.tail[:] = 0.3929, 0.0522, 1.4801
bone.roll = 1.6281
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['DLT-upper_arm.L']
bone = arm.edit_bones.new('upper_arm.R')
bone.head[:] = -0.1482, 0.0483, 1.4943
bone.tail[:] = -0.3929, 0.0522, 1.4801
bone.roll = -1.6281
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['DLT-upper_arm.R']
bone = arm.edit_bones.new('forearm.L')
bone.head[:] = 0.3929, 0.0522, 1.4801
bone.tail[:] = 0.6198, 0.0364, 1.4906
bone.roll = 1.5240
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['upper_arm.L']
bone = arm.edit_bones.new('forearm.R')
bone.head[:] = -0.3929, 0.0522, 1.4801
bone.tail[:] = -0.6198, 0.0364, 1.4906
bone.roll = -1.5219
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['upper_arm.R']
bone = arm.edit_bones.new('hand.L')
bone.head[:] = 0.6198, 0.0364, 1.4906
bone.tail[:] = 0.6592, 0.0364, 1.4853
bone.roll = -3.0065
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['forearm.L']
bone = arm.edit_bones.new('hand.R')
bone.head[:] = -0.6198, 0.0364, 1.4906
bone.tail[:] = -0.6592, 0.0364, 1.4853
bone.roll = 3.0065
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['forearm.R']
bone = arm.edit_bones.new('palm.04.L')
bone.head[:] = 0.6514, 0.0658, 1.4906
bone.tail[:] = 0.7287, 0.0810, 1.4747
bone.roll = -3.0715
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand.L']
bone = arm.edit_bones.new('palm.03.L')
bone.head[:] = 0.6533, 0.0481, 1.4943
bone.tail[:] = 0.7386, 0.0553, 1.4781
bone.roll = -3.0290
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand.L']
bone = arm.edit_bones.new('palm.02.L')
bone.head[:] = 0.6539, 0.0305, 1.4967
bone.tail[:] = 0.7420, 0.0250, 1.4835
bone.roll = -3.0669
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand.L']
bone = arm.edit_bones.new('palm.01.L')
bone.head[:] = 0.6514, 0.0116, 1.4961
bone.tail[:] = 0.7361, -0.0074, 1.4823
bone.roll = -2.9422
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand.L']
bone = arm.edit_bones.new('thumb.01.L')
bone.head[:] = 0.6380, -0.0005, 1.4848
bone.tail[:] = 0.6757, -0.0408, 1.4538
bone.roll = -0.7041
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand.L']
bone = arm.edit_bones.new('palm.04.R')
bone.head[:] = -0.6514, 0.0658, 1.4906
bone.tail[:] = -0.7287, 0.0810, 1.4747
bone.roll = 3.0715
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand.R']
bone = arm.edit_bones.new('palm.03.R')
bone.head[:] = -0.6533, 0.0481, 1.4943
bone.tail[:] = -0.7386, 0.0553, 1.4781
bone.roll = 3.0290
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand.R']
bone = arm.edit_bones.new('palm.02.R')
bone.head[:] = -0.6539, 0.0305, 1.4967
bone.tail[:] = -0.7420, 0.0250, 1.4835
bone.roll = 3.0669
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand.R']
bone = arm.edit_bones.new('thumb.01.R')
bone.head[:] = -0.6380, -0.0005, 1.4848
bone.tail[:] = -0.6757, -0.0408, 1.4538
bone.roll = 0.7041
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand.R']
bone = arm.edit_bones.new('palm.01.R')
bone.head[:] = -0.6514, 0.0116, 1.4961
bone.tail[:] = -0.7361, -0.0074, 1.4823
bone.roll = 2.9332
- bone.connected = False
+ bone.use_connect = False
bone.parent = arm.edit_bones['hand.R']
bone = arm.edit_bones.new('finger_pinky.01.L')
bone.head[:] = 0.7287, 0.0810, 1.4747
bone.tail[:] = 0.7698, 0.0947, 1.4635
bone.roll = -3.0949
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['palm.04.L']
bone = arm.edit_bones.new('finger_ring.01.L')
bone.head[:] = 0.7386, 0.0553, 1.4781
bone.tail[:] = 0.7890, 0.0615, 1.4667
bone.roll = -3.0081
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['palm.03.L']
bone = arm.edit_bones.new('finger_middle.01.L')
bone.head[:] = 0.7420, 0.0250, 1.4835
bone.tail[:] = 0.7975, 0.0221, 1.4712
bone.roll = -2.9982
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['palm.02.L']
bone = arm.edit_bones.new('finger_index.01.L')
bone.head[:] = 0.7361, -0.0074, 1.4823
bone.tail[:] = 0.7843, -0.0204, 1.4718
bone.roll = -3.0021
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['palm.01.L']
bone = arm.edit_bones.new('thumb.02.L')
bone.head[:] = 0.6757, -0.0408, 1.4538
bone.tail[:] = 0.6958, -0.0568, 1.4376
bone.roll = -0.6963
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['thumb.01.L']
bone = arm.edit_bones.new('finger_pinky.01.R')
bone.head[:] = -0.7287, 0.0810, 1.4747
bone.tail[:] = -0.7698, 0.0947, 1.4635
bone.roll = 3.0949
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['palm.04.R']
bone = arm.edit_bones.new('finger_ring.01.R')
bone.head[:] = -0.7386, 0.0553, 1.4781
bone.tail[:] = -0.7890, 0.0615, 1.4667
bone.roll = 2.9892
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['palm.03.R']
bone = arm.edit_bones.new('finger_middle.01.R')
bone.head[:] = -0.7420, 0.0250, 1.4835
bone.tail[:] = -0.7975, 0.0221, 1.4712
bone.roll = 2.9816
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['palm.02.R']
bone = arm.edit_bones.new('thumb.02.R')
bone.head[:] = -0.6757, -0.0408, 1.4538
bone.tail[:] = -0.6958, -0.0568, 1.4376
bone.roll = 0.6963
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['thumb.01.R']
bone = arm.edit_bones.new('finger_index.01.R')
bone.head[:] = -0.7361, -0.0074, 1.4823
bone.tail[:] = -0.7843, -0.0204, 1.4718
bone.roll = 2.9498
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['palm.01.R']
bone = arm.edit_bones.new('finger_pinky.02.L')
bone.head[:] = 0.7698, 0.0947, 1.4635
bone.tail[:] = 0.7910, 0.1018, 1.4577
bone.roll = -3.0949
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_pinky.01.L']
bone = arm.edit_bones.new('finger_ring.02.L')
bone.head[:] = 0.7890, 0.0615, 1.4667
bone.tail[:] = 0.8177, 0.0650, 1.4600
bone.roll = -3.0006
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_ring.01.L']
bone = arm.edit_bones.new('finger_middle.02.L')
bone.head[:] = 0.7975, 0.0221, 1.4712
bone.tail[:] = 0.8289, 0.0206, 1.4643
bone.roll = -2.9995
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_middle.01.L']
bone = arm.edit_bones.new('finger_index.02.L')
bone.head[:] = 0.7843, -0.0204, 1.4718
bone.tail[:] = 0.8117, -0.0275, 1.4660
bone.roll = -3.0064
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_index.01.L']
bone = arm.edit_bones.new('thumb.03.L')
bone.head[:] = 0.6958, -0.0568, 1.4376
bone.tail[:] = 0.7196, -0.0671, 1.4210
bone.roll = -0.8072
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['thumb.02.L']
bone = arm.edit_bones.new('finger_pinky.02.R')
bone.head[:] = -0.7698, 0.0947, 1.4635
bone.tail[:] = -0.7910, 0.1018, 1.4577
bone.roll = 3.0949
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_pinky.01.R']
bone = arm.edit_bones.new('finger_ring.02.R')
bone.head[:] = -0.7890, 0.0615, 1.4667
bone.tail[:] = -0.8177, 0.0650, 1.4600
bone.roll = 3.0341
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_ring.01.R']
bone = arm.edit_bones.new('finger_middle.02.R')
bone.head[:] = -0.7975, 0.0221, 1.4712
bone.tail[:] = -0.8289, 0.0206, 1.4643
bone.roll = 3.0291
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_middle.01.R']
bone = arm.edit_bones.new('thumb.03.R')
bone.head[:] = -0.6958, -0.0568, 1.4376
bone.tail[:] = -0.7196, -0.0671, 1.4210
bone.roll = 0.8072
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['thumb.02.R']
bone = arm.edit_bones.new('finger_index.02.R')
bone.head[:] = -0.7843, -0.0204, 1.4718
bone.tail[:] = -0.8117, -0.0275, 1.4660
bone.roll = 3.0705
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_index.01.R']
bone = arm.edit_bones.new('finger_pinky.03.L')
bone.head[:] = 0.7910, 0.1018, 1.4577
bone.tail[:] = 0.8109, 0.1085, 1.4523
bone.roll = -3.0949
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_pinky.02.L']
bone = arm.edit_bones.new('finger_ring.03.L')
bone.head[:] = 0.8177, 0.0650, 1.4600
bone.tail[:] = 0.8396, 0.0677, 1.4544
bone.roll = -2.9819
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_ring.02.L']
bone = arm.edit_bones.new('finger_middle.03.L')
bone.head[:] = 0.8289, 0.0206, 1.4643
bone.tail[:] = 0.8534, 0.0193, 1.4589
bone.roll = -3.0004
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_middle.02.L']
bone = arm.edit_bones.new('finger_index.03.L')
bone.head[:] = 0.8117, -0.0275, 1.4660
bone.tail[:] = 0.8331, -0.0333, 1.4615
bone.roll = -3.0103
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_index.02.L']
bone = arm.edit_bones.new('finger_pinky.03.R')
bone.head[:] = -0.7910, 0.1018, 1.4577
bone.tail[:] = -0.8109, 0.1085, 1.4523
bone.roll = 3.0949
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_pinky.02.R']
bone = arm.edit_bones.new('finger_ring.03.R')
bone.head[:] = -0.8177, 0.0650, 1.4600
bone.tail[:] = -0.8396, 0.0677, 1.4544
bone.roll = 2.9819
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_ring.02.R']
bone = arm.edit_bones.new('finger_middle.03.R')
bone.head[:] = -0.8289, 0.0206, 1.4643
bone.tail[:] = -0.8534, 0.0193, 1.4589
bone.roll = 3.0004
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_middle.02.R']
bone = arm.edit_bones.new('finger_index.03.R')
bone.head[:] = -0.8117, -0.0275, 1.4660
bone.tail[:] = -0.8331, -0.0333, 1.4615
bone.roll = 2.9917
- bone.connected = True
+ bone.use_connect = True
bone.parent = arm.edit_bones['finger_index.02.R']
bpy.ops.object.mode_set(mode='OBJECT')
@@ -487,11 +487,11 @@ def metarig_template():
pbone = obj.pose.bones['shoulder.L']
pbone['type'] = 'copy'
pbone = obj.pose.bones['shoulder.L']
- pbone['copy.layer'] = 1
+ pbone['copy.layers'] = 1
pbone = obj.pose.bones['shoulder.R']
pbone['type'] = 'copy'
pbone = obj.pose.bones['shoulder.R']
- pbone['copy.layer'] = 1
+ pbone['copy.layers'] = 1
pbone = obj.pose.bones['DLT-upper_arm.L']
pbone['type'] = 'delta'
pbone = obj.pose.bones['DLT-upper_arm.R']
@@ -515,7 +515,7 @@ def metarig_template():
pbone = obj.pose.bones['palm.01.L']
pbone['type'] = 'palm_curl'
pbone = obj.pose.bones['palm.01.L']
- pbone['palm_curl.layer'] = 5
+ pbone['palm_curl.layers'] = 5
pbone = obj.pose.bones['thumb.01.L']
pbone['type'] = 'finger_curl'
pbone = obj.pose.bones['thumb.01.L']
@@ -531,7 +531,7 @@ def metarig_template():
pbone = obj.pose.bones['palm.01.R']
pbone['type'] = 'palm_curl'
pbone = obj.pose.bones['palm.01.R']
- pbone['palm_curl.layer'] = 5
+ pbone['palm_curl.layers'] = 5
pbone = obj.pose.bones['finger_pinky.01.L']
pbone['type'] = 'finger_curl'
pbone = obj.pose.bones['finger_pinky.01.L']
@@ -606,12 +606,10 @@ menu_func = (lambda self, context: self.layout.operator(AddHuman.bl_idname,
def register():
- bpy.types.register(AddHuman)
bpy.types.INFO_MT_armature_add.append(menu_func)
def unregister():
- bpy.types.unregister(AddHuman)
bpy.types.INFO_MT_armature_add.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/op/add_mesh_torus.py b/release/scripts/op/add_mesh_torus.py
index 16bf4e1c92c..e19f2b4e18c 100644
--- a/release/scripts/op/add_mesh_torus.py
+++ b/release/scripts/op/add_mesh_torus.py
@@ -122,8 +122,8 @@ class AddTorus(bpy.types.Operator):
mesh = bpy.data.meshes.new("Torus")
mesh.add_geometry(int(len(verts_loc) / 3), 0, int(len(faces) / 4))
- mesh.verts.foreach_set("co", verts_loc)
- mesh.faces.foreach_set("verts_raw", faces)
+ mesh.vertices.foreach_set("co", verts_loc)
+ mesh.faces.foreach_set("vertices_raw", faces)
mesh.update()
import add_object_utils
@@ -137,12 +137,10 @@ def menu_func(self, context):
def register():
- bpy.types.register(AddTorus)
bpy.types.INFO_MT_mesh_add.append(menu_func)
def unregister():
- bpy.types.unregister(AddTorus)
bpy.types.INFO_MT_mesh_add.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/op/fcurve_euler_filter.py b/release/scripts/op/fcurve_euler_filter.py
index bba4576ef73..a2730e16843 100644
--- a/release/scripts/op/fcurve_euler_filter.py
+++ b/release/scripts/op/fcurve_euler_filter.py
@@ -7,7 +7,7 @@ def main(context):
keys = []
for k in fcv.keyframe_points:
- keys.append([k.handle1.copy(), k.co.copy(), k.handle2.copy()])
+ keys.append([k.handle_left.copy(), k.co.copy(), k.handle_right.copy()])
print(keys)
for i in range(len(keys)):
@@ -34,13 +34,13 @@ def main(context):
for i in range(len(keys)):
for x in range(2):
- fcv.keyframe_points[i].handle1[x] = keys[i][0][x]
+ fcv.keyframe_points[i].handle_left[x] = keys[i][0][x]
fcv.keyframe_points[i].co[x] = keys[i][1][x]
- fcv.keyframe_points[i].handle2[x] = keys[i][2][x]
+ fcv.keyframe_points[i].handle_right[x] = keys[i][2][x]
flist = bpy.context.active_object.animation_data.action.fcurves
for f in flist:
- if f.selected and f.data_path.endswith("rotation_euler"):
+ if f.select and f.data_path.endswith("rotation_euler"):
cleanupEulCurve(f)
class DiscontFilterOp(bpy.types.Operator):
@@ -48,7 +48,8 @@ class DiscontFilterOp(bpy.types.Operator):
bl_idname = "graph.euler_filter"
bl_label = "Filter out discontinuities in the active fcurves"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.active_object != None
def execute(self, context):
@@ -56,10 +57,10 @@ class DiscontFilterOp(bpy.types.Operator):
return {'FINISHED'}
def register():
- bpy.types.register(DiscontFilterOp)
+ pass
def unregister():
- bpy.types.unregister(DiscontFilterOp)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py
index be583012d7a..c8160ded9a4 100644
--- a/release/scripts/op/image.py
+++ b/release/scripts/op/image.py
@@ -56,13 +56,15 @@ class EditExternally(bpy.types.Operator):
return image_editor
def execute(self, context):
+ import os
import subprocess
- filepath = self.properties.filepath
- image_editor = self._editor_guess(context)
+ filepath = bpy.path.abspath(self.properties.filepath)
+
+ if not os.path.exists(filepath):
+ self.report('ERROR', "Image path '%s' not found." % filepath)
+ return {'CANCELLED'}
- cmd = []
- cmd.extend(image_editor)
- cmd.append(bpy.utils.expandpath(filepath))
+ cmd = self._editor_guess(context) + [filepath]
subprocess.Popen(cmd)
@@ -90,8 +92,8 @@ class SaveDirty(bpy.types.Operator):
def execute(self, context):
unique_paths = set()
for image in bpy.data.images:
- if image.dirty:
- filepath = bpy.utils.expandpath(image.filepath)
+ if image.is_dirty:
+ filepath = bpy.path.abspath(image.filepath)
if "\\" not in filepath and "/" not in filepath:
self.report({'WARNING'}, "Invalid path: " + filepath)
elif filepath in unique_paths:
@@ -133,7 +135,7 @@ class ProjectEdit(bpy.types.Operator):
filepath = os.path.basename(bpy.data.filepath)
filepath = os.path.splitext(filepath)[0]
- # filepath = bpy.utils.clean_name(filepath) # fixes <memory> rubbish, needs checking
+ # filepath = bpy.path.clean_name(filepath) # fixes <memory> rubbish, needs checking
if filepath.startswith(".") or filepath == "":
# TODO, have a way to check if the file is saved, assume .B25.blend
@@ -145,12 +147,12 @@ class ProjectEdit(bpy.types.Operator):
obj = context.object
if obj:
- filepath += "_" + bpy.utils.clean_name(obj.name)
+ filepath += "_" + bpy.path.clean_name(obj.name)
filepath_final = filepath + "." + EXT
i = 0
- while os.path.exists(bpy.utils.expandpath(filepath_final)):
+ while os.path.exists(bpy.path.abspath(filepath_final)):
filepath_final = filepath + ("%.3d.%s" % (i, EXT))
i += 1
@@ -186,23 +188,12 @@ class ProjectApply(bpy.types.Operator):
return {'FINISHED'}
-classes = [
- EditExternally,
- SaveDirty,
- ProjectEdit,
- ProjectApply]
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
-
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/op/mesh.py b/release/scripts/op/mesh.py
index 78ca9a18cdc..9e684cea9c2 100644
--- a/release/scripts/op/mesh.py
+++ b/release/scripts/op/mesh.py
@@ -28,7 +28,8 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
bl_label = "Select Interior Faces"
bl_options = {'REGISTER', 'UNDO'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.active_object
return (ob and ob.type == 'MESH')
@@ -54,9 +55,9 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
for index, face in enumerate(face_list):
if(test_interior(index)):
- face.selected = True
+ face.select = True
else:
- face.selected = False
+ face.select = False
if is_editmode:
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
@@ -69,7 +70,8 @@ class MeshMirrorUV(bpy.types.Operator):
bl_label = "Copy Mirrored UV coords"
bl_options = {'REGISTER', 'UNDO'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.active_object
return (ob and ob.type == 'MESH')
@@ -89,7 +91,7 @@ class MeshMirrorUV(bpy.types.Operator):
mirror_gt = {}
mirror_lt = {}
- vcos = [v.co.to_tuple(5) for v in mesh.verts]
+ vcos = [v.co.to_tuple(5) for v in mesh.vertices]
for i, co in enumerate(vcos):
if co[0] > 0.0:
@@ -100,7 +102,7 @@ class MeshMirrorUV(bpy.types.Operator):
mirror_gt[co] = i
mirror_lt[co] = i
- #for i, v in enumerate(mesh.verts):
+ #for i, v in enumerate(mesh.vertices):
vmap = {}
for mirror_a, mirror_b in (mirror_gt, mirror_lt), (mirror_lt, mirror_gt):
for co, i in mirror_a.items():
@@ -122,20 +124,20 @@ class MeshMirrorUV(bpy.types.Operator):
# as a list
faces = mesh.faces[:]
- fuvsel = [(False not in uv.uv_selected) for uv in active_uv_layer]
+ fuvsel = [(False not in uv.select_uv) for uv in active_uv_layer]
fcents = [f.center for f in faces]
# find mirror faces
mirror_fm = {}
for i, f in enumerate(faces):
- verts = f.verts[:]
+ verts = f.vertices[:]
verts.sort()
verts = tuple(verts)
mirror_fm[verts] = i
fmap = {}
for i, f in enumerate(faces):
- verts = [vmap.get(j) for j in f.verts]
+ verts = [vmap.get(j) for j in f.vertices]
if None not in verts:
verts.sort()
j = mirror_fm.get(tuple(verts))
@@ -157,8 +159,8 @@ class MeshMirrorUV(bpy.types.Operator):
uv2 = fuvs_cpy[j]
# get the correct rotation
- v1 = faces[j].verts[:]
- v2 = [vmap[k] for k in faces[i].verts[:]]
+ v1 = faces[j].vertices[:]
+ v2 = [vmap[k] for k in faces[i].vertices[:]]
for k in range(len(uv1)):
@@ -172,22 +174,12 @@ class MeshMirrorUV(bpy.types.Operator):
return {'FINISHED'}
-# Register the operator
-classes = [
- MeshSelectInteriorFaces,
- MeshMirrorUV]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/op/nla.py b/release/scripts/op/nla.py
index d0c53758ba9..44bd5d91e32 100644
--- a/release/scripts/op/nla.py
+++ b/release/scripts/op/nla.py
@@ -100,7 +100,7 @@ def bake(frame_start, frame_end, step=1, only_selected=False):
pose_items = pose.bones.items()
for name, pbone in pose_items:
- if only_selected and not pbone.selected:
+ if only_selected and not pbone.select:
continue
for f in frame_range:
@@ -150,7 +150,7 @@ class BakeAction(bpy.types.Operator):
def execute(self, context):
props = self.properties
- action = bake(props.frame_start, props.frame_end, props.step, props.only_selected)
+ action = bake(props.frame_start, props.frame_end, props.step, props.show_only_selected)
# basic cleanup, could move elsewhere
for fcu in action.fcurves:
@@ -178,12 +178,12 @@ class BakeAction(bpy.types.Operator):
def register():
- bpy.types.register(BakeAction)
+ pass
# bpy.types.INFO_MT_mesh_add.append(menu_func)
def unregister():
- bpy.types.unregister(BakeAction)
+ pass
# bpy.types.INFO_MT_mesh_add.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py
index b16d2b0dcf2..56c43c0728c 100644
--- a/release/scripts/op/object.py
+++ b/release/scripts/op/object.py
@@ -52,9 +52,9 @@ class SelectPattern(bpy.types.Operator):
# Can be pose bones or objects
for item in items:
if pattern_match(item.name, self.properties.pattern):
- item.selected = True
+ item.select = True
elif not self.properties.extend:
- item.selected = False
+ item.select = False
return {'FINISHED'}
@@ -80,7 +80,8 @@ class SelectCamera(bpy.types.Operator):
bl_label = "Select Camera"
bl_options = {'REGISTER', 'UNDO'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.scene.camera is not None
def execute(self, context):
@@ -90,7 +91,7 @@ class SelectCamera(bpy.types.Operator):
self.report({'WARNING'}, "Active camera is not in this scene")
context.scene.objects.active = camera
- camera.selected = True
+ camera.select = True
return {'FINISHED'}
@@ -109,48 +110,51 @@ class SelectHierarchy(bpy.types.Operator):
extend = BoolProperty(name="Extend", description="Extend the existing selection", default=False)
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.object
def execute(self, context):
- objs = context.selected_objects
+ select_new = []
+ act_new = None
+
+
+ selected_objects = context.selected_objects
obj_act = context.object
- if context.object not in objs:
- objs.append(context.object)
-
- if not self.properties.extend:
- # for obj in objs:
- # obj.selected = False
- bpy.ops.object.select_all(action='DESELECT')
+ if context.object not in selected_objects:
+ selected_objects.append(context.object)
if self.properties.direction == 'PARENT':
- parents = []
- for obj in objs:
+ for obj in selected_objects:
parent = obj.parent
if parent:
- parents.append(parent)
-
if obj_act == obj:
- context.scene.objects.active = parent
+ act_new = parent
- parent.selected = True
-
- if parents:
- return {'CANCELLED'}
+ select_new.append(parent)
else:
- children = []
- for obj in objs:
- children += list(obj.children)
- for obj_iter in children:
- obj_iter.selected = True
+ for obj in selected_objects:
+ select_new.extend(obj.children)
- children.sort(key=lambda obj_iter: obj_iter.name)
- context.scene.objects.active = children[0]
+ if select_new:
+ select_new.sort(key=lambda obj_iter: obj_iter.name)
+ act_new = select_new[0]
- return {'FINISHED'}
+ # dont edit any object settings above this
+ if select_new:
+ if not self.properties.extend:
+ bpy.ops.object.select_all(action='DESELECT')
+
+ for obj in select_new:
+ obj.select = True
+
+ context.scene.objects.active = act_new
+ return {'FINISHED'}
+
+ return {'CANCELLED'}
class SubdivisionSet(bpy.types.Operator):
@@ -165,7 +169,8 @@ class SubdivisionSet(bpy.types.Operator):
relative = BoolProperty(name="Relative", description="Apply the subsurf level as an offset relative to the current level", default=False)
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
obs = context.selected_editable_objects
return (obs is not None)
@@ -251,7 +256,7 @@ class ShapeTransfer(bpy.types.Operator):
key = ob.add_shape_key(from_mix=False) # we need a rest
key.name = name
ob.active_shape_key_index = len(me.shape_keys.keys) - 1
- ob.shape_key_lock = True
+ ob.show_shape_key = True
from geometry import BarycentricTransform
from mathutils import Vector
@@ -264,28 +269,28 @@ class ShapeTransfer(bpy.types.Operator):
orig_shape_coords = me_cos(ob_act.active_shape_key.data)
- orig_normals = me_nos(me.verts)
- # orig_coords = me_cos(me.verts) # the actual mverts location isnt as relyable as the base shape :S
+ orig_normals = me_nos(me.vertices)
+ # orig_coords = me_cos(me.vertices) # the actual mverts location isnt as relyable as the base shape :S
orig_coords = me_cos(me.shape_keys.keys[0].data)
for ob_other in objects:
me_other = ob_other.data
- if len(me_other.verts) != len(me.verts):
+ if len(me_other.vertices) != len(me.vertices):
self.report({'WARNING'}, "Skipping '%s', vertex count differs" % ob_other.name)
continue
- target_normals = me_nos(me_other.verts)
+ target_normals = me_nos(me_other.vertices)
if me_other.shape_keys:
target_coords = me_cos(me_other.shape_keys.keys[0].data)
else:
- target_coords = me_cos(me_other.verts)
+ target_coords = me_cos(me_other.vertices)
ob_add_shape(ob_other, orig_key_name)
# editing the final coords, only list that stores wrapped coords
target_shape_coords = [v.co for v in ob_other.active_shape_key.data]
- median_coords = [[] for i in range(len(me.verts))]
+ median_coords = [[] for i in range(len(me.vertices))]
# Method 1, edge
if mode == 'OFFSET':
@@ -294,7 +299,7 @@ class ShapeTransfer(bpy.types.Operator):
elif mode == 'RELATIVE_FACE':
for face in me.faces:
- i1, i2, i3, i4 = face.verts_raw
+ i1, i2, i3, i4 = face.vertices_raw
if i4 != 0:
pt = BarycentricTransform(orig_shape_coords[i1],
orig_coords[i4], orig_coords[i1], orig_coords[i2],
@@ -334,7 +339,7 @@ class ShapeTransfer(bpy.types.Operator):
elif mode == 'RELATIVE_EDGE':
for ed in me.edges:
- i1, i2 = ed.verts
+ i1, i2 = ed.vertices
v1, v2 = orig_coords[i1], orig_coords[i2]
edge_length = (v1 - v2).length
n1loc = v1 + orig_normals[i1] * edge_length
@@ -377,7 +382,8 @@ class ShapeTransfer(bpy.types.Operator):
return {'FINISHED'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
obj = context.active_object
return (obj and obj.mode != 'EDIT')
@@ -407,7 +413,8 @@ class JoinUVs(bpy.types.Operator):
bl_idname = "object.join_uvs"
bl_label = "Join as UVs"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
obj = context.active_object
return (obj and obj.type == 'MESH')
@@ -465,7 +472,8 @@ class MakeDupliFace(bpy.types.Operator):
bl_idname = "object.make_dupli_face"
bl_label = "Make DupliFace"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
obj = context.active_object
return (obj and obj.type == 'MESH')
@@ -497,8 +505,8 @@ class MakeDupliFace(bpy.types.Operator):
mesh = bpy.data.meshes.new(data.name + "_dupli")
mesh.add_geometry(int(len(face_verts) / 3), 0, int(len(face_verts) / (4 * 3)))
- mesh.verts.foreach_set("co", face_verts)
- mesh.faces.foreach_set("verts_raw", faces)
+ mesh.vertices.foreach_set("co", face_verts)
+ mesh.faces.foreach_set("vertices_raw", faces)
mesh.update() # generates edge data
# pick an object to use
@@ -526,9 +534,9 @@ class MakeDupliFace(bpy.types.Operator):
class IsolateTypeRender(bpy.types.Operator):
- '''Select object matching a naming pattern'''
+ '''Hide unselected render objects of same type as active by setting the hide render flag'''
bl_idname = "object.isolate_type_render"
- bl_label = "Isolate Render Selection"
+ bl_label = "Restrict Render Unselected"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
@@ -536,36 +544,32 @@ class IsolateTypeRender(bpy.types.Operator):
for obj in context.visible_objects:
- if obj.selected:
- obj.restrict_render = False
+ if obj.select:
+ obj.hide_render = False
else:
if obj.type == act_type:
- obj.restrict_render = True
+ obj.hide_render = True
return {'FINISHED'}
+
+class ClearAllRestrictRender(bpy.types.Operator):
+ '''Reveal all render objects by setting the hide render flag'''
+ bl_idname = "object.hide_render_clear_all"
+ bl_label = "Clear All Restrict Render"
+ bl_options = {'REGISTER', 'UNDO'}
-
-classes = [
- SelectPattern,
- SelectCamera,
- SelectHierarchy,
- SubdivisionSet,
- ShapeTransfer,
- JoinUVs,
- IsolateTypeRender,
- MakeDupliFace]
+ def execute(self, context):
+ for obj in context.scene.objects:
+ obj.hide_render = False
+ return {'FINISHED'}
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
- register()
+ register() \ No newline at end of file
diff --git a/release/scripts/op/object_align.py b/release/scripts/op/object_align.py
index 6e5eef0fbc2..dc9b7c34523 100644
--- a/release/scripts/op/object_align.py
+++ b/release/scripts/op/object_align.py
@@ -263,7 +263,8 @@ class AlignObjects(bpy.types.Operator):
align_z = BoolProperty(name="Align Z",
description="Align in the Z axis", default=False)
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.mode == 'OBJECT'
def execute(self, context):
@@ -286,12 +287,10 @@ def menu_func(self, context):
def register():
- bpy.types.register(AlignObjects)
bpy.types.VIEW3D_MT_transform.append(menu_func)
def unregister():
- bpy.types.unregister(AlignObjects)
bpy.types.VIEW3D_MT_transform.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/op/object_randomize_transform.py b/release/scripts/op/object_randomize_transform.py
index 89884b1767f..8c3f4eb6dfd 100644
--- a/release/scripts/op/object_randomize_transform.py
+++ b/release/scripts/op/object_randomize_transform.py
@@ -140,12 +140,10 @@ def menu_func(self, context):
def register():
- bpy.types.register(RandomizeLocRotSize)
bpy.types.VIEW3D_MT_transform.append(menu_func)
def unregister():
- bpy.types.unregister(RandomizeLocRotSize)
bpy.types.VIEW3D_MT_transform.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py
index f80c5e69ddd..43e2cda5d53 100644
--- a/release/scripts/op/presets.py
+++ b/release/scripts/op/presets.py
@@ -22,7 +22,7 @@ import bpy
import os
-class AddPresetBase(bpy.types.Operator):
+class AddPresetBase():
'''Base preset class, only for subclassing
subclasses must define
- preset_values
@@ -91,29 +91,29 @@ class ExecutePreset(bpy.types.Operator):
return {'FINISHED'}
-class AddPresetRender(AddPresetBase):
+class AddPresetRender(AddPresetBase, bpy.types.Operator):
'''Add a Render Preset'''
bl_idname = "render.preset_add"
bl_label = "Add Render Preset"
name = AddPresetBase.name
preset_values = [
- "bpy.context.scene.render.resolution_x",
- "bpy.context.scene.render.resolution_y",
- "bpy.context.scene.render.pixel_aspect_x",
- "bpy.context.scene.render.pixel_aspect_y",
+ "bpy.context.scene.render.field_order",
"bpy.context.scene.render.fps",
"bpy.context.scene.render.fps_base",
+ "bpy.context.scene.render.pixel_aspect_x",
+ "bpy.context.scene.render.pixel_aspect_y",
"bpy.context.scene.render.resolution_percentage",
- "bpy.context.scene.render.fields",
- "bpy.context.scene.render.field_order",
- "bpy.context.scene.render.fields_still",
+ "bpy.context.scene.render.resolution_x",
+ "bpy.context.scene.render.resolution_y",
+ "bpy.context.scene.render.use_fields",
+ "bpy.context.scene.render.use_fields_still",
]
preset_subdir = "render"
-class AddPresetSSS(AddPresetBase):
+class AddPresetSSS(AddPresetBase, bpy.types.Operator):
'''Add a Subsurface Scattering Preset'''
bl_idname = "material.sss_preset_add"
bl_label = "Add SSS Preset"
@@ -125,7 +125,7 @@ class AddPresetSSS(AddPresetBase):
"bpy.context.material.subsurface_scattering.color[1]",
"bpy.context.material.subsurface_scattering.color[2]",
"bpy.context.material.subsurface_scattering.color_factor",
- "bpy.context.material.subsurface_scattering.error_tolerance",
+ "bpy.context.material.subsurface_scattering.error_threshold",
"bpy.context.material.subsurface_scattering.front",
"bpy.context.material.subsurface_scattering.ior",
"bpy.context.material.subsurface_scattering.radius[0]",
@@ -138,50 +138,50 @@ class AddPresetSSS(AddPresetBase):
preset_subdir = "sss"
-class AddPresetCloth(AddPresetBase):
+class AddPresetCloth(AddPresetBase, bpy.types.Operator):
'''Add a Cloth Preset'''
bl_idname = "cloth.preset_add"
bl_label = "Add Cloth Preset"
name = AddPresetBase.name
preset_values = [
- "bpy.context.cloth.settings.quality",
- "bpy.context.cloth.settings.mass",
- "bpy.context.cloth.settings.structural_stiffness",
+ "bpy.context.cloth.settings.air_damping",
"bpy.context.cloth.settings.bending_stiffness",
+ "bpy.context.cloth.settings.mass",
+ "bpy.context.cloth.settings.quality",
"bpy.context.cloth.settings.spring_damping",
- "bpy.context.cloth.settings.air_damping",
+ "bpy.context.cloth.settings.structural_stiffness",
]
preset_subdir = "cloth"
-class AddPresetSunSky(AddPresetBase):
+class AddPresetSunSky(AddPresetBase, bpy.types.Operator):
'''Add a Sky & Atmosphere Preset'''
bl_idname = "lamp.sunsky_preset_add"
bl_label = "Add Sunsky Preset"
name = AddPresetBase.name
preset_values = [
+ "bpy.context.object.data.sky.atmosphere_extinction",
+ "bpy.context.object.data.sky.atmosphere_inscattering",
"bpy.context.object.data.sky.atmosphere_turbidity",
- "bpy.context.object.data.sky.sky_blend_type",
- "bpy.context.object.data.sky.sky_blend",
+ "bpy.context.object.data.sky.backscattered_light",
"bpy.context.object.data.sky.horizon_brightness",
"bpy.context.object.data.sky.spread",
- "bpy.context.object.data.sky.sky_color_space",
- "bpy.context.object.data.sky.sky_exposure",
"bpy.context.object.data.sky.sun_brightness",
- "bpy.context.object.data.sky.sun_size",
- "bpy.context.object.data.sky.backscattered_light",
"bpy.context.object.data.sky.sun_intensity",
- "bpy.context.object.data.sky.atmosphere_inscattering",
- "bpy.context.object.data.sky.atmosphere_extinction",
+ "bpy.context.object.data.sky.sun_size",
+ "bpy.context.object.data.sky.use_sky_blend",
+ "bpy.context.object.data.sky.use_sky_blend_type",
+ "bpy.context.object.data.sky.use_sky_color_space",
+ "bpy.context.object.data.sky.use_sky_exposure",
]
preset_subdir = "sunsky"
-class AddPresetInteraction(AddPresetBase):
+class AddPresetInteraction(AddPresetBase, bpy.types.Operator):
'''Add an Application Interaction Preset'''
bl_idname = "wm.interaction_preset_add"
bl_label = "Add Interaction Preset"
@@ -189,39 +189,26 @@ class AddPresetInteraction(AddPresetBase):
save_keyconfig = True
preset_values = [
- "bpy.context.user_preferences.edit.drag_immediately",
- "bpy.context.user_preferences.edit.insertkey_xyz_to_rgb",
+ "bpy.context.user_preferences.edit.use_drag_immediately",
+ "bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb",
+ "bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom",
"bpy.context.user_preferences.inputs.select_mouse",
- "bpy.context.user_preferences.inputs.zoom_style",
- "bpy.context.user_preferences.inputs.zoom_axis",
- "bpy.context.user_preferences.inputs.view_rotation",
- "bpy.context.user_preferences.inputs.invert_zoom_direction",
- "bpy.context.user_preferences.inputs.emulate_numpad",
- "bpy.context.user_preferences.inputs.emulate_3_button_mouse",
- "bpy.context.user_preferences.inputs.continuous_mouse",
+ "bpy.context.user_preferences.inputs.use_emulate_numpad",
+ "bpy.context.user_preferences.inputs.use_mouse_continuous",
+ "bpy.context.user_preferences.inputs.use_mouse_emulate_3_button",
+ "bpy.context.user_preferences.inputs.view_rotate_method",
+ "bpy.context.user_preferences.inputs.view_zoom_axis",
+ "bpy.context.user_preferences.inputs.view_zoom_method",
]
preset_subdir = "interaction"
-classes = [
- ExecutePreset,
- AddPresetRender,
- AddPresetSSS,
- AddPresetCloth,
- AddPresetSunSky,
- AddPresetInteraction]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py
index 2ecd445df1d..80260755714 100644
--- a/release/scripts/op/screen_play_rendered_anim.py
+++ b/release/scripts/op/screen_play_rendered_anim.py
@@ -79,7 +79,7 @@ class PlayRenderedAnim(bpy.types.Operator):
preset = prefs.filepaths.animation_player_preset
player_path = prefs.filepaths.animation_player
- file_path = bpy.utils.expandpath(rd.output_path)
+ file_path = bpy.path.abspath(rd.filepath)
is_movie = rd.is_movie_format
# try and guess a command line if it doesn't exist
@@ -105,7 +105,7 @@ class PlayRenderedAnim(bpy.types.Operator):
# works for movies and images
file = rd.frame_path(frame=scene.frame_start)
- file = bpy.utils.expandpath(file) # expand '//'
+ file = bpy.path.abspath(file) # expand '//'
cmd = [player_path]
# extra options, fps controls etc.
@@ -144,11 +144,11 @@ class PlayRenderedAnim(bpy.types.Operator):
def register():
- bpy.types.register(PlayRenderedAnim)
+ pass
def unregister():
- bpy.types.unregister(PlayRenderedAnim)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/op/sequencer.py b/release/scripts/op/sequencer.py
index 13668498aae..feedb5cb4a8 100644
--- a/release/scripts/op/sequencer.py
+++ b/release/scripts/op/sequencer.py
@@ -30,7 +30,8 @@ class SequencerCrossfadeSounds(bpy.types.Operator):
bl_label = "Crossfade sounds"
bl_options = {'REGISTER', 'UNDO'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
return context.scene.sequence_editor.active_strip.type == 'SOUND'
else:
@@ -40,7 +41,7 @@ class SequencerCrossfadeSounds(bpy.types.Operator):
seq1 = None
seq2 = None
for s in context.scene.sequence_editor.sequences:
- if s.selected and s.type == 'SOUND':
+ if s.select and s.type == 'SOUND':
if seq1 == None:
seq1 = s
elif seq2 == None:
@@ -83,7 +84,8 @@ class SequencerCutMulticam(bpy.types.Operator):
camera = IntProperty(name="Camera",
default=1, min=1, max=32, soft_min=1, soft_max=32)
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
return context.scene.sequence_editor.active_strip.type == 'MULTICAM'
else:
@@ -94,16 +96,16 @@ class SequencerCutMulticam(bpy.types.Operator):
s = context.scene.sequence_editor.active_strip
- if s.multicam_source == camera:
+ if s.multicam_source == camera or camera >= s.channel:
return {'FINISHED'}
- if not s.selected:
- s.selected = True
+ if not s.select:
+ s.select = True
cfra = context.scene.frame_current
bpy.ops.sequencer.cut(frame=cfra, type='SOFT', side='RIGHT')
for s in context.scene.sequence_editor.sequences_all:
- if s.selected and s.type == 'MULTICAM' and s.frame_final_start <= cfra and cfra < s.frame_final_end:
+ if s.select and s.type == 'MULTICAM' and s.frame_final_start <= cfra and cfra < s.frame_final_end:
context.scene.sequence_editor.active_strip = s
context.scene.sequence_editor.active_strip.multicam_source = camera
@@ -117,7 +119,8 @@ class SequencerDeinterlaceSelectedMovies(bpy.types.Operator):
bl_label = "Deinterlace Movies"
bl_options = {'REGISTER', 'UNDO'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
if context.scene and context.scene.sequence_editor:
return True
else:
@@ -125,26 +128,18 @@ class SequencerDeinterlaceSelectedMovies(bpy.types.Operator):
def execute(self, context):
for s in context.scene.sequence_editor.sequences_all:
- if s.selected and s.type == 'MOVIE':
- s.de_interlace = True
+ if s.select and s.type == 'MOVIE':
+ s.use_deinterlace = True
return {'FINISHED'}
def register():
- register = bpy.types.register
-
- register(SequencerCrossfadeSounds)
- register(SequencerCutMulticam)
- register(SequencerDeinterlaceSelectedMovies)
+ pass
def unregister():
- unregister = bpy.types.unregister
-
- unregister(SequencerCrossfadeSounds)
- unregister(SequencerCutMulticam)
- unregister(SequencerDeinterlaceSelectedMovies)
+ pass
if __name__ == "__main__":
diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py
index 51c1695677b..cf3d68787c0 100644
--- a/release/scripts/op/uv.py
+++ b/release/scripts/op/uv.py
@@ -39,7 +39,8 @@ class ExportUVLayout(bpy.types.Operator):
description="File format to export the UV layout to",
default='SVG')
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
obj = context.active_object
return (obj and obj.type == 'MESH')
@@ -75,7 +76,7 @@ class ExportUVLayout(bpy.types.Operator):
local_image = Ellipsis
- if context.tool_settings.uv_local_view:
+ if context.tool_settings.show_uv_local_view:
space_data = self._space_image(context)
if space_data:
local_image = space_data.image
@@ -85,9 +86,9 @@ class ExportUVLayout(bpy.types.Operator):
for i in range(uv_layer_len):
uv_elem = uv_layer[i]
# context checks
- if faces[i].selected and (local_image is Ellipsis or local_image == uv_elem.image):
+ if faces[i].select and (local_image is Ellipsis or local_image == uv_elem.image):
#~ uv = uv_elem.uv
- #~ if False not in uv_elem.uv_selected[:len(uv)]:
+ #~ if False not in uv_elem.select_uv[:len(uv)]:
#~ yield (i, uv)
# just write what we see.
@@ -113,7 +114,9 @@ class ExportUVLayout(bpy.types.Operator):
mode = self.properties.mode
- file = open(self.properties.filepath, "w")
+ filepath = self.properties.filepath
+ filepath = bpy.path.ensure_ext(filepath, "." + mode.lower())
+ file = open(filepath, "w")
fw = file.write
if mode == 'SVG':
@@ -216,12 +219,10 @@ def menu_func(self, context):
def register():
- bpy.types.register(ExportUVLayout)
bpy.types.IMAGE_MT_uvs.append(menu_func)
def unregister():
- bpy.types.unregister(ExportUVLayout)
bpy.types.IMAGE_MT_uvs.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/op/uvcalc_follow_active.py b/release/scripts/op/uvcalc_follow_active.py
index 61c149c8735..1f80e704f93 100644
--- a/release/scripts/op/uvcalc_follow_active.py
+++ b/release/scripts/op/uvcalc_follow_active.py
@@ -26,7 +26,7 @@ import bpy
def extend(obj, operator, EXTEND_MODE):
me = obj.data
- me_verts = me.verts
+ me_verts = me.vertices
# script will fail without UVs
if not me.active_uv_texture:
me.add_uv_texture()
@@ -54,8 +54,8 @@ def extend(obj, operator, EXTEND_MODE):
# assume a quad
return [(vi[0], vi[1]), (vi[1], vi[2]), (vi[2], vi[3]), (vi[3], vi[0])]
- vidx_source = face_source.verts
- vidx_target = face_target.verts
+ vidx_source = face_source.vertices
+ vidx_target = face_target.vertices
faceUVsource = me.active_uv_texture.data[face_source.index]
uvs_source = [faceUVsource.uv1, faceUVsource.uv2, faceUVsource.uv3, faceUVsource.uv4]
@@ -146,7 +146,7 @@ def extend(obj, operator, EXTEND_MODE):
operator.report({'ERROR'}, "No active face.")
return
- face_sel = [f for f in me.faces if len(f.verts) == 4 and f.selected]
+ face_sel = [f for f in me.faces if len(f.vertices) == 4 and f.select]
face_act_local_index = -1
for i, f in enumerate(face_sel):
@@ -177,11 +177,9 @@ def extend(obj, operator, EXTEND_MODE):
except:
edge_faces[edkey] = [i]
- #SEAM = me.edges.seam
-
if EXTEND_MODE == 'LENGTH':
- edge_loops = me.edge_loops_from_faces(face_sel, [ed.key for ed in me.edges if ed.seam])
- me_verts = me.verts
+ edge_loops = me.edge_loops_from_faces(face_sel, [ed.key for ed in me.edges if ed.use_seam])
+ me_verts = me.vertices
for loop in edge_loops:
looplen = [0.0]
for ed in loop:
@@ -192,7 +190,7 @@ def extend(obj, operator, EXTEND_MODE):
# remove seams, so we dont map accross seams.
for ed in me.edges:
- if ed.seam:
+ if ed.use_seam:
# remove the edge pair if we can
try:
del edge_faces[ed.key]
@@ -249,7 +247,8 @@ class FollowActiveQuads(bpy.types.Operator):
description="Method to space UV edge loops",
default="LENGTH")
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
obj = context.active_object
return (obj is not None and obj.type == 'MESH')
@@ -263,12 +262,10 @@ menu_func = (lambda self, context: self.layout.operator(FollowActiveQuads.bl_idn
def register():
- bpy.types.register(FollowActiveQuads)
bpy.types.VIEW3D_MT_uv_map.append(menu_func)
def unregister():
- bpy.types.unregister(FollowActiveQuads)
bpy.types.VIEW3D_MT_uv_map.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/op/uvcalc_smart_project.py b/release/scripts/op/uvcalc_smart_project.py
index 13bf6244f4d..0589b7e861a 100644
--- a/release/scripts/op/uvcalc_smart_project.py
+++ b/release/scripts/op/uvcalc_smart_project.py
@@ -22,7 +22,7 @@
# <pep8 compliant>
-from mathutils import Matrix, Vector, RotationMatrix
+from mathutils import Matrix, Vector
import time
import geometry
import bpy
@@ -275,15 +275,15 @@ def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1):
# Takes a list of faces that make up a UV island and rotate
# until they optimally fit inside a square.
-ROTMAT_2D_POS_90D = RotationMatrix( radians(90.0), 2)
-ROTMAT_2D_POS_45D = RotationMatrix( radians(45.0), 2)
+ROTMAT_2D_POS_90D = Matrix.Rotation( radians(90.0), 2)
+ROTMAT_2D_POS_45D = Matrix.Rotation( radians(45.0), 2)
RotMatStepRotation = []
rot_angle = 22.5 #45.0/2
while rot_angle > 0.1:
RotMatStepRotation.append([\
- RotationMatrix( radians(rot_angle), 2),\
- RotationMatrix( radians(-rot_angle), 2)])
+ Matrix.Rotation( radians(rot_angle), 2),\
+ Matrix.Rotation( radians(-rot_angle), 2)])
rot_angle = rot_angle/2.0
@@ -524,7 +524,7 @@ def mergeUvIslands(islandList):
then move us 1 whole width accross,
Its possible this is a bad idea since 2 skinny Angular faces
could join without 1 whole move, but its a lot more optimal to speed this up
- since we have alredy tested for it.
+ since we have already tested for it.
It gives about 10% speedup with minimal errors.
'''
@@ -604,7 +604,7 @@ def getUvIslands(faceGroups, me):
# Get seams so we dont cross over seams
edge_seams = {} # shoudl be a set
for ed in me.edges:
- if ed.seam:
+ if ed.use_seam:
edge_seams[ed.key] = None # dummy var- use sets!
# Done finding seams
@@ -792,7 +792,7 @@ def VectoMat(vec):
class thickface(object):
__slost__= 'v', 'uv', 'no', 'area', 'edge_keys'
def __init__(self, face, uvface, mesh_verts):
- self.v = [mesh_verts[i] for i in face.verts]
+ self.v = [mesh_verts[i] for i in face.vertices]
if len(self.v)==4:
self.uv = uvface.uv1, uvface.uv2, uvface.uv3, uvface.uv4
else:
@@ -821,7 +821,7 @@ def main(context, island_margin, projection_limit):
#XXX ob = objects.active
ob= objects[0]
- if ob and ob.selected == 0 and ob.type == 'MESH':
+ if ob and (not ob.select) and ob.type == 'MESH':
# Add to the list
obList =[ob]
del objects
@@ -896,10 +896,10 @@ def main(context, island_margin, projection_limit):
me.add_uv_texture()
uv_layer = me.active_uv_texture.data
- me_verts = list(me.verts)
+ me_verts = list(me.vertices)
if USER_ONLY_SELECTED_FACES:
- meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces) if f.selected]
+ meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces) if f.select]
#else:
# meshFaces = map(thickface, me.faces)
@@ -1027,7 +1027,7 @@ def main(context, island_margin, projection_limit):
bestAng = fvec.dot(projectVecs[0])
bestAngIdx = 0
- # Cycle through the remaining, first alredy done
+ # Cycle through the remaining, first already done
while i-1:
i-=1
@@ -1124,7 +1124,8 @@ class SmartProject(bpy.types.Operator):
description="Margin to reduce bleed from adjacent islands.",
default=0.0, min=0.0, max=1.0)
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.active_object != None
def execute(self, context):
@@ -1138,12 +1139,10 @@ menu_func = (lambda self, context: self.layout.operator(SmartProject.bl_idname,
def register():
- bpy.types.register(SmartProject)
bpy.types.VIEW3D_MT_uv_map.append(menu_func)
def unregister():
- bpy.types.unregister(SmartProject)
bpy.types.VIEW3D_MT_uv_map.remove(menu_func)
if __name__ == "__main__":
diff --git a/release/scripts/op/vertexpaint_dirt.py b/release/scripts/op/vertexpaint_dirt.py
index c1521866a56..72317cf8c11 100644
--- a/release/scripts/op/vertexpaint_dirt.py
+++ b/release/scripts/op/vertexpaint_dirt.py
@@ -43,7 +43,7 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
#BPyMesh.meshCalcNormals(me)
- vert_tone = [0.0] * len(me.verts)
+ vert_tone = [0.0] * len(me.vertices)
min_tone = 180.0
max_tone = 0.0
@@ -51,21 +51,21 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
# create lookup table for each vertex's connected vertices (via edges)
con = []
- con = [[] for i in range(len(me.verts))]
+ con = [[] for i in range(len(me.vertices))]
# add connected verts
for e in me.edges:
- con[e.verts[0]].append(e.verts[1])
- con[e.verts[1]].append(e.verts[0])
+ con[e.vertices[0]].append(e.vertices[1])
+ con[e.vertices[1]].append(e.vertices[0])
- for i, v in enumerate(me.verts):
+ for i, v in enumerate(me.vertices):
vec = Vector()
no = v.normal
co = v.co
# get the direction of the vectors between the vertex and it's connected vertices
for c in con[i]:
- vec += (me.verts[c].co - co).normalize()
+ vec += (me.vertices[c].co - co).normalize()
# normalize the vector by dividing by the number of connected verts
tot_con = len(con[i])
@@ -127,15 +127,15 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
return('CANCELLED', )
for i, f in enumerate(me.faces):
- if not me.use_paint_mask or f.selected:
+ if not me.use_paint_mask or f.select:
f_col = active_col_layer[i]
f_col = [f_col.color1, f_col.color2, f_col.color3, f_col.color4]
- for j, v in enumerate(f.verts):
+ for j, v in enumerate(f.vertices):
col = f_col[j]
- tone = vert_tone[me.verts[v].index]
+ tone = vert_tone[me.vertices[v].index]
tone = (tone - min_tone) / tone_range
if dirt_only:
@@ -180,11 +180,11 @@ class VertexPaintDirt(bpy.types.Operator):
def register():
- bpy.types.register(VertexPaintDirt)
+ pass
def unregister():
- bpy.types.unregister(VertexPaintDirt)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py
index ed77f32ff6d..cc35a0ab3dd 100644
--- a/release/scripts/op/wm.py
+++ b/release/scripts/op/wm.py
@@ -21,7 +21,7 @@
import bpy
from bpy.props import *
-
+from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
class MESH_OT_delete_edgeloop(bpy.types.Operator):
'''Delete an edge loop by merging the faces on each side to a single face loop'''
@@ -325,6 +325,42 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
exec("context.%s=advance_enum" % self.properties.data_path)
return {'FINISHED'}
+
+class WM_OT_context_set_id(bpy.types.Operator):
+ '''Toggle a context value.'''
+ bl_idname = "wm.context_set_id"
+ bl_label = "Set Library ID"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ value = StringProperty(name="Value",
+ description="Assign value", maxlen=1024, default="")
+
+ def execute(self, context):
+ value = self.properties.value
+ data_path = self.properties.data_path
+
+ # match the pointer type from the target property to bpy.data.*
+ # so we lookup the correct list.
+ data_path_base, data_path_prop = data_path.rsplit(".", 1)
+ data_prop_rna = eval("context.%s" % data_path_base).rna_type.properties[data_path_prop]
+ data_prop_rna_type = data_prop_rna.fixed_type
+
+ id_iter = None
+
+ for prop in bpy.data.rna_type.properties:
+ if prop.rna_type.identifier == "CollectionProperty":
+ if prop.fixed_type == data_prop_rna_type:
+ id_iter = prop.identifier
+ break
+
+ if id_iter:
+ value_id = getattr(bpy.data, id_iter).get(value)
+ exec("context.%s=value_id" % data_path)
+
+ return {'FINISHED'}
+
+
doc_id = StringProperty(name="Doc ID",
description="", maxlen=1024, default="", options={'HIDDEN'})
@@ -442,7 +478,7 @@ class WM_OT_path_open(bpy.types.Operator):
import os
import subprocess
- filepath = bpy.utils.expandpath(self.properties.filepath)
+ filepath = bpy.path.abspath(self.properties.filepath)
filepath = os.path.normpath(filepath)
if not os.path.exists(filepath):
@@ -576,46 +612,139 @@ class WM_OT_doc_edit(bpy.types.Operator):
return wm.invoke_props_dialog(self, width=600)
-import rna_prop_ui
+from bpy.props import *
+
+
+rna_path = StringProperty(name="Property Edit",
+ description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'})
+
+rna_value = StringProperty(name="Property Value",
+ description="Property value edit", maxlen=1024, default="")
+
+rna_property = StringProperty(name="Property Name",
+ description="Property name edit", maxlen=1024, default="")
+
+rna_min = FloatProperty(name="Min", default=0.0, precision=3)
+rna_max = FloatProperty(name="Max", default=1.0, precision=3)
+
+
+class WM_OT_properties_edit(bpy.types.Operator):
+ '''Internal use (edit a property data_path)'''
+ bl_idname = "wm.properties_edit"
+ bl_label = "Edit Property"
+
+ data_path = rna_path
+ property = rna_property
+ value = rna_value
+ min = rna_min
+ max = rna_max
+ description = StringProperty(name="Tip", default="")
+
+ def execute(self, context):
+ data_path = self.properties.data_path
+ value = self.properties.value
+ prop = self.properties.property
+ prop_old = self._last_prop[0]
+
+ try:
+ value_eval = eval(value)
+ except:
+ value_eval = value
+
+ # First remove
+ item = eval("context.%s" % data_path)
+
+ rna_idprop_ui_prop_clear(item, prop_old)
+ exec_str = "del item['%s']" % prop_old
+ # print(exec_str)
+ exec(exec_str)
+
+
+ # Reassign
+ exec_str = "item['%s'] = %s" % (prop, repr(value_eval))
+ # print(exec_str)
+ exec(exec_str)
+ self._last_prop[:] = [prop]
+
+ prop_type = type(item[prop])
+
+ prop_ui = rna_idprop_ui_prop_get(item, prop)
+
+ if prop_type in (float, int):
+
+ prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.properties.min)
+ prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.properties.max)
+
+ prop_ui['description'] = self.properties.description
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+
+ self._last_prop = [self.properties.property]
+
+ item = eval("context.%s" % self.properties.data_path)
+
+ # setup defaults
+ prop_ui = rna_idprop_ui_prop_get(item, self.properties.property, False) # dont create
+ if prop_ui:
+ self.properties.min = prop_ui.get("min", -1000000000)
+ self.properties.max = prop_ui.get("max", 1000000000)
+ self.properties.description = prop_ui.get("description", "")
+
+ wm = context.manager
+ # This crashes, TODO - fix
+ #return wm.invoke_props_popup(self, event)
+
+ wm.invoke_props_popup(self, event)
+ return {'RUNNING_MODAL'}
+
+
+class WM_OT_properties_add(bpy.types.Operator):
+ '''Internal use (edit a property data_path)'''
+ bl_idname = "wm.properties_add"
+ bl_label = "Add Property"
-classes = [
- MESH_OT_delete_edgeloop,
+ data_path = rna_path
- WM_OT_context_set_boolean,
- WM_OT_context_set_int,
- WM_OT_context_scale_int,
- WM_OT_context_set_float,
- WM_OT_context_set_string,
- WM_OT_context_set_enum,
- WM_OT_context_set_value,
- WM_OT_context_toggle,
- WM_OT_context_toggle_enum,
- WM_OT_context_cycle_enum,
- WM_OT_context_cycle_int,
- WM_OT_context_modal_mouse,
+ def execute(self, context):
+ item = eval("context.%s" % self.properties.data_path)
+
+ def unique_name(names):
+ prop = 'prop'
+ prop_new = prop
+ i = 1
+ while prop_new in names:
+ prop_new = prop + str(i)
+ i += 1
+
+ return prop_new
+
+ property = unique_name(item.keys())
+
+ item[property] = 1.0
+ return {'FINISHED'}
- WM_OT_url_open,
- WM_OT_path_open,
- WM_OT_doc_view,
- WM_OT_doc_edit,
+class WM_OT_properties_remove(bpy.types.Operator):
+ '''Internal use (edit a property data_path)'''
+ bl_idname = "wm.properties_remove"
+ bl_label = "Remove Property"
- # experemental!
- rna_prop_ui.WM_OT_properties_edit,
- rna_prop_ui.WM_OT_properties_add,
- rna_prop_ui.WM_OT_properties_remove]
+ data_path = rna_path
+ property = rna_property
+ def execute(self, context):
+ item = eval("context.%s" % self.properties.data_path)
+ del item[self.properties.property]
+ return {'FINISHED'}
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/presets/interaction/blender.py b/release/scripts/presets/interaction/blender.py
index 63006b2008d..229aa657b2f 100644
--- a/release/scripts/presets/interaction/blender.py
+++ b/release/scripts/presets/interaction/blender.py
@@ -4,13 +4,13 @@ import bpy
wm = bpy.context.manager
wm.active_keyconfig = wm.keyconfigs['Blender']
-bpy.context.user_preferences.view.auto_depth = False
-bpy.context.user_preferences.view.zoom_to_mouse = False
-bpy.context.user_preferences.view.rotate_around_selection = False
-bpy.context.user_preferences.edit.drag_immediately = False
-bpy.context.user_preferences.edit.insertkey_xyz_to_rgb = False
+bpy.context.user_preferences.view.use_mouse_auto_depth = False
+bpy.context.user_preferences.view.use_zoom_to_mouse = False
+bpy.context.user_preferences.view.use_rotate_around_active = False
+bpy.context.user_preferences.edit.use_drag_immediately = False
+bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False
bpy.context.user_preferences.inputs.select_mouse = 'RIGHT'
-bpy.context.user_preferences.inputs.zoom_style = 'DOLLY'
-bpy.context.user_preferences.inputs.zoom_axis = 'VERTICAL'
-bpy.context.user_preferences.inputs.view_rotation = 'TRACKBALL'
-bpy.context.user_preferences.inputs.invert_zoom_direction = False
+bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
+bpy.context.user_preferences.inputs.view_zoom_axis = 'VERTICAL'
+bpy.context.user_preferences.inputs.view_rotate_method = 'TRACKBALL'
+bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = False
diff --git a/release/scripts/presets/interaction/maya.py b/release/scripts/presets/interaction/maya.py
index 31652035dff..ccd95abf75e 100644
--- a/release/scripts/presets/interaction/maya.py
+++ b/release/scripts/presets/interaction/maya.py
@@ -7,7 +7,7 @@ kc = wm.add_keyconfig('Maya')
# Map 3D View
km = kc.add_keymap('3D View', space_type='VIEW_3D', region_type='WINDOW', modal=False)
-kmi = km.items.add('view3d.manipulator', 'LEFTMOUSE', 'PRESS', any=True)
+kmi = km.items.add('view3d.show_manipulator', 'LEFTMOUSE', 'PRESS', any=True)
kmi.properties.release_confirm = True
kmi = km.items.add('view3d.cursor3d', 'ACTIONMOUSE', 'PRESS')
kmi = km.items.add('view3d.rotate', 'LEFTMOUSE', 'PRESS', alt=True)
@@ -126,11 +126,11 @@ kmi.properties.nr = 9
kmi = km.items.add('view3d.layers', 'ZERO', 'PRESS', any=True)
kmi.properties.nr = 10
kmi = km.items.add('wm.context_toggle_enum', 'Z', 'PRESS')
-kmi.properties.data_path = 'space_data.viewport_shading'
+kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.value_1 = 'SOLID'
kmi.properties.value_2 = 'WIREFRAME'
kmi = km.items.add('wm.context_toggle_enum', 'Z', 'PRESS', alt=True)
-kmi.properties.data_path = 'space_data.viewport_shading'
+kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.value_1 = 'TEXTURED'
kmi.properties.value_2 = 'SOLID'
kmi = km.items.add('view3d.select', 'SELECTMOUSE', 'PRESS')
@@ -173,9 +173,9 @@ kmi = km.items.add('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True)
kmi.properties.data_path = 'space_data.pivot_point'
kmi.properties.value = 'MEDIAN_POINT'
kmi = km.items.add('wm.context_toggle', 'COMMA', 'PRESS', alt=True)
-kmi.properties.data_path = 'space_data.pivot_point_align'
+kmi.properties.data_path = 'space_data.use_pivot_point_align'
kmi = km.items.add('wm.context_toggle', 'Q', 'PRESS')
-kmi.properties.data_path = 'space_data.manipulator'
+kmi.properties.data_path = 'space_data.show_manipulator'
kmi = km.items.add('wm.context_set_enum', 'PERIOD', 'PRESS')
kmi.properties.data_path = 'space_data.pivot_point'
kmi.properties.value = 'CURSOR'
@@ -212,9 +212,9 @@ kmi.properties.extend = True
km = kc.add_keymap('Object Mode', space_type='EMPTY', region_type='WINDOW', modal=False)
kmi = km.items.add('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
-kmi.properties.data_path = 'tool_settings.proportional_editing_falloff'
+kmi.properties.data_path = 'tool_settings.proportional_edit_falloff'
kmi = km.items.add('wm.context_toggle_enum', 'O', 'PRESS')
-kmi.properties.data_path = 'tool_settings.proportional_editing'
+kmi.properties.data_path = 'tool_settings.proportional_edit'
kmi.properties.value_1 = 'DISABLED'
kmi.properties.value_2 = 'ENABLED'
kmi = km.items.add('view3d.game_start', 'P', 'PRESS')
@@ -244,9 +244,9 @@ kmi = km.items.add('object.location_clear', 'G', 'PRESS', alt=True)
kmi = km.items.add('object.rotation_clear', 'R', 'PRESS', alt=True)
kmi = km.items.add('object.scale_clear', 'S', 'PRESS', alt=True)
kmi = km.items.add('object.origin_clear', 'O', 'PRESS', alt=True)
-kmi = km.items.add('object.restrictview_clear', 'H', 'PRESS', alt=True)
-kmi = km.items.add('object.restrictview_set', 'H', 'PRESS')
-kmi = km.items.add('object.restrictview_set', 'H', 'PRESS', shift=True)
+kmi = km.items.add('object.hide_view_clear', 'H', 'PRESS', alt=True)
+kmi = km.items.add('object.hide_view_set', 'H', 'PRESS')
+kmi = km.items.add('object.hide_view_set', 'H', 'PRESS', shift=True)
kmi.properties.unselected = True
kmi = km.items.add('object.move_to_layer', 'M', 'PRESS')
kmi = km.items.add('object.delete', 'X', 'PRESS')
@@ -363,13 +363,13 @@ kmi.properties.name = 'VIEW3D_MT_uv_map'
kmi = km.items.add('wm.call_menu', 'G', 'PRESS', ctrl=True)
kmi.properties.name = 'VIEW3D_MT_vertex_group'
kmi = km.items.add('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
-kmi.properties.data_path = 'tool_settings.proportional_editing_falloff'
+kmi.properties.data_path = 'tool_settings.proportional_edit_falloff'
kmi = km.items.add('wm.context_toggle_enum', 'O', 'PRESS')
-kmi.properties.data_path = 'tool_settings.proportional_editing'
+kmi.properties.data_path = 'tool_settings.proportional_edit'
kmi.properties.value_1 = 'DISABLED'
kmi.properties.value_2 = 'ENABLED'
kmi = km.items.add('wm.context_toggle_enum', 'O', 'PRESS', alt=True)
-kmi.properties.data_path = 'tool_settings.proportional_editing'
+kmi.properties.data_path = 'tool_settings.proportional_edit'
kmi.properties.value_1 = 'DISABLED'
kmi.properties.value_2 = 'CONNECTED'
kmi = km.items.add('mesh.select_all', 'SELECTMOUSE', 'CLICK')
@@ -377,10 +377,10 @@ kmi.properties.action = 'DESELECT'
wm.active_keyconfig = kc
-bpy.context.user_preferences.edit.drag_immediately = True
-bpy.context.user_preferences.edit.insertkey_xyz_to_rgb = False
+bpy.context.user_preferences.edit.use_drag_immediately = True
+bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False
bpy.context.user_preferences.inputs.select_mouse = 'LEFT'
-bpy.context.user_preferences.inputs.zoom_style = 'DOLLY'
-bpy.context.user_preferences.inputs.zoom_axis = 'HORIZONTAL'
-bpy.context.user_preferences.inputs.view_rotation = 'TURNTABLE'
-bpy.context.user_preferences.inputs.invert_zoom_direction = True
+bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
+bpy.context.user_preferences.inputs.view_zoom_axis = 'HORIZONTAL'
+bpy.context.user_preferences.inputs.view_rotate_method = 'TURNTABLE'
+bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = True
diff --git a/release/scripts/templates/gamelogic.py b/release/scripts/templates/gamelogic.py
index b31d5d95987..21a901c091b 100644
--- a/release/scripts/templates/gamelogic.py
+++ b/release/scripts/templates/gamelogic.py
@@ -6,7 +6,7 @@
# for keyboard event comparison
# import GameKeys
-# support for Vector(), Matrix() types and advanced functions like ScaleMatrix(...) and RotationMatrix(...)
+# support for Vector(), Matrix() types and advanced functions like Matrix.Scale(...) and Matrix.Rotation(...)
# import mathutils
# for functions like getWindowWidth(), getWindowHeight()
diff --git a/release/scripts/templates/operator.py b/release/scripts/templates/operator.py
index e20b92c9b6a..5a525784b51 100644
--- a/release/scripts/templates/operator.py
+++ b/release/scripts/templates/operator.py
@@ -23,7 +23,8 @@ class ExportSomeData(bpy.types.Operator):
description="Choose between two items",
default='OPT_A')
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.active_object != None
def execute(self, context):
@@ -54,9 +55,6 @@ class ExportSomeData(bpy.types.Operator):
return self.execute(context)
-
-bpy.types.register(ExportSomeData)
-
# Only needed if you want to add into a dynamic menu
menu_func = lambda self, context: self.layout.operator("export.some_data", text="Example Exporter...")
bpy.types.INFO_MT_file_export.append(menu_func)
diff --git a/release/scripts/templates/operator_modal.py b/release/scripts/templates/operator_modal.py
index e029d91a7fa..0c5db47674b 100644
--- a/release/scripts/templates/operator_modal.py
+++ b/release/scripts/templates/operator_modal.py
@@ -34,7 +34,5 @@ class ModalOperator(bpy.types.Operator):
return {'CANCELLED'}
-bpy.types.register(ModalOperator)
-
if __name__ == "__main__":
bpy.ops.object.modal_operator()
diff --git a/release/scripts/templates/operator_modal_draw.py b/release/scripts/templates/operator_modal_draw.py
index 1f24672346b..56ffb95f555 100644
--- a/release/scripts/templates/operator_modal_draw.py
+++ b/release/scripts/templates/operator_modal_draw.py
@@ -64,15 +64,3 @@ class ModalDrawOperator(bpy.types.Operator):
else:
self.report({'WARNING'}, "View3D not found, cannot run operator")
return {'CANCELLED'}
-
-
-def register():
- bpy.types.register(ModalDrawOperator)
-
-
-def unregister():
- bpy.types.unregister(ModalDrawOperator)
-
-
-if __name__ == "__main__":
- register()
diff --git a/release/scripts/templates/operator_modal_view3d.py b/release/scripts/templates/operator_modal_view3d.py
index da019c2b653..9b49fd947ad 100644
--- a/release/scripts/templates/operator_modal_view3d.py
+++ b/release/scripts/templates/operator_modal_view3d.py
@@ -51,6 +51,3 @@ class ViewOperator(bpy.types.Operator):
else:
self.report({'WARNING'}, "Active space must be a View3d")
return {'CANCELLED'}
-
-
-bpy.types.register(ViewOperator)
diff --git a/release/scripts/templates/operator_simple.py b/release/scripts/templates/operator_simple.py
index 985a628c2d0..853bfa666eb 100644
--- a/release/scripts/templates/operator_simple.py
+++ b/release/scripts/templates/operator_simple.py
@@ -9,18 +9,14 @@ class SimpleOperator(bpy.types.Operator):
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.active_object != None
def execute(self, context):
main(context)
return {'FINISHED'}
-def register():
- bpy.types.register(SimpleOperator)
-
-def unregister():
- bpy.types.unregister(SimpleOperator)
if __name__ == "__main__":
- register()
+ bpy.ops.object.simple_operator()
diff --git a/release/scripts/templates/operator_uv.py b/release/scripts/templates/operator_uv.py
index 1003bd6c58b..a18aaf358c8 100644
--- a/release/scripts/templates/operator_uv.py
+++ b/release/scripts/templates/operator_uv.py
@@ -15,21 +15,23 @@ def main(context):
# adjust UVs
for i, uv in enumerate(mesh.active_uv_texture.data):
uvs = uv.uv1, uv.uv2, uv.uv3, uv.uv4
- for j, v_idx in enumerate(mesh.faces[i].verts):
- if uv.uv_selected[j]:
+ for j, v_idx in enumerate(mesh.faces[i].vertices):
+ if uv.select_uv[j]:
# apply the location of the vertex as a UV
- uvs[j][:] = mesh.verts[v_idx].co.xy
+ uvs[j][:] = mesh.vertices[v_idx].co.xy
if is_editmode:
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+
class UvOperator(bpy.types.Operator):
- ''''''
+ '''UV Operator description'''
bl_idname = "uv.simple_operator"
bl_label = "Simple UV Operator"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
obj = context.active_object
return (obj and obj.type == 'MESH')
@@ -37,7 +39,6 @@ class UvOperator(bpy.types.Operator):
main(context)
return {'FINISHED'}
-bpy.types.register(UvOperator)
if __name__ == "__main__":
bpy.ops.uv.simple_operator()
diff --git a/release/scripts/templates/panel_simple.py b/release/scripts/templates/panel_simple.py
index aac4b6e715e..7c73e58a3e5 100644
--- a/release/scripts/templates/panel_simple.py
+++ b/release/scripts/templates/panel_simple.py
@@ -18,5 +18,3 @@ class OBJECT_PT_hello(bpy.types.Panel):
row.label(text="Active object is: " + obj.name)
row = layout.row()
row.prop(obj, "name")
-
-bpy.types.register(OBJECT_PT_hello)
diff --git a/release/scripts/ui/properties_animviz.py b/release/scripts/ui/properties_animviz.py
index 9eb046cc2c8..9b605d02215 100644
--- a/release/scripts/ui/properties_animviz.py
+++ b/release/scripts/ui/properties_animviz.py
@@ -19,35 +19,30 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-################################################
# Generic Panels (Independent of DataType)
-class MotionPathButtonsPanel(bpy.types.Panel):
+class MotionPathButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Motion Paths"
bl_default_closed = True
- def draw_settings(self, context, avs, wide_ui, bones=False):
+ def draw_settings(self, context, avs, bones=False):
layout = self.layout
- mps = avs.motion_paths
+ mps = avs.motion_path
- if wide_ui:
- layout.prop(mps, "type", expand=True)
- else:
- layout.prop(mps, "type", text="")
+ layout.prop(mps, "type", expand=True)
split = layout.split()
col = split.column()
sub = col.column(align=True)
if (mps.type == 'CURRENT_FRAME'):
- sub.prop(mps, "before_current", text="Before")
- sub.prop(mps, "after_current", text="After")
+ sub.prop(mps, "frame_before", text="Before")
+ sub.prop(mps, "frame_after", text="After")
elif (mps.type == 'RANGE'):
sub.prop(mps, "frame_start", text="Start")
sub.prop(mps, "frame_end", text="End")
@@ -56,18 +51,17 @@ class MotionPathButtonsPanel(bpy.types.Panel):
if bones:
col.row().prop(mps, "bake_location", expand=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Display:")
col.prop(mps, "show_frame_numbers", text="Frame Numbers")
- col.prop(mps, "highlight_keyframes", text="Keyframes")
+ col.prop(mps, "show_keyframe_highlight", text="Keyframes")
if bones:
- col.prop(mps, "search_all_action_keyframes", text="+ Non-Grouped Keyframes")
+ col.prop(mps, "show_keyframe_action_all", text="+ Non-Grouped Keyframes")
col.prop(mps, "show_keyframe_numbers", text="Keyframe Numbers")
# FIXME: this panel still needs to be ported so that it will work correctly with animviz
-class OnionSkinButtonsPanel(bpy.types.Panel):
+class OnionSkinButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Onion Skinning"
@@ -77,12 +71,8 @@ class OnionSkinButtonsPanel(bpy.types.Panel):
layout = self.layout
arm = context.armature
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(arm, "ghost_type", expand=True)
- else:
- layout.prop(arm, "ghost_type", text="")
+ layout.prop(arm, "ghost_type", expand=True)
split = layout.split()
@@ -97,124 +87,23 @@ class OnionSkinButtonsPanel(bpy.types.Panel):
sub.prop(arm, "ghost_step", text="Range")
sub.prop(arm, "ghost_size", text="Step")
- if wide_ui:
- col = split.column()
- col.label(text="Display:")
- col.prop(arm, "ghost_only_selected", text="Selected Only")
-
-################################################
-# Specific Panels for DataTypes
-
-
-class OBJECT_PT_motion_paths(MotionPathButtonsPanel):
- #bl_label = "Object Motion Paths"
- bl_context = "object"
-
- def poll(self, context):
- return (context.object)
-
- def draw(self, context):
- layout = self.layout
-
- ob = context.object
- wide_ui = context.region.width > narrowui
-
- self.draw_settings(context, ob.animation_visualisation, wide_ui)
-
- layout.separator()
-
- split = layout.split()
-
col = split.column()
- col.operator("object.paths_calculate", text="Calculate Paths")
-
- if wide_ui:
- col = split.column()
- col.operator("object.paths_clear", text="Clear Paths")
-
-
-class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel):
- #bl_label = "Object Onion Skinning"
- bl_context = "object"
-
- def poll(self, context):
- return (context.object)
-
- def draw(self, context):
- layout = self.layout
-
- ob = context.object
- wide_ui = context.region.width > narrowui
-
- self.draw_settings(context, ob.animation_visualisation, wide_ui)
-
-
-class DATA_PT_motion_paths(MotionPathButtonsPanel):
- #bl_label = "Bones Motion Paths"
- bl_context = "data"
-
- def poll(self, context):
- # XXX: include posemode check?
- return (context.object) and (context.armature)
-
- def draw(self, context):
- layout = self.layout
-
- ob = context.object
- wide_ui = context.region.width > narrowui
-
- self.draw_settings(context, ob.pose.animation_visualisation, wide_ui, bones=True)
-
- layout.separator()
-
- split = layout.split()
-
- col = split.column()
- col.operator("pose.paths_calculate", text="Calculate Paths")
-
- if wide_ui:
- col = split.column()
- col.operator("pose.paths_clear", text="Clear Paths")
-
-
-class DATA_PT_onion_skinning(OnionSkinButtonsPanel):
- #bl_label = "Bones Onion Skinning"
- bl_context = "data"
-
- def poll(self, context):
- # XXX: include posemode check?
- return (context.object) and (context.armature)
-
- def draw(self, context):
- layout = self.layout
+ col.label(text="Display:")
+ col.prop(arm, "show_only_ghost_selected", text="Selected Only")
- ob = context.object
- wide_ui = context.region.width > narrowui
- self.draw_settings(context, ob.pose.animation_visualisation, wide_ui, bones=True)
# NOTE:
-# The specialised panel types defined here (i.e. OBJECT_PT_*, etc.)
-# aren't registered here, but are rather imported to (and registered)
-# in the files defining the contexts where they reside. Otherwise,
-# these panels appear at the top of the lists by default.
-#
-# However, we keep these empty register funcs here just in case
-# something will need them again one day, and also to make
-# it easier to maintain these scripts.
-classes = []
+# The specialised panel types are derived in their respective UI modules
+
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py
index 38903cc1f27..7de06554751 100644
--- a/release/scripts/ui/properties_data_armature.py
+++ b/release/scripts/ui/properties_data_armature.py
@@ -20,19 +20,18 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class ArmatureButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.armature
-class DATA_PT_context_arm(DataButtonsPanel):
+class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -42,60 +41,47 @@ class DATA_PT_context_arm(DataButtonsPanel):
ob = context.object
arm = context.armature
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif arm:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- layout.template_ID(ob, "data")
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif arm:
+ split.template_ID(space, "pin_id")
+ split.separator()
-class DATA_PT_custom_props_arm(DataButtonsPanel, PropertyPanel):
- _context_path = "object.data"
-
-class DATA_PT_skeleton(DataButtonsPanel):
+class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Skeleton"
def draw(self, context):
layout = self.layout
arm = context.armature
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(arm, "pose_position", expand=True)
- else:
- layout.prop(arm, "pose_position", text="")
+ layout.prop(arm, "pose_position", expand=True)
split = layout.split()
col = split.column()
col.label(text="Layers:")
- col.prop(arm, "layer", text="")
+ col.prop(arm, "layers", text="")
col.label(text="Protected Layers:")
- col.prop(arm, "layer_protection", text="")
+ col.prop(arm, "layers_protected", text="")
col.label(text="Deform:")
split = layout.split()
col = split.column()
- col.prop(arm, "deform_vertexgroups", text="Vertex Groups")
- col.prop(arm, "deform_envelope", text="Envelopes")
+ col.prop(arm, "use_deform_vertex_groups", text="Vertex Groups")
+ col.prop(arm, "use_deform_envelopes", text="Envelopes")
- if wide_ui:
- col = split.column()
- col.prop(arm, "deform_quaternion", text="Quaternion")
+ col = split.column()
+ col.prop(arm, "use_deform_preserve_volume", text="Quaternion")
-class DATA_PT_display(DataButtonsPanel):
+class DATA_PT_display(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Display"
def draw(self, context):
@@ -103,30 +89,27 @@ class DATA_PT_display(DataButtonsPanel):
ob = context.object
arm = context.armature
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.row().prop(arm, "drawtype", expand=True)
- else:
- layout.row().prop(arm, "drawtype", text="")
+ layout.row().prop(arm, "draw_type", expand=True)
split = layout.split()
col = split.column()
- col.prop(arm, "draw_names", text="Names")
- col.prop(arm, "draw_axes", text="Axes")
- col.prop(arm, "draw_custom_bone_shapes", text="Shapes")
+ col.prop(arm, "show_names", text="Names")
+ col.prop(arm, "show_axes", text="Axes")
+ col.prop(arm, "show_bone_custom_shapes", text="Shapes")
- if wide_ui:
- col = split.column()
- col.prop(arm, "draw_group_colors", text="Colors")
- col.prop(arm, "delay_deform", text="Delay Refresh")
+ col = split.column()
+ col.prop(arm, "show_group_colors", text="Colors")
+ col.prop(ob, "show_x_ray", text="X-Ray")
+ col.prop(arm, "use_deform_delay", text="Delay Refresh")
-class DATA_PT_bone_groups(DataButtonsPanel):
+class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Bone Groups"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
def draw(self, context):
@@ -134,7 +117,6 @@ class DATA_PT_bone_groups(DataButtonsPanel):
ob = context.object
pose = ob.pose
- wide_ui = context.region.width > narrowui
row = layout.row()
row.template_list(pose, "bone_groups", pose, "active_bone_group_index", rows=2)
@@ -156,8 +138,7 @@ class DATA_PT_bone_groups(DataButtonsPanel):
col = split.column()
col.prop(group, "color_set")
if group.color_set:
- if wide_ui:
- col = split.column()
+ col = split.column()
col.template_triColorSet(group, "colors")
row = layout.row()
@@ -173,21 +154,15 @@ class DATA_PT_bone_groups(DataButtonsPanel):
# TODO: this panel will soon be depreceated too
-
-
-class DATA_PT_ghost(DataButtonsPanel):
+class DATA_PT_ghost(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Ghost"
def draw(self, context):
layout = self.layout
arm = context.armature
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(arm, "ghost_type", expand=True)
- else:
- layout.prop(arm, "ghost_type", text="")
+ layout.prop(arm, "ghost_type", expand=True)
split = layout.split()
@@ -202,17 +177,17 @@ class DATA_PT_ghost(DataButtonsPanel):
sub.prop(arm, "ghost_step", text="Range")
sub.prop(arm, "ghost_size", text="Step")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Display:")
- col.prop(arm, "ghost_only_selected", text="Selected Only")
+ col.prop(arm, "show_only_ghost_selected", text="Selected Only")
-class DATA_PT_iksolver_itasc(DataButtonsPanel):
+class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "iTaSC parameters"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
return (ob and ob.pose)
@@ -222,7 +197,6 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel):
ob = context.object
itasc = ob.pose.ik_param
- wide_ui = (context.region.width > narrowui)
row = layout.row()
row.prop(ob.pose, "ik_solver")
@@ -232,63 +206,91 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel):
simulation = (itasc.mode == 'SIMULATION')
if simulation:
layout.label(text="Reiteration:")
- layout.prop(itasc, "reiteration", expand=True)
+ layout.prop(itasc, "reiteration_method", expand=True)
split = layout.split()
- split.active = not simulation or itasc.reiteration != 'NEVER'
+ split.active = not simulation or itasc.reiteration_method != 'NEVER'
col = split.column()
col.prop(itasc, "precision")
- if wide_ui:
- col = split.column()
- col.prop(itasc, "num_iter")
+ col = split.column()
+ col.prop(itasc, "iterations")
if simulation:
- layout.prop(itasc, "auto_step")
+ layout.prop(itasc, "use_auto_step")
row = layout.row()
- if itasc.auto_step:
- row.prop(itasc, "min_step", text="Min")
- row.prop(itasc, "max_step", text="Max")
+ if itasc.use_auto_step:
+ row.prop(itasc, "step_min", text="Min")
+ row.prop(itasc, "step_max", text="Max")
else:
- row.prop(itasc, "num_step")
+ row.prop(itasc, "step_count")
layout.prop(itasc, "solver")
if simulation:
layout.prop(itasc, "feedback")
- layout.prop(itasc, "max_velocity")
+ layout.prop(itasc, "velocity_max")
if itasc.solver == 'DLS':
row = layout.row()
- row.prop(itasc, "dampmax", text="Damp", slider=True)
- row.prop(itasc, "dampeps", text="Eps", slider=True)
+ row.prop(itasc, "damping_max", text="Damp", slider=True)
+ row.prop(itasc, "damping_epsilon", text="Eps", slider=True)
+
+from properties_animviz import MotionPathButtonsPanel, OnionSkinButtonsPanel
+
+class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
+ #bl_label = "Bones Motion Paths"
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ # XXX: include posemode check?
+ return (context.object) and (context.armature)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.operator("pose.paths_calculate", text="Calculate Paths")
-# import generic panels from other files
-from properties_animviz import DATA_PT_motion_paths, DATA_PT_onion_skinning
+ col = split.column()
+ col.operator("pose.paths_clear", text="Clear Paths")
+
+
+class DATA_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inherit from panel when ready
+ #bl_label = "Bones Onion Skinning"
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ # XXX: include posemode check?
+ return (context.object) and (context.armature)
-classes = [
- DATA_PT_context_arm,
- DATA_PT_skeleton,
- DATA_PT_display,
- DATA_PT_bone_groups,
- DATA_PT_ghost,
- DATA_PT_iksolver_itasc,
+ def draw(self, context):
+ layout = self.layout
- DATA_PT_motion_paths,
- #DATA_PT_onion_skinning,
+ ob = context.object
- DATA_PT_custom_props_arm]
+ self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
+class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
+
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_armature_rigify.py b/release/scripts/ui/properties_data_armature_rigify.py
index 43021858f9f..1c2370cbb28 100644
--- a/release/scripts/ui/properties_data_armature_rigify.py
+++ b/release/scripts/ui/properties_data_armature_rigify.py
@@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
class PoseTemplateSettings(bpy.types.IDPropertyGroup):
pass
@@ -44,7 +42,8 @@ class DATA_PT_template(bpy.types.Panel):
templates = []
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
if not context.armature:
return False
obj = context.object
@@ -85,7 +84,7 @@ class DATA_PT_template(bpy.types.Panel):
row.operator("pose.metarig_validate", text="Check")
row.operator("pose.metarig_graph", text="Graph")
row = layout.row()
- row.prop(pose_templates, "generate_def_rig")
+ row.prop(pose_templates, "use_generate_deform_rig")
row = layout.row()
col = row.column()
@@ -96,12 +95,13 @@ class DATA_PT_template(bpy.types.Panel):
subsubrow.operator("pose.metarig_assign", text="Assign")
subsubrow.operator("pose.metarig_clear", text="Clear")
- subsubrow = subrow.split(percentage=0.8)
- subsubrow.operator("pose.metarig_sample_add", text="Sample").metarig_type = self.templates[pose_templates.active_template_index]
- subsubrow.operator("pose.metarig_sample_add", text="All").metarig_type = "" # self.templates[pose_templates.active_template_index]
+ if self.templates:
+ subsubrow = subrow.split(percentage=0.8)
+ subsubrow.operator("pose.metarig_sample_add", text="Sample").metarig_type = self.templates[pose_templates.active_template_index]
+ subsubrow.operator("pose.metarig_sample_add", text="All").metarig_type = "" # self.templates[pose_templates.active_template_index]
- sub = row.column(align=True)
- sub.operator("pose.metarig_reload", icon="FILE_REFRESH", text="")
+ sub = row.column(align=True)
+ sub.operator("pose.metarig_reload", icon="FILE_REFRESH", text="")
# operators
@@ -151,7 +151,7 @@ class Generate(bpy.types.Operator):
import rigify
reload(rigify)
- meta_def = context.scene.pose_templates.generate_def_rig
+ meta_def = context.scene.pose_templates.use_generate_deform_rig
try:
rigify.generate_rig(context, context.object, META_DEF=meta_def)
@@ -212,7 +212,7 @@ class Graph(bpy.types.Operator):
import bpy
reload(graphviz_export)
obj = bpy.context.object
- path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.utils.clean_name(obj.name)
+ path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name)
path_dot = path + ".dot"
path_png = path + ".png"
saved = graphviz_export.graph_armature(bpy.context.object, path_dot, CONSTRAINTS=False, DRIVERS=False)
@@ -249,7 +249,7 @@ class AsScript(bpy.types.Operator):
def invoke(self, context, event):
import os
obj = context.object
- self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.utils.clean_name(obj.name) + ".py"
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name) + ".py"
wm = context.manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
@@ -262,7 +262,8 @@ class ActiveAssign(bpy.types.Operator):
bl_idname = "pose.metarig_assign"
bl_label = "Assign to the active posebone"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
bone = context.active_pose_bone
return bool(bone and bone.id_data.mode == 'POSE')
@@ -280,7 +281,8 @@ class ActiveClear(bpy.types.Operator):
bl_idname = "pose.metarig_clear"
bl_label = "Metarig Clear Type"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
bone = context.active_pose_bone
return bool(bone and bone.id_data.mode == 'POSE')
@@ -304,36 +306,14 @@ class INFO_MT_armature_metarig_add(bpy.types.Menu):
layout.operator_context = 'INVOKE_REGION_WIN'
for submodule_type in rigify.get_submodule_types():
- text = bpy.utils.display_name(submodule_type)
+ text = bpy.path.display_name(submodule_type)
layout.operator("pose.metarig_sample_add", text=text, icon='OUTLINER_OB_ARMATURE').metarig_type = submodule_type
-classes = [
- DATA_PT_template,
-
- PoseTemplateSettings,
- PoseTemplate,
-
- Reload,
- Generate,
- Validate,
- Sample,
- Graph,
- AsScript,
-
- ActiveAssign,
- ActiveClear,
-
- INFO_MT_armature_metarig_add]
-
menu_func = (lambda self, context: self.layout.menu("INFO_MT_armature_metarig_add", icon='OUTLINER_OB_ARMATURE'))
import space_info # ensure the menu is loaded first
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
-
PoseTemplate.StringProperty(attr="name",
name="Name of the slave",
description="",
@@ -349,7 +329,7 @@ def register():
min=-1,
max=65535)
- PoseTemplateSettings.BoolProperty(attr="generate_def_rig",
+ PoseTemplateSettings.BoolProperty(attr="use_generate_deform_rig",
name="Create Deform Rig",
description="Create a copy of the metarig, constrainted by the generated rig",
default=False)
@@ -360,11 +340,8 @@ def register():
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
-
- bpy.types.INFO_MT_armature_add.remove(menu_func)
+ bpy.types.Scene.RemoveProperty("pose_templates")
+ space_info.INFO_MT_armature_add.remove(menu_func)
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_bone.py b/release/scripts/ui/properties_data_bone.py
index b6b638ef380..663d576a9c0 100644
--- a/release/scripts/ui/properties_data_bone.py
+++ b/release/scripts/ui/properties_data_bone.py
@@ -20,19 +20,18 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class BoneButtonsPanel(bpy.types.Panel):
+class BoneButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "bone"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.bone or context.edit_bone)
-class BONE_PT_context_bone(BoneButtonsPanel):
+class BONE_PT_context_bone(BoneButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -48,18 +47,7 @@ class BONE_PT_context_bone(BoneButtonsPanel):
row.prop(bone, "name", text="")
-class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel):
-
- @property
- def _context_path(self):
- obj = bpy.context.object
- if obj and obj.mode == 'POSE':
- return "active_pose_bone"
- else:
- return "active_bone"
-
-
-class BONE_PT_transform(BoneButtonsPanel):
+class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Transform"
def draw(self, context):
@@ -67,72 +55,50 @@ class BONE_PT_transform(BoneButtonsPanel):
ob = context.object
bone = context.bone
- wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
- if wide_ui:
- row = layout.row()
- row.column().prop(bone, "head")
- row.column().prop(bone, "tail")
-
- col = row.column()
- sub = col.column(align=True)
- sub.label(text="Roll:")
- sub.prop(bone, "roll", text="")
- sub.label()
- sub.prop(bone, "locked")
- else:
- col = layout.column()
- col.prop(bone, "head")
- col.prop(bone, "tail")
- col.prop(bone, "roll")
- col.prop(bone, "locked")
+ row = layout.row()
+ row.column().prop(bone, "head")
+ row.column().prop(bone, "tail")
+
+ col = row.column()
+ sub = col.column(align=True)
+ sub.label(text="Roll:")
+ sub.prop(bone, "roll", text="")
+ sub.label()
+ sub.prop(bone, "lock")
else:
pchan = ob.pose.bones[context.bone.name]
- if wide_ui:
- row = layout.row()
- col = row.column()
- col.prop(pchan, "location")
- col.active = not (bone.parent and bone.connected)
-
- col = row.column()
- if pchan.rotation_mode == 'QUATERNION':
- col.prop(pchan, "rotation_quaternion", text="Rotation")
- elif pchan.rotation_mode == 'AXIS_ANGLE':
- #col.label(text="Rotation")
- #col.prop(pchan, "rotation_angle", text="Angle")
- #col.prop(pchan, "rotation_axis", text="Axis")
- col.prop(pchan, "rotation_axis_angle", text="Rotation")
- else:
- col.prop(pchan, "rotation_euler", text="Rotation")
-
- row.column().prop(pchan, "scale")
-
- layout.prop(pchan, "rotation_mode")
+ row = layout.row()
+ col = row.column()
+ col.prop(pchan, "location")
+ col.active = not (bone.parent and bone.use_connect)
+
+ col = row.column()
+ if pchan.rotation_mode == 'QUATERNION':
+ col.prop(pchan, "rotation_quaternion", text="Rotation")
+ elif pchan.rotation_mode == 'AXIS_ANGLE':
+ #col.label(text="Rotation")
+ #col.prop(pchan, "rotation_angle", text="Angle")
+ #col.prop(pchan, "rotation_axis", text="Axis")
+ col.prop(pchan, "rotation_axis_angle", text="Rotation")
else:
- col = layout.column()
- sub = col.column()
- sub.active = not (bone.parent and bone.connected)
- sub.prop(pchan, "location")
- col.label(text="Rotation:")
- col.prop(pchan, "rotation_mode", text="")
- if pchan.rotation_mode == 'QUATERNION':
- col.prop(pchan, "rotation_quaternion", text="")
- elif pchan.rotation_mode == 'AXIS_ANGLE':
- col.prop(pchan, "rotation_axis_angle", text="")
- else:
- col.prop(pchan, "rotation_euler", text="")
- col.prop(pchan, "scale")
-
-
-class BONE_PT_transform_locks(BoneButtonsPanel):
+ col.prop(pchan, "rotation_euler", text="Rotation")
+
+ row.column().prop(pchan, "scale")
+
+ layout.prop(pchan, "rotation_mode")
+
+
+class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Transform Locks"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.bone
def draw(self, context):
@@ -145,7 +111,7 @@ class BONE_PT_transform_locks(BoneButtonsPanel):
row = layout.row()
col = row.column()
col.prop(pchan, "lock_location")
- col.active = not (bone.parent and bone.connected)
+ col.active = not (bone.parent and bone.use_connect)
col = row.column()
if pchan.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'):
@@ -159,7 +125,7 @@ class BONE_PT_transform_locks(BoneButtonsPanel):
row.column().prop(pchan, "lock_scale")
-class BONE_PT_relations(BoneButtonsPanel):
+class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Relations"
def draw(self, context):
@@ -168,7 +134,6 @@ class BONE_PT_relations(BoneButtonsPanel):
ob = context.object
bone = context.bone
arm = context.armature
- wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
@@ -180,7 +145,7 @@ class BONE_PT_relations(BoneButtonsPanel):
col = split.column()
col.label(text="Layers:")
- col.prop(bone, "layer", text="")
+ col.prop(bone, "layers", text="")
col.separator()
@@ -188,8 +153,7 @@ class BONE_PT_relations(BoneButtonsPanel):
col.label(text="Bone Group:")
col.prop_object(pchan, "bone_group", ob.pose, "bone_groups", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Parent:")
if context.bone:
col.prop(bone, "parent", text="")
@@ -198,18 +162,19 @@ class BONE_PT_relations(BoneButtonsPanel):
sub = col.column()
sub.active = (bone.parent is not None)
- sub.prop(bone, "connected")
- sub.prop(bone, "hinge", text="Inherit Rotation")
- sub.prop(bone, "inherit_scale", text="Inherit Scale")
+ sub.prop(bone, "use_connect")
+ sub.prop(bone, "use_hinge", text="Inherit Rotation")
+ sub.prop(bone, "use_inherit_scale", text="Inherit Scale")
sub = col.column()
- sub.active = (not bone.parent or not bone.connected)
- sub.prop(bone, "local_location", text="Local Location")
+ sub.active = (not bone.parent or not bone.use_connect)
+ sub.prop(bone, "use_local_location", text="Local Location")
-class BONE_PT_display(BoneButtonsPanel):
+class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Display"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.bone
def draw(self, context):
@@ -217,7 +182,6 @@ class BONE_PT_display(BoneButtonsPanel):
ob = context.object
bone = context.bone
- wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
@@ -230,11 +194,10 @@ class BONE_PT_display(BoneButtonsPanel):
split = layout.split()
col = split.column()
- col.prop(bone, "draw_wire", text="Wireframe")
- col.prop(bone, "hidden", text="Hide")
+ col.prop(bone, "show_wire", text="Wireframe")
+ col.prop(bone, "hide", text="Hide")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Custom Shape:")
col.prop(pchan, "custom_shape", text="")
@@ -242,11 +205,12 @@ class BONE_PT_display(BoneButtonsPanel):
col.prop_object(pchan, "custom_shape_transform", ob.pose, "bones", text="At")
-class BONE_PT_inverse_kinematics(BoneButtonsPanel):
+class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Inverse Kinematics"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.active_pose_bone
def draw(self, context):
@@ -255,92 +219,81 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel):
ob = context.object
bone = context.bone
pchan = ob.pose.bones[bone.name]
- wide_ui = context.region.width > narrowui
row = layout.row()
row.prop(ob.pose, "ik_solver")
split = layout.split(percentage=0.25)
- split.prop(pchan, "ik_dof_x", text="X")
- split.active = pchan.has_ik
+ split.prop(pchan, "lock_ik_x", text="Lock X")
+ split.active = pchan.is_in_ik_chain
row = split.row()
row.prop(pchan, "ik_stiffness_x", text="Stiffness", slider=True)
- row.active = pchan.ik_dof_x and pchan.has_ik
+ row.active = pchan.lock_ik_x == False and pchan.is_in_ik_chain
- if wide_ui:
- split = layout.split(percentage=0.25)
- sub = split.row()
- else:
- sub = layout.column(align=True)
- sub.prop(pchan, "ik_limit_x", text="Limit")
- sub.active = pchan.ik_dof_x and pchan.has_ik
- if wide_ui:
- sub = split.row(align=True)
+ split = layout.split(percentage=0.25)
+ sub = split.row()
+
+ sub.prop(pchan, "use_ik_limit_x", text="Limit")
+ sub.active = pchan.lock_ik_x == False and pchan.is_in_ik_chain
+ sub = split.row(align=True)
sub.prop(pchan, "ik_min_x", text="")
sub.prop(pchan, "ik_max_x", text="")
- sub.active = pchan.ik_dof_x and pchan.ik_limit_x and pchan.has_ik
+ sub.active = pchan.lock_ik_x == False and pchan.use_ik_limit_x and pchan.is_in_ik_chain
split = layout.split(percentage=0.25)
- split.prop(pchan, "ik_dof_y", text="Y")
- split.active = pchan.has_ik and pchan.has_ik
+ split.prop(pchan, "lock_ik_y", text="Y")
+ split.active = pchan.is_in_ik_chain and pchan.is_in_ik_chain
row = split.row()
row.prop(pchan, "ik_stiffness_y", text="Stiffness", slider=True)
- row.active = pchan.ik_dof_y and pchan.has_ik
+ row.active = pchan.lock_ik_y == False and pchan.is_in_ik_chain
- if wide_ui:
- split = layout.split(percentage=0.25)
- sub = split.row()
- else:
- sub = layout.column(align=True)
- sub.prop(pchan, "ik_limit_y", text="Limit")
- sub.active = pchan.ik_dof_y and pchan.has_ik
- if wide_ui:
- sub = split.row(align=True)
+ split = layout.split(percentage=0.25)
+ sub = split.row()
+
+ sub.prop(pchan, "use_ik_limit_y", text="Limit")
+ sub.active = pchan.lock_ik_y == False and pchan.is_in_ik_chain
+
+ sub = split.row(align=True)
sub.prop(pchan, "ik_min_y", text="")
sub.prop(pchan, "ik_max_y", text="")
- sub.active = pchan.ik_dof_y and pchan.ik_limit_y and pchan.has_ik
+ sub.active = pchan.lock_ik_y == False and pchan.use_ik_limit_y and pchan.is_in_ik_chain
split = layout.split(percentage=0.25)
- split.prop(pchan, "ik_dof_z", text="Z")
- split.active = pchan.has_ik and pchan.has_ik
+ split.prop(pchan, "lock_ik_z", text="Z")
+ split.active = pchan.is_in_ik_chain and pchan.is_in_ik_chain
sub = split.row()
sub.prop(pchan, "ik_stiffness_z", text="Stiffness", slider=True)
- sub.active = pchan.ik_dof_z and pchan.has_ik
+ sub.active = pchan.lock_ik_z == False and pchan.is_in_ik_chain
- if wide_ui:
- split = layout.split(percentage=0.25)
- sub = split.row()
- else:
- sub = layout.column(align=True)
- sub.prop(pchan, "ik_limit_z", text="Limit")
- sub.active = pchan.ik_dof_z and pchan.has_ik
- if wide_ui:
- sub = split.row(align=True)
+ split = layout.split(percentage=0.25)
+ sub = split.row()
+
+ sub.prop(pchan, "use_ik_limit_z", text="Limit")
+ sub.active = pchan.lock_ik_z == False and pchan.is_in_ik_chain
+ sub = split.row(align=True)
sub.prop(pchan, "ik_min_z", text="")
sub.prop(pchan, "ik_max_z", text="")
- sub.active = pchan.ik_dof_z and pchan.ik_limit_z and pchan.has_ik
+ sub.active = pchan.lock_ik_z == False and pchan.use_ik_limit_z and pchan.is_in_ik_chain
split = layout.split()
split.prop(pchan, "ik_stretch", text="Stretch", slider=True)
- if wide_ui:
- split.label()
- split.active = pchan.has_ik
+ split.label()
+ split.active = pchan.is_in_ik_chain
if ob.pose.ik_solver == 'ITASC':
split = layout.split()
col = split.column()
- col.prop(pchan, "ik_rot_control", text="Control Rotation")
- col.active = pchan.has_ik
- if wide_ui:
- col = split.column()
- col.prop(pchan, "ik_rot_weight", text="Weight", slider=True)
- col.active = pchan.has_ik
+ col.prop(pchan, "use_ik_rotation_control", text="Control Rotation")
+ col.active = pchan.is_in_ik_chain
+ col = split.column()
+ col.prop(pchan, "ik_rotation_weight", text="Weight", slider=True)
+ col.active = pchan.is_in_ik_chain
# not supported yet
#row = layout.row()
- #row.prop(pchan, "ik_lin_control", text="Joint Size")
- #row.prop(pchan, "ik_lin_weight", text="Weight", slider=True)
+ #row.prop(pchan, "use_ik_linear_control", text="Joint Size")
+ #row.prop(pchan, "ik_linear_weight", text="Weight", slider=True)
-class BONE_PT_deform(BoneButtonsPanel):
+class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Deform"
bl_default_closed = True
@@ -350,18 +303,17 @@ class BONE_PT_deform(BoneButtonsPanel):
if not bone:
bone = context.edit_bone
- self.layout.prop(bone, "deform", text="")
+ self.layout.prop(bone, "use_deform", text="")
def draw(self, context):
layout = self.layout
bone = context.bone
- wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
- layout.active = bone.deform
+ layout.active = bone.use_deform
split = layout.split()
@@ -371,15 +323,14 @@ class BONE_PT_deform(BoneButtonsPanel):
sub = col.column(align=True)
sub.prop(bone, "envelope_distance", text="Distance")
sub.prop(bone, "envelope_weight", text="Weight")
- col.prop(bone, "multiply_vertexgroup_with_envelope", text="Multiply")
+ col.prop(bone, "use_envelope_multiply", text="Multiply")
sub = col.column(align=True)
sub.label(text="Radius:")
sub.prop(bone, "head_radius", text="Head")
sub.prop(bone, "tail_radius", text="Tail")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Curved Bones:")
sub = col.column(align=True)
@@ -388,30 +339,27 @@ class BONE_PT_deform(BoneButtonsPanel):
sub.prop(bone, "bbone_out", text="Ease Out")
col.label(text="Offset:")
- col.prop(bone, "cyclic_offset")
+ col.prop(bone, "use_cyclic_offset")
-classes = [
- BONE_PT_context_bone,
- BONE_PT_transform,
- BONE_PT_transform_locks,
- BONE_PT_relations,
- BONE_PT_display,
- BONE_PT_inverse_kinematics,
- BONE_PT_deform,
- BONE_PT_custom_props]
+class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @property
+ def _context_path(self):
+ obj = bpy.context.object
+ if obj and obj.mode == 'POSE':
+ return "active_pose_bone"
+ else:
+ return "active_bone"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_camera.py b/release/scripts/ui/properties_data_camera.py
index 3abd460c427..1e4ec6deb18 100644
--- a/release/scripts/ui/properties_data_camera.py
+++ b/release/scripts/ui/properties_data_camera.py
@@ -20,20 +20,19 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class CameraButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return context.camera and (engine in self.COMPAT_ENGINES)
+ return context.camera and (engine in cls.COMPAT_ENGINES)
-class DATA_PT_context_camera(DataButtonsPanel):
+class DATA_PT_context_camera(CameraButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -44,29 +43,17 @@ class DATA_PT_context_camera(DataButtonsPanel):
ob = context.object
cam = context.camera
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif cam:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "data")
- elif cam:
- layout.template_ID(space, "pin_id")
-
-
-class DATA_PT_custom_props_camera(DataButtonsPanel, PropertyPanel):
- _context_path = "object.data"
- COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif cam:
+ split.template_ID(space, "pin_id")
+ split.separator()
-class DATA_PT_camera(DataButtonsPanel):
+class DATA_PT_camera(CameraButtonsPanel, bpy.types.Panel):
bl_label = "Lens"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -74,12 +61,8 @@ class DATA_PT_camera(DataButtonsPanel):
layout = self.layout
cam = context.camera
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(cam, "type", expand=True)
- else:
- layout.prop(cam, "type", text="")
+ layout.prop(cam, "type", expand=True)
split = layout.split()
@@ -89,14 +72,13 @@ class DATA_PT_camera(DataButtonsPanel):
col.prop(cam, "lens", text="Angle")
elif cam.lens_unit == 'DEGREES':
col.prop(cam, "angle")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(cam, "lens_unit", text="")
elif cam.type == 'ORTHO':
col.prop(cam, "ortho_scale")
- layout.prop(cam, "panorama")
+ layout.prop(cam, "use_panorama")
split = layout.split()
@@ -105,8 +87,7 @@ class DATA_PT_camera(DataButtonsPanel):
col.prop(cam, "shift_x", text="X")
col.prop(cam, "shift_y", text="Y")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Clipping:")
col.prop(cam, "clip_start", text="Start")
col.prop(cam, "clip_end", text="End")
@@ -118,16 +99,14 @@ class DATA_PT_camera(DataButtonsPanel):
col = split.column()
col.prop(cam, "dof_object", text="")
- if wide_ui:
- col = split.column()
- else:
- col = col.column()
+ col = split.column()
+
if cam.dof_object != None:
col.enabled = False
col.prop(cam, "dof_distance", text="Distance")
-class DATA_PT_camera_display(DataButtonsPanel):
+class DATA_PT_camera_display(CameraButtonsPanel, bpy.types.Panel):
bl_label = "Display"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -135,7 +114,6 @@ class DATA_PT_camera_display(DataButtonsPanel):
layout = self.layout
cam = context.camera
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -145,8 +123,7 @@ class DATA_PT_camera_display(DataButtonsPanel):
col.prop(cam, "show_title_safe", text="Title Safe")
col.prop(cam, "show_name", text="Name")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(cam, "draw_size", text="Size")
col.separator()
col.prop(cam, "show_passepartout", text="Passepartout")
@@ -155,24 +132,17 @@ class DATA_PT_camera_display(DataButtonsPanel):
sub.prop(cam, "passepartout_alpha", text="Alpha", slider=True)
-classes = [
- DATA_PT_context_camera,
- DATA_PT_camera,
- DATA_PT_camera_display,
-
- DATA_PT_custom_props_camera]
+class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_curve.py b/release/scripts/ui/properties_data_curve.py
index fd836f5e5d4..3008db11b36 100644
--- a/release/scripts/ui/properties_data_curve.py
+++ b/release/scripts/ui/properties_data_curve.py
@@ -20,34 +20,35 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class CurveButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type in ('CURVE', 'SURFACE', 'TEXT') and context.curve)
-class DataButtonsPanelCurve(DataButtonsPanel):
+class CurveButtonsPanelCurve(CurveButtonsPanel):
'''Same as above but for curves only'''
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'CURVE' and context.curve)
-class DataButtonsPanelActive(DataButtonsPanel):
+class CurveButtonsPanelActive(CurveButtonsPanel):
'''Same as above but for curves only'''
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
curve = context.curve
return (curve and type(curve) is not bpy.types.TextCurve and curve.splines.active)
-class DATA_PT_context_curve(DataButtonsPanel):
+class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -57,27 +58,18 @@ class DATA_PT_context_curve(DataButtonsPanel):
ob = context.object
curve = context.curve
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
+ split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif curve:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- layout.template_ID(ob, "data")
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif curve:
+ split.template_ID(space, "pin_id")
+ split.separator()
-class DATA_PT_custom_props_curve(DataButtonsPanel, PropertyPanel):
- _context_path = "object.data"
-
-
-class DATA_PT_shape_curve(DataButtonsPanel):
+class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Shape"
def draw(self, context):
@@ -85,7 +77,6 @@ class DATA_PT_shape_curve(DataButtonsPanel):
ob = context.object
curve = context.curve
- wide_ui = context.region.width > narrowui
is_surf = (ob.type == 'SURFACE')
is_curve = (ob.type == 'CURVE')
is_text = (ob.type == 'TEXT')
@@ -107,10 +98,9 @@ class DATA_PT_shape_curve(DataButtonsPanel):
col.prop(curve, "twist_smooth", text="Smooth")
if is_text:
col.label(text="Display:")
- col.prop(curve, "fast", text="Fast Editing")
+ col.prop(curve, "use_fast_edit", text="Fast Editing")
- if wide_ui:
- col = split.column()
+ col = split.column()
if is_surf:
sub = col.column(align=True)
@@ -121,19 +111,20 @@ class DATA_PT_shape_curve(DataButtonsPanel):
if is_curve or is_text:
sub = col.column()
sub.label(text="Caps:")
- sub.prop(curve, "front")
- sub.prop(curve, "back")
- sub.prop(curve, "use_deform_fill")
+ sub.prop(curve, "use_fill_front")
+ sub.prop(curve, "use_fill_back")
+ sub.prop(curve, "use_fill_deform")
col.label(text="Textures:")
- col.prop(curve, "map_along_length")
- col.prop(curve, "auto_texspace")
+ col.prop(curve, "use_map_on_length")
+ col.prop(curve, "use_auto_texspace")
-class DATA_PT_geometry_curve(DataButtonsPanel):
+class DATA_PT_geometry_curve(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Geometry"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
obj = context.object
if obj and obj.type == 'SURFACE':
return False
@@ -144,19 +135,17 @@ class DATA_PT_geometry_curve(DataButtonsPanel):
layout = self.layout
curve = context.curve
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.label(text="Modification:")
- col.prop(curve, "width")
+ col.prop(curve, "offset")
col.prop(curve, "extrude")
col.label(text="Taper Object:")
col.prop(curve, "taper_object", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Bevel:")
col.prop(curve, "bevel_depth", text="Depth")
col.prop(curve, "bevel_resolution", text="Resolution")
@@ -164,7 +153,7 @@ class DATA_PT_geometry_curve(DataButtonsPanel):
col.prop(curve, "bevel_object", text="")
-class DATA_PT_pathanim(DataButtonsPanelCurve):
+class DATA_PT_pathanim(CurveButtonsPanelCurve, bpy.types.Panel):
bl_label = "Path Animation"
def draw_header(self, context):
@@ -176,12 +165,11 @@ class DATA_PT_pathanim(DataButtonsPanelCurve):
layout = self.layout
curve = context.curve
- wide_ui = context.region.width > narrowui
layout.active = curve.use_path
col = layout.column()
- layout.prop(curve, "path_length", text="Frames")
+ layout.prop(curve, "path_duration", text="Frames")
layout.prop(curve, "eval_time")
split = layout.split()
@@ -189,14 +177,14 @@ class DATA_PT_pathanim(DataButtonsPanelCurve):
col = split.column()
col.prop(curve, "use_path_follow")
col.prop(curve, "use_stretch")
+ col.prop(curve, "use_deform_bounds")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(curve, "use_radius")
col.prop(curve, "use_time_offset", text="Offset Children")
-class DATA_PT_active_spline(DataButtonsPanelActive):
+class DATA_PT_active_spline(CurveButtonsPanelActive, bpy.types.Panel):
bl_label = "Active Spline"
def draw(self, context):
@@ -215,9 +203,9 @@ class DATA_PT_active_spline(DataButtonsPanelActive):
# poly's set aside since they use so few settings
col = split.column()
col.label(text="Cyclic:")
- col.prop(act_spline, "smooth")
+ col.prop(act_spline, "use_smooth")
col = split.column()
- col.prop(act_spline, "cyclic_u", text="U")
+ col.prop(act_spline, "use_cyclic_u", text="U")
else:
col = split.column()
@@ -230,13 +218,13 @@ class DATA_PT_active_spline(DataButtonsPanelActive):
col.label(text="Resolution:")
col = split.column()
- col.prop(act_spline, "cyclic_u", text="U")
+ col.prop(act_spline, "use_cyclic_u", text="U")
if act_spline.type == 'NURBS':
sub = col.column()
- # sub.active = (not act_spline.cyclic_u)
- sub.prop(act_spline, "bezier_u", text="U")
- sub.prop(act_spline, "endpoint_u", text="U")
+ # sub.active = (not act_spline.use_cyclic_u)
+ sub.prop(act_spline, "use_bezier_u", text="U")
+ sub.prop(act_spline, "use_endpoint_u", text="U")
sub = col.column()
sub.prop(act_spline, "order_u", text="U")
@@ -244,13 +232,13 @@ class DATA_PT_active_spline(DataButtonsPanelActive):
if is_surf:
col = split.column()
- col.prop(act_spline, "cyclic_v", text="V")
+ col.prop(act_spline, "use_cyclic_v", text="V")
# its a surface, assume its a nurb.
sub = col.column()
- sub.active = (not act_spline.cyclic_v)
- sub.prop(act_spline, "bezier_v", text="V")
- sub.prop(act_spline, "endpoint_v", text="V")
+ sub.active = (not act_spline.use_cyclic_v)
+ sub.prop(act_spline, "use_bezier_v", text="V")
+ sub.prop(act_spline, "use_endpoint_v", text="V")
sub = col.column()
sub.prop(act_spline, "order_v", text="V")
sub.prop(act_spline, "resolution_v", text="V")
@@ -264,13 +252,14 @@ class DATA_PT_active_spline(DataButtonsPanelActive):
col.prop(act_spline, "tilt_interpolation", text="Tilt")
col.prop(act_spline, "radius_interpolation", text="Radius")
- layout.prop(act_spline, "smooth")
+ layout.prop(act_spline, "use_smooth")
-class DATA_PT_font(DataButtonsPanel):
+class DATA_PT_font(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Font"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'TEXT' and context.curve)
def draw(self, context):
@@ -278,21 +267,16 @@ class DATA_PT_font(DataButtonsPanel):
text = context.curve
char = context.curve.edit_format
- wide_ui = context.region.width > narrowui
layout.template_ID(text, "font", open="font.open", unlink="font.unlink")
- #if wide_ui:
- # layout.prop(text, "font")
- #else:
- # layout.prop(text, "font", text="")
+ #layout.prop(text, "font")
split = layout.split()
col = split.column()
- col.prop(text, "text_size", text="Size")
- if wide_ui:
- col = split.column()
+ col.prop(text, "size", text="Size")
+ col = split.column()
col.prop(text, "shear")
split = layout.split()
@@ -301,25 +285,23 @@ class DATA_PT_font(DataButtonsPanel):
col.label(text="Object Font:")
col.prop(text, "family", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Text on Curve:")
- col.prop(text, "text_on_curve", text="")
+ col.prop(text, "follow_curve", text="")
split = layout.split()
col = split.column()
colsub = col.column(align=True)
colsub.label(text="Underline:")
- colsub.prop(text, "ul_position", text="Position")
- colsub.prop(text, "ul_height", text="Thickness")
+ colsub.prop(text, "underline_position", text="Position")
+ colsub.prop(text, "underline_height", text="Thickness")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Character:")
- col.prop(char, "bold")
- col.prop(char, "italic")
- col.prop(char, "underline")
+ col.prop(char, "use_bold")
+ col.prop(char, "use_italic")
+ col.prop(char, "use_underline")
split = layout.split()
col = split.column()
@@ -329,58 +311,53 @@ class DATA_PT_font(DataButtonsPanel):
col.prop(char, "use_small_caps")
-class DATA_PT_paragraph(DataButtonsPanel):
+class DATA_PT_paragraph(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Paragraph"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'TEXT' and context.curve)
def draw(self, context):
layout = self.layout
text = context.curve
- wide_ui = context.region.width > narrowui
layout.label(text="Align:")
- if wide_ui:
- layout.prop(text, "spacemode", expand=True)
- else:
- layout.prop(text, "spacemode", text="")
+ layout.prop(text, "align", expand=True)
split = layout.split()
col = split.column(align=True)
col.label(text="Spacing:")
- col.prop(text, "spacing", text="Character")
- col.prop(text, "word_spacing", text="Word")
- col.prop(text, "line_dist", text="Line")
+ col.prop(text, "space_character", text="Character")
+ col.prop(text, "space_word", text="Word")
+ col.prop(text, "space_line", text="Line")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Offset:")
col.prop(text, "offset_x", text="X")
col.prop(text, "offset_y", text="Y")
-class DATA_PT_textboxes(DataButtonsPanel):
+class DATA_PT_textboxes(CurveButtonsPanel, bpy.types.Panel):
bl_label = "Text Boxes"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'TEXT' and context.curve)
def draw(self, context):
layout = self.layout
text = context.curve
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.operator("font.textbox_add", icon='ZOOMIN')
- if wide_ui:
- col = split.column()
+ col = split.column()
- for i, box in enumerate(text.textboxes):
+ for i, box in enumerate(text.text_boxes):
boxy = layout.box()
@@ -394,8 +371,7 @@ class DATA_PT_textboxes(DataButtonsPanel):
col.prop(box, "width", text="Width")
col.prop(box, "height", text="Height")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Offset:")
col.prop(box, "x", text="X")
@@ -404,29 +380,17 @@ class DATA_PT_textboxes(DataButtonsPanel):
row.operator("font.textbox_remove", text='', icon='X', emboss=False).index = i
-classes = [
- DATA_PT_context_curve,
- DATA_PT_shape_curve,
- DATA_PT_geometry_curve,
- DATA_PT_pathanim,
- DATA_PT_active_spline,
- DATA_PT_font,
- DATA_PT_paragraph,
- DATA_PT_textboxes,
-
- DATA_PT_custom_props_curve]
+class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_empty.py b/release/scripts/ui/properties_data_empty.py
index 577e32ed840..bf2f3b3d0ba 100644
--- a/release/scripts/ui/properties_data_empty.py
+++ b/release/scripts/ui/properties_data_empty.py
@@ -19,49 +19,37 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object and context.object.type == 'EMPTY')
-class DATA_PT_empty(DataButtonsPanel):
+class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel):
bl_label = "Empty"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(ob, "empty_draw_type", text="Display")
- else:
- layout.prop(ob, "empty_draw_type", text="")
+ layout.prop(ob, "empty_draw_type", text="Display")
layout.prop(ob, "empty_draw_size", text="Size")
-classes = [
- DATA_PT_empty]
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_lamp.py b/release/scripts/ui/properties_data_lamp.py
index 14493301b1e..ce0d404434d 100644
--- a/release/scripts/ui/properties_data_lamp.py
+++ b/release/scripts/ui/properties_data_lamp.py
@@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
class LAMP_MT_sunsky_presets(bpy.types.Menu):
bl_label = "Sun & Sky Presets"
@@ -31,25 +29,18 @@ class LAMP_MT_sunsky_presets(bpy.types.Menu):
draw = bpy.types.Menu.draw_preset
-class DataButtonsPanel(bpy.types.Panel):
+class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return context.lamp and (engine in self.COMPAT_ENGINES)
-
-
-class DATA_PT_preview(DataButtonsPanel):
- bl_label = "Preview"
- COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
-
- def draw(self, context):
- self.layout.template_preview(context.lamp)
+ return context.lamp and (engine in cls.COMPAT_ENGINES)
-class DATA_PT_context_lamp(DataButtonsPanel):
+class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -60,29 +51,26 @@ class DATA_PT_context_lamp(DataButtonsPanel):
ob = context.object
lamp = context.lamp
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif lamp:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "data")
- elif lamp:
- layout.template_ID(space, "pin_id")
-
-
-class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel):
- _context_path = "object.data"
+
+ split = layout.split(percentage=0.65)
+
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif lamp:
+ split.template_ID(space, "pin_id")
+ split.separator()
+
+
+class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ def draw(self, context):
+ self.layout.template_preview(context.lamp)
-class DATA_PT_lamp(DataButtonsPanel):
+
+class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel):
bl_label = "Lamp"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -90,12 +78,8 @@ class DATA_PT_lamp(DataButtonsPanel):
layout = self.layout
lamp = context.lamp
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(lamp, "type", expand=True)
- else:
- layout.prop(lamp, "type", text="")
+ layout.prop(lamp, "type", expand=True)
split = layout.split()
@@ -115,34 +99,33 @@ class DATA_PT_lamp(DataButtonsPanel):
sub.prop(lamp, "linear_attenuation", slider=True, text="Linear")
sub.prop(lamp, "quadratic_attenuation", slider=True, text="Quadratic")
- col.prop(lamp, "sphere")
+ col.prop(lamp, "use_sphere")
if lamp.type == 'AREA':
col.prop(lamp, "distance")
col.prop(lamp, "gamma")
- if wide_ui:
- col = split.column()
- col.prop(lamp, "negative")
- col.prop(lamp, "layer", text="This Layer Only")
- col.prop(lamp, "specular")
- col.prop(lamp, "diffuse")
+ col = split.column()
+ col.prop(lamp, "use_negative")
+ col.prop(lamp, "use_own_layer", text="This Layer Only")
+ col.prop(lamp, "use_specular")
+ col.prop(lamp, "use_diffuse")
-class DATA_PT_sunsky(DataButtonsPanel):
+class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel):
bl_label = "Sky & Atmosphere"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
- return (lamp and lamp.type == 'SUN') and (engine in self.COMPAT_ENGINES)
+ return (lamp and lamp.type == 'SUN') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
lamp = context.lamp.sky
- wide_ui = context.region.width > narrowui
row = layout.row(align=True)
row.prop(lamp, "use_sky")
@@ -167,8 +150,7 @@ class DATA_PT_sunsky(DataButtonsPanel):
sub.row().prop(lamp, "sky_color_space", expand=True)
sub.prop(lamp, "sky_exposure", text="Exposure")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.active = lamp.use_sky
col.label(text="Horizon:")
sub = col.column()
@@ -193,8 +175,7 @@ class DATA_PT_sunsky(DataButtonsPanel):
col.prop(lamp, "sun_intensity", text="Sun")
col.prop(lamp, "atmosphere_distance_factor", text="Distance")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.active = lamp.use_atmosphere
col.label(text="Scattering:")
sub = col.column(align=True)
@@ -202,25 +183,36 @@ class DATA_PT_sunsky(DataButtonsPanel):
sub.prop(lamp, "atmosphere_extinction", slider=True, text="Extinction")
-class DATA_PT_shadow(DataButtonsPanel):
+class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
bl_label = "Shadow"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
- return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in self.COMPAT_ENGINES)
+ return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
lamp = context.lamp
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(lamp, "shadow_method", expand=True)
- else:
- layout.prop(lamp, "shadow_method", text="")
+ layout.prop(lamp, "shadow_method", expand=True)
+
+ if lamp.shadow_method == 'NOSHADOW' and lamp.type == 'AREA':
+ split = layout.split()
+
+ col= split.column()
+ col.label(text="Form factor sampling:")
+
+ sub=col.row(align=True)
+
+ if lamp.shape == 'SQUARE':
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
+ elif lamp.shape == 'RECTANGLE':
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
+ sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
if lamp.shadow_method != 'NOSHADOW':
split = layout.split()
@@ -228,65 +220,51 @@ class DATA_PT_shadow(DataButtonsPanel):
col = split.column()
col.prop(lamp, "shadow_color", text="")
- if wide_ui:
- col = split.column()
- col.prop(lamp, "shadow_layer", text="This Layer Only")
- col.prop(lamp, "only_shadow")
+ col = split.column()
+ col.prop(lamp, "use_shadow_layer", text="This Layer Only")
+ col.prop(lamp, "use_only_shadow")
if lamp.shadow_method == 'RAY_SHADOW':
- col = layout.column()
+ split = layout.split()
+
+ col = split.column()
col.label(text="Sampling:")
- if wide_ui:
- col.row().prop(lamp, "shadow_ray_sampling_method", expand=True)
- else:
- col.prop(lamp, "shadow_ray_sampling_method", text="")
-
+
if lamp.type in ('POINT', 'SUN', 'SPOT'):
- split = layout.split()
-
- col = split.column()
- col.prop(lamp, "shadow_soft_size", text="Soft Size")
-
- col.prop(lamp, "shadow_ray_samples", text="Samples")
- if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
- col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
- if wide_ui:
- col = split.column()
-
+ sub = col.row()
+
+ sub.prop(lamp, "shadow_ray_samples", text="Samples")
+ sub.prop(lamp, "shadow_soft_size", text="Soft Size")
+
elif lamp.type == 'AREA':
- split = layout.split()
-
- col = split.column()
-
+ sub = col.row(align=True)
+
if lamp.shape == 'SQUARE':
- col.prop(lamp, "shadow_ray_samples_x", text="Samples")
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
elif lamp.shape == 'RECTANGLE':
- col.prop(lamp, "shadow_ray_samples_x", text="Samples X")
- col.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
-
- if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
- col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
- if wide_ui:
- col = split.column()
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
+ sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
- elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
- if wide_ui:
- col = split.column()
- col.prop(lamp, "umbra")
- col.prop(lamp, "dither")
- col.prop(lamp, "jitter")
- else:
- if wide_ui:
- col = split.column()
+ col.row().prop(lamp, "shadow_ray_sample_method", expand=True)
+ split = layout.split()
+ col = split.column()
+
+ if lamp.shadow_ray_sample_method == 'ADAPTIVE_QMC':
+ col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
+ col = split.column()
+
+ if lamp.type == 'AREA' and lamp.shadow_ray_sample_method == 'CONSTANT_JITTERED':
+ col = split.column()
+ col = split.column()
+ col.prop(lamp, "use_umbra")
+ col.prop(lamp, "use_dither")
+ col.prop(lamp, "use_jitter")
elif lamp.shadow_method == 'BUFFER_SHADOW':
col = layout.column()
col.label(text="Buffer Type:")
- if wide_ui:
- col.row().prop(lamp, "shadow_buffer_type", expand=True)
- else:
- col.row().prop(lamp, "shadow_buffer_type", text="")
+ col.row().prop(lamp, "shadow_buffer_type", expand=True)
if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY', 'DEEP'):
split = layout.split()
@@ -298,8 +276,7 @@ class DATA_PT_shadow(DataButtonsPanel):
sub.prop(lamp, "shadow_buffer_soft", text="Soft")
sub.prop(lamp, "shadow_buffer_bias", text="Bias")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Sample Buffers:")
col.prop(lamp, "shadow_sample_buffers", text="")
sub = col.column(align=True)
@@ -314,39 +291,39 @@ class DATA_PT_shadow(DataButtonsPanel):
split = layout.split()
col = split.column()
- col.prop(lamp, "auto_clip_start", text="Autoclip Start")
+ col.prop(lamp, "use_auto_clip_start", text="Autoclip Start")
sub = col.column()
- sub.active = not lamp.auto_clip_start
+ sub.active = not lamp.use_auto_clip_start
sub.prop(lamp, "shadow_buffer_clip_start", text="Clip Start")
- if wide_ui:
- col = split.column()
- col.prop(lamp, "auto_clip_end", text="Autoclip End")
+ col = split.column()
+ col.prop(lamp, "use_auto_clip_end", text="Autoclip End")
sub = col.column()
- sub.active = not lamp.auto_clip_end
+ sub.active = not lamp.use_auto_clip_end
sub.prop(lamp, "shadow_buffer_clip_end", text=" Clip End")
-class DATA_PT_area(DataButtonsPanel):
+class DATA_PT_area(DataButtonsPanel, bpy.types.Panel):
bl_label = "Area Shape"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
- return (lamp and lamp.type == 'AREA') and (engine in self.COMPAT_ENGINES)
+ return (lamp and lamp.type == 'AREA') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
- layout = self.layout
-
lamp = context.lamp
+ layout = self.layout
split = layout.split()
col = split.column()
+
col.row().prop(lamp, "shape", expand=True)
+ sub = col.row(align=True)
- sub = col.column(align=True)
if (lamp.shape == 'SQUARE'):
sub.prop(lamp, "size")
elif (lamp.shape == 'RECTANGLE'):
@@ -354,20 +331,20 @@ class DATA_PT_area(DataButtonsPanel):
sub.prop(lamp, "size_y", text="Size Y")
-class DATA_PT_spot(DataButtonsPanel):
+class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel):
bl_label = "Spot Shape"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
- return (lamp and lamp.type == 'SPOT') and (engine in self.COMPAT_ENGINES)
+ return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
lamp = context.lamp
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -375,31 +352,30 @@ class DATA_PT_spot(DataButtonsPanel):
sub = col.column()
sub.prop(lamp, "spot_size", text="Size")
sub.prop(lamp, "spot_blend", text="Blend", slider=True)
- col.prop(lamp, "square")
+ col.prop(lamp, "use_square")
col.prop(lamp, "show_cone")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
- col.prop(lamp, "halo")
+ col = split.column()
+
+ col.prop(lamp, "use_halo")
sub = col.column(align=True)
- sub.active = lamp.halo
+ sub.active = lamp.use_halo
sub.prop(lamp, "halo_intensity", text="Intensity")
if lamp.shadow_method == 'BUFFER_SHADOW':
sub.prop(lamp, "halo_step", text="Step")
-class DATA_PT_falloff_curve(DataButtonsPanel):
+class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel):
bl_label = "Falloff Curve"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
- return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in self.COMPAT_ENGINES)
+ return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
lamp = context.lamp
@@ -407,31 +383,17 @@ class DATA_PT_falloff_curve(DataButtonsPanel):
self.layout.template_curve_mapping(lamp, "falloff_curve")
-classes = [
- LAMP_MT_sunsky_presets,
-
- DATA_PT_context_lamp,
- DATA_PT_preview,
- DATA_PT_lamp,
- DATA_PT_falloff_curve,
- DATA_PT_area,
- DATA_PT_spot,
- DATA_PT_shadow,
- DATA_PT_sunsky,
-
- DATA_PT_custom_props_lamp]
+class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_lattice.py b/release/scripts/ui/properties_data_lattice.py
index 2aa719437a7..9abdb23ea23 100644
--- a/release/scripts/ui/properties_data_lattice.py
+++ b/release/scripts/ui/properties_data_lattice.py
@@ -20,19 +20,18 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.lattice
-class DATA_PT_context_lattice(DataButtonsPanel):
+class DATA_PT_context_lattice(DataButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -42,79 +41,58 @@ class DATA_PT_context_lattice(DataButtonsPanel):
ob = context.object
lat = context.lattice
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif lat:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "data")
- elif lat:
- layout.template_ID(space, "pin_id")
-
-
-class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel):
- _context_path = "object.data"
+
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif lat:
+ split.template_ID(space, "pin_id")
+ split.separator()
-class DATA_PT_lattice(DataButtonsPanel):
+class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
bl_label = "Lattice"
def draw(self, context):
layout = self.layout
lat = context.lattice
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(lat, "points_u")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(lat, "interpolation_type_u", text="")
split = layout.split()
col = split.column()
col.prop(lat, "points_v")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(lat, "interpolation_type_v", text="")
split = layout.split()
col = split.column()
col.prop(lat, "points_w")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(lat, "interpolation_type_w", text="")
row = layout.row()
- row.prop(lat, "outside")
+ row.prop(lat, "use_outside")
row.prop_object(lat, "vertex_group", context.object, "vertex_groups", text="")
+
-
-classes = [
- DATA_PT_context_lattice,
- DATA_PT_lattice,
-
- DATA_PT_custom_props_lattice]
+class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py
index 44d3d19e793..aaf70692681 100644
--- a/release/scripts/ui/properties_data_mesh.py
+++ b/release/scripts/ui/properties_data_mesh.py
@@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
class MESH_MT_vertex_group_specials(bpy.types.Menu):
bl_label = "Vertex Group Specials"
@@ -49,17 +47,18 @@ class MESH_MT_shape_key_specials(bpy.types.Menu):
layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT')
-class DataButtonsPanel(bpy.types.Panel):
+class MeshButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return context.mesh and (engine in self.COMPAT_ENGINES)
+ return context.mesh and (engine in cls.COMPAT_ENGINES)
-class DATA_PT_context_mesh(DataButtonsPanel):
+class DATA_PT_context_mesh(MeshButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -70,29 +69,17 @@ class DATA_PT_context_mesh(DataButtonsPanel):
ob = context.object
mesh = context.mesh
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif mesh:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "data")
- elif mesh:
- layout.template_ID(space, "pin_id")
-
-class DATA_PT_custom_props_mesh(DataButtonsPanel, PropertyPanel):
- _context_path = "object.data"
- COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif mesh:
+ split.template_ID(space, "pin_id")
+ split.separator()
-class DATA_PT_normals(DataButtonsPanel):
+class DATA_PT_normals(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Normals"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -100,25 +87,21 @@ class DATA_PT_normals(DataButtonsPanel):
layout = self.layout
mesh = context.mesh
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
- col.prop(mesh, "autosmooth")
+ col.prop(mesh, "use_auto_smooth")
sub = col.column()
- sub.active = mesh.autosmooth
- sub.prop(mesh, "autosmooth_angle", text="Angle")
+ sub.active = mesh.use_auto_smooth
+ sub.prop(mesh, "auto_smooth_angle", text="Angle")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
- col.prop(mesh, "vertex_normal_flip")
- col.prop(mesh, "double_sided")
+ col = split.column()
+
+ col.prop(mesh, "show_double_sided")
-class DATA_PT_settings(DataButtonsPanel):
+class DATA_PT_settings(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Settings"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -130,13 +113,15 @@ class DATA_PT_settings(DataButtonsPanel):
layout.prop(mesh, "texture_mesh")
-class DATA_PT_vertex_groups(DataButtonsPanel):
+class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Vertex Groups"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return (context.object and context.object.type in ('MESH', 'LATTICE') and (engine in self.COMPAT_ENGINES))
+ obj = context.object
+ return (obj and obj.type in ('MESH', 'LATTICE') and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@@ -177,13 +162,15 @@ class DATA_PT_vertex_groups(DataButtonsPanel):
layout.prop(context.tool_settings, "vertex_group_weight", text="Weight")
-class DATA_PT_shape_keys(DataButtonsPanel):
+class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Shape Keys"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return (context.object and context.object.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE') and (engine in self.COMPAT_ENGINES))
+ obj = context.object
+ return (obj and obj.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE') and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@@ -191,13 +178,12 @@ class DATA_PT_shape_keys(DataButtonsPanel):
ob = context.object
key = ob.data.shape_keys
kb = ob.active_shape_key
- wide_ui = context.region.width > narrowui
enable_edit = ob.mode != 'EDIT'
enable_edit_value = False
- if ob.shape_key_lock is False:
- if enable_edit or (ob.type == 'MESH' and ob.shape_key_edit_mode):
+ if ob.show_shape_key is False:
+ if enable_edit or (ob.type == 'MESH' and ob.use_shape_key_edit_mode):
enable_edit_value = True
row = layout.row()
@@ -224,23 +210,17 @@ class DATA_PT_shape_keys(DataButtonsPanel):
split = layout.split(percentage=0.4)
row = split.row()
row.enabled = enable_edit
- if wide_ui:
- row.prop(key, "relative")
+ row.prop(key, "use_relative")
row = split.row()
row.alignment = 'RIGHT'
- if not wide_ui:
- layout.prop(key, "relative")
- row = layout.row()
-
-
sub = row.row(align=True)
subsub = sub.row(align=True)
subsub.active = enable_edit_value
- subsub.prop(ob, "shape_key_lock", text="")
+ subsub.prop(ob, "show_shape_key", text="")
subsub.prop(kb, "mute", text="")
- sub.prop(ob, "shape_key_edit_mode", text="")
+ sub.prop(ob, "use_shape_key_edit_mode", text="")
sub = row.row()
sub.operator("object.shape_key_clear", icon='X', text="")
@@ -248,7 +228,7 @@ class DATA_PT_shape_keys(DataButtonsPanel):
row = layout.row()
row.prop(kb, "name")
- if key.relative:
+ if key.use_relative:
if ob.active_shape_key_index != 0:
row = layout.row()
row.active = enable_edit_value
@@ -262,8 +242,7 @@ class DATA_PT_shape_keys(DataButtonsPanel):
col.prop(kb, "slider_min", text="Min")
col.prop(kb, "slider_max", text="Max")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.active = enable_edit_value
col.label(text="Blend:")
col.prop_object(kb, "vertex_group", ob, "vertex_groups", text="")
@@ -275,7 +254,7 @@ class DATA_PT_shape_keys(DataButtonsPanel):
row.prop(key, "slurph")
-class DATA_PT_uv_texture(DataButtonsPanel):
+class DATA_PT_uv_texture(MeshButtonsPanel, bpy.types.Panel):
bl_label = "UV Texture"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -298,11 +277,12 @@ class DATA_PT_uv_texture(DataButtonsPanel):
layout.prop(lay, "name")
-class DATA_PT_texface(DataButtonsPanel):
+class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Texture Face"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.active_object
rd = context.scene.render
@@ -312,7 +292,6 @@ class DATA_PT_texface(DataButtonsPanel):
layout = self.layout
col = layout.column()
- wide_ui = context.region.width > narrowui
me = context.mesh
tf = me.faces.active_tface
@@ -321,31 +300,30 @@ class DATA_PT_texface(DataButtonsPanel):
split = layout.split()
col = split.column()
- col.prop(tf, "tex")
- col.prop(tf, "light")
- col.prop(tf, "invisible")
- col.prop(tf, "collision")
+ col.prop(tf, "use_bitmap_text")
+ col.prop(tf, "use_light")
+ col.prop(tf, "hide")
+ col.prop(tf, "use_collision")
- col.prop(tf, "shared")
- col.prop(tf, "twoside")
- col.prop(tf, "object_color")
+ col.prop(tf, "use_blend_shared")
+ col.prop(tf, "use_twoside")
+ col.prop(tf, "use_object_color")
- if wide_ui:
- col = split.column()
+ col = split.column()
- col.prop(tf, "halo")
- col.prop(tf, "billboard")
- col.prop(tf, "shadow")
- col.prop(tf, "text")
- col.prop(tf, "alpha_sort")
+ col.prop(tf, "use_halo")
+ col.prop(tf, "use_billboard")
+ col.prop(tf, "use_shadow_cast")
+ col.prop(tf, "use_bitmap_text")
+ col.prop(tf, "use_alpha_sort")
col = layout.column()
- col.prop(tf, "transp")
+ col.prop(tf, "blend_type")
else:
col.label(text="No UV Texture")
-class DATA_PT_vertex_colors(DataButtonsPanel):
+class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel):
bl_label = "Vertex Colors"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -368,32 +346,17 @@ class DATA_PT_vertex_colors(DataButtonsPanel):
layout.prop(lay, "name")
-classes = [
- MESH_MT_vertex_group_specials,
- MESH_MT_shape_key_specials,
-
- DATA_PT_context_mesh,
- DATA_PT_normals,
- DATA_PT_settings,
- DATA_PT_vertex_groups,
- DATA_PT_shape_keys,
- DATA_PT_uv_texture,
- DATA_PT_texface,
- DATA_PT_vertex_colors,
-
- DATA_PT_custom_props_mesh]
+class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_metaball.py b/release/scripts/ui/properties_data_metaball.py
index e0155059b98..83e5e642d0e 100644
--- a/release/scripts/ui/properties_data_metaball.py
+++ b/release/scripts/ui/properties_data_metaball.py
@@ -20,19 +20,18 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class DataButtonsPanel(bpy.types.Panel):
+class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.meta_ball
-class DATA_PT_context_metaball(DataButtonsPanel):
+class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -42,83 +41,63 @@ class DATA_PT_context_metaball(DataButtonsPanel):
ob = context.object
mball = context.meta_ball
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "data")
- split.separator()
- elif mball:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "data")
- elif mball:
- layout.template_ID(space, "pin_id")
-
-
-class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel):
- _context_path = "object.data"
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif mball:
+ split.template_ID(space, "pin_id")
+ split.separator()
-class DATA_PT_metaball(DataButtonsPanel):
+
+class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
bl_label = "Metaball"
def draw(self, context):
layout = self.layout
mball = context.meta_ball
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.label(text="Resolution:")
sub = col.column(align=True)
- sub.prop(mball, "wire_size", text="View")
- sub.prop(mball, "render_size", text="Render")
+ sub.prop(mball, "resolution", text="View")
+ sub.prop(mball, "render_resolution", text="Render")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Settings:")
col.prop(mball, "threshold", text="Threshold")
layout.label(text="Update:")
- if wide_ui:
- layout.prop(mball, "flag", expand=True)
- else:
- layout.prop(mball, "flag", text="")
+ layout.prop(mball, "update_method", expand=True)
-class DATA_PT_metaball_element(DataButtonsPanel):
+class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
bl_label = "Active Element"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.meta_ball and context.meta_ball.active_element)
def draw(self, context):
layout = self.layout
metaelem = context.meta_ball.active_element
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(metaelem, "type")
- else:
- layout.prop(metaelem, "type", text="")
+ layout.prop(metaelem, "type")
split = layout.split()
col = split.column(align=True)
col.label(text="Settings:")
col.prop(metaelem, "stiffness", text="Stiffness")
- col.prop(metaelem, "negative", text="Negative")
+ col.prop(metaelem, "use_negative", text="Negative")
col.prop(metaelem, "hide", text="Hide")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
if metaelem.type in ('CUBE', 'ELLIPSOID'):
col.label(text="Size:")
@@ -136,24 +115,17 @@ class DATA_PT_metaball_element(DataButtonsPanel):
col.prop(metaelem, "size_y", text="Y")
-classes = [
- DATA_PT_context_metaball,
- DATA_PT_metaball,
- DATA_PT_metaball_element,
-
- DATA_PT_custom_props_metaball]
+class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_data_modifier.py b/release/scripts/ui/properties_data_modifier.py
index dfa0d8029b2..46ac5ae570f 100644
--- a/release/scripts/ui/properties_data_modifier.py
+++ b/release/scripts/ui/properties_data_modifier.py
@@ -19,52 +19,46 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-narrowmod = 260
-
-class DataButtonsPanel(bpy.types.Panel):
+class ModifierButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "modifier"
-class DATA_PT_modifiers(DataButtonsPanel):
+class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
bl_label = "Modifiers"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
- compact_mod = context.region.width < narrowmod
layout.operator_menu_enum("object.modifier_add", "type")
for md in ob.modifiers:
- box = layout.template_modifier(md, compact=compact_mod)
+ box = layout.template_modifier(md)
if box:
# match enum type to our functions, avoids a lookup table.
- getattr(self, md.type)(box, ob, md, wide_ui)
+ getattr(self, md.type)(box, ob, md)
# the mt.type enum is (ab)used for a lookup on function names
# ...to avoid lengthy if statements
# so each type must have a function here.
- def ARMATURE(self, layout, ob, md, wide_ui):
+ def ARMATURE(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group::")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
sub = col.column()
sub.active = bool(md.vertex_group)
- sub.prop(md, "invert")
+ sub.prop(md, "invert_vertex_group")
split = layout.split()
@@ -73,23 +67,18 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "use_vertex_groups", text="Vertex Groups")
col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Deformation:")
- col.prop(md, "quaternion")
- col.prop(md, "multi_modifier")
-
- def ARRAY(self, layout, ob, md, wide_ui):
- if wide_ui:
- layout.prop(md, "fit_type")
- else:
- layout.prop(md, "fit_type", text="")
+ col.prop(md, "use_deform_preserve_volume")
+ col.prop(md, "use_multi_modifier")
+ def ARRAY(self, layout, ob, md):
+ layout.prop(md, "fit_type")
if md.fit_type == 'FIXED_COUNT':
layout.prop(md, "count")
elif md.fit_type == 'FIT_LENGTH':
- layout.prop(md, "length")
+ layout.prop(md, "fit_length")
elif md.fit_type == 'FIT_CURVE':
layout.prop(md, "curve")
@@ -98,31 +87,30 @@ class DATA_PT_modifiers(DataButtonsPanel):
split = layout.split()
col = split.column()
- col.prop(md, "constant_offset")
+ col.prop(md, "use_constant_offset")
sub = col.column()
- sub.active = md.constant_offset
- sub.prop(md, "constant_offset_displacement", text="")
+ sub.active = md.use_constant_offset
+ sub.prop(md, "constant_offset_displace", text="")
col.separator()
- col.prop(md, "merge_adjacent_vertices", text="Merge")
+ col.prop(md, "use_merge_vertices", text="Merge")
sub = col.column()
- sub.active = md.merge_adjacent_vertices
- sub.prop(md, "merge_end_vertices", text="First Last")
- sub.prop(md, "merge_distance", text="Distance")
+ sub.active = md.use_merge_vertices
+ sub.prop(md, "use_merge_vertices_cap", text="First Last")
+ sub.prop(md, "merge_threshold", text="Distance")
- if wide_ui:
- col = split.column()
- col.prop(md, "relative_offset")
+ col = split.column()
+ col.prop(md, "use_relative_offset")
sub = col.column()
- sub.active = md.relative_offset
- sub.prop(md, "relative_offset_displacement", text="")
+ sub.active = md.use_relative_offset
+ sub.prop(md, "relative_offset_displace", text="")
col.separator()
- col.prop(md, "add_offset_object")
+ col.prop(md, "use_object_offset")
sub = col.column()
- sub.active = md.add_offset_object
+ sub.active = md.use_object_offset
sub.prop(md, "offset_object", text="")
layout.separator()
@@ -131,107 +119,99 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "start_cap")
col.prop(md, "end_cap")
- def BEVEL(self, layout, ob, md, wide_ui):
+ def BEVEL(self, layout, ob, md):
split = layout.split()
col = split.column()
col.prop(md, "width")
- if wide_ui:
- col = split.column()
- col.prop(md, "only_vertices")
+ col = split.column()
+ col.prop(md, "use_only_vertices")
layout.label(text="Limit Method:")
layout.row().prop(md, "limit_method", expand=True)
if md.limit_method == 'ANGLE':
- layout.prop(md, "angle")
+ layout.prop(md, "angle_limit")
elif md.limit_method == 'WEIGHT':
layout.row().prop(md, "edge_weight_method", expand=True)
- def BOOLEAN(self, layout, ob, md, wide_ui):
+ def BOOLEAN(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Operation:")
col.prop(md, "operation", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
- def BUILD(self, layout, ob, md, wide_ui):
+ def BUILD(self, layout, ob, md):
split = layout.split()
col = split.column()
col.prop(md, "frame_start")
- col.prop(md, "length")
+ col.prop(md, "frame_duration")
- if wide_ui:
- col = split.column()
- col.prop(md, "randomize")
+ col = split.column()
+ col.prop(md, "use_random_order")
sub = col.column()
- sub.active = md.randomize
+ sub.active = md.use_random_order
sub.prop(md, "seed")
- def CAST(self, layout, ob, md, wide_ui):
+ def CAST(self, layout, ob, md):
split = layout.split(percentage=0.25)
- if wide_ui:
- split.label(text="Cast Type:")
- split.prop(md, "cast_type", text="")
- else:
- layout.prop(md, "cast_type", text="")
+ split.label(text="Cast Type:")
+ split.prop(md, "cast_type", text="")
split = layout.split(percentage=0.25)
col = split.column()
- col.prop(md, "x")
- col.prop(md, "y")
- col.prop(md, "z")
+ col.prop(md, "use_x")
+ col.prop(md, "use_y")
+ col.prop(md, "use_z")
col = split.column()
col.prop(md, "factor")
col.prop(md, "radius")
col.prop(md, "size")
- col.prop(md, "from_radius")
+ col.prop(md, "use_radius_as_size")
split = layout.split()
col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Control Object:")
col.prop(md, "object", text="")
if md.object:
col.prop(md, "use_transform")
- def CLOTH(self, layout, ob, md, wide_ui):
+ def CLOTH(self, layout, ob, md):
layout.label(text="See Cloth panel.")
- def COLLISION(self, layout, ob, md, wide_ui):
+ def COLLISION(self, layout, ob, md):
layout.label(text="See Collision panel.")
- def CURVE(self, layout, ob, md, wide_ui):
+ def CURVE(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
layout.label(text="Deformation Axis:")
layout.row().prop(md, "deform_axis", expand=True)
- def DECIMATE(self, layout, ob, md, wide_ui):
+ def DECIMATE(self, layout, ob, md):
layout.prop(md, "ratio")
layout.label(text="Face Count: %s" % str(md.face_count))
- def DISPLACE(self, layout, ob, md, wide_ui):
+ def DISPLACE(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -240,15 +220,14 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Direction:")
col.prop(md, "direction", text="")
col.label(text="Texture Coordinates:")
- col.prop(md, "texture_coordinates", text="")
- if md.texture_coordinates == 'OBJECT':
+ col.prop(md, "texture_coords", text="")
+ if md.texture_coords == 'OBJECT':
layout.prop(md, "texture_coordinate_object", text="Object")
- elif md.texture_coordinates == 'UV' and ob.type == 'MESH':
+ elif md.texture_coords == 'UV' and ob.type == 'MESH':
layout.prop_object(md, "uv_layer", ob.data, "uv_textures")
layout.separator()
@@ -256,13 +235,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
split = layout.split()
col = split.column()
- col.prop(md, "midlevel")
+ col.prop(md, "mid_level")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "strength")
- def EDGE_SPLIT(self, layout, ob, md, wide_ui):
+ def EDGE_SPLIT(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -271,11 +249,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.active = md.use_edge_angle
sub.prop(md, "split_angle")
- if wide_ui:
- col = split.column()
- col.prop(md, "use_sharp", text="Sharp Edges")
+ col = split.column()
+ col.prop(md, "use_edge_sharp", text="Sharp Edges")
- def EXPLODE(self, layout, ob, md, wide_ui):
+ def EXPLODE(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -285,20 +262,19 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.active = bool(md.vertex_group)
sub.prop(md, "protect")
- if wide_ui:
- col = split.column()
- col.prop(md, "split_edges")
- col.prop(md, "unborn")
- col.prop(md, "alive")
- col.prop(md, "dead")
- col.prop(md, "size")
+ col = split.column()
+ col.prop(md, "use_edge_split")
+ col.prop(md, "show_unborn")
+ col.prop(md, "show_alive")
+ col.prop(md, "show_dead")
+ col.prop(md, "use_size")
layout.operator("object.explode_refresh", text="Refresh")
- def FLUID_SIMULATION(self, layout, ob, md, wide_ui):
+ def FLUID_SIMULATION(self, layout, ob, md):
layout.label(text="See Fluid panel.")
- def HOOK(self, layout, ob, md, wide_ui):
+ def HOOK(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -307,8 +283,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
if md.object and md.object.type == 'ARMATURE':
col.label(text="Bone:")
col.prop_object(md, "subtarget", md.object.data, "bones", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
@@ -319,10 +294,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
col = split.column()
col.prop(md, "falloff")
col.prop(md, "force", slider=True)
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+
+ col = split.column()
col.operator("object.hook_reset", text="Reset")
col.operator("object.hook_recenter", text="Recenter")
@@ -332,26 +305,24 @@ class DATA_PT_modifiers(DataButtonsPanel):
row.operator("object.hook_select", text="Select")
row.operator("object.hook_assign", text="Assign")
- def LATTICE(self, layout, ob, md, wide_ui):
+ def LATTICE(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
- def MASK(self, layout, ob, md, wide_ui):
+ def MASK(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Mode:")
col.prop(md, "mode", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
if md.mode == 'ARMATURE':
col.label(text="Armature:")
col.prop(md, "armature", text="")
@@ -361,23 +332,22 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub = col.column()
sub.active = bool(md.vertex_group)
- sub.prop(md, "invert")
+ sub.prop(md, "invert_vertex_group")
- def MESH_DEFORM(self, layout, ob, md, wide_ui):
+ def MESH_DEFORM(self, layout, ob, md):
split = layout.split()
col = split.column()
sub = col.column()
sub.label(text="Object:")
sub.prop(md, "object", text="")
sub.active = not md.is_bound
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
sub = col.column()
sub.active = bool(md.vertex_group)
- sub.prop(md, "invert")
+ sub.prop(md, "invert_vertex_group")
layout.separator()
@@ -391,68 +361,55 @@ class DATA_PT_modifiers(DataButtonsPanel):
col = split.column()
col.prop(md, "precision")
- if wide_ui:
- col = split.column()
- col.prop(md, "dynamic")
+ col = split.column()
+ col.prop(md, "use_dynamic_bind")
- def MIRROR(self, layout, ob, md, wide_ui):
- layout.prop(md, "merge_limit")
- if wide_ui:
- split = layout.split(percentage=0.25)
- else:
- split = layout.split(percentage=0.4)
+ def MIRROR(self, layout, ob, md):
+ layout.prop(md, "merge_threshold")
+ split = layout.split(percentage=0.25)
col = split.column()
col.label(text="Axis:")
- col.prop(md, "x")
- col.prop(md, "y")
- col.prop(md, "z")
+ col.prop(md, "use_x")
+ col.prop(md, "use_y")
+ col.prop(md, "use_z")
- if wide_ui:
- col = split.column()
- else:
- subsplit = layout.split()
- col = subsplit.column()
+ col = split.column()
col.label(text="Options:")
- col.prop(md, "clip", text="Clipping")
- col.prop(md, "mirror_vertex_groups", text="Vertex Groups")
+ col.prop(md, "use_clip", text="Clipping")
+ col.prop(md, "use_mirror_vertex_groups", text="Vertex Groups")
col = split.column()
col.label(text="Textures:")
- col.prop(md, "mirror_u", text="U")
- col.prop(md, "mirror_v", text="V")
+ col.prop(md, "use_mirror_u", text="U")
+ col.prop(md, "use_mirror_v", text="V")
col = layout.column()
col.label(text="Mirror Object:")
col.prop(md, "mirror_object", text="")
- def MULTIRES(self, layout, ob, md, wide_ui):
- if wide_ui:
- layout.row().prop(md, "subdivision_type", expand=True)
- else:
- layout.row().prop(md, "subdivision_type", text="")
+ def MULTIRES(self, layout, ob, md):
+ layout.row().prop(md, "subdivision_type", expand=True)
split = layout.split()
col = split.column()
col.prop(md, "levels", text="Preview")
col.prop(md, "sculpt_levels", text="Sculpt")
col.prop(md, "render_levels", text="Render")
- col.prop(bpy.context.tool_settings.sculpt, "fast_navigate")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.enabled = ob.mode != 'EDIT'
col.operator("object.multires_subdivide", text="Subdivide")
col.operator("object.multires_higher_levels_delete", text="Delete Higher")
col.operator("object.multires_reshape", text="Reshape")
- col.prop(md, "optimal_display")
+ col.prop(md, "show_only_control_edges")
layout.separator()
col = layout.column()
row = col.row()
- if md.external:
+ if md.is_external:
row.operator("object.multires_external_pack", text="Pack External")
row.label()
row = col.row()
@@ -461,23 +418,22 @@ class DATA_PT_modifiers(DataButtonsPanel):
row.operator("object.multires_external_save", text="Save External...")
row.label()
- def PARTICLE_INSTANCE(self, layout, ob, md, wide_ui):
+ def PARTICLE_INSTANCE(self, layout, ob, md):
layout.prop(md, "object")
- layout.prop(md, "particle_system_number", text="Particle System")
+ layout.prop(md, "particle_system_index", text="Particle System")
split = layout.split()
col = split.column()
col.label(text="Create From:")
- col.prop(md, "normal")
- col.prop(md, "children")
- col.prop(md, "size")
+ col.prop(md, "use_normal")
+ col.prop(md, "use_children")
+ col.prop(md, "use_size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Show Particles When:")
- col.prop(md, "alive")
- col.prop(md, "unborn")
- col.prop(md, "dead")
+ col.prop(md, "show_alive")
+ col.prop(md, "show_unborn")
+ col.prop(md, "show_dead")
layout.separator()
@@ -487,17 +443,16 @@ class DATA_PT_modifiers(DataButtonsPanel):
split.active = md.use_path
col = split.column()
col.row().prop(md, "axis", expand=True)
- col.prop(md, "keep_shape")
+ col.prop(md, "use_preserve_shape")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "position", slider=True)
col.prop(md, "random_position", text="Random", slider=True)
- def PARTICLE_SYSTEM(self, layout, ob, md, wide_ui):
+ def PARTICLE_SYSTEM(self, layout, ob, md):
layout.label(text="See Particle panel.")
- def SCREW(self, layout, ob, md, wide_ui):
+ def SCREW(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -507,8 +462,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "steps")
col.prop(md, "render_steps")
- if wide_ui:
- col = split.column()
+ col = split.column()
row = col.row()
row.active = (md.object is None or md.use_object_screw_offset == False)
row.prop(md, "screw_offset")
@@ -519,13 +473,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "use_normal_flip")
col.prop(md, "iterations")
- def SHRINKWRAP(self, layout, ob, md, wide_ui):
+ def SHRINKWRAP(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Target:")
col.prop(md, "target", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
@@ -535,52 +488,45 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "offset")
col.prop(md, "subsurf_levels")
- if wide_ui:
- col = split.column()
- col.label(text="Mode:")
- col.prop(md, "mode", text="")
+ col = split.column()
+ col.label(text="Mode:")
+ col.prop(md, "wrap_method", text="")
+
+ split = layout.split(percentage=0.25)
- if wide_ui:
- split = layout.split(percentage=0.25)
- else:
- split = layout.split(percentage=0.35)
col = split.column()
- if md.mode == 'PROJECT':
+ if md.wrap_method == 'PROJECT':
col.label(text="Axis:")
- col.prop(md, "x")
- col.prop(md, "y")
- col.prop(md, "z")
+ col.prop(md, "use_project_x")
+ col.prop(md, "use_project_y")
+ col.prop(md, "use_project_z")
col = split.column()
col.label(text="Direction:")
- col.prop(md, "negative")
- col.prop(md, "positive")
-
- if wide_ui:
- col = split.column()
- else:
- subsplit = layout.split()
- col = subsplit.column()
+ col.prop(md, "use_negative_direction")
+ col.prop(md, "use_positive_direction")
+
+ col = split.column()
+
col.label(text="Cull Faces:")
- col.prop(md, "cull_front_faces", text="Front")
- col.prop(md, "cull_back_faces", text="Back")
+ col.prop(md, "use_cull_front_faces", text="Front")
+ col.prop(md, "use_cull_back_faces", text="Back")
layout.label(text="Auxiliary Target:")
layout.prop(md, "auxiliary_target", text="")
- elif md.mode == 'NEAREST_SURFACEPOINT':
- layout.prop(md, "keep_above_surface")
+ elif md.wrap_method == 'NEAREST_SURFACEPOINT':
+ layout.prop(md, "use_keep_above_surface")
- def SIMPLE_DEFORM(self, layout, ob, md, wide_ui):
+ def SIMPLE_DEFORM(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Mode:")
- col.prop(md, "mode", text="")
+ col.prop(md, "deform_method", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
@@ -590,40 +536,39 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.label(text="Origin:")
col.prop(md, "origin", text="")
sub = col.column()
- sub.active = (md.origin != "")
- sub.prop(md, "relative")
+ sub.active = (md.origin is not None)
+ sub.prop(md, "use_relative")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Deform:")
col.prop(md, "factor")
col.prop(md, "limits", slider=True)
- if md.mode in ('TAPER', 'STRETCH'):
- col.prop(md, "lock_x_axis")
- col.prop(md, "lock_y_axis")
+ if md.deform_method in ('TAPER', 'STRETCH'):
+ col.prop(md, "lock_x")
+ col.prop(md, "lock_y")
- def SMOKE(self, layout, ob, md, wide_ui):
+ def SMOKE(self, layout, ob, md):
layout.label(text="See Smoke panel.")
- def SMOOTH(self, layout, ob, md, wide_ui):
+ def SMOOTH(self, layout, ob, md):
split = layout.split(percentage=0.25)
col = split.column()
col.label(text="Axis:")
- col.prop(md, "x")
- col.prop(md, "y")
- col.prop(md, "z")
+ col.prop(md, "use_x")
+ col.prop(md, "use_y")
+ col.prop(md, "use_z")
col = split.column()
col.prop(md, "factor")
- col.prop(md, "repeat")
+ col.prop(md, "iterations")
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
- def SOFT_BODY(self, layout, ob, md, wide_ui):
+ def SOFT_BODY(self, layout, ob, md):
layout.label(text="See Soft Body panel.")
- def SOLIDIFY(self, layout, ob, md, wide_ui):
+ def SOLIDIFY(self, layout, ob, md):
split = layout.split()
@@ -636,13 +581,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "edge_crease_outer", text="Outer")
col.prop(md, "edge_crease_rim", text="Rim")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "offset")
colsub = col.column()
- colsub.active = (md.vertex_group is not "")
- colsub.prop(md, "invert", text="Invert")
+ colsub.active = bool(md.vertex_group)
+ colsub.prop(md, "invert_vertex_group", text="Invert")
col.prop(md, "use_even_offset")
col.prop(md, "use_quality_normals")
@@ -652,15 +596,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
colsub.active = md.use_rim
colsub.prop(md, "use_rim_material")
- # col = layout.column()
- # col.label(text="Vertex Group:")
- # col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
-
- def SUBSURF(self, layout, ob, md, wide_ui):
- if wide_ui:
- layout.row().prop(md, "subdivision_type", expand=True)
- else:
- layout.row().prop(md, "subdivision_type", text="")
+ def SUBSURF(self, layout, ob, md):
+ layout.row().prop(md, "subdivision_type", expand=True)
split = layout.split()
col = split.column()
@@ -668,16 +605,15 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "levels", text="View")
col.prop(md, "render_levels", text="Render")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Options:")
- col.prop(md, "subsurf_uv")
- col.prop(md, "optimal_display")
+ col.prop(md, "use_subsurf_uv")
+ col.prop(md, "show_only_control_edges")
- def SURFACE(self, layout, ob, md, wide_ui):
+ def SURFACE(self, layout, ob, md):
layout.label(text="See Fields panel.")
- def UV_PROJECT(self, layout, ob, md, wide_ui):
+ def UV_PROJECT(self, layout, ob, md):
if ob.type == 'MESH':
split = layout.split()
@@ -685,20 +621,18 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.label(text="Image:")
col.prop(md, "image", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="UV Layer:")
col.prop_object(md, "uv_layer", ob.data, "uv_textures", text="")
split = layout.split()
col = split.column()
- col.prop(md, "override_image")
- col.prop(md, "num_projectors", text="Projectors")
+ col.prop(md, "use_image_override")
+ col.prop(md, "projector_count", text="Projectors")
for proj in md.projectors:
col.prop(proj, "object", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column(align=True)
sub.prop(md, "aspect_x", text="Aspect X")
sub.prop(md, "aspect_y", text="Aspect Y")
@@ -707,23 +641,22 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.prop(md, "scale_x", text="Scale X")
sub.prop(md, "scale_y", text="Scale Y")
- def WAVE(self, layout, ob, md, wide_ui):
+ def WAVE(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Motion:")
- col.prop(md, "x")
- col.prop(md, "y")
- col.prop(md, "cyclic")
+ col.prop(md, "use_x")
+ col.prop(md, "use_y")
+ col.prop(md, "use_cyclic")
- if wide_ui:
- col = split.column()
- col.prop(md, "normals")
+ col = split.column()
+ col.prop(md, "use_normal")
sub = col.column()
- sub.active = md.normals
- sub.prop(md, "x_normal", text="X")
- sub.prop(md, "y_normal", text="Y")
- sub.prop(md, "z_normal", text="Z")
+ sub.active = md.use_normal
+ sub.prop(md, "use_normal_x", text="X")
+ sub.prop(md, "use_normal_y", text="Y")
+ sub.prop(md, "use_normal_z", text="Z")
split = layout.split()
@@ -734,8 +667,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.prop(md, "lifetime", text="Life")
col.prop(md, "damping_time", text="Damping")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Position:")
sub = col.column(align=True)
sub.prop(md, "start_position_x", text="X")
@@ -747,11 +679,11 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.prop(md, "start_position_object")
layout.prop_object(md, "vertex_group", ob, "vertex_groups")
layout.prop(md, "texture")
- layout.prop(md, "texture_coordinates")
- if md.texture_coordinates == 'MAP_UV' and ob.type == 'MESH':
+ layout.prop(md, "texture_coords")
+ if md.texture_coords == 'MAP_UV' and ob.type == 'MESH':
layout.prop_object(md, "uv_layer", ob.data, "uv_textures")
- elif md.texture_coordinates == 'OBJECT':
- layout.prop(md, "texture_coordinates_object")
+ elif md.texture_coords == 'OBJECT':
+ layout.prop(md, "texture_coords_object")
layout.separator()
@@ -761,26 +693,17 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.prop(md, "speed", slider=True)
col.prop(md, "height", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(md, "width", slider=True)
col.prop(md, "narrowness", slider=True)
-classes = [
- DATA_PT_modifiers]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_game.py b/release/scripts/ui/properties_game.py
index 9ec7168f834..8d2f075fce0 100644
--- a/release/scripts/ui/properties_game.py
+++ b/release/scripts/ui/properties_game.py
@@ -19,36 +19,31 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class PhysicsButtonsPanel(bpy.types.Panel):
+class PhysicsButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
- ob = context.active_object
- rd = context.scene.render
- return ob and ob.game and (rd.engine in self.COMPAT_ENGINES)
-
-class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
+class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
+ @classmethod
+ def poll(cls, context):
+ ob = context.active_object
+ rd = context.scene.render
+ return ob and ob.game and (rd.engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
ob = context.active_object
game = ob.game
soft = ob.game.soft_body
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(game, "physics_type")
- else:
- layout.prop(game, "physics_type", text="")
+ layout.prop(game, "physics_type")
layout.separator()
#if game.physics_type == 'DYNAMIC':
@@ -56,15 +51,14 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
split = layout.split()
col = split.column()
- col.prop(game, "actor")
- col.prop(game, "ghost")
- col.prop(ob, "restrict_render", text="Invisible") # out of place but useful
+ col.prop(game, "use_actor")
+ col.prop(game, "use_ghost")
+ col.prop(ob, "hide_render", text="Invisible") # out of place but useful
- if wide_ui:
- col = split.column()
- col.prop(game, "material_physics")
- col.prop(game, "rotate_from_normal")
- col.prop(game, "no_sleeping")
+ col = split.column()
+ col.prop(game, "use_material_physics")
+ col.prop(game, "use_rotate_from_normal")
+ col.prop(game, "use_sleep")
layout.separator()
@@ -76,13 +70,12 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
col.prop(game, "radius")
col.prop(game, "form_factor")
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column()
sub.active = (game.physics_type == 'RIGID_BODY')
- sub.prop(game, "anisotropic_friction")
+ sub.prop(game, "use_anisotropic_friction")
subsub = sub.column()
- subsub.active = game.anisotropic_friction
+ subsub.active = game.use_anisotropic_friction
subsub.prop(game, "friction_coefficients", text="", slider=True)
split = layout.split()
@@ -90,11 +83,10 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
col = split.column()
col.label(text="Velocity:")
sub = col.column(align=True)
- sub.prop(game, "minimum_velocity", text="Minimum")
- sub.prop(game, "maximum_velocity", text="Maximum")
+ sub.prop(game, "velocity_min", text="Minimum")
+ sub.prop(game, "velocity_max", text="Maximum")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Damping:")
sub = col.column(align=True)
sub.prop(game, "damping", text="Translation", slider=True)
@@ -106,21 +98,21 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
col = split.column()
col.label(text="Lock Translation:")
- col.prop(game, "lock_x_axis", text="X")
- col.prop(game, "lock_y_axis", text="Y")
- col.prop(game, "lock_z_axis", text="Z")
+ col.prop(game, "lock_location_x", text="X")
+ col.prop(game, "lock_location_y", text="Y")
+ col.prop(game, "lock_location_z", text="Z")
col = split.column()
col.label(text="Lock Rotation:")
- col.prop(game, "lock_x_rot_axis", text="X")
- col.prop(game, "lock_y_rot_axis", text="Y")
- col.prop(game, "lock_z_rot_axis", text="Z")
+ col.prop(game, "lock_rotation_x", text="X")
+ col.prop(game, "lock_rotation_y", text="Y")
+ col.prop(game, "lock_rotation_z", text="Z")
elif game.physics_type == 'SOFT_BODY':
col = layout.column()
- col.prop(game, "actor")
- col.prop(game, "ghost")
- col.prop(ob, "restrict_render", text="Invisible")
+ col.prop(game, "use_actor")
+ col.prop(game, "use_ghost")
+ col.prop(ob, "hide_render", text="Invisible")
layout.separator()
@@ -129,47 +121,47 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
col = split.column()
col.label(text="Attributes:")
col.prop(game, "mass")
- col.prop(soft, "welding")
- col.prop(soft, "position_iterations")
- col.prop(soft, "linstiff", slider=True)
+ col.prop(soft, "weld_threshold")
+ col.prop(soft, "location_iterations")
+ col.prop(soft, "linear_stiffness", slider=True)
col.prop(soft, "dynamic_friction", slider=True)
- col.prop(soft, "margin", slider=True)
- col.prop(soft, "bending_const", text="Bending Constraints")
+ col.prop(soft, "collision_margin", slider=True)
+ col.prop(soft, "use_bending_constraints", text="Bending Constraints")
- if wide_ui:
- col = split.column()
- col.prop(soft, "shape_match")
+ col = split.column()
+ col.prop(soft, "use_shape_match")
sub = col.column()
- sub.active = soft.shape_match
- sub.prop(soft, "threshold", slider=True)
+ sub.active = soft.use_shape_match
+ sub.prop(soft, "shape_threshold", slider=True)
col.separator()
col.label(text="Cluster Collision:")
- col.prop(soft, "cluster_rigid_to_softbody")
- col.prop(soft, "cluster_soft_to_softbody")
+ col.prop(soft, "use_cluster_rigid_to_softbody")
+ col.prop(soft, "use_cluster_soft_to_softbody")
sub = col.column()
- sub.active = (soft.cluster_rigid_to_softbody or soft.cluster_soft_to_softbody)
+ sub.active = (soft.use_cluster_rigid_to_softbody or soft.use_cluster_soft_to_softbody)
sub.prop(soft, "cluster_iterations", text="Iterations")
elif game.physics_type == 'STATIC':
col = layout.column()
- col.prop(game, "actor")
- col.prop(game, "ghost")
- col.prop(ob, "restrict_render", text="Invisible")
+ col.prop(game, "use_actor")
+ col.prop(game, "use_ghost")
+ col.prop(ob, "hide_render", text="Invisible")
elif game.physics_type in ('SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'):
- layout.prop(ob, "restrict_render", text="Invisible")
+ layout.prop(ob, "hide_render", text="Invisible")
-class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
+class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, bpy.types.Panel):
bl_label = "Collision Bounds"
COMPAT_ENGINES = {'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
game = context.object.game
rd = context.scene.render
- return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in self.COMPAT_ENGINES)
+ return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
game = context.active_object.game
@@ -180,35 +172,31 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
layout = self.layout
game = context.active_object.game
- wide_ui = context.region.width > narrowui
layout.active = game.use_collision_bounds
- if wide_ui:
- layout.prop(game, "collision_bounds", text="Bounds")
- else:
- layout.prop(game, "collision_bounds", text="")
+ layout.prop(game, "collision_bounds_type", text="Bounds")
split = layout.split()
col = split.column()
col.prop(game, "collision_margin", text="Margin", slider=True)
- if wide_ui:
- col = split.column()
- col.prop(game, "collision_compound", text="Compound")
+ col = split.column()
+ col.prop(game, "use_collision_compound", text="Compound")
-class RenderButtonsPanel(bpy.types.Panel):
+class RenderButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "render"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
- return (rd.engine in self.COMPAT_ENGINES)
+ return (rd.engine in cls.COMPAT_ENGINES)
-class RENDER_PT_game(RenderButtonsPanel):
+class RENDER_PT_game(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Game"
COMPAT_ENGINES = {'BLENDER_GAME'}
@@ -220,17 +208,16 @@ class RENDER_PT_game(RenderButtonsPanel):
row.label()
-class RENDER_PT_game_player(RenderButtonsPanel):
+class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Standalone Player"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
- gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
+ gs = context.scene.game_settings
- layout.prop(gs, "fullscreen")
+ layout.prop(gs, "show_fullscreen")
split = layout.split()
@@ -240,8 +227,7 @@ class RENDER_PT_game_player(RenderButtonsPanel):
sub.prop(gs, "resolution_x", slider=False, text="X")
sub.prop(gs, "resolution_y", slider=False, text="Y")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Quality:")
sub = col.column(align=True)
sub.prop(gs, "depth", text="Bit Depth", slider=False)
@@ -250,24 +236,20 @@ class RENDER_PT_game_player(RenderButtonsPanel):
# framing:
col = layout.column()
col.label(text="Framing:")
- if wide_ui:
- col.row().prop(gs, "framing_type", expand=True)
- else:
- col.prop(gs, "framing_type", text="")
- if gs.framing_type == 'LETTERBOX':
- col.prop(gs, "framing_color", text="")
+ col.row().prop(gs, "frame_type", expand=True)
+ if gs.frame_type == 'LETTERBOX':
+ col.prop(gs, "frame_color", text="")
-class RENDER_PT_game_stereo(RenderButtonsPanel):
+class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Stereo"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
- gs = context.scene.game_data
+ gs = context.scene.game_settings
stereo_mode = gs.stereo
- wide_ui = context.region.width > narrowui
# stereo options:
layout.prop(gs, "stereo", expand=True)
@@ -275,14 +257,11 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
# stereo:
if stereo_mode == 'STEREO':
layout.prop(gs, "stereo_mode")
- layout.prop(gs, "eye_separation")
+ layout.prop(gs, "stereo_eye_separation")
# dome:
elif stereo_mode == 'DOME':
- if wide_ui:
- layout.prop(gs, "dome_mode", text="Dome Type")
- else:
- layout.prop(gs, "dome_mode", text="")
+ layout.prop(gs, "dome_mode", text="Dome Type")
dome_type = gs.dome_mode
@@ -296,8 +275,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
col.prop(gs, "dome_angle", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(gs, "dome_tesselation", text="Tesselation")
col.prop(gs, "dome_tilt")
@@ -305,57 +283,51 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(gs, "dome_tesselation", text="Tesselation")
else: # cube map
col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
- if wide_ui:
- col = split.column()
+
+ col = split.column()
layout.prop(gs, "dome_text")
-class RENDER_PT_game_shading(RenderButtonsPanel):
+class RENDER_PT_game_shading(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
- gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
+ gs = context.scene.game_settings
- if wide_ui:
- layout.prop(gs, "material_mode", expand=True)
- else:
- layout.prop(gs, "material_mode", text="")
+ layout.prop(gs, "material_mode", expand=True)
if gs.material_mode == 'GLSL':
split = layout.split()
col = split.column()
- col.prop(gs, "glsl_lights", text="Lights")
- col.prop(gs, "glsl_shaders", text="Shaders")
- col.prop(gs, "glsl_shadows", text="Shadows")
+ col.prop(gs, "use_glsl_lights", text="Lights")
+ col.prop(gs, "use_glsl_shaders", text="Shaders")
+ col.prop(gs, "use_glsl_shadows", text="Shadows")
col = split.column()
- col.prop(gs, "glsl_ramps", text="Ramps")
- col.prop(gs, "glsl_nodes", text="Nodes")
- col.prop(gs, "glsl_extra_textures", text="Extra Textures")
+ col.prop(gs, "use_glsl_ramps", text="Ramps")
+ col.prop(gs, "use_glsl_nodes", text="Nodes")
+ col.prop(gs, "use_glsl_extra_textures", text="Extra Textures")
-class RENDER_PT_game_performance(RenderButtonsPanel):
+class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Performance"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
- gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
+ gs = context.scene.game_settings
split = layout.split()
@@ -366,14 +338,14 @@ class RENDER_PT_game_performance(RenderButtonsPanel):
col.prop(gs, "show_physics_visualization", text="Physics Visualization")
col.prop(gs, "use_deprecation_warnings")
- if wide_ui:
- col = split.column()
+ col = split.column()
+
col.label(text="Render:")
col.prop(gs, "use_frame_rate")
col.prop(gs, "use_display_lists")
-class RENDER_PT_game_sound(RenderButtonsPanel):
+class RENDER_PT_game_sound(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Sound"
COMPAT_ENGINES = {'BLENDER_GAME'}
@@ -381,32 +353,26 @@ class RENDER_PT_game_sound(RenderButtonsPanel):
layout = self.layout
scene = context.scene
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(scene, "distance_model")
- else:
- layout.prop(scene, "distance_model", text="")
- layout.prop(scene, "speed_of_sound", text="Speed")
- layout.prop(scene, "doppler_factor")
+ layout.prop(scene, "audio_distance_model")
+
+ layout.prop(scene, "audio_doppler_speed", text="Speed")
+ layout.prop(scene, "audio_doppler_factor")
-class WorldButtonsPanel(bpy.types.Panel):
+class WorldButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "world"
- def poll(self, context):
- scene = context.scene
- return (scene.render.engine in self.COMPAT_ENGINES) and (scene.world is not None)
-
-class WORLD_PT_game_context_world(WorldButtonsPanel):
+class WORLD_PT_game_context_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
return (context.scene) and (rd.use_game_engine)
@@ -416,76 +382,79 @@ class WORLD_PT_game_context_world(WorldButtonsPanel):
scene = context.scene
world = context.world
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if scene:
- split.template_ID(scene, "world", new="world.new")
- elif world:
- split.template_ID(space, "pin_id")
- else:
- if scene:
- layout.template_ID(scene, "world", new="world.new")
- elif world:
- layout.template_ID(space, "pin_id")
+
+ split = layout.split(percentage=0.65)
+ if scene:
+ split.template_ID(scene, "world", new="world.new")
+ elif world:
+ split.template_ID(space, "pin_id")
-class WORLD_PT_game_world(WorldButtonsPanel):
+class WORLD_PT_game_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = "World"
COMPAT_ENGINES = {'BLENDER_GAME'}
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
world = context.world
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(world, "horizon_color")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(world, "ambient_color")
-class WORLD_PT_game_mist(WorldButtonsPanel):
+class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Mist"
COMPAT_ENGINES = {'BLENDER_GAME'}
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
+
def draw_header(self, context):
world = context.world
- self.layout.prop(world.mist, "use_mist", text="")
+ self.layout.prop(world.mist_settings, "use_mist", text="")
def draw(self, context):
layout = self.layout
world = context.world
- wide_ui = context.region.width > narrowui
- layout.active = world.mist.use_mist
+ layout.active = world.mist_settings.use_mist
split = layout.split()
col = split.column()
- col.prop(world.mist, "start")
+ col.prop(world.mist_settings, "start")
- if wide_ui:
- col = split.column()
- col.prop(world.mist, "depth")
+ col = split.column()
+ col.prop(world.mist_settings, "depth")
-class WORLD_PT_game_physics(WorldButtonsPanel):
+class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
- gs = context.scene.game_data
- wide_ui = context.region.width > narrowui
+ gs = context.scene.game_settings
layout.prop(gs, "physics_engine")
if gs.physics_engine != 'NONE':
@@ -500,8 +469,7 @@ class WORLD_PT_game_physics(WorldButtonsPanel):
sub.prop(gs, "physics_step_sub", text="Substeps")
col.prop(gs, "fps", text="FPS")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Logic Steps:")
col.prop(gs, "logic_step_max", text="Max")
@@ -523,33 +491,12 @@ class WORLD_PT_game_physics(WorldButtonsPanel):
col.prop(gs, "logic_step_max", text="Max")
-classes = [
- PHYSICS_PT_game_physics,
- PHYSICS_PT_game_collision_bounds,
-
- RENDER_PT_game,
- RENDER_PT_game_player,
- RENDER_PT_game_stereo,
- RENDER_PT_game_shading,
- RENDER_PT_game_performance,
- RENDER_PT_game_sound,
-
- WORLD_PT_game_context_world,
- WORLD_PT_game_world,
- WORLD_PT_game_mist,
- WORLD_PT_game_physics]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py
index 1526bd004a0..265f7e08d3a 100644
--- a/release/scripts/ui/properties_material.py
+++ b/release/scripts/ui/properties_material.py
@@ -20,13 +20,11 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
def active_node_mat(mat):
# TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
# which settings from node-materials are used
- if mat:
+ if mat is not None:
mat_node = mat.active_node_material
if mat_node:
return mat_node
@@ -54,37 +52,29 @@ class MATERIAL_MT_specials(bpy.types.Menu):
layout.operator("material.paste", icon='PASTEDOWN')
-class MaterialButtonsPanel(bpy.types.Panel):
+class MaterialButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "material"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
- def poll(self, context):
- mat = context.material
- engine = context.scene.render.engine
- return mat and (engine in self.COMPAT_ENGINES)
-
+ @classmethod
+ def poll(cls, context):
+ return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
-class MATERIAL_PT_preview(MaterialButtonsPanel):
- bl_label = "Preview"
- COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def draw(self, context):
- self.layout.template_preview(context.material)
-
-
-class MATERIAL_PT_context_material(MaterialButtonsPanel):
+class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
# An exception, dont call the parent poll func because
# this manages materials for all engine types
engine = context.scene.render.engine
- return (context.material or context.object) and (engine in self.COMPAT_ENGINES)
+ return (context.material or context.object) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -93,7 +83,6 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel):
ob = context.object
slot = context.material_slot
space = context.space_data
- wide_ui = context.region.width > narrowui
if ob:
row = layout.row()
@@ -112,262 +101,64 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel):
row.operator("object.material_slot_select", text="Select")
row.operator("object.material_slot_deselect", text="Deselect")
- if wide_ui:
- split = layout.split(percentage=0.65)
-
- if ob:
- split.template_ID(ob, "active_material", new="material.new")
- row = split.row()
- if slot:
- row.prop(slot, "link", text="")
- else:
- row.label()
- elif mat:
- split.template_ID(space, "pin_id")
- split.separator()
- else:
- if ob:
- layout.template_ID(ob, "active_material", new="material.new")
- elif mat:
- layout.template_ID(space, "pin_id")
-
- if mat:
- if wide_ui:
- layout.prop(mat, "type", expand=True)
- else:
- layout.prop(mat, "type", text="")
-
-
-class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel):
- COMPAT_ENGINES = {'BLENDER_RENDER'}
- _context_path = "material"
-
-
-class MATERIAL_PT_shading(MaterialButtonsPanel):
- bl_label = "Shading"
- COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
-
- def poll(self, context):
- mat = active_node_mat(context.material)
- engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
-
- def draw(self, context):
- layout = self.layout
-
- mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
-
- if mat.type in ('SURFACE', 'WIRE'):
- split = layout.split()
-
- col = split.column()
- sub = col.column()
- sub.active = not mat.shadeless
- sub.prop(mat, "emit")
- sub.prop(mat, "ambient")
- sub = col.column()
- sub.prop(mat, "translucency")
-
- if wide_ui:
- col = split.column()
- col.prop(mat, "shadeless")
- sub = col.column()
- sub.active = not mat.shadeless
- sub.prop(mat, "tangent_shading")
- sub.prop(mat, "cubic")
-
- elif mat.type == 'HALO':
- layout.prop(mat, "alpha")
-
-
-class MATERIAL_PT_strand(MaterialButtonsPanel):
- bl_label = "Strand"
- bl_default_closed = True
- COMPAT_ENGINES = {'BLENDER_RENDER'}
-
- def poll(self, context):
- mat = context.material
- engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
-
- def draw(self, context):
- layout = self.layout
-
- mat = context.material # dont use node material
- tan = mat.strand
- wide_ui = context.region.width > narrowui
-
- split = layout.split()
-
- col = split.column()
- sub = col.column(align=True)
- sub.label(text="Size:")
- sub.prop(tan, "root_size", text="Root")
- sub.prop(tan, "tip_size", text="Tip")
- sub.prop(tan, "min_size", text="Minimum")
- sub.prop(tan, "blender_units")
- sub = col.column()
- sub.active = (not mat.shadeless)
- sub.prop(tan, "tangent_shading")
- col.prop(tan, "shape")
-
- if wide_ui:
- col = split.column()
- col.label(text="Shading:")
- col.prop(tan, "width_fade")
- ob = context.object
- if ob and ob.type == 'MESH':
- col.prop_object(tan, "uv_layer", ob.data, "uv_textures", text="")
- else:
- col.prop(tan, "uv_layer", text="")
- col.separator()
- sub = col.column()
- sub.active = (not mat.shadeless)
- sub.prop(tan, "surface_diffuse")
- sub = col.column()
- sub.active = tan.surface_diffuse
- sub.prop(tan, "blend_distance", text="Distance")
-
-
-class MATERIAL_PT_physics(MaterialButtonsPanel):
- bl_label = "Physics"
- COMPAT_ENGINES = {'BLENDER_GAME'}
-
- def draw(self, context):
- layout = self.layout
-
- phys = context.material.physics # dont use node material
- wide_ui = context.region.width > narrowui
-
- split = layout.split()
-
- col = split.column()
- col.prop(phys, "distance")
- col.prop(phys, "friction")
- col.prop(phys, "align_to_normal")
-
- if wide_ui:
- col = split.column()
- col.prop(phys, "force", slider=True)
- col.prop(phys, "elasticity", slider=True)
- col.prop(phys, "damp", slider=True)
-
+ split = layout.split(percentage=0.65)
-class MATERIAL_PT_options(MaterialButtonsPanel):
- bl_label = "Options"
- COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
-
- def poll(self, context):
- mat = active_node_mat(context.material)
- engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
-
- def draw(self, context):
- layout = self.layout
-
- mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
-
- split = layout.split()
-
- col = split.column()
- col.prop(mat, "traceable")
- col.prop(mat, "full_oversampling")
- col.prop(mat, "use_sky")
- col.prop(mat, "exclude_mist")
- col.prop(mat, "invert_z")
- sub = col.row()
- sub.prop(mat, "z_offset")
- sub.active = mat.transparency and mat.transparency_method == 'Z_TRANSPARENCY'
- sub = col.column(align=True)
- sub.label(text="Light Group:")
- sub.prop(mat, "light_group", text="")
- row = sub.row()
- row.active = bool(mat.light_group)
- row.prop(mat, "light_group_exclusive", text="Exclusive")
+ if ob:
+ split.template_ID(ob, "active_material", new="material.new")
+ row = split.row()
+ if mat:
+ row.prop(mat, "use_nodes", icon="NODETREE", text="")
- if wide_ui:
- col = split.column()
- col.prop(mat, "face_texture")
- sub = col.column()
- sub.active = mat.face_texture
- sub.prop(mat, "face_texture_alpha")
- col.separator()
- col.prop(mat, "vertex_color_paint")
- col.prop(mat, "vertex_color_light")
- col.prop(mat, "object_color")
+ if slot:
+ row.prop(slot, "link", text="")
+ else:
+ row.label()
+ elif mat:
+ split.template_ID(space, "pin_id")
+ split.separator()
+ if mat:
+ layout.prop(mat, "type", expand=True)
+
-class MATERIAL_PT_shadow(MaterialButtonsPanel):
- bl_label = "Shadow"
- bl_default_closed = True
+class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
- mat = active_node_mat(context.material)
- engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
-
def draw(self, context):
- layout = self.layout
-
- mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
-
- split = layout.split()
-
- col = split.column()
- col.prop(mat, "shadows", text="Receive")
- col.prop(mat, "receive_transparent_shadows", text="Receive Transparent")
- col.prop(mat, "only_shadow", text="Shadows Only")
- col.prop(mat, "cast_shadows_only", text="Cast Only")
- col.prop(mat, "shadow_casting_alpha", text="Casting Alpha")
-
- if wide_ui:
- col = split.column()
- col.prop(mat, "cast_buffer_shadows")
- sub = col.column()
- sub.active = mat.cast_buffer_shadows
- sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias")
- col.prop(mat, "ray_shadow_bias", text="Auto Ray Bias")
- sub = col.column()
- sub.active = (not mat.ray_shadow_bias)
- sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
- col.prop(mat, "cast_approximate")
+ self.layout.template_preview(context.material)
-class MATERIAL_PT_diffuse(MaterialButtonsPanel):
+class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Diffuse"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(mat, "diffuse_color", text="")
sub = col.column()
- sub.active = (not mat.shadeless)
+ sub.active = (not mat.use_shadeless)
sub.prop(mat, "diffuse_intensity", text="Intensity")
- if wide_ui:
- col = split.column()
- col.active = (not mat.shadeless)
+ col = split.column()
+ col.active = (not mat.use_shadeless)
col.prop(mat, "diffuse_shader", text="")
col.prop(mat, "use_diffuse_ramp", text="Ramp")
col = layout.column()
- col.active = (not mat.shadeless)
+ col.active = (not mat.use_shadeless)
if mat.diffuse_shader == 'OREN_NAYAR':
col.prop(mat, "roughness")
elif mat.diffuse_shader == 'MINNAERT':
@@ -378,8 +169,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "diffuse_toon_size", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "diffuse_toon_smooth", text="Smooth")
elif mat.diffuse_shader == 'FRESNEL':
split = col.split()
@@ -387,8 +177,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "diffuse_fresnel", text="Fresnel")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "diffuse_fresnel_factor", text="Factor")
if mat.use_diffuse_ramp:
@@ -401,29 +190,28 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "diffuse_ramp_input", text="Input")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "diffuse_ramp_blend", text="Blend")
row = layout.row()
row.prop(mat, "diffuse_ramp_factor", text="Factor")
-class MATERIAL_PT_specular(MaterialButtonsPanel):
+class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Specular"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
- layout.active = (not mat.shadeless)
+ layout.active = (not mat.use_shadeless)
split = layout.split()
@@ -431,8 +219,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
col.prop(mat, "specular_color", text="")
col.prop(mat, "specular_intensity", text="Intensity")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "specular_shader", text="")
col.prop(mat, "use_specular_ramp", text="Ramp")
@@ -445,8 +232,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "specular_hardness", text="Hardness")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "specular_ior", text="IOR")
elif mat.specular_shader == 'WARDISO':
col.prop(mat, "specular_slope", text="Slope")
@@ -456,8 +242,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "specular_toon_size", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "specular_toon_smooth", text="Smooth")
if mat.use_specular_ramp:
@@ -469,89 +254,135 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "specular_ramp_input", text="Input")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(mat, "specular_ramp_blend", text="Blend")
row = layout.row()
row.prop(mat, "specular_ramp_factor", text="Factor")
-class MATERIAL_PT_sss(MaterialButtonsPanel):
- bl_label = "Subsurface Scattering"
+class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Shading"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = active_node_mat(context.material)
+ engine = context.scene.render.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = active_node_mat(context.material)
+
+ if mat.type in ('SURFACE', 'WIRE'):
+ split = layout.split()
+
+ col = split.column()
+ sub = col.column()
+ sub.active = not mat.use_shadeless
+ sub.prop(mat, "emit")
+ sub.prop(mat, "ambient")
+ sub = col.column()
+ sub.prop(mat, "translucency")
+
+ col = split.column()
+ col.prop(mat, "use_shadeless")
+ sub = col.column()
+ sub.active = not mat.use_shadeless
+ sub.prop(mat, "use_tangent_shading")
+ sub.prop(mat, "use_cubic")
+
+ elif mat.type == 'HALO':
+ layout.prop(mat, "alpha")
+
+
+class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Transparency"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
- sss = mat.subsurface_scattering
- self.layout.active = (not mat.shadeless)
- self.layout.prop(sss, "enabled", text="")
+ self.layout.prop(mat, "use_transparency", text="")
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
- sss = mat.subsurface_scattering
- wide_ui = context.region.width > narrowui
-
- layout.active = (sss.enabled) and (not mat.shadeless)
+ rayt = mat.raytrace_transparency
- row = layout.row().split()
- sub = row.row(align=True).split(percentage=0.75)
- sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_presets.bl_label)
- sub.operator("material.sss_preset_add", text="", icon="ZOOMIN")
+ row = layout.row()
+ row.active = mat.use_transparency and (not mat.use_shadeless)
+ row.prop(mat, "transparency_method", expand=True)
split = layout.split()
col = split.column()
- col.prop(sss, "ior")
- col.prop(sss, "scale")
- col.prop(sss, "color", text="")
- col.prop(sss, "radius", text="RGB Radius", expand=True)
+ col.prop(mat, "alpha")
+ row = col.row()
+ row.active = mat.use_transparency and (not mat.use_shadeless)
+ row.prop(mat, "specular_alpha", text="Specular")
+
+ col = split.column()
+ col.active = (not mat.use_shadeless)
+ col.prop(rayt, "fresnel")
+ sub = col.column()
+ sub.active = rayt.fresnel > 0
+ sub.prop(rayt, "fresnel_factor", text="Blend")
+
+ if mat.transparency_method == 'RAYTRACE':
+ layout.separator()
+ split = layout.split()
+ split.active = mat.use_transparency
- if wide_ui:
col = split.column()
- sub = col.column(align=True)
- sub.label(text="Blend:")
- sub.prop(sss, "color_factor", text="Color")
- sub.prop(sss, "texture_factor", text="Texture")
- sub.label(text="Scattering Weight:")
- sub.prop(sss, "front")
- sub.prop(sss, "back")
- col.separator()
- col.prop(sss, "error_tolerance", text="Error")
+ col.prop(rayt, "ior")
+ col.prop(rayt, "filter")
+ col.prop(rayt, "falloff")
+ col.prop(rayt, "depth_max")
+ col.prop(rayt, "depth")
+ col = split.column()
+ col.label(text="Gloss:")
+ col.prop(rayt, "gloss_factor", text="Amount")
+ sub = col.column()
+ sub.active = rayt.gloss_factor < 1.0
+ sub.prop(rayt, "gloss_threshold", text="Threshold")
+ sub.prop(rayt, "gloss_samples", text="Samples")
-class MATERIAL_PT_mirror(MaterialButtonsPanel):
+
+class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Mirror"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
raym = active_node_mat(context.material).raytrace_mirror
- self.layout.prop(raym, "enabled", text="")
+ self.layout.prop(raym, "use", text="")
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
raym = mat.raytrace_mirror
- wide_ui = context.region.width > narrowui
- layout.active = raym.enabled
+ layout.active = raym.use
split = layout.split()
@@ -559,8 +390,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel):
col.prop(raym, "reflect_factor")
col.prop(mat, "mirror_color", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(raym, "fresnel")
sub = col.column()
sub.active = raym.fresnel > 0
@@ -578,8 +408,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel):
sub.label(text="Fade To:")
sub.prop(raym, "fade_to", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Gloss:")
col.prop(raym, "gloss_factor", text="Amount")
sub = col.column()
@@ -589,123 +418,72 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel):
sub.prop(raym, "gloss_anisotropic", text="Anisotropic")
-class MATERIAL_PT_transp(MaterialButtonsPanel):
- bl_label = "Transparency"
+class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Subsurface Scattering"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = active_node_mat(context.material)
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
+ sss = mat.subsurface_scattering
- self.layout.prop(mat, "transparency", text="")
+ self.layout.active = (not mat.use_shadeless)
+ self.layout.prop(sss, "use", text="")
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
- rayt = mat.raytrace_transparency
- wide_ui = context.region.width > narrowui
+ sss = mat.subsurface_scattering
- row = layout.row()
- row.active = mat.transparency and (not mat.shadeless)
- if wide_ui:
- row.prop(mat, "transparency_method", expand=True)
- else:
- row.prop(mat, "transparency_method", text="")
+ layout.active = (sss.use) and (not mat.use_shadeless)
+
+ row = layout.row().split()
+ sub = row.row(align=True).split(percentage=0.75)
+ sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_presets.bl_label)
+ sub.operator("material.sss_preset_add", text="", icon="ZOOMIN")
split = layout.split()
col = split.column()
- col.prop(mat, "alpha")
- row = col.row()
- row.active = mat.transparency and (not mat.shadeless)
- row.prop(mat, "specular_alpha", text="Specular")
-
- if wide_ui:
- col = split.column()
- col.active = (not mat.shadeless)
- col.prop(rayt, "fresnel")
- sub = col.column()
- sub.active = rayt.fresnel > 0
- sub.prop(rayt, "fresnel_factor", text="Blend")
-
- if mat.transparency_method == 'RAYTRACE':
- layout.separator()
- split = layout.split()
- split.active = mat.transparency
-
- col = split.column()
- col.prop(rayt, "ior")
- col.prop(rayt, "filter")
- col.prop(rayt, "falloff")
- col.prop(rayt, "limit")
- col.prop(rayt, "depth")
-
- if wide_ui:
- col = split.column()
- col.label(text="Gloss:")
- col.prop(rayt, "gloss_factor", text="Amount")
- sub = col.column()
- sub.active = rayt.gloss_factor < 1.0
- sub.prop(rayt, "gloss_threshold", text="Threshold")
- sub.prop(rayt, "gloss_samples", text="Samples")
-
-
-class MATERIAL_PT_transp_game(MaterialButtonsPanel):
- bl_label = "Transparency"
- bl_default_closed = True
- COMPAT_ENGINES = {'BLENDER_GAME'}
-
- def poll(self, context):
- mat = active_node_mat(context.material)
- engine = context.scene.render.engine
- return mat and (engine in self.COMPAT_ENGINES)
-
- def draw_header(self, context):
- mat = active_node_mat(context.material)
-
- self.layout.prop(mat, "transparency", text="")
-
- def draw(self, context):
- layout = self.layout
-
- mat = active_node_mat(context.material)
- rayt = mat.raytrace_transparency
- wide_ui = context.region.width > narrowui
-
- row = layout.row()
- row.active = mat.transparency and (not mat.shadeless)
- if wide_ui:
- row.prop(mat, "transparency_method", expand=True)
- else:
- row.prop(mat, "transparency_method", text="")
-
- split = layout.split()
+ col.prop(sss, "ior")
+ col.prop(sss, "scale")
+ col.prop(sss, "color", text="")
+ col.prop(sss, "radius", text="RGB Radius", expand=True)
col = split.column()
- col.prop(mat, "alpha")
+ sub = col.column(align=True)
+ sub.label(text="Blend:")
+ sub.prop(sss, "color_factor", text="Color")
+ sub.prop(sss, "texture_factor", text="Texture")
+ sub.label(text="Scattering Weight:")
+ sub.prop(sss, "front")
+ sub.prop(sss, "back")
+ col.separator()
+ col.prop(sss, "error_threshold", text="Error")
-class MATERIAL_PT_halo(MaterialButtonsPanel):
+class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Halo"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material # dont use node material
halo = mat.halo
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -715,54 +493,53 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
col.prop(halo, "hardness")
col.prop(halo, "add")
col.label(text="Options:")
- col.prop(halo, "texture")
- col.prop(halo, "vertex_normal")
- col.prop(halo, "xalpha")
- col.prop(halo, "shaded")
- col.prop(halo, "soft")
+ col.prop(halo, "use_texture")
+ col.prop(halo, "use_vertex_normal")
+ col.prop(halo, "use_extreme_alpha")
+ col.prop(halo, "use_shaded")
+ col.prop(halo, "use_soft")
- if wide_ui:
- col = split.column()
- col.prop(halo, "ring")
+ col = split.column()
+ col.prop(halo, "use_ring")
sub = col.column()
- sub.active = halo.ring
- sub.prop(halo, "rings")
+ sub.active = halo.use_ring
+ sub.prop(halo, "ring_count")
sub.prop(mat, "mirror_color", text="")
col.separator()
- col.prop(halo, "lines")
+ col.prop(halo, "use_lines")
sub = col.column()
- sub.active = halo.lines
- sub.prop(halo, "line_number", text="Lines")
+ sub.active = halo.use_lines
+ sub.prop(halo, "line_count", text="Lines")
sub.prop(mat, "specular_color", text="")
col.separator()
- col.prop(halo, "star")
+ col.prop(halo, "use_star")
sub = col.column()
- sub.active = halo.star
- sub.prop(halo, "star_tips")
+ sub.active = halo.use_star
+ sub.prop(halo, "star_tip_count")
-class MATERIAL_PT_flare(MaterialButtonsPanel):
+class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Flare"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
halo = context.material.halo
- self.layout.prop(halo, "flare_mode", text="")
+ self.layout.prop(halo, "use_flare_mode", text="")
def draw(self, context):
layout = self.layout
mat = context.material # dont use node material
halo = mat.halo
- wide_ui = context.region.width > narrowui
- layout.active = halo.flare_mode
+ layout.active = halo.use_flare_mode
split = layout.split()
@@ -770,24 +547,213 @@ class MATERIAL_PT_flare(MaterialButtonsPanel):
col.prop(halo, "flare_size", text="Size")
col.prop(halo, "flare_boost", text="Boost")
col.prop(halo, "flare_seed", text="Seed")
- if wide_ui:
- col = split.column()
- col.prop(halo, "flares_sub", text="Subflares")
- col.prop(halo, "flare_subsize", text="Subsize")
+ col = split.column()
+ col.prop(halo, "flare_subflare_count", text="Subflares")
+ col.prop(halo, "flare_subflare_size", text="Subsize")
+
+
+class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Physics"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ phys = context.material.physics # dont use node material
+
+ split = layout.split()
-class VolumeButtonsPanel(bpy.types.Panel):
+ col = split.column()
+ col.prop(phys, "distance")
+ col.prop(phys, "friction")
+ col.prop(phys, "use_normal_align")
+
+ col = split.column()
+ col.prop(phys, "force", slider=True)
+ col.prop(phys, "elasticity", slider=True)
+ col.prop(phys, "damping", slider=True)
+
+
+class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Strand"
+ bl_default_closed = True
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = context.material # dont use node material
+ tan = mat.strand
+
+ split = layout.split()
+
+ col = split.column()
+ sub = col.column(align=True)
+ sub.label(text="Size:")
+ sub.prop(tan, "root_size", text="Root")
+ sub.prop(tan, "tip_size", text="Tip")
+ sub.prop(tan, "size_min", text="Minimum")
+ sub.prop(tan, "use_blender_units")
+ sub = col.column()
+ sub.active = (not mat.use_shadeless)
+ sub.prop(tan, "use_tangent_shading")
+ col.prop(tan, "shape")
+
+ col = split.column()
+ col.label(text="Shading:")
+ col.prop(tan, "width_fade")
+ ob = context.object
+ if ob and ob.type == 'MESH':
+ col.prop_object(tan, "uv_layer", ob.data, "uv_textures", text="")
+ else:
+ col.prop(tan, "uv_layer", text="")
+ col.separator()
+ sub = col.column()
+ sub.active = (not mat.use_shadeless)
+ sub.prop(tan, "use_surface_diffuse")
+ sub = col.column()
+ sub.active = tan.use_surface_diffuse
+ sub.prop(tan, "blend_distance", text="Distance")
+
+
+class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Options"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = active_node_mat(context.material)
+ engine = context.scene.render.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = active_node_mat(context.material)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(mat, "use_raytrace")
+ col.prop(mat, "use_full_oversampling")
+ col.prop(mat, "use_sky")
+ col.prop(mat, "use_mist")
+ col.prop(mat, "invert_z")
+ sub = col.row()
+ sub.prop(mat, "offset_z")
+ sub.active = mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
+ sub = col.column(align=True)
+ sub.label(text="Light Group:")
+ sub.prop(mat, "light_group", text="")
+ row = sub.row()
+ row.active = bool(mat.light_group)
+ row.prop(mat, "use_light_group_exclusive", text="Exclusive")
+
+ col = split.column()
+ col.prop(mat, "use_face_texture")
+ sub = col.column()
+ sub.active = mat.use_face_texture
+ sub.prop(mat, "use_face_texture_alpha")
+ col.separator()
+ col.prop(mat, "use_vertex_color_paint")
+ col.prop(mat, "use_vertex_color_light")
+ col.prop(mat, "use_object_color")
+
+
+class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Shadow"
+ bl_default_closed = True
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = active_node_mat(context.material)
+ engine = context.scene.render.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = active_node_mat(context.material)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(mat, "use_shadows", text="Receive")
+ col.prop(mat, "use_transparent_shadows", text="Receive Transparent")
+ col.prop(mat, "use_only_shadow", text="Shadows Only")
+ col.prop(mat, "use_cast_shadows_only", text="Cast Only")
+ col.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
+
+ col = split.column()
+ col.prop(mat, "use_cast_buffer_shadows")
+ sub = col.column()
+ sub.active = mat.use_cast_buffer_shadows
+ sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias")
+ col.prop(mat, "use_ray_shadow_bias", text="Auto Ray Bias")
+ sub = col.column()
+ sub.active = (not mat.use_ray_shadow_bias)
+ sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
+ col.prop(mat, "use_cast_approximate")
+
+
+class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Transparency"
+ bl_default_closed = True
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = active_node_mat(context.material)
+ engine = context.scene.render.engine
+ return mat and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self, context):
+ mat = active_node_mat(context.material)
+
+ self.layout.prop(mat, "use_transparency", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = active_node_mat(context.material)
+ rayt = mat.raytrace_transparency
+
+ row = layout.row()
+ row.active = mat.use_transparency and (not mat.use_shadeless)
+ row.prop(mat, "transparency_method", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(mat, "alpha")
+
+
+class VolumeButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "material"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES)
+ return mat and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
-class MATERIAL_PT_volume_density(VolumeButtonsPanel):
+class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Density"
bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -796,18 +762,16 @@ class MATERIAL_PT_volume_density(VolumeButtonsPanel):
layout = self.layout
vol = context.material.volume # dont use node material
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(vol, "density")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(vol, "density_scale")
-class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
+class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -816,7 +780,6 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
layout = self.layout
vol = context.material.volume # dont use node material
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -825,8 +788,7 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
col.prop(vol, "asymmetry")
col.prop(vol, "transmission_color")
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column(align=True)
sub.prop(vol, "emission")
sub.prop(vol, "emission_color", text="")
@@ -835,7 +797,7 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel):
sub.prop(vol, "reflection_color", text="")
-class MATERIAL_PT_volume_lighting(VolumeButtonsPanel):
+class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Lighting"
bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -844,27 +806,25 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel):
layout = self.layout
vol = context.material.volume # dont use node material
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
- col.prop(vol, "lighting_mode", text="")
+ col.prop(vol, "light_method", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
- if vol.lighting_mode == 'SHADED':
- col.prop(vol, "external_shadows")
- col.prop(vol, "light_cache")
+ if vol.light_method == 'SHADED':
+ col.prop(vol, "use_external_shadows")
+ col.prop(vol, "use_light_cache")
sub = col.column()
- sub.active = vol.light_cache
+ sub.active = vol.use_light_cache
sub.prop(vol, "cache_resolution")
- elif vol.lighting_mode in ('MULTIPLE_SCATTERING', 'SHADED_PLUS_MULTIPLE_SCATTERING'):
+ elif vol.light_method in ('MULTIPLE_SCATTERING', 'SHADED_PLUS_MULTIPLE_SCATTERING'):
sub = col.column()
sub.enabled = True
sub.active = False
- sub.prop(vol, "light_cache")
+ sub.prop(vol, "use_light_cache")
col.prop(vol, "cache_resolution")
sub = col.column(align=True)
@@ -873,7 +833,7 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel):
sub.prop(vol, "ms_intensity")
-class MATERIAL_PT_volume_transp(VolumeButtonsPanel):
+class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Transparency"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -881,15 +841,11 @@ class MATERIAL_PT_volume_transp(VolumeButtonsPanel):
layout = self.layout
mat = context.material # dont use node material
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(mat, "transparency_method", expand=True)
- else:
- layout.prop(mat, "transparency_method", text="")
+ layout.prop(mat, "transparency_method", expand=True)
-class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
+class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Integration"
bl_default_closed = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -898,23 +854,21 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
layout = self.layout
vol = context.material.volume # dont use node material
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.label(text="Step Calculation:")
- col.prop(vol, "step_calculation", text="")
+ col.prop(vol, "step_method", text="")
col = col.column(align=True)
col.prop(vol, "step_size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label()
- col.prop(vol, "depth_cutoff")
+ col.prop(vol, "depth_threshold")
-class MATERIAL_PT_volume_options(VolumeButtonsPanel):
+class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Options"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
bl_default_closed = True
@@ -923,63 +877,33 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel):
layout = self.layout
mat = active_node_mat(context.material)
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
- col.prop(mat, "traceable")
- col.prop(mat, "full_oversampling")
- col.prop(mat, "exclude_mist")
+ col.prop(mat, "use_raytrace")
+ col.prop(mat, "use_full_oversampling")
+ col.prop(mat, "use_mist")
col = split.column()
col.label(text="Light Group:")
col.prop(mat, "light_group", text="")
row = col.row()
row.active = bool(mat.light_group)
- row.prop(mat, "light_group_exclusive", text="Exclusive")
-
-
-classes = [
- MATERIAL_PT_context_material,
- MATERIAL_PT_preview,
- MATERIAL_PT_diffuse,
- MATERIAL_PT_specular,
- MATERIAL_PT_shading,
- MATERIAL_PT_transp,
- MATERIAL_PT_mirror,
- MATERIAL_PT_sss,
- MATERIAL_PT_halo,
- MATERIAL_PT_flare,
- MATERIAL_PT_physics,
- MATERIAL_PT_strand,
- MATERIAL_PT_options,
- MATERIAL_PT_shadow,
- MATERIAL_PT_transp_game,
-
- MATERIAL_MT_sss_presets,
- MATERIAL_MT_specials,
-
- MATERIAL_PT_volume_density,
- MATERIAL_PT_volume_shading,
- MATERIAL_PT_volume_lighting,
- MATERIAL_PT_volume_transp,
- MATERIAL_PT_volume_integration,
- MATERIAL_PT_volume_options,
-
- MATERIAL_PT_custom_props]
+ row.prop(mat, "use_light_group_exclusive", text="Exclusive")
+
+
+class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "material"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py
index 4e60879d665..a87a43a7998 100644
--- a/release/scripts/ui/properties_object.py
+++ b/release/scripts/ui/properties_object.py
@@ -20,16 +20,14 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class ObjectButtonsPanel(bpy.types.Panel):
+class ObjectButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
-class OBJECT_PT_context_object(ObjectButtonsPanel):
+class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
@@ -46,51 +44,33 @@ class OBJECT_PT_context_object(ObjectButtonsPanel):
row.prop(ob, "name", text="")
-class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel):
- _context_path = "object"
-
-
-class OBJECT_PT_transform(ObjectButtonsPanel):
+class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Transform"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
- if wide_ui:
- row = layout.row()
+ row = layout.row()
- row.column().prop(ob, "location")
- if ob.rotation_mode == 'QUATERNION':
- row.column().prop(ob, "rotation_quaternion", text="Rotation")
- elif ob.rotation_mode == 'AXIS_ANGLE':
- #row.column().label(text="Rotation")
- #row.column().prop(pchan, "rotation_angle", text="Angle")
- #row.column().prop(pchan, "rotation_axis", text="Axis")
- row.column().prop(ob, "rotation_axis_angle", text="Rotation")
- else:
- row.column().prop(ob, "rotation_euler", text="Rotation")
+ row.column().prop(ob, "location")
+ if ob.rotation_mode == 'QUATERNION':
+ row.column().prop(ob, "rotation_quaternion", text="Rotation")
+ elif ob.rotation_mode == 'AXIS_ANGLE':
+ #row.column().label(text="Rotation")
+ #row.column().prop(pchan, "rotation_angle", text="Angle")
+ #row.column().prop(pchan, "rotation_axis", text="Axis")
+ row.column().prop(ob, "rotation_axis_angle", text="Rotation")
+ else:
+ row.column().prop(ob, "rotation_euler", text="Rotation")
- row.column().prop(ob, "scale")
+ row.column().prop(ob, "scale")
- layout.prop(ob, "rotation_mode")
- else:
- col = layout.column()
- col.prop(ob, "location")
- col.label(text="Rotation:")
- col.prop(ob, "rotation_mode", text="")
- if ob.rotation_mode == 'QUATERNION':
- col.prop(ob, "rotation_quaternion", text="")
- elif ob.rotation_mode == 'AXIS_ANGLE':
- col.prop(ob, "rotation_axis_angle", text="")
- else:
- col.prop(ob, "rotation_euler", text="")
- col.prop(ob, "scale")
-
-
-class OBJECT_PT_transform_locks(ObjectButtonsPanel):
+ layout.prop(ob, "rotation_mode")
+
+
+class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Transform Locks"
bl_default_closed = True
@@ -98,7 +78,6 @@ class OBJECT_PT_transform_locks(ObjectButtonsPanel):
layout = self.layout
ob = context.object
- # wide_ui = context.region.width > narrowui
row = layout.row()
@@ -117,14 +96,13 @@ class OBJECT_PT_transform_locks(ObjectButtonsPanel):
row.column().prop(ob, "lock_scale", text="Scale")
-class OBJECT_PT_relations(ObjectButtonsPanel):
+class OBJECT_PT_relations(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Relations"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -133,8 +111,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel):
col.separator()
col.prop(ob, "pass_index")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Parent:")
col.prop(ob, "parent", text="")
@@ -146,14 +123,13 @@ class OBJECT_PT_relations(ObjectButtonsPanel):
sub.active = (parent is not None)
-class OBJECT_PT_groups(ObjectButtonsPanel):
+class OBJECT_PT_groups(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Groups"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
row = layout.row(align=True)
row.operator("object.group_link", text="Add to Group")
@@ -175,10 +151,9 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
split = col.box().split()
col = split.column()
- col.prop(group, "layer", text="Dupli")
+ col.prop(group, "layers", text="Dupli")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(group, "dupli_offset", text="")
prop = col.operator("wm.context_set_value", text="From Cursor")
@@ -187,55 +162,48 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
index += 1
-class OBJECT_PT_display(ObjectButtonsPanel):
+class OBJECT_PT_display(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Display"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
- col.prop(ob, "max_draw_type", text="Type")
+ col.prop(ob, "draw_type", text="Type")
- if wide_ui:
- col = split.column()
+ col = split.column()
row = col.row()
- row.prop(ob, "draw_bounds", text="Bounds")
+ row.prop(ob, "show_bounds", text="Bounds")
sub = row.row()
- sub.active = ob.draw_bounds
+ sub.active = ob.show_bounds
sub.prop(ob, "draw_bounds_type", text="")
split = layout.split()
col = split.column()
- col.prop(ob, "draw_name", text="Name")
- col.prop(ob, "draw_axis", text="Axis")
- col.prop(ob, "draw_wire", text="Wire")
+ col.prop(ob, "show_name", text="Name")
+ col.prop(ob, "show_axis", text="Axis")
+ col.prop(ob, "show_wire", text="Wire")
col.prop(ob, "color", text="Object Color")
- if wide_ui:
- col = split.column()
- col.prop(ob, "draw_texture_space", text="Texture Space")
- col.prop(ob, "x_ray", text="X-Ray")
- col.prop(ob, "draw_transparent", text="Transparency")
+ col = split.column()
+ col.prop(ob, "show_texture_space", text="Texture Space")
+ col.prop(ob, "show_x_ray", text="X-Ray")
+ col.prop(ob, "show_transparent", text="Transparency")
-class OBJECT_PT_duplication(ObjectButtonsPanel):
+class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Duplication"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(ob, "dupli_type", expand=True)
- else:
- layout.prop(ob, "dupli_type", text="")
+ layout.prop(ob, "dupli_type", expand=True)
if ob.dupli_type == 'FRAMES':
split = layout.split()
@@ -244,15 +212,14 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
col.prop(ob, "dupli_frames_start", text="Start")
col.prop(ob, "dupli_frames_end", text="End")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.prop(ob, "dupli_frames_on", text="On")
col.prop(ob, "dupli_frames_off", text="Off")
layout.prop(ob, "use_dupli_frames_speed", text="Speed")
elif ob.dupli_type == 'VERTS':
- layout.prop(ob, "use_dupli_verts_rotation", text="Rotation")
+ layout.prop(ob, "use_dupli_vertices_rotation", text="Rotation")
elif ob.dupli_type == 'FACES':
split = layout.split()
@@ -260,20 +227,16 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
col = split.column()
col.prop(ob, "use_dupli_faces_scale", text="Scale")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(ob, "dupli_faces_scale", text="Inherit Scale")
elif ob.dupli_type == 'GROUP':
- if wide_ui:
- layout.prop(ob, "dupli_group", text="Group")
- else:
- layout.prop(ob, "dupli_group", text="")
+ layout.prop(ob, "dupli_group", text="Group")
-# XXX: the following options are all quite buggy, ancient hacks that should be dropped
+# XXX: the following options are all quite buggy, ancient hacks that should be dropped
-class OBJECT_PT_animation(ObjectButtonsPanel):
+class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Animation Hacks"
bl_default_closed = True
@@ -281,61 +244,85 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.label(text="Time Offset:")
- col.prop(ob, "time_offset_edit", text="Edit")
+ col.prop(ob, "use_time_offset_edit", text="Edit")
row = col.row()
- row.prop(ob, "time_offset_particle", text="Particle")
- row.active = len(ob.particle_systems) != 0
+ row.prop(ob, "use_time_offset_particle", text="Particle")
+ row.active = bool(ob.particle_systems)
row = col.row()
- row.prop(ob, "time_offset_parent", text="Parent")
+ row.prop(ob, "use_time_offset_parent", text="Parent")
row.active = (ob.parent is not None)
row = col.row()
- row.prop(ob, "slow_parent")
+ row.prop(ob, "use_slow_parent")
row.active = (ob.parent is not None)
col.prop(ob, "time_offset", text="Offset")
# XXX: these are still used for a few curve-related tracking features
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Tracking Axes:")
col.prop(ob, "track_axis", text="Axis")
col.prop(ob, "up_axis", text="Up Axis")
+from properties_animviz import MotionPathButtonsPanel, OnionSkinButtonsPanel
+
-# import generic panels from other files
-from properties_animviz import OBJECT_PT_motion_paths, OBJECT_PT_onion_skinning
+class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
+ #bl_label = "Object Motion Paths"
+ bl_context = "object"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
-classes = [
- OBJECT_PT_context_object,
- OBJECT_PT_transform,
- OBJECT_PT_transform_locks,
- OBJECT_PT_relations,
- OBJECT_PT_groups,
- OBJECT_PT_display,
- OBJECT_PT_duplication,
- OBJECT_PT_animation, # XXX: panel of old hacks pending to be removed...
+ self.draw_settings(context, ob.animation_visualisation)
- OBJECT_PT_motion_paths,
- #OBJECT_PT_onion_skinning,
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.operator("object.paths_calculate", text="Calculate Paths")
+
+ col = split.column()
+ col.operator("object.paths_clear", text="Clear Paths")
- OBJECT_PT_custom_props]
+
+class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inherit from panel when ready
+ #bl_label = "Object Onion Skinning"
+ bl_context = "object"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ self.draw_settings(context, ob.animation_visualisation)
+
+
+class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_object_constraint.py b/release/scripts/ui/properties_object_constraint.py
index 335bd25b501..8a8142a790f 100644
--- a/release/scripts/ui/properties_object_constraint.py
+++ b/release/scripts/ui/properties_object_constraint.py
@@ -19,11 +19,8 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-narrowcon = 260
-
-class ConstraintButtonsPanel(bpy.types.Panel):
+class ConstraintButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "constraint"
@@ -31,52 +28,38 @@ class ConstraintButtonsPanel(bpy.types.Panel):
def draw_constraint(self, context, con):
layout = self.layout
- wide_ui = context.region.width > narrowui
- compact_con = context.region.width < narrowcon
- box = layout.template_constraint(con, compact=compact_con)
+ box = layout.template_constraint(con)
if box:
# match enum type to our functions, avoids a lookup table.
- getattr(self, con.type)(context, box, con, wide_ui)
+ getattr(self, con.type)(context, box, con)
if con.type not in ('RIGID_BODY_JOINT', 'NULL'):
box.prop(con, "influence")
- def space_template(self, layout, con, wide_ui, target=True, owner=True):
+ def space_template(self, layout, con, target=True, owner=True):
if target or owner:
split = layout.split(percentage=0.2)
- if wide_ui:
- split.label(text="Space:")
- row = split.row()
- else:
- row = layout.row()
-
+ split.label(text="Space:")
+ row = split.row()
if target:
row.prop(con, "target_space", text="")
- if wide_ui:
- if target and owner:
- row.label(icon='ARROW_LEFTRIGHT')
- else:
- row = layout.row()
+ if target and owner:
+ row.label(icon='ARROW_LEFTRIGHT')
+
if owner:
row.prop(con, "owner_space", text="")
- def target_template(self, layout, con, wide_ui, subtargets=True):
- if wide_ui:
- layout.prop(con, "target") # XXX limiting settings for only 'curves' or some type of object
- else:
- layout.prop(con, "target", text="")
+ def target_template(self, layout, con, subtargets=True):
+ layout.prop(con, "target") # XXX limiting settings for only 'curves' or some type of object
if con.target and subtargets:
if con.target.type == 'ARMATURE':
- if wide_ui:
- layout.prop_object(con, "subtarget", con.target.data, "bones", text="Bone")
- else:
- layout.prop_object(con, "subtarget", con.target.data, "bones", text="")
+ layout.prop_object(con, "subtarget", con.target.data, "bones", text="Bone")
if con.type in ('COPY_LOCATION', 'STRETCH_TO', 'TRACK_TO', 'PIVOT'):
row = layout.row()
@@ -85,7 +68,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
elif con.target.type in ('MESH', 'LATTICE'):
layout.prop_object(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
- def ik_template(self, layout, con, wide_ui):
+ def ik_template(self, layout, con):
# only used for iTaSC
layout.prop(con, "pole_target")
@@ -103,11 +86,11 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col.prop(con, "use_stretch")
col = split.column()
- col.prop(con, "chain_length")
+ col.prop(con, "chain_count")
col.prop(con, "use_target")
- def CHILD_OF(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def CHILD_OF(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
@@ -134,56 +117,47 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col = split.column()
col.operator("constraint.childof_set_inverse")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.operator("constraint.childof_clear_inverse")
- def TRACK_TO(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def TRACK_TO(self, context, layout, con):
+ self.target_template(layout, con)
row = layout.row()
- if wide_ui:
- row.label(text="To:")
- row.prop(con, "track", expand=True)
+ row.label(text="To:")
+ row.prop(con, "track_axis", expand=True)
split = layout.split()
col = split.column()
- col.prop(con, "up", text="Up")
+ col.prop(con, "up_axis", text="Up")
- if wide_ui:
- col = split.column()
- col.prop(con, "target_z")
+ col = split.column()
+ col.prop(con, "use_target_z")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def IK(self, context, layout, con, wide_ui):
+ def IK(self, context, layout, con):
if context.object.pose.ik_solver == "ITASC":
layout.prop(con, "ik_type")
- getattr(self, 'IK_' + con.ik_type)(context, layout, con, wide_ui)
+ getattr(self, 'IK_' + con.ik_type)(context, layout, con)
else:
# Legacy IK constraint
- self.target_template(layout, con, wide_ui)
- if wide_ui:
- layout.prop(con, "pole_target")
- else:
- layout.prop(con, "pole_target", text="")
+ self.target_template(layout, con)
+ layout.prop(con, "pole_target")
+
if con.pole_target and con.pole_target.type == 'ARMATURE':
- if wide_ui:
- layout.prop_object(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
- else:
- layout.prop_object(con, "pole_subtarget", con.pole_target.data, "bones", text="")
+ layout.prop_object(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
if con.pole_target:
row = layout.row()
row.prop(con, "pole_angle")
- if wide_ui:
- row.label()
+ row.label()
split = layout.split()
col = split.column()
col.prop(con, "iterations")
- col.prop(con, "chain_length")
+ col.prop(con, "chain_count")
col.label(text="Weight:")
col.prop(con, "weight", text="Position", slider=True)
@@ -191,34 +165,33 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.active = con.use_rotation
sub.prop(con, "orient_weight", text="Rotation", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(con, "use_tail")
col.prop(con, "use_stretch")
col.separator()
col.prop(con, "use_target")
col.prop(con, "use_rotation")
- def IK_COPY_POSE(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
- self.ik_template(layout, con, wide_ui)
+ def IK_COPY_POSE(self, context, layout, con):
+ self.target_template(layout, con)
+ self.ik_template(layout, con)
row = layout.row()
row.label(text="Axis Ref:")
- row.prop(con, "axis_reference", expand=True)
+ row.prop(con, "reference_axis", expand=True)
split = layout.split(percentage=0.33)
- split.row().prop(con, "use_position")
+ split.row().prop(con, "use_location")
row = split.row()
row.prop(con, "weight", text="Weight", slider=True)
- row.active = con.use_position
+ row.active = con.use_location
split = layout.split(percentage=0.33)
row = split.row()
row.label(text="Lock:")
row = split.row()
- row.prop(con, "pos_lock_x", text="X")
- row.prop(con, "pos_lock_y", text="Y")
- row.prop(con, "pos_lock_z", text="Z")
- split.active = con.use_position
+ row.prop(con, "lock_location_x", text="X")
+ row.prop(con, "lock_location_y", text="Y")
+ row.prop(con, "lock_location_z", text="Z")
+ split.active = con.use_location
split = layout.split(percentage=0.33)
split.row().prop(con, "use_rotation")
@@ -229,22 +202,22 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row = split.row()
row.label(text="Lock:")
row = split.row()
- row.prop(con, "rot_lock_x", text="X")
- row.prop(con, "rot_lock_y", text="Y")
- row.prop(con, "rot_lock_z", text="Z")
+ row.prop(con, "lock_rotation_x", text="X")
+ row.prop(con, "lock_rotation_y", text="Y")
+ row.prop(con, "lock_rotation_z", text="Z")
split.active = con.use_rotation
- def IK_DISTANCE(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
- self.ik_template(layout, con, wide_ui)
+ def IK_DISTANCE(self, context, layout, con):
+ self.target_template(layout, con)
+ self.ik_template(layout, con)
layout.prop(con, "limit_mode")
row = layout.row()
row.prop(con, "weight", text="Weight", slider=True)
row.prop(con, "distance", text="Distance", slider=True)
- def FOLLOW_PATH(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def FOLLOW_PATH(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
@@ -252,25 +225,22 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col.prop(con, "use_curve_follow")
col.prop(con, "use_curve_radius")
- if wide_ui:
- col = split.column()
- col.prop(con, "use_fixed_position")
- if con.use_fixed_position:
+ col = split.column()
+ col.prop(con, "use_fixed_location")
+ if con.use_fixed_location:
col.prop(con, "offset_factor", text="Offset")
else:
col.prop(con, "offset")
row = layout.row()
- if wide_ui:
- row.label(text="Forward:")
- row.prop(con, "forward", expand=True)
+ row.label(text="Forward:")
+ row.prop(con, "forward_axis", expand=True)
row = layout.row()
- row.prop(con, "up", text="Up")
- if wide_ui:
- row.label()
+ row.prop(con, "up_axis", text="Up")
+ row.label()
- def LIMIT_ROTATION(self, context, layout, con, wide_ui):
+ def LIMIT_ROTATION(self, context, layout, con):
split = layout.split()
@@ -278,127 +248,115 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col.prop(con, "use_limit_x")
sub = col.column()
sub.active = con.use_limit_x
- sub.prop(con, "minimum_x", text="Min")
- sub.prop(con, "maximum_x", text="Max")
+ sub.prop(con, "min_x", text="Min")
+ sub.prop(con, "max_x", text="Max")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.prop(con, "use_limit_y")
sub = col.column()
sub.active = con.use_limit_y
- sub.prop(con, "minimum_y", text="Min")
- sub.prop(con, "maximum_y", text="Max")
+ sub.prop(con, "min_y", text="Min")
+ sub.prop(con, "max_y", text="Max")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.prop(con, "use_limit_z")
sub = col.column()
sub.active = con.use_limit_z
- sub.prop(con, "minimum_z", text="Min")
- sub.prop(con, "maximum_z", text="Max")
+ sub.prop(con, "min_z", text="Min")
+ sub.prop(con, "max_z", text="Max")
row = layout.row()
- row.prop(con, "limit_transform")
- if wide_ui:
- row.label()
+ row.prop(con, "use_transform_limit")
+ row.label()
row = layout.row()
- if wide_ui:
- row.label(text="Convert:")
+ row.label(text="Convert:")
row.prop(con, "owner_space", text="")
- def LIMIT_LOCATION(self, context, layout, con, wide_ui):
+ def LIMIT_LOCATION(self, context, layout, con):
split = layout.split()
col = split.column()
- col.prop(con, "use_minimum_x")
+ col.prop(con, "use_min_x")
sub = col.column()
- sub.active = con.use_minimum_x
- sub.prop(con, "minimum_x", text="")
- col.prop(con, "use_maximum_x")
+ sub.active = con.use_min_x
+ sub.prop(con, "min_x", text="")
+ col.prop(con, "use_max_x")
sub = col.column()
- sub.active = con.use_maximum_x
- sub.prop(con, "maximum_x", text="")
+ sub.active = con.use_max_x
+ sub.prop(con, "max_x", text="")
- if wide_ui:
- col = split.column()
- col.prop(con, "use_minimum_y")
+ col = split.column()
+ col.prop(con, "use_min_y")
sub = col.column()
- sub.active = con.use_minimum_y
- sub.prop(con, "minimum_y", text="")
- col.prop(con, "use_maximum_y")
+ sub.active = con.use_min_y
+ sub.prop(con, "min_y", text="")
+ col.prop(con, "use_max_y")
sub = col.column()
- sub.active = con.use_maximum_y
- sub.prop(con, "maximum_y", text="")
+ sub.active = con.use_max_y
+ sub.prop(con, "max_y", text="")
- if wide_ui:
- col = split.column()
- col.prop(con, "use_minimum_z")
+ col = split.column()
+ col.prop(con, "use_min_z")
sub = col.column()
- sub.active = con.use_minimum_z
- sub.prop(con, "minimum_z", text="")
- col.prop(con, "use_maximum_z")
+ sub.active = con.use_min_z
+ sub.prop(con, "min_z", text="")
+ col.prop(con, "use_max_z")
sub = col.column()
- sub.active = con.use_maximum_z
- sub.prop(con, "maximum_z", text="")
+ sub.active = con.use_max_z
+ sub.prop(con, "max_z", text="")
row = layout.row()
- row.prop(con, "limit_transform")
- if wide_ui:
- row.label()
+ row.prop(con, "use_transform_limit")
+ row.label()
row = layout.row()
- if wide_ui:
- row.label(text="Convert:")
+ row.label(text="Convert:")
row.prop(con, "owner_space", text="")
- def LIMIT_SCALE(self, context, layout, con, wide_ui):
+ def LIMIT_SCALE(self, context, layout, con):
split = layout.split()
col = split.column()
- col.prop(con, "use_minimum_x")
+ col.prop(con, "use_min_x")
sub = col.column()
- sub.active = con.use_minimum_x
- sub.prop(con, "minimum_x", text="")
- col.prop(con, "use_maximum_x")
+ sub.active = con.use_min_x
+ sub.prop(con, "min_x", text="")
+ col.prop(con, "use_max_x")
sub = col.column()
- sub.active = con.use_maximum_x
- sub.prop(con, "maximum_x", text="")
+ sub.active = con.use_max_x
+ sub.prop(con, "max_x", text="")
- if wide_ui:
- col = split.column()
- col.prop(con, "use_minimum_y")
+ col = split.column()
+ col.prop(con, "use_min_y")
sub = col.column()
- sub.active = con.use_minimum_y
- sub.prop(con, "minimum_y", text="")
- col.prop(con, "use_maximum_y")
+ sub.active = con.use_min_y
+ sub.prop(con, "min_y", text="")
+ col.prop(con, "use_max_y")
sub = col.column()
- sub.active = con.use_maximum_y
- sub.prop(con, "maximum_y", text="")
+ sub.active = con.use_max_y
+ sub.prop(con, "max_y", text="")
- if wide_ui:
- col = split.column()
- col.prop(con, "use_minimum_z")
+ col = split.column()
+ col.prop(con, "use_min_z")
sub = col.column()
- sub.active = con.use_minimum_z
- sub.prop(con, "minimum_z", text="")
- col.prop(con, "use_maximum_z")
+ sub.active = con.use_min_z
+ sub.prop(con, "min_z", text="")
+ col.prop(con, "use_max_z")
sub = col.column()
- sub.active = con.use_maximum_z
- sub.prop(con, "maximum_z", text="")
+ sub.active = con.use_max_z
+ sub.prop(con, "max_z", text="")
row = layout.row()
- row.prop(con, "limit_transform")
- if wide_ui:
- row.label()
+ row.prop(con, "use_transform_limit")
+ row.label()
row = layout.row()
- if wide_ui:
- row.label(text="Convert:")
+ row.label(text="Convert:")
row.prop(con, "owner_space", text="")
- def COPY_ROTATION(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def COPY_ROTATION(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
@@ -422,10 +380,10 @@ class ConstraintButtonsPanel(bpy.types.Panel):
layout.prop(con, "use_offset")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def COPY_LOCATION(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def COPY_LOCATION(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
@@ -449,10 +407,10 @@ class ConstraintButtonsPanel(bpy.types.Panel):
layout.prop(con, "use_offset")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def COPY_SCALE(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def COPY_SCALE(self, context, layout, con):
+ self.target_template(layout, con)
row = layout.row(align=True)
row.prop(con, "use_x", text="X")
@@ -461,38 +419,31 @@ class ConstraintButtonsPanel(bpy.types.Panel):
layout.prop(con, "use_offset")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def MAINTAIN_VOLUME(self, context, layout, con, wide_ui):
+ def MAINTAIN_VOLUME(self, context, layout, con):
row = layout.row()
- if wide_ui:
- row.label(text="Free:")
- row.prop(con, "axis", expand=True)
+ row.label(text="Free:")
+ row.prop(con, "free_axis", expand=True)
layout.prop(con, "volume")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def COPY_TRANSFORMS(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def COPY_TRANSFORMS(self, context, layout, con):
+ self.target_template(layout, con)
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
#def SCRIPT(self, context, layout, con):
- def ACTION(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def ACTION(self, context, layout, con):
+ self.target_template(layout, con)
- if wide_ui:
- layout.prop(con, "action")
- else:
- layout.prop(con, "action", text="")
+ layout.prop(con, "action")
- if wide_ui:
- layout.prop(con, "transform_channel")
- else:
- layout.prop(con, "transform_channel", text="")
+ layout.prop(con, "transform_channel")
split = layout.split()
@@ -501,32 +452,28 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col.prop(con, "frame_start", text="Start")
col.prop(con, "frame_end", text="End")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Target Range:")
- col.prop(con, "minimum", text="Min")
- col.prop(con, "maximum", text="Max")
+ col.prop(con, "min", text="Min")
+ col.prop(con, "max", text="Max")
row = layout.row()
- if wide_ui:
- row.label(text="Convert:")
+ row.label(text="Convert:")
row.prop(con, "target_space", text="")
- def LOCKED_TRACK(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def LOCKED_TRACK(self, context, layout, con):
+ self.target_template(layout, con)
row = layout.row()
- if wide_ui:
- row.label(text="To:")
- row.prop(con, "track", expand=True)
+ row.label(text="To:")
+ row.prop(con, "track_axis", expand=True)
row = layout.row()
- if wide_ui:
- row.label(text="Lock:")
- row.prop(con, "locked", expand=True)
+ row.label(text="Lock:")
+ row.prop(con, "lock_axis", expand=True)
- def LIMIT_DISTANCE(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def LIMIT_DISTANCE(self, context, layout, con):
+ self.target_template(layout, con)
col = layout.column(align=True)
col.prop(con, "distance")
@@ -536,71 +483,59 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.label(text="Clamp Region:")
row.prop(con, "limit_mode", text="")
- def STRETCH_TO(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def STRETCH_TO(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
col = split.column()
- col.prop(con, "original_length", text="Rest Length")
+ col.prop(con, "rest_length", text="Rest Length")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.operator("constraint.stretchto_reset", text="Reset")
col = layout.column()
col.prop(con, "bulge", text="Volume Variation")
row = layout.row()
- if wide_ui:
- row.label(text="Volume:")
+ row.label(text="Volume:")
row.prop(con, "volume", expand=True)
- if not wide_ui:
- row = layout.row()
+
row.label(text="Plane:")
row.prop(con, "keep_axis", expand=True)
- def FLOOR(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def FLOOR(self, context, layout, con):
+ self.target_template(layout, con)
split = layout.split()
col = split.column()
- col.prop(con, "sticky")
+ col.prop(con, "use_sticky")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(con, "use_rotation")
layout.prop(con, "offset")
row = layout.row()
- if wide_ui:
- row.label(text="Min/Max:")
+ row.label(text="Min/Max:")
row.prop(con, "floor_location", expand=True)
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def RIGID_BODY_JOINT(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def RIGID_BODY_JOINT(self, context, layout, con):
+ self.target_template(layout, con, subtargets=False)
- if wide_ui:
- layout.prop(con, "pivot_type")
- else:
- layout.prop(con, "pivot_type", text="")
- if wide_ui:
- layout.prop(con, "child")
- else:
- layout.prop(con, "child", text="")
+ layout.prop(con, "pivot_type")
+ layout.prop(con, "child")
split = layout.split()
col = split.column()
- col.prop(con, "disable_linked_collision", text="No Collision")
+ col.prop(con, "use_linked_collision", text="Linked Collision")
- if wide_ui:
- col = split.column()
- col.prop(con, "draw_pivot", text="Display Pivot")
+ col = split.column()
+ col.prop(con, "show_pivot", text="Display Pivot")
split = layout.split()
@@ -610,8 +545,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
col.prop(con, "pivot_y", text="Y")
col.prop(con, "pivot_z", text="Z")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Axis:")
col.prop(con, "axis_x", text="X")
col.prop(con, "axis_y", text="Y")
@@ -619,21 +553,20 @@ class ConstraintButtonsPanel(bpy.types.Panel):
#Missing: Limit arrays (not wrapped in RNA yet)
- def CLAMP_TO(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def CLAMP_TO(self, context, layout, con):
+ self.target_template(layout, con)
row = layout.row()
- if wide_ui:
- row.label(text="Main Axis:")
+ row.label(text="Main Axis:")
row.prop(con, "main_axis", expand=True)
row = layout.row()
- row.prop(con, "cyclic")
+ row.prop(con, "use_cyclic")
- def TRANSFORM(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def TRANSFORM(self, context, layout, con):
+ self.target_template(layout, con)
- layout.prop(con, "extrapolate_motion", text="Extrapolate")
+ layout.prop(con, "use_motion_extrapolate", text="Extrapolate")
col = layout.column()
col.row().label(text="Source:")
@@ -646,14 +579,12 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.prop(con, "from_min_x", text="Min")
sub.prop(con, "from_max_x", text="Max")
- if wide_ui:
- sub = split.column(align=True)
+ sub = split.column(align=True)
sub.label(text="Y:")
sub.prop(con, "from_min_y", text="Min")
sub.prop(con, "from_max_y", text="Max")
- if wide_ui:
- sub = split.column(align=True)
+ sub = split.column(align=True)
sub.label(text="Z:")
sub.prop(con, "from_min_z", text="Min")
sub.prop(con, "from_max_z", text="Max")
@@ -674,8 +605,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.prop(con, "to_min_x", text="Min")
sub.prop(con, "to_max_x", text="Max")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Y:")
col.row().prop(con, "map_to_y_from", expand=True)
@@ -683,8 +613,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.prop(con, "to_min_y", text="Min")
sub.prop(con, "to_max_y", text="Max")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Z:")
col.row().prop(con, "map_to_z_from", expand=True)
@@ -692,10 +621,10 @@ class ConstraintButtonsPanel(bpy.types.Panel):
sub.prop(con, "to_min_z", text="Min")
sub.prop(con, "to_max_z", text="Max")
- self.space_template(layout, con, wide_ui)
+ self.space_template(layout, con)
- def SHRINKWRAP(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def SHRINKWRAP(self, context, layout, con):
+ self.target_template(layout, con)
layout.prop(con, "distance")
layout.prop(con, "shrinkwrap_type")
@@ -706,55 +635,55 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.prop(con, "use_y")
row.prop(con, "use_z")
- def DAMPED_TRACK(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def DAMPED_TRACK(self, context, layout, con):
+ self.target_template(layout, con)
row = layout.row()
- if wide_ui:
- row.label(text="To:")
- row.prop(con, "track", expand=True)
+ row.label(text="To:")
+ row.prop(con, "track_axis", expand=True)
- def SPLINE_IK(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def SPLINE_IK(self, context, layout, con):
+ self.target_template(layout, con)
col = layout.column()
col.label(text="Spline Fitting:")
- col.prop(con, "chain_length")
- col.prop(con, "even_divisions")
- col.prop(con, "chain_offset")
+ col.prop(con, "chain_count")
+ col.prop(con, "use_even_divisions")
+ col.prop(con, "use_chain_offset")
col = layout.column()
col.label(text="Chain Scaling:")
- col.prop(con, "y_stretch")
- if wide_ui:
- col.prop(con, "xz_scaling_mode")
- else:
- col.prop(con, "xz_scaling_mode", text="")
+ col.prop(con, "use_y_stretch")
+ col.prop(con, "xz_scale_mode")
col.prop(con, "use_curve_radius")
- def PIVOT(self, context, layout, con, wide_ui):
- self.target_template(layout, con, wide_ui)
+ def PIVOT(self, context, layout, con):
+ self.target_template(layout, con)
if con.target:
col = layout.column()
col.prop(con, "offset", text="Pivot Offset")
else:
col = layout.column()
- col.prop(con, "use_relative_position")
- if con.use_relative_position:
+ col.prop(con, "use_relative_location")
+ if con.use_relative_location:
col.prop(con, "offset", text="Relative Pivot Point")
else:
col.prop(con, "offset", text="Absolute Pivot Point")
col = layout.column()
- col.prop(con, "enabled_rotation_range", text="Pivot When")
+ col.prop(con, "rotation_range", text="Pivot When")
+ def SCRIPT(self, context, layout, con):
+ layout.label("blender 2.5 has no py-constraints")
-class OBJECT_PT_constraints(ConstraintButtonsPanel):
+
+class OBJECT_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
bl_label = "Object Constraints"
bl_context = "constraint"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.object)
def draw(self, context):
@@ -768,11 +697,12 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel):
self.draw_constraint(context, con)
-class BONE_PT_constraints(ConstraintButtonsPanel):
+class BONE_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
bl_label = "Bone Constraints"
bl_context = "bone_constraint"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.pose_bone)
def draw(self, context):
@@ -784,21 +714,12 @@ class BONE_PT_constraints(ConstraintButtonsPanel):
self.draw_constraint(context, con)
-classes = [
- OBJECT_PT_constraints,
- BONE_PT_constraints]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py
index 58e602dd1e2..27d02ac97cd 100644
--- a/release/scripts/ui/properties_particle.py
+++ b/release/scripts/ui/properties_particle.py
@@ -25,40 +25,40 @@ from properties_physics_common import effector_weights_ui
from properties_physics_common import basic_force_field_settings_ui
from properties_physics_common import basic_force_field_falloff_ui
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
def particle_panel_enabled(context, psys):
- return (psys.point_cache.baked is False) and (not psys.edited) and (not context.particle_system_editable)
+ return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
-def particle_panel_poll(panel, context):
+def particle_panel_poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
- return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR') and (engine in panel.COMPAT_ENGINES)
+ return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR') and (engine in cls.COMPAT_ENGINES)
-class ParticleButtonsPanel(bpy.types.Panel):
+class ParticleButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "particle"
- def poll(self, context):
- return particle_panel_poll(self, context)
+ @classmethod
+ def poll(cls, context):
+ return particle_panel_poll(cls, context)
-class PARTICLE_PT_context_particles(ParticleButtonsPanel):
+class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
- return (context.particle_system or context.object) and (engine in self.COMPAT_ENGINES)
+ return (context.particle_system or context.object) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -116,15 +116,15 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel):
split = layout.split(percentage=0.65)
if part.type == 'HAIR':
- if psys.edited:
+ if psys.is_edited:
split.operator("particle.edited_clear", text="Free Edit")
else:
split.label(text="")
row = split.row()
row.enabled = particle_panel_enabled(context, psys)
row.prop(part, "hair_step")
- if psys.edited:
- if psys.global_hair:
+ if psys.is_edited:
+ if psys.is_global_hair:
layout.operator("particle.connect_hair")
layout.label(text="Hair is disconnected.")
else:
@@ -136,18 +136,14 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel):
split.prop(psys, "reactor_target_particle_system", text="Particle System")
-class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel):
- COMPAT_ENGINES = {'BLENDER_RENDER'}
- _context_path = "particle_system.settings"
-
-
-class PARTICLE_PT_emission(ParticleButtonsPanel):
+class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Emission"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
- if particle_panel_poll(self, context):
- return not context.particle_system.point_cache.external
+ @classmethod
+ def poll(cls, context):
+ if particle_panel_poll(PARTICLE_PT_emission, context):
+ return not context.particle_system.point_cache.use_external
else:
return False
@@ -156,13 +152,12 @@ class PARTICLE_PT_emission(ParticleButtonsPanel):
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
- layout.enabled = particle_panel_enabled(context, psys) and not psys.multiple_caches
+ layout.enabled = particle_panel_enabled(context, psys) and not psys.has_multiple_caches
row = layout.row()
row.active = part.distribution != 'GRID'
- row.prop(part, "amount")
+ row.prop(part, "count")
if part.type != 'HAIR':
split = layout.split()
@@ -173,26 +168,22 @@ class PARTICLE_PT_emission(ParticleButtonsPanel):
col = split.column(align=True)
col.prop(part, "lifetime")
- col.prop(part, "random_lifetime", slider=True)
+ col.prop(part, "lifetime_random", slider=True)
layout.row().label(text="Emit From:")
row = layout.row()
- if wide_ui:
- row.prop(part, "emit_from", expand=True)
- else:
- row.prop(part, "emit_from", text="")
+ row.prop(part, "emit_from", expand=True)
+
row = layout.row()
- row.prop(part, "trand")
+ row.prop(part, "use_emit_random")
if part.distribution != 'GRID':
- row.prop(part, "even_distribution")
+ row.prop(part, "use_even_distribution")
if part.emit_from == 'FACE' or part.emit_from == 'VOLUME':
row = layout.row()
- if wide_ui:
- row.prop(part, "distribution", expand=True)
- else:
- row.prop(part, "distribution", text="")
+
+ row.prop(part, "distribution", expand=True)
row = layout.row()
@@ -203,27 +194,28 @@ class PARTICLE_PT_emission(ParticleButtonsPanel):
row.prop(part, "grid_resolution")
-class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel):
+class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Hair dynamics"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
- return psys.settings.type == 'HAIR' and (engine in self.COMPAT_ENGINES)
+ return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
#cloth = context.cloth.collision_settings
#self.layout.active = cloth_panel_enabled(context.cloth)
- #self.layout.prop(cloth, "enable_collision", text="")
+ #self.layout.prop(cloth, "use_collision", text="")
psys = context.particle_system
- self.layout.prop(psys, "hair_dynamics", text="")
+ self.layout.prop(psys, "use_hair_dynamics", text="")
def draw(self, context):
layout = self.layout
@@ -236,7 +228,7 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel):
#part = psys.settings
cloth = psys.cloth.settings
- layout.enabled = psys.hair_dynamics
+ layout.enabled = psys.use_hair_dynamics
split = layout.split()
@@ -260,12 +252,13 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel):
col.prop(cloth, "quality", text="Steps", slider=True)
-class PARTICLE_PT_cache(ParticleButtonsPanel):
+class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Cache"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
@@ -275,22 +268,23 @@ class PARTICLE_PT_cache(ParticleButtonsPanel):
phystype = psys.settings.physics_type
if phystype == 'NO' or phystype == 'KEYED':
return False
- return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)) and engine in self.COMPAT_ENGINES
+ return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.use_hair_dynamics)) and engine in cls.COMPAT_ENGINES
def draw(self, context):
psys = context.particle_system
- point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if psys.hair_dynamics else 'PSYS')
+ point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if psys.use_hair_dynamics else 'PSYS')
-class PARTICLE_PT_velocity(ParticleButtonsPanel):
+class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Velocity"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
- if particle_panel_poll(self, context):
+ @classmethod
+ def poll(cls, context):
+ if particle_panel_poll(PARTICLE_PT_velocity, context):
psys = context.particle_system
- return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
+ return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.use_external
else:
return False
@@ -313,7 +307,7 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel):
sub = split.column()
sub.label(text="Emitter Object")
- sub.prop(part, "object_aligned_factor", text="")
+ sub.prop(part, "object_align_factor", text="")
layout.row().label(text="Other:")
split = layout.split()
@@ -323,21 +317,22 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel):
else:
sub.prop(part, "object_factor", slider=True)
sub = split.column()
- sub.prop(part, "random_factor")
+ sub.prop(part, "factor_random")
#if part.type=='REACTOR':
# sub.prop(part, "reactor_factor")
# sub.prop(part, "reaction_shape", slider=True)
-class PARTICLE_PT_rotation(ParticleButtonsPanel):
+class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Rotation"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
- if particle_panel_poll(self, context):
+ @classmethod
+ def poll(cls, context):
+ if particle_panel_poll(PARTICLE_PT_rotation, context):
psys = context.particle_system
- return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
+ return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.use_external
else:
return False
@@ -346,28 +341,24 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel):
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
layout.enabled = particle_panel_enabled(context, psys)
split = layout.split()
split.label(text="Initial Rotation:")
- split.prop(part, "rotation_dynamic")
+ split.prop(part, "use_dynamic_rotation")
split = layout.split()
sub = split.column(align=True)
sub.prop(part, "rotation_mode", text="")
- sub.prop(part, "random_rotation_factor", slider=True, text="Random")
+ sub.prop(part, "rotation_factor_random", slider=True, text="Random")
sub = split.column(align=True)
sub.prop(part, "phase_factor", slider=True)
- sub.prop(part, "random_phase_factor", text="Random", slider=True)
+ sub.prop(part, "phase_factor_random", text="Random", slider=True)
layout.row().label(text="Angular Velocity:")
- if wide_ui:
- layout.row().prop(part, "angular_velocity_mode", expand=True)
- else:
- layout.row().prop(part, "angular_velocity_mode", text="")
+ layout.row().prop(part, "angular_velocity_mode", expand=True)
split = layout.split()
sub = split.column()
@@ -376,13 +367,14 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel):
sub.prop(part, "angular_velocity_factor", text="")
-class PARTICLE_PT_physics(ParticleButtonsPanel):
+class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
- if particle_panel_poll(self, context):
- return not context.particle_system.point_cache.external
+ @classmethod
+ def poll(cls, context):
+ if particle_panel_poll(PARTICLE_PT_physics, context):
+ return not context.particle_system.point_cache.use_external
else:
return False
@@ -391,24 +383,21 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
layout.enabled = particle_panel_enabled(context, psys)
row = layout.row()
- if wide_ui:
- row.prop(part, "physics_type", expand=True)
- else:
- row.prop(part, "physics_type", text="")
+ row.prop(part, "physics_type", expand=True)
+
+ row = layout.row()
+ col = row.column(align=True)
+ col.prop(part, "particle_size")
+ col.prop(part, "size_random", slider=True)
if part.physics_type != 'NO':
- row = layout.row()
- col = row.column(align=True)
- col.prop(part, "particle_size")
- col.prop(part, "random_size", slider=True)
col = row.column(align=True)
col.prop(part, "mass")
- col.prop(part, "sizemass", text="Multiply mass with size")
+ col.prop(part, "use_multiply_size_mass", text="Multiply mass with size")
if part.physics_type == 'NEWTON':
split = layout.split()
@@ -417,15 +406,15 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
sub.label(text="Forces:")
sub.prop(part, "brownian_factor")
sub.prop(part, "drag_factor", slider=True)
- sub.prop(part, "damp_factor", slider=True)
+ sub.prop(part, "damping", slider=True)
sub = split.column()
sub.label(text="Integration:")
sub.prop(part, "integrator", text="")
sub.prop(part, "time_tweak")
sub.prop(part, "subframes")
sub = layout.row()
- sub.prop(part, "size_deflect")
- sub.prop(part, "die_on_collision")
+ sub.prop(part, "use_size_deflect")
+ sub.prop(part, "use_die_on_collision")
elif part.physics_type == 'FLUID':
fluid = part.fluid
@@ -435,22 +424,22 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
sub.label(text="Forces:")
sub.prop(part, "brownian_factor")
sub.prop(part, "drag_factor", slider=True)
- sub.prop(part, "damp_factor", slider=True)
+ sub.prop(part, "damping", slider=True)
sub = split.column()
sub.label(text="Integration:")
sub.prop(part, "integrator", text="")
sub.prop(part, "time_tweak")
sub.prop(part, "subframes")
sub = layout.row()
- sub.prop(part, "size_deflect")
- sub.prop(part, "die_on_collision")
+ sub.prop(part, "use_size_deflect")
+ sub.prop(part, "use_die_on_collision")
split = layout.split()
sub = split.column()
sub.label(text="Fluid Interaction:")
sub.prop(fluid, "fluid_radius", slider=True)
- sub.prop(fluid, "stiffness_k")
- sub.prop(fluid, "stiffness_knear")
+ sub.prop(fluid, "stiffness")
+ sub.prop(fluid, "stiffness_near")
sub.prop(fluid, "rest_density")
sub.label(text="Viscosity:")
@@ -460,7 +449,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
sub = split.column()
sub.label(text="Springs:")
- sub.prop(fluid, "spring_k", text="Force", slider=True)
+ sub.prop(fluid, "spring_force", text="Force", slider=True)
sub.prop(fluid, "rest_length", slider=True)
layout.label(text="Multiple fluids interactions:")
@@ -473,9 +462,9 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
row = layout.row()
col = row.column()
- col.active = not psys.keyed_timing
+ col.active = not psys.use_keyed_timing
col.prop(part, "keyed_loops", text="Loops")
- row.prop(psys, "keyed_timing", text="Use Timing")
+ row.prop(psys, "use_keyed_timing", text="Use Timing")
layout.label(text="Keys:")
elif part.physics_type == 'BOIDS':
@@ -483,31 +472,31 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
row = layout.row()
- row.prop(boids, "allow_flight")
- row.prop(boids, "allow_land")
- row.prop(boids, "allow_climb")
+ row.prop(boids, "use_flight")
+ row.prop(boids, "use_land")
+ row.prop(boids, "use_climb")
split = layout.split()
sub = split.column()
col = sub.column(align=True)
- col.active = boids.allow_flight
- col.prop(boids, "air_max_speed")
- col.prop(boids, "air_min_speed", slider=True)
- col.prop(boids, "air_max_acc", slider=True)
- col.prop(boids, "air_max_ave", slider=True)
+ col.active = boids.use_flight
+ col.prop(boids, "air_speed_max")
+ col.prop(boids, "air_speed_min", slider=True)
+ col.prop(boids, "air_acc_max", slider=True)
+ col.prop(boids, "air_ave_max", slider=True)
col.prop(boids, "air_personal_space")
row = col.row()
- row.active = (boids.allow_land or boids.allow_climb) and boids.allow_flight
- row.prop(boids, "landing_smoothness")
+ row.active = (boids.use_land or boids.allow_climb) and boids.allow_flight
+ row.prop(boids, "land_smooth")
sub = split.column()
col = sub.column(align=True)
- col.active = boids.allow_land or boids.allow_climb
- col.prop(boids, "land_max_speed")
+ col.active = boids.use_land or boids.allow_climb
+ col.prop(boids, "land_speed_max")
col.prop(boids, "land_jump_speed")
- col.prop(boids, "land_max_acc", slider=True)
- col.prop(boids, "land_max_ave", slider=True)
+ col.prop(boids, "land_acc_max", slider=True)
+ col.prop(boids, "land_ave_max", slider=True)
col.prop(boids, "land_personal_space")
col.prop(boids, "land_stick_force")
@@ -523,7 +512,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
col = row.column()
col.label(text="Misc:")
- col.prop(boids, "banking", slider=True)
+ col.prop(boids, "bank", slider=True)
col.prop(boids, "height", slider=True)
if part.physics_type == 'KEYED' or part.physics_type == 'BOIDS' or part.physics_type == 'FLUID':
@@ -553,7 +542,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
col.prop(key, "object", text="")
col.prop(key, "system", text="System")
col = row.column()
- col.active = psys.keyed_timing
+ col.active = psys.use_keyed_timing
col.prop(key, "time")
col.prop(key, "duration")
elif part.physics_type == 'BOIDS':
@@ -563,7 +552,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
sub.prop(key, "object", text="")
sub.prop(key, "system", text="System")
- layout.prop(key, "mode", expand=True)
+ layout.prop(key, "alliance", expand=True)
elif part.physics_type == 'FLUID':
sub = row.row()
#doesn't work yet
@@ -572,20 +561,21 @@ class PARTICLE_PT_physics(ParticleButtonsPanel):
sub.prop(key, "system", text="System")
-class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
+class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Boid Brain"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
- if psys.point_cache.external:
+ if psys.point_cache.use_external:
return False
- return psys.settings.physics_type == 'BOIDS' and engine in self.COMPAT_ENGINES
+ return psys.settings.physics_type == 'BOIDS' and engine in cls.COMPAT_ENGINES
def draw(self, context):
layout = self.layout
@@ -612,7 +602,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
row = layout.row()
row.prop(state, "ruleset_type")
if state.ruleset_type == 'FUZZY':
- row.prop(state, "rule_fuzziness", slider=True)
+ row.prop(state, "rule_fuzzy", slider=True)
else:
row.label(text="")
@@ -635,34 +625,34 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
row = layout.row()
row.prop(rule, "name", text="")
#somebody make nice icons for boids here please! -jahka
- row.prop(rule, "in_air", icon='MOVE_UP_VEC', text="")
- row.prop(rule, "on_land", icon='MOVE_DOWN_VEC', text="")
+ row.prop(rule, "use_in_air", icon='MOVE_UP_VEC', text="")
+ row.prop(rule, "use_on_land", icon='MOVE_DOWN_VEC', text="")
row = layout.row()
if rule.type == 'GOAL':
row.prop(rule, "object")
row = layout.row()
- row.prop(rule, "predict")
+ row.prop(rule, "use_predict")
elif rule.type == 'AVOID':
row.prop(rule, "object")
row = layout.row()
- row.prop(rule, "predict")
+ row.prop(rule, "use_predict")
row.prop(rule, "fear_factor")
elif rule.type == 'FOLLOW_PATH':
row.label(text="Not yet functional.")
elif rule.type == 'AVOID_COLLISION':
- row.prop(rule, "boids")
- row.prop(rule, "deflectors")
+ row.prop(rule, "use_avoid")
+ row.prop(rule, "use_avoid_collision")
row.prop(rule, "look_ahead")
elif rule.type == 'FOLLOW_LEADER':
row.prop(rule, "object", text="")
row.prop(rule, "distance")
row = layout.row()
- row.prop(rule, "line")
+ row.prop(rule, "use_line")
sub = row.row()
sub.active = rule.line
- sub.prop(rule, "queue_size")
+ sub.prop(rule, "queue_count")
elif rule.type == 'AVERAGE_SPEED':
row.prop(rule, "speed", slider=True)
row.prop(rule, "wander", slider=True)
@@ -672,25 +662,25 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
row.prop(rule, "flee_distance")
-class PARTICLE_PT_render(ParticleButtonsPanel):
+class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Render"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
- return engine in self.COMPAT_ENGINES
+ return engine in cls.COMPAT_ENGINES
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
row = layout.row()
row.prop(part, "material")
@@ -699,85 +689,82 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
split = layout.split()
sub = split.column()
- sub.prop(part, "emitter")
- sub.prop(part, "parent")
+ sub.prop(part, "use_render_emitter")
+ sub.prop(part, "use_parent_particles")
sub = split.column()
- sub.prop(part, "unborn")
- sub.prop(part, "died")
+ sub.prop(part, "show_unborn")
+ sub.prop(part, "use_dead")
row = layout.row()
- if wide_ui:
- row.prop(part, "ren_as", expand=True)
- else:
- row.prop(part, "ren_as", text="")
+ row.prop(part, "render_type", expand=True)
split = layout.split()
sub = split.column()
- if part.ren_as == 'LINE':
+ if part.render_type == 'LINE':
sub.prop(part, "line_length_tail")
sub.prop(part, "line_length_head")
sub = split.column()
- sub.prop(part, "velocity_length")
- elif part.ren_as == 'PATH':
- sub.prop(part, "render_strand")
+ sub.prop(part, "use_velocity_length")
+ elif part.render_type == 'PATH':
+ sub.prop(part, "use_strand_primitive")
subsub = sub.column()
- subsub.active = (part.render_strand is False)
- subsub.prop(part, "render_adaptive")
+ subsub.active = (part.use_strand_primitive is False)
+ subsub.prop(part, "use_render_adaptive")
subsub = sub.column()
- subsub.active = part.render_adaptive or part.render_strand == True
+ subsub.active = part.use_render_adaptive or part.use_strand_primitive == True
subsub.prop(part, "adaptive_angle")
subsub = sub.column()
- subsub.active = (part.render_adaptive is True and part.render_strand is False)
- subsub.prop(part, "adaptive_pix")
- sub.prop(part, "hair_bspline")
+ subsub.active = (part.use_render_adaptive is True and part.use_strand_primitive is False)
+ subsub.prop(part, "adaptive_pixel")
+ sub.prop(part, "use_hair_bspline")
sub.prop(part, "render_step", text="Steps")
sub = split.column()
sub.label(text="Timing:")
- sub.prop(part, "abs_path_time")
- sub.prop(part, "path_start", text="Start", slider=not part.abs_path_time)
- sub.prop(part, "path_end", text="End", slider=not part.abs_path_time)
- sub.prop(part, "random_length", text="Random", slider=True)
+ sub.prop(part, "use_absolute_path_time")
+ sub.prop(part, "path_start", text="Start", slider=not part.use_absolute_path_time)
+ sub.prop(part, "path_end", text="End", slider=not part.use_absolute_path_time)
+ sub.prop(part, "length_random", text="Random", slider=True)
row = layout.row()
col = row.column()
- if part.type == 'HAIR' and part.render_strand == True and part.child_type == 'FACES':
- layout.prop(part, "enable_simplify")
- if part.enable_simplify == True:
+ if part.type == 'HAIR' and part.use_strand_primitive == True and part.child_type == 'FACES':
+ layout.prop(part, "use_simplify")
+ if part.use_simplify == True:
row = layout.row()
row.prop(part, "simplify_refsize")
row.prop(part, "simplify_rate")
row.prop(part, "simplify_transition")
row = layout.row()
- row.prop(part, "viewport")
+ row.prop(part, "use_simplify_viewport")
sub = row.row()
sub.active = part.viewport == True
sub.prop(part, "simplify_viewport")
- elif part.ren_as == 'OBJECT':
+ elif part.render_type == 'OBJECT':
sub.prop(part, "dupli_object")
sub.prop(part, "use_global_dupli")
- elif part.ren_as == 'GROUP':
+ elif part.render_type == 'GROUP':
sub.prop(part, "dupli_group")
split = layout.split()
sub = split.column()
- sub.prop(part, "whole_group")
+ sub.prop(part, "use_whole_group")
subsub = sub.column()
- subsub.active = (part.whole_group is False)
+ subsub.active = (part.use_whole_group is False)
subsub.prop(part, "use_group_count")
sub = split.column()
subsub = sub.column()
- subsub.active = (part.whole_group is False)
+ subsub.active = (part.use_whole_group is False)
subsub.prop(part, "use_global_dupli")
- subsub.prop(part, "rand_group")
+ subsub.prop(part, "use_group_pick_random")
- if part.use_group_count and not part.whole_group:
+ if part.use_group_count and not part.use_whole_group:
row = layout.row()
- row.template_list(part, "dupliweights", part, "active_dupliweight_index")
+ row.template_list(part, "dupli_weights", part, "active_dupliweight_index")
col = row.column()
sub = col.row()
@@ -792,15 +779,12 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
row = layout.row()
row.prop(weight, "count")
- elif part.ren_as == 'BILLBOARD':
+ elif part.render_type == 'BILLBOARD':
sub.label(text="Align:")
row = layout.row()
- if wide_ui:
- row.prop(part, "billboard_align", expand=True)
- else:
- row.prop(part, "billboard_align", text="")
- row.prop(part, "billboard_lock", text="Lock")
+ row.prop(part, "billboard_align", expand=True)
+ row.prop(part, "lock_billboard", text="Lock")
row = layout.row()
row.prop(part, "billboard_object")
@@ -808,7 +792,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
col = row.column(align=True)
col.label(text="Tilt:")
col.prop(part, "billboard_tilt", text="Angle", slider=True)
- col.prop(part, "billboard_random_tilt", slider=True)
+ col.prop(part, "billboard_tilt_random", slider=True)
col = row.column()
col.prop(part, "billboard_offset")
@@ -826,57 +810,54 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
row.label(text="Animate:")
row.prop(part, "billboard_animation", text="")
row.label(text="Offset:")
- row.prop(part, "billboard_split_offset", text="")
+ row.prop(part, "billboard_offset_split", text="")
- if part.ren_as == 'HALO' or part.ren_as == 'LINE' or part.ren_as == 'BILLBOARD':
+ if part.render_type == 'HALO' or part.render_type == 'LINE' or part.render_type == 'BILLBOARD':
row = layout.row()
col = row.column()
col.prop(part, "trail_count")
if part.trail_count > 1:
- col.prop(part, "abs_path_time", text="Length in frames")
+ col.prop(part, "use_absolute_path_time", text="Length in frames")
col = row.column()
- col.prop(part, "path_end", text="Length", slider=not part.abs_path_time)
- col.prop(part, "random_length", text="Random", slider=True)
+ col.prop(part, "path_end", text="Length", slider=not part.use_absolute_path_time)
+ col.prop(part, "length_random", text="Random", slider=True)
else:
col = row.column()
col.label(text="")
-class PARTICLE_PT_draw(ParticleButtonsPanel):
+class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Display"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
if psys is None:
return False
if psys.settings is None:
return False
- return engine in self.COMPAT_ENGINES
+ return engine in cls.COMPAT_ENGINES
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
row = layout.row()
- if wide_ui:
- row.prop(part, "draw_as", expand=True)
- else:
- row.prop(part, "draw_as", text="")
+ row.prop(part, "draw_method", expand=True)
- if part.draw_as == 'NONE' or (part.ren_as == 'NONE' and part.draw_as == 'RENDER'):
+ if part.draw_method == 'NONE' or (part.render_type == 'NONE' and part.draw_method == 'RENDER'):
return
- path = (part.ren_as == 'PATH' and part.draw_as == 'RENDER') or part.draw_as == 'PATH'
+ path = (part.render_type == 'PATH' and part.draw_method == 'RENDER') or part.draw_method == 'PATH'
row = layout.row()
- row.prop(part, "display", slider=True)
- if part.draw_as != 'RENDER' or part.ren_as == 'HALO':
+ row.prop(part, "draw_percentage", slider=True)
+ if part.draw_method != 'RENDER' or part.render_type == 'HALO':
row.prop(part, "draw_size")
else:
row.label(text="")
@@ -884,39 +865,39 @@ class PARTICLE_PT_draw(ParticleButtonsPanel):
row = layout.row()
col = row.column()
col.prop(part, "show_size")
- col.prop(part, "velocity")
- col.prop(part, "num")
+ col.prop(part, "show_velocity")
+ col.prop(part, "show_number")
if part.physics_type == 'BOIDS':
- col.prop(part, "draw_health")
+ col.prop(part, "show_health")
col = row.column()
- col.prop(part, "material_color", text="Use material color")
+ col.prop(part, "show_material_color", text="Use material color")
if (path):
col.prop(part, "draw_step")
else:
sub = col.column()
- sub.active = (part.material_color is False)
+ sub.active = (part.show_material_color is False)
#sub.label(text="color")
#sub.label(text="Override material color")
-class PARTICLE_PT_children(ParticleButtonsPanel):
+class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Children"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
+ @classmethod
+ def poll(cls, context):
+ return particle_panel_poll(cls, context)
+
def draw(self, context):
layout = self.layout
psys = context.particle_system
part = psys.settings
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.row().prop(part, "child_type", expand=True)
- else:
- layout.row().prop(part, "child_type", text="")
+ layout.row().prop(part, "child_type", expand=True)
if part.child_type == 'NONE':
return
@@ -925,7 +906,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel):
col = row.column(align=True)
col.prop(part, "child_nbr", text="Display")
- col.prop(part, "rendered_child_nbr", text="Render")
+ col.prop(part, "rendered_child_count", text="Render")
col = row.column(align=True)
@@ -937,7 +918,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel):
col = row.column(align=True)
col.prop(part, "child_size", text="Size")
- col.prop(part, "child_random_size", text="Random")
+ col.prop(part, "child_size_random", text="Random")
layout.row().label(text="Effects:")
@@ -945,37 +926,34 @@ class PARTICLE_PT_children(ParticleButtonsPanel):
col = row.column(align=True)
col.prop(part, "clump_factor", slider=True)
- col.prop(part, "clumppow", slider=True)
+ col.prop(part, "clump_shape", slider=True)
col = row.column(align=True)
- col.prop(part, "rough_endpoint")
- col.prop(part, "rough_end_shape")
+ col.prop(part, "roughness_endpoint")
+ col.prop(part, "roughness_end_shape")
row = layout.row()
col = row.column(align=True)
- col.prop(part, "rough1")
- col.prop(part, "rough1_size")
+ col.prop(part, "roughness_1")
+ col.prop(part, "roughness_1_size")
col = row.column(align=True)
- col.prop(part, "rough2")
- col.prop(part, "rough2_size")
- col.prop(part, "rough2_thres", slider=True)
+ col.prop(part, "roughness_2")
+ col.prop(part, "roughness_2_size")
+ col.prop(part, "roughness_2_threshold", slider=True)
row = layout.row()
col = row.column(align=True)
col.prop(part, "child_length", slider=True)
- col.prop(part, "child_length_thres", slider=True)
+ col.prop(part, "child_length_threshold", slider=True)
col = row.column(align=True)
col.label(text="Space reserved for")
col.label(text="hair parting controls")
layout.row().label(text="Kink:")
- if wide_ui:
- layout.row().prop(part, "kink", expand=True)
- else:
- layout.row().prop(part, "kink", text="")
+ layout.row().prop(part, "kink", expand=True)
split = layout.split()
@@ -986,7 +964,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel):
col.prop(part, "kink_shape", slider=True)
-class PARTICLE_PT_field_weights(ParticleButtonsPanel):
+class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Field Weights"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -996,10 +974,10 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel):
effector_weights_ui(self, context, part.effector_weights)
if part.type == 'HAIR':
- self.layout.prop(part.effector_weights, "do_growing_hair")
+ self.layout.prop(part.effector_weights, "apply_to_hair_growing")
-class PARTICLE_PT_force_fields(ParticleButtonsPanel):
+class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Force Field Settings"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -1009,7 +987,7 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel):
part = context.particle_system.settings
- layout.prop(part, "self_effect")
+ layout.prop(part, "use_self_effect")
split = layout.split(percentage=0.2)
split.label(text="Type 1:")
@@ -1027,7 +1005,7 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel):
basic_force_field_falloff_ui(self, context, part.force_field_2)
-class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):
+class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Vertexgroups"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -1048,82 +1026,64 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel):
row = layout.row()
row.prop_object(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
- row.prop(psys, "vertex_group_density_negate", text="")
+ row.prop(psys, "invert_vertex_group_density", text="")
row = layout.row()
row.prop_object(psys, "vertex_group_velocity", ob, "vertex_groups", text="Velocity")
- row.prop(psys, "vertex_group_velocity_negate", text="")
+ row.prop(psys, "invert_vertex_group_velocity", text="")
row = layout.row()
row.prop_object(psys, "vertex_group_length", ob, "vertex_groups", text="Length")
- row.prop(psys, "vertex_group_length_negate", text="")
+ row.prop(psys, "invert_vertex_group_length", text="")
row = layout.row()
row.prop_object(psys, "vertex_group_clump", ob, "vertex_groups", text="Clump")
- row.prop(psys, "vertex_group_clump_negate", text="")
+ row.prop(psys, "invert_vertex_group_clump", text="")
row = layout.row()
row.prop_object(psys, "vertex_group_kink", ob, "vertex_groups", text="Kink")
- row.prop(psys, "vertex_group_kink_negate", text="")
+ row.prop(psys, "invert_vertex_group_kink", text="")
row = layout.row()
- row.prop_object(psys, "vertex_group_roughness1", ob, "vertex_groups", text="Roughness 1")
- row.prop(psys, "vertex_group_roughness1_negate", text="")
+ row.prop_object(psys, "vertex_group_roughness_1", ob, "vertex_groups", text="Roughness 1")
+ row.prop(psys, "invert_vertex_group_roughness_1", text="")
row = layout.row()
- row.prop_object(psys, "vertex_group_roughness2", ob, "vertex_groups", text="Roughness 2")
- row.prop(psys, "vertex_group_roughness2_negate", text="")
+ row.prop_object(psys, "vertex_group_roughness_2", ob, "vertex_groups", text="Roughness 2")
+ row.prop(psys, "invert_vertex_group_roughness_2", text="")
row = layout.row()
row.prop_object(psys, "vertex_group_roughness_end", ob, "vertex_groups", text="Roughness End")
- row.prop(psys, "vertex_group_roughness_end_negate", text="")
+ row.prop(psys, "invert_vertex_group_roughness_end", text="")
row = layout.row()
row.prop_object(psys, "vertex_group_size", ob, "vertex_groups", text="Size")
- row.prop(psys, "vertex_group_size_negate", text="")
+ row.prop(psys, "invert_vertex_group_size", text="")
row = layout.row()
row.prop_object(psys, "vertex_group_tangent", ob, "vertex_groups", text="Tangent")
- row.prop(psys, "vertex_group_tangent_negate", text="")
+ row.prop(psys, "invert_vertex_group_tangent", text="")
row = layout.row()
row.prop_object(psys, "vertex_group_rotation", ob, "vertex_groups", text="Rotation")
- row.prop(psys, "vertex_group_rotation_negate", text="")
+ row.prop(psys, "invert_vertex_group_rotation", text="")
row = layout.row()
row.prop_object(psys, "vertex_group_field", ob, "vertex_groups", text="Field")
- row.prop(psys, "vertex_group_field_negate", text="")
+ row.prop(psys, "invert_vertex_group_field", text="")
-classes = [
- PARTICLE_PT_context_particles,
- PARTICLE_PT_hair_dynamics,
- PARTICLE_PT_cache,
- PARTICLE_PT_emission,
- PARTICLE_PT_velocity,
- PARTICLE_PT_rotation,
- PARTICLE_PT_physics,
- PARTICLE_PT_boidbrain,
- PARTICLE_PT_render,
- PARTICLE_PT_draw,
- PARTICLE_PT_children,
- PARTICLE_PT_field_weights,
- PARTICLE_PT_force_fields,
- PARTICLE_PT_vertexgroups,
-
- PARTICLE_PT_custom_props]
+class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+ _context_path = "particle_system.settings"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py
index 61e1fe81812..30619de5814 100644
--- a/release/scripts/ui/properties_physics_cloth.py
+++ b/release/scripts/ui/properties_physics_cloth.py
@@ -19,15 +19,13 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
from properties_physics_common import point_cache_ui
from properties_physics_common import effector_weights_ui
def cloth_panel_enabled(md):
- return md.point_cache.baked is False
+ return md.point_cache.is_baked is False
class CLOTH_MT_presets(bpy.types.Menu):
@@ -40,18 +38,19 @@ class CLOTH_MT_presets(bpy.types.Menu):
draw = bpy.types.Menu.draw_preset
-class PhysicButtonsPanel(bpy.types.Panel):
+class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
-class PHYSICS_PT_cloth(PhysicButtonsPanel):
+class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth"
def draw(self, context):
@@ -59,7 +58,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
md = context.cloth
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -69,13 +67,12 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
split.operator("object.modifier_remove", text="Remove")
row = split.row(align=True)
- row.prop(md, "render", text="")
- row.prop(md, "realtime", text="")
+ row.prop(md, "show_render", text="")
+ row.prop(md, "show_viewport", text="")
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'CLOTH'
- if wide_ui:
- split.label()
+ split.label()
if md:
cloth = md.settings
@@ -99,16 +96,15 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
col.prop(cloth, "structural_stiffness", text="Structural")
col.prop(cloth, "bending_stiffness", text="Bending")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Damping:")
col.prop(cloth, "spring_damping", text="Spring")
col.prop(cloth, "air_damping", text="Air")
- col.prop(cloth, "pin_cloth", text="Pinning")
+ col.prop(cloth, "use_pin_cloth", text="Pinning")
sub = col.column()
- sub.active = cloth.pin_cloth
+ sub.active = cloth.use_pin_cloth
sub.prop_object(cloth, "mass_vertex_group", ob, "vertex_groups", text="")
sub.prop(cloth, "pin_stiffness", text="Stiffness")
@@ -133,11 +129,12 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
col.prop_object(cloth, "rest_shape_key", key, "keys", text="")
-class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
+class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Cache"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.cloth
def draw(self, context):
@@ -145,58 +142,58 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
point_cache_ui(self, context, md.point_cache, cloth_panel_enabled(md), 'CLOTH')
-class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
+class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Collision"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.cloth
def draw_header(self, context):
cloth = context.cloth.collision_settings
self.layout.active = cloth_panel_enabled(context.cloth)
- self.layout.prop(cloth, "enable_collision", text="")
+ self.layout.prop(cloth, "use_collision", text="")
def draw(self, context):
layout = self.layout
cloth = context.cloth.collision_settings
md = context.cloth
- wide_ui = context.region.width > narrowui
- layout.active = cloth.enable_collision and cloth_panel_enabled(md)
+ layout.active = cloth.use_collision and cloth_panel_enabled(md)
split = layout.split()
col = split.column()
col.prop(cloth, "collision_quality", slider=True, text="Quality")
- col.prop(cloth, "min_distance", slider=True, text="Distance")
+ col.prop(cloth, "distance_min", slider=True, text="Distance")
col.prop(cloth, "friction")
- if wide_ui:
- col = split.column()
- col.prop(cloth, "enable_self_collision", text="Self Collision")
+ col = split.column()
+ col.prop(cloth, "use_self_collision", text="Self Collision")
sub = col.column()
- sub.active = cloth.enable_self_collision
+ sub.active = cloth.use_self_collision
sub.prop(cloth, "self_collision_quality", slider=True, text="Quality")
- sub.prop(cloth, "self_min_distance", slider=True, text="Distance")
+ sub.prop(cloth, "self_distance_min", slider=True, text="Distance")
layout.prop(cloth, "group")
-class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
+class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Stiffness Scaling"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.cloth
def draw_header(self, context):
cloth = context.cloth.settings
self.layout.active = cloth_panel_enabled(context.cloth)
- self.layout.prop(cloth, "stiffness_scaling", text="")
+ self.layout.prop(cloth, "use_stiffness_scale", text="")
def draw(self, context):
layout = self.layout
@@ -204,9 +201,8 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
md = context.cloth
ob = context.object
cloth = context.cloth.settings
- wide_ui = context.region.width > narrowui
- layout.active = cloth.stiffness_scaling and cloth_panel_enabled(md)
+ layout.active = cloth.use_stiffness_scale and cloth_panel_enabled(md)
split = layout.split()
@@ -215,18 +211,18 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
col.prop_object(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="")
col.prop(cloth, "structural_stiffness_max", text="Max")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Bending Stiffness:")
col.prop_object(cloth, "bending_vertex_group", ob, "vertex_groups", text="")
col.prop(cloth, "bending_stiffness_max", text="Max")
-class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel):
+class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Cloth Field Weights"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.cloth)
def draw(self, context):
@@ -234,26 +230,12 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel):
effector_weights_ui(self, context, cloth.effector_weights)
-classes = [
- CLOTH_MT_presets,
-
- PHYSICS_PT_cloth,
- PHYSICS_PT_cloth_cache,
- PHYSICS_PT_cloth_collision,
- PHYSICS_PT_cloth_stiffness,
- PHYSICS_PT_cloth_field_weights]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_physics_common.py b/release/scripts/ui/properties_physics_common.py
index be8972e4fe6..fb9f2f981ae 100644
--- a/release/scripts/ui/properties_physics_common.py
+++ b/release/scripts/ui/properties_physics_common.py
@@ -20,28 +20,25 @@
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
#cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc
def point_cache_ui(self, context, cache, enabled, cachetype):
layout = self.layout
- wide_ui = context.region.width > narrowui
layout.set_context_pointer("point_cache", cache)
row = layout.row()
- row.template_list(cache, "point_cache_list", cache, "active_point_cache_index", rows=2)
+ row.template_list(cache, "point_caches", cache, "active_point_cache_index", rows=2)
col = row.column(align=True)
col.operator("ptcache.add", icon='ZOOMIN', text="")
col.operator("ptcache.remove", icon='ZOOMOUT', text="")
row = layout.row()
if cachetype in ('PSYS', 'HAIR', 'SMOKE'):
- row.prop(cache, "external")
+ row.prop(cache, "use_external")
- if cache.external:
+ if cache.use_external:
split = layout.split(percentage=0.80)
split.prop(cache, "name", text="File Name")
split.prop(cache, "index", text="")
@@ -64,19 +61,18 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
col.prop(cache, "frame_start")
col.prop(cache, "frame_end")
if cachetype != 'SMOKE':
- col.prop(cache, "step")
+ col.prop(cache, "frame_step")
- if wide_ui:
- col = split.column()
+ col = split.column()
if cachetype != 'SMOKE':
sub = col.column()
sub.enabled = enabled
- sub.prop(cache, "quick_cache")
+ sub.prop(cache, "use_quick_cache")
sub = col.column()
- sub.enabled = bpy.data.file_is_saved
- sub.prop(cache, "disk_cache")
+ sub.enabled = (not bpy.data.is_dirty)
+ sub.prop(cache, "use_disk_cache")
col.label(text=cache.info)
sub = col.column()
@@ -88,13 +84,13 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
col = split.column()
- if cache.baked == True:
+ if cache.is_baked == True:
col.operator("ptcache.free_bake", text="Free Bake")
else:
col.operator("ptcache.bake", text="Bake").bake = True
sub = col.row()
- sub.enabled = (cache.frames_skipped or cache.outdated) and enabled
+ sub.enabled = (cache.frames_skipped or cache.is_outdated) and enabled
sub.operator("ptcache.bake", text="Calculate To Frame").bake = False
sub = col.column()
@@ -102,8 +98,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
sub.operator("ptcache.bake_from_cache", text="Current Cache to Bake")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.operator("ptcache.bake_all", text="Bake All Dynamics").bake = True
col.operator("ptcache.free_bake_all", text="Free All Bakes")
col.operator("ptcache.bake_all", text="Update All To Frame").bake = False
@@ -112,7 +107,6 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
def effector_weights_ui(self, context, weights):
layout = self.layout
- wide_ui = context.region.width > narrowui
layout.prop(weights, "group")
@@ -121,8 +115,7 @@ def effector_weights_ui(self, context, weights):
col = split.column()
col.prop(weights, "gravity", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(weights, "all", slider=True)
layout.separator()
@@ -134,11 +127,10 @@ def effector_weights_ui(self, context, weights):
col.prop(weights, "vortex", slider=True)
col.prop(weights, "magnetic", slider=True)
col.prop(weights, "wind", slider=True)
- col.prop(weights, "curveguide", slider=True)
+ col.prop(weights, "curve_guide", slider=True)
col.prop(weights, "texture", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(weights, "harmonic", slider=True)
col.prop(weights, "charge", slider=True)
col.prop(weights, "lennardjones", slider=True)
@@ -150,7 +142,6 @@ def effector_weights_ui(self, context, weights):
def basic_force_field_settings_ui(self, context, field):
layout = self.layout
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -177,37 +168,32 @@ def basic_force_field_settings_ui(self, context, field):
else:
col.prop(field, "flow")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(field, "noise")
col.prop(field, "seed")
if field.type == 'TURBULENCE':
- col.prop(field, "global_coordinates", text="Global")
+ col.prop(field, "use_global_coords", text="Global")
elif field.type == 'HARMONIC':
- col.prop(field, "multiple_springs")
+ col.prop(field, "use_multiple_springs")
split = layout.split()
col = split.column()
col.label(text="Effect point:")
- col.prop(field, "do_location")
- col.prop(field, "do_rotation")
+ col.prop(field, "apply_to_location")
+ col.prop(field, "apply_to_rotation")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Collision:")
- col.prop(field, "do_absorption")
+ col.prop(field, "use_absorption")
def basic_force_field_falloff_ui(self, context, field):
layout = self.layout
- wide_ui = context.region.width > narrowui
# XXX: This doesn't update for some reason.
- #if wide_ui:
- # split = layout.split()
- #else:
+ #split = layout.split()
split = layout.split(percentage=0.35)
if not field or field.type == 'NONE':
@@ -218,17 +204,16 @@ def basic_force_field_falloff_ui(self, context, field):
col.prop(field, "use_min_distance", text="Use Minimum")
col.prop(field, "use_max_distance", text="Use Maximum")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(field, "falloff_power", text="Power")
sub = col.column()
sub.active = field.use_min_distance
- sub.prop(field, "minimum_distance", text="Distance")
+ sub.prop(field, "distance_min", text="Distance")
sub = col.column()
sub.active = field.use_max_distance
- sub.prop(field, "maximum_distance", text="Distance")
+ sub.prop(field, "distance_max", text="Distance")
def register():
diff --git a/release/scripts/ui/properties_physics_field.py b/release/scripts/ui/properties_physics_field.py
index 57fa40e4c5d..80ea999eedb 100644
--- a/release/scripts/ui/properties_physics_field.py
+++ b/release/scripts/ui/properties_physics_field.py
@@ -19,24 +19,23 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
from properties_physics_common import basic_force_field_settings_ui
from properties_physics_common import basic_force_field_falloff_ui
-class PhysicButtonsPanel(bpy.types.Panel):
+class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
return (context.object) and (not rd.use_game_engine)
-class PHYSICS_PT_field(PhysicButtonsPanel):
+class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Force Fields"
def draw(self, context):
@@ -44,22 +43,15 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
ob = context.object
field = ob.field
- wide_ui = context.region.width > narrowui
- if wide_ui:
- split = layout.split(percentage=0.2)
- split.label(text="Type:")
- else:
- split = layout.split()
+ split = layout.split(percentage=0.2)
+ split.label(text="Type:")
split.prop(field, "type", text="")
if field.type not in ('NONE', 'GUIDE', 'TEXTURE'):
- if wide_ui:
- split = layout.split(percentage=0.2)
- split.label(text="Shape:")
- else:
- split = layout.split()
+ split = layout.split(percentage=0.2)
+ split.label(text="Shape:")
split.prop(field, "shape", text="")
split = layout.split()
@@ -71,11 +63,10 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
col.prop(field, "guide_minimum")
col.prop(field, "guide_free")
col.prop(field, "falloff_power")
- col.prop(field, "guide_path_add")
+ col.prop(field, "use_guide_path_add")
col.prop(field, "use_guide_path_weight")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Clumping:")
col.prop(field, "guide_clump_amount")
col.prop(field, "guide_clump_shape")
@@ -84,7 +75,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
row.prop(field, "use_max_distance")
sub = row.row()
sub.active = field.use_max_distance
- sub.prop(field, "maximum_distance")
+ sub.prop(field, "distance_max")
layout.separator()
@@ -98,8 +89,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
col.prop(field, "guide_kink_frequency")
col.prop(field, "guide_kink_shape")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(field, "guide_kink_amplitude")
elif field.type == 'TEXTURE':
@@ -109,11 +99,10 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
col.prop(field, "texture_mode", text="")
col.prop(field, "texture_nabla")
- if wide_ui:
- col = split.column()
- col.prop(field, "use_coordinates")
- col.prop(field, "root_coordinates")
- col.prop(field, "force_2d")
+ col = split.column()
+ col.prop(field, "use_object_coords")
+ col.prop(field, "use_root_coords")
+ col.prop(field, "use_2d_force")
else:
basic_force_field_settings_ui(self, context, field)
@@ -134,17 +123,16 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
col.prop(field, "use_radial_min", text="Use Minimum")
col.prop(field, "use_radial_max", text="Use Maximum")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(field, "radial_falloff", text="Power")
sub = col.column()
sub.active = field.use_radial_min
- sub.prop(field, "radial_minimum", text="Angle")
+ sub.prop(field, "radial_min", text="Angle")
sub = col.column()
sub.active = field.use_radial_max
- sub.prop(field, "radial_maximum", text="Angle")
+ sub.prop(field, "radial_max", text="Angle")
elif field.falloff_type == 'TUBE':
layout.separator()
@@ -156,24 +144,24 @@ class PHYSICS_PT_field(PhysicButtonsPanel):
col.prop(field, "use_radial_min", text="Use Minimum")
col.prop(field, "use_radial_max", text="Use Maximum")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(field, "radial_falloff", text="Power")
sub = col.column()
sub.active = field.use_radial_min
- sub.prop(field, "radial_minimum", text="Distance")
+ sub.prop(field, "radial_min", text="Distance")
sub = col.column()
sub.active = field.use_radial_max
- sub.prop(field, "radial_maximum", text="Distance")
+ sub.prop(field, "radial_max", text="Distance")
-class PHYSICS_PT_collision(PhysicButtonsPanel):
+class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Collision"
#bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@@ -182,7 +170,6 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
layout = self.layout
md = context.collision
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -190,27 +177,25 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
# remove modifier + settings
split.set_context_pointer("modifier", md)
split.operator("object.modifier_remove", text="Remove")
- if wide_ui:
- col = split.column()
+ col = split.column()
#row = split.row(align=True)
- #row.prop(md, "render", text="")
- #row.prop(md, "realtime", text="")
+ #row.prop(md, "show_render", text="")
+ #row.prop(md, "show_viewport", text="")
coll = md.settings
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'COLLISION'
- if wide_ui:
- split.label()
+ split.label()
coll = None
if coll:
settings = context.object.collision
- layout.active = settings.enabled
+ layout.active = settings.use
split = layout.split()
@@ -218,23 +203,22 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
col.label(text="Particle:")
col.prop(settings, "permeability", slider=True)
col.prop(settings, "stickness")
- col.prop(settings, "kill_particles")
+ col.prop(settings, "use_particle_kill")
col.label(text="Particle Damping:")
sub = col.column(align=True)
sub.prop(settings, "damping_factor", text="Factor", slider=True)
- sub.prop(settings, "random_damping", text="Random", slider=True)
+ sub.prop(settings, "damping_random", text="Random", slider=True)
col.label(text="Particle Friction:")
sub = col.column(align=True)
sub.prop(settings, "friction_factor", text="Factor", slider=True)
- sub.prop(settings, "random_friction", text="Random", slider=True)
+ sub.prop(settings, "friction_random", text="Random", slider=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Soft Body and Cloth:")
sub = col.column(align=True)
- sub.prop(settings, "outer_thickness", text="Outer", slider=True)
- sub.prop(settings, "inner_thickness", text="Inner", slider=True)
+ sub.prop(settings, "thickness_outer", text="Outer", slider=True)
+ sub.prop(settings, "thickness_inner", text="Inner", slider=True)
col.label(text="Soft Body Damping:")
col.prop(settings, "damping", text="Factor", slider=True)
@@ -243,21 +227,12 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
col.prop(settings, "absorption", text="Absorption")
-classes = [
- PHYSICS_PT_field,
- PHYSICS_PT_collision]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_physics_fluid.py b/release/scripts/ui/properties_physics_fluid.py
index 32acd88654d..035eefe6c2a 100644
--- a/release/scripts/ui/properties_physics_fluid.py
+++ b/release/scripts/ui/properties_physics_fluid.py
@@ -19,28 +19,26 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class PhysicButtonsPanel(bpy.types.Panel):
+class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
-class PHYSICS_PT_fluid(PhysicButtonsPanel):
+class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Fluid"
def draw(self, context):
layout = self.layout
md = context.fluid
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -50,34 +48,28 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
split.operator("object.modifier_remove", text="Remove")
row = split.row(align=True)
- row.prop(md, "render", text="")
- row.prop(md, "realtime", text="")
+ row.prop(md, "show_render", text="")
+ row.prop(md, "show_viewport", text="")
fluid = md.settings
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'FLUID_SIMULATION'
- if wide_ui:
- split.label()
+ split.label()
fluid = None
if fluid:
- if wide_ui:
- row = layout.row()
- row.prop(fluid, "type")
- if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
- row.prop(fluid, "active", text="")
- else:
- layout.prop(fluid, "type", text="")
- if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
- layout.prop(fluid, "active", text="")
+ row = layout.row()
+ row.prop(fluid, "type")
+ if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
+ row.prop(fluid, "use", text="")
layout = layout.column()
if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
- layout.active = fluid.active
+ layout.active = fluid.use
if fluid.type == 'DOMAIN':
layout.operator("fluid.bake", text="Bake Fluid Simulation", icon='MOD_FLUIDSIM')
@@ -89,8 +81,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col.label(text="Render Display:")
col.prop(fluid, "render_display_mode", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Required Memory: " + fluid.memory_estimate)
col.prop(fluid, "preview_resolution", text="Preview")
col.label(text="Viewport Display:")
@@ -104,13 +95,12 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
sub.prop(fluid, "start_time", text="Start")
sub.prop(fluid, "end_time", text="End")
- if wide_ui:
- col = split.column()
- col.label()
- col.prop(fluid, "generate_speed_vectors")
- col.prop(fluid, "reverse_frames")
+ col = split.column()
+ col.label()
+ col.prop(fluid, "use_speed_vectors")
+ col.prop(fluid, "use_reverse_frames")
- layout.prop(fluid, "path", text="")
+ layout.prop(fluid, "filepath", text="")
elif fluid.type == 'FLUID':
split = layout.split()
@@ -118,10 +108,9 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col = split.column()
col.label(text="Volume Initialization:")
col.prop(fluid, "volume_initialization", text="")
- col.prop(fluid, "export_animated_mesh")
+ col.prop(fluid, "use_animated_mesh")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Initial Velocity:")
col.prop(fluid, "initial_velocity", text="")
@@ -131,10 +120,9 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col = split.column()
col.label(text="Volume Initialization:")
col.prop(fluid, "volume_initialization", text="")
- col.prop(fluid, "export_animated_mesh")
+ col.prop(fluid, "use_animated_mesh")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Slip Type:")
col.prop(fluid, "slip_type", text="")
if fluid.slip_type == 'PARTIALSLIP':
@@ -149,11 +137,10 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col = split.column()
col.label(text="Volume Initialization:")
col.prop(fluid, "volume_initialization", text="")
- col.prop(fluid, "export_animated_mesh")
- col.prop(fluid, "local_coordinates")
+ col.prop(fluid, "use_animated_mesh")
+ col.prop(fluid, "use_local_coords")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Inflow Velocity:")
col.prop(fluid, "inflow_velocity", text="")
@@ -163,10 +150,9 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col = split.column()
col.label(text="Volume Initialization:")
col.prop(fluid, "volume_initialization", text="")
- col.prop(fluid, "export_animated_mesh")
+ col.prop(fluid, "use_animated_mesh")
- if wide_ui:
- split.column()
+ split.column()
elif fluid.type == 'PARTICLE':
split = layout.split()
@@ -176,14 +162,13 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col.prop(fluid, "particle_influence", text="Size")
col.prop(fluid, "alpha_influence", text="Alpha")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Type:")
- col.prop(fluid, "drops")
- col.prop(fluid, "floats")
- col.prop(fluid, "tracer")
+ col.prop(fluid, "use_drops")
+ col.prop(fluid, "use_floats")
+ col.prop(fluid, "show_tracer")
- layout.prop(fluid, "path", text="")
+ layout.prop(fluid, "filepath", text="")
elif fluid.type == 'CONTROL':
split = layout.split()
@@ -191,10 +176,9 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
col = split.column()
col.label(text="")
col.prop(fluid, "quality", slider=True)
- col.prop(fluid, "reverse_frames")
+ col.prop(fluid, "use_reverse_frames")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Time:")
sub = col.column(align=True)
sub.prop(fluid, "start_time", text="Start")
@@ -208,28 +192,27 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
sub.prop(fluid, "attraction_strength", text="Strength")
sub.prop(fluid, "attraction_radius", text="Radius")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Velocity Force:")
sub = col.column(align=True)
sub.prop(fluid, "velocity_strength", text="Strength")
sub.prop(fluid, "velocity_radius", text="Radius")
-class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
+class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain World"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.fluid
- return md and (md.settings.type == 'DOMAIN')
+ return md and md.settings and (md.settings.type == 'DOMAIN')
def draw(self, context):
layout = self.layout
fluid = context.fluid.settings
scene = context.scene
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -247,13 +230,12 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
col.label(text="Using Scene Size Units", icon="SCENE_DATA")
sub = col.column()
sub.enabled = False
- sub.prop(fluid, "real_world_size", text="Metres")
+ sub.prop(fluid, "simulation_scale", text="Metres")
else:
col.label(text="Real World Size:")
- col.prop(fluid, "real_world_size", text="Metres")
+ col.prop(fluid, "simulation_scale", text="Metres")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Viscosity Presets:")
sub = col.column(align=True)
sub.prop(fluid, "viscosity_preset", text="")
@@ -267,19 +249,19 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
col.prop(fluid, "compressibility", slider=True)
-class PHYSICS_PT_domain_boundary(PhysicButtonsPanel):
+class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain Boundary"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.fluid
- return md and (md.settings.type == 'DOMAIN')
+ return md and md.settings and (md.settings.type == 'DOMAIN')
def draw(self, context):
layout = self.layout
fluid = context.fluid.settings
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -289,20 +271,20 @@ class PHYSICS_PT_domain_boundary(PhysicButtonsPanel):
if fluid.slip_type == 'PARTIALSLIP':
col.prop(fluid, "partial_slip_factor", slider=True, text="Amount")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Surface:")
- col.prop(fluid, "surface_smoothing", text="Smoothing")
+ col.prop(fluid, "surface_smooth", text="Smoothing")
col.prop(fluid, "surface_subdivisions", text="Subdivisions")
-class PHYSICS_PT_domain_particles(PhysicButtonsPanel):
+class PHYSICS_PT_domain_particles(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Domain Particles"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.fluid
- return md and (md.settings.type == 'DOMAIN')
+ return md and md.settings and (md.settings.type == 'DOMAIN')
def draw(self, context):
layout = self.layout
@@ -314,23 +296,12 @@ class PHYSICS_PT_domain_particles(PhysicButtonsPanel):
col.prop(fluid, "generate_particles")
-classes = [
- PHYSICS_PT_fluid,
- PHYSICS_PT_domain_gravity,
- PHYSICS_PT_domain_boundary,
- PHYSICS_PT_domain_particles]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_physics_smoke.py b/release/scripts/ui/properties_physics_smoke.py
index c5357c515de..d2e37ef29fb 100644
--- a/release/scripts/ui/properties_physics_smoke.py
+++ b/release/scripts/ui/properties_physics_smoke.py
@@ -19,25 +19,24 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
from properties_physics_common import point_cache_ui
from properties_physics_common import effector_weights_ui
-class PhysicButtonsPanel(bpy.types.Panel):
+class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
-class PHYSICS_PT_smoke(PhysicButtonsPanel):
+class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke"
def draw(self, context):
@@ -45,7 +44,6 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
md = context.smoke
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -55,20 +53,16 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
split.operator("object.modifier_remove", text="Remove")
row = split.row(align=True)
- row.prop(md, "render", text="")
- row.prop(md, "realtime", text="")
+ row.prop(md, "show_render", text="")
+ row.prop(md, "show_viewport", text="")
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'SMOKE'
- if wide_ui:
- split.label()
+ split.label()
if md:
- if wide_ui:
- layout.prop(md, "smoke_type", expand=True)
- else:
- layout.prop(md, "smoke_type", text="")
+ layout.prop(md, "smoke_type", expand=True)
if md.smoke_type == 'DOMAIN':
domain = md.domain_settings
@@ -77,50 +71,60 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
col = split.column()
col.label(text="Resolution:")
- col.prop(domain, "maxres", text="Divisions")
- col.label(text="Particle:")
- col.prop(domain, "initial_velocity", text="Initial Velocity")
+ col.prop(domain, "resolution_max", text="Divisions")
+ col.label(text="Time:")
+ col.prop(domain, "time_scale", text="Scale")
+ col.label(text="Border Collisions:")
+ col.prop(domain, "collision_extents", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Behavior:")
col.prop(domain, "alpha")
col.prop(domain, "beta")
- col.prop(domain, "dissolve_smoke", text="Dissolve")
+ col.prop(domain, "vorticity")
+ col.prop(domain, "use_dissolve_smoke", text="Dissolve")
sub = col.column()
- sub.active = domain.dissolve_smoke
+ sub.active = domain.use_dissolve_smoke
sub.prop(domain, "dissolve_speed", text="Time")
- sub.prop(domain, "dissolve_smoke_log", text="Slow")
+ sub.prop(domain, "use_dissolve_smoke_log", text="Slow")
elif md.smoke_type == 'FLOW':
+
flow = md.flow_settings
split = layout.split()
col = split.column()
- col.prop(flow, "outflow")
+ col.prop(flow, "use_outflow")
col.label(text="Particle System:")
col.prop_object(flow, "psys", ob, "particle_systems", text="")
- if md.flow_settings.outflow:
- if wide_ui:
- col = split.column()
- else:
- if wide_ui:
- col = split.column()
- col.label(text="Behavior:")
- col.prop(flow, "temperature")
- col.prop(flow, "density")
+ sub = col.column()
+ sub.active = not md.flow_settings.outflow
+
+ sub.prop(flow, "initial_velocity", text="Initial Velocity")
+ sub = sub.column()
+ sub.active = flow.initial_velocity
+ sub.prop(flow, "velocity_factor", text="Multiplier")
+
+
+ sub = split.column()
+ sub.active = not md.flow_settings.outflow
+ sub.label(text="Behavior:")
+ sub.prop(flow, "temperature")
+ sub.prop(flow, "density")
+ sub.prop(flow, "use_absolute")
#elif md.smoke_type == 'COLLISION':
# layout.separator()
-class PHYSICS_PT_smoke_groups(PhysicButtonsPanel):
+class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Groups"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.smoke
return md and (md.smoke_type == 'DOMAIN')
@@ -128,7 +132,6 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel):
layout = self.layout
group = context.smoke.domain_settings
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -137,19 +140,19 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel):
col.prop(group, "fluid_group", text="")
#col.label(text="Effector Group:")
- #col.prop(group, "eff_group", text="")
+ #col.prop(group, "effector_group", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Collision Group:")
- col.prop(group, "coll_group", text="")
+ col.prop(group, "collision_group", text="")
-class PHYSICS_PT_smoke_cache(PhysicButtonsPanel):
+class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Cache"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.smoke
return md and (md.smoke_type == 'DOMAIN')
@@ -160,53 +163,54 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel):
cache = md.point_cache_low
layout.label(text="Compression:")
- layout.prop(md, "smoke_cache_comp", expand=True)
+ layout.prop(md, "point_cache_compress_type", expand=True)
- point_cache_ui(self, context, cache, (cache.baked is False), 'SMOKE')
+ point_cache_ui(self, context, cache, (cache.is_baked is False), 'SMOKE')
-class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
+class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke High Resolution"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.smoke
return md and (md.smoke_type == 'DOMAIN')
def draw_header(self, context):
md = context.smoke.domain_settings
- self.layout.prop(md, "highres", text="")
+ self.layout.prop(md, "use_high_resolution", text="")
def draw(self, context):
layout = self.layout
md = context.smoke.domain_settings
- wide_ui = context.region.width > narrowui
- layout.active = md.highres
+ layout.active = md.use_high_resolution
split = layout.split()
col = split.column()
col.label(text="Resolution:")
col.prop(md, "amplify", text="Divisions")
- col.prop(md, "viewhighres")
+ col.prop(md, "smooth_emitter")
+ col.prop(md, "show_high_resolution")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Noise Method:")
col.row().prop(md, "noise_type", text="")
col.prop(md, "strength")
-class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel):
+class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke High Resolution Cache"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
md = context.smoke
- return md and (md.smoke_type == 'DOMAIN') and md.domain_settings.highres
+ return md and (md.smoke_type == 'DOMAIN') and md.domain_settings.use_high_resolution
def draw(self, context):
layout = self.layout
@@ -215,16 +219,17 @@ class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel):
cache = md.point_cache_high
layout.label(text="Compression:")
- layout.prop(md, "smoke_cache_high_comp", expand=True)
+ layout.prop(md, "point_cache_compress_high_type", expand=True)
- point_cache_ui(self, context, cache, (cache.baked is False), 'SMOKE')
+ point_cache_ui(self, context, cache, (cache.is_baked is False), 'SMOKE')
-class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel):
+class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Smoke Field Weights"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
smoke = context.smoke
return (smoke and smoke.smoke_type == 'DOMAIN')
@@ -233,25 +238,12 @@ class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel):
effector_weights_ui(self, context, domain.effector_weights)
-classes = [
- PHYSICS_PT_smoke,
- PHYSICS_PT_smoke_field_weights,
- PHYSICS_PT_smoke_cache,
- PHYSICS_PT_smoke_highres,
- PHYSICS_PT_smoke_groups,
- PHYSICS_PT_smoke_cache_highres]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_physics_softbody.py b/release/scripts/ui/properties_physics_softbody.py
index 60149cf533b..3722182caa1 100644
--- a/release/scripts/ui/properties_physics_softbody.py
+++ b/release/scripts/ui/properties_physics_softbody.py
@@ -19,23 +19,22 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
from properties_physics_common import point_cache_ui
from properties_physics_common import effector_weights_ui
def softbody_panel_enabled(md):
- return (md.point_cache.baked is False)
+ return (md.point_cache.is_baked is False)
-class PhysicButtonsPanel(bpy.types.Panel):
+class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.object
rd = context.scene.render
# return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
@@ -43,7 +42,7 @@ class PhysicButtonsPanel(bpy.types.Panel):
return (ob and (ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE')) and (not rd.use_game_engine)
-class PHYSICS_PT_softbody(PhysicButtonsPanel):
+class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body"
def draw(self, context):
@@ -51,7 +50,6 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel):
md = context.soft_body
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -61,13 +59,12 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel):
split.operator("object.modifier_remove", text="Remove")
row = split.row(align=True)
- row.prop(md, "render", text="")
- row.prop(md, "realtime", text="")
+ row.prop(md, "show_render", text="")
+ row.prop(md, "show_viewport", text="")
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'SOFT_BODY'
- if wide_ui:
- split.column()
+ split.column()
if md:
softbody = md.settings
@@ -82,17 +79,17 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel):
col.prop(softbody, "mass")
col.prop_object(softbody, "mass_vertex_group", ob, "vertex_groups", text="Mass:")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Simulation:")
col.prop(softbody, "speed")
-class PHYSICS_PT_softbody_cache(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Cache"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.soft_body
def draw(self, context):
@@ -100,11 +97,12 @@ class PHYSICS_PT_softbody_cache(PhysicButtonsPanel):
point_cache_ui(self, context, md.point_cache, softbody_panel_enabled(md), 'SOFTBODY')
-class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Goal"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.soft_body
def draw_header(self, context):
@@ -119,7 +117,6 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
md = context.soft_body
softbody = md.settings
ob = context.object
- wide_ui = context.region.width > narrowui
layout.active = softbody.use_goal and softbody_panel_enabled(md)
@@ -135,8 +132,7 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
sub.prop(softbody, "goal_min", text="Minimum")
sub.prop(softbody, "goal_max", text="Maximum")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Goal Settings:")
col.prop(softbody, "goal_spring", text="Stiffness")
col.prop(softbody, "goal_friction", text="Damping")
@@ -144,11 +140,12 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
layout.prop_object(softbody, "goal_vertex_group", ob, "vertex_groups", text="Vertex Group")
-class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Edges"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.soft_body
def draw_header(self, context):
@@ -163,7 +160,6 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
md = context.soft_body
softbody = md.settings
ob = context.object
- wide_ui = context.region.width > narrowui
layout.active = softbody.use_edges and softbody_panel_enabled(md)
@@ -173,17 +169,16 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
col.label(text="Springs:")
col.prop(softbody, "pull")
col.prop(softbody, "push")
- col.prop(softbody, "damp")
+ col.prop(softbody, "damping")
col.prop(softbody, "plastic")
- col.prop(softbody, "bending")
+ col.prop(softbody, "bend")
col.prop(softbody, "spring_length", text="Length")
col.prop_object(softbody, "spring_vertex_group", ob, "vertex_groups", text="Springs:")
- if wide_ui:
- col = split.column()
- col.prop(softbody, "stiff_quads")
+ col = split.column()
+ col.prop(softbody, "use_stiff_quads")
sub = col.column()
- sub.active = softbody.stiff_quads
+ sub.active = softbody.use_stiff_quads
sub.prop(softbody, "shear")
col.label(text="Aerodynamics:")
@@ -195,37 +190,34 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
col.label(text="Collision:")
- col.prop(softbody, "edge_collision", text="Edge")
- col.prop(softbody, "face_collision", text="Face")
+ col.prop(softbody, "use_edge_collision", text="Edge")
+ col.prop(softbody, "use_face_collision", text="Face")
-class PHYSICS_PT_softbody_collision(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Self Collision"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.soft_body
def draw_header(self, context):
softbody = context.soft_body.settings
self.layout.active = softbody_panel_enabled(context.soft_body)
- self.layout.prop(softbody, "self_collision", text="")
+ self.layout.prop(softbody, "use_self_collision", text="")
def draw(self, context):
layout = self.layout
md = context.soft_body
softbody = md.settings
- wide_ui = context.region.width > narrowui
- layout.active = softbody.self_collision and softbody_panel_enabled(md)
+ layout.active = softbody.use_self_collision and softbody_panel_enabled(md)
layout.label(text="Collision Ball Size Calculation:")
- if wide_ui:
- layout.prop(softbody, "collision_type", expand=True)
- else:
- layout.prop(softbody, "collision_type", text="")
+ layout.prop(softbody, "collision_type", expand=True)
col = layout.column(align=True)
col.label(text="Ball:")
@@ -234,11 +226,12 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel):
col.prop(softbody, "ball_damp", text="Dampening")
-class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Solver"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.soft_body
def draw(self, context):
@@ -246,7 +239,6 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
md = context.soft_body
softbody = md.settings
- wide_ui = context.region.width > narrowui
layout.active = softbody_panel_enabled(md)
@@ -255,27 +247,27 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
col = split.column(align=True)
col.label(text="Step Size:")
- col.prop(softbody, "minstep")
- col.prop(softbody, "maxstep")
- col.prop(softbody, "auto_step", text="Auto-Step")
+ col.prop(softbody, "step_min")
+ col.prop(softbody, "step_max")
+ col.prop(softbody, "use_auto_step", text="Auto-Step")
- if wide_ui:
- col = split.column()
- col.prop(softbody, "error_limit")
+ col = split.column()
+ col.prop(softbody, "error_threshold")
col.label(text="Helpers:")
col.prop(softbody, "choke")
col.prop(softbody, "fuzzy")
layout.label(text="Diagnostics:")
- layout.prop(softbody, "diagnose")
- layout.prop(softbody, "estimate_matrix")
+ layout.prop(softbody, "use_diagnose")
+ layout.prop(softbody, "use_estimate_matrix")
-class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel):
+class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, bpy.types.Panel):
bl_label = "Soft Body Field Weights"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.soft_body)
def draw(self, context):
@@ -285,26 +277,12 @@ class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel):
effector_weights_ui(self, context, softbody.effector_weights)
-classes = [
- PHYSICS_PT_softbody,
- PHYSICS_PT_softbody_cache,
- PHYSICS_PT_softbody_goal,
- PHYSICS_PT_softbody_edge,
- PHYSICS_PT_softbody_collision,
- PHYSICS_PT_softbody_solver,
- PHYSICS_PT_softbody_field_weights]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py
index 829416b86d3..2072aa00b76 100644
--- a/release/scripts/ui/properties_render.py
+++ b/release/scripts/ui/properties_render.py
@@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
class RENDER_MT_presets(bpy.types.Menu):
bl_label = "Render Presets"
@@ -36,18 +34,19 @@ class RENDER_MT_ffmpeg_presets(bpy.types.Menu):
draw = bpy.types.Menu.draw_preset
-class RenderButtonsPanel(bpy.types.Panel):
+class RenderButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "render"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
- return (context.scene and rd.use_game_engine is False) and (rd.engine in self.COMPAT_ENGINES)
+ return (context.scene and rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES)
-class RENDER_PT_render(RenderButtonsPanel):
+class RENDER_PT_render(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Render"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -55,21 +54,19 @@ class RENDER_PT_render(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.operator("render.render", text="Image", icon='RENDER_STILL')
- if wide_ui:
- col = split.column()
+ col = split.column()
col.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
layout.prop(rd, "display_mode", text="Display")
-class RENDER_PT_layers(RenderButtonsPanel):
+class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Layers"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -79,7 +76,6 @@ class RENDER_PT_layers(RenderButtonsPanel):
scene = context.scene
rd = scene.render
- wide_ui = context.region.width > narrowui
row = layout.row()
row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
@@ -100,11 +96,11 @@ class RENDER_PT_layers(RenderButtonsPanel):
col.label(text="")
col.prop(rl, "light_override", text="Light")
col.prop(rl, "material_override", text="Material")
- if wide_ui:
- col = split.column()
- col.prop(rl, "visible_layers", text="Layer")
+
+ col = split.column()
+ col.prop(rl, "layers", text="Layer")
col.label(text="Mask Layers:")
- col.prop(rl, "zmask_layers", text="")
+ col.prop(rl, "layers_zmask", text="")
layout.separator()
@@ -113,21 +109,21 @@ class RENDER_PT_layers(RenderButtonsPanel):
split = layout.split()
col = split.column()
- col.prop(rl, "zmask")
+ col.prop(rl, "use_zmask")
row = col.row()
- row.prop(rl, "zmask_negate", text="Negate")
- row.active = rl.zmask
- col.prop(rl, "all_z")
+ row.prop(rl, "invert_zmask", text="Negate")
+ row.active = rl.use_zmask
+ col.prop(rl, "use_all_z")
col = split.column()
- col.prop(rl, "solid")
- col.prop(rl, "halo")
- col.prop(rl, "ztransp")
+ col.prop(rl, "use_solid")
+ col.prop(rl, "use_halo")
+ col.prop(rl, "use_ztransp")
col = split.column()
- col.prop(rl, "sky")
- col.prop(rl, "edge")
- col.prop(rl, "strand")
+ col.prop(rl, "use_sky")
+ col.prop(rl, "use_edge_enhance")
+ col.prop(rl, "use_strand")
layout.separator()
@@ -135,46 +131,45 @@ class RENDER_PT_layers(RenderButtonsPanel):
col = split.column()
col.label(text="Passes:")
- col.prop(rl, "pass_combined")
- col.prop(rl, "pass_z")
- col.prop(rl, "pass_vector")
- col.prop(rl, "pass_normal")
- col.prop(rl, "pass_uv")
- col.prop(rl, "pass_mist")
- col.prop(rl, "pass_object_index")
- col.prop(rl, "pass_color")
-
- if wide_ui:
- col = split.column()
+ col.prop(rl, "use_pass_combined")
+ col.prop(rl, "use_pass_z")
+ col.prop(rl, "use_pass_vector")
+ col.prop(rl, "use_pass_normal")
+ col.prop(rl, "use_pass_uv")
+ col.prop(rl, "use_pass_mist")
+ col.prop(rl, "use_pass_object_index")
+ col.prop(rl, "use_pass_color")
+
+ col = split.column()
col.label()
- col.prop(rl, "pass_diffuse")
+ col.prop(rl, "use_pass_diffuse")
row = col.row()
- row.prop(rl, "pass_specular")
- row.prop(rl, "pass_specular_exclude", text="")
+ row.prop(rl, "use_pass_specular")
+ row.prop(rl, "exclude_specular", text="")
row = col.row()
- row.prop(rl, "pass_shadow")
- row.prop(rl, "pass_shadow_exclude", text="")
+ row.prop(rl, "use_pass_shadow")
+ row.prop(rl, "exclude_shadow", text="")
row = col.row()
- row.prop(rl, "pass_emit")
- row.prop(rl, "pass_emit_exclude", text="")
+ row.prop(rl, "use_pass_emit")
+ row.prop(rl, "exclude_emit", text="")
row = col.row()
- row.prop(rl, "pass_ao")
- row.prop(rl, "pass_ao_exclude", text="")
+ row.prop(rl, "use_pass_ambient_occlusion")
+ row.prop(rl, "exclude_ambient_occlusion", text="")
row = col.row()
- row.prop(rl, "pass_environment")
- row.prop(rl, "pass_environment_exclude", text="")
+ row.prop(rl, "use_pass_environment")
+ row.prop(rl, "exclude_environment", text="")
row = col.row()
- row.prop(rl, "pass_indirect")
- row.prop(rl, "pass_indirect_exclude", text="")
+ row.prop(rl, "use_pass_indirect")
+ row.prop(rl, "exclude_indirect", text="")
row = col.row()
- row.prop(rl, "pass_reflection")
- row.prop(rl, "pass_reflection_exclude", text="")
+ row.prop(rl, "use_pass_reflection")
+ row.prop(rl, "exclude_reflection", text="")
row = col.row()
- row.prop(rl, "pass_refraction")
- row.prop(rl, "pass_refraction_exclude", text="")
+ row.prop(rl, "use_pass_refraction")
+ row.prop(rl, "exclude_refraction", text="")
-class RENDER_PT_shading(RenderButtonsPanel):
+class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Shading"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -182,7 +177,6 @@ class RENDER_PT_shading(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -192,14 +186,13 @@ class RENDER_PT_shading(RenderButtonsPanel):
col.prop(rd, "use_sss", text="Subsurface Scattering")
col.prop(rd, "use_envmaps", text="Environment Map")
- if wide_ui:
- col = split.column()
- col.prop(rd, "use_raytracing", text="Ray Tracing")
- col.prop(rd, "color_management")
+ col = split.column()
+ col.prop(rd, "use_raytrace", text="Ray Tracing")
+ col.prop(rd, "use_color_management")
col.prop(rd, "alpha_mode", text="Alpha")
-class RENDER_PT_performance(RenderButtonsPanel):
+class RENDER_PT_performance(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Performance"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -208,7 +201,6 @@ class RENDER_PT_performance(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -223,27 +215,26 @@ class RENDER_PT_performance(RenderButtonsPanel):
sub.prop(rd, "parts_x", text="X")
sub.prop(rd, "parts_y", text="Y")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Memory:")
sub = col.column()
- sub.enabled = not (rd.use_border or rd.full_sample)
- sub.prop(rd, "save_buffers")
+ sub.enabled = not (rd.use_border or rd.use_full_sample)
+ sub.prop(rd, "use_save_buffers")
sub = col.column()
sub.active = rd.use_compositing
- sub.prop(rd, "free_image_textures")
+ sub.prop(rd, "use_free_image_textures")
sub = col.column()
- sub.active = rd.use_raytracing
+ sub.active = rd.use_raytrace
sub.label(text="Acceleration structure:")
- sub.prop(rd, "raytrace_structure", text="")
- if rd.raytrace_structure == 'OCTREE':
+ sub.prop(rd, "raytrace_method", text="")
+ if rd.raytrace_method == 'OCTREE':
sub.prop(rd, "octree_resolution", text="Resolution")
else:
sub.prop(rd, "use_instances", text="Instances")
sub.prop(rd, "use_local_coords", text="Local Coordinates")
-class RENDER_PT_post_processing(RenderButtonsPanel):
+class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Post Processing"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -252,7 +243,6 @@ class RENDER_PT_post_processing(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -260,8 +250,7 @@ class RENDER_PT_post_processing(RenderButtonsPanel):
col.prop(rd, "use_compositing")
col.prop(rd, "use_sequencer")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "dither_intensity", text="Dither", slider=True)
layout.separator()
@@ -269,25 +258,22 @@ class RENDER_PT_post_processing(RenderButtonsPanel):
split = layout.split()
col = split.column()
- col.prop(rd, "fields", text="Fields")
+ col.prop(rd, "use_fields", text="Fields")
sub = col.column()
- sub.active = rd.fields
+ sub.active = rd.use_fields
sub.row().prop(rd, "field_order", expand=True)
- sub.prop(rd, "fields_still", text="Still")
+ sub.prop(rd, "use_fields_still", text="Still")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
- col.prop(rd, "edge")
+ col = split.column()
+ col.prop(rd, "use_edge_enhance")
sub = col.column()
- sub.active = rd.edge
+ sub.active = rd.use_edge_enhance
sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
sub.prop(rd, "edge_color", text="")
-class RENDER_PT_output(RenderButtonsPanel):
+class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Output"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -295,83 +281,81 @@ class RENDER_PT_output(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
+ file_format = rd.file_format
- layout.prop(rd, "output_path", text="")
+ layout.prop(rd, "filepath", text="")
split = layout.split()
col = split.column()
col.prop(rd, "file_format", text="")
col.row().prop(rd, "color_mode", text="Color", expand=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "use_file_extension")
col.prop(rd, "use_overwrite")
col.prop(rd, "use_placeholder")
- if rd.file_format in ('AVI_JPEG', 'JPEG'):
+ if file_format in ('AVI_JPEG', 'JPEG'):
split = layout.split()
split.prop(rd, "file_quality", slider=True)
+
+ if file_format == 'PNG':
+ split = layout.split()
+ split.prop(rd, "file_quality", slider=True, text="Compression")
- elif rd.file_format == 'MULTILAYER':
+ elif file_format == 'MULTILAYER':
split = layout.split()
col = split.column()
col.label(text="Codec:")
col.prop(rd, "exr_codec", text="")
- if wide_ui:
- col = split.column()
+ col = split.column()
- elif rd.file_format == 'OPEN_EXR':
+ elif file_format == 'OPEN_EXR':
split = layout.split()
col = split.column()
col.label(text="Codec:")
col.prop(rd, "exr_codec", text="")
- if wide_ui:
- subsplit = split.split()
- col = subsplit.column()
- col.prop(rd, "exr_half")
+ subsplit = split.split()
+ col = subsplit.column()
+ col.prop(rd, "use_exr_half")
col.prop(rd, "exr_zbuf")
- if wide_ui:
- col = subsplit.column()
+ col = subsplit.column()
col.prop(rd, "exr_preview")
- elif rd.file_format == 'JPEG2000':
+ elif file_format == 'JPEG2000':
split = layout.split()
col = split.column()
col.label(text="Depth:")
col.row().prop(rd, "jpeg2k_depth", expand=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "jpeg2k_preset", text="")
col.prop(rd, "jpeg2k_ycc")
- elif rd.file_format in ('CINEON', 'DPX'):
+ elif file_format in ('CINEON', 'DPX'):
split = layout.split()
col = split.column()
- col.prop(rd, "cineon_log", text="Convert to Log")
+ col.prop(rd, "use_cineon_log", text="Convert to Log")
- if wide_ui:
- col = split.column(align=True)
- col.active = rd.cineon_log
+ col = split.column(align=True)
+ col.active = rd.use_cineon_log
col.prop(rd, "cineon_black", text="Black")
col.prop(rd, "cineon_white", text="White")
col.prop(rd, "cineon_gamma", text="Gamma")
- elif rd.file_format == 'TIFF':
+ elif file_format == 'TIFF':
split = layout.split()
- split.prop(rd, "tiff_bit")
+ split.prop(rd, "use_tiff_16bit")
- elif rd.file_format == 'QUICKTIME_CARBON':
+ elif file_format == 'QUICKTIME_CARBON':
split = layout.split()
split.operator("scene.render_data_set_quicktime_codec")
- elif rd.file_format == 'QUICKTIME_QTKIT':
+ elif file_format == 'QUICKTIME_QTKIT':
split = layout.split()
col = split.column()
col.prop(rd, "quicktime_codec_type", text="Video Codec")
@@ -384,30 +368,32 @@ class RENDER_PT_output(RenderButtonsPanel):
col = split.column()
if rd.quicktime_audiocodec_type == 'LPCM':
col.prop(rd, "quicktime_audio_bitdepth", text="")
- if wide_ui:
- col = split.column()
+
+ col = split.column()
col.prop(rd, "quicktime_audio_samplerate", text="")
split = layout.split()
col = split.column()
if rd.quicktime_audiocodec_type == 'AAC':
col.prop(rd, "quicktime_audio_bitrate")
- if wide_ui:
- subsplit = split.split()
- col = subsplit.column()
+
+ subsplit = split.split()
+ col = subsplit.column()
+
if rd.quicktime_audiocodec_type == 'AAC':
col.prop(rd, "quicktime_audio_codec_isvbr")
- if wide_ui:
- col = subsplit.column()
+
+ col = subsplit.column()
col.prop(rd, "quicktime_audio_resampling_hq")
-class RENDER_PT_encoding(RenderButtonsPanel):
+class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Encoding"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
@@ -415,7 +401,6 @@ class RENDER_PT_encoding(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
@@ -424,19 +409,17 @@ class RENDER_PT_encoding(RenderButtonsPanel):
col = split.column()
col.prop(rd, "ffmpeg_format")
if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "ffmpeg_codec")
else:
- if wide_ui:
- split.label()
+ split.label()
split = layout.split()
col = split.column()
col.prop(rd, "ffmpeg_video_bitrate")
- if wide_ui:
- col = split.column()
+
+ col = split.column()
col.prop(rd, "ffmpeg_gopsize")
split = layout.split()
@@ -447,8 +430,7 @@ class RENDER_PT_encoding(RenderButtonsPanel):
col.prop(rd, "ffmpeg_maxrate", text="Maximum")
col.prop(rd, "ffmpeg_buffersize", text="Buffer")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "ffmpeg_autosplit")
col.label(text="Mux:")
@@ -458,7 +440,7 @@ class RENDER_PT_encoding(RenderButtonsPanel):
# Audio:
sub = layout.column()
- if rd.ffmpeg_format not in ('MP3'):
+ if rd.ffmpeg_format not in ('MP3', ):
sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
sub.separator()
@@ -469,26 +451,24 @@ class RENDER_PT_encoding(RenderButtonsPanel):
col.prop(rd, "ffmpeg_audio_bitrate")
col.prop(rd, "ffmpeg_audio_mixrate")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "ffmpeg_audio_volume", slider=True)
-class RENDER_PT_antialiasing(RenderButtonsPanel):
+class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Anti-Aliasing"
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
rd = context.scene.render
- self.layout.prop(rd, "render_antialiasing", text="")
+ self.layout.prop(rd, "use_antialiasing", text="")
def draw(self, context):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
- layout.active = rd.render_antialiasing
+ layout.active = rd.use_antialiasing
split = layout.split()
@@ -496,15 +476,14 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
col.row().prop(rd, "antialiasing_samples", expand=True)
sub = col.row()
sub.enabled = not rd.use_border
- sub.prop(rd, "full_sample")
+ sub.prop(rd, "use_full_sample")
- if wide_ui:
- col = split.column()
- col.prop(rd, "pixel_filter", text="")
+ col = split.column()
+ col.prop(rd, "pixel_filter_type", text="")
col.prop(rd, "filter_size", text="Size")
-class RENDER_PT_motion_blur(RenderButtonsPanel):
+class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Full Sample Motion Blur"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -512,20 +491,19 @@ class RENDER_PT_motion_blur(RenderButtonsPanel):
def draw_header(self, context):
rd = context.scene.render
- self.layout.prop(rd, "motion_blur", text="")
+ self.layout.prop(rd, "use_motion_blur", text="")
def draw(self, context):
layout = self.layout
rd = context.scene.render
- layout.active = rd.motion_blur
+ layout.active = rd.use_motion_blur
row = layout.row()
row.prop(rd, "motion_blur_samples")
row.prop(rd, "motion_blur_shutter")
-
-class RENDER_PT_dimensions(RenderButtonsPanel):
+class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Dimensions"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -534,7 +512,6 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
scene = context.scene
rd = scene.render
- wide_ui = context.region.width > narrowui
row = layout.row(align=True)
row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
@@ -557,10 +534,9 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
row.prop(rd, "use_border", text="Border")
sub = row.row()
sub.active = rd.use_border
- sub.prop(rd, "crop_to_border", text="Crop")
+ sub.prop(rd, "use_crop_to_border", text="Crop")
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column(align=True)
sub.label(text="Frame Range:")
sub.prop(scene, "frame_start", text="Start")
@@ -572,7 +548,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
sub.prop(rd, "fps_base", text="/")
-class RENDER_PT_stamp(RenderButtonsPanel):
+class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Stamp"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -580,45 +556,43 @@ class RENDER_PT_stamp(RenderButtonsPanel):
def draw_header(self, context):
rd = context.scene.render
- self.layout.prop(rd, "render_stamp", text="")
+ self.layout.prop(rd, "use_stamp", text="")
def draw(self, context):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
- layout.active = rd.render_stamp
+ layout.active = rd.use_stamp
split = layout.split()
col = split.column()
- col.prop(rd, "stamp_time", text="Time")
- col.prop(rd, "stamp_date", text="Date")
- col.prop(rd, "stamp_render_time", text="RenderTime")
- col.prop(rd, "stamp_frame", text="Frame")
- col.prop(rd, "stamp_scene", text="Scene")
- col.prop(rd, "stamp_camera", text="Camera")
- col.prop(rd, "stamp_filename", text="Filename")
- col.prop(rd, "stamp_marker", text="Marker")
- col.prop(rd, "stamp_sequencer_strip", text="Seq. Strip")
+ col.prop(rd, "use_stamp_time", text="Time")
+ col.prop(rd, "use_stamp_date", text="Date")
+ col.prop(rd, "use_stamp_render_time", text="RenderTime")
+ col.prop(rd, "use_stamp_frame", text="Frame")
+ col.prop(rd, "use_stamp_scene", text="Scene")
+ col.prop(rd, "use_stamp_camera", text="Camera")
+ col.prop(rd, "use_stamp_filename", text="Filename")
+ col.prop(rd, "use_stamp_marker", text="Marker")
+ col.prop(rd, "use_stamp_sequencer_strip", text="Seq. Strip")
- if wide_ui:
- col = split.column()
- col.active = rd.render_stamp
+ col = split.column()
+ col.active = rd.use_stamp
col.prop(rd, "stamp_foreground", slider=True)
col.prop(rd, "stamp_background", slider=True)
col.separator()
col.prop(rd, "stamp_font_size", text="Font Size")
row = layout.split(percentage=0.2)
- row.prop(rd, "stamp_note", text="Note")
+ row.prop(rd, "use_stamp_note", text="Note")
sub = row.row()
- sub.active = rd.stamp_note
+ sub.active = rd.use_stamp_note
sub.prop(rd, "stamp_note_text", text="")
-class RENDER_PT_bake(RenderButtonsPanel):
+class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Bake"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -627,71 +601,42 @@ class RENDER_PT_bake(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render
- wide_ui = context.region.width > narrowui
layout.operator("object.bake_image", icon='RENDER_STILL')
- if wide_ui:
- layout.prop(rd, "bake_type")
- else:
- layout.prop(rd, "bake_type", text="")
+ layout.prop(rd, "bake_type")
if rd.bake_type == 'NORMALS':
- if wide_ui:
- layout.prop(rd, "bake_normal_space")
- else:
- layout.prop(rd, "bake_normal_space", text="")
+ layout.prop(rd, "bake_normal_space")
elif rd.bake_type in ('DISPLACEMENT', 'AO'):
- layout.prop(rd, "bake_normalized")
+ layout.prop(rd, "use_bake_normalize")
# col.prop(rd, "bake_aa_mode")
- # col.prop(rd, "bake_enable_aa")
+ # col.prop(rd, "use_bake_antialiasing")
layout.separator()
split = layout.split()
col = split.column()
- col.prop(rd, "bake_clear")
+ col.prop(rd, "use_bake_clear")
col.prop(rd, "bake_margin")
col.prop(rd, "bake_quad_split", text="Split")
- if wide_ui:
- col = split.column()
- col.prop(rd, "bake_active")
+ col = split.column()
+ col.prop(rd, "use_bake_selected_to_active")
sub = col.column()
- sub.active = rd.bake_active
+ sub.active = rd.use_bake_selected_to_active
sub.prop(rd, "bake_distance")
sub.prop(rd, "bake_bias")
-classes = [
- RENDER_MT_presets,
- RENDER_MT_ffmpeg_presets,
- RENDER_PT_render,
- RENDER_PT_layers,
- RENDER_PT_dimensions,
- RENDER_PT_antialiasing,
- RENDER_PT_motion_blur,
- RENDER_PT_shading,
- RENDER_PT_output,
- RENDER_PT_encoding,
- RENDER_PT_performance,
- RENDER_PT_post_processing,
- RENDER_PT_stamp,
- RENDER_PT_bake]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py
index 06ad1eda835..c6b9d7522e0 100644
--- a/release/scripts/ui/properties_scene.py
+++ b/release/scripts/ui/properties_scene.py
@@ -20,46 +20,35 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
-class SceneButtonsPanel(bpy.types.Panel):
+class SceneButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.scene
-class SCENE_PT_scene(SceneButtonsPanel):
+class SCENE_PT_scene(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Scene"
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
scene = context.scene
- if wide_ui:
- layout.prop(scene, "camera")
- layout.prop(scene, "set", text="Background")
- else:
- layout.prop(scene, "camera", text="")
- layout.prop(scene, "set", text="")
-
-
-class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel):
- _context_path = "scene"
+ layout.prop(scene, "camera")
+ layout.prop(scene, "background_set", text="Background")
-class SCENE_PT_unit(SceneButtonsPanel):
+class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Units"
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
unit = context.scene.unit_settings
col = layout.column()
@@ -71,21 +60,19 @@ class SCENE_PT_unit(SceneButtonsPanel):
col = split.column()
col.prop(unit, "scale_length", text="Scale")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(unit, "use_separate")
layout.column().prop(unit, "rotation_units")
-class SCENE_PT_keying_sets(SceneButtonsPanel):
+class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Keying Sets"
def draw(self, context):
layout = self.layout
scene = context.scene
- wide_ui = context.region.width > narrowui
row = layout.row()
col = row.column()
@@ -96,7 +83,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
col.operator("anim.keying_set_remove", icon='ZOOMOUT', text="")
ks = scene.active_keying_set
- if ks and ks.absolute:
+ if ks and ks.is_path_absolute:
row = layout.row()
col = row.column()
@@ -107,26 +94,25 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
op = subcol.operator("anim.keying_set_export", text="Export to File")
op.filepath = "keyingset.py"
- if wide_ui:
- col = row.column()
+ col = row.column()
col.label(text="Keyframing Settings:")
- col.prop(ks, "insertkey_needed", text="Needed")
- col.prop(ks, "insertkey_visual", text="Visual")
- col.prop(ks, "insertkey_xyz_to_rgb", text="XYZ to RGB")
+ col.prop(ks, "use_insertkey_needed", text="Needed")
+ col.prop(ks, "use_insertkey_visual", text="Visual")
+ col.prop(ks, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
-class SCENE_PT_keying_set_paths(SceneButtonsPanel):
+class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Active Keying Set"
- def poll(self, context):
- return (context.scene.active_keying_set and context.scene.active_keying_set.absolute)
+ @classmethod
+ def poll(cls, context):
+ return (context.scene.active_keying_set and context.scene.active_keying_set.is_path_absolute)
def draw(self, context):
layout = self.layout
scene = context.scene
ks = scene.active_keying_set
- wide_ui = context.region.width > narrowui
row = layout.row()
row.label(text="Paths:")
@@ -152,24 +138,23 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
col = row.column()
col.label(text="Array Target:")
- col.prop(ksp, "entire_array")
- if ksp.entire_array is False:
+ col.prop(ksp, "use_entire_array")
+ if ksp.use_entire_array is False:
col.prop(ksp, "array_index")
- if wide_ui:
- col = row.column()
+ col = row.column()
col.label(text="F-Curve Grouping:")
- col.prop(ksp, "grouping")
- if ksp.grouping == 'NAMED':
+ col.prop(ksp, "group_method")
+ if ksp.group_method == 'NAMED':
col.prop(ksp, "group")
col.label(text="Keyframing Settings:")
- col.prop(ksp, "insertkey_needed", text="Needed")
- col.prop(ksp, "insertkey_visual", text="Visual")
- col.prop(ksp, "insertkey_xyz_to_rgb", text="XYZ to RGB")
+ col.prop(ksp, "use_insertkey_needed", text="Needed")
+ col.prop(ksp, "use_insertkey_visual", text="Visual")
+ col.prop(ksp, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
-class SCENE_PT_physics(SceneButtonsPanel):
+class SCENE_PT_physics(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Gravity"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -180,17 +165,13 @@ class SCENE_PT_physics(SceneButtonsPanel):
layout = self.layout
scene = context.scene
- wide_ui = context.region.width > narrowui
layout.active = scene.use_gravity
- if wide_ui:
- layout.prop(scene, "gravity", text="")
- else:
- layout.column().prop(scene, "gravity", text="")
+ layout.prop(scene, "gravity", text="")
-class SCENE_PT_simplify(SceneButtonsPanel):
+class SCENE_PT_simplify(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Simplify"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -203,7 +184,6 @@ class SCENE_PT_simplify(SceneButtonsPanel):
layout = self.layout
scene = context.scene
rd = scene.render
- wide_ui = context.region.width > narrowui
layout.active = rd.use_simplify
@@ -213,14 +193,18 @@ class SCENE_PT_simplify(SceneButtonsPanel):
col.prop(rd, "simplify_subdivision", text="Subdivision")
col.prop(rd, "simplify_child_particles", text="Child Particles")
- col.prop(rd, "simplify_triangulate")
+ col.prop(rd, "use_simplify_triangulate")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(rd, "simplify_shadow_samples", text="Shadow Samples")
col.prop(rd, "simplify_ao_sss", text="AO and SSS")
+class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "scene"
+
+
from bpy.props import *
@@ -255,13 +239,13 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
f.write("# Keying Set Level declarations\n")
f.write("ks= scene.add_keying_set(name=\"%s\")\n" % ks.name)
- if ks.absolute is False:
- f.write("ks.absolute = False\n")
+ if not ks.is_path_absolute:
+ f.write("ks.is_path_absolute = False\n")
f.write("\n")
- f.write("ks.insertkey_needed = %s\n" % ks.insertkey_needed)
- f.write("ks.insertkey_visual = %s\n" % ks.insertkey_visual)
- f.write("ks.insertkey_xyz_to_rgb = %s\n" % ks.insertkey_xyz_to_rgb)
+ f.write("ks.use_insertkey_needed = %s\n" % ks.use_insertkey_needed)
+ f.write("ks.use_insertkey_visual = %s\n" % ks.use_insertkey_visual)
+ f.write("ks.use_insertkey_xyz_to_rgb = %s\n" % ks.use_insertkey_xyz_to_rgb)
f.write("\n")
@@ -308,17 +292,17 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
f.write("%s, '%s'" % (id_bpy_path, ksp.data_path))
# array index settings (if applicable)
- if ksp.entire_array:
+ if ksp.use_entire_array:
f.write(", index=-1")
else:
f.write(", index=%d" % ksp.array_index)
# grouping settings (if applicable)
# NOTE: the current default is KEYINGSET, but if this changes, change this code too
- if ksp.grouping == 'NAMED':
- f.write(", grouping_method='%s', group_name=\"%s\"" % (ksp.grouping, ksp.group))
- elif ksp.grouping != 'KEYINGSET':
- f.write(", grouping_method='%s'" % ksp.grouping)
+ if ksp.group_method == 'NAMED':
+ f.write(", group_method='%s', group_name=\"%s\"" % (ksp.group_method, ksp.group))
+ elif ksp.group_method != 'KEYINGSET':
+ f.write(", group_method='%s'" % ksp.group_method)
# finish off
f.write(")\n")
@@ -334,29 +318,12 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
return {'RUNNING_MODAL'}
-classes = [
- SCENE_PT_scene,
- SCENE_PT_unit,
- SCENE_PT_keying_sets,
- SCENE_PT_keying_set_paths,
- SCENE_PT_physics,
- SCENE_PT_simplify,
-
- SCENE_PT_custom_props,
-
- ANIM_OT_keying_set_export]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py
index 2bfbe188c9e..5163ae884ed 100644
--- a/release/scripts/ui/properties_texture.py
+++ b/release/scripts/ui/properties_texture.py
@@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
-
class TEXTURE_MT_specials(bpy.types.Menu):
bl_label = "Texture Specials"
@@ -65,47 +63,29 @@ def context_tex_datablock(context):
return idblock
-class TextureButtonsPanel(bpy.types.Panel):
+class TextureButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "texture"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
tex = context.texture
- if not tex:
- return False
- engine = context.scene.render.engine
- return (tex.type != 'NONE' or tex.use_nodes) and (engine in self.COMPAT_ENGINES)
-
+ return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in cls.COMPAT_ENGINES)
-class TEXTURE_PT_preview(TextureButtonsPanel):
- bl_label = "Preview"
- COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def draw(self, context):
- layout = self.layout
-
- tex = context.texture
- slot = getattr(context, "texture_slot", None)
- idblock = context_tex_datablock(context)
-
- if idblock:
- layout.template_preview(tex, parent=idblock, slot=slot)
- else:
- layout.template_preview(tex, slot=slot)
-
-
-class TEXTURE_PT_context_texture(TextureButtonsPanel):
+class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
engine = context.scene.render.engine
if not hasattr(context, "texture_slot"):
return False
return ((context.material or context.world or context.lamp or context.brush or context.texture)
- and (engine in self.COMPAT_ENGINES))
+ and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@@ -113,7 +93,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
node = context.texture_node
space = context.space_data
tex = context.texture
- wide_ui = context.region.width > narrowui
idblock = context_tex_datablock(context)
tex_collection = space.pin_id == None and type(idblock) != bpy.types.Brush and not node
@@ -127,11 +106,8 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")
- if wide_ui:
- split = layout.split(percentage=0.65)
- col = split.column()
- else:
- col = layout.column()
+ split = layout.split(percentage=0.65)
+ col = split.column()
if tex_collection:
col.template_ID(idblock, "active_texture", new="texture.new")
@@ -143,11 +119,10 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
if space.pin_id:
col.template_ID(space, "pin_id")
- if wide_ui:
- col = split.column()
+ col = split.column()
if not space.pin_id:
- col.prop(space, "brush_texture", text="Brush", toggle=True)
+ col.prop(space, "show_brush_texture", text="Brush", toggle=True)
if tex:
split = layout.split(percentage=0.2)
@@ -159,23 +134,28 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
split.prop(slot, "output_node", text="")
else:
- if wide_ui:
- split.label(text="Type:")
- split.prop(tex, "type", text="")
- else:
- layout.prop(tex, "type", text="")
+ split.label(text="Type:")
+ split.prop(tex, "type", text="")
-class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel):
- _context_path = "texture"
+class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel):
+ bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context): # use alternate poll since NONE texture type is ok
- engine = context.scene.render.engine
- return context.texture and (engine in self.COMPAT_ENGINES)
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+ slot = getattr(context, "texture_slot", None)
+ idblock = context_tex_datablock(context)
+
+ if idblock:
+ layout.template_preview(tex, parent=idblock, slot=slot)
+ else:
+ layout.template_preview(tex, slot=slot)
-class TEXTURE_PT_colors(TextureButtonsPanel):
+class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Colors"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -184,7 +164,6 @@ class TEXTURE_PT_colors(TextureButtonsPanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
layout.prop(tex, "use_color_ramp", text="Ramp")
if tex.use_color_ramp:
@@ -199,10 +178,9 @@ class TEXTURE_PT_colors(TextureButtonsPanel):
sub.prop(tex, "factor_green", text="G")
sub.prop(tex, "factor_blue", text="B")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Adjust:")
- col.prop(tex, "brightness")
+ col.prop(tex, "intensity")
col.prop(tex, "contrast")
col.prop(tex, "saturation")
@@ -212,19 +190,21 @@ class TEXTURE_PT_colors(TextureButtonsPanel):
class TextureSlotPanel(TextureButtonsPanel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
if not hasattr(context, "texture_slot"):
return False
engine = context.scene.render.engine
- return TextureButtonsPanel.poll(self, context) and (engine in self.COMPAT_ENGINES)
+ return TextureButtonsPanel.poll(self, context) and (engine in cls.COMPAT_ENGINES)
-class TEXTURE_PT_mapping(TextureSlotPanel):
+class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
bl_label = "Mapping"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
idblock = context_tex_datablock(context)
if type(idblock) == bpy.types.Brush and not context.sculpt_object:
return False
@@ -233,7 +213,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
return False
engine = context.scene.render.engine
- return (engine in self.COMPAT_ENGINES)
+ return (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -242,16 +222,15 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
tex = context.texture_slot
# textype = context.texture
- wide_ui = context.region.width > narrowui
if type(idblock) != bpy.types.Brush:
split = layout.split(percentage=0.3)
col = split.column()
col.label(text="Coordinates:")
col = split.column()
- col.prop(tex, "texture_coordinates", text="")
+ col.prop(tex, "texture_coords", text="")
- if tex.texture_coordinates == 'ORCO':
+ if tex.texture_coords == 'ORCO':
"""
ob = context.object
if ob and ob.type == 'MESH':
@@ -259,7 +238,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
split.label(text="Mesh:")
split.prop(ob.data, "texco_mesh", text="")
"""
- elif tex.texture_coordinates == 'UV':
+ elif tex.texture_coords == 'UV':
split = layout.split(percentage=0.3)
split.label(text="Layer:")
ob = context.object
@@ -268,7 +247,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
else:
split.prop(tex, "uv_layer", text="")
- elif tex.texture_coordinates == 'OBJECT':
+ elif tex.texture_coords == 'OBJECT':
split = layout.split(percentage=0.3)
split.label(text="Object:")
split.prop(tex, "object", text="")
@@ -290,38 +269,35 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
split = layout.split()
col = split.column()
- if tex.texture_coordinates in ('ORCO', 'UV'):
- col.prop(tex, "from_dupli")
- elif tex.texture_coordinates == 'OBJECT':
- col.prop(tex, "from_original")
- elif wide_ui:
+ if tex.texture_coords in ('ORCO', 'UV'):
+ col.prop(tex, "use_from_dupli")
+ elif tex.texture_coords == 'OBJECT':
+ col.prop(tex, "use_from_original")
+ else:
col.label()
- if wide_ui:
- col = split.column()
+ col = split.column()
row = col.row()
- row.prop(tex, "x_mapping", text="")
- row.prop(tex, "y_mapping", text="")
- row.prop(tex, "z_mapping", text="")
+ row.prop(tex, "mapping_x", text="")
+ row.prop(tex, "mapping_y", text="")
+ row.prop(tex, "mapping_z", text="")
split = layout.split()
col = split.column()
col.prop(tex, "offset")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
- col.prop(tex, "size")
+ col.prop(tex, "scale")
-class TEXTURE_PT_influence(TextureSlotPanel):
+class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
bl_label = "Influence"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
idblock = context_tex_datablock(context)
if type(idblock) == bpy.types.Brush:
return False
@@ -330,7 +306,7 @@ class TEXTURE_PT_influence(TextureSlotPanel):
return False
engine = context.scene.render.engine
- return (engine in self.COMPAT_ENGINES)
+ return (engine in cls.COMPAT_ENGINES)
def draw(self, context):
@@ -340,7 +316,6 @@ class TEXTURE_PT_influence(TextureSlotPanel):
# textype = context.texture
tex = context.texture_slot
- wide_ui = context.region.width > narrowui
def factor_but(layout, active, toggle, factor, name):
row = layout.row(align=True)
@@ -355,70 +330,66 @@ class TEXTURE_PT_influence(TextureSlotPanel):
col = split.column()
col.label(text="Diffuse:")
- factor_but(col, tex.map_diffuse, "map_diffuse", "diffuse_factor", "Intensity")
- factor_but(col, tex.map_colordiff, "map_colordiff", "colordiff_factor", "Color")
- factor_but(col, tex.map_alpha, "map_alpha", "alpha_factor", "Alpha")
- factor_but(col, tex.map_translucency, "map_translucency", "translucency_factor", "Translucency")
+ factor_but(col, tex.use_map_diffuse, "use_map_diffuse", "diffuse_factor", "Intensity")
+ factor_but(col, tex.use_map_color_diffuse, "use_map_color_diffuse", "diffuse_color_factor", "Color")
+ factor_but(col, tex.use_map_alpha, "use_map_alpha", "alpha_factor", "Alpha")
+ factor_but(col, tex.use_map_translucency, "use_map_translucency", "translucency_factor", "Translucency")
col.label(text="Specular:")
- factor_but(col, tex.map_specular, "map_specular", "specular_factor", "Intensity")
- factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color")
- factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness")
+ factor_but(col, tex.use_map_specular, "use_map_specular", "specular_factor", "Intensity")
+ factor_but(col, tex.use_map_color_spec, "use_map_color_spec", "specular_color_factor", "Color")
+ factor_but(col, tex.use_map_hardness, "use_map_hardness", "hardness_factor", "Hardness")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Shading:")
- factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient")
- factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit")
- factor_but(col, tex.map_mirror, "map_mirror", "mirror_factor", "Mirror")
- factor_but(col, tex.map_raymir, "map_raymir", "raymir_factor", "Ray Mirror")
+ factor_but(col, tex.use_map_ambient, "use_map_ambient", "ambient_factor", "Ambient")
+ factor_but(col, tex.use_map_emit, "use_map_emit", "emit_factor", "Emit")
+ factor_but(col, tex.use_map_mirror, "use_map_mirror", "mirror_factor", "Mirror")
+ factor_but(col, tex.use_map_raymir, "use_map_raymir", "raymir_factor", "Ray Mirror")
col.label(text="Geometry:")
# XXX replace 'or' when displacement is fixed to not rely on normal influence value.
- factor_but(col, (tex.map_normal or tex.map_displacement), "map_normal", "normal_factor", "Normal")
- factor_but(col, tex.map_warp, "map_warp", "warp_factor", "Warp")
- factor_but(col, tex.map_displacement, "map_displacement", "displacement_factor", "Displace")
+ factor_but(col, (tex.use_map_normal or tex.use_map_displacement), "use_map_normal", "normal_factor", "Normal")
+ factor_but(col, tex.use_map_warp, "use_map_warp", "warp_factor", "Warp")
+ factor_but(col, tex.use_map_displacement, "use_map_displacement", "displacement_factor", "Displace")
#sub = col.column()
- #sub.active = tex.map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
+ #sub.active = tex.use_map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
#sub.prop(tex, "default_value", text="Amount", slider=True)
elif idblock.type == 'VOLUME':
split = layout.split()
col = split.column()
- factor_but(col, tex.map_density, "map_density", "density_factor", "Density")
- factor_but(col, tex.map_emission, "map_emission", "emission_factor", "Emission")
- factor_but(col, tex.map_scattering, "map_scattering", "scattering_factor", "Scattering")
- factor_but(col, tex.map_reflection, "map_reflection", "reflection_factor", "Reflection")
-
- if wide_ui:
- col = split.column()
- col.label(text=" ")
- factor_but(col, tex.map_coloremission, "map_coloremission", "coloremission_factor", "Emission Color")
- factor_but(col, tex.map_colortransmission, "map_colortransmission", "colortransmission_factor", "Transmission Color")
- factor_but(col, tex.map_colorreflection, "map_colorreflection", "colorreflection_factor", "Reflection Color")
+ factor_but(col, tex.use_map_density, "use_map_density", "density_factor", "Density")
+ factor_but(col, tex.use_map_emission, "use_map_emission", "emission_factor", "Emission")
+ factor_but(col, tex.use_map_scatter, "use_map_scattering", "scattering_factor", "Scattering")
+ factor_but(col, tex.use_map_reflect, "use_map_reflection", "reflection_factor", "Reflection")
+
+ col = split.column()
+ col.label(text=" ")
+ factor_but(col, tex.use_map_color_emission, "use_map_color_emission", "emission_color_factor", "Emission Color")
+ factor_but(col, tex.use_map_color_transmission, "use_map_color_transmission", "transmission_color_factor", "Transmission Color")
+ factor_but(col, tex.use_map_color_reflection, "use_map_color_reflection", "reflection_color_factor", "Reflection Color")
elif type(idblock) == bpy.types.Lamp:
split = layout.split()
col = split.column()
- factor_but(col, tex.map_color, "map_color", "color_factor", "Color")
+ factor_but(col, tex.use_map_color, "map_color", "color_factor", "Color")
- if wide_ui:
- col = split.column()
- factor_but(col, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow")
+ col = split.column()
+ factor_but(col, tex.use_map_shadow, "map_shadow", "shadow_factor", "Shadow")
elif type(idblock) == bpy.types.World:
split = layout.split()
col = split.column()
- factor_but(col, tex.map_blend, "map_blend", "blend_factor", "Blend")
- factor_but(col, tex.map_horizon, "map_horizon", "horizon_factor", "Horizon")
+ factor_but(col, tex.use_map_blend, "use_map_blend", "blend_factor", "Blend")
+ factor_but(col, tex.use_map_horizon, "use_map_horizon", "horizon_factor", "Horizon")
- if wide_ui:
- col = split.column()
- factor_but(col, tex.map_zenith_up, "map_zenith_up", "zenith_up_factor", "Zenith Up")
- factor_but(col, tex.map_zenith_down, "map_zenith_down", "zenith_down_factor", "Zenith Down")
+ col = split.column()
+ factor_but(col, tex.use_map_zenith_up, "use_map_zenith_up", "zenith_up_factor", "Zenith Up")
+ factor_but(col, tex.use_map_zenith_down, "use_map_zenith_down", "zenith_down_factor", "Zenith Down")
layout.separator()
@@ -426,15 +397,14 @@ class TEXTURE_PT_influence(TextureSlotPanel):
col = split.column()
col.prop(tex, "blend_type", text="Blend")
- col.prop(tex, "rgb_to_intensity")
+ col.prop(tex, "use_rgb_to_intensity")
sub = col.column()
- sub.active = tex.rgb_to_intensity
+ sub.active = tex.use_rgb_to_intensity
sub.prop(tex, "color", text="")
- if wide_ui:
- col = split.column()
- col.prop(tex, "negate", text="Negative")
- col.prop(tex, "stencil")
+ col = split.column()
+ col.prop(tex, "invert", text="Negative")
+ col.prop(tex, "use_stencil")
if type(idblock) in (bpy.types.Material, bpy.types.World):
col.prop(tex, "default_value", text="DVar", slider=True)
@@ -443,15 +413,15 @@ class TEXTURE_PT_influence(TextureSlotPanel):
class TextureTypePanel(TextureButtonsPanel):
- COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
- return ((tex and tex.type == self.tex_type and not tex.use_nodes) and (engine in self.COMPAT_ENGINES))
+ return tex and ((tex.type == cls.tex_type and not tex.use_nodes) and (engine in cls.COMPAT_ENGINES))
-class TEXTURE_PT_clouds(TextureTypePanel):
+class TEXTURE_PT_clouds(TextureTypePanel, bpy.types.Panel):
bl_label = "Clouds"
tex_type = 'CLOUDS'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -460,28 +430,23 @@ class TEXTURE_PT_clouds(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- layout.prop(tex, "stype", expand=True)
+ layout.prop(tex, "cloud_type", expand=True)
layout.label(text="Noise:")
layout.prop(tex, "noise_type", text="Type", expand=True)
- if wide_ui:
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
col = split.column()
- col.prop(tex, "noise_size", text="Size")
+ col.prop(tex, "noise_scale", text="Size")
col.prop(tex, "noise_depth", text="Depth")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "nabla", text="Nabla")
-class TEXTURE_PT_wood(TextureTypePanel):
+class TEXTURE_PT_wood(TextureTypePanel, bpy.types.Panel):
bl_label = "Wood"
tex_type = 'WOOD'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -490,35 +455,28 @@ class TEXTURE_PT_wood(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- layout.prop(tex, "noisebasis2", expand=True)
- if wide_ui:
- layout.prop(tex, "stype", expand=True)
- else:
- layout.prop(tex, "stype", text="")
+ layout.prop(tex, "noisebasis_2", expand=True)
+ layout.prop(tex, "wood_type", expand=True)
col = layout.column()
- col.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
+ col.active = tex.wood_type in ('RINGNOISE', 'BANDNOISE')
col.label(text="Noise:")
col.row().prop(tex, "noise_type", text="Type", expand=True)
- if wide_ui:
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
- split.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
+ split.active = tex.wood_type in ('RINGNOISE', 'BANDNOISE')
col = split.column()
- col.prop(tex, "noise_size", text="Size")
+ col.prop(tex, "noise_scale", text="Size")
col.prop(tex, "turbulence")
col = split.column()
col.prop(tex, "nabla")
-class TEXTURE_PT_marble(TextureTypePanel):
+class TEXTURE_PT_marble(TextureTypePanel, bpy.types.Panel):
bl_label = "Marble"
tex_type = 'MARBLE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -527,30 +485,25 @@ class TEXTURE_PT_marble(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- layout.prop(tex, "stype", expand=True)
- layout.prop(tex, "noisebasis2", expand=True)
+ layout.prop(tex, "marble_type", expand=True)
+ layout.prop(tex, "noisebasis_2", expand=True)
layout.label(text="Noise:")
layout.prop(tex, "noise_type", text="Type", expand=True)
- if wide_ui:
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
col = split.column()
- col.prop(tex, "noise_size", text="Size")
+ col.prop(tex, "noise_scale", text="Size")
col.prop(tex, "noise_depth", text="Depth")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "turbulence")
col.prop(tex, "nabla")
-class TEXTURE_PT_magic(TextureTypePanel):
+class TEXTURE_PT_magic(TextureTypePanel, bpy.types.Panel):
bl_label = "Magic"
tex_type = 'MAGIC'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -559,19 +512,17 @@ class TEXTURE_PT_magic(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(tex, "noise_depth", text="Depth")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "turbulence")
-class TEXTURE_PT_blend(TextureTypePanel):
+class TEXTURE_PT_blend(TextureTypePanel, bpy.types.Panel):
bl_label = "Blend"
tex_type = 'BLEND'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -580,20 +531,16 @@ class TEXTURE_PT_blend(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(tex, "progression")
- else:
- layout.prop(tex, "progression", text="")
+ layout.prop(tex, "progression")
sub = layout.row()
sub.active = (tex.progression in ('LINEAR', 'QUADRATIC', 'EASING', 'RADIAL'))
- sub.prop(tex, "flip_axis", expand=True)
+ sub.prop(tex, "use_flip_axis", expand=True)
-class TEXTURE_PT_stucci(TextureTypePanel):
+class TEXTURE_PT_stucci(TextureTypePanel, bpy.types.Panel):
bl_label = "Stucci"
tex_type = 'STUCCI'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -602,27 +549,22 @@ class TEXTURE_PT_stucci(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- layout.prop(tex, "stype", expand=True)
+ layout.prop(tex, "stucci_type", expand=True)
layout.label(text="Noise:")
layout.prop(tex, "noise_type", text="Type", expand=True)
- if wide_ui:
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
col = split.column()
- col.prop(tex, "noise_size", text="Size")
+ col.prop(tex, "noise_scale", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "turbulence")
-class TEXTURE_PT_image(TextureTypePanel):
+class TEXTURE_PT_image(TextureTypePanel, bpy.types.Panel):
bl_label = "Image"
tex_type = 'IMAGE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -637,18 +579,18 @@ class TEXTURE_PT_image(TextureTypePanel):
def texture_filter_common(tex, layout):
layout.label(text="Filter:")
- layout.prop(tex, "filter", text="")
- if tex.mipmap and tex.filter in ('AREA', 'EWA', 'FELINE'):
- if tex.filter == 'FELINE':
+ layout.prop(tex, "filter_type", text="")
+ if tex.use_mipmap and tex.filter_type in ('AREA', 'EWA', 'FELINE'):
+ if tex.filter_type == 'FELINE':
layout.prop(tex, "filter_probes", text="Probes")
else:
layout.prop(tex, "filter_eccentricity", text="Eccentricity")
layout.prop(tex, "filter_size")
- layout.prop(tex, "filter_size_minimum")
+ layout.prop(tex, "use_filter_size_min")
-class TEXTURE_PT_image_sampling(TextureTypePanel):
+class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
bl_label = "Image Sampling"
bl_default_closed = True
tex_type = 'IMAGE'
@@ -659,37 +601,34 @@ class TEXTURE_PT_image_sampling(TextureTypePanel):
tex = context.texture
# slot = context.texture_slot
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.label(text="Alpha:")
col.prop(tex, "use_alpha", text="Use")
- col.prop(tex, "calculate_alpha", text="Calculate")
+ col.prop(tex, "use_calculate_alpha", text="Calculate")
col.prop(tex, "invert_alpha", text="Invert")
col.separator()
- col.prop(tex, "flip_axis", text="Flip X/Y Axis")
+ col.prop(tex, "use_flip_axis", text="Flip X/Y Axis")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
- col.prop(tex, "normal_map")
+ col = split.column()
+
+ col.prop(tex, "use_normal_map")
row = col.row()
- row.active = tex.normal_map
+ row.active = tex.use_normal_map
row.prop(tex, "normal_space", text="")
- col.prop(tex, "mipmap")
+ col.prop(tex, "use_mipmap")
row = col.row()
- row.active = tex.mipmap
- row.prop(tex, "mipmap_gauss")
- col.prop(tex, "interpolation")
+ row.active = tex.use_mipmap
+ row.prop(tex, "use_mipmap_gauss")
+ col.prop(tex, "use_interpolation")
texture_filter_common(tex, col)
-class TEXTURE_PT_image_mapping(TextureTypePanel):
+class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel):
bl_label = "Image Mapping"
bl_default_closed = True
tex_type = 'IMAGE'
@@ -699,12 +638,8 @@ class TEXTURE_PT_image_mapping(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(tex, "extension")
- else:
- layout.prop(tex, "extension", text="")
+ layout.prop(tex, "extension")
split = layout.split()
@@ -714,21 +649,19 @@ class TEXTURE_PT_image_mapping(TextureTypePanel):
col.prop(tex, "repeat_x", text="X")
col.prop(tex, "repeat_y", text="Y")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Mirror:")
- col.prop(tex, "mirror_x", text="X")
- col.prop(tex, "mirror_y", text="Y")
+ col.prop(tex, "use_mirror_x", text="X")
+ col.prop(tex, "use_mirror_y", text="Y")
layout.separator()
elif tex.extension == 'CHECKER':
col = split.column(align=True)
row = col.row()
- row.prop(tex, "checker_even", text="Even")
- row.prop(tex, "checker_odd", text="Odd")
+ row.prop(tex, "use_checker_even", text="Even")
+ row.prop(tex, "use_checker_odd", text="Odd")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "checker_distance", text="Distance")
layout.separator()
@@ -741,27 +674,13 @@ class TEXTURE_PT_image_mapping(TextureTypePanel):
col.prop(tex, "crop_min_x", text="X")
col.prop(tex, "crop_min_y", text="Y")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Crop Maximum:")
col.prop(tex, "crop_max_x", text="X")
col.prop(tex, "crop_max_y", text="Y")
-class TEXTURE_PT_plugin(TextureTypePanel):
- bl_label = "Plugin"
- tex_type = 'PLUGIN'
- COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
-
- def draw(self, context):
- layout = self.layout
-
- # tex = context.texture
-
- layout.label(text="Nothing yet")
-
-
-class TEXTURE_PT_envmap(TextureTypePanel):
+class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel):
bl_label = "Environment Map"
tex_type = 'ENVIRONMENT_MAP'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -772,7 +691,6 @@ class TEXTURE_PT_envmap(TextureTypePanel):
tex = context.texture
env = tex.environment_map
- wide_ui = context.region.width > narrowui
row = layout.row()
row.prop(env, "source", expand=True)
@@ -790,19 +708,18 @@ class TEXTURE_PT_envmap(TextureTypePanel):
split = layout.split()
col = split.column()
- col.prop(env, "ignore_layers")
+ col.prop(env, "layers_ignore")
col.prop(env, "resolution")
col.prop(env, "depth")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.label(text="Clipping:")
col.prop(env, "clip_start", text="Start")
col.prop(env, "clip_end", text="End")
-class TEXTURE_PT_envmap_sampling(TextureTypePanel):
+class TEXTURE_PT_envmap_sampling(TextureTypePanel, bpy.types.Panel):
bl_label = "Environment Map Sampling"
bl_default_closed = True
tex_type = 'ENVIRONMENT_MAP'
@@ -816,7 +733,7 @@ class TEXTURE_PT_envmap_sampling(TextureTypePanel):
texture_filter_common(tex, layout)
-class TEXTURE_PT_musgrave(TextureTypePanel):
+class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel):
bl_label = "Musgrave"
tex_type = 'MUSGRAVE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -825,22 +742,17 @@ class TEXTURE_PT_musgrave(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(tex, "musgrave_type")
- else:
- layout.prop(tex, "musgrave_type", text="")
+ layout.prop(tex, "musgrave_type")
split = layout.split()
col = split.column()
- col.prop(tex, "highest_dimension", text="Dimension")
+ col.prop(tex, "dimension_max", text="Dimension")
col.prop(tex, "lacunarity")
col.prop(tex, "octaves")
- if wide_ui:
- col = split.column()
+ col = split.column()
if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
col.prop(tex, "offset")
if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
@@ -849,22 +761,18 @@ class TEXTURE_PT_musgrave(TextureTypePanel):
layout.label(text="Noise:")
- if wide_ui:
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
col = split.column()
- col.prop(tex, "noise_size", text="Size")
+ col.prop(tex, "noise_scale", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "nabla")
-class TEXTURE_PT_voronoi(TextureTypePanel):
+class TEXTURE_PT_voronoi(TextureTypePanel, bpy.types.Panel):
bl_label = "Voronoi"
tex_type = 'VORONOI'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -873,7 +781,6 @@ class TEXTURE_PT_voronoi(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -884,11 +791,10 @@ class TEXTURE_PT_voronoi(TextureTypePanel):
sub.active = tex.distance_metric == 'MINKOVSKY'
sub.prop(tex, "minkovsky_exponent", text="Exponent")
col.label(text="Coloring:")
- col.prop(tex, "coloring", text="")
+ col.prop(tex, "color_mode", text="")
col.prop(tex, "noise_intensity", text="Intensity")
- if wide_ui:
- col = split.column()
+ col = split.column()
sub = col.column(align=True)
sub.label(text="Feature Weights:")
sub.prop(tex, "weight_1", text="1", slider=True)
@@ -901,14 +807,13 @@ class TEXTURE_PT_voronoi(TextureTypePanel):
split = layout.split()
col = split.column()
- col.prop(tex, "noise_size", text="Size")
+ col.prop(tex, "noise_scale", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "nabla")
-class TEXTURE_PT_distortednoise(TextureTypePanel):
+class TEXTURE_PT_distortednoise(TextureTypePanel, bpy.types.Panel):
bl_label = "Distorted Noise"
tex_type = 'DISTORTED_NOISE'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -917,44 +822,39 @@ class TEXTURE_PT_distortednoise(TextureTypePanel):
layout = self.layout
tex = context.texture
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(tex, "noise_distortion")
- layout.prop(tex, "noise_basis", text="Basis")
- else:
- layout.prop(tex, "noise_distortion", text="")
- layout.prop(tex, "noise_basis", text="")
+ layout.prop(tex, "noise_distortion")
+ layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
col = split.column()
col.prop(tex, "distortion", text="Distortion")
- col.prop(tex, "noise_size", text="Size")
+ col.prop(tex, "noise_scale", text="Size")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(tex, "nabla")
-class TEXTURE_PT_voxeldata(TextureButtonsPanel):
+class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Voxel Data"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
- return (tex and tex.type == 'VOXEL_DATA' and (engine in self.COMPAT_ENGINES))
+ return tex and (tex.type == 'VOXEL_DATA' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
tex = context.texture
- vd = tex.voxeldata
+ vd = tex.voxel_data
layout.prop(vd, "file_format")
- if vd.file_format in ['BLENDER_VOXEL', 'RAW_8BIT']:
- layout.prop(vd, "source_path")
+ if vd.file_format in ('BLENDER_VOXEL', 'RAW_8BIT'):
+ layout.prop(vd, "filepath")
if vd.file_format == 'RAW_8BIT':
layout.prop(vd, "resolution")
elif vd.file_format == 'SMOKE':
@@ -963,38 +863,35 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel):
elif vd.file_format == 'IMAGE_SEQUENCE':
layout.template_ID(tex, "image", open="image.open")
layout.template_image(tex, "image", tex.image_user, compact=True)
- #layout.prop(vd, "frames")
+ #layout.prop(vd, "frame_duration")
- layout.prop(vd, "still")
+ layout.prop(vd, "use_still_frame")
row = layout.row()
- row.active = vd.still
- row.prop(vd, "still_frame_number")
+ row.active = vd.use_still_frame
+ row.prop(vd, "still_frame")
layout.prop(vd, "interpolation")
layout.prop(vd, "extension")
layout.prop(vd, "intensity")
-class TEXTURE_PT_pointdensity(TextureButtonsPanel):
+class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Point Density"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
- return (tex and tex.type == 'POINT_DENSITY' and (engine in self.COMPAT_ENGINES))
+ return tex and (tex.type == 'POINT_DENSITY' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
tex = context.texture
- pd = tex.pointdensity
- wide_ui = context.region.width > narrowui
+ pd = tex.point_density
- if wide_ui:
- layout.prop(pd, "point_source", expand=True)
- else:
- layout.prop(pd, "point_source", text="")
+ layout.prop(pd, "point_source", expand=True)
split = layout.split()
@@ -1009,12 +906,12 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel):
sub.label(text="System:")
sub.prop_object(pd, "particle_system", pd.object, "particle_systems", text="")
sub.label(text="Cache:")
- sub.prop(pd, "particle_cache", text="")
+ sub.prop(pd, "particle_cache_space", text="")
else:
col.label(text="Object:")
col.prop(pd, "object", text="")
col.label(text="Cache:")
- col.prop(pd, "vertices_cache", text="")
+ col.prop(pd, "vertex_cache_space", text="")
col.separator()
@@ -1025,40 +922,39 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel):
if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_AGE'):
layout.template_color_ramp(pd, "color_ramp", expand=True)
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label()
col.prop(pd, "radius")
col.label(text="Falloff:")
col.prop(pd, "falloff", text="")
if pd.falloff == 'SOFT':
- col.prop(pd, "falloff_softness")
+ col.prop(pd, "falloff_soft")
-class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel):
+class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Turbulence"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
tex = context.texture
engine = context.scene.render.engine
- return (tex and tex.type == 'POINT_DENSITY' and (engine in self.COMPAT_ENGINES))
+ return tex and (tex.type == 'POINT_DENSITY' and (engine in cls.COMPAT_ENGINES))
def draw_header(self, context):
layout = self.layout
tex = context.texture
- pd = tex.pointdensity
+ pd = tex.point_density
- layout.prop(pd, "turbulence", text="")
+ layout.prop(pd, "use_turbulence", text="")
def draw(self, context):
layout = self.layout
tex = context.texture
- pd = tex.pointdensity
- layout.active = pd.turbulence
- wide_ui = context.region.width > narrowui
+ pd = tex.point_density
+ layout.active = pd.use_turbulence
split = layout.split()
@@ -1068,57 +964,24 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel):
col.label(text="Noise Basis:")
col.prop(pd, "noise_basis", text="")
- if wide_ui:
- col = split.column()
- col.label()
- col.prop(pd, "turbulence_size")
+ col = split.column()
+ col.label()
+ col.prop(pd, "turbulence_scale")
col.prop(pd, "turbulence_depth")
col.prop(pd, "turbulence_strength")
-classes = [
- TEXTURE_MT_specials,
- TEXTURE_MT_envmap_specials,
-
- TEXTURE_PT_context_texture,
- TEXTURE_PT_preview,
-
- TEXTURE_PT_clouds, # Texture Type Panels
- TEXTURE_PT_wood,
- TEXTURE_PT_marble,
- TEXTURE_PT_magic,
- TEXTURE_PT_blend,
- TEXTURE_PT_stucci,
- TEXTURE_PT_image,
- TEXTURE_PT_image_sampling,
- TEXTURE_PT_image_mapping,
- TEXTURE_PT_plugin,
- TEXTURE_PT_envmap,
- TEXTURE_PT_envmap_sampling,
- TEXTURE_PT_musgrave,
- TEXTURE_PT_voronoi,
- TEXTURE_PT_distortednoise,
- TEXTURE_PT_voxeldata,
- TEXTURE_PT_pointdensity,
- TEXTURE_PT_pointdensity_turbulence,
-
- TEXTURE_PT_colors,
- TEXTURE_PT_mapping,
- TEXTURE_PT_influence,
-
- TEXTURE_PT_custom_props]
+class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "texture"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/properties_world.py b/release/scripts/ui/properties_world.py
index e63d513a4b5..a42516a63b4 100644
--- a/release/scripts/ui/properties_world.py
+++ b/release/scripts/ui/properties_world.py
@@ -20,36 +20,29 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = bpy.context.user_preferences.view.properties_width_check
+# TODO, "color_range" not in the UI
-class WorldButtonsPanel(bpy.types.Panel):
+class WorldButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "world"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
- def poll(self, context):
- rd = context.scene.render
- return (context.world) and (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
-
+ @classmethod
+ def poll(cls, context):
+ return (context.world and context.scene.render.engine in cls.COMPAT_ENGINES)
-class WORLD_PT_preview(WorldButtonsPanel):
- bl_label = "Preview"
- COMPAT_ENGINES = {'BLENDER_RENDER'}
-
- def draw(self, context):
- self.layout.template_preview(context.world)
-
-class WORLD_PT_context_world(WorldButtonsPanel):
+class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
- return (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
+ return (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -57,178 +50,119 @@ class WORLD_PT_context_world(WorldButtonsPanel):
scene = context.scene
world = context.world
space = context.space_data
- wide_ui = context.region.width > narrowui
-
- if wide_ui:
- split = layout.split(percentage=0.65)
- if scene:
- split.template_ID(scene, "world", new="world.new")
- elif world:
- split.template_ID(space, "pin_id")
- else:
- layout.template_ID(scene, "world", new="world.new")
+ split = layout.split(percentage=0.65)
+ if scene:
+ split.template_ID(scene, "world", new="world.new")
+ elif world:
+ split.template_ID(space, "pin_id")
-class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel):
+class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER'}
- _context_path = "world"
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return (context.world) and (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
-class WORLD_PT_world(WorldButtonsPanel):
+ def draw(self, context):
+ self.layout.template_preview(context.world)
+
+
+class WORLD_PT_world(WorldButtonsPanel, bpy.types.Panel):
bl_label = "World"
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
world = context.world
- if wide_ui:
- row = layout.row()
- row.prop(world, "paper_sky")
- row.prop(world, "blend_sky")
- row.prop(world, "real_sky")
- else:
- col = layout.column()
- col.prop(world, "paper_sky")
- col.prop(world, "blend_sky")
- col.prop(world, "real_sky")
+ row = layout.row()
+ row.prop(world, "use_sky_paper")
+ row.prop(world, "use_sky_blend")
+ row.prop(world, "use_sky_real")
row = layout.row()
row.column().prop(world, "horizon_color")
col = row.column()
col.prop(world, "zenith_color")
- col.active = world.blend_sky
+ col.active = world.use_sky_blend
row.column().prop(world, "ambient_color")
-class WORLD_PT_mist(WorldButtonsPanel):
- bl_label = "Mist"
- bl_default_closed = True
- COMPAT_ENGINES = {'BLENDER_RENDER'}
-
- def draw_header(self, context):
- world = context.world
-
- self.layout.prop(world.mist, "use_mist", text="")
-
- def draw(self, context):
- layout = self.layout
- wide_ui = context.region.width > narrowui
- world = context.world
-
- layout.active = world.mist.use_mist
-
- split = layout.split()
-
- col = split.column()
- col.prop(world.mist, "intensity", slider=True)
- col.prop(world.mist, "start")
-
- if wide_ui:
- col = split.column()
- col.prop(world.mist, "depth")
- col.prop(world.mist, "height")
-
- layout.prop(world.mist, "falloff")
-
-
-class WORLD_PT_stars(WorldButtonsPanel):
- bl_label = "Stars"
- bl_default_closed = True
- COMPAT_ENGINES = {'BLENDER_RENDER'}
-
- def draw_header(self, context):
- world = context.world
-
- self.layout.prop(world.stars, "use_stars", text="")
-
- def draw(self, context):
- layout = self.layout
- wide_ui = context.region.width > narrowui
- world = context.world
-
- layout.active = world.stars.use_stars
-
- split = layout.split()
-
- col = split.column()
- col.prop(world.stars, "size")
- col.prop(world.stars, "color_randomization", text="Colors")
-
- if wide_ui:
- col = split.column()
- col.prop(world.stars, "min_distance", text="Min. Dist")
- col.prop(world.stars, "average_separation", text="Separation")
-
-
-class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
+class WORLD_PT_ambient_occlusion(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Ambient Occlusion"
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
- light = context.world.lighting
+ light = context.world.light_settings
self.layout.prop(light, "use_ambient_occlusion", text="")
def draw(self, context):
layout = self.layout
- light = context.world.lighting
+ light = context.world.light_settings
layout.active = light.use_ambient_occlusion
split = layout.split()
split.prop(light, "ao_factor", text="Factor")
- split.prop(light, "ao_blend_mode", text="")
+ split.prop(light, "ao_blend_type", text="")
-class WORLD_PT_environment_lighting(WorldButtonsPanel):
+class WORLD_PT_environment_lighting(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Environment Lighting"
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
- light = context.world.lighting
- self.layout.prop(light, "use_environment_lighting", text="")
+ light = context.world.light_settings
+ self.layout.prop(light, "use_environment_light", text="")
def draw(self, context):
layout = self.layout
- light = context.world.lighting
+ light = context.world.light_settings
- layout.active = light.use_environment_lighting
+ layout.active = light.use_environment_light
split = layout.split()
split.prop(light, "environment_energy", text="Energy")
split.prop(light, "environment_color", text="")
-class WORLD_PT_indirect_lighting(WorldButtonsPanel):
+class WORLD_PT_indirect_lighting(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Indirect Lighting"
COMPAT_ENGINES = {'BLENDER_RENDER'}
+ @classmethod
+ def poll(cls, context):
+ light = getattr(context.world, "light_settings", None)
+ return light and light.gather_method == 'APPROXIMATE'
+
def draw_header(self, context):
- light = context.world.lighting
- self.layout.prop(light, "use_indirect_lighting", text="")
+ light = context.world.light_settings
+ self.layout.prop(light, "use_indirect_light", text="")
def draw(self, context):
layout = self.layout
- light = context.world.lighting
+ light = context.world.light_settings
- layout.active = light.use_indirect_lighting
+ layout.active = light.use_indirect_light
split = layout.split()
split.prop(light, "indirect_factor", text="Factor")
split.prop(light, "indirect_bounces", text="Bounces")
-class WORLD_PT_gather(WorldButtonsPanel):
+class WORLD_PT_gather(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Gather"
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw(self, context):
layout = self.layout
- light = context.world.lighting
+ light = context.world.light_settings
- layout.active = light.use_ambient_occlusion or light.use_environment_lighting or light.use_indirect_lighting
+ layout.active = light.use_ambient_occlusion or light.use_environment_light or light.use_indirect_light
layout.prop(light, "gather_method", expand=True)
@@ -238,9 +172,9 @@ class WORLD_PT_gather(WorldButtonsPanel):
col.label(text="Attenuation:")
if light.gather_method == 'RAYTRACE':
col.prop(light, "distance")
- col.prop(light, "falloff")
+ col.prop(light, "use_falloff")
sub = col.row()
- sub.active = light.falloff
+ sub.active = light.use_falloff
sub.prop(light, "falloff_strength", text="Strength")
if light.gather_method == 'RAYTRACE':
@@ -263,35 +197,78 @@ class WORLD_PT_gather(WorldButtonsPanel):
col.label(text="Sampling:")
col.prop(light, "passes")
- col.prop(light, "error_tolerance", text="Error")
- col.prop(light, "pixel_cache")
+ col.prop(light, "error_threshold", text="Error")
+ col.prop(light, "use_cache")
col.prop(light, "correction")
-classes = [
- WORLD_PT_context_world,
- WORLD_PT_preview,
- WORLD_PT_world,
- WORLD_PT_ambient_occlusion,
- WORLD_PT_environment_lighting,
- WORLD_PT_indirect_lighting,
- WORLD_PT_gather,
- WORLD_PT_mist,
- WORLD_PT_stars,
+class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Mist"
+ bl_default_closed = True
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw_header(self, context):
+ world = context.world
+
+ self.layout.prop(world.mist_settings, "use_mist", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ world = context.world
+
+ layout.active = world.mist_settings.use_mist
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(world.mist_settings, "intensity", slider=True)
+ col.prop(world.mist_settings, "start")
+
+ col = split.column()
+ col.prop(world.mist_settings, "depth")
+ col.prop(world.mist_settings, "height")
+
+ layout.prop(world.mist_settings, "falloff")
+
- WORLD_PT_custom_props]
+class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Stars"
+ bl_default_closed = True
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw_header(self, context):
+ world = context.world
+
+ self.layout.prop(world.star_settings, "use_stars", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ world = context.world
+
+ layout.active = world.star_settings.use_stars
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(world.star_settings, "size")
+ col.prop(world.star_settings, "color_random", text="Colors")
+
+ col = split.column()
+ col.prop(world.star_settings, "distance_min", text="Min. Dist")
+ col.prop(world.star_settings, "average_separation", text="Separation")
+
+
+class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "world"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_buttons.py b/release/scripts/ui/space_buttons.py
deleted file mode 100644
index 9fc30a8189b..00000000000
--- a/release/scripts/ui/space_buttons.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# ##### 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 #####
-
-# <pep8 compliant>
-import bpy
-
-
-class Buttons_HT_header(bpy.types.Header):
- bl_space_type = 'PROPERTIES'
-
- def draw(self, context):
- layout = self.layout
-
- so = context.space_data
- scene = context.scene
-
- row = layout.row(align=True)
- row.template_header()
-
- if context.area.show_menus:
- sub = row.row(align=True)
- sub.menu("Buttons_MT_view", text="View")
-
- row = layout.row()
- row.prop(so, "buttons_context", expand=True, text="")
- row.prop(scene, "frame_current")
-
-
-class Buttons_MT_view(bpy.types.Menu):
- bl_label = "View"
-
- def draw(self, context):
- layout = self.layout
- so = context.space_data
-
- col = layout.column()
- col.prop(so, "panel_alignment", expand=True)
-
-
-classes = [
- Buttons_HT_header,
- Buttons_MT_view]
-
-
-def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
-
-
-def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
-
-if __name__ == "__main__":
- register()
diff --git a/release/scripts/ui/space_console.py b/release/scripts/ui/space_console.py
index 512af350a47..f2264a5c926 100644
--- a/release/scripts/ui/space_console.py
+++ b/release/scripts/ui/space_console.py
@@ -48,7 +48,7 @@ class CONSOLE_HT_header(bpy.types.Header):
row.prop(sc, "show_report_debug", text="Debug")
row.prop(sc, "show_report_info", text="Info")
row.prop(sc, "show_report_operator", text="Operators")
- row.prop(sc, "show_report_warn", text="Warnings")
+ row.prop(sc, "show_report_warning", text="Warnings")
row.prop(sc, "show_report_error", text="Errors")
row = layout.row()
@@ -138,7 +138,8 @@ class ConsoleAutocomplete(bpy.types.Operator):
bl_idname = "console.autocomplete"
bl_label = "Console Autocomplete"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.space_data.console_type != 'REPORT'
def execute(self, context):
@@ -196,31 +197,12 @@ class ConsoleLanguage(bpy.types.Operator):
return {'FINISHED'}
-classes = [
- CONSOLE_HT_header,
- CONSOLE_MT_console,
- CONSOLE_MT_report,
- CONSOLE_MT_language,
-
- # Stubs that call the language operators
- ConsoleExec,
- ConsoleAutocomplete,
- ConsoleBanner,
-
- # Set the language and call the banner
- ConsoleLanguage]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_dopesheet.py b/release/scripts/ui/space_dopesheet.py
index 41917acd997..110ddd9606b 100644
--- a/release/scripts/ui/space_dopesheet.py
+++ b/release/scripts/ui/space_dopesheet.py
@@ -48,7 +48,7 @@ class DOPESHEET_HT_header(bpy.types.Header):
sub.menu("DOPESHEET_MT_key")
layout.prop(st, "mode", text="")
- layout.prop(st.dopesheet, "display_summary", text="Summary")
+ layout.prop(st.dopesheet, "show_summary", text="Summary")
if st.mode == 'DOPESHEET':
layout.template_dopesheet_filter(st.dopesheet)
@@ -56,7 +56,7 @@ class DOPESHEET_HT_header(bpy.types.Header):
layout.template_ID(st, "action", new="action.new")
if st.mode != 'GPENCIL':
- layout.prop(st, "autosnap", text="")
+ layout.prop(st, "auto_snap", text="")
row = layout.row(align=True)
row.operator("action.copy", text="", icon='COPYDOWN')
@@ -73,10 +73,10 @@ class DOPESHEET_MT_view(bpy.types.Menu):
layout.column()
- layout.prop(st, "realtime_updates")
- layout.prop(st, "show_cframe_indicator")
+ layout.prop(st, "use_realtime_update")
+ layout.prop(st, "show_frame_indicator")
layout.prop(st, "show_sliders")
- layout.prop(st, "automerge_keyframes")
+ layout.prop(st, "use_auto_merge_keyframes")
layout.prop(st, "use_marker_sync")
if st.show_seconds:
@@ -196,25 +196,12 @@ class DOPESHEET_MT_key_transform(bpy.types.Menu):
layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
-classes = [
- DOPESHEET_HT_header, # header/menu classes
- DOPESHEET_MT_view,
- DOPESHEET_MT_select,
- DOPESHEET_MT_channel,
- DOPESHEET_MT_key,
- DOPESHEET_MT_key_transform]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_filebrowser.py b/release/scripts/ui/space_filebrowser.py
index 39bae6ca59b..cb95ac87eef 100644
--- a/release/scripts/ui/space_filebrowser.py
+++ b/release/scripts/ui/space_filebrowser.py
@@ -46,39 +46,31 @@ class FILEBROWSER_HT_header(bpy.types.Header):
row = layout.row(align=True)
row.operator("file.directory_new", text="", icon='NEWFOLDER')
- layout.prop(params, "display", expand=True, text="")
- layout.prop(params, "sort", expand=True, text="")
+ layout.prop(params, "display_type", expand=True, text="")
+ layout.prop(params, "sort_method", expand=True, text="")
- layout.prop(params, "hide_dot", text="Hide Invisible")
- layout.prop(params, "do_filter", text="", icon='FILTER')
+ layout.prop(params, "show_hidden", text="Hide Invisible")
+ layout.prop(params, "use_filter", text="", icon='FILTER')
row = layout.row(align=True)
- row.active = params.do_filter
+ row.active = params.use_filter
- row.prop(params, "filter_folder", text="")
- row.prop(params, "filter_blender", text="")
- row.prop(params, "filter_image", text="")
- row.prop(params, "filter_movie", text="")
- row.prop(params, "filter_script", text="")
- row.prop(params, "filter_font", text="")
- row.prop(params, "filter_sound", text="")
- row.prop(params, "filter_text", text="")
-
-
-classes = [
- FILEBROWSER_HT_header]
+ row.prop(params, "use_filter_folder", text="")
+ row.prop(params, "use_filter_blender", text="")
+ row.prop(params, "use_filter_image", text="")
+ row.prop(params, "use_filter_movie", text="")
+ row.prop(params, "use_filter_script", text="")
+ row.prop(params, "use_filter_font", text="")
+ row.prop(params, "use_filter_sound", text="")
+ row.prop(params, "use_filter_text", text="")
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_graph.py b/release/scripts/ui/space_graph.py
index 1533b891202..e5ba894f8ad 100644
--- a/release/scripts/ui/space_graph.py
+++ b/release/scripts/ui/space_graph.py
@@ -44,7 +44,7 @@ class GRAPH_HT_header(bpy.types.Header):
layout.template_dopesheet_filter(st.dopesheet)
- layout.prop(st, "autosnap", text="")
+ layout.prop(st, "auto_snap", text="")
layout.prop(st, "pivot_point", text="", icon_only=True)
row = layout.row(align=True)
@@ -71,19 +71,19 @@ class GRAPH_MT_view(bpy.types.Menu):
layout.operator("graph.properties", icon='MENU_PANEL')
layout.separator()
- layout.prop(st, "realtime_updates")
- layout.prop(st, "show_cframe_indicator")
+ layout.prop(st, "use_realtime_update")
+ layout.prop(st, "show_frame_indicator")
layout.prop(st, "show_cursor")
layout.prop(st, "show_sliders")
- layout.prop(st, "automerge_keyframes")
+ layout.prop(st, "use_auto_merge_keyframes")
layout.separator()
if st.show_handles:
layout.operator("graph.handles_view_toggle", icon='CHECKBOX_HLT', text="Show All Handles")
else:
layout.operator("graph.handles_view_toggle", icon='CHECKBOX_DEHLT', text="Show All Handles")
- layout.prop(st, "only_selected_curves_handles")
- layout.prop(st, "only_selected_keyframe_handles")
+ layout.prop(st, "use_only_selected_curves_handles")
+ layout.prop(st, "use_only_selected_keyframe_handles")
layout.operator("anim.time_toggle")
layout.separator()
@@ -204,25 +204,12 @@ class GRAPH_MT_key_transform(bpy.types.Menu):
layout.operator("transform.resize", text="Scale")
-classes = [
- GRAPH_HT_header, # header/menu classes
- GRAPH_MT_view,
- GRAPH_MT_select,
- GRAPH_MT_channel,
- GRAPH_MT_key,
- GRAPH_MT_key_transform]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py
index e9c963db7b3..11324b59b3b 100644
--- a/release/scripts/ui/space_image.py
+++ b/release/scripts/ui/space_image.py
@@ -19,7 +19,16 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
+
+class BrushButtonsPanel():
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'UI'
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ toolsettings = context.tool_settings.image_paint
+ return sima.show_paint and toolsettings.brush
class IMAGE_MT_view(bpy.types.Menu):
@@ -39,10 +48,10 @@ class IMAGE_MT_view(bpy.types.Menu):
layout.separator()
- layout.prop(sima, "update_automatically")
+ layout.prop(sima, "use_realtime_update")
if show_uvedit:
- layout.prop(toolsettings, "uv_local_view") # Numpad /
- layout.prop(uv, "draw_other_objects")
+ layout.prop(toolsettings, "show_uv_local_view") # Numpad /
+ layout.prop(uv, "show_other_objects")
layout.separator()
@@ -129,13 +138,13 @@ class IMAGE_MT_image(bpy.types.Menu):
# only for dirty && specific image types, perhaps
# this could be done in operator poll too
- if ima.dirty:
+ if ima.is_dirty:
if ima.source in ('FILE', 'GENERATED') and ima.type != 'MULTILAYER':
layout.operator("image.pack", text="Pack As PNG").as_png = True
layout.separator()
- layout.prop(sima, "image_painting")
+ layout.prop(sima, "use_image_paint")
class IMAGE_MT_uvs_showhide(bpy.types.Menu):
@@ -208,12 +217,12 @@ class IMAGE_MT_uvs(bpy.types.Menu):
uv = sima.uv_editor
toolsettings = context.tool_settings
- layout.prop(uv, "snap_to_pixels")
- layout.prop(uv, "constrain_to_image_bounds")
+ layout.prop(uv, "use_snap_to_pixels")
+ layout.prop(uv, "lock_bounds")
layout.separator()
- layout.prop(uv, "live_unwrap")
+ layout.prop(uv, "use_live_unwrap")
layout.operator("uv.unwrap")
layout.operator("uv.pin", text="Unpin").clear = True
layout.operator("uv.pin")
@@ -235,8 +244,8 @@ class IMAGE_MT_uvs(bpy.types.Menu):
layout.separator()
- layout.prop_menu_enum(toolsettings, "proportional_editing")
- layout.prop_menu_enum(toolsettings, "proportional_editing_falloff")
+ layout.prop_menu_enum(toolsettings, "proportional_edit")
+ layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
layout.separator()
@@ -269,7 +278,7 @@ class IMAGE_HT_header(bpy.types.Header):
if show_uvedit:
sub.menu("IMAGE_MT_select")
- if ima and ima.dirty:
+ if ima and ima.is_dirty:
sub.menu("IMAGE_MT_image", text="Image*")
else:
sub.menu("IMAGE_MT_image", text="Image")
@@ -279,31 +288,31 @@ class IMAGE_HT_header(bpy.types.Header):
layout.template_ID(sima, "image", new="image.new")
if not show_render:
- layout.prop(sima, "image_pin", text="")
+ layout.prop(sima, "use_image_pin", text="")
# uv editing
if show_uvedit:
uvedit = sima.uv_editor
- layout.prop(uvedit, "pivot", text="", icon_only=True)
- layout.prop(toolsettings, "uv_sync_selection", text="")
+ layout.prop(uvedit, "pivot_point", text="", icon_only=True)
+ layout.prop(toolsettings, "use_uv_select_sync", text="")
- if toolsettings.uv_sync_selection:
+ if toolsettings.use_uv_select_sync:
row = layout.row(align=True)
- row.prop(toolsettings, "mesh_selection_mode", text="", index=0, icon='VERTEXSEL')
- row.prop(toolsettings, "mesh_selection_mode", text="", index=1, icon='EDGESEL')
- row.prop(toolsettings, "mesh_selection_mode", text="", index=2, icon='FACESEL')
+ row.prop(toolsettings, "mesh_select_mode", text="", index=0, icon='VERTEXSEL')
+ row.prop(toolsettings, "mesh_select_mode", text="", index=1, icon='EDGESEL')
+ row.prop(toolsettings, "mesh_select_mode", text="", index=2, icon='FACESEL')
else:
- layout.prop(toolsettings, "uv_selection_mode", text="", expand=True)
- layout.prop(uvedit, "sticky_selection_mode", text="", icon_only=True)
+ layout.prop(toolsettings, "uv_select_mode", text="", expand=True)
+ layout.prop(uvedit, "sticky_select_mode", text="", icon_only=True)
row = layout.row(align=True)
- row.prop(toolsettings, "proportional_editing", text="", icon_only=True)
- if toolsettings.proportional_editing != 'DISABLED':
- row.prop(toolsettings, "proportional_editing_falloff", text="", icon_only=True)
+ row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
+ if toolsettings.proportional_edit != 'DISABLED':
+ row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
row = layout.row(align=True)
- row.prop(toolsettings, "snap", text="")
+ row.prop(toolsettings, "use_snap", text="")
row.prop(toolsettings, "snap_element", text="", icon_only=True)
# mesh = context.edit_object.data
@@ -314,7 +323,7 @@ class IMAGE_HT_header(bpy.types.Header):
layout.template_image_layers(ima, iuser)
# painting
- layout.prop(sima, "image_painting", text="")
+ layout.prop(sima, "use_image_paint", text="")
# draw options
row = layout.row(align=True)
@@ -326,8 +335,8 @@ class IMAGE_HT_header(bpy.types.Header):
if ima.type == 'COMPOSITE' and ima.source in ('MOVIE', 'SEQUENCE'):
row.operator("image.play_composite", icon='PLAY')
- if show_uvedit or sima.image_painting:
- layout.prop(sima, "update_automatically", text="", icon_only=True, icon='LOCKED')
+ if show_uvedit or sima.use_image_paint:
+ layout.prop(sima, "use_realtime_update", text="", icon_only=True, icon='LOCKED')
class IMAGE_PT_image_properties(bpy.types.Panel):
@@ -335,7 +344,8 @@ class IMAGE_PT_image_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Image"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima.image)
@@ -354,7 +364,8 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Game Properties"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
rd = context.scene.render
sima = context.space_data
return (sima and sima.image) and (rd.engine == 'BLENDER_GAME')
@@ -364,32 +375,30 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
sima = context.space_data
ima = sima.image
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
sub = col.column(align=True)
- sub.prop(ima, "animated")
+ sub.prop(ima, "use_animation")
subsub = sub.column()
- subsub.active = ima.animated
- subsub.prop(ima, "animation_start", text="Start")
- subsub.prop(ima, "animation_end", text="End")
- subsub.prop(ima, "animation_speed", text="Speed")
+ subsub.active = ima.use_animation
+ subsub.prop(ima, "frame_start", text="Start")
+ subsub.prop(ima, "frame_end", text="End")
+ subsub.prop(ima, "fps", text="Speed")
- col.prop(ima, "tiles")
+ col.prop(ima, "use_tiles")
sub = col.column(align=True)
- sub.active = ima.tiles or ima.animated
+ sub.active = ima.tiles or ima.use_animation
sub.prop(ima, "tiles_x", text="X")
sub.prop(ima, "tiles_y", text="Y")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Clamp:")
- col.prop(ima, "clamp_x", text="X")
- col.prop(ima, "clamp_y", text="Y")
+ col.prop(ima, "use_clamp_x", text="X")
+ col.prop(ima, "use_clamp_y", text="Y")
col.separator()
col.prop(ima, "mapping", expand=True)
@@ -399,7 +408,8 @@ class IMAGE_PT_view_histogram(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Histogram"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@@ -417,7 +427,8 @@ class IMAGE_PT_view_waveform(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Waveform"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@@ -436,7 +447,8 @@ class IMAGE_PT_view_vectorscope(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Vectorscope"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@@ -453,7 +465,8 @@ class IMAGE_PT_sample_line(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Sample Line"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and sima.image)
@@ -470,7 +483,8 @@ class IMAGE_PT_scope_sample(bpy.types.Panel):
bl_region_type = 'PREVIEW'
bl_label = "Scope Samples"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return sima
@@ -490,7 +504,8 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Display"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return (sima and (sima.image or sima.show_uvedit))
@@ -501,7 +516,6 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
ima = sima.image
show_uvedit = sima.show_uvedit
uvedit = sima.uv_editor
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -509,16 +523,15 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
if ima:
col.prop(ima, "display_aspect", text="Aspect Ratio")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Coordinates:")
- col.prop(sima, "draw_repeated", text="Repeat")
+ col.prop(sima, "show_repeat", text="Repeat")
if show_uvedit:
- col.prop(uvedit, "normalized_coordinates", text="Normalized")
+ col.prop(uvedit, "show_normalized_coords", text="Normalized")
elif show_uvedit:
col.label(text="Coordinates:")
- col.prop(uvedit, "normalized_coordinates", text="Normalized")
+ col.prop(uvedit, "show_normalized_coords", text="Normalized")
if show_uvedit:
@@ -528,23 +541,19 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
col = layout.column()
col.label(text="UVs:")
row = col.row()
- if wide_ui:
- row.prop(uvedit, "edge_draw_type", expand=True)
- else:
- row.prop(uvedit, "edge_draw_type", text="")
+ row.prop(uvedit, "edge_draw_type", expand=True)
split = layout.split()
col = split.column()
- col.prop(uvedit, "draw_smooth_edges", text="Smooth")
- col.prop(uvedit, "draw_modified_edges", text="Modified")
- #col.prop(uvedit, "draw_edges")
- #col.prop(uvedit, "draw_faces")
-
- if wide_ui:
- col = split.column()
- col.prop(uvedit, "draw_stretch", text="Stretch")
+ col.prop(uvedit, "show_smooth_edges", text="Smooth")
+ col.prop(uvedit, "show_modified_edges", text="Modified")
+ #col.prop(uvedit, "show_edges")
+ #col.prop(uvedit, "show_faces")
+
+ col = split.column()
+ col.prop(uvedit, "show_stretch", text="Stretch")
sub = col.column()
- sub.active = uvedit.draw_stretch
+ sub.active = uvedit.show_stretch
sub.row().prop(uvedit, "draw_stretch_type", expand=True)
@@ -553,7 +562,8 @@ class IMAGE_PT_paint(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Paint"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
sima = context.space_data
return sima.show_paint
@@ -562,22 +572,10 @@ class IMAGE_PT_paint(bpy.types.Panel):
toolsettings = context.tool_settings.image_paint
brush = toolsettings.brush
- wide_ui = context.region.width > narrowui
col = layout.split().column()
row = col.row()
- row.template_list(toolsettings, "brushes", toolsettings, "active_brush_index", rows=2)
-
- col.template_ID(toolsettings, "brush", new="brush.add")
-
- if wide_ui:
- sub = layout.row(align=True)
- else:
- sub = layout.column(align=True)
- sub.prop_enum(brush, "imagepaint_tool", 'DRAW')
- sub.prop_enum(brush, "imagepaint_tool", 'SOFTEN')
- sub.prop_enum(brush, "imagepaint_tool", 'CLONE')
- sub.prop_enum(brush, "imagepaint_tool", 'SMEAR')
+ col.template_ID_preview(toolsettings, "brush", new="brush.add", rows=3, cols=8)
if brush:
col = layout.column()
@@ -586,15 +584,15 @@ class IMAGE_PT_paint(bpy.types.Panel):
row = col.row(align=True)
row.prop(brush, "size", slider=True)
- row.prop(brush, "use_size_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_size", toggle=True, text="")
row = col.row(align=True)
row.prop(brush, "strength", slider=True)
- row.prop(brush, "use_strength_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_strength", toggle=True, text="")
row = col.row(align=True)
row.prop(brush, "jitter", slider=True)
- row.prop(brush, "use_jitter_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_jitter", toggle=True, text="")
col.prop(brush, "blend", text="Blend")
@@ -604,16 +602,26 @@ class IMAGE_PT_paint(bpy.types.Panel):
col.prop(brush, "clone_alpha", text="Alpha")
-class IMAGE_PT_paint_stroke(bpy.types.Panel):
- bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
- bl_label = "Paint Stroke"
+class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, bpy.types.Panel):
+ bl_label = "Texture"
bl_default_closed = True
- def poll(self, context):
- sima = context.space_data
+ def draw(self, context):
+ layout = self.layout
+
toolsettings = context.tool_settings.image_paint
- return sima.show_paint and toolsettings.brush
+ brush = toolsettings.brush
+
+# tex_slot = brush.texture_slot
+
+ col = layout.column()
+
+ col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
+
+
+class IMAGE_PT_paint_stroke(BrushButtonsPanel, bpy.types.Panel):
+ bl_label = "Paint Stroke"
+ bl_default_closed = True
def draw(self, context):
layout = self.layout
@@ -630,22 +638,15 @@ class IMAGE_PT_paint_stroke(bpy.types.Panel):
row = layout.row(align=True)
row.active = brush.use_space
row.prop(brush, "spacing", text="Distance", slider=True)
- row.prop(brush, "use_spacing_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_spacing", toggle=True, text="")
layout.prop(brush, "use_wrap")
-class IMAGE_PT_paint_curve(bpy.types.Panel):
- bl_space_type = 'IMAGE_EDITOR'
- bl_region_type = 'UI'
+class IMAGE_PT_paint_curve(BrushButtonsPanel, bpy.types.Panel):
bl_label = "Paint Curve"
bl_default_closed = True
- def poll(self, context):
- sima = context.space_data
- toolsettings = context.tool_settings.image_paint
- return sima.show_paint and toolsettings.brush
-
def draw(self, context):
layout = self.layout
@@ -653,43 +654,21 @@ class IMAGE_PT_paint_curve(bpy.types.Panel):
brush = toolsettings.brush
layout.template_curve_mapping(brush, "curve")
- layout.operator_menu_enum("brush.curve_preset", "shape")
-
-
-classes = [
- IMAGE_MT_view,
- IMAGE_MT_select,
- IMAGE_MT_image,
- IMAGE_MT_uvs_showhide,
- IMAGE_MT_uvs_transform,
- IMAGE_MT_uvs_snap,
- IMAGE_MT_uvs_mirror,
- IMAGE_MT_uvs_weldalign,
- IMAGE_MT_uvs,
- IMAGE_HT_header,
- IMAGE_PT_image_properties,
- IMAGE_PT_paint,
- IMAGE_PT_paint_stroke,
- IMAGE_PT_paint_curve,
- IMAGE_PT_game_properties,
- IMAGE_PT_view_properties,
- IMAGE_PT_view_histogram,
- IMAGE_PT_view_waveform,
- IMAGE_PT_view_vectorscope,
- IMAGE_PT_sample_line,
- IMAGE_PT_scope_sample]
+ row = layout.row(align=True)
+ row.operator("brush.curve_preset", icon="SMOOTHCURVE", text="").shape = 'SMOOTH'
+ row.operator("brush.curve_preset", icon="SPHERECURVE", text="").shape = 'ROUND'
+ row.operator("brush.curve_preset", icon="ROOTCURVE", text="").shape = 'ROOT'
+ row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP'
+ row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
+ row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py
index ca8371b85fe..500e80fe120 100644
--- a/release/scripts/ui/space_info.py
+++ b/release/scripts/ui/space_info.py
@@ -27,7 +27,7 @@ class INFO_HT_header(bpy.types.Header):
layout = self.layout
wm = context.manager
- if wm and len(wm.operators):
+ if wm and wm.operators:
last_op = wm.operators[-1]
else:
last_op = None
@@ -48,7 +48,7 @@ class INFO_HT_header(bpy.types.Header):
sub.menu("INFO_MT_render")
sub.menu("INFO_MT_help")
- if window.screen.fullscreen:
+ if window.screen.show_fullscreen:
layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous")
layout.separator()
else:
@@ -58,7 +58,7 @@ class INFO_HT_header(bpy.types.Header):
layout.separator()
- if rd.multiple_engines:
+ if rd.has_multiple_engines:
layout.prop(rd, "engine", text="")
layout.separator()
@@ -93,6 +93,8 @@ class INFO_MT_file(bpy.types.Menu):
layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK').check_existing = False
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.save_as_mainfile", text="Save As...")
+ layout.operator_context = 'INVOKE_AREA'
+ layout.operator("wm.save_as_mainfile", text="Save Copy...").copy = True
layout.separator()
@@ -129,7 +131,7 @@ class INFO_MT_file_import(bpy.types.Menu):
bl_label = "Import"
def draw(self, context):
- if "collada_import" in dir(bpy.ops.wm):
+ if hasattr(bpy.types, "WM_OT_collada_import"):
self.layout.operator("wm.collada_import", text="COLLADA (.dae)")
@@ -138,7 +140,7 @@ class INFO_MT_file_export(bpy.types.Menu):
bl_label = "Export"
def draw(self, context):
- if "collada_export" in dir(bpy.ops.wm):
+ if hasattr(bpy.types, "WM_OT_collada_export"):
self.layout.operator("wm.collada_export", text="COLLADA (.dae)")
@@ -263,7 +265,7 @@ class INFO_MT_game(bpy.types.Menu):
def draw(self, context):
layout = self.layout
- gs = context.scene.game_data
+ gs = context.scene.game_settings
layout.operator("view3d.game_start")
@@ -275,7 +277,7 @@ class INFO_MT_game(bpy.types.Menu):
layout.prop(gs, "use_deprecation_warnings")
layout.prop(gs, "use_animation_record")
layout.separator()
- layout.prop(gs, "auto_start")
+ layout.prop(gs, "use_auto_start")
class INFO_MT_render(bpy.types.Menu):
@@ -352,34 +354,13 @@ class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
return {'FINISHED'}
-classes = [
- INFO_HT_header,
- INFO_MT_file,
- INFO_MT_file_import,
- INFO_MT_file_export,
- INFO_MT_file_external_data,
- INFO_MT_add,
- INFO_MT_mesh_add,
- INFO_MT_curve_add,
- INFO_MT_surface_add,
- INFO_MT_armature_add,
- INFO_MT_game,
- INFO_MT_render,
- INFO_MT_help,
-
- HELP_OT_operator_cheat_sheet]
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_logic.py b/release/scripts/ui/space_logic.py
index a01a5ce6305..1272a5db9d1 100644
--- a/release/scripts/ui/space_logic.py
+++ b/release/scripts/ui/space_logic.py
@@ -25,7 +25,8 @@ class LOGIC_PT_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Properties"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
ob = context.active_object
return ob and ob.game
@@ -44,7 +45,7 @@ class LOGIC_PT_properties(bpy.types.Panel):
row.prop(prop, "name", text="")
row.prop(prop, "type", text="")
row.prop(prop, "value", text="", toggle=True) # we dont care about the type. rna will display correctly
- row.prop(prop, "debug", text="", toggle=True, icon='INFO')
+ row.prop(prop, "show_debug", text="", toggle=True, icon='INFO')
row.operator("object.game_property_remove", text="", icon='X', emboss=False).index = i
@@ -57,21 +58,43 @@ class LOGIC_MT_logicbricks_add(bpy.types.Menu):
layout.operator_menu_enum("logic.sensor_add", "type", text="Sensor")
layout.operator_menu_enum("logic.controller_add", "type", text="Controller")
layout.operator_menu_enum("logic.actuator_add", "type", text="Actuator")
+
-classes = [
- LOGIC_PT_properties, LOGIC_MT_logicbricks_add]
+class LOGIC_HT_header(bpy.types.Header):
+ bl_space_type = 'LOGIC_EDITOR'
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+ sub.menu("LOGIC_MT_view")
+ #sub.menu("LOGIC_MT_select")
+ #sub.menu("LOGIC_MT_add")
+
+
+class LOGIC_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+
+ layout.operator("logic.properties", icon='MENU_PANEL')
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_nla.py b/release/scripts/ui/space_nla.py
index 0eb342d4b15..bb979e0573e 100644
--- a/release/scripts/ui/space_nla.py
+++ b/release/scripts/ui/space_nla.py
@@ -42,7 +42,7 @@ class NLA_HT_header(bpy.types.Header):
layout.template_dopesheet_filter(st.dopesheet)
- layout.prop(st, "autosnap", text="")
+ layout.prop(st, "auto_snap", text="")
class NLA_MT_view(bpy.types.Menu):
@@ -59,8 +59,8 @@ class NLA_MT_view(bpy.types.Menu):
layout.separator()
- layout.prop(st, "realtime_updates")
- layout.prop(st, "show_cframe_indicator")
+ layout.prop(st, "use_realtime_update")
+ layout.prop(st, "show_frame_indicator")
layout.operator("anim.time_toggle", text="Show Frames" if st.show_seconds else "Show Seconds")
@@ -122,7 +122,7 @@ class NLA_MT_edit(bpy.types.Menu):
layout.separator()
# TODO: names of these tools for 'tweakmode' need changing?
- if scene.nla_tweakmode_on:
+ if scene.is_nla_tweakmode:
layout.operator("nla.tweakmode_exit", text="Stop Tweaking Strip Actions")
else:
layout.operator("nla.tweakmode_enter", text="Start Tweaking Strip Actions")
@@ -159,25 +159,12 @@ class NLA_MT_edit_transform(bpy.types.Menu):
layout.operator("transform.resize", text="Scale")
-classes = [
- NLA_HT_header, # header/menu classes
- NLA_MT_view,
- NLA_MT_select,
- NLA_MT_edit,
- NLA_MT_add,
- NLA_MT_edit_transform]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_node.py b/release/scripts/ui/space_node.py
index 365835009ba..cd1425ee122 100644
--- a/release/scripts/ui/space_node.py
+++ b/release/scripts/ui/space_node.py
@@ -66,8 +66,8 @@ class NODE_HT_header(bpy.types.Header):
scene = snode.id
layout.prop(scene, "use_nodes")
- layout.prop(scene.render, "free_unused_nodes", text="Free Unused")
- layout.prop(snode, "backdrop")
+ layout.prop(scene.render, "use_free_unused_nodes", text="Free Unused")
+ layout.prop(snode, "show_backdrop")
layout.separator()
@@ -90,6 +90,13 @@ class NODE_MT_view(bpy.types.Menu):
layout.operator("node.view_all")
+ if context.space_data.show_backdrop:
+ layout.separator()
+
+ layout.operator("node.backimage_move",text = "Backdrop move")
+ layout.operator("node.backimage_zoom",text = "Backdrop zoom in").factor = 1.2
+ layout.operator("node.backimage_zoom",text = "Backdrop zoom out").factor = 0.833
+
layout.separator()
layout.operator("screen.area_dupli")
@@ -131,6 +138,7 @@ class NODE_MT_node(bpy.types.Menu):
layout.separator()
layout.operator("node.link_make")
layout.operator("node.link_make", text="Make and Replace Links").replace = True
+ layout.operator("node.links_cut")
layout.separator()
layout.operator("node.group_edit")
@@ -152,23 +160,12 @@ class NODE_MT_node(bpy.types.Menu):
layout.operator("node.show_cyclic_dependencies")
-classes = [
- NODE_HT_header,
- NODE_MT_view,
- NODE_MT_select,
- NODE_MT_node]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_outliner.py b/release/scripts/ui/space_outliner.py
index ec3c430feaa..e170dc0322c 100644
--- a/release/scripts/ui/space_outliner.py
+++ b/release/scripts/ui/space_outliner.py
@@ -42,7 +42,7 @@ class OUTLINER_HT_header(bpy.types.Header):
layout.prop(space, "display_mode", text="")
- layout.prop(space, "display_filter", icon='VIEWZOOM', text="")
+ layout.prop(space, "filter_text", icon='VIEWZOOM', text="")
layout.separator()
@@ -73,7 +73,7 @@ class OUTLINER_MT_view(bpy.types.Menu):
col = layout.column()
if space.display_mode not in ('DATABLOCKS', 'USER_PREFERENCES', 'KEYMAPS'):
- col.prop(space, "show_restriction_columns")
+ col.prop(space, "show_restrict_columns")
col.separator()
col.operator("outliner.show_active")
@@ -96,8 +96,8 @@ class OUTLINER_MT_search(bpy.types.Menu):
col = layout.column()
- col.prop(space, "match_case_sensitive")
- col.prop(space, "match_complete")
+ col.prop(space, "use_filter_case_sensitive")
+ col.prop(space, "use_filter_complete")
class OUTLINER_MT_edit_datablocks(bpy.types.Menu):
@@ -117,23 +117,12 @@ class OUTLINER_MT_edit_datablocks(bpy.types.Menu):
col.operator("outliner.drivers_delete_selected")
-classes = [
- OUTLINER_HT_header,
- OUTLINER_MT_view,
- OUTLINER_MT_search,
- OUTLINER_MT_edit_datablocks]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py
index 97d84b77e18..ec607629757 100644
--- a/release/scripts/ui/space_sequencer.py
+++ b/release/scripts/ui/space_sequencer.py
@@ -98,6 +98,10 @@ class SEQUENCER_MT_view(bpy.types.Menu):
st = context.space_data
layout.column()
+
+ layout.operator("sequencer.properties", icon='MENU_PANEL')
+
+ layout.separator()
"""
uiBlock *block= uiBeginBlock(C, ar, "seq_viewmenu", UI_EMBOSSP);
@@ -127,7 +131,6 @@ class SEQUENCER_MT_view(bpy.types.Menu):
menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
"""
- layout.separator()
if (st.view_type == 'SEQUENCER') or (st.view_type == 'SEQUENCER_PREVIEW'):
layout.operator("sequencer.view_all", text='View all Sequences')
if (st.view_type == 'PREVIEW') or (st.view_type == 'SEQUENCER_PREVIEW'):
@@ -140,12 +143,12 @@ class SEQUENCER_MT_view(bpy.types.Menu):
layout.operator("sequencer.view_selected")
- layout.prop(st, "draw_frames")
- layout.prop(st, "show_cframe_indicator")
+ layout.prop(st, "show_frames")
+ layout.prop(st, "show_frame_indicator")
if st.display_mode == 'IMAGE':
- layout.prop(st, "draw_safe_margin")
+ layout.prop(st, "show_safe_margin")
if st.display_mode == 'WAVEFORM':
- layout.prop(st, "separate_color_preview")
+ layout.prop(st, "show_separate_color")
layout.separator()
layout.prop(st, "use_marker_sync")
@@ -309,29 +312,33 @@ class SEQUENCER_MT_strip(bpy.types.Menu):
layout.operator("sequencer.swap_data")
-class SequencerButtonsPanel(bpy.types.Panel):
+class SequencerButtonsPanel():
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
- def has_sequencer(self, context):
+ @staticmethod
+ def has_sequencer(context):
return (context.space_data.view_type == 'SEQUENCER') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
- def poll(self, context):
- return self.has_sequencer(context) and (act_strip(context) is not None)
+ @classmethod
+ def poll(cls, context):
+ return cls.has_sequencer(context) and (act_strip(context) is not None)
-class SequencerButtonsPanel_Output(bpy.types.Panel):
+class SequencerButtonsPanel_Output():
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
- def has_preview(self, context):
+ @staticmethod
+ def has_preview(context):
return (context.space_data.view_type == 'PREVIEW') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
- def poll(self, context):
- return self.has_preview(context)
+ @classmethod
+ def poll(cls, context):
+ return cls.has_preview(context)
-class SEQUENCER_PT_edit(SequencerButtonsPanel):
+class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Edit Strip"
def draw(self, context):
@@ -351,13 +358,12 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel):
split = layout.split(percentage=0.3)
split.label(text="Blend:")
- split.prop(strip, "blend_mode", text="")
+ split.prop(strip, "blend_type", text="")
row = layout.row(align=True)
sub = row.row()
sub.active = (not strip.mute)
- sub.prop(strip, "blend_opacity", text="Opacity", slider=True)
- sub = row.row()
+ sub.prop(strip, "blend_alpha", text="Opacity", slider=True)
row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
@@ -366,48 +372,25 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel):
sub.enabled = not strip.lock
sub.prop(strip, "channel")
sub.prop(strip, "frame_start")
- sub.prop(strip, "frame_final_length")
+ sub.prop(strip, "frame_final_duration")
col = layout.column(align=True)
row = col.row()
- row.label(text="Final Length: %s" % bpy.utils.smpte_from_frame(strip.frame_final_length))
+ row.label(text="Final Length: %s" % bpy.utils.smpte_from_frame(strip.frame_final_duration))
row = col.row()
- row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_length)
+ row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration)
row.label(text="Playhead: %d" % (frame_current - strip.frame_start))
col.label(text="Frame Offset %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
-class SEQUENCER_PT_preview(bpy.types.Panel):
- bl_label = "Scene Preview/Render"
- bl_space_type = 'SEQUENCE_EDITOR'
- bl_region_type = 'UI'
-
- def draw(self, context):
- layout = self.layout
- render = context.scene.render
-
- col = layout.column()
- col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
- col = layout.column()
- col.active = render.use_sequencer_gl_preview
- col.prop(render, "sequencer_gl_preview", text="")
-
- '''
- col = layout.column()
- col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
- col = layout.column()
- col.active = render.use_sequencer_gl_render
- col.prop(render, "sequencer_gl_render", text="")
- '''
-
-
-class SEQUENCER_PT_effect(SequencerButtonsPanel):
+class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Effect Strip"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -445,19 +428,19 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
flow.prop(strip, "threshold", slider=True)
flow.prop(strip, "clamp", slider=True)
flow.prop(strip, "boost_factor")
- flow.prop(strip, "blur_distance")
+ flow.prop(strip, "blur_radius")
row = layout.row()
row.prop(strip, "quality", slider=True)
- row.prop(strip, "only_boost")
+ row.prop(strip, "use_only_boost")
elif strip.type == 'SPEED':
layout.prop(strip, "global_speed")
flow = layout.column_flow()
- flow.prop(strip, "curve_velocity")
- flow.prop(strip, "curve_compress_y")
- flow.prop(strip, "frame_blending")
+ flow.prop(strip, "use_curve_velocity")
+ flow.prop(strip, "use_curve_compress_y")
+ flow.prop(strip, "use_frame_blend")
elif strip.type == 'TRANSFORM':
self.draw_panel_transform(strip)
@@ -469,10 +452,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
sub = row.row()
sub.scale_x = 2.0
- if not context.screen.animation_playing:
- sub.operator("screen.animation_play", text="", icon='PLAY')
- else:
- sub.operator("screen.animation_play", text="", icon='PAUSE')
+ sub.operator("screen.animation_play", text="", icon='PAUSE' if context.screen.is_animation_playing else 'PLAY')
row.label("Cut To")
for i in range(1, strip.channel):
@@ -483,9 +463,23 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
if strip.type == 'SPEED':
col.prop(strip, "speed_fader", text="Speed fader")
elif strip.type in ('CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'):
- col.prop(strip, "use_effect_default_fade", "Default fade")
- if not strip.use_effect_default_fade:
+ col.prop(strip, "use_default_fade", "Default fade")
+ if not strip.use_default_fade:
col.prop(strip, "effect_fader", text="Effect fader")
+
+ layout.prop(strip, "use_translation", text="Image Offset:")
+ if strip.use_translation:
+ col = layout.column(align=True)
+ col.prop(strip.transform, "offset_x", text="X")
+ col.prop(strip.transform, "offset_y", text="Y")
+
+ layout.prop(strip, "use_crop", text="Image Crop:")
+ if strip.use_crop:
+ col = layout.column(align=True)
+ col.prop(strip.crop, "max_y")
+ col.prop(strip.crop, "min_x")
+ col.prop(strip.crop, "min_y")
+ col.prop(strip.crop, "max_x")
def draw_panel_transform(self, strip):
layout = self.layout
@@ -501,8 +495,8 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
layout.separator()
col = layout.column(align=True)
- col.prop(strip, "uniform_scale")
- if (strip.uniform_scale):
+ col.prop(strip, "use_uniform_scale")
+ if (strip.use_uniform_scale):
col = layout.column(align=True)
col.prop(strip, "scale_start_x", text="Scale")
else:
@@ -518,11 +512,12 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
col.prop(strip, "rotation_start", text="Rotation")
-class SEQUENCER_PT_input(SequencerButtonsPanel):
+class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Strip Input"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -536,15 +531,41 @@ class SEQUENCER_PT_input(SequencerButtonsPanel):
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
'MULTICAM', 'SPEED')
- def draw_filename(self, context):
- pass
-
def draw(self, context):
layout = self.layout
strip = act_strip(context)
- self.draw_filename(context)
+ seq_type = strip.type
+
+ # draw a filename if we have one
+ if seq_type == 'IMAGE':
+ split = layout.split(percentage=0.2)
+ col = split.column()
+ col.label(text="Path:")
+ col = split.column()
+ col.prop(strip, "directory", text="")
+
+ # Current element for the filename
+
+ elem = strip.getStripElem(context.scene.frame_current)
+ if elem:
+ split = layout.split(percentage=0.2)
+ col = split.column()
+ col.label(text="File:")
+ col = split.column()
+ col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
+
+ elif seq_type == 'MOVIE':
+ split = layout.split(percentage=0.2)
+ col = split.column()
+ col.label(text="Path:")
+ col = split.column()
+ col.prop(strip, "filepath", text="")
+ col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
+ # TODO, sound???
+ # end drawing filename
+
layout.prop(strip, "use_translation", text="Image Offset:")
if strip.use_translation:
@@ -555,99 +576,23 @@ class SEQUENCER_PT_input(SequencerButtonsPanel):
layout.prop(strip, "use_crop", text="Image Crop:")
if strip.use_crop:
col = layout.column(align=True)
- col.prop(strip.crop, "top")
- col.prop(strip.crop, "left")
- col.prop(strip.crop, "bottom")
- col.prop(strip.crop, "right")
+ col.prop(strip.crop, "max_y")
+ col.prop(strip.crop, "min_x")
+ col.prop(strip.crop, "min_y")
+ col.prop(strip.crop, "max_x")
col = layout.column(align=True)
col.label(text="Trim Duration:")
- col.prop(strip, "animation_start_offset", text="Start")
- col.prop(strip, "animation_end_offset", text="End")
-
-
-class SEQUENCER_PT_input_movie(SEQUENCER_PT_input):
- bl_label = "Strip Input"
-
- def poll(self, context):
- if not self.has_sequencer(context):
- return False
-
- strip = act_strip(context)
- if not strip:
- return False
-
- return strip.type == 'MOVIE'
-
- def draw_filename(self, context):
- layout = self.layout
-
- strip = act_strip(context)
-
- split = layout.split(percentage=0.2)
- col = split.column()
- col.label(text="Path:")
- col = split.column()
- col.prop(strip, "filepath", text="")
-
-
-class SEQUENCER_PT_input_image(SEQUENCER_PT_input):
- bl_label = "Strip Input"
-
- def poll(self, context):
- if not self.has_sequencer(context):
- return False
-
- strip = act_strip(context)
- if not strip:
- return False
-
- return strip.type == 'IMAGE'
-
- def draw_filename(self, context):
- layout = self.layout
-
- strip = act_strip(context)
-
- split = layout.split(percentage=0.2)
- col = split.column()
- col.label(text="Path:")
- col = split.column()
- col.prop(strip, "directory", text="")
-
- # Current element for the filename
-
- elem = strip.getStripElem(context.scene.frame_current)
- if elem:
- split = layout.split(percentage=0.2)
- col = split.column()
- col.label(text="File:")
- col = split.column()
- col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
+ col.prop(strip, "frame_offset_start", text="Start")
+ col.prop(strip, "frame_offset_end", text="End")
-class SEQUENCER_PT_input_secondary(SEQUENCER_PT_input):
- bl_label = "Strip Input"
-
- def poll(self, context):
- if not self.has_sequencer(context):
- return False
-
- strip = act_strip(context)
- if not strip:
- return False
-
- return strip.type in ('SCENE', 'META')
-
- def draw_filename(self, context):
- pass
-
-
-class SEQUENCER_PT_sound(SequencerButtonsPanel):
+class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Sound"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -672,22 +617,23 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel):
else:
row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack")
- row.prop(strip.sound, "caching")
+ row.prop(strip.sound, "use_memory_cache")
layout.prop(strip, "volume")
layout.prop(strip, "attenuation")
col = layout.column(align=True)
col.label(text="Trim Duration:")
- col.prop(strip, "animation_start_offset", text="Start")
- col.prop(strip, "animation_end_offset", text="End")
+ col.prop(strip, "animation_offset_start", text="Start")
+ col.prop(strip, "animation_offset_end", text="End")
-class SEQUENCER_PT_scene(SequencerButtonsPanel):
+class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Scene"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -707,11 +653,12 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel):
layout.template_ID(strip, "scene_camera")
-class SEQUENCER_PT_filter(SequencerButtonsPanel):
+class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Filter"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -736,19 +683,19 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel):
row = layout.row()
row.label(text="Flip:")
- row.prop(strip, "flip_x", text="X")
- row.prop(strip, "flip_y", text="Y")
+ row.prop(strip, "use_flip_x", text="X")
+ row.prop(strip, "use_flip_y", text="Y")
col = layout.column()
- col.prop(strip, "reverse_frames", text="Backwards")
- col.prop(strip, "de_interlace")
+ col.prop(strip, "use_reverse_frames", text="Backwards")
+ col.prop(strip, "use_deinterlace")
col = layout.column()
col.label(text="Colors:")
col.prop(strip, "color_saturation", text="Saturation")
- col.prop(strip, "multiply_colors", text="Multiply")
- col.prop(strip, "premultiply")
- col.prop(strip, "convert_float")
+ col.prop(strip, "color_multiply", text="Multiply")
+ col.prop(strip, "use_premultiply")
+ col.prop(strip, "use_float")
layout.prop(strip, "use_color_balance")
if strip.use_color_balance and strip.color_balance: # TODO - need to add this somehow
@@ -757,22 +704,23 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel):
col = row.column()
col.template_color_wheel(strip.color_balance, "lift", value_slider=False, cubic=True)
col.row().prop(strip.color_balance, "lift")
- col.prop(strip.color_balance, "inverse_lift", text="Inverse")
+ col.prop(strip.color_balance, "invert_lift", text="Inverse")
col = row.column()
col.template_color_wheel(strip.color_balance, "gamma", value_slider=False, lock_luminosity=True, cubic=True)
col.row().prop(strip.color_balance, "gamma")
- col.prop(strip.color_balance, "inverse_gamma", text="Inverse")
+ col.prop(strip.color_balance, "invert_gamma", text="Inverse")
col = row.column()
col.template_color_wheel(strip.color_balance, "gain", value_slider=False, lock_luminosity=True, cubic=True)
col.row().prop(strip.color_balance, "gain")
- col.prop(strip.color_balance, "inverse_gain", text="Inverse")
+ col.prop(strip.color_balance, "invert_gain", text="Inverse")
-class SEQUENCER_PT_proxy(SequencerButtonsPanel):
+class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Proxy"
- def poll(self, context):
- if not self.has_sequencer(context):
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
return False
strip = act_strip(context)
@@ -792,16 +740,40 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel):
strip = act_strip(context)
flow = layout.column_flow()
- flow.prop(strip, "proxy_custom_directory")
- flow.prop(strip, "proxy_custom_file")
+ flow.prop(strip, "use_proxy_custom_directory")
+ flow.prop(strip, "use_proxy_custom_file")
if strip.proxy: # TODO - need to add this somehow
- if strip.proxy_custom_directory and not strip.proxy_custom_file:
+ if strip.proxy_custom_directory and not strip.use_proxy_custom_file:
flow.prop(strip.proxy, "directory")
- if strip.proxy_custom_file:
+ if strip.use_proxy_custom_file:
flow.prop(strip.proxy, "filepath")
-class SEQUENCER_PT_view(SequencerButtonsPanel_Output):
+class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, bpy.types.Panel):
+ bl_label = "Scene Preview/Render"
+ bl_space_type = 'SEQUENCE_EDITOR'
+ bl_region_type = 'UI'
+
+ def draw(self, context):
+ layout = self.layout
+ render = context.scene.render
+
+ col = layout.column()
+ col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
+ col = layout.column()
+ col.active = render.use_sequencer_gl_preview
+ col.prop(render, "sequencer_gl_preview", text="")
+
+ '''
+ col = layout.column()
+ col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
+ col = layout.column()
+ col.active = render.use_sequencer_gl_render
+ col.prop(render, "sequencer_gl_render", text="")
+ '''
+
+
+class SEQUENCER_PT_view(SequencerButtonsPanel_Output, bpy.types.Panel):
bl_label = "View Settings"
def draw(self, context):
@@ -812,45 +784,17 @@ class SEQUENCER_PT_view(SequencerButtonsPanel_Output):
col = layout.column()
if st.display_mode == 'IMAGE':
col.prop(st, "draw_overexposed") # text="Zebra"
- col.prop(st, "draw_safe_margin")
+ col.prop(st, "show_safe_margin")
if st.display_mode == 'WAVEFORM':
- col.prop(st, "separate_color_preview")
+ col.prop(st, "show_separate_color")
col.prop(st, "proxy_render_size")
-classes = [
- SEQUENCER_HT_header, # header/menu classes
- SEQUENCER_MT_view,
- SEQUENCER_MT_view_toggle,
- SEQUENCER_MT_select,
- SEQUENCER_MT_marker,
- SEQUENCER_MT_add,
- SEQUENCER_MT_add_effect,
- SEQUENCER_MT_strip,
-
- SEQUENCER_PT_edit, # sequencer panels
- SEQUENCER_PT_preview,
- SEQUENCER_PT_effect,
- SEQUENCER_PT_input_movie,
- SEQUENCER_PT_input_image,
- SEQUENCER_PT_input_secondary,
- SEQUENCER_PT_sound,
- SEQUENCER_PT_scene,
- SEQUENCER_PT_filter,
- SEQUENCER_PT_proxy,
-
- SEQUENCER_PT_view] # view panels
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py
index 692f1581bd6..0b7e215dc37 100644
--- a/release/scripts/ui/space_text.py
+++ b/release/scripts/ui/space_text.py
@@ -34,12 +34,13 @@ class TEXT_HT_header(bpy.types.Header):
if context.area.show_menus:
sub = row.row(align=True)
+ sub.menu("TEXT_MT_view")
sub.menu("TEXT_MT_text")
if text:
sub.menu("TEXT_MT_edit")
sub.menu("TEXT_MT_format")
- if text and text.modified:
+ if text and text.is_modified:
row = layout.row()
# row.color(redalert)
row.operator("text.resolve_conflict", text="", icon='HELP')
@@ -47,9 +48,9 @@ class TEXT_HT_header(bpy.types.Header):
layout.template_ID(st, "text", new="text.new", unlink="text.unlink")
row = layout.row(align=True)
- row.prop(st, "line_numbers", text="")
- row.prop(st, "word_wrap", text="")
- row.prop(st, "syntax_highlight", text="")
+ row.prop(st, "show_line_numbers", text="")
+ row.prop(st, "show_word_wrap", text="")
+ row.prop(st, "show_syntax_highlight", text="")
if text:
row = layout.row()
@@ -61,7 +62,7 @@ class TEXT_HT_header(bpy.types.Header):
row = layout.row()
if text.filepath:
- if text.dirty:
+ if text.is_dirty:
row.label(text="File: *%s (unsaved)" % text.filepath)
else:
row.label(text="File: %s" % text.filepath)
@@ -80,10 +81,11 @@ class TEXT_PT_properties(bpy.types.Panel):
st = context.space_data
flow = layout.column_flow()
- flow.prop(st, "line_numbers")
- flow.prop(st, "word_wrap")
- flow.prop(st, "syntax_highlight")
- flow.prop(st, "live_edit")
+ flow.prop(st, "show_line_numbers")
+ flow.prop(st, "show_word_wrap")
+ flow.prop(st, "show_syntax_highlight")
+ flow.prop(st, "show_line_highlight")
+ flow.prop(st, "use_live_edit")
flow = layout.column_flow()
flow.prop(st, "font_size")
@@ -91,7 +93,7 @@ class TEXT_PT_properties(bpy.types.Panel):
text = st.text
if text:
- flow.prop(text, "tabs_as_spaces")
+ flow.prop(text, "use_tabs_as_spaces")
class TEXT_PT_find(bpy.types.Panel):
@@ -123,10 +125,29 @@ class TEXT_PT_find(bpy.types.Panel):
# settings
row = layout.row()
- row.prop(st, "find_wrap", text="Wrap")
- row.prop(st, "find_all", text="All")
+ row.prop(st, "use_find_wrap", text="Wrap")
+ row.prop(st, "use_find_all", text="All")
+class TEXT_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("text.properties", icon='MENU_PANEL')
+
+ layout.separator()
+
+ layout.operator("screen.area_dupli")
+ layout.operator("screen.screen_full_area")
+
+ layout.separator()
+
+ layout.operator("text.move", text="Top of File").type = 'FILE_TOP'
+ layout.operator("text.move", text="Bottom of File").type = 'FILE_BOTTOM'
+
+
class TEXT_MT_text(bpy.types.Menu):
bl_label = "Text"
@@ -160,15 +181,8 @@ class TEXT_MT_text(bpy.types.Menu):
layout.separator()
- layout.operator("text.properties", icon='MENU_PANEL')
-
layout.menu("TEXT_MT_templates")
- layout.separator()
-
- layout.operator("screen.area_dupli")
- layout.operator("screen.screen_full_area")
-
class TEXT_MT_templates(bpy.types.Menu):
'''
@@ -180,16 +194,6 @@ class TEXT_MT_templates(bpy.types.Menu):
self.path_menu(bpy.utils.script_paths("templates"), "text.open", {"internal": True})
-class TEXT_MT_edit_view(bpy.types.Menu):
- bl_label = "View"
-
- def draw(self, context):
- layout = self.layout
-
- layout.operator("text.move", text="Top of File").type = 'FILE_TOP'
- layout.operator("text.move", text="Bottom of File").type = 'FILE_BOTTOM'
-
-
class TEXT_MT_edit_select(bpy.types.Menu):
bl_label = "Select"
@@ -243,7 +247,8 @@ class TEXT_MT_edit_to3d(bpy.types.Menu):
class TEXT_MT_edit(bpy.types.Menu):
bl_label = "Edit"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.space_data.text)
def draw(self, context):
@@ -260,7 +265,6 @@ class TEXT_MT_edit(bpy.types.Menu):
layout.separator()
- layout.menu("TEXT_MT_edit_view")
layout.menu("TEXT_MT_edit_select")
layout.menu("TEXT_MT_edit_markers")
@@ -289,32 +293,12 @@ class TEXT_MT_toolbox(bpy.types.Menu):
layout.operator("text.run_script")
-
-classes = [
- TEXT_HT_header,
- TEXT_PT_properties,
- TEXT_PT_find,
- TEXT_MT_text,
- TEXT_MT_templates,
- TEXT_MT_format,
- TEXT_MT_edit,
- TEXT_MT_edit_view,
- TEXT_MT_edit_select,
- TEXT_MT_edit_markers,
- TEXT_MT_edit_to3d,
- TEXT_MT_toolbox]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_time.py b/release/scripts/ui/space_time.py
index 042e4dbc015..cfd8401b46b 100644
--- a/release/scripts/ui/space_time.py
+++ b/release/scripts/ui/space_time.py
@@ -46,8 +46,8 @@ class TIME_HT_header(bpy.types.Header):
row.prop(scene, "frame_start", text="Start")
row.prop(scene, "frame_end", text="End")
else:
- row.prop(scene, "preview_range_frame_start", text="Start")
- row.prop(scene, "preview_range_frame_end", text="End")
+ row.prop(scene, "frame_preview_start", text="Start")
+ row.prop(scene, "frame_preview_end", text="End")
layout.prop(scene, "frame_current", text="")
@@ -56,7 +56,7 @@ class TIME_HT_header(bpy.types.Header):
row = layout.row(align=True)
row.operator("screen.frame_jump", text="", icon='REW').end = False
row.operator("screen.keyframe_jump", text="", icon='PREV_KEYFRAME').next = False
- if not screen.animation_playing:
+ if not screen.is_animation_playing:
row.operator("screen.animation_play", text="", icon='PLAY_REVERSE').reverse = True
row.operator("screen.animation_play", text="", icon='PLAY')
else:
@@ -67,17 +67,17 @@ class TIME_HT_header(bpy.types.Header):
row.operator("screen.frame_jump", text="", icon='FF').end = True
row = layout.row(align=True)
- row.prop(tools, "use_auto_keying", text="", toggle=True)
- if screen.animation_playing and tools.use_auto_keying:
+ row.prop(tools, "use_keyframe_insert_auto", text="", toggle=True)
+ if screen.is_animation_playing and tools.use_keyframe_insert_auto:
subsub = row.row()
- subsub.prop(tools, "record_with_nla", toggle=True)
+ subsub.prop(tools, "use_record_with_nla", toggle=True)
layout.prop(scene, "sync_mode", text="")
layout.separator()
row = layout.row(align=True)
- row.prop_object(scene, "active_keying_set", scene, "all_keying_sets", text="")
+ row.prop_object(scene, "active_keying_set", scene, "keying_sets_all", text="")
row.operator("anim.keyframe_insert", text="", icon='KEY_HLT')
row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT')
@@ -95,8 +95,8 @@ class TIME_MT_view(bpy.types.Menu):
layout.separator()
- layout.prop(st, "show_cframe_indicator")
- layout.prop(st, "only_selected")
+ layout.prop(st, "show_frame_indicator")
+ layout.prop(st, "show_only_selected")
layout.separator()
@@ -141,7 +141,7 @@ class TIME_MT_frame(bpy.types.Menu):
# it was ok for riscos... ok TODO, operator
for marker in context.scene.timeline_markers:
- if marker.selected:
+ if marker.select:
layout.separator()
layout.prop(marker, "name", text="", icon='MARKER_HLT')
break
@@ -166,20 +166,20 @@ class TIME_MT_playback(bpy.types.Menu):
st = context.space_data
scene = context.scene
- layout.prop(st, "play_top_left")
- layout.prop(st, "play_all_3d")
- layout.prop(st, "play_anim")
- layout.prop(st, "play_buttons")
- layout.prop(st, "play_image")
- layout.prop(st, "play_sequencer")
- layout.prop(st, "play_nodes")
+ layout.prop(st, "use_play_top_left_3d_editor")
+ layout.prop(st, "use_play_3d_editors")
+ layout.prop(st, "use_play_animation_editors")
+ layout.prop(st, "use_play_properties_editors")
+ layout.prop(st, "use_play_image_editors")
+ layout.prop(st, "use_play_sequence_editors")
+ layout.prop(st, "use_play_node_editors")
layout.separator()
- layout.prop(scene, "frame_drop", text="Frame Dropping")
- layout.prop(scene, "sync_audio", text="AV-sync", icon='SPEAKER')
- layout.prop(scene, "mute_audio")
- layout.prop(scene, "scrub_audio")
+ layout.prop(scene, "use_frame_drop", text="Frame Dropping")
+ layout.prop(scene, "use_audio_sync", text="AV-sync", icon='SPEAKER')
+ layout.prop(scene, "use_audio")
+ layout.prop(scene, "use_audio_scrub")
class TIME_MT_autokey(bpy.types.Menu):
@@ -189,28 +189,15 @@ class TIME_MT_autokey(bpy.types.Menu):
layout = self.layout
tools = context.tool_settings
- layout.prop_enum(tools, "autokey_mode", 'ADD_REPLACE_KEYS')
- layout.prop_enum(tools, "autokey_mode", 'REPLACE_KEYS')
-
-classes = [
- TIME_HT_header,
- TIME_MT_view,
- TIME_MT_cache,
- TIME_MT_frame,
- TIME_MT_autokey,
- TIME_MT_playback]
-
+ layout.prop_enum(tools, "auto_keying_mode", 'ADD_REPLACE_KEYS')
+ layout.prop_enum(tools, "auto_keying_mode", 'REPLACE_KEYS')
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index 61f759a1d83..feeae5d3f9b 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -45,9 +45,9 @@ def ui_items_general(col, context):
colsub = padding.column()
colsub.row().prop(context, "text")
colsub.row().prop(context, "text_sel")
- colsub.prop(context, "shaded")
+ colsub.prop(context, "show_shaded")
subsub = colsub.column(align=True)
- subsub.active = context.shaded
+ subsub.active = context.show_shaded
subsub.prop(context, "shadetop")
subsub.prop(context, "shadedown")
@@ -57,13 +57,10 @@ def ui_items_general(col, context):
def opengl_lamp_buttons(column, lamp):
split = column.split(percentage=0.1)
- if lamp.enabled == True:
- split.prop(lamp, "enabled", text="", icon='OUTLINER_OB_LAMP')
- else:
- split.prop(lamp, "enabled", text="", icon='LAMP_DATA')
+ split.prop(lamp, "use", text="", icon='OUTLINER_OB_LAMP' if lamp.use else 'LAMP_DATA')
col = split.column()
- col.active = lamp.enabled
+ col.active = lamp.use
row = col.row()
row.label(text="Diffuse:")
row.prop(lamp, "diffuse_color", text="")
@@ -72,7 +69,7 @@ def opengl_lamp_buttons(column, lamp):
row.prop(lamp, "specular_color", text="")
col = split.column()
- col.active = lamp.enabled
+ col.active = lamp.use
col.prop(lamp, "direction", text="")
@@ -91,15 +88,12 @@ class USERPREF_HT_header(bpy.types.Header):
layout.operator_context = 'INVOKE_DEFAULT'
if userpref.active_section == 'INPUT':
- op = layout.operator("wm.keyconfig_export")
- op.filepath = "keymap.py"
- op = layout.operator("wm.keyconfig_import")
- op.filepath = "keymap.py"
+ layout.operator("wm.keyconfig_export")
+ layout.operator("wm.keyconfig_import")
elif userpref.active_section == 'ADDONS':
- op = layout.operator("wm.addon_install")
- op.filepath = "*.py"
+ layout.operator("wm.addon_install")
elif userpref.active_section == 'THEMES':
- op = layout.operator("ui.reset_default_theme")
+ layout.operator("ui.reset_default_theme")
class USERPREF_PT_tabs(bpy.types.Panel):
@@ -142,7 +136,8 @@ class USERPREF_PT_interface(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'INTERFACE')
@@ -156,12 +151,12 @@ class USERPREF_PT_interface(bpy.types.Panel):
col = row.column()
col.label(text="Display:")
- col.prop(view, "tooltips")
- col.prop(view, "display_object_info", text="Object Info")
- col.prop(view, "use_large_cursors")
+ col.prop(view, "show_tooltips")
+ col.prop(view, "show_object_info", text="Object Info")
+ col.prop(view, "show_large_cursors")
col.prop(view, "show_view_name", text="View Name")
col.prop(view, "show_playback_fps", text="Playback FPS")
- col.prop(view, "global_scene")
+ col.prop(view, "use_global_scene")
col.prop(view, "object_origin_size")
col.separator()
@@ -170,30 +165,24 @@ class USERPREF_PT_interface(bpy.types.Panel):
col.prop(view, "show_mini_axis", text="Display Mini Axis")
sub = col.column()
- sub.enabled = view.show_mini_axis
+ sub.active = view.show_mini_axis
sub.prop(view, "mini_axis_size", text="Size")
sub.prop(view, "mini_axis_brightness", text="Brightness")
col.separator()
- col.separator()
- col.separator()
-
- col.label(text="Properties Window:")
- col.prop(view, "properties_width_check")
-
row.separator()
row.separator()
col = row.column()
col.label(text="View Manipulation:")
- col.prop(view, "auto_depth")
- col.prop(view, "zoom_to_mouse")
- col.prop(view, "rotate_around_selection")
- col.prop(view, "global_pivot")
+ col.prop(view, "use_mouse_auto_depth")
+ col.prop(view, "use_zoom_to_mouse")
+ col.prop(view, "use_rotate_around_active")
+ col.prop(view, "use_global_pivot")
col.separator()
- col.prop(view, "auto_perspective")
+ col.prop(view, "use_auto_perspective")
col.prop(view, "smooth_view")
col.prop(view, "rotation_angle")
@@ -201,7 +190,7 @@ class USERPREF_PT_interface(bpy.types.Panel):
col.separator()
col.label(text="2D Viewports:")
- col.prop(view, "view2d_grid_minimum_spacing", text="Minimum Grid Spacing")
+ col.prop(view, "view2d_grid_spacing_min", text="Minimum Grid Spacing")
col.prop(view, "timecode_style")
row.separator()
@@ -210,13 +199,13 @@ class USERPREF_PT_interface(bpy.types.Panel):
col = row.column()
#Toolbox doesn't exist yet
#col.label(text="Toolbox:")
- #col.prop(view, "use_column_layout")
+ #col.prop(view, "show_column_layout")
#col.label(text="Open Toolbox Delay:")
#col.prop(view, "open_left_mouse_delay", text="Hold LMB")
#col.prop(view, "open_right_mouse_delay", text="Hold RMB")
- col.prop(view, "use_manipulator")
+ col.prop(view, "show_manipulator")
sub = col.column()
- sub.enabled = view.use_manipulator
+ sub.active = view.show_manipulator
sub.prop(view, "manipulator_size", text="Size")
sub.prop(view, "manipulator_handle_size", text="Handle Size")
sub.prop(view, "manipulator_hotspot", text="Hotspot")
@@ -226,7 +215,7 @@ class USERPREF_PT_interface(bpy.types.Panel):
col.separator()
col.label(text="Menus:")
- col.prop(view, "open_mouse_over")
+ col.prop(view, "use_mouse_over_open")
col.label(text="Menu Open Delay:")
col.prop(view, "open_toplevel_delay", text="Top Level")
col.prop(view, "open_sublevel_delay", text="Sub Level")
@@ -242,7 +231,8 @@ class USERPREF_PT_edit(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'EDITING')
@@ -263,7 +253,7 @@ class USERPREF_PT_edit(bpy.types.Panel):
col.separator()
col.label(text="New Objects:")
- col.prop(edit, "enter_edit_mode")
+ col.prop(edit, "use_enter_edit_mode")
col.label(text="Align To:")
col.prop(edit, "object_align", text="")
@@ -272,7 +262,7 @@ class USERPREF_PT_edit(bpy.types.Panel):
col.separator()
col.label(text="Undo:")
- col.prop(edit, "global_undo")
+ col.prop(edit, "use_global_undo")
col.prop(edit, "undo_steps", text="Steps")
col.prop(edit, "undo_memory_limit", text="Memory Limit")
@@ -283,9 +273,9 @@ class USERPREF_PT_edit(bpy.types.Panel):
col.label(text="Grease Pencil:")
col.prop(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
col.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
- #col.prop(edit, "grease_pencil_simplify_stroke", text="Simplify Stroke")
+ #col.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify Stroke")
col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
- col.prop(edit, "grease_pencil_smooth_stroke", text="Smooth Stroke")
+ col.prop(edit, "use_grease_pencil_smooth_stroke", text="Smooth Stroke")
col.separator()
col.separator()
col.separator()
@@ -298,7 +288,7 @@ class USERPREF_PT_edit(bpy.types.Panel):
col = row.column()
col.label(text="Keyframing:")
col.prop(edit, "use_visual_keying")
- col.prop(edit, "keyframe_insert_needed", text="Only Insert Needed")
+ col.prop(edit, "use_keyframe_insert_needed", text="Only Insert Needed")
col.separator()
@@ -306,55 +296,48 @@ class USERPREF_PT_edit(bpy.types.Panel):
sub = col.column()
- # sub.active = edit.use_auto_keying # incorrect, timeline can enable
- sub.prop(edit, "auto_keyframe_insert_keyingset", text="Only Insert for Keying Set")
- sub.prop(edit, "auto_keyframe_insert_available", text="Only Insert Available")
+ # sub.active = edit.use_keyframe_insert_auto # incorrect, timeline can enable
+ sub.prop(edit, "use_keyframe_insert_keyingset", text="Only Insert for Keying Set")
+ sub.prop(edit, "use_keyframe_insert_available", text="Only Insert Available")
col.separator()
col.label(text="New F-Curve Defaults:")
col.prop(edit, "keyframe_new_interpolation_type", text="Interpolation")
col.prop(edit, "keyframe_new_handle_type", text="Handles")
- col.prop(edit, "insertkey_xyz_to_rgb", text="XYZ to RGB")
+ col.prop(edit, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
col.separator()
col.separator()
col.separator()
col.label(text="Transform:")
- col.prop(edit, "drag_immediately")
+ col.prop(edit, "use_drag_immediately")
row.separator()
row.separator()
- sculpt = context.tool_settings.sculpt
col = row.column()
- col.label(text="Paint and Sculpt:")
- col.prop(edit, "sculpt_paint_use_unified_size", text="Unify Size")
- col.prop(edit, "sculpt_paint_use_unified_strength", text="Unify Strength")
row = col.row(align=True)
- row.label("Overlay Color:")
- row.prop(edit, "sculpt_paint_overlay_col", text="")
- col.prop(sculpt, "use_openmp", text="Threaded Sculpt")
- col.prop(sculpt, "show_brush")
+ row.prop(edit, "sculpt_paint_overlay_color", text="Sculpt Overlay Color")
col.separator()
col.separator()
col.separator()
col.label(text="Duplicate Data:")
- col.prop(edit, "duplicate_mesh", text="Mesh")
- col.prop(edit, "duplicate_surface", text="Surface")
- col.prop(edit, "duplicate_curve", text="Curve")
- col.prop(edit, "duplicate_text", text="Text")
- col.prop(edit, "duplicate_metaball", text="Metaball")
- col.prop(edit, "duplicate_armature", text="Armature")
- col.prop(edit, "duplicate_lamp", text="Lamp")
- col.prop(edit, "duplicate_material", text="Material")
- col.prop(edit, "duplicate_texture", text="Texture")
- col.prop(edit, "duplicate_fcurve", text="F-Curve")
- col.prop(edit, "duplicate_action", text="Action")
- col.prop(edit, "duplicate_particle", text="Particle")
+ col.prop(edit, "use_duplicate_mesh", text="Mesh")
+ col.prop(edit, "use_duplicate_surface", text="Surface")
+ col.prop(edit, "use_duplicate_curve", text="Curve")
+ col.prop(edit, "use_duplicate_text", text="Text")
+ col.prop(edit, "use_duplicate_metaball", text="Metaball")
+ col.prop(edit, "use_duplicate_armature", text="Armature")
+ col.prop(edit, "use_duplicate_lamp", text="Lamp")
+ col.prop(edit, "use_duplicate_material", text="Material")
+ col.prop(edit, "use_duplicate_texture", text="Texture")
+ #col.prop(edit, "use_duplicate_fcurve", text="F-Curve")
+ col.prop(edit, "use_duplicate_action", text="Action")
+ col.prop(edit, "use_duplicate_particle", text="Particle")
class USERPREF_PT_system(bpy.types.Panel):
@@ -363,7 +346,8 @@ class USERPREF_PT_system(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'SYSTEM')
@@ -385,8 +369,8 @@ class USERPREF_PT_system(bpy.types.Panel):
col.prop(system, "dpi")
col.prop(system, "frame_server_port")
col.prop(system, "scrollback", text="Console Scrollback")
- col.prop(system, "auto_execute_scripts")
- col.prop(system, "tabs_as_spaces")
+ col.prop(system, "use_scripts_auto_execute")
+ col.prop(system, "use_tabs_as_spaces")
col.separator()
col.separator()
@@ -396,7 +380,7 @@ class USERPREF_PT_system(bpy.types.Panel):
col.row().prop(system, "audio_device", expand=True)
sub = col.column()
sub.active = system.audio_device != 'NONE'
- #sub.prop(system, "enable_all_codecs")
+ #sub.prop(system, "use_preview_images")
sub.prop(system, "audio_channels", text="Channels")
sub.prop(system, "audio_mixing_buffer", text="Mixing Buffer")
sub.prop(system, "audio_sample_rate", text="Sample Rate")
@@ -419,9 +403,9 @@ class USERPREF_PT_system(bpy.types.Panel):
# No translation in 2.5 yet
#col.prop(system, "language")
#col.label(text="Translate:")
- #col.prop(system, "translate_tooltips", text="Tooltips")
- #col.prop(system, "translate_buttons", text="Labels")
- #col.prop(system, "translate_toolbox", text="Toolbox")
+ #col.prop(system, "use_translate_tooltips", text="Tooltips")
+ #col.prop(system, "use_translate_buttons", text="Labels")
+ #col.prop(system, "use_translate_toolbox", text="Toolbox")
#col.separator()
@@ -434,9 +418,9 @@ class USERPREF_PT_system(bpy.types.Panel):
col = colsplit.column()
col.label(text="OpenGL:")
- col.prop(system, "clip_alpha", slider=True)
+ col.prop(system, "gl_clip_alpha", slider=True)
col.prop(system, "use_mipmaps")
- col.prop(system, "use_vbos")
+ col.prop(system, "use_vertex_buffer_objects")
#Anti-aliasing is disabled as it breaks broder/lasso select
#col.prop(system, "use_antialiasing")
col.label(text="Window Draw Method:")
@@ -527,7 +511,8 @@ class USERPREF_PT_theme(bpy.types.Panel):
for i, attr in enumerate(props_ls):
colsub_pair[i % 2].row().prop(themedata, attr)
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'THEMES')
@@ -659,7 +644,8 @@ class USERPREF_PT_file(bpy.types.Panel):
bl_region_type = 'WINDOW'
bl_show_header = False
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'FILES')
@@ -690,13 +676,13 @@ class USERPREF_PT_file(bpy.types.Panel):
sub.label(text="Animation Player:")
sub = col1.column()
- sub.prop(paths, "fonts_directory", text="")
- sub.prop(paths, "textures_directory", text="")
+ sub.prop(paths, "font_directory", text="")
+ sub.prop(paths, "texture_directory", text="")
sub.prop(paths, "texture_plugin_directory", text="")
sub.prop(paths, "sequence_plugin_directory", text="")
sub.prop(paths, "render_output_directory", text="")
- sub.prop(paths, "python_scripts_directory", text="")
- sub.prop(paths, "sounds_directory", text="")
+ sub.prop(paths, "script_directory", text="")
+ sub.prop(paths, "sound_directory", text="")
sub.prop(paths, "temporary_directory", text="")
sub.prop(paths, "image_editor", text="")
subsplit = sub.split(percentage=0.3)
@@ -706,10 +692,10 @@ class USERPREF_PT_file(bpy.types.Panel):
col = split.column()
col.label(text="Save & Load:")
col.prop(paths, "use_relative_paths")
- col.prop(paths, "compress_file")
- col.prop(paths, "load_ui")
- col.prop(paths, "filter_file_extensions")
- col.prop(paths, "hide_dot_files_datablocks")
+ col.prop(paths, "use_file_compression")
+ col.prop(paths, "use_load_ui")
+ col.prop(paths, "use_filter_files")
+ col.prop(paths, "show_hidden_files_datablocks")
col.separator()
col.separator()
@@ -717,10 +703,10 @@ class USERPREF_PT_file(bpy.types.Panel):
col.label(text="Auto Save:")
col.prop(paths, "save_version")
col.prop(paths, "recent_files")
- col.prop(paths, "save_preview_images")
- col.prop(paths, "auto_save_temporary_files")
+ col.prop(paths, "use_save_preview_images")
+ col.prop(paths, "use_auto_save_temporary_files")
sub = col.column()
- sub.enabled = paths.auto_save_temporary_files
+ sub.active = paths.use_auto_save_temporary_files
sub.prop(paths, "auto_save_time", text="Timer (mins)")
from space_userpref_keymap import InputKeyMapPanel
@@ -730,7 +716,8 @@ class USERPREF_PT_input(InputKeyMapPanel):
bl_space_type = 'USER_PREFERENCES'
bl_label = "Input"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'INPUT')
@@ -748,38 +735,39 @@ class USERPREF_PT_input(InputKeyMapPanel):
sub.label(text="Mouse:")
sub1 = sub.column()
- sub1.enabled = (inputs.select_mouse == 'RIGHT')
- sub1.prop(inputs, "emulate_3_button_mouse")
- sub.prop(inputs, "continuous_mouse")
+ sub1.active = (inputs.select_mouse == 'RIGHT')
+ sub1.prop(inputs, "use_mouse_emulate_3_button")
+ sub.prop(inputs, "use_mouse_continuous")
sub.label(text="Select With:")
sub.row().prop(inputs, "select_mouse", expand=True)
sub = col.column()
sub.label(text="Double Click:")
- sub.prop(inputs, "double_click_time", text="Speed")
+ sub.prop(inputs, "mouse_double_click_time", text="Speed")
sub.separator()
- sub.prop(inputs, "emulate_numpad")
+ sub.prop(inputs, "use_emulate_numpad")
sub.separator()
sub.label(text="Orbit Style:")
- sub.row().prop(inputs, "view_rotation", expand=True)
+ sub.row().prop(inputs, "view_rotate_method", expand=True)
sub.label(text="Zoom Style:")
- sub.row().prop(inputs, "zoom_style", text="")
- if inputs.zoom_style == 'DOLLY':
- sub.row().prop(inputs, "zoom_axis", expand=True)
- sub.prop(inputs, "invert_zoom_direction")
+ sub.row().prop(inputs, "view_zoom_method", text="")
+ if inputs.view_zoom_method == 'DOLLY':
+ sub.row().prop(inputs, "view_zoom_axis", expand=True)
+ sub.prop(inputs, "invert_mouse_wheel_zoom")
- #sub.prop(inputs, "use_middle_mouse_paste")
+ #sub.prop(inputs, "use_mouse_mmb_paste")
#col.separator()
- #sub = col.column()
- #sub.label(text="Mouse Wheel:")
+ sub = col.column()
+ sub.label(text="Mouse Wheel:")
+ sub.prop(inputs, "invert_zoom_wheel", text="Invert Wheel Zoom Direction")
#sub.prop(view, "wheel_scroll_lines", text="Scroll Lines")
col.separator()
@@ -820,24 +808,112 @@ class USERPREF_PT_addons(bpy.types.Panel):
bl_label = "Addons"
bl_region_type = 'WINDOW'
bl_show_header = False
+
+ _addons_fake_modules = {}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
userpref = context.user_preferences
return (userpref.active_section == 'ADDONS')
@staticmethod
+ def module_get(mod_name):
+ return USERPREF_PT_addons._addons_fake_modules[mod_name]
+
+ @staticmethod
def _addon_list():
+ import os
import sys
+ import time
+
modules = []
loaded_modules = set()
paths = bpy.utils.script_paths("addons")
- # sys.path.insert(0, None)
- for path in paths:
- # sys.path[0] = path
- modules.extend(bpy.utils.modules_from_path(path, loaded_modules))
+ # if folder addons_contrib/ exists, scripts in there will be loaded
+ paths += bpy.utils.script_paths("addons_contrib")
+
+ if bpy.app.debug:
+ t_main = time.time()
+
+ # fake module importing
+ def fake_module(mod_name, mod_path, speedy=True):
+ if bpy.app.debug:
+ print("fake_module", mod_name, mod_path)
+ import ast
+ ModuleType = type(ast)
+ if speedy:
+ lines = []
+ line_iter = iter(open(mod_path, "r"))
+ l = ""
+ while not l.startswith("bl_addon_info"):
+ l = line_iter.readline()
+ if len(l) == 0:
+ break
+ while l.rstrip():
+ lines.append(l)
+ l = line_iter.readline()
+ del line_iter
+ data = "".join(lines)
+
+ else:
+ data = open(mod_path, "r").read()
+
+ ast_data = ast.parse(data, filename=mod_path)
+ body_info = None
+ for body in ast_data.body:
+ if body.__class__ == ast.Assign:
+ if len(body.targets) == 1:
+ if getattr(body.targets[0], "id", "") == "bl_addon_info":
+ body_info = body
+ break
+
+ if body_info:
+ mod = ModuleType(mod_name)
+ mod.bl_addon_info = ast.literal_eval(body.value)
+ mod.__file__ = mod_path
+ mod.__time__ = os.path.getmtime(mod_path)
+ return mod
+ else:
+ return None
+
+ modules_stale = set(USERPREF_PT_addons._addons_fake_modules.keys())
- # del sys.path[0]
- return modules
+ for path in paths:
+ for f in sorted(os.listdir(path)):
+ if f.endswith(".py"):
+ mod_name = f[0:-3]
+ mod_path = os.path.join(path, f)
+ elif ("." not in f) and (os.path.isfile(os.path.join(path, f, "__init__.py"))):
+ mod_name = f
+ mod_path = os.path.join(path, f, "__init__.py")
+ else:
+ mod_name = ""
+ mod_path = ""
+
+ if mod_name:
+ if mod_name in modules_stale:
+ modules_stale.remove(mod_name)
+ mod = USERPREF_PT_addons._addons_fake_modules.get(mod_name)
+ if mod:
+ if mod.__time__ != os.path.getmtime(mod_path):
+ print("Reloading", mod_name)
+ del USERPREF_PT_addons._addons_fake_modules[mod_name]
+ mod = None
+
+ if mod is None:
+ mod = fake_module(mod_name, mod_path)
+ if mod:
+ USERPREF_PT_addons._addons_fake_modules[mod_name] = mod
+
+
+ # just incase we get stale modules, not likely
+ for mod_stale in modules_stale:
+ del USERPREF_PT_addons._addons_fake_modules[mod_stale]
+ del modules_stale
+
+ mod_list = list(USERPREF_PT_addons._addons_fake_modules.values())
+ mod_list.sort(key=lambda mod: (mod.bl_addon_info['category'], mod.bl_addon_info['name']))
+ return mod_list
def draw(self, context):
layout = self.layout
@@ -892,7 +968,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
colsub = box.column()
row = colsub.row()
- row.operator("wm.addon_expand", icon='TRIA_DOWN' if info["expanded"] else 'TRIA_RIGHT', emboss=False).module = module_name
+ row.operator("wm.addon_expand", icon='TRIA_DOWN' if info["show_expanded"] else 'TRIA_RIGHT', emboss=False).module = module_name
rowsub = row.row()
rowsub.active = is_enabled
@@ -904,7 +980,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
row.operator("wm.addon_enable", icon='CHECKBOX_DEHLT', text="", emboss=False).module = module_name
# Expanded UI (only if additional infos are available)
- if info["expanded"]:
+ if info["show_expanded"]:
if info["description"]:
split = colsub.row().split(percentage=0.15)
split.label(text='Description:')
@@ -961,7 +1037,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
from bpy.props import *
-def addon_info_get(mod, info_basis={"name": "", "author": "", "version": "", "blender": "", "location": "", "description": "", "wiki_url": "", "tracker_url": "", "category": "", "warning": "", "expanded": False}):
+def addon_info_get(mod, info_basis={"name": "", "author": "", "version": "", "blender": "", "location": "", "description": "", "wiki_url": "", "tracker_url": "", "category": "", "warning": "", "show_expanded": False}):
addon_info = getattr(mod, "bl_addon_info", {})
# avoid re-initializing
@@ -991,8 +1067,13 @@ class WM_OT_addon_enable(bpy.types.Operator):
def execute(self, context):
module_name = self.properties.module
+ # note, this still gets added to _bpy_types.TypeMap
+ import bpy_types as _bpy_types
+ _bpy_types._register_immediate = False
+
try:
mod = __import__(module_name)
+ _bpy_types._register_module(module_name)
mod.register()
except:
import traceback
@@ -1007,7 +1088,9 @@ class WM_OT_addon_enable(bpy.types.Operator):
if info.get("blender", (0, 0, 0)) > bpy.app.version:
self.report("WARNING','This script was written for a newer version of Blender and might not function (correctly).\nThe script is enabled though.")
-
+
+ _bpy_types._register_immediate = True
+
return {'FINISHED'}
@@ -1019,13 +1102,15 @@ class WM_OT_addon_disable(bpy.types.Operator):
module = StringProperty(name="Module", description="Module name of the addon to disable")
def execute(self, context):
- import traceback
+ import bpy_types as _bpy_types
module_name = self.properties.module
try:
mod = __import__(module_name)
+ _bpy_types._unregister_module(module_name, free=False) # dont free because we may want to enable again.
mod.unregister()
except:
+ import traceback
traceback.print_exc()
addons = context.user_preferences.addons
@@ -1111,49 +1196,25 @@ class WM_OT_addon_expand(bpy.types.Operator):
def execute(self, context):
module_name = self.properties.module
- # unlikely to fail, module should have alredy been imported
+ # unlikely to fail, module should have already been imported
try:
- mod = __import__(module_name)
+ # mod = __import__(module_name)
+ mod = USERPREF_PT_addons.module_get(module_name)
except:
import traceback
traceback.print_exc()
return {'CANCELLED'}
info = addon_info_get(mod)
- info["expanded"] = not info["expanded"]
+ info["show_expanded"] = not info["show_expanded"]
return {'FINISHED'}
-classes = [
- USERPREF_HT_header,
- USERPREF_PT_tabs,
- USERPREF_PT_interface,
- USERPREF_PT_theme,
- USERPREF_PT_edit,
- USERPREF_PT_system,
- USERPREF_PT_file,
- USERPREF_PT_input,
- USERPREF_PT_addons,
-
- USERPREF_MT_interaction_presets,
- USERPREF_MT_splash,
-
- WM_OT_addon_enable,
- WM_OT_addon_disable,
- WM_OT_addon_install,
- WM_OT_addon_expand]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
-
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_userpref_keymap.py b/release/scripts/ui/space_userpref_keymap.py
index c93b24d5cb2..f966f8a7e8b 100644
--- a/release/scripts/ui/space_userpref_keymap.py
+++ b/release/scripts/ui/space_userpref_keymap.py
@@ -19,8 +19,8 @@
# <pep8 compliant>
import bpy
import os
-import re
-import shutil
+
+KM_MOD_PREFIX = "keyconfig_"
KM_HIERARCHY = [
('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit
@@ -167,39 +167,39 @@ class InputKeyMapPanel(bpy.types.Panel):
col = self.indented_layout(layout, level)
row = col.row()
- row.prop(km, "children_expanded", text="", emboss=False)
+ row.prop(km, "show_expanded_children", text="", emboss=False)
row.label(text=km.name)
row.label()
row.label()
- if km.modal:
+ if km.is_modal:
row.label(text="", icon='LINKED')
- if km.user_defined:
+ if km.is_user_defined:
op = row.operator("wm.keymap_restore", text="Restore")
else:
op = row.operator("wm.keymap_edit", text="Edit")
- if km.children_expanded:
+ if km.show_expanded_children:
if children:
# Put the Parent key map's entries in a 'global' sub-category
# equal in hierarchy to the other children categories
subcol = self.indented_layout(col, level + 1)
subrow = subcol.row()
- subrow.prop(km, "items_expanded", text="", emboss=False)
+ subrow.prop(km, "show_expanded_items", text="", emboss=False)
subrow.label(text="%s (Global)" % km.name)
else:
- km.items_expanded = True
+ km.show_expanded_items = True
# Key Map items
- if km.items_expanded:
+ if km.show_expanded_items:
for kmi in km.items:
self.draw_kmi(display_keymaps, kc, km, kmi, col, level + 1)
# "Add New" at end of keymap item list
col = self.indented_layout(col, level + 1)
subcol = col.split(percentage=0.2).column()
- subcol.enabled = km.user_defined
+ subcol.enabled = km.is_user_defined
op = subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
col.separator()
@@ -217,7 +217,7 @@ class InputKeyMapPanel(bpy.types.Panel):
col = self.indented_layout(layout, level)
- if km.user_defined:
+ if km.is_user_defined:
col = col.column(align=True)
box = col.box()
else:
@@ -227,19 +227,19 @@ class InputKeyMapPanel(bpy.types.Panel):
# header bar
row = split.row()
- row.prop(kmi, "expanded", text="", emboss=False)
+ row.prop(kmi, "show_expanded", text="", emboss=False)
row = split.row()
- row.enabled = km.user_defined
+ row.enabled = km.is_user_defined
row.prop(kmi, "active", text="", emboss=False)
- if km.modal:
+ if km.is_modal:
row.prop(kmi, "propvalue", text="")
else:
row.label(text=kmi.name)
row = split.row()
- row.enabled = km.user_defined
+ row.enabled = km.is_user_defined
row.prop(kmi, "map_type", text="")
if map_type == 'KEYBOARD':
row.prop(kmi, "type", text="", full_event=True)
@@ -261,16 +261,16 @@ class InputKeyMapPanel(bpy.types.Panel):
op.item_id = kmi.id
# Expanded, additional event settings
- if kmi.expanded:
+ if kmi.show_expanded:
box = col.box()
- box.enabled = km.user_defined
+ box.enabled = km.is_user_defined
if map_type not in ('TEXTINPUT', 'TIMER'):
split = box.split(percentage=0.4)
sub = split.row()
- if km.modal:
+ if km.is_modal:
sub.prop(kmi, "propvalue", text="")
else:
sub.prop(kmi, "idname", text="")
@@ -299,9 +299,8 @@ class InputKeyMapPanel(bpy.types.Panel):
if title:
box.label(text=title)
flow = box.column_flow(columns=2)
- for pname in dir(properties):
+ for pname, value in properties.items():
if not properties.is_property_hidden(pname):
- value = eval("properties." + pname)
if isinstance(value, bpy.types.OperatorProperties):
display_properties(value, title=pname)
else:
@@ -313,7 +312,7 @@ class InputKeyMapPanel(bpy.types.Panel):
display_properties(props)
# Modal key maps attached to this operator
- if not km.modal:
+ if not km.is_modal:
kmm = kc.find_keymap_modal(kmi.idname)
if kmm:
self.draw_km(display_keymaps, kc, kmm, None, layout, level + 1)
@@ -335,7 +334,7 @@ class InputKeyMapPanel(bpy.types.Panel):
row.label()
row.label()
- if km.user_defined:
+ if km.is_user_defined:
op = row.operator("wm.keymap_restore", text="Restore")
else:
op = row.operator("wm.keymap_edit", text="Edit")
@@ -346,7 +345,7 @@ class InputKeyMapPanel(bpy.types.Panel):
# "Add New" at end of keymap item list
col = self.indented_layout(layout, 1)
subcol = col.split(percentage=0.2).column()
- subcol.enabled = km.user_defined
+ subcol.enabled = km.is_user_defined
op = subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
def draw_hierarchy(self, display_keymaps, layout):
@@ -369,13 +368,13 @@ class InputKeyMapPanel(bpy.types.Panel):
layout.set_context_pointer("keyconfig", wm.active_keyconfig)
row.operator("wm.keyconfig_remove", text="", icon='X')
- row.prop(context.space_data, "filter", icon="VIEWZOOM")
+ row.prop(context.space_data, "filter_text", icon="VIEWZOOM")
col.separator()
display_keymaps = _merge_keymaps(kc, defkc)
- if context.space_data.filter != "":
- filter = context.space_data.filter.lower()
+ if context.space_data.filter_text != "":
+ filter_text = context.space_data.filter_text.lower()
self.draw_filtered(display_keymaps, filter, col)
else:
self.draw_hierarchy(display_keymaps, col)
@@ -384,6 +383,21 @@ class InputKeyMapPanel(bpy.types.Panel):
from bpy.props import *
+def export_properties(prefix, properties, lines=None):
+ if lines is None:
+ lines = []
+
+ for value, pname in properties.items():
+ if not properties.is_property_hidden(pname):
+ if isinstance(value, bpy.types.OperatorProperties):
+ export_properties(prefix + "." + pname, value, lines)
+ elif properties.is_property_set(pname):
+ value = _string_value(value)
+ if value != "":
+ lines.append("%s.%s = %s\n" % (prefix, pname, value))
+ return lines
+
+
class WM_OT_keyconfig_test(bpy.types.Operator):
"Test keyconfig for conflicts"
bl_idname = "wm.keyconfig_test"
@@ -393,7 +407,7 @@ class WM_OT_keyconfig_test(bpy.types.Operator):
result = False
def kmistr(kmi):
- if km.modal:
+ if km.is_modal:
s = ["kmi = km.items.add_modal(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)]
else:
s = ["kmi = km.items.add(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)]
@@ -414,21 +428,10 @@ class WM_OT_keyconfig_test(bpy.types.Operator):
s.append(")\n")
- def export_properties(prefix, properties):
- for pname in dir(properties):
- if not properties.is_property_hidden(pname):
- value = eval("properties.%s" % pname)
- if isinstance(value, bpy.types.OperatorProperties):
- export_properties(prefix + "." + pname, value)
- elif properties.is_property_set(pname):
- value = _string_value(value)
- if value != "":
- s.append(prefix + ".%s = %s\n" % (pname, value))
-
props = kmi.properties
if props is not None:
- export_properties("kmi.properties", props)
+ export_properties("kmi.properties", props, s)
return "".join(s).strip()
@@ -508,7 +511,7 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
bl_idname = "wm.keyconfig_import"
bl_label = "Import Key Configuration..."
- filepath = StringProperty(name="File Path", description="Filepath to write file to")
+ filepath = StringProperty(name="File Path", description="Filepath to write file to", default="keymap.py")
filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'})
filter_text = BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'})
filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'})
@@ -516,25 +519,26 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
keep_original = BoolProperty(name="Keep original", description="Keep original file after copying to configuration folder", default=True)
def execute(self, context):
- if not self.properties.filepath:
+ import shutil
+ if not self.properties.is_property_set("filepath"):
raise Exception("Filepath not set")
f = open(self.properties.filepath, "r")
if not f:
raise Exception("Could not open file")
- name_pattern = re.compile("^kc = wm.add_keyconfig\('(.*)'\)$")
-
- for line in f.readlines():
- match = name_pattern.match(line)
-
- if match:
- config_name = match.groups()[0]
+ config_name = None
+ for line in f:
+ if line.startswith("kc = wm.add_keyconfig("):
+ config_name = line[23:-3]
+ break
- f.close()
+ if config_name is None:
+ raise Exception("config name not found")
- path = os.path.split(os.path.split(__file__)[0])[0] # remove ui/space_userpref.py
- path = os.path.join(path, "cfg")
+ path = os.path.join(__file__, "..", "..", "cfg") # remove ui/space_userpref.py
+ path = os.path.normpath(path)
+ print(path)
# create config folder if needed
if not os.path.exists(path):
@@ -547,7 +551,16 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
else:
shutil.move(self.properties.filepath, path)
- exec("import " + config_name)
+ # sneaky way to check we're actually running the code.
+ wm = context.manager
+ while config_name in wm.keyconfigs:
+ wm.remove_keyconfig(wm.keyconfigs[config_name])
+
+ wm = context.manager
+ totmap = len(wm.keyconfigs)
+ mod = __import__(config_name)
+ if totmap == len(wm.keyconfigs):
+ reload(mod)
wm = bpy.context.manager
wm.active_keyconfig = wm.keyconfigs[config_name]
@@ -567,14 +580,14 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
bl_idname = "wm.keyconfig_export"
bl_label = "Export Key Configuration..."
- filepath = StringProperty(name="File Path", description="Filepath to write file to")
+ filepath = StringProperty(name="File Path", description="Filepath to write file to", default="keymap.py")
filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'})
filter_text = BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'})
filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'})
kc_name = StringProperty(name="KeyConfig Name", description="Name to save the key config as")
def execute(self, context):
- if not self.properties.filepath:
+ if not self.properties.is_property_set("filepath"):
raise Exception("Filepath not set")
f = open(self.properties.filepath, "w")
@@ -621,9 +634,9 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
km = km.active()
f.write("# Map %s\n" % km.name)
- f.write("km = kc.add_keymap('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.modal))
+ f.write("km = kc.add_keymap('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.is_modal))
for kmi in km.items:
- if km.modal:
+ if km.is_modal:
f.write("kmi = km.items.add_modal('%s', '%s', '%s'" % (kmi.propvalue, kmi.type, kmi.value))
else:
f.write("kmi = km.items.add('%s', '%s', '%s'" % (kmi.idname, kmi.type, kmi.value))
@@ -642,21 +655,10 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
f.write(", key_modifier='%s'" % kmi.key_modifier)
f.write(")\n")
- def export_properties(prefix, properties):
- for pname in dir(properties):
- if not properties.is_property_hidden(pname):
- value = eval("properties.%s" % pname)
- if isinstance(value, bpy.types.OperatorProperties):
- export_properties(prefix + "." + pname, value)
- elif properties.is_property_set(pname):
- value = _string_value(value)
- if value != "":
- f.write(prefix + ".%s = %s\n" % (pname, value))
-
props = kmi.properties
if props is not None:
- export_properties("kmi.properties", props)
+ f.write("".join(export_properties("kmi.properties", props)))
f.write("\n")
@@ -729,16 +731,16 @@ class WM_OT_keyitem_add(bpy.types.Operator):
km = context.keymap
kc = wm.default_keyconfig
- if km.modal:
+ if km.is_modal:
km.items.add_modal("", 'A', 'PRESS') # kmi
else:
km.items.add("none", 'A', 'PRESS') # kmi
# clear filter and expand keymap so we can see the newly added item
- if context.space_data.filter != '':
- context.space_data.filter = ''
- km.items_expanded = True
- km.children_expanded = True
+ if context.space_data.filter_text != "":
+ context.space_data.filter_text = ""
+ km.show_expanded_items = True
+ km.show_expanded_children = True
return {'FINISHED'}
@@ -763,50 +765,37 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
bl_idname = "wm.keyconfig_remove"
bl_label = "Remove Key Config"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
wm = context.manager
- return wm.active_keyconfig.user_defined
+ return wm.active_keyconfig.is_user_defined
def execute(self, context):
+ import sys
wm = context.manager
keyconfig = wm.active_keyconfig
- module = __import__(keyconfig.name)
+ module = sys.modules.get(keyconfig.name)
- os.remove(module.__file__)
+ if module:
+ path = module.__file__
+ if os.path.exists(path):
+ os.remove(path)
- compiled_path = module.__file__ + "c" # for .pyc
+ path = module.__file__ + "c" # for .pyc
- if os.path.exists(compiled_path):
- os.remove(compiled_path)
+ if os.path.exists(path):
+ os.remove(path)
wm.remove_keyconfig(keyconfig)
return {'FINISHED'}
-
-classes = [
- WM_OT_keyconfig_export,
- WM_OT_keyconfig_import,
- WM_OT_keyconfig_test,
- WM_OT_keyconfig_remove,
- WM_OT_keymap_edit,
- WM_OT_keymap_restore,
- WM_OT_keyitem_add,
- WM_OT_keyitem_remove,
- WM_OT_keyitem_restore]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
-
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py
index bab3695a0b6..b8b220cad0c 100644
--- a/release/scripts/ui/space_view3d.py
+++ b/release/scripts/ui/space_view3d.py
@@ -60,39 +60,44 @@ class VIEW3D_HT_header(bpy.types.Header):
'''
if obj and obj.mode == 'EDIT' and obj.type == 'MESH':
row_sub = row.row(align=True)
- row_sub.prop(toolsettings, "mesh_selection_mode", text="", index=0, icon='VERTEXSEL')
- row_sub.prop(toolsettings, "mesh_selection_mode", text="", index=1, icon='EDGESEL')
- row_sub.prop(toolsettings, "mesh_selection_mode", text="", index=2, icon='FACESEL')
+ row_sub.prop(toolsettings, "mesh_select_mode", text="", index=0, icon='VERTEXSEL')
+ row_sub.prop(toolsettings, "mesh_select_mode", text="", index=1, icon='EDGESEL')
+ row_sub.prop(toolsettings, "mesh_select_mode", text="", index=2, icon='FACESEL')
'''
if obj:
# Particle edit
if obj.mode == 'PARTICLE_EDIT':
- row.prop(toolsettings.particle_edit, "selection_mode", text="", expand=True, toggle=True)
+ row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True, toggle=True)
# Occlude geometry
- if view.viewport_shading in ('SOLID', 'SHADED', 'TEXTURED') and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):
- row.prop(view, "occlude_geometry", text="")
+ if view.viewport_shade in ('SOLID', 'SHADED', 'TEXTURED') and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):
+ row.prop(view, "use_occlude_geometry", text="")
# Proportional editing
- if obj.mode in ('OBJECT', 'EDIT', 'PARTICLE_EDIT'):
+ if obj.mode in ('EDIT', 'PARTICLE_EDIT'):
row = layout.row(align=True)
- row.prop(toolsettings, "proportional_editing", text="", icon_only=True)
- if toolsettings.proportional_editing != 'DISABLED':
- row.prop(toolsettings, "proportional_editing_falloff", text="", icon_only=True)
+ row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
+ if toolsettings.proportional_edit != 'DISABLED':
+ row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
+ elif obj.mode == 'OBJECT':
+ row = layout.row(align=True)
+ row.prop(toolsettings, "use_proportional_edit_objects", text="", icon_only=True)
+ if toolsettings.use_proportional_edit_objects:
+ row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
# Snap
row = layout.row(align=True)
- row.prop(toolsettings, "snap", text="")
+ row.prop(toolsettings, "use_snap", text="")
row.prop(toolsettings, "snap_element", text="", icon_only=True)
if toolsettings.snap_element != 'INCREMENT':
row.prop(toolsettings, "snap_target", text="")
if obj and obj.mode == 'OBJECT':
- row.prop(toolsettings, "snap_align_rotation", text="")
+ row.prop(toolsettings, "use_snap_align_rotation", text="")
if toolsettings.snap_element == 'VOLUME':
- row.prop(toolsettings, "snap_peel_object", text="")
+ row.prop(toolsettings, "use_snap_peel_object", text="")
elif toolsettings.snap_element == 'FACE':
- row.prop(toolsettings, "snap_project", text="")
+ row.prop(toolsettings, "use_snap_project", text="")
# OpenGL render
row = layout.row(align=True)
@@ -114,7 +119,7 @@ class VIEW3D_HT_header(bpy.types.Header):
# ********** Utilities **********
-class VIEW3D_MT_showhide(bpy.types.Menu):
+class ShowHideMenu():
bl_label = "Show/Hide"
_operator_name = ""
@@ -484,7 +489,7 @@ class VIEW3D_MT_select_edit_mesh(bpy.types.Menu):
layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES'
layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS'
- if context.scene.tool_settings.mesh_selection_mode[2] == False:
+ if context.scene.tool_settings.mesh_select_mode[2] == False:
layout.operator("mesh.select_non_manifold", text="Non Manifold")
layout.operator("mesh.select_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER'
layout.operator("mesh.select_similar", text="Similar")
@@ -709,7 +714,8 @@ class VIEW3D_MT_object_clear(bpy.types.Menu):
class VIEW3D_MT_object_specials(bpy.types.Menu):
bl_label = "Specials"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
# add more special types
return context.object
@@ -742,7 +748,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
props = layout.operator("wm.context_modal_mouse", text="Width Size")
props.data_path_iter = "selected_editable_objects"
- props.data_path_item = "data.width"
+ props.data_path_item = "data.offset"
props.input_scale = 0.01
if obj.type == 'EMPTY':
@@ -791,7 +797,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
layout.separator()
props = layout.operator("object.isolate_type_render")
-
+ props = layout.operator("object.hide_render_clear_all")
class VIEW3D_MT_object_apply(bpy.types.Menu):
bl_label = "Apply"
@@ -859,9 +865,9 @@ class VIEW3D_MT_object_showhide(bpy.types.Menu):
def draw(self, context):
layout = self.layout
- layout.operator("object.restrictview_clear", text="Show Hidden")
- layout.operator("object.restrictview_set", text="Hide Selected")
- layout.operator("object.restrictview_set", text="Hide Unselected").unselected = True
+ layout.operator("object.hide_view_clear", text="Show Hidden")
+ layout.operator("object.hide_view_set", text="Hide Selected")
+ layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
class VIEW3D_MT_make_single_user(bpy.types.Menu):
@@ -1001,12 +1007,13 @@ class VIEW3D_MT_sculpt(bpy.types.Menu):
def draw(self, context):
layout = self.layout
- sculpt = context.tool_settings.sculpt
- brush = context.tool_settings.sculpt.brush
+ tool_settings = context.tool_settings
+ sculpt = tool_settings.sculpt
+ brush = tool_settings.sculpt.brush
- layout.prop(sculpt, "symmetry_x")
- layout.prop(sculpt, "symmetry_y")
- layout.prop(sculpt, "symmetry_z")
+ layout.prop(sculpt, "use_symmetry_x")
+ layout.prop(sculpt, "use_symmetry_y")
+ layout.prop(sculpt, "use_symmetry_z")
layout.separator()
layout.prop(sculpt, "lock_x")
layout.prop(sculpt, "lock_y")
@@ -1024,12 +1031,20 @@ class VIEW3D_MT_sculpt(bpy.types.Menu):
layout.prop(brush, "use_anchor")
if sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
- layout.prop(brush, "flip_direction")
+ layout.prop_menu_enum(brush, "direction")
if sculpt_tool == 'LAYER':
layout.prop(brush, "use_persistent")
layout.operator("sculpt.set_persistent_base")
+ layout.separator()
+ layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
+ layout.prop(sculpt, "show_brush")
+
+ # TODO, make availabel from paint menu!
+ layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Unify Size")
+ layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Unify Strength")
+
# ********** Particle menu **********
@@ -1048,7 +1063,7 @@ class VIEW3D_MT_particle(bpy.types.Menu):
layout.operator("particle.remove_doubles")
layout.operator("particle.delete")
- if particle_edit.selection_mode == 'POINT':
+ if particle_edit.select_mode == 'POINT':
layout.operator("particle.subdivide")
layout.operator("particle.rekey")
@@ -1069,7 +1084,7 @@ class VIEW3D_MT_particle_specials(bpy.types.Menu):
layout.operator("particle.rekey")
layout.separator()
- if particle_edit.selection_mode == 'POINT':
+ if particle_edit.select_mode == 'POINT':
layout.operator("particle.subdivide")
layout.operator("particle.select_roots")
layout.operator("particle.select_tips")
@@ -1077,7 +1092,7 @@ class VIEW3D_MT_particle_specials(bpy.types.Menu):
layout.operator("particle.remove_doubles")
-class VIEW3D_MT_particle_showhide(VIEW3D_MT_showhide):
+class VIEW3D_MT_particle_showhide(ShowHideMenu, bpy.types.Menu):
_operator_name = "particle"
# ********** Pose Menu **********
@@ -1093,7 +1108,7 @@ class VIEW3D_MT_pose(bpy.types.Menu):
layout.menu("VIEW3D_MT_transform")
layout.menu("VIEW3D_MT_snap")
- if arm.drawtype in ('BBONE', 'ENVELOPE'):
+ if arm.draw_type in ('BBONE', 'ENVELOPE'):
layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONESIZE'
layout.menu("VIEW3D_MT_pose_transform")
@@ -1227,7 +1242,7 @@ class VIEW3D_MT_pose_constraints(bpy.types.Menu):
layout.operator("pose.constraints_clear")
-class VIEW3D_MT_pose_showhide(VIEW3D_MT_showhide):
+class VIEW3D_MT_pose_showhide(ShowHideMenu, bpy.types.Menu):
_operator_name = "pose"
@@ -1281,9 +1296,9 @@ class VIEW3D_MT_edit_mesh(bpy.types.Menu):
layout.separator()
- layout.prop(settings, "automerge_editing")
- layout.prop_menu_enum(settings, "proportional_editing")
- layout.prop_menu_enum(settings, "proportional_editing_falloff")
+ layout.prop(settings, "use_mesh_automerge")
+ layout.prop_menu_enum(settings, "proportional_edit")
+ layout.prop_menu_enum(settings, "proportional_edit_falloff")
layout.separator()
@@ -1325,15 +1340,15 @@ class VIEW3D_MT_edit_mesh_selection_mode(bpy.types.Menu):
prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
prop.value = "(True, False, False)"
- prop.data_path = "tool_settings.mesh_selection_mode"
+ prop.data_path = "tool_settings.mesh_select_mode"
prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
prop.value = "(False, True, False)"
- prop.data_path = "tool_settings.mesh_selection_mode"
+ prop.data_path = "tool_settings.mesh_select_mode"
prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
prop.value = "(False, False, True)"
- prop.data_path = "tool_settings.mesh_selection_mode"
+ prop.data_path = "tool_settings.mesh_select_mode"
class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
@@ -1342,7 +1357,7 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
@staticmethod
def extrude_options(context):
mesh = context.object.data
- selection_mode = context.tool_settings.mesh_selection_mode
+ selection_mode = context.tool_settings.mesh_select_mode
totface = mesh.total_face_sel
totedge = mesh.total_edge_sel
@@ -1424,7 +1439,7 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
def execute(self, context):
mesh = context.object.data
- selection_mode = context.tool_settings.mesh_selection_mode
+ selection_mode = context.tool_settings.mesh_select_mode
totface = mesh.total_face_sel
totedge = mesh.total_edge_sel
@@ -1593,7 +1608,7 @@ class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
layout.operator("mesh.flip_normals")
-class VIEW3D_MT_edit_mesh_showhide(VIEW3D_MT_showhide):
+class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, bpy.types.Menu):
_operator_name = "mesh"
# Edit Curve
@@ -1625,8 +1640,8 @@ def draw_curve(self, context):
layout.separator()
- layout.prop_menu_enum(settings, "proportional_editing")
- layout.prop_menu_enum(settings, "proportional_editing_falloff")
+ layout.prop_menu_enum(settings, "proportional_edit")
+ layout.prop_menu_enum(settings, "proportional_edit_falloff")
layout.separator()
@@ -1685,7 +1700,7 @@ class VIEW3D_MT_edit_curve_specials(bpy.types.Menu):
layout.operator("curve.smooth_radius")
-class VIEW3D_MT_edit_curve_showhide(VIEW3D_MT_showhide):
+class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, bpy.types.Menu):
_operator_name = "curve"
@@ -1773,8 +1788,8 @@ class VIEW3D_MT_edit_meta(bpy.types.Menu):
layout.separator()
- layout.prop_menu_enum(settings, "proportional_editing")
- layout.prop_menu_enum(settings, "proportional_editing_falloff")
+ layout.prop_menu_enum(settings, "proportional_edit")
+ layout.prop_menu_enum(settings, "proportional_edit_falloff")
layout.separator()
@@ -1810,8 +1825,8 @@ class VIEW3D_MT_edit_lattice(bpy.types.Menu):
layout.separator()
- layout.prop_menu_enum(settings, "proportional_editing")
- layout.prop_menu_enum(settings, "proportional_editing_falloff")
+ layout.prop_menu_enum(settings, "proportional_edit")
+ layout.prop_menu_enum(settings, "proportional_edit_falloff")
class VIEW3D_MT_edit_armature(bpy.types.Menu):
@@ -1828,7 +1843,7 @@ class VIEW3D_MT_edit_armature(bpy.types.Menu):
layout.menu("VIEW3D_MT_snap")
layout.menu("VIEW3D_MT_edit_armature_roll")
- if arm.drawtype == 'ENVELOPE':
+ if arm.draw_type == 'ENVELOPE':
layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONESIZE'
else:
layout.operator("transform.transform", text="Scale B-Bone Width").mode = 'BONESIZE'
@@ -1837,7 +1852,7 @@ class VIEW3D_MT_edit_armature(bpy.types.Menu):
layout.operator("armature.extrude_move")
- if arm.x_axis_mirror:
+ if arm.use_mirror_x:
layout.operator("armature.extrude_forked")
layout.operator("armature.duplicate_move")
@@ -1910,8 +1925,8 @@ class VIEW3D_MT_edit_armature_roll(bpy.types.Menu):
def draw(self, context):
layout = self.layout
- layout.operator("armature.calculate_roll", text="Clear Roll (Z-Axis Up)").type = 'GLOBALUP'
- layout.operator("armature.calculate_roll", text="Roll to Cursor").type = 'CURSOR'
+ layout.operator("armature.calculate_roll", text="Recalculate with Z-Axis Up").type = 'GLOBALUP'
+ layout.operator("armature.calculate_roll", text="Recalculate with Z-Axis to Cursor").type = 'CURSOR'
layout.separator()
@@ -1925,7 +1940,8 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "View"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
view = context.space_data
return (view)
@@ -1961,7 +1977,8 @@ class VIEW3D_PT_view3d_name(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Item"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.space_data and context.active_object)
def draw(self, context):
@@ -1986,7 +2003,8 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel):
bl_label = "Display"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
view = context.space_data
return (view)
@@ -1994,34 +2012,34 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel):
layout = self.layout
view = context.space_data
- gs = context.scene.game_data
+ gs = context.scene.game_settings
ob = context.object
col = layout.column()
- col.prop(view, "display_render_override")
+ col.prop(view, "show_only_render")
col = layout.column()
- display_all = not view.display_render_override
+ display_all = not view.show_only_render
col.active = display_all
- col.prop(view, "outline_selected")
- col.prop(view, "all_object_origins")
- col.prop(view, "relationship_lines")
+ col.prop(view, "show_outline_selected")
+ col.prop(view, "show_all_objects_origin")
+ col.prop(view, "show_relationship_lines")
if ob and ob.type == 'MESH':
mesh = ob.data
- col.prop(mesh, "all_edges")
+ col.prop(mesh, "show_all_edges")
col = layout.column()
col.active = display_all
split = col.split(percentage=0.55)
- split.prop(view, "display_floor", text="Grid Floor")
+ split.prop(view, "show_floor", text="Grid Floor")
row = split.row(align=True)
- row.prop(view, "display_x_axis", text="X", toggle=True)
- row.prop(view, "display_y_axis", text="Y", toggle=True)
- row.prop(view, "display_z_axis", text="Z", toggle=True)
+ row.prop(view, "show_axis_x", text="X", toggle=True)
+ row.prop(view, "show_axis_y", text="Y", toggle=True)
+ row.prop(view, "show_axis_z", text="Z", toggle=True)
sub = col.column(align=True)
- sub.active = (display_all and view.display_floor)
+ sub.active = (display_all and view.show_floor)
sub.prop(view, "grid_lines", text="Lines")
sub.prop(view, "grid_spacing", text="Spacing")
sub.prop(view, "grid_subdivisions", text="Subdivisions")
@@ -2029,7 +2047,7 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel):
col = layout.column()
col.label(text="Shading:")
col.prop(gs, "material_mode", text="")
- col.prop(view, "textured_solid")
+ col.prop(view, "show_textured_solid")
layout.separator()
@@ -2042,10 +2060,10 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel):
col.prop(region, "lock_rotation")
row = col.row()
row.enabled = region.lock_rotation
- row.prop(region, "box_preview")
+ row.prop(region, "show_sync_view")
row = col.row()
- row.enabled = region.lock_rotation and region.box_preview
- row.prop(region, "box_clip")
+ row.enabled = region.lock_rotation and region.show_sync_view
+ row.prop(region, "use_box_clip")
class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
@@ -2053,7 +2071,8 @@ class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Mesh Display"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
# The active object check is needed because of localmode
return (context.active_object and (context.mode == 'EDIT_MESH'))
@@ -2064,24 +2083,24 @@ class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
col = layout.column()
col.label(text="Overlays:")
- col.prop(mesh, "draw_edges", text="Edges")
- col.prop(mesh, "draw_faces", text="Faces")
- col.prop(mesh, "draw_creases", text="Creases")
- col.prop(mesh, "draw_bevel_weights", text="Bevel Weights")
- col.prop(mesh, "draw_seams", text="Seams")
- col.prop(mesh, "draw_sharp", text="Sharp")
+ col.prop(mesh, "show_edges", text="Edges")
+ col.prop(mesh, "show_faces", text="Faces")
+ col.prop(mesh, "show_edge_crease", text="Creases")
+ col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights")
+ col.prop(mesh, "show_edge_seams", text="Seams")
+ col.prop(mesh, "show_edge_sharp", text="Sharp")
col.separator()
col.label(text="Normals:")
- col.prop(mesh, "draw_normals", text="Face")
- col.prop(mesh, "draw_vertex_normals", text="Vertex")
+ col.prop(mesh, "show_normal_face", text="Face")
+ col.prop(mesh, "show_normal_vertex", text="Vertex")
col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
col.separator()
col.label(text="Numerics:")
- col.prop(mesh, "draw_edge_lenght")
- col.prop(mesh, "draw_edge_angle")
- col.prop(mesh, "draw_face_area")
+ col.prop(mesh, "show_extra_edge_length")
+ col.prop(mesh, "show_extra_edge_angle")
+ col.prop(mesh, "show_extra_face_area")
class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel):
@@ -2089,7 +2108,8 @@ class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel):
bl_region_type = 'UI'
bl_label = "Curve Display"
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
editmesh = context.mode == 'EDIT_CURVE'
return (editmesh)
@@ -2100,8 +2120,8 @@ class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel):
col = layout.column()
col.label(text="Overlays:")
- col.prop(curve, "draw_handles", text="Handles")
- col.prop(curve, "draw_normals", text="Normals")
+ col.prop(curve, "show_handles", text="Handles")
+ col.prop(curve, "show_normal_face", text="Normals")
col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
@@ -2111,7 +2131,8 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
bl_label = "Background Images"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
view = context.space_data
# bg = context.space_data.background_image
return (view)
@@ -2120,7 +2141,7 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
layout = self.layout
view = context.space_data
- layout.prop(view, "display_background_images", text="")
+ layout.prop(view, "show_background_images", text="")
def draw(self, context):
layout = self.layout
@@ -2131,7 +2152,7 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
col.operator("view3d.add_background_image", text="Add Image")
for i, bg in enumerate(view.background_images):
- layout.active = view.display_background_images
+ layout.active = view.show_background_images
box = layout.box()
row = box.row(align=True)
row.prop(bg, "show_expanded", text="", emboss=False)
@@ -2147,10 +2168,11 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
box.template_image(bg, "image", bg.image_user, compact=True)
box.prop(bg, "transparency", slider=True)
- box.prop(bg, "size")
- row = box.row(align=True)
- row.prop(bg, "offset_x", text="X")
- row.prop(bg, "offset_y", text="Y")
+ if bg.view_axis != 'CAMERA':
+ box.prop(bg, "size")
+ row = box.row(align=True)
+ row.prop(bg, "offset_x", text="X")
+ row.prop(bg, "offset_y", text="Y")
class VIEW3D_PT_transform_orientations(bpy.types.Panel):
@@ -2159,7 +2181,8 @@ class VIEW3D_PT_transform_orientations(bpy.types.Panel):
bl_label = "Transform Orientations"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
view = context.space_data
return (view)
@@ -2186,7 +2209,8 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
bl_label = "Skeleton Sketching"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
scene = context.space_data
ob = context.active_object
return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
@@ -2195,7 +2219,7 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
layout = self.layout
toolsettings = context.scene.tool_settings
- layout.prop(toolsettings, "bone_sketching", text="")
+ layout.prop(toolsettings, "use_bone_sketching", text="")
def draw(self, context):
layout = self.layout
@@ -2203,8 +2227,8 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
col = layout.column()
- col.prop(toolsettings, "etch_quick")
- col.prop(toolsettings, "etch_overdraw")
+ col.prop(toolsettings, "use_etch_quick")
+ col.prop(toolsettings, "use_etch_overdraw")
col.prop(toolsettings, "etch_convert_mode")
@@ -2217,7 +2241,7 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
elif toolsettings.etch_convert_mode == 'RETARGET':
col.prop(toolsettings, "etch_template")
col.prop(toolsettings, "etch_roll_mode")
- col.prop(toolsettings, "etch_autoname")
+ col.prop(toolsettings, "use_etch_autoname")
col.prop(toolsettings, "etch_number")
col.prop(toolsettings, "etch_side")
col.operator("sketch.convert", text="Convert")
@@ -2229,7 +2253,7 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
bl_label = "Properties"
bl_default_closed = True
- def _active_context_member(self, context):
+ def _active_context_member(context):
obj = context.object
if obj:
mode = obj.mode
@@ -2242,8 +2266,9 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
return ""
- def poll(self, context):
- member = self._active_context_member(context)
+ @classmethod
+ def poll(cls, context):
+ member = cls._active_context_member(context)
if member:
context_member = getattr(context, member)
return context_member and context_member.keys()
@@ -2253,129 +2278,19 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
def draw(self, context):
import rna_prop_ui
# reload(rna_prop_ui)
- member = self._active_context_member(context)
+ member = __class__._active_context_member(context)
if member:
# Draw with no edit button
rna_prop_ui.draw(self.layout, context, member, False)
-classes = [
- VIEW3D_OT_edit_mesh_extrude_move, # detects constraints setup and extrude region
- VIEW3D_OT_edit_mesh_extrude_individual_move,
-
- VIEW3D_HT_header, # Header
-
- VIEW3D_MT_view, #View Menus
- VIEW3D_MT_view_navigation,
- VIEW3D_MT_view_align,
- VIEW3D_MT_view_align_selected,
- VIEW3D_MT_view_cameras,
-
- VIEW3D_MT_select_object, # Select Menus
- VIEW3D_MT_select_pose,
- VIEW3D_MT_select_particle,
- VIEW3D_MT_select_edit_mesh,
- VIEW3D_MT_select_edit_curve,
- VIEW3D_MT_select_edit_surface,
- VIEW3D_MT_select_edit_metaball,
- VIEW3D_MT_select_edit_lattice,
- VIEW3D_MT_select_edit_armature,
- VIEW3D_MT_select_face, # XXX todo
-
- VIEW3D_MT_transform, # Object/Edit Menus
- VIEW3D_MT_mirror, # Object/Edit Menus
- VIEW3D_MT_snap, # Object/Edit Menus
- VIEW3D_MT_uv_map, # Edit Menus
-
- VIEW3D_MT_object, # Object Menu
- VIEW3D_MT_object_specials,
- VIEW3D_MT_object_apply,
- VIEW3D_MT_object_clear,
- VIEW3D_MT_object_parent,
- VIEW3D_MT_object_track,
- VIEW3D_MT_object_group,
- VIEW3D_MT_object_constraints,
- VIEW3D_MT_object_showhide,
- VIEW3D_MT_make_single_user,
- VIEW3D_MT_make_links,
- VIEW3D_MT_object_game_properties,
- VIEW3D_MT_object_game_logicbricks,
-
- VIEW3D_MT_hook,
- VIEW3D_MT_vertex_group,
-
- VIEW3D_MT_sculpt, # Sculpt Menu
- VIEW3D_MT_paint_vertex,
- VIEW3D_MT_paint_weight,
-
- VIEW3D_MT_particle, # Particle Menu
- VIEW3D_MT_particle_specials,
- VIEW3D_MT_particle_showhide,
-
- VIEW3D_MT_pose, # POSE Menu
- VIEW3D_MT_pose_transform,
- VIEW3D_MT_pose_pose,
- VIEW3D_MT_pose_motion,
- VIEW3D_MT_pose_group,
- VIEW3D_MT_pose_ik,
- VIEW3D_MT_pose_constraints,
- VIEW3D_MT_pose_showhide,
- VIEW3D_MT_pose_apply,
-
- VIEW3D_MT_edit_mesh,
- VIEW3D_MT_edit_mesh_specials, # Only as a menu for keybindings
- VIEW3D_MT_edit_mesh_selection_mode, # Only as a menu for keybindings
- VIEW3D_MT_edit_mesh_vertices,
- VIEW3D_MT_edit_mesh_edges,
- VIEW3D_MT_edit_mesh_faces,
- VIEW3D_MT_edit_mesh_normals,
- VIEW3D_MT_edit_mesh_showhide,
- VIEW3D_MT_edit_mesh_extrude, # use with VIEW3D_OT_edit_mesh_extrude_menu
-
- VIEW3D_MT_edit_curve,
- VIEW3D_MT_edit_curve_ctrlpoints,
- VIEW3D_MT_edit_curve_segments,
- VIEW3D_MT_edit_curve_specials,
- VIEW3D_MT_edit_curve_showhide,
-
- VIEW3D_MT_edit_surface,
-
- VIEW3D_MT_edit_text,
- VIEW3D_MT_edit_text_chars,
-
- VIEW3D_MT_edit_meta,
- VIEW3D_MT_edit_meta_showhide,
-
- VIEW3D_MT_edit_lattice,
-
- VIEW3D_MT_edit_armature,
- VIEW3D_MT_edit_armature_parent,
- VIEW3D_MT_edit_armature_roll,
-
- VIEW3D_MT_armature_specials, # Only as a menu for keybindings
-
- # Panels
- VIEW3D_PT_view3d_properties,
- VIEW3D_PT_view3d_display,
- VIEW3D_PT_view3d_name,
- VIEW3D_PT_view3d_meshdisplay,
- VIEW3D_PT_view3d_curvedisplay,
- VIEW3D_PT_background_image,
- VIEW3D_PT_transform_orientations,
- VIEW3D_PT_etch_a_ton,
- VIEW3D_PT_context_properties]
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py
index 515fa236fc0..9769107a5c9 100644
--- a/release/scripts/ui/space_view3d_toolbar.py
+++ b/release/scripts/ui/space_view3d_toolbar.py
@@ -19,9 +19,8 @@
# <pep8 compliant>
import bpy
-narrowui = bpy.context.user_preferences.view.properties_width_check
-class View3DPanel(bpy.types.Panel):
+class View3DPanel():
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
@@ -29,7 +28,7 @@ class View3DPanel(bpy.types.Panel):
# ********** default tools for objectmode ****************
-class VIEW3D_PT_tools_objectmode(View3DPanel):
+class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel):
bl_context = "objectmode"
bl_label = "Object Tools"
@@ -79,7 +78,7 @@ class VIEW3D_PT_tools_objectmode(View3DPanel):
# ********** default tools for editmode_mesh ****************
-class VIEW3D_PT_tools_meshedit(View3DPanel):
+class VIEW3D_PT_tools_meshedit(View3DPanel, bpy.types.Panel):
bl_context = "mesh_edit"
bl_label = "Mesh Tools"
@@ -147,7 +146,7 @@ class VIEW3D_PT_tools_meshedit(View3DPanel):
row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
-class VIEW3D_PT_tools_meshedit_options(View3DPanel):
+class VIEW3D_PT_tools_meshedit_options(View3DPanel, bpy.types.Panel):
bl_context = "mesh_edit"
bl_label = "Mesh Options"
@@ -166,7 +165,7 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel):
# ********** default tools for editmode_curve ****************
-class VIEW3D_PT_tools_curveedit(View3DPanel):
+class VIEW3D_PT_tools_curveedit(View3DPanel, bpy.types.Panel):
bl_context = "curve_edit"
bl_label = "Curve Tools"
@@ -220,7 +219,7 @@ class VIEW3D_PT_tools_curveedit(View3DPanel):
# ********** default tools for editmode_surface ****************
-class VIEW3D_PT_tools_surfaceedit(View3DPanel):
+class VIEW3D_PT_tools_surfaceedit(View3DPanel, bpy.types.Panel):
bl_context = "surface_edit"
bl_label = "Surface Tools"
@@ -260,7 +259,7 @@ class VIEW3D_PT_tools_surfaceedit(View3DPanel):
# ********** default tools for editmode_text ****************
-class VIEW3D_PT_tools_textedit(View3DPanel):
+class VIEW3D_PT_tools_textedit(View3DPanel, bpy.types.Panel):
bl_context = "text_edit"
bl_label = "Text Tools"
@@ -293,7 +292,7 @@ class VIEW3D_PT_tools_textedit(View3DPanel):
# ********** default tools for editmode_armature ****************
-class VIEW3D_PT_tools_armatureedit(View3DPanel):
+class VIEW3D_PT_tools_armatureedit(View3DPanel, bpy.types.Panel):
bl_context = "armature_edit"
bl_label = "Armature Tools"
@@ -330,7 +329,7 @@ class VIEW3D_PT_tools_armatureedit(View3DPanel):
row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
-class VIEW3D_PT_tools_armatureedit_options(View3DPanel):
+class VIEW3D_PT_tools_armatureedit_options(View3DPanel, bpy.types.Panel):
bl_context = "armature_edit"
bl_label = "Armature Options"
@@ -340,12 +339,12 @@ class VIEW3D_PT_tools_armatureedit_options(View3DPanel):
arm = context.active_object.data
col = layout.column(align=True)
- col.prop(arm, "x_axis_mirror")
+ col.prop(arm, "use_mirror_x")
# ********** default tools for editmode_mball ****************
-class VIEW3D_PT_tools_mballedit(View3DPanel):
+class VIEW3D_PT_tools_mballedit(View3DPanel, bpy.types.Panel):
bl_context = "mball_edit"
bl_label = "Meta Tools"
@@ -373,7 +372,7 @@ class VIEW3D_PT_tools_mballedit(View3DPanel):
# ********** default tools for editmode_lattice ****************
-class VIEW3D_PT_tools_latticeedit(View3DPanel):
+class VIEW3D_PT_tools_latticeedit(View3DPanel, bpy.types.Panel):
bl_context = "lattice_edit"
bl_label = "Lattice Tools"
@@ -405,7 +404,7 @@ class VIEW3D_PT_tools_latticeedit(View3DPanel):
# ********** default tools for posemode ****************
-class VIEW3D_PT_tools_posemode(View3DPanel):
+class VIEW3D_PT_tools_posemode(View3DPanel, bpy.types.Panel):
bl_context = "posemode"
bl_label = "Pose Tools"
@@ -453,7 +452,7 @@ class VIEW3D_PT_tools_posemode(View3DPanel):
row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
-class VIEW3D_PT_tools_posemode_options(View3DPanel):
+class VIEW3D_PT_tools_posemode_options(View3DPanel, bpy.types.Panel):
bl_context = "posemode"
bl_label = "Pose Options"
@@ -463,17 +462,18 @@ class VIEW3D_PT_tools_posemode_options(View3DPanel):
arm = context.active_object.data
col = layout.column(align=True)
- col.prop(arm, "x_axis_mirror")
- col.prop(arm, "auto_ik")
+ col.prop(arm, "use_mirror_x")
+ col.prop(arm, "use_auto_ik")
# ********** default tools for paint modes ****************
-class PaintPanel(bpy.types.Panel):
+class PaintPanel():
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
- def paint_settings(self, context):
+ @staticmethod
+ def paint_settings(context):
ts = context.tool_settings
if context.sculpt_object:
@@ -487,43 +487,25 @@ class PaintPanel(bpy.types.Panel):
elif context.particle_edit_object:
return ts.particle_edit
- return False
+ return None
-class VIEW3D_PT_tools_brush(PaintPanel):
+class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
bl_label = "Brush"
- def poll(self, context):
- return self.paint_settings(context)
+ @classmethod
+ def poll(cls, context):
+ return cls.paint_settings(context)
def draw(self, context):
layout = self.layout
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
if not context.particle_edit_object:
col = layout.split().column()
-
- if context.sculpt_object and context.tool_settings.sculpt:
- col.template_ID_preview(settings, "brush", new="brush.add", filter="is_sculpt_brush", rows=3, cols=8)
- elif context.texture_paint_object and context.tool_settings.image_paint:
- col.template_ID_preview(settings, "brush", new="brush.add", filter="is_imapaint_brush", rows=3, cols=8)
- elif context.vertex_paint_object and context.tool_settings.vertex_paint:
- col.template_ID_preview(settings, "brush", new="brush.add", filter="is_vpaint_brush", rows=3, cols=8)
- elif context.weight_paint_object and context.tool_settings.weight_paint:
- col.template_ID_preview(settings, "brush", new="brush.add", filter="is_wpaint_brush", rows=3, cols=8)
- else:
- row = col.row()
-
- if context.sculpt_object and brush:
- defaultbrushes = 8
- elif context.texture_paint_object and brush:
- defaultbrushes = 4
- else:
- defaultbrushes = 7
-
- row.template_list(settings, "brushes", settings, "active_brush_index", rows=2, maxrows=defaultbrushes)
+ col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
# Particle Mode #
@@ -541,11 +523,11 @@ class VIEW3D_PT_tools_brush(PaintPanel):
if settings.tool == 'ADD':
col.prop(brush, "count")
col = layout.column()
- col.prop(settings, "add_interpolate")
+ col.prop(settings, "use_default_interpolate")
sub = col.column(align=True)
- sub.active = settings.add_interpolate
+ sub.active = settings.use_default_interpolate
sub.prop(brush, "steps", slider=True)
- sub.prop(settings, "add_keys", slider=True)
+ sub.prop(settings, "default_key_count", slider=True)
elif settings.tool == 'LENGTH':
layout.prop(brush, "length_mode", expand=True)
elif settings.tool == 'PUFF':
@@ -555,7 +537,6 @@ class VIEW3D_PT_tools_brush(PaintPanel):
# Sculpt Mode #
elif context.sculpt_object and brush:
- edit = context.user_preferences.edit
col = layout.column()
@@ -564,23 +545,14 @@ class VIEW3D_PT_tools_brush(PaintPanel):
row = col.row(align=True)
- if edit.sculpt_paint_use_unified_size:
- if edit.sculpt_paint_unified_lock_brush_size:
- row.prop(edit, "sculpt_paint_unified_lock_brush_size", toggle=True, text="", icon='LOCKED')
- row.prop(edit, "sculpt_paint_unified_unprojected_radius", text="Unified Radius", slider=True)
- else:
- row.prop(edit, "sculpt_paint_unified_lock_brush_size", toggle=True, text="", icon='UNLOCKED')
- row.prop(edit, "sculpt_paint_unified_size", text="Unified Radius", slider=True)
-
+ if brush.use_locked_size:
+ row.prop(brush, "use_locked_size", toggle=True, text="", icon='LOCKED')
+ row.prop(brush, "unprojected_radius", text="Radius", slider=True)
else:
- if brush.lock_brush_size:
- row.prop(brush, "lock_brush_size", toggle=True, text="", icon='LOCKED')
- row.prop(brush, "unprojected_radius", text="Radius", slider=True)
- else:
- row.prop(brush, "lock_brush_size", toggle=True, text="", icon='UNLOCKED')
- row.prop(brush, "size", text="Radius", slider=True)
+ row.prop(brush, "use_locked_size", toggle=True, text="", icon='UNLOCKED')
+ row.prop(brush, "size", text="Radius", slider=True)
- row.prop(brush, "use_size_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_size", toggle=True, text="")
if brush.sculpt_tool not in ('SNAKE_HOOK', 'GRAB', 'ROTATE'):
@@ -594,12 +566,8 @@ class VIEW3D_PT_tools_brush(PaintPanel):
else:
row.prop(brush, "use_space_atten", toggle=True, text="", icon='UNLOCKED')
- if edit.sculpt_paint_use_unified_strength:
- row.prop(edit, "sculpt_paint_unified_strength", text="Unified Strength", slider=True)
- else:
- row.prop(brush, "strength", text="Strength", slider=True)
-
- row.prop(brush, "use_strength_pressure", text="")
+ row.prop(brush, "strength", text="Strength", slider=True)
+ row.prop(brush, "use_pressure_strength", text="")
@@ -607,7 +575,7 @@ class VIEW3D_PT_tools_brush(PaintPanel):
col.separator()
row = col.row(align=True)
- row.prop(brush, "autosmooth_factor", slider=True)
+ row.prop(brush, "auto_smooth_factor", slider=True)
row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
@@ -657,29 +625,9 @@ class VIEW3D_PT_tools_brush(PaintPanel):
row= col.row()
row.prop(brush, "use_frontface", text="Front Faces Only")
- #if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'LAYER', 'CLAY', 'CLAY_TUBES'):
- if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'LAYER', 'CLAY'):
- col.separator()
- col.row().prop(brush, "direction", expand=True)
- elif brush.sculpt_tool in ('FLATTEN'):
- col.separator()
- col.row().prop(brush, "flatten_contrast", expand=True)
- elif brush.sculpt_tool in ('FILL'):
- col.separator()
- col.row().prop(brush, "fill_deepen", expand=True)
- elif brush.sculpt_tool in ('SCRAPE'):
- col.separator()
- col.row().prop(brush, "scrape_peaks", expand=True)
- elif brush.sculpt_tool in ('INFLATE'):
- col.separator()
- col.row().prop(brush, "inflate_deflate", expand=True)
- elif brush.sculpt_tool in ('PINCH'):
- col.separator()
- col.row().prop(brush, "pinch_magnify", expand=True)
-
-
+ col.separator()
+ col.row().prop(brush, "direction", expand=True)
- #if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY', 'CLAY_TUBES'):
if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'):
col.separator()
@@ -710,16 +658,16 @@ class VIEW3D_PT_tools_brush(PaintPanel):
col.prop(brush, "color", text="")
row = col.row(align=True)
- row.prop(brush, "size", slider=True)
- row.prop(brush, "use_size_pressure", toggle=True, text="")
+ row.prop(brush, "size", text="Radius", slider=True)
+ row.prop(brush, "use_pressure_size", toggle=True, text="")
row = col.row(align=True)
- row.prop(brush, "strength", slider=True)
- row.prop(brush, "use_strength_pressure", toggle=True, text="")
+ row.prop(brush, "strength", text="Strength", slider=True)
+ row.prop(brush, "use_pressure_strength", toggle=True, text="")
row = col.row(align=True)
row.prop(brush, "jitter", slider=True)
- row.prop(brush, "use_jitter_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_jitter", toggle=True, text="")
col.prop(brush, "blend", text="Blend")
@@ -732,20 +680,21 @@ class VIEW3D_PT_tools_brush(PaintPanel):
elif context.weight_paint_object and brush:
layout.prop(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
- layout.prop(context.tool_settings, "auto_normalize", text="Auto Normalize")
+ layout.prop(context.tool_settings, "use_auto_normalize", text="Auto Normalize")
col = layout.column()
+
row = col.row(align=True)
- row.prop(brush, "size", slider=True)
- row.prop(brush, "use_size_pressure", toggle=True, text="")
+ row.prop(brush, "size", text="Radius", slider=True)
+ row.prop(brush, "use_pressure_size", toggle=True, text="")
row = col.row(align=True)
- row.prop(brush, "strength", slider=True)
- row.prop(brush, "use_strength_pressure", toggle=True, text="")
+ row.prop(brush, "strength", text="Strength", slider=True)
+ row.prop(brush, "use_pressure_strength", toggle=True, text="")
row = col.row(align=True)
row.prop(brush, "jitter", slider=True)
- row.prop(brush, "use_jitter_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_jitter", toggle=True, text="")
# Vertex Paint Mode #
@@ -755,32 +704,33 @@ class VIEW3D_PT_tools_brush(PaintPanel):
col.prop(brush, "color", text="")
row = col.row(align=True)
- row.prop(brush, "size", slider=True)
- row.prop(brush, "use_size_pressure", toggle=True, text="")
+ row.prop(brush, "size", text="Radius", slider=True)
+ row.prop(brush, "use_pressure_size", toggle=True, text="")
row = col.row(align=True)
- row.prop(brush, "strength", slider=True)
- row.prop(brush, "use_strength_pressure", toggle=True, text="")
+ row.prop(brush, "strength", text="Strength", slider=True)
+ row.prop(brush, "use_pressure_strength", toggle=True, text="")
# XXX - TODO
#row = col.row(align=True)
#row.prop(brush, "jitter", slider=True)
- #row.prop(brush, "use_jitter_pressure", toggle=True, text="")
+ #row.prop(brush, "use_pressure_jitter", toggle=True, text="")
-class VIEW3D_PT_tools_brush_texture(PaintPanel):
+class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
bl_label = "Texture"
bl_default_closed = True
- def poll(self, context):
- settings = self.paint_settings(context)
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
return (settings and settings.brush and (context.sculpt_object or
context.texture_paint_object))
def draw(self, context):
layout = self.layout
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
tex_slot = brush.texture_slot
@@ -791,7 +741,6 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel):
if context.sculpt_object:
#XXX duplicated from properties_texture.py
- wide_ui = context.region.width > narrowui
col.separator()
@@ -804,12 +753,12 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel):
col.separator()
col = layout.column()
- col.active = tex_slot.map_mode in ('FIXED')
+ col.active = tex_slot.map_mode in ('FIXED', )
col.label(text="Angle:")
col = layout.column()
if not brush.use_anchor and brush.sculpt_tool not in ('GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE') and tex_slot.map_mode in ('FIXED'):
- col.prop(brush, "texture_angle_source", text="")
+ col.prop(brush, "texture_angle_source_random", text="")
else:
col.prop(brush, "texture_angle_source_no_random", text="")
@@ -836,10 +785,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel):
col = split.column()
col.prop(tex_slot, "offset")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
col.prop(tex_slot, "size")
@@ -870,12 +816,13 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel):
col.active = tex_slot.map_mode in ('FIXED', 'TILED') and brush.use_texture_overlay
-class VIEW3D_PT_tools_brush_tool(PaintPanel):
+class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
bl_label = "Tool"
bl_default_closed = True
- def poll(self, context):
- settings = self.paint_settings(context)
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
return (settings and settings.brush and
(context.sculpt_object or context.texture_paint_object or
context.vertex_paint_object or context.weight_paint_object))
@@ -883,7 +830,7 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel):
def draw(self, context):
layout = self.layout
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
texture_paint = context.texture_paint_object
sculpt = context.sculpt_object
@@ -892,18 +839,26 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel):
if context.sculpt_object:
col.prop(brush, "sculpt_tool", expand=False, text="")
+ col.operator("brush.reset")
elif context.texture_paint_object:
col.prop(brush, "imagepaint_tool", expand=False, text="")
elif context.vertex_paint_object or context.weight_paint_object:
col.prop(brush, "vertexpaint_tool", expand=False, text="")
+ row = layout.row(align=True)
+ row.prop(brush, "use_paint_sculpt", text="", icon='SCULPTMODE_HLT')
+ row.prop(brush, "use_paint_vertex", text="", icon='VPAINT_HLT')
+ row.prop(brush, "use_paint_weight", text="", icon='WPAINT_HLT')
+ row.prop(brush, "use_paint_texture", text="", icon='TPAINT_HLT')
-class VIEW3D_PT_tools_brush_stroke(PaintPanel):
+
+class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
bl_label = "Stroke"
bl_default_closed = True
- def poll(self, context):
- settings = self.paint_settings(context)
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
return (settings and settings.brush and (context.sculpt_object or
context.vertex_paint_object or
context.weight_paint_object or
@@ -912,7 +867,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel):
def draw(self, context):
layout = self.layout
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
texture_paint = context.texture_paint_object
@@ -925,7 +880,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel):
if brush.use_anchor:
col.separator()
row = col.row()
- row.prop(brush, "edge_to_edge", "Edge To Edge")
+ row.prop(brush, "use_edge_to_edge", "Edge To Edge")
if brush.use_airbrush:
col.separator()
@@ -938,7 +893,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel):
row.active = brush.use_space
row.prop(brush, "spacing", text="Spacing")
- if brush.sculpt_tool not in ('GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE') and (not brush.use_anchor) and (not brush.restore_mesh):
+ if brush.sculpt_tool not in ('GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE') and (not brush.use_anchor) and (not brush.use_restore_mesh):
col = layout.column()
col.separator()
@@ -953,7 +908,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel):
row = col.row(align=True)
row.prop(brush, "jitter", slider=True)
- row.prop(brush, "use_jitter_pressure", toggle=True, text="")
+ row.prop(brush, "use_pressure_jitter", toggle=True, text="")
else:
row = col.row()
@@ -992,21 +947,23 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel):
#col.separator()
#if texture_paint:
- # row.prop(brush, "use_spacing_pressure", toggle=True, text="")
+ # row.prop(brush, "use_pressure_spacing", toggle=True, text="")
-class VIEW3D_PT_tools_brush_curve(PaintPanel):
+class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
bl_label = "Curve"
bl_default_closed = True
- def poll(self, context):
- settings = self.paint_settings(context)
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
return (settings and settings.brush and settings.brush.curve)
def draw(self, context):
layout = self.layout
settings = self.paint_settings(context)
+
brush = settings.brush
layout.template_curve_mapping(brush, "curve", brush=True)
@@ -1018,37 +975,38 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel):
row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP'
row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
- row.operator("brush.curve_preset", icon="RNDCURVE", text="").shape = 'MID9'
-class VIEW3D_PT_sculpt_options(PaintPanel):
+
+class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
bl_label = "Options"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.sculpt_object and context.tool_settings.sculpt)
def draw(self, context):
layout = self.layout
- wide_ui = context.region.width > narrowui
- sculpt = context.tool_settings.sculpt
- settings = self.paint_settings(context)
+ tool_settings = context.tool_settings
+ sculpt = tool_settings.sculpt
+ settings = __class__.paint_settings(context)
brush = settings.brush
split = layout.split()
col = split.column()
- edit = context.user_preferences.edit
+ col.prop(sculpt, "use_threaded", text="Threaded Sculpt")
+ col.prop(sculpt, "show_low_resolution")
+ col.prop(sculpt, "show_brush")
+
col.label(text="Unified Settings:")
- col.prop(edit, "sculpt_paint_use_unified_size", text="Size")
- col.prop(edit, "sculpt_paint_use_unified_strength", text="Strength")
+ col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+ col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
col.label(text="Lock:")
row = col.row(align=True)
@@ -1056,20 +1014,22 @@ class VIEW3D_PT_sculpt_options(PaintPanel):
row.prop(sculpt, "lock_y", text="Y", toggle=True)
row.prop(sculpt, "lock_z", text="Z", toggle=True)
-class VIEW3D_PT_sculpt_symmetry(PaintPanel):
+
+
+class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
bl_label = "Symmetry"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.sculpt_object and context.tool_settings.sculpt)
def draw(self, context):
- wide_ui = context.region.width > narrowui
layout = self.layout
sculpt = context.tool_settings.sculpt
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
split = layout.split()
@@ -1077,16 +1037,13 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel):
col = split.column()
col.label(text="Mirror:")
- col.prop(sculpt, "symmetry_x", text="X")
- col.prop(sculpt, "symmetry_y", text="Y")
- col.prop(sculpt, "symmetry_z", text="Z")
+ col.prop(sculpt, "use_symmetry_x", text="X")
+ col.prop(sculpt, "use_symmetry_y", text="Y")
+ col.prop(sculpt, "use_symmetry_z", text="Z")
- if wide_ui:
- col = split.column()
- else:
- col.separator()
+ col = split.column()
- col.prop(sculpt, "radial_symm", text="Radial")
+ col.prop(sculpt, "radial_symmetry", text="Radial")
col = layout.column()
@@ -1094,41 +1051,46 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel):
col.prop(sculpt, "use_symmetry_feather", text="Feather")
-class VIEW3D_PT_tools_brush_appearance(PaintPanel):
+class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
bl_label = "Appearance"
bl_default_closed = True
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.sculpt_object and context.tool_settings.sculpt) or (context.vertex_paint_object and context.tool_settings.vertex_paint) or (context.weight_paint_object and context.tool_settings.weight_paint) or (context.texture_paint_object and context.tool_settings.image_paint)
def draw(self, context):
layout = self.layout
sculpt = context.tool_settings.sculpt
- settings = self.paint_settings(context)
+ settings = __class__.paint_settings(context)
brush = settings.brush
col = layout.column();
if context.sculpt_object and context.tool_settings.sculpt:
- #if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'CLAY_TUBES', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN'):
- if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN'):
- col.prop(brush, "add_col", text="Add Color")
- col.prop(brush, "sub_col", text="Substract Color")
+ #if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE', 'CLAY_TUBES'):
+ if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE'):
+ col.prop(brush, "cursor_color_add", text="Add Color")
+ col.prop(brush, "cursor_color_subtract", text="Subtract Color")
else:
- col.prop(brush, "add_col", text="Color")
-
- col.separator()
+ col.prop(brush, "cursor_color_add", text="Color")
+ else:
+ col.prop(brush, "cursor_color_add", text="Color")
col = layout.column()
col.label(text="Icon:")
- #col.template_ID_preview(brush, "image_icon", open="image.open", filter="is_image_icon", rows=3, cols=8)
- col.template_ID_preview(brush, "image_icon", open="image.open", rows=3, cols=8)
+
+ row = col.row(align=True)
+ row.prop(brush, "use_custom_icon")
+ if brush.use_custom_icon:
+ row = col.row(align=True)
+ row.prop(brush, "icon_filepath", text="")
# ********** default tools for weightpaint ****************
-class VIEW3D_PT_tools_weightpaint(View3DPanel):
+class VIEW3D_PT_tools_weightpaint(View3DPanel, bpy.types.Panel):
bl_context = "weightpaint"
bl_label = "Weight Tools"
@@ -1143,19 +1105,20 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel):
col.operator("object.vertex_group_levels", text="Levels")
-class VIEW3D_PT_tools_weightpaint_options(View3DPanel):
+class VIEW3D_PT_tools_weightpaint_options(View3DPanel, bpy.types.Panel):
bl_context = "weightpaint"
bl_label = "Options"
def draw(self, context):
layout = self.layout
- wpaint = context.tool_settings.weight_paint
+ tool_settings = context.tool_settings
+ wpaint = tool_settings.weight_paint
col = layout.column()
- col.prop(wpaint, "all_faces")
- col.prop(wpaint, "normals")
- col.prop(wpaint, "spray")
+ col.prop(wpaint, "use_all_faces")
+ col.prop(wpaint, "use_normal")
+ col.prop(wpaint, "use_spray")
obj = context.weight_paint_object
if obj.type == 'MESH':
@@ -1163,6 +1126,10 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel):
col.prop(mesh, "use_mirror_x")
col.prop(mesh, "use_mirror_topology")
+ col.label(text="Unified Settings:")
+ col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+ col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+
# Commented out because the Apply button isn't an operator yet, making these settings useless
# col.label(text="Gamma:")
# col.prop(wpaint, "gamma", text="")
@@ -1175,20 +1142,25 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel):
# ********** default tools for vertexpaint ****************
-class VIEW3D_PT_tools_vertexpaint(View3DPanel):
+class VIEW3D_PT_tools_vertexpaint(View3DPanel, bpy.types.Panel):
bl_context = "vertexpaint"
bl_label = "Options"
def draw(self, context):
layout = self.layout
- vpaint = context.tool_settings.vertex_paint
+ tool_settings = context.tool_settings
+ vpaint = tool_settings.vertex_paint
col = layout.column()
#col.prop(vpaint, "mode", text="")
- col.prop(vpaint, "all_faces")
- col.prop(vpaint, "normals")
- col.prop(vpaint, "spray")
+ col.prop(vpaint, "use_all_faces")
+ col.prop(vpaint, "use_normal")
+ col.prop(vpaint, "use_spray")
+
+ col.label(text="Unified Settings:")
+ col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+ col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
# Commented out because the Apply button isn't an operator yet, making these settings useless
# col.label(text="Gamma:")
@@ -1199,12 +1171,14 @@ class VIEW3D_PT_tools_vertexpaint(View3DPanel):
# ********** default tools for texturepaint ****************
-class VIEW3D_PT_tools_projectpaint(View3DPanel):
+class VIEW3D_PT_tools_projectpaint(View3DPanel, bpy.types.Panel):
bl_context = "texturepaint"
bl_label = "Project Paint"
- def poll(self, context):
- return context.tool_settings.image_paint.brush.imagepaint_tool != 'SMEAR'
+ @classmethod
+ def poll(cls, context):
+ brush = context.tool_settings.image_paint.brush
+ return (brush and brush.imagepaint_tool != 'SMEAR')
def draw_header(self, context):
ipaint = context.tool_settings.image_paint
@@ -1222,7 +1196,7 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel):
sub = col.column()
sub.active = use_projection
sub.prop(ipaint, "use_occlude")
- sub.prop(ipaint, "use_backface_cull")
+ sub.prop(ipaint, "use_backface_culling")
split = layout.split()
@@ -1268,6 +1242,24 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel):
sub.operator("image.save_dirty", text="Save All Edited")
+class VIEW3D_PT_imagepaint_options(PaintPanel):
+ bl_label = "Options"
+ bl_default_closed = True
+
+ @classmethod
+ def poll(cls, context):
+ return (context.texture_paint_object and context.tool_settings.image_paint)
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column()
+
+ tool_settings = context.tool_settings
+ col.label(text="Unified Settings:")
+ col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+ col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+
class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu):
bl_label = "Clone Layer"
@@ -1290,7 +1282,7 @@ class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu):
prop.value = i
-class VIEW3D_PT_tools_particlemode(View3DPanel):
+class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel):
'''default tools for particle mode'''
bl_context = "particlemode"
bl_label = "Options"
@@ -1316,89 +1308,53 @@ class VIEW3D_PT_tools_particlemode(View3DPanel):
if md.type == pe.type:
ptcache = md.point_cache
- if ptcache and len(ptcache.point_cache_list) > 1:
- layout.template_list(ptcache, "point_cache_list", ptcache, "active_point_cache_index", type='ICONS')
+ if ptcache and len(ptcache.point_caches) > 1:
+ layout.template_list(ptcache, "point_caches", ptcache, "active_point_cache_index", type='ICONS')
- if not pe.editable:
+ if not pe.is_editable:
layout.label(text="Point cache must be baked")
layout.label(text="to enable editing!")
col = layout.column(align=True)
- if pe.hair:
- col.active = pe.editable
- col.prop(pe, "emitter_deflect", text="Deflect emitter")
+ if pe.is_hair:
+ col.active = pe.is_editable
+ col.prop(pe, "use_emitter_deflect", text="Deflect emitter")
sub = col.row()
- sub.active = pe.emitter_deflect
+ sub.active = pe.use_emitter_deflect
sub.prop(pe, "emitter_distance", text="Distance")
col = layout.column(align=True)
- col.active = pe.editable
+ col.active = pe.is_editable
col.label(text="Keep:")
- col.prop(pe, "keep_lengths", text="Lenghts")
- col.prop(pe, "keep_root", text="Root")
- if not pe.hair:
+ col.prop(pe, "use_preserve_length", text="Lengths")
+ col.prop(pe, "use_preserve_root", text="Root")
+ if not pe.is_hair:
col.label(text="Correct:")
- col.prop(pe, "auto_velocity", text="Velocity")
+ col.prop(pe, "use_auto_velocity", text="Velocity")
col.prop(ob.data, "use_mirror_x")
col = layout.column(align=True)
- col.active = pe.editable
+ col.active = pe.is_editable
col.label(text="Draw:")
col.prop(pe, "draw_step", text="Path Steps")
- if pe.hair:
- col.prop(pe, "draw_particles", text="Children")
+ if pe.is_hair:
+ col.prop(pe, "show_particles", text="Children")
else:
if pe.type == 'PARTICLES':
- col.prop(pe, "draw_particles", text="Particles")
- col.prop(pe, "fade_time")
+ col.prop(pe, "show_particles", text="Particles")
+ col.prop(pe, "use_fade_time")
sub = col.row()
- sub.active = pe.fade_time
+ sub.active = pe.use_fade_time
sub.prop(pe, "fade_frames", slider=True)
-classes = [
- VIEW3D_PT_tools_weightpaint,
- VIEW3D_PT_tools_objectmode,
- VIEW3D_PT_tools_meshedit,
- VIEW3D_PT_tools_meshedit_options,
- VIEW3D_PT_tools_curveedit,
- VIEW3D_PT_tools_surfaceedit,
- VIEW3D_PT_tools_textedit,
- VIEW3D_PT_tools_armatureedit,
- VIEW3D_PT_tools_armatureedit_options,
- VIEW3D_PT_tools_mballedit,
- VIEW3D_PT_tools_latticeedit,
- VIEW3D_PT_tools_posemode,
- VIEW3D_PT_tools_posemode_options,
- VIEW3D_PT_tools_brush,
- VIEW3D_PT_tools_brush_texture,
- VIEW3D_PT_tools_brush_stroke,
- VIEW3D_PT_tools_brush_curve,
- VIEW3D_PT_tools_brush_appearance,
- VIEW3D_PT_tools_brush_tool,
- VIEW3D_PT_sculpt_symmetry,
- VIEW3D_PT_sculpt_options,
- VIEW3D_PT_tools_vertexpaint,
- VIEW3D_PT_tools_weightpaint_options,
-
- VIEW3D_PT_tools_projectpaint,
- VIEW3D_MT_tools_projectpaint_clone,
- VIEW3D_MT_tools_projectpaint_stencil,
-
- VIEW3D_PT_tools_particlemode]
-
-
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()
diff --git a/release/text/copyright.txt b/release/text/copyright.txt
index 9f49dd4587a..207d6f54ea8 100644
--- a/release/text/copyright.txt
+++ b/release/text/copyright.txt
@@ -1,6 +1,6 @@
This version of Blender has been originally released at www.blender.org.
- It is subject to the GPL license, which is part of this download.
+ It is subject to the GNU GPL license, which is part of this download.
For more information please review the Blender source code distribution,
which should be available at the same location as where you obtained
this version.
@@ -14,14 +14,12 @@
License Agreement accompanies (the "Software").
By installing, copying or otherwise using the Software, You agree to be
- bound by the terms of this License Agreement. If You do not agree to the
- terms of this License Agreement do not install or use the Software.
+ bound by the terms of this License Agreement.
1. Grant of License
- Subject to the provisions of this License Agreement, BF grants You a
- limited, non-exclusive, personal, non-sublicenseable, non-transferable
- license to use the Software at any computer You own or use.
+ Subject to the provisions of the GNU GPL license, BF grants You a
+ non-exclusive right to use the Software at any computer You own or use.
Artwork you create with the Software - whether it is images, movies,
scripts, exported 3d files or the .blend files themselves - is your sole
property, and can be licensed or sold under any conditions you prefer.
@@ -76,25 +74,8 @@
out of or in connection with (i) the use of the Software by You and (ii)
the use of any Works created with the Software by You or any third
parties.
-
- 6. Term and Termination
-
- This License Agreement and the license granted hereunder is effective
- until terminated. This License Agreement shall terminate automatically
- and forthwith if You fail to comply with the terms of this License
- Agreement. Upon termination, You shall cease the use of the Software,
- remove the Software from (the memory of) your computer and destroy all
- copies of the Software.
-
- 7. Entire Agreement
-
- This License Agreement is the entire agreement between BF and You in
- respect of the subject matter of the License Agreement. This License
- Agreement supersedes all prior written or oral agreements, proposals or
- understandings, and any other communications between BF and You
- relating to the subject matter of this License Agreement.
-
- 8. Enforceability
+
+ 6. Enforceability
If any provision of this License Agreement is held to be unenforceable
by a court of competent jurisdiction for any reason, such provision
@@ -102,7 +83,7 @@
enforceable, and the remainder of the License Agreement shall remain in
effect.
- 9. Governing law and disputes
+ 7. Governing law and disputes
This License Agreement and all disputes arising from it will be governed
by the laws of The Netherlands. All disputes arising in connection with
diff --git a/release/text/readme.html b/release/text/readme.html
index 1da4b62a73e..1b14c63e14a 100644
--- a/release/text/readme.html
+++ b/release/text/readme.html
@@ -12,23 +12,23 @@
</style>
</head>
<body>
-<p class="title"><b>Blender 2.5 Alpha 2</b></p>
+<p class="title"><b>Blender 2.5 Beta</b></p>
<p><br></p>
<p class="header"><b>About</b></p>
<p class="body">Welcome to Blender, the free, open source 3D application for modeling, animation, rendering, compositing, video editing and game creation. Blender is available for Linux, Mac OS X, Windows, Solaris and Irix and has a large world-wide community.</p>
<p class="body">Blender can be used freely for any purpose, including commercial use and distribution. It's free and open-source software, released under the GNU GPL licence. The entire source code is available on our website.</p>
<p class="body">For more information, visit <a href="http://www.blender.org">blender.org</a>.</p>
<p><br></p>
-<p class="header"><b>2.5 Alpha 2</b></p>
-<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.5 Alpha 2. This release is the third official testing release of the Blender 2.5 series, and represents the culmination of many years of redesign and development work. <a href="http://www.blender.org/development/release-logs/blender-250/">More information about this release</a>.</p>
+<p class="header"><b>2.5 Beta</b></p>
+<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.5 Beta. This release is the third official testing release of the Blender 2.5 series, and represents the culmination of many years of redesign and development work. <a href="http://www.blender.org/development/release-logs/blender-250/">More information about this release</a>.</p>
<p class="body">What to Expect:</p>
<p class="body"> • Big improvements - This is our most exciting version to date, already a significant improvement in many ways over 2.49</p>
<p class="body"> • Missing/Incomplete Features - Although most of it is there, not all functionality from pre-2.5 versions has been restored yet. Some functionality may be re-implemented a different way.</p>
-<p class="body"> • Bugs - We've fixed a lot lately, but there are still quite a few bugs. This is alpha software, we're still working on it!</p>
+<p class="body"> • Bugs - We've fixed a lot lately, but there are still quite a few bugs. This is beta software, we're still working on it!</p>
<p class="body"> • Changes - If you're used to the old Blenders, Blender 2.5 may seem quite different at first, but it won't be long before it grows on you even more than before.</p>
<p><br></p>
<p class="header"><b>Bugs</b></p>
-<p class="body">Blender 2.5 Alpha 2 is unfinished software. If you encounter a bug, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender 2.5. If it wasn’t reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
+<p class="body">Blender 2.5 Beta is unfinished software. If you encounter a bug, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender 2.5. If it wasn’t reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
<p><br></p>
<p class="header"><b>Package Contents</b></p>
<p class="body">The downloaded Blender package includes:</p>